@intlayer/core 8.1.2 → 8.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (408) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -29
  2. package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs +1 -212
  3. package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -1
  4. package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs +1 -94
  5. package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -1
  6. package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs +1 -45
  7. package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -1
  8. package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs +1 -33
  9. package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs.map +1 -1
  10. package/dist/cjs/deepTransformPlugins/getMaskContent.cjs +1 -27
  11. package/dist/cjs/deepTransformPlugins/getMaskContent.cjs.map +1 -1
  12. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +1 -82
  13. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -1
  14. package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs +1 -87
  15. package/dist/cjs/deepTransformPlugins/getMultilingualDictionary.cjs.map +1 -1
  16. package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs +1 -60
  17. package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs.map +1 -1
  18. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs +1 -122
  19. package/dist/cjs/deepTransformPlugins/getSplittedContent.cjs.map +1 -1
  20. package/dist/cjs/deepTransformPlugins/index.cjs +1 -32
  21. package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs +1 -106
  22. package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -1
  23. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +1 -64
  24. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
  25. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +1 -18
  26. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
  27. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +1 -55
  28. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
  29. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +1 -26
  30. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
  31. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +1 -23
  32. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
  33. package/dist/cjs/dictionaryManipulator/getNodeType.cjs +1 -36
  34. package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
  35. package/dist/cjs/dictionaryManipulator/index.cjs +1 -27
  36. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +1 -69
  37. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -1
  38. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs +1 -30
  39. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -1
  40. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +1 -48
  41. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -1
  42. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +1 -31
  43. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
  44. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +1 -39
  45. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
  46. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +1 -38
  47. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
  48. package/dist/cjs/formatters/compact.cjs +1 -25
  49. package/dist/cjs/formatters/compact.cjs.map +1 -1
  50. package/dist/cjs/formatters/currency.cjs +1 -29
  51. package/dist/cjs/formatters/currency.cjs.map +1 -1
  52. package/dist/cjs/formatters/date.cjs +1 -60
  53. package/dist/cjs/formatters/date.cjs.map +1 -1
  54. package/dist/cjs/formatters/index.cjs +1 -18
  55. package/dist/cjs/formatters/list.cjs +1 -30
  56. package/dist/cjs/formatters/list.cjs.map +1 -1
  57. package/dist/cjs/formatters/number.cjs +1 -18
  58. package/dist/cjs/formatters/number.cjs.map +1 -1
  59. package/dist/cjs/formatters/percentage.cjs +1 -25
  60. package/dist/cjs/formatters/percentage.cjs.map +1 -1
  61. package/dist/cjs/formatters/relativeTime.cjs +1 -33
  62. package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
  63. package/dist/cjs/formatters/units.cjs +1 -23
  64. package/dist/cjs/formatters/units.cjs.map +1 -1
  65. package/dist/cjs/getStorageAttributes.cjs +1 -134
  66. package/dist/cjs/getStorageAttributes.cjs.map +1 -1
  67. package/dist/cjs/index.cjs +1 -300
  68. package/dist/cjs/interpreter/getCondition.cjs +1 -27
  69. package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
  70. package/dist/cjs/interpreter/getContent/deepTransform.cjs +1 -41
  71. package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
  72. package/dist/cjs/interpreter/getContent/getContent.cjs +1 -34
  73. package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
  74. package/dist/cjs/interpreter/getContent/index.cjs +1 -14
  75. package/dist/cjs/interpreter/getContent/plugins.cjs +1 -161
  76. package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
  77. package/dist/cjs/interpreter/getDictionary.cjs +1 -24
  78. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  79. package/dist/cjs/interpreter/getEnumeration.cjs +1 -72
  80. package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
  81. package/dist/cjs/interpreter/getGender.cjs +1 -38
  82. package/dist/cjs/interpreter/getGender.cjs.map +1 -1
  83. package/dist/cjs/interpreter/getHTML.cjs +1 -121
  84. package/dist/cjs/interpreter/getHTML.cjs.map +1 -1
  85. package/dist/cjs/interpreter/getInsertion.cjs +1 -22
  86. package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
  87. package/dist/cjs/interpreter/getIntlayer.cjs +1 -40
  88. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  89. package/dist/cjs/interpreter/getNesting.cjs +1 -36
  90. package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
  91. package/dist/cjs/interpreter/getTranslation.cjs +1 -112
  92. package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
  93. package/dist/cjs/interpreter/index.cjs +1 -31
  94. package/dist/cjs/interpreter/splitAndJoinInsertion.cjs +1 -55
  95. package/dist/cjs/interpreter/splitAndJoinInsertion.cjs.map +1 -1
  96. package/dist/cjs/localization/getBrowserLocale.cjs +1 -143
  97. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -1
  98. package/dist/cjs/localization/getHTMLTextDir.cjs +1 -64
  99. package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
  100. package/dist/cjs/localization/getLocale.cjs +1 -27
  101. package/dist/cjs/localization/getLocale.cjs.map +1 -1
  102. package/dist/cjs/localization/getLocaleFromPath.cjs +1 -45
  103. package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
  104. package/dist/cjs/localization/getLocaleLang.cjs +1 -20
  105. package/dist/cjs/localization/getLocaleLang.cjs.map +1 -1
  106. package/dist/cjs/localization/getLocaleName.cjs +1 -10
  107. package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
  108. package/dist/cjs/localization/getLocalizedUrl.cjs +1 -82
  109. package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
  110. package/dist/cjs/localization/getMultilingualUrls.cjs +1 -63
  111. package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
  112. package/dist/cjs/localization/getPathWithoutLocale.cjs +1 -55
  113. package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
  114. package/dist/cjs/localization/getPrefix.cjs +1 -63
  115. package/dist/cjs/localization/getPrefix.cjs.map +1 -1
  116. package/dist/cjs/localization/index.cjs +1 -39
  117. package/dist/cjs/localization/localeDetector.cjs +1 -133
  118. package/dist/cjs/localization/localeDetector.cjs.map +1 -1
  119. package/dist/cjs/localization/localeMapper.cjs +1 -119
  120. package/dist/cjs/localization/localeMapper.cjs.map +1 -1
  121. package/dist/cjs/localization/localeResolver.cjs +1 -28
  122. package/dist/cjs/localization/localeResolver.cjs.map +1 -1
  123. package/dist/cjs/localization/rewriteUtils.cjs +1 -110
  124. package/dist/cjs/localization/rewriteUtils.cjs.map +1 -1
  125. package/dist/cjs/localization/validatePrefix.cjs +1 -54
  126. package/dist/cjs/localization/validatePrefix.cjs.map +1 -1
  127. package/dist/cjs/markdown/compiler.cjs +10 -810
  128. package/dist/cjs/markdown/compiler.cjs.map +1 -1
  129. package/dist/cjs/markdown/constants.cjs +1 -328
  130. package/dist/cjs/markdown/constants.cjs.map +1 -1
  131. package/dist/cjs/markdown/index.cjs +1 -120
  132. package/dist/cjs/markdown/parser.cjs +1 -66
  133. package/dist/cjs/markdown/parser.cjs.map +1 -1
  134. package/dist/cjs/markdown/renderer.cjs +1 -61
  135. package/dist/cjs/markdown/renderer.cjs.map +1 -1
  136. package/dist/cjs/markdown/utils.cjs +6 -391
  137. package/dist/cjs/markdown/utils.cjs.map +1 -1
  138. package/dist/cjs/messageFormat/ICU.cjs +1 -319
  139. package/dist/cjs/messageFormat/ICU.cjs.map +1 -1
  140. package/dist/cjs/messageFormat/i18next.cjs +1 -330
  141. package/dist/cjs/messageFormat/i18next.cjs.map +1 -1
  142. package/dist/cjs/messageFormat/index.cjs +1 -11
  143. package/dist/cjs/messageFormat/verify-icu-format.cjs +2 -64
  144. package/dist/cjs/messageFormat/verify-icu-format.cjs.map +1 -1
  145. package/dist/cjs/messageFormat/vue-i18n.cjs +1 -166
  146. package/dist/cjs/messageFormat/vue-i18n.cjs.map +1 -1
  147. package/dist/cjs/transpiler/condition/condition.cjs +1 -26
  148. package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
  149. package/dist/cjs/transpiler/condition/index.cjs +1 -4
  150. package/dist/cjs/transpiler/enumeration/enumeration.cjs +1 -28
  151. package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
  152. package/dist/cjs/transpiler/enumeration/index.cjs +1 -4
  153. package/dist/cjs/transpiler/file/file.cjs +1 -52
  154. package/dist/cjs/transpiler/file/file.cjs.map +1 -1
  155. package/dist/cjs/transpiler/file/fileBrowser.cjs +1 -25
  156. package/dist/cjs/transpiler/file/fileBrowser.cjs.map +1 -1
  157. package/dist/cjs/transpiler/file/index.cjs +1 -5
  158. package/dist/cjs/transpiler/gender/gender.cjs +1 -26
  159. package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
  160. package/dist/cjs/transpiler/gender/index.cjs +1 -4
  161. package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs +1 -44
  162. package/dist/cjs/transpiler/html/getHTMLCustomComponents.cjs.map +1 -1
  163. package/dist/cjs/transpiler/html/html.cjs +1 -37
  164. package/dist/cjs/transpiler/html/html.cjs.map +1 -1
  165. package/dist/cjs/transpiler/html/htmlTags.cjs +1 -116
  166. package/dist/cjs/transpiler/html/htmlTags.cjs.map +1 -1
  167. package/dist/cjs/transpiler/html/index.cjs +1 -6
  168. package/dist/cjs/transpiler/index.cjs +1 -24
  169. package/dist/cjs/transpiler/insertion/getInsertionValues.cjs +1 -11
  170. package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
  171. package/dist/cjs/transpiler/insertion/index.cjs +1 -6
  172. package/dist/cjs/transpiler/insertion/insertion.cjs +1 -36
  173. package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
  174. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +2 -23
  175. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
  176. package/dist/cjs/transpiler/markdown/index.cjs +1 -6
  177. package/dist/cjs/transpiler/markdown/markdown.cjs +1 -54
  178. package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
  179. package/dist/cjs/transpiler/nesting/index.cjs +1 -4
  180. package/dist/cjs/transpiler/nesting/nesting.cjs +1 -27
  181. package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
  182. package/dist/cjs/transpiler/translation/index.cjs +1 -4
  183. package/dist/cjs/transpiler/translation/translation.cjs +1 -29
  184. package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
  185. package/dist/cjs/utils/checkIsURLAbsolute.cjs +1 -7
  186. package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -1
  187. package/dist/cjs/utils/getCookie.cjs +1 -32
  188. package/dist/cjs/utils/getCookie.cjs.map +1 -1
  189. package/dist/cjs/utils/index.cjs +1 -0
  190. package/dist/cjs/utils/intl.cjs +1 -91
  191. package/dist/cjs/utils/intl.cjs.map +1 -1
  192. package/dist/cjs/utils/isSameKeyPath.cjs +1 -7
  193. package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
  194. package/dist/cjs/utils/isValidReactElement.cjs +1 -14
  195. package/dist/cjs/utils/isValidReactElement.cjs.map +1 -1
  196. package/dist/cjs/utils/localeStorage.cjs +1 -140
  197. package/dist/cjs/utils/localeStorage.cjs.map +1 -1
  198. package/dist/cjs/utils/parseYaml.cjs +16 -322
  199. package/dist/cjs/utils/parseYaml.cjs.map +1 -1
  200. package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs +1 -207
  201. package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs.map +1 -1
  202. package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs +1 -89
  203. package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs.map +1 -1
  204. package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs +1 -42
  205. package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +1 -1
  206. package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs +1 -31
  207. package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +1 -1
  208. package/dist/esm/deepTransformPlugins/getMaskContent.mjs +1 -25
  209. package/dist/esm/deepTransformPlugins/getMaskContent.mjs.map +1 -1
  210. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs +1 -77
  211. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -1
  212. package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs +1 -86
  213. package/dist/esm/deepTransformPlugins/getMultilingualDictionary.mjs.map +1 -1
  214. package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs +1 -59
  215. package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs.map +1 -1
  216. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs +1 -119
  217. package/dist/esm/deepTransformPlugins/getSplittedContent.mjs.map +1 -1
  218. package/dist/esm/deepTransformPlugins/index.mjs +1 -12
  219. package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs +1 -104
  220. package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs.map +1 -1
  221. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +1 -62
  222. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
  223. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +1 -16
  224. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
  225. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +1 -53
  226. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
  227. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +1 -24
  228. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
  229. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +1 -21
  230. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
  231. package/dist/esm/dictionaryManipulator/getNodeType.mjs +1 -34
  232. package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
  233. package/dist/esm/dictionaryManipulator/index.mjs +1 -14
  234. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +1 -66
  235. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -1
  236. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs +1 -28
  237. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -1
  238. package/dist/esm/dictionaryManipulator/orderDictionaries.mjs +1 -45
  239. package/dist/esm/dictionaryManipulator/orderDictionaries.mjs.map +1 -1
  240. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +1 -29
  241. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
  242. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +1 -37
  243. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
  244. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +1 -36
  245. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
  246. package/dist/esm/formatters/compact.mjs +1 -22
  247. package/dist/esm/formatters/compact.mjs.map +1 -1
  248. package/dist/esm/formatters/currency.mjs +1 -26
  249. package/dist/esm/formatters/currency.mjs.map +1 -1
  250. package/dist/esm/formatters/date.mjs +1 -57
  251. package/dist/esm/formatters/date.mjs.map +1 -1
  252. package/dist/esm/formatters/index.mjs +1 -10
  253. package/dist/esm/formatters/list.mjs +1 -27
  254. package/dist/esm/formatters/list.mjs.map +1 -1
  255. package/dist/esm/formatters/number.mjs +1 -15
  256. package/dist/esm/formatters/number.mjs.map +1 -1
  257. package/dist/esm/formatters/percentage.mjs +1 -22
  258. package/dist/esm/formatters/percentage.mjs.map +1 -1
  259. package/dist/esm/formatters/relativeTime.mjs +1 -30
  260. package/dist/esm/formatters/relativeTime.mjs.map +1 -1
  261. package/dist/esm/formatters/units.mjs +1 -20
  262. package/dist/esm/formatters/units.mjs.map +1 -1
  263. package/dist/esm/getStorageAttributes.mjs +1 -132
  264. package/dist/esm/getStorageAttributes.mjs.map +1 -1
  265. package/dist/esm/index.mjs +1 -82
  266. package/dist/esm/interpreter/getCondition.mjs +1 -25
  267. package/dist/esm/interpreter/getCondition.mjs.map +1 -1
  268. package/dist/esm/interpreter/getContent/deepTransform.mjs +1 -39
  269. package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
  270. package/dist/esm/interpreter/getContent/getContent.mjs +1 -31
  271. package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
  272. package/dist/esm/interpreter/getContent/index.mjs +1 -5
  273. package/dist/esm/interpreter/getContent/plugins.mjs +1 -153
  274. package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
  275. package/dist/esm/interpreter/getDictionary.mjs +1 -23
  276. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  277. package/dist/esm/interpreter/getEnumeration.mjs +1 -69
  278. package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
  279. package/dist/esm/interpreter/getGender.mjs +1 -36
  280. package/dist/esm/interpreter/getGender.mjs.map +1 -1
  281. package/dist/esm/interpreter/getHTML.mjs +1 -119
  282. package/dist/esm/interpreter/getHTML.mjs.map +1 -1
  283. package/dist/esm/interpreter/getInsertion.mjs +1 -20
  284. package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
  285. package/dist/esm/interpreter/getIntlayer.mjs +1 -36
  286. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  287. package/dist/esm/interpreter/getNesting.mjs +1 -35
  288. package/dist/esm/interpreter/getNesting.mjs.map +1 -1
  289. package/dist/esm/interpreter/getTranslation.mjs +1 -110
  290. package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
  291. package/dist/esm/interpreter/index.mjs +1 -13
  292. package/dist/esm/interpreter/splitAndJoinInsertion.mjs +1 -53
  293. package/dist/esm/interpreter/splitAndJoinInsertion.mjs.map +1 -1
  294. package/dist/esm/localization/getBrowserLocale.mjs +1 -138
  295. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -1
  296. package/dist/esm/localization/getHTMLTextDir.mjs +1 -62
  297. package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
  298. package/dist/esm/localization/getLocale.mjs +1 -24
  299. package/dist/esm/localization/getLocale.mjs.map +1 -1
  300. package/dist/esm/localization/getLocaleFromPath.mjs +1 -42
  301. package/dist/esm/localization/getLocaleFromPath.mjs.map +1 -1
  302. package/dist/esm/localization/getLocaleLang.mjs +1 -18
  303. package/dist/esm/localization/getLocaleLang.mjs.map +1 -1
  304. package/dist/esm/localization/getLocaleName.mjs +1 -9
  305. package/dist/esm/localization/getLocaleName.mjs.map +1 -1
  306. package/dist/esm/localization/getLocalizedUrl.mjs +1 -79
  307. package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
  308. package/dist/esm/localization/getMultilingualUrls.mjs +1 -60
  309. package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
  310. package/dist/esm/localization/getPathWithoutLocale.mjs +1 -52
  311. package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
  312. package/dist/esm/localization/getPrefix.mjs +1 -60
  313. package/dist/esm/localization/getPrefix.mjs.map +1 -1
  314. package/dist/esm/localization/index.mjs +1 -17
  315. package/dist/esm/localization/localeDetector.mjs +1 -131
  316. package/dist/esm/localization/localeDetector.mjs.map +1 -1
  317. package/dist/esm/localization/localeMapper.mjs +1 -114
  318. package/dist/esm/localization/localeMapper.mjs.map +1 -1
  319. package/dist/esm/localization/localeResolver.mjs +1 -25
  320. package/dist/esm/localization/localeResolver.mjs.map +1 -1
  321. package/dist/esm/localization/rewriteUtils.mjs +1 -104
  322. package/dist/esm/localization/rewriteUtils.mjs.map +1 -1
  323. package/dist/esm/localization/validatePrefix.mjs +1 -51
  324. package/dist/esm/localization/validatePrefix.mjs.map +1 -1
  325. package/dist/esm/markdown/compiler.mjs +10 -786
  326. package/dist/esm/markdown/compiler.mjs.map +1 -1
  327. package/dist/esm/markdown/constants.mjs +1 -247
  328. package/dist/esm/markdown/constants.mjs.map +1 -1
  329. package/dist/esm/markdown/index.mjs +1 -7
  330. package/dist/esm/markdown/parser.mjs +1 -65
  331. package/dist/esm/markdown/parser.mjs.map +1 -1
  332. package/dist/esm/markdown/renderer.mjs +1 -59
  333. package/dist/esm/markdown/renderer.mjs.map +1 -1
  334. package/dist/esm/markdown/utils.mjs +6 -361
  335. package/dist/esm/markdown/utils.mjs.map +1 -1
  336. package/dist/esm/messageFormat/ICU.mjs +1 -316
  337. package/dist/esm/messageFormat/ICU.mjs.map +1 -1
  338. package/dist/esm/messageFormat/i18next.mjs +1 -327
  339. package/dist/esm/messageFormat/i18next.mjs.map +1 -1
  340. package/dist/esm/messageFormat/index.mjs +1 -5
  341. package/dist/esm/messageFormat/verify-icu-format.mjs +2 -64
  342. package/dist/esm/messageFormat/verify-icu-format.mjs.map +1 -1
  343. package/dist/esm/messageFormat/vue-i18n.mjs +1 -163
  344. package/dist/esm/messageFormat/vue-i18n.mjs.map +1 -1
  345. package/dist/esm/transpiler/condition/condition.mjs +1 -24
  346. package/dist/esm/transpiler/condition/condition.mjs.map +1 -1
  347. package/dist/esm/transpiler/condition/index.mjs +1 -3
  348. package/dist/esm/transpiler/enumeration/enumeration.mjs +1 -26
  349. package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -1
  350. package/dist/esm/transpiler/enumeration/index.mjs +1 -3
  351. package/dist/esm/transpiler/file/file.mjs +1 -49
  352. package/dist/esm/transpiler/file/file.mjs.map +1 -1
  353. package/dist/esm/transpiler/file/fileBrowser.mjs +1 -24
  354. package/dist/esm/transpiler/file/fileBrowser.mjs.map +1 -1
  355. package/dist/esm/transpiler/file/index.mjs +1 -3
  356. package/dist/esm/transpiler/gender/gender.mjs +1 -24
  357. package/dist/esm/transpiler/gender/gender.mjs.map +1 -1
  358. package/dist/esm/transpiler/gender/index.mjs +1 -3
  359. package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs +1 -43
  360. package/dist/esm/transpiler/html/getHTMLCustomComponents.mjs.map +1 -1
  361. package/dist/esm/transpiler/html/html.mjs +1 -35
  362. package/dist/esm/transpiler/html/html.mjs.map +1 -1
  363. package/dist/esm/transpiler/html/htmlTags.mjs +1 -114
  364. package/dist/esm/transpiler/html/htmlTags.mjs.map +1 -1
  365. package/dist/esm/transpiler/html/index.mjs +1 -4
  366. package/dist/esm/transpiler/index.mjs +1 -13
  367. package/dist/esm/transpiler/insertion/getInsertionValues.mjs +1 -9
  368. package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
  369. package/dist/esm/transpiler/insertion/index.mjs +1 -4
  370. package/dist/esm/transpiler/insertion/insertion.mjs +1 -34
  371. package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
  372. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +2 -22
  373. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
  374. package/dist/esm/transpiler/markdown/index.mjs +1 -4
  375. package/dist/esm/transpiler/markdown/markdown.mjs +1 -52
  376. package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -1
  377. package/dist/esm/transpiler/nesting/index.mjs +1 -3
  378. package/dist/esm/transpiler/nesting/nesting.mjs +1 -25
  379. package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -1
  380. package/dist/esm/transpiler/translation/index.mjs +1 -3
  381. package/dist/esm/transpiler/translation/translation.mjs +1 -27
  382. package/dist/esm/transpiler/translation/translation.mjs.map +1 -1
  383. package/dist/esm/utils/checkIsURLAbsolute.mjs +1 -5
  384. package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -1
  385. package/dist/esm/utils/getCookie.mjs +1 -30
  386. package/dist/esm/utils/getCookie.mjs.map +1 -1
  387. package/dist/esm/utils/index.mjs +1 -0
  388. package/dist/esm/utils/intl.mjs +1 -86
  389. package/dist/esm/utils/intl.mjs.map +1 -1
  390. package/dist/esm/utils/isSameKeyPath.mjs +1 -5
  391. package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
  392. package/dist/esm/utils/isValidReactElement.mjs +1 -12
  393. package/dist/esm/utils/isValidReactElement.mjs.map +1 -1
  394. package/dist/esm/utils/localeStorage.mjs +1 -135
  395. package/dist/esm/utils/localeStorage.mjs.map +1 -1
  396. package/dist/esm/utils/parseYaml.mjs +16 -320
  397. package/dist/esm/utils/parseYaml.mjs.map +1 -1
  398. package/dist/types/formatters/index.d.ts +2 -1
  399. package/dist/types/index.d.ts +8 -2
  400. package/dist/types/interpreter/getContent/plugins.d.ts +4 -4
  401. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  402. package/dist/types/localization/index.d.ts +2 -1
  403. package/dist/types/markdown/index.d.ts +4 -1
  404. package/dist/types/markdown/types.d.ts +1 -1
  405. package/dist/types/markdown/types.d.ts.map +1 -1
  406. package/dist/types/transpiler/translation/translation.d.ts +1 -1
  407. package/dist/types/utils/index.d.ts +8 -0
  408. package/package.json +65 -11
@@ -1,164 +1,2 @@
1
- import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
- import { enu as enumeration } from "../transpiler/enumeration/enumeration.mjs";
3
- import { insert as insertion } from "../transpiler/insertion/insertion.mjs";
4
- import { NodeType } from "@intlayer/types";
5
-
6
- //#region src/messageFormat/vue-i18n.ts
7
- const parseVueI18nPart = (text) => {
8
- let index = 0;
9
- const nodes = [];
10
- let currentText = "";
11
- while (index < text.length) {
12
- const char = text[index];
13
- if (char === "{") {
14
- if (currentText) {
15
- nodes.push(currentText);
16
- currentText = "";
17
- }
18
- index++;
19
- let name = "";
20
- while (index < text.length && text[index] !== "}") {
21
- name += text[index];
22
- index++;
23
- }
24
- if (index < text.length) index++;
25
- nodes.push({
26
- type: "argument",
27
- name: name.trim()
28
- });
29
- } else {
30
- currentText += char;
31
- index++;
32
- }
33
- }
34
- if (currentText) nodes.push(currentText);
35
- return nodes;
36
- };
37
- const parseVueI18n = (text) => {
38
- const parts = [];
39
- let currentPart = "";
40
- let index = 0;
41
- while (index < text.length) {
42
- const char = text[index];
43
- if (char === "\\" && index + 1 < text.length && text[index + 1] === "|") {
44
- currentPart += "|";
45
- index += 2;
46
- } else if (char === "|") {
47
- parts.push(currentPart.trim());
48
- currentPart = "";
49
- index++;
50
- } else {
51
- currentPart += char;
52
- index++;
53
- }
54
- }
55
- parts.push(currentPart.trim());
56
- return parts.map(parseVueI18nPart);
57
- };
58
- const vueI18nPartToIntlayer = (nodes) => {
59
- if (nodes.length === 0) return "";
60
- if (nodes.length === 1 && typeof nodes[0] === "string") return nodes[0];
61
- let str = "";
62
- for (const node of nodes) if (typeof node === "string") str += node;
63
- else str += `{{${node.name}}}`;
64
- return insertion(str);
65
- };
66
- const vueI18nNodesToIntlayer = (parts) => {
67
- if (parts.length === 1) return vueI18nPartToIntlayer(parts[0]);
68
- const options = {};
69
- const varName = "count";
70
- if (parts.length === 2) {
71
- options["1"] = vueI18nPartToIntlayer(parts[0]);
72
- options.fallback = vueI18nPartToIntlayer(parts[1]);
73
- } else if (parts.length === 3) {
74
- options["0"] = vueI18nPartToIntlayer(parts[0]);
75
- options["1"] = vueI18nPartToIntlayer(parts[1]);
76
- options.fallback = vueI18nPartToIntlayer(parts[2]);
77
- } else parts.forEach((part, index) => {
78
- if (index === parts.length - 1) options.fallback = vueI18nPartToIntlayer(part);
79
- else options[index.toString()] = vueI18nPartToIntlayer(part);
80
- });
81
- options.__intlayer_vue_i18n_var = varName;
82
- return enumeration(options);
83
- };
84
- const vueI18nToIntlayerPlugin = {
85
- canHandle: (node) => typeof node === "string" && (node.includes("{") || node.includes("|")),
86
- transform: (node) => {
87
- try {
88
- return vueI18nNodesToIntlayer(parseVueI18n(node));
89
- } catch {
90
- return node;
91
- }
92
- }
93
- };
94
- const intlayerToVueI18nPlugin = {
95
- canHandle: (node) => typeof node === "string" || node && typeof node === "object" && (node.nodeType === NodeType.Insertion || node.nodeType === NodeType.Enumeration || node.nodeType === NodeType.Gender || node.nodeType === "composite") || Array.isArray(node),
96
- transform: (node, props, next) => {
97
- if (typeof node === "string") return node.replace(/\{\{([^}]+)\}\}/g, "{$1}");
98
- if (node.nodeType === NodeType.Insertion) return node.insertion.replace(/\{\{([^}]+)\}\}/g, "{$1}");
99
- if (node.nodeType === NodeType.Enumeration) {
100
- const options = node.enumeration;
101
- const transformedOptions = {};
102
- for (const [key, val] of Object.entries(options)) {
103
- if (key === "__intlayer_vue_i18n_var") continue;
104
- const childVal = next(val, props);
105
- transformedOptions[key] = typeof childVal === "string" ? childVal : JSON.stringify(childVal);
106
- }
107
- const keys = Object.keys(transformedOptions);
108
- if (keys.includes("0")) {
109
- const indices = keys.filter((key) => /^\d+$/.test(key)).map(Number);
110
- const maxIndex = Math.max(...indices);
111
- const fallback = transformedOptions.fallback || transformedOptions.other;
112
- const resultParts = [];
113
- if (maxIndex <= 1 && !keys.includes("2")) return `${transformedOptions["0"] || ""} | ${transformedOptions["1"] || ""} | ${fallback}`;
114
- const limit = Math.max(1, maxIndex);
115
- for (let i = 0; i <= limit; i++) {
116
- const key = i.toString();
117
- if (transformedOptions[key]) resultParts.push(transformedOptions[key]);
118
- else resultParts.push("");
119
- }
120
- resultParts.push(fallback);
121
- return resultParts.join(" | ").replace(/ \| {2}\| /g, " | | ");
122
- }
123
- if (keys.includes("1") && (keys.includes("fallback") || keys.includes("other"))) return `${transformedOptions["1"]} | ${transformedOptions.fallback || transformedOptions.other}`;
124
- if (keys.length === 1 && (keys.includes("fallback") || keys.includes("other"))) return transformedOptions.fallback || transformedOptions.other;
125
- return transformedOptions.fallback || Object.values(transformedOptions)[0];
126
- }
127
- if (node.nodeType === NodeType.Gender) {
128
- const options = node.gender;
129
- const transformedOptions = {};
130
- for (const [key, val] of Object.entries(options)) {
131
- let newKey = key;
132
- if (key === "fallback") newKey = "other";
133
- transformedOptions[newKey] = next(val, props);
134
- }
135
- return transformedOptions;
136
- }
137
- if (Array.isArray(node) || node.nodeType === "composite" && Array.isArray(node.composite)) return (Array.isArray(node) ? node : node.composite).map((item) => next(item, props)).join("");
138
- return next(node, props);
139
- }
140
- };
141
- const intlayerToVueI18nFormatter = (message) => {
142
- return deepTransformNode(message, {
143
- dictionaryKey: "vue-i18n",
144
- keyPath: [],
145
- plugins: [{
146
- id: "vue-i18n",
147
- ...intlayerToVueI18nPlugin
148
- }]
149
- });
150
- };
151
- const vueI18nToIntlayerFormatter = (message) => {
152
- return deepTransformNode(message, {
153
- dictionaryKey: "vue-i18n",
154
- keyPath: [],
155
- plugins: [{
156
- id: "vue-i18n",
157
- ...vueI18nToIntlayerPlugin
158
- }]
159
- });
160
- };
161
-
162
- //#endregion
163
- export { intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter };
1
+ import{deepTransformNode as e}from"../interpreter/getContent/deepTransform.mjs";import{enu as t}from"../transpiler/enumeration/enumeration.mjs";import{insert as n}from"../transpiler/insertion/insertion.mjs";import{NodeType as r}from"@intlayer/types";const i=e=>{let t=0,n=[],r=``;for(;t<e.length;){let i=e[t];if(i===`{`){r&&=(n.push(r),``),t++;let i=``;for(;t<e.length&&e[t]!==`}`;)i+=e[t],t++;t<e.length&&t++,n.push({type:`argument`,name:i.trim()})}else r+=i,t++}return r&&n.push(r),n},a=e=>{let t=[],n=``,r=0;for(;r<e.length;){let i=e[r];i===`\\`&&r+1<e.length&&e[r+1]===`|`?(n+=`|`,r+=2):i===`|`?(t.push(n.trim()),n=``,r++):(n+=i,r++)}return t.push(n.trim()),t.map(i)},o=e=>{if(e.length===0)return``;if(e.length===1&&typeof e[0]==`string`)return e[0];let t=``;for(let n of e)typeof n==`string`?t+=n:t+=`{{${n.name}}}`;return n(t)},s=e=>{if(e.length===1)return o(e[0]);let n={};return e.length===2?(n[1]=o(e[0]),n.fallback=o(e[1])):e.length===3?(n[0]=o(e[0]),n[1]=o(e[1]),n.fallback=o(e[2])):e.forEach((t,r)=>{r===e.length-1?n.fallback=o(t):n[r.toString()]=o(t)}),n.__intlayer_vue_i18n_var=`count`,t(n)},c={canHandle:e=>typeof e==`string`&&(e.includes(`{`)||e.includes(`|`)),transform:e=>{try{return s(a(e))}catch{return e}}},l={canHandle:e=>typeof e==`string`||e&&typeof e==`object`&&(e.nodeType===r.Insertion||e.nodeType===r.Enumeration||e.nodeType===r.Gender||e.nodeType===`composite`)||Array.isArray(e),transform:(e,t,n)=>{if(typeof e==`string`)return e.replace(/\{\{([^}]+)\}\}/g,`{$1}`);if(e.nodeType===r.Insertion)return e.insertion.replace(/\{\{([^}]+)\}\}/g,`{$1}`);if(e.nodeType===r.Enumeration){let r=e.enumeration,i={};for(let[e,a]of Object.entries(r)){if(e===`__intlayer_vue_i18n_var`)continue;let r=n(a,t);i[e]=typeof r==`string`?r:JSON.stringify(r)}let a=Object.keys(i);if(a.includes(`0`)){let e=a.filter(e=>/^\d+$/.test(e)).map(Number),t=Math.max(...e),n=i.fallback||i.other,r=[];if(t<=1&&!a.includes(`2`))return`${i[0]||``} | ${i[1]||``} | ${n}`;let o=Math.max(1,t);for(let e=0;e<=o;e++){let t=e.toString();i[t]?r.push(i[t]):r.push(``)}return r.push(n),r.join(` | `).replace(/ \| {2}\| /g,` | | `)}return a.includes(`1`)&&(a.includes(`fallback`)||a.includes(`other`))?`${i[1]} | ${i.fallback||i.other}`:a.length===1&&(a.includes(`fallback`)||a.includes(`other`))?i.fallback||i.other:i.fallback||Object.values(i)[0]}if(e.nodeType===r.Gender){let r=e.gender,i={};for(let[e,a]of Object.entries(r)){let r=e;e===`fallback`&&(r=`other`),i[r]=n(a,t)}return i}return Array.isArray(e)||e.nodeType===`composite`&&Array.isArray(e.composite)?(Array.isArray(e)?e:e.composite).map(e=>n(e,t)).join(``):n(e,t)}},u=t=>e(t,{dictionaryKey:`vue-i18n`,keyPath:[],plugins:[{id:`vue-i18n`,...l}]}),d=t=>e(t,{dictionaryKey:`vue-i18n`,keyPath:[],plugins:[{id:`vue-i18n`,...c}]});export{u as intlayerToVueI18nFormatter,d as vueI18nToIntlayerFormatter};
164
2
  //# sourceMappingURL=vue-i18n.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"vue-i18n.mjs","names":["insert","enu"],"sources":["../../../src/messageFormat/vue-i18n.ts"],"sourcesContent":["import { type Dictionary, NodeType } from '@intlayer/types';\nimport { deepTransformNode } from '../interpreter';\nimport { enu, insert } from '../transpiler';\nimport type { JsonValue } from './ICU';\n\n// Types for our AST\ntype VueI18nNode =\n | string\n | {\n type: 'argument';\n name: string;\n };\n\nconst parseVueI18nPart = (text: string): VueI18nNode[] => {\n let index = 0;\n const nodes: VueI18nNode[] = [];\n let currentText = '';\n\n while (index < text.length) {\n const char = text[index];\n\n if (char === '{') {\n if (currentText) {\n nodes.push(currentText);\n currentText = '';\n }\n index++; // skip {\n let name = '';\n while (index < text.length && text[index] !== '}') {\n name += text[index];\n index++;\n }\n if (index < text.length) {\n index++; // skip }\n }\n nodes.push({ type: 'argument', name: name.trim() });\n } else {\n currentText += char;\n index++;\n }\n }\n\n if (currentText) {\n nodes.push(currentText);\n }\n\n return nodes;\n};\n\nconst parseVueI18n = (text: string): VueI18nNode[][] => {\n // Split by | but handle escaped \\|\n const parts: string[] = [];\n let currentPart = '';\n let index = 0;\n\n while (index < text.length) {\n const char = text[index];\n if (char === '\\\\' && index + 1 < text.length && text[index + 1] === '|') {\n currentPart += '|';\n index += 2;\n } else if (char === '|') {\n parts.push(currentPart.trim()); // Trim to remove surrounding spaces\n currentPart = '';\n index++;\n } else {\n currentPart += char;\n index++;\n }\n }\n parts.push(currentPart.trim()); // Trim last part too\n\n return parts.map(parseVueI18nPart);\n};\n\nconst vueI18nPartToIntlayer = (nodes: VueI18nNode[]): any => {\n if (nodes.length === 0) return '';\n if (nodes.length === 1 && typeof nodes[0] === 'string') return nodes[0];\n\n let str = '';\n for (const node of nodes) {\n if (typeof node === 'string') {\n str += node;\n } else {\n str += `{{${node.name}}}`;\n }\n }\n return insert(str);\n};\n\nconst vueI18nNodesToIntlayer = (parts: VueI18nNode[][]): any => {\n if (parts.length === 1) {\n return vueI18nPartToIntlayer(parts[0]);\n }\n\n // Handle pluralization (choice)\n const options: Record<string, any> = {};\n const varName = 'count'; // Default variable for vue-i18n choices\n\n if (parts.length === 2) {\n // 2 choices: 1 | other\n options['1'] = vueI18nPartToIntlayer(parts[0]);\n options.fallback = vueI18nPartToIntlayer(parts[1]);\n } else if (parts.length === 3) {\n // 3 choices: 0 | 1 | other\n options['0'] = vueI18nPartToIntlayer(parts[0]);\n options['1'] = vueI18nPartToIntlayer(parts[1]);\n options.fallback = vueI18nPartToIntlayer(parts[2]);\n } else {\n // > 3 choices: 0 | 1 | 2 | ... | other\n parts.forEach((part, index) => {\n if (index === parts.length - 1) {\n options.fallback = vueI18nPartToIntlayer(part);\n } else {\n options[index.toString()] = vueI18nPartToIntlayer(part);\n }\n });\n }\n\n // Preserve variable name\n options.__intlayer_vue_i18n_var = varName;\n\n return enu(options);\n};\n\nconst vueI18nToIntlayerPlugin = {\n canHandle: (node: any) =>\n typeof node === 'string' && (node.includes('{') || node.includes('|')),\n transform: (node: any) => {\n try {\n const ast = parseVueI18n(node);\n return vueI18nNodesToIntlayer(ast);\n } catch {\n return node;\n }\n },\n};\n\nconst intlayerToVueI18nPlugin = {\n canHandle: (node: any) =>\n typeof node === 'string' ||\n (node &&\n typeof node === 'object' &&\n (node.nodeType === NodeType.Insertion ||\n node.nodeType === NodeType.Enumeration ||\n node.nodeType === NodeType.Gender ||\n node.nodeType === 'composite')) ||\n Array.isArray(node),\n transform: (node: any, props: any, next: any) => {\n if (typeof node === 'string') {\n // replace {{...}} with {...} even in strings\n return node.replace(/\\{\\{([^}]+)\\}\\}/g, '{$1}');\n }\n\n if (node.nodeType === NodeType.Insertion) {\n // {{name}} -> {name}\n return node.insertion.replace(/\\{\\{([^}]+)\\}\\}/g, '{$1}');\n }\n\n if (node.nodeType === NodeType.Enumeration) {\n const options = node.enumeration;\n\n const transformedOptions: Record<string, string> = {};\n for (const [key, val] of Object.entries(options)) {\n if (key === '__intlayer_vue_i18n_var') continue;\n const childVal = next(val, props);\n transformedOptions[key] =\n typeof childVal === 'string' ? childVal : JSON.stringify(childVal);\n }\n\n // We need to reconstruct the pipe-separated string.\n // 2 parts: 1, fallback\n // 3 parts: 0, 1, fallback\n\n const keys = Object.keys(transformedOptions);\n\n // Heuristic to decide format\n // Use loose condition for 3 parts: if 0 exists, OR if 2 exists, etc.\n // But typically 0, 1, 2...\n // If '0' is present, we likely want the 3+ parts format.\n if (keys.includes('0')) {\n const indices = keys.filter((key) => /^\\d+$/.test(key)).map(Number);\n const maxIndex = Math.max(...indices);\n\n const fallback =\n transformedOptions.fallback || transformedOptions.other;\n const resultParts = [];\n\n // Check if we can use simple 3-part: 0 | 1 | fallback\n // Only if maxIndex <= 1\n if (maxIndex <= 1 && !keys.includes('2')) {\n const zero = transformedOptions['0'] || '';\n const one = transformedOptions['1'] || ''; // Gap handling?\n return `${zero} | ${one} | ${fallback}`;\n }\n\n // General case: loop until maxIndex\n const limit = Math.max(1, maxIndex);\n\n for (let i = 0; i <= limit; i++) {\n const key = i.toString();\n if (transformedOptions[key]) {\n resultParts.push(transformedOptions[key]);\n } else {\n resultParts.push(''); // Empty string for gaps\n }\n }\n resultParts.push(fallback);\n return resultParts.join(' | ').replace(/ \\| {2}\\| /g, ' | | ');\n }\n\n // 2 parts: 1 | fallback\n if (\n keys.includes('1') &&\n (keys.includes('fallback') || keys.includes('other'))\n ) {\n return `${transformedOptions['1']} | ${transformedOptions.fallback || transformedOptions.other}`;\n }\n\n // Fallback for only fallback?\n if (\n keys.length === 1 &&\n (keys.includes('fallback') || keys.includes('other'))\n ) {\n return transformedOptions.fallback || transformedOptions.other;\n }\n\n // Default fallback\n return (\n transformedOptions.fallback || Object.values(transformedOptions)[0]\n );\n }\n\n // Gender not supported by vue-i18n string format, return object\n if (node.nodeType === NodeType.Gender) {\n const options = node.gender;\n const transformedOptions: Record<string, any> = {};\n\n // Just map values\n for (const [key, val] of Object.entries(options)) {\n let newKey = key;\n if (key === 'fallback') newKey = 'other'; // vue-i18n doesn't strictly have 'other' for gender objects but standard convention often uses similar keys\n\n const childVal = next(val, props);\n transformedOptions[newKey] = childVal;\n }\n return transformedOptions;\n }\n\n if (\n Array.isArray(node) ||\n (node.nodeType === 'composite' && Array.isArray(node.composite))\n ) {\n const arr = Array.isArray(node) ? node : node.composite;\n const items = arr.map((item: any) => next(item, props));\n return items.join('');\n }\n\n return next(node, props);\n },\n};\n\nexport const intlayerToVueI18nFormatter = (\n message: Dictionary['content']\n): JsonValue => {\n return deepTransformNode(message, {\n dictionaryKey: 'vue-i18n',\n keyPath: [],\n plugins: [{ id: 'vue-i18n', ...intlayerToVueI18nPlugin }],\n });\n};\n\nexport const vueI18nToIntlayerFormatter = (\n message: JsonValue\n): Dictionary['content'] => {\n return deepTransformNode(message, {\n dictionaryKey: 'vue-i18n',\n keyPath: [],\n plugins: [{ id: 'vue-i18n', ...vueI18nToIntlayerPlugin }],\n });\n};\n"],"mappings":"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"}
1
+ {"version":3,"file":"vue-i18n.mjs","names":["insert","enu"],"sources":["../../../src/messageFormat/vue-i18n.ts"],"sourcesContent":["import { type Dictionary, NodeType } from '@intlayer/types';\nimport { deepTransformNode } from '../interpreter';\nimport { enu, insert } from '../transpiler';\nimport type { JsonValue } from './ICU';\n\n// Types for our AST\ntype VueI18nNode =\n | string\n | {\n type: 'argument';\n name: string;\n };\n\nconst parseVueI18nPart = (text: string): VueI18nNode[] => {\n let index = 0;\n const nodes: VueI18nNode[] = [];\n let currentText = '';\n\n while (index < text.length) {\n const char = text[index];\n\n if (char === '{') {\n if (currentText) {\n nodes.push(currentText);\n currentText = '';\n }\n index++; // skip {\n let name = '';\n while (index < text.length && text[index] !== '}') {\n name += text[index];\n index++;\n }\n if (index < text.length) {\n index++; // skip }\n }\n nodes.push({ type: 'argument', name: name.trim() });\n } else {\n currentText += char;\n index++;\n }\n }\n\n if (currentText) {\n nodes.push(currentText);\n }\n\n return nodes;\n};\n\nconst parseVueI18n = (text: string): VueI18nNode[][] => {\n // Split by | but handle escaped \\|\n const parts: string[] = [];\n let currentPart = '';\n let index = 0;\n\n while (index < text.length) {\n const char = text[index];\n if (char === '\\\\' && index + 1 < text.length && text[index + 1] === '|') {\n currentPart += '|';\n index += 2;\n } else if (char === '|') {\n parts.push(currentPart.trim()); // Trim to remove surrounding spaces\n currentPart = '';\n index++;\n } else {\n currentPart += char;\n index++;\n }\n }\n parts.push(currentPart.trim()); // Trim last part too\n\n return parts.map(parseVueI18nPart);\n};\n\nconst vueI18nPartToIntlayer = (nodes: VueI18nNode[]): any => {\n if (nodes.length === 0) return '';\n if (nodes.length === 1 && typeof nodes[0] === 'string') return nodes[0];\n\n let str = '';\n for (const node of nodes) {\n if (typeof node === 'string') {\n str += node;\n } else {\n str += `{{${node.name}}}`;\n }\n }\n return insert(str);\n};\n\nconst vueI18nNodesToIntlayer = (parts: VueI18nNode[][]): any => {\n if (parts.length === 1) {\n return vueI18nPartToIntlayer(parts[0]);\n }\n\n // Handle pluralization (choice)\n const options: Record<string, any> = {};\n const varName = 'count'; // Default variable for vue-i18n choices\n\n if (parts.length === 2) {\n // 2 choices: 1 | other\n options['1'] = vueI18nPartToIntlayer(parts[0]);\n options.fallback = vueI18nPartToIntlayer(parts[1]);\n } else if (parts.length === 3) {\n // 3 choices: 0 | 1 | other\n options['0'] = vueI18nPartToIntlayer(parts[0]);\n options['1'] = vueI18nPartToIntlayer(parts[1]);\n options.fallback = vueI18nPartToIntlayer(parts[2]);\n } else {\n // > 3 choices: 0 | 1 | 2 | ... | other\n parts.forEach((part, index) => {\n if (index === parts.length - 1) {\n options.fallback = vueI18nPartToIntlayer(part);\n } else {\n options[index.toString()] = vueI18nPartToIntlayer(part);\n }\n });\n }\n\n // Preserve variable name\n options.__intlayer_vue_i18n_var = varName;\n\n return enu(options);\n};\n\nconst vueI18nToIntlayerPlugin = {\n canHandle: (node: any) =>\n typeof node === 'string' && (node.includes('{') || node.includes('|')),\n transform: (node: any) => {\n try {\n const ast = parseVueI18n(node);\n return vueI18nNodesToIntlayer(ast);\n } catch {\n return node;\n }\n },\n};\n\nconst intlayerToVueI18nPlugin = {\n canHandle: (node: any) =>\n typeof node === 'string' ||\n (node &&\n typeof node === 'object' &&\n (node.nodeType === NodeType.Insertion ||\n node.nodeType === NodeType.Enumeration ||\n node.nodeType === NodeType.Gender ||\n node.nodeType === 'composite')) ||\n Array.isArray(node),\n transform: (node: any, props: any, next: any) => {\n if (typeof node === 'string') {\n // replace {{...}} with {...} even in strings\n return node.replace(/\\{\\{([^}]+)\\}\\}/g, '{$1}');\n }\n\n if (node.nodeType === NodeType.Insertion) {\n // {{name}} -> {name}\n return node.insertion.replace(/\\{\\{([^}]+)\\}\\}/g, '{$1}');\n }\n\n if (node.nodeType === NodeType.Enumeration) {\n const options = node.enumeration;\n\n const transformedOptions: Record<string, string> = {};\n for (const [key, val] of Object.entries(options)) {\n if (key === '__intlayer_vue_i18n_var') continue;\n const childVal = next(val, props);\n transformedOptions[key] =\n typeof childVal === 'string' ? childVal : JSON.stringify(childVal);\n }\n\n // We need to reconstruct the pipe-separated string.\n // 2 parts: 1, fallback\n // 3 parts: 0, 1, fallback\n\n const keys = Object.keys(transformedOptions);\n\n // Heuristic to decide format\n // Use loose condition for 3 parts: if 0 exists, OR if 2 exists, etc.\n // But typically 0, 1, 2...\n // If '0' is present, we likely want the 3+ parts format.\n if (keys.includes('0')) {\n const indices = keys.filter((key) => /^\\d+$/.test(key)).map(Number);\n const maxIndex = Math.max(...indices);\n\n const fallback =\n transformedOptions.fallback || transformedOptions.other;\n const resultParts = [];\n\n // Check if we can use simple 3-part: 0 | 1 | fallback\n // Only if maxIndex <= 1\n if (maxIndex <= 1 && !keys.includes('2')) {\n const zero = transformedOptions['0'] || '';\n const one = transformedOptions['1'] || ''; // Gap handling?\n return `${zero} | ${one} | ${fallback}`;\n }\n\n // General case: loop until maxIndex\n const limit = Math.max(1, maxIndex);\n\n for (let i = 0; i <= limit; i++) {\n const key = i.toString();\n if (transformedOptions[key]) {\n resultParts.push(transformedOptions[key]);\n } else {\n resultParts.push(''); // Empty string for gaps\n }\n }\n resultParts.push(fallback);\n return resultParts.join(' | ').replace(/ \\| {2}\\| /g, ' | | ');\n }\n\n // 2 parts: 1 | fallback\n if (\n keys.includes('1') &&\n (keys.includes('fallback') || keys.includes('other'))\n ) {\n return `${transformedOptions['1']} | ${transformedOptions.fallback || transformedOptions.other}`;\n }\n\n // Fallback for only fallback?\n if (\n keys.length === 1 &&\n (keys.includes('fallback') || keys.includes('other'))\n ) {\n return transformedOptions.fallback || transformedOptions.other;\n }\n\n // Default fallback\n return (\n transformedOptions.fallback || Object.values(transformedOptions)[0]\n );\n }\n\n // Gender not supported by vue-i18n string format, return object\n if (node.nodeType === NodeType.Gender) {\n const options = node.gender;\n const transformedOptions: Record<string, any> = {};\n\n // Just map values\n for (const [key, val] of Object.entries(options)) {\n let newKey = key;\n if (key === 'fallback') newKey = 'other'; // vue-i18n doesn't strictly have 'other' for gender objects but standard convention often uses similar keys\n\n const childVal = next(val, props);\n transformedOptions[newKey] = childVal;\n }\n return transformedOptions;\n }\n\n if (\n Array.isArray(node) ||\n (node.nodeType === 'composite' && Array.isArray(node.composite))\n ) {\n const arr = Array.isArray(node) ? node : node.composite;\n const items = arr.map((item: any) => next(item, props));\n return items.join('');\n }\n\n return next(node, props);\n },\n};\n\nexport const intlayerToVueI18nFormatter = (\n message: Dictionary['content']\n): JsonValue => {\n return deepTransformNode(message, {\n dictionaryKey: 'vue-i18n',\n keyPath: [],\n plugins: [{ id: 'vue-i18n', ...intlayerToVueI18nPlugin }],\n });\n};\n\nexport const vueI18nToIntlayerFormatter = (\n message: JsonValue\n): Dictionary['content'] => {\n return deepTransformNode(message, {\n dictionaryKey: 'vue-i18n',\n keyPath: [],\n plugins: [{ id: 'vue-i18n', ...vueI18nToIntlayerPlugin }],\n });\n};\n"],"mappings":"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"}
@@ -1,25 +1,2 @@
1
- import { NodeType, formatNodeType } from "@intlayer/types";
2
-
3
- //#region src/transpiler/condition/condition.ts
4
- /**
5
- * Function intended to be used to build intlayer dictionaries.
6
- *
7
- * Allow to pick a content based on a condition.
8
- *
9
- * Usage:
10
- *
11
- * ```ts
12
- * cond({
13
- * 'true': 'The condition is validated',
14
- * 'false': 'The condition is not validated',
15
- * });
16
- * ```
17
- *
18
- * The last key provided will be used as the fallback value.
19
- *
20
- */
21
- const condition = (content) => formatNodeType(NodeType.Condition, content);
22
-
23
- //#endregion
24
- export { condition as cond };
1
+ import{NodeType as e,formatNodeType as t}from"@intlayer/types";const n=n=>t(e.Condition,n);export{n as cond};
25
2
  //# sourceMappingURL=condition.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"condition.mjs","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n NodeType.Condition,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(content?: ConditionContentStates<Content>) =>\n formatNodeType(NodeType.Condition, content);\n\nexport { condition as cond };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BA,MAAM,aAAsB,YAC1B,eAAe,SAAS,WAAW,QAAQ"}
1
+ {"version":3,"file":"condition.mjs","names":[],"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type ConditionContentStates<Content> = Record<`${boolean}`, Content> & {\n fallback?: Content;\n};\n\nexport type ConditionContent<Content = unknown> = TypedNodeModel<\n NodeType.Condition,\n ConditionContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a condition.\n *\n * Usage:\n *\n * ```ts\n * cond({\n * 'true': 'The condition is validated',\n * 'false': 'The condition is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst condition = <Content>(content?: ConditionContentStates<Content>) =>\n formatNodeType(NodeType.Condition, content);\n\nexport { condition as cond };\n"],"mappings":"+DA4BA,MAAM,EAAsB,GAC1B,EAAe,EAAS,UAAW,EAAQ"}
@@ -1,3 +1 @@
1
- import { cond as condition } from "./condition.mjs";
2
-
3
- export { condition as cond };
1
+ import{cond as e}from"./condition.mjs";export{e as cond};
@@ -1,27 +1,2 @@
1
- import { NodeType, formatNodeType } from "@intlayer/types";
2
-
3
- //#region src/transpiler/enumeration/enumeration.ts
4
- /**
5
- * Function intended to be used to build intlayer dictionaries.
6
- *
7
- * Allow to pick a content based on a quantity.
8
- *
9
- * Usage:
10
- *
11
- * ```ts
12
- * enu({
13
- * '<=-2.3': 'You have less than -2.3',
14
- * '<1': 'You have less than one',
15
- * '2': 'You have two',
16
- * '>=3': 'You have three or more',
17
- * });
18
- * ```
19
- *
20
- * > The order of the keys will define the priority of the content.
21
- *
22
- */
23
- const enumeration = (content) => formatNodeType(NodeType.Enumeration, content);
24
-
25
- //#endregion
26
- export { enumeration as enu };
1
+ import{NodeType as e,formatNodeType as t}from"@intlayer/types";const n=n=>t(e.Enumeration,n);export{n as enu};
27
2
  //# sourceMappingURL=enumeration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"enumeration.mjs","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n NodeType.Enumeration,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content>(content?: EnumerationContentState<Content>) =>\n formatNodeType(NodeType.Enumeration, content);\n\nexport { enumeration as enu };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAmDA,MAAM,eAAwB,YAC5B,eAAe,SAAS,aAAa,QAAQ"}
1
+ {"version":3,"file":"enumeration.mjs","names":[],"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\ntype Positive = number | `${number}`;\ntype Negative = `-${number}`;\ntype Numbers = Positive | Negative;\n\ntype Equal = Numbers;\ntype EqualString = `=${Numbers}`;\ntype Superior = `>${Numbers}`;\ntype SuperiorOrEqual = `>=${Numbers}`;\ntype Inferior = `<${Numbers}`;\ntype InferiorOrEqual = `<=${Numbers}`;\n\nexport type EnterFormat =\n | Equal\n | EqualString\n | Superior\n | SuperiorOrEqual\n | Inferior\n | InferiorOrEqual;\n\nexport type EnumerationContentState<Content> = Partial<\n Record<EnterFormat, Content>\n> & {\n fallback?: Content;\n};\n\nexport type EnumerationContent<Content = unknown> = TypedNodeModel<\n NodeType.Enumeration,\n EnumerationContentState<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a quantity.\n *\n * Usage:\n *\n * ```ts\n * enu({\n * '<=-2.3': 'You have less than -2.3',\n * '<1': 'You have less than one',\n * '2': 'You have two',\n * '>=3': 'You have three or more',\n * });\n * ```\n *\n * > The order of the keys will define the priority of the content.\n *\n */\nconst enumeration = <Content>(content?: EnumerationContentState<Content>) =>\n formatNodeType(NodeType.Enumeration, content);\n\nexport { enumeration as enu };\n"],"mappings":"+DAmDA,MAAM,EAAwB,GAC5B,EAAe,EAAS,YAAa,EAAQ"}
@@ -1,3 +1 @@
1
- import { enu as enumeration } from "./enumeration.mjs";
2
-
3
- export { enumeration as enu };
1
+ import{enu as e}from"./enumeration.mjs";export{e as enu};
@@ -1,50 +1,2 @@
1
- import { NodeType, formatNodeType } from "@intlayer/types";
2
- import { existsSync, readFileSync, statSync } from "node:fs";
3
- import { dirname, isAbsolute, relative, resolve } from "node:path";
4
- import { colorizePath, getAppLogger } from "@intlayer/config";
5
-
6
- //#region src/transpiler/file/file.ts
7
- const fileContent = (path, callerDir, baseDir) => {
8
- const isRelativePath = path.startsWith("./") || path.startsWith("../");
9
- const appLogger = getAppLogger();
10
- let filePath;
11
- if (isAbsolute(path)) {
12
- appLogger(`Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`, { level: "warn" });
13
- filePath = path;
14
- } else if (isRelativePath) filePath = resolve(callerDir, path);
15
- else filePath = resolve(baseDir, path);
16
- if (existsSync(filePath) && statSync(filePath).isFile()) try {
17
- const content = readFileSync(filePath, "utf8");
18
- return formatNodeType(NodeType.File, path, {
19
- content,
20
- fixedPath: relative(baseDir, filePath)
21
- });
22
- } catch {
23
- appLogger(`Unable to read path: ${colorizePath(relative(baseDir, filePath))}`, { level: "warn" });
24
- }
25
- else appLogger(`File not found: ${colorizePath(relative(baseDir, filePath))}`, { level: "warn" });
26
- return formatNodeType(NodeType.File, path, { content: `-` });
27
- };
28
- /**
29
- * Function intended to be used to build intlayer dictionaries.
30
- *
31
- * Allow identify the usage of an external resource.
32
- *
33
- * Usage:
34
- *
35
- * ```ts
36
- * file('/path/to/file.md') // absolute path
37
- *
38
- * // or
39
- *
40
- * file('path/to/file.md') // relative path
41
- * ```
42
- */
43
- const file = (path) => {
44
- const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } = globalThis;
45
- return fileContent(path, dirname(INTLAYER_FILE_PATH), INTLAYER_BASE_DIR);
46
- };
47
-
48
- //#endregion
49
- export { file, fileContent };
1
+ import{NodeType as e,formatNodeType as t}from"@intlayer/types";import{existsSync as n,readFileSync as r,statSync as i}from"node:fs";import{dirname as a,isAbsolute as o,relative as s,resolve as c}from"node:path";import{colorizePath as l,getAppLogger as u}from"@intlayer/config/logger";const d=(a,d,f)=>{let p=a.startsWith(`./`)||a.startsWith(`../`),m=u(),h;if(o(a)?(m(`Using absolute path for file is not recommended. Use relative paths instead. Path: ${a}, imported from: ${d}`,{level:`warn`}),h=a):h=c(p?d:f,a),n(h)&&i(h).isFile())try{let n=r(h,`utf8`);return t(e.File,a,{content:n,fixedPath:s(f,h)})}catch{m(`Unable to read path: ${l(s(f,h))}`,{level:`warn`})}else m(`File not found: ${l(s(f,h))}`,{level:`warn`});return t(e.File,a,{content:`-`})},f=e=>{let{INTLAYER_FILE_PATH:t,INTLAYER_BASE_DIR:n}=globalThis;return d(e,a(t),n)};export{f as file,d as fileContent};
50
2
  //# sourceMappingURL=file.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"file.mjs","names":[],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config';\nimport { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<NodeType.File, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(NodeType.File, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n appLogger(\n `Unable to read path: ${colorizePath(relative(baseDir, filePath))}`,\n { level: 'warn' }\n );\n }\n } else {\n appLogger(`File not found: ${colorizePath(relative(baseDir, filePath))}`, {\n level: 'warn',\n });\n }\n\n return formatNodeType(NodeType.File, path, {\n content: `-`,\n });\n};\n\ntype GlobalIntlayerFilePath = {\n INTLAYER_FILE_PATH: string;\n INTLAYER_BASE_DIR: string;\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } =\n globalThis as unknown as GlobalIntlayerFilePath;\n\n const callerDir = dirname(INTLAYER_FILE_PATH);\n const baseDir = INTLAYER_BASE_DIR;\n\n return fileContent(path, callerDir, baseDir);\n};\n"],"mappings":";;;;;;AAaA,MAAa,eACX,MACA,WACA,YACgB;CAChB,MAAM,iBAAiB,KAAK,WAAW,KAAK,IAAI,KAAK,WAAW,MAAM;CACtE,MAAM,YAAY,cAAc;CAEhC,IAAI;AACJ,KAAI,WAAW,KAAK,EAAE;AACpB,YACE,sFAAsF,KAAK,mBAAmB,aAC9G,EAAE,OAAO,QAAQ,CAClB;AACD,aAAW;YACF,eACT,YAAW,QAAQ,WAAW,KAAK;KAEnC,YAAW,QAAQ,SAAS,KAAK;AAGnC,KAAI,WAAW,SAAS,IAAI,SAAS,SAAS,CAAC,QAAQ,CACrD,KAAI;EACF,MAAM,UAAU,aAAa,UAAU,OAAO;AAE9C,SAAO,eAAe,SAAS,MAAM,MAAM;GACzC;GACA,WAAW,SAAS,SAAS,SAAS;GACvC,CAAC;SACI;AACN,YACE,wBAAwB,aAAa,SAAS,SAAS,SAAS,CAAC,IACjE,EAAE,OAAO,QAAQ,CAClB;;KAGH,WAAU,mBAAmB,aAAa,SAAS,SAAS,SAAS,CAAC,IAAI,EACxE,OAAO,QACR,CAAC;AAGJ,QAAO,eAAe,SAAS,MAAM,MAAM,EACzC,SAAS,KACV,CAAC;;;;;;;;;;;;;;;;;AAuBJ,MAAa,QAAQ,SAA8B;CACjD,MAAM,EAAE,oBAAoB,sBAC1B;AAKF,QAAO,YAAY,MAHD,QAAQ,mBAAmB,EAC7B,kBAE4B"}
1
+ {"version":3,"file":"file.mjs","names":[],"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { existsSync, readFileSync, statSync } from 'node:fs';\nimport { dirname, isAbsolute, relative, resolve } from 'node:path';\nimport { colorizePath, getAppLogger } from '@intlayer/config/logger';\nimport { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type FileContentConstructor<T extends Record<string, any> = {}> =\n TypedNodeModel<NodeType.File, string, T>;\n\nexport type FileContent = FileContentConstructor<{\n content: string;\n fixedPath?: string;\n}>;\n\nexport const fileContent = (\n path: string,\n callerDir: string,\n baseDir: string\n): FileContent => {\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger();\n\n let filePath: string;\n if (isAbsolute(path)) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(baseDir, path);\n }\n\n if (existsSync(filePath) && statSync(filePath).isFile()) {\n try {\n const content = readFileSync(filePath, 'utf8');\n\n return formatNodeType(NodeType.File, path, {\n content,\n fixedPath: relative(baseDir, filePath),\n });\n } catch {\n appLogger(\n `Unable to read path: ${colorizePath(relative(baseDir, filePath))}`,\n { level: 'warn' }\n );\n }\n } else {\n appLogger(`File not found: ${colorizePath(relative(baseDir, filePath))}`, {\n level: 'warn',\n });\n }\n\n return formatNodeType(NodeType.File, path, {\n content: `-`,\n });\n};\n\ntype GlobalIntlayerFilePath = {\n INTLAYER_FILE_PATH: string;\n INTLAYER_BASE_DIR: string;\n};\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } =\n globalThis as unknown as GlobalIntlayerFilePath;\n\n const callerDir = dirname(INTLAYER_FILE_PATH);\n const baseDir = INTLAYER_BASE_DIR;\n\n return fileContent(path, callerDir, baseDir);\n};\n"],"mappings":"4RAaA,MAAa,GACX,EACA,EACA,IACgB,CAChB,IAAM,EAAiB,EAAK,WAAW,KAAK,EAAI,EAAK,WAAW,MAAM,CAChE,EAAY,GAAc,CAE5B,EAaJ,GAZI,EAAW,EAAK,EAClB,EACE,sFAAsF,EAAK,mBAAmB,IAC9G,CAAE,MAAO,OAAQ,CAClB,CACD,EAAW,GAIX,EAFW,EADF,EACU,EAEA,EAFW,EAEG,CAG/B,EAAW,EAAS,EAAI,EAAS,EAAS,CAAC,QAAQ,CACrD,GAAI,CACF,IAAM,EAAU,EAAa,EAAU,OAAO,CAE9C,OAAO,EAAe,EAAS,KAAM,EAAM,CACzC,UACA,UAAW,EAAS,EAAS,EAAS,CACvC,CAAC,MACI,CACN,EACE,wBAAwB,EAAa,EAAS,EAAS,EAAS,CAAC,GACjE,CAAE,MAAO,OAAQ,CAClB,MAGH,EAAU,mBAAmB,EAAa,EAAS,EAAS,EAAS,CAAC,GAAI,CACxE,MAAO,OACR,CAAC,CAGJ,OAAO,EAAe,EAAS,KAAM,EAAM,CACzC,QAAS,IACV,CAAC,EAuBS,EAAQ,GAA8B,CACjD,GAAM,CAAE,qBAAoB,qBAC1B,WAKF,OAAO,EAAY,EAHD,EAAQ,EAAmB,CAC7B,EAE4B"}
@@ -1,25 +1,2 @@
1
- import { NodeType, formatNodeType } from "@intlayer/types";
2
-
3
- //#region src/transpiler/file/fileBrowser.ts
4
- /**
5
- * Function intended to be used to build intlayer dictionaries.
6
- *
7
- * Allow identify the usage of an external resource.
8
- *
9
- * Usage:
10
- *
11
- * ```ts
12
- * file('/path/to/file.md') // absolute path
13
- *
14
- * // or
15
- *
16
- * file('path/to/file.md') // relative path
17
- * ```
18
- */
19
- const file = (path) => {
20
- throw new Error("file is not available in browser");
21
- };
22
-
23
- //#endregion
24
- export { file };
1
+ import{NodeType as e,formatNodeType as t}from"@intlayer/types";const n=e=>{throw Error(`file is not available in browser`)};export{n as file};
25
2
  //# sourceMappingURL=fileBrowser.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fileBrowser.mjs","names":[],"sources":["../../../../src/transpiler/file/fileBrowser.ts"],"sourcesContent":["import { formatNodeType, NodeType } from '@intlayer/types';\nimport type { FileContent } from './file';\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n throw new Error('file is not available in browser');\n\n return formatNodeType(NodeType.File, path, {\n content: '',\n fixedPath: '',\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAa,QAAQ,SAA8B;AACjD,OAAM,IAAI,MAAM,mCAAmC"}
1
+ {"version":3,"file":"fileBrowser.mjs","names":[],"sources":["../../../../src/transpiler/file/fileBrowser.ts"],"sourcesContent":["import { formatNodeType, NodeType } from '@intlayer/types';\nimport type { FileContent } from './file';\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow identify the usage of an external resource.\n *\n * Usage:\n *\n * ```ts\n * file('/path/to/file.md') // absolute path\n *\n * // or\n *\n * file('path/to/file.md') // relative path\n * ```\n */\nexport const file = (path: string): FileContent => {\n throw new Error('file is not available in browser');\n\n return formatNodeType(NodeType.File, path, {\n content: '',\n fixedPath: '',\n });\n};\n"],"mappings":"+DAkBA,MAAa,EAAQ,GAA8B,CACjD,MAAU,MAAM,mCAAmC"}
@@ -1,3 +1 @@
1
- import { file, fileContent } from "./file.mjs";
2
-
3
- export { file, fileContent };
1
+ import{file as e,fileContent as t}from"./file.mjs";export{e as file,t as fileContent};
@@ -1,25 +1,2 @@
1
- import { NodeType, formatNodeType } from "@intlayer/types";
2
-
3
- //#region src/transpiler/gender/gender.ts
4
- /**
5
- * Function intended to be used to build intlayer dictionaries.
6
- *
7
- * Allow to pick a content based on a gender.
8
- *
9
- * Usage:
10
- *
11
- * ```ts
12
- * gender({
13
- * 'true': 'The gender is validated',
14
- * 'false': 'The gender is not validated',
15
- * });
16
- * ```
17
- *
18
- * The last key provided will be used as the fallback value.
19
- *
20
- */
21
- const gender = (content) => formatNodeType(NodeType.Gender, content);
22
-
23
- //#endregion
24
- export { gender };
1
+ import{NodeType as e,formatNodeType as t}from"@intlayer/types";const n=n=>t(e.Gender,n);export{n as gender};
25
2
  //# sourceMappingURL=gender.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"gender.mjs","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n NodeType.Gender,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(content?: GenderContentStates<Content>) =>\n formatNodeType(NodeType.Gender, content);\n\nexport { gender };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,MAAM,UAAmB,YACvB,eAAe,SAAS,QAAQ,QAAQ"}
1
+ {"version":3,"file":"gender.mjs","names":[],"sources":["../../../../src/transpiler/gender/gender.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\n\nexport type Gender = 'male' | 'female' | 'fallback';\n\nexport type GenderContentStates<Content> = Record<`${Gender}`, Content> & {\n fallback?: Content;\n};\n\nexport type GenderContent<Content = unknown> = TypedNodeModel<\n NodeType.Gender,\n GenderContentStates<Content>\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to pick a content based on a gender.\n *\n * Usage:\n *\n * ```ts\n * gender({\n * 'true': 'The gender is validated',\n * 'false': 'The gender is not validated',\n * });\n * ```\n *\n * The last key provided will be used as the fallback value.\n *\n */\nconst gender = <Content>(content?: GenderContentStates<Content>) =>\n formatNodeType(NodeType.Gender, content);\n\nexport { gender };\n"],"mappings":"+DA8BA,MAAM,EAAmB,GACvB,EAAe,EAAS,OAAQ,EAAQ"}
@@ -1,3 +1 @@
1
- import { gender } from "./gender.mjs";
2
-
3
- export { gender };
1
+ import{gender as e}from"./gender.mjs";export{e as gender};
@@ -1,44 +1,2 @@
1
- import { HTML_TAGS } from "./htmlTags.mjs";
2
-
3
- //#region src/transpiler/html/getHTMLCustomComponents.ts
4
- const parseAttributes = (attributesString) => {
5
- const attributes = {};
6
- if (!attributesString || !attributesString.trim()) return attributes;
7
- [...attributesString.matchAll(/([a-zA-Z0-9-:_@]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?/g)].forEach((match) => {
8
- const attrName = match[1];
9
- attributes[attrName] = "string";
10
- });
11
- return attributes;
12
- };
13
- /**
14
- * Extracts component names from an HTML string.
15
- * - Standard HTML tags are set to `true`.
16
- * - Custom components are parsed to extract their attributes/props.
17
- */
18
- const getHTMLCustomComponents = (content) => {
19
- if (typeof content !== "string") throw new Error("content must be a string");
20
- const matches = [...content.matchAll(/<(\/)?([a-zA-Z0-9.-]+)\s*([\s\S]*?)(\/?)>/g)];
21
- const components = {};
22
- matches.forEach((match) => {
23
- const isClosing = !!match[1];
24
- const tagName = match[2];
25
- const attributesString = match[3];
26
- const isSelfClosing = !!match[4];
27
- if (HTML_TAGS.includes(tagName.toLowerCase())) {
28
- components[tagName] = true;
29
- return;
30
- }
31
- if (!components[tagName]) components[tagName] = {};
32
- if (components[tagName] === true) return;
33
- if (isClosing) return;
34
- const attributes = parseAttributes(attributesString);
35
- const componentDef = components[tagName];
36
- Object.assign(componentDef, attributes);
37
- if (!isSelfClosing) componentDef.children = "string";
38
- });
39
- return components;
40
- };
41
-
42
- //#endregion
43
- export { getHTMLCustomComponents };
1
+ import{HTML_TAGS as e}from"./htmlTags.mjs";const t=e=>{let t={};return!e||!e.trim()||[...e.matchAll(/([a-zA-Z0-9-:_@]+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?/g)].forEach(e=>{let n=e[1];t[n]=`string`}),t},n=n=>{if(typeof n!=`string`)throw Error(`content must be a string`);let r=[...n.matchAll(/<(\/)?([a-zA-Z0-9.-]+)\s*([\s\S]*?)(\/?)>/g)],i={};return r.forEach(n=>{let r=!!n[1],a=n[2],o=n[3],s=!!n[4];if(e.includes(a.toLowerCase())){i[a]=!0;return}if(i[a]||(i[a]={}),i[a]===!0||r)return;let c=t(o),l=i[a];Object.assign(l,c),s||(l.children=`string`)}),i};export{n as getHTMLCustomComponents};
44
2
  //# sourceMappingURL=getHTMLCustomComponents.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getHTMLCustomComponents.mjs","names":[],"sources":["../../../../src/transpiler/html/getHTMLCustomComponents.ts"],"sourcesContent":["import { HTML_TAGS } from './index';\n\nconst parseAttributes = (attributesString: string): Record<string, string> => {\n const attributes: Record<string, string> = {};\n\n if (!attributesString || !attributesString.trim()) {\n return attributes;\n }\n\n // Regex to match attribute names\n // Matches: name=\"value\", name='value', name=value, or just name\n const attrRegex =\n /([a-zA-Z0-9-:_@]+)(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^>\\s]+))?/g;\n\n const matches = [...attributesString.matchAll(attrRegex)];\n\n matches.forEach((match) => {\n const attrName = match[1];\n attributes[attrName] = 'string';\n });\n\n return attributes;\n};\n\n/**\n * Extracts component names from an HTML string.\n * - Standard HTML tags are set to `true`.\n * - Custom components are parsed to extract their attributes/props.\n */\nexport const getHTMLCustomComponents = (\n content: string\n): Record<string, Record<string, string> | true> => {\n if (typeof content !== 'string') {\n throw new Error('content must be a string');\n }\n\n // Regex to match tags: <Tag ...>, </Tag>, or <Tag ... />\n // Captures: 1: Closing slash (if any), 2: Tag Name, 3: Attributes, 4: Self-closing slash (if any)\n const tagRegex = /<(\\/)?([a-zA-Z0-9.-]+)\\s*([\\s\\S]*?)(\\/?)>/g;\n const matches = [...content.matchAll(tagRegex)];\n\n const components: Record<string, Record<string, string> | true> = {};\n\n matches.forEach((match) => {\n const isClosing = !!match[1];\n const tagName = match[2];\n const attributesString = match[3];\n const isSelfClosing = !!match[4];\n\n // If it's a standard HTML tag, mark it as true and skip prop parsing\n if ((HTML_TAGS as readonly string[]).includes(tagName.toLowerCase())) {\n components[tagName] = true;\n return;\n }\n\n if (!components[tagName]) {\n components[tagName] = {};\n }\n\n // Safety check if we somehow have a collision or logic issue, though loop order handles it\n if (components[tagName] === true) {\n return;\n }\n\n if (isClosing) {\n return;\n }\n\n // Parse attributes for custom components\n const attributes = parseAttributes(attributesString);\n const componentDef = components[tagName] as Record<string, string>;\n Object.assign(componentDef, attributes);\n\n // If not self-closing, assume it has children\n if (!isSelfClosing) {\n componentDef.children = 'string';\n }\n });\n\n return components;\n};\n"],"mappings":";;;AAEA,MAAM,mBAAmB,qBAAqD;CAC5E,MAAM,aAAqC,EAAE;AAE7C,KAAI,CAAC,oBAAoB,CAAC,iBAAiB,MAAM,CAC/C,QAAO;AAUT,CAFgB,CAAC,GAAG,iBAAiB,SAFnC,6DAEsD,CAAC,CAEjD,SAAS,UAAU;EACzB,MAAM,WAAW,MAAM;AACvB,aAAW,YAAY;GACvB;AAEF,QAAO;;;;;;;AAQT,MAAa,2BACX,YACkD;AAClD,KAAI,OAAO,YAAY,SACrB,OAAM,IAAI,MAAM,2BAA2B;CAM7C,MAAM,UAAU,CAAC,GAAG,QAAQ,SADX,6CAC6B,CAAC;CAE/C,MAAM,aAA4D,EAAE;AAEpE,SAAQ,SAAS,UAAU;EACzB,MAAM,YAAY,CAAC,CAAC,MAAM;EAC1B,MAAM,UAAU,MAAM;EACtB,MAAM,mBAAmB,MAAM;EAC/B,MAAM,gBAAgB,CAAC,CAAC,MAAM;AAG9B,MAAK,UAAgC,SAAS,QAAQ,aAAa,CAAC,EAAE;AACpE,cAAW,WAAW;AACtB;;AAGF,MAAI,CAAC,WAAW,SACd,YAAW,WAAW,EAAE;AAI1B,MAAI,WAAW,aAAa,KAC1B;AAGF,MAAI,UACF;EAIF,MAAM,aAAa,gBAAgB,iBAAiB;EACpD,MAAM,eAAe,WAAW;AAChC,SAAO,OAAO,cAAc,WAAW;AAGvC,MAAI,CAAC,cACH,cAAa,WAAW;GAE1B;AAEF,QAAO"}
1
+ {"version":3,"file":"getHTMLCustomComponents.mjs","names":[],"sources":["../../../../src/transpiler/html/getHTMLCustomComponents.ts"],"sourcesContent":["import { HTML_TAGS } from './index';\n\nconst parseAttributes = (attributesString: string): Record<string, string> => {\n const attributes: Record<string, string> = {};\n\n if (!attributesString || !attributesString.trim()) {\n return attributes;\n }\n\n // Regex to match attribute names\n // Matches: name=\"value\", name='value', name=value, or just name\n const attrRegex =\n /([a-zA-Z0-9-:_@]+)(?:\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^>\\s]+))?/g;\n\n const matches = [...attributesString.matchAll(attrRegex)];\n\n matches.forEach((match) => {\n const attrName = match[1];\n attributes[attrName] = 'string';\n });\n\n return attributes;\n};\n\n/**\n * Extracts component names from an HTML string.\n * - Standard HTML tags are set to `true`.\n * - Custom components are parsed to extract their attributes/props.\n */\nexport const getHTMLCustomComponents = (\n content: string\n): Record<string, Record<string, string> | true> => {\n if (typeof content !== 'string') {\n throw new Error('content must be a string');\n }\n\n // Regex to match tags: <Tag ...>, </Tag>, or <Tag ... />\n // Captures: 1: Closing slash (if any), 2: Tag Name, 3: Attributes, 4: Self-closing slash (if any)\n const tagRegex = /<(\\/)?([a-zA-Z0-9.-]+)\\s*([\\s\\S]*?)(\\/?)>/g;\n const matches = [...content.matchAll(tagRegex)];\n\n const components: Record<string, Record<string, string> | true> = {};\n\n matches.forEach((match) => {\n const isClosing = !!match[1];\n const tagName = match[2];\n const attributesString = match[3];\n const isSelfClosing = !!match[4];\n\n // If it's a standard HTML tag, mark it as true and skip prop parsing\n if ((HTML_TAGS as readonly string[]).includes(tagName.toLowerCase())) {\n components[tagName] = true;\n return;\n }\n\n if (!components[tagName]) {\n components[tagName] = {};\n }\n\n // Safety check if we somehow have a collision or logic issue, though loop order handles it\n if (components[tagName] === true) {\n return;\n }\n\n if (isClosing) {\n return;\n }\n\n // Parse attributes for custom components\n const attributes = parseAttributes(attributesString);\n const componentDef = components[tagName] as Record<string, string>;\n Object.assign(componentDef, attributes);\n\n // If not self-closing, assume it has children\n if (!isSelfClosing) {\n componentDef.children = 'string';\n }\n });\n\n return components;\n};\n"],"mappings":"2CAEA,MAAM,EAAmB,GAAqD,CAC5E,IAAM,EAAqC,EAAE,CAkB7C,MAhBI,CAAC,GAAoB,CAAC,EAAiB,MAAM,EASjC,CAAC,GAAG,EAAiB,SAFnC,6DAEsD,CAAC,CAEjD,QAAS,GAAU,CACzB,IAAM,EAAW,EAAM,GACvB,EAAW,GAAY,UACvB,CAbO,GAuBE,EACX,GACkD,CAClD,GAAI,OAAO,GAAY,SACrB,MAAU,MAAM,2BAA2B,CAM7C,IAAM,EAAU,CAAC,GAAG,EAAQ,SADX,6CAC6B,CAAC,CAEzC,EAA4D,EAAE,CAsCpE,OApCA,EAAQ,QAAS,GAAU,CACzB,IAAM,EAAY,CAAC,CAAC,EAAM,GACpB,EAAU,EAAM,GAChB,EAAmB,EAAM,GACzB,EAAgB,CAAC,CAAC,EAAM,GAG9B,GAAK,EAAgC,SAAS,EAAQ,aAAa,CAAC,CAAE,CACpE,EAAW,GAAW,GACtB,OAYF,GATK,EAAW,KACd,EAAW,GAAW,EAAE,EAItB,EAAW,KAAa,IAIxB,EACF,OAIF,IAAM,EAAa,EAAgB,EAAiB,CAC9C,EAAe,EAAW,GAChC,OAAO,OAAO,EAAc,EAAW,CAGlC,IACH,EAAa,SAAW,WAE1B,CAEK"}
@@ -1,36 +1,2 @@
1
- import { getHTMLCustomComponents } from "./getHTMLCustomComponents.mjs";
2
- import { NodeType, formatNodeType } from "@intlayer/types";
3
-
4
- //#region src/transpiler/html/html.ts
5
- /**
6
- * Function intended to be used to build intlayer dictionaries.
7
- *
8
- * Allow to parse HTML/JSX-like strings and replace tags with components during interpretation.
9
- *
10
- * Usage:
11
- *
12
- * ```ts
13
- * html('Hello <b>World</b>')
14
- * ```
15
- *
16
- */
17
- const html = (content, components) => {
18
- const getComponents = () => {
19
- if (components) return components;
20
- if (typeof content === "string") return getHTMLCustomComponents(content);
21
- let stringContent;
22
- if (typeof content === "function") stringContent = content();
23
- else if (typeof content.then === "function") stringContent = async () => getHTMLCustomComponents(await content);
24
- if (typeof stringContent === "string") return getHTMLCustomComponents(stringContent);
25
- try {
26
- return getHTMLCustomComponents(JSON.stringify(content));
27
- } catch (_e) {
28
- return [];
29
- }
30
- };
31
- return formatNodeType(NodeType.HTML, content, { tags: getComponents() });
32
- };
33
-
34
- //#endregion
35
- export { html };
1
+ import{getHTMLCustomComponents as e}from"./getHTMLCustomComponents.mjs";import{NodeType as t,formatNodeType as n}from"@intlayer/types";const r=(r,i)=>n(t.HTML,r,{tags:(()=>{if(i)return i;if(typeof r==`string`)return e(r);let t;if(typeof r==`function`?t=r():typeof r.then==`function`&&(t=async()=>e(await r)),typeof t==`string`)return e(t);try{return e(JSON.stringify(r))}catch{return[]}})()});export{r as html};
36
2
  //# sourceMappingURL=html.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"html.mjs","names":[],"sources":["../../../../src/transpiler/html/html.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\nimport { getHTMLCustomComponents } from './getHTMLCustomComponents';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type HTMLContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<NodeType.HTML, Content, T>;\n\nexport type HTMLContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = HTMLContentConstructor<\n Content,\n {\n tags: string[] | Components;\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to parse HTML/JSX-like strings and replace tags with components during interpretation.\n *\n * Usage:\n *\n * ```ts\n * html('Hello <b>World</b>')\n * ```\n *\n */\nexport const html = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): HTMLContent<Content, Components> => {\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(NodeType.HTML, content, {\n tags: getComponents(),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,MAAa,QAIX,SACA,eACqC;CACrC,MAAM,sBAAsB;AAC1B,MAAI,WACF,QAAO;AAGT,MAAI,OAAO,YAAY,SACrB,QAAO,wBAAwB,QAAQ;EAGzC,IAAI;AAEJ,MAAI,OAAO,YAAY,WACrB,iBAAgB,SAAS;WAChB,OAAQ,QAA4B,SAAS,WACtD,iBAAgB,YACd,wBAAyB,MAAO,QAAuC;AAG3E,MAAI,OAAO,kBAAkB,SAC3B,QAAO,wBAAwB,cAAc;AAG/C,MAAI;AACF,UAAO,wBAAwB,KAAK,UAAU,QAAQ,CAAC;WAChD,IAAI;AACX,UAAO,EAAE;;;AAIb,QAAO,eAAe,SAAS,MAAM,SAAS,EAC5C,MAAM,eAAe,EACtB,CAAC"}
1
+ {"version":3,"file":"html.mjs","names":[],"sources":["../../../../src/transpiler/html/html.ts"],"sourcesContent":["import { formatNodeType, NodeType, type TypedNodeModel } from '@intlayer/types';\nimport { getHTMLCustomComponents } from './getHTMLCustomComponents';\n\ntype PropsType = 'number' | 'string' | 'node';\n\ntype ComponentName = string;\n\nexport type HTMLContentConstructor<\n Content = unknown,\n T extends Record<string, any> = {},\n> = TypedNodeModel<NodeType.HTML, Content, T>;\n\nexport type HTMLContent<\n Content = unknown,\n Components extends Record<ComponentName, PropsType> = Record<\n ComponentName,\n PropsType\n >,\n> = HTMLContentConstructor<\n Content,\n {\n tags: string[] | Components;\n }\n>;\n\n/**\n * Function intended to be used to build intlayer dictionaries.\n *\n * Allow to parse HTML/JSX-like strings and replace tags with components during interpretation.\n *\n * Usage:\n *\n * ```ts\n * html('Hello <b>World</b>')\n * ```\n *\n */\nexport const html = <\n Components extends Record<string, any> = Record<string, any>,\n Content = unknown,\n>(\n content: Content,\n components?: Components\n): HTMLContent<Content, Components> => {\n const getComponents = () => {\n if (components) {\n return components;\n }\n\n if (typeof content === 'string') {\n return getHTMLCustomComponents(content);\n }\n\n let stringContent: any;\n\n if (typeof content === 'function') {\n stringContent = content();\n } else if (typeof (content as Promise<string>).then === 'function') {\n stringContent = async () =>\n getHTMLCustomComponents((await (content as Promise<string>)) as string);\n }\n\n if (typeof stringContent === 'string') {\n return getHTMLCustomComponents(stringContent);\n }\n\n try {\n return getHTMLCustomComponents(JSON.stringify(content));\n } catch (_e) {\n return [];\n }\n };\n\n return formatNodeType(NodeType.HTML, content, {\n tags: getComponents(),\n });\n};\n"],"mappings":"uIAqCA,MAAa,GAIX,EACA,IA+BO,EAAe,EAAS,KAAM,EAAS,CAC5C,UA9B0B,CAC1B,GAAI,EACF,OAAO,EAGT,GAAI,OAAO,GAAY,SACrB,OAAO,EAAwB,EAAQ,CAGzC,IAAI,EASJ,GAPI,OAAO,GAAY,WACrB,EAAgB,GAAS,CAChB,OAAQ,EAA4B,MAAS,aACtD,EAAgB,SACd,EAAyB,MAAO,EAAuC,EAGvE,OAAO,GAAkB,SAC3B,OAAO,EAAwB,EAAc,CAG/C,GAAI,CACF,OAAO,EAAwB,KAAK,UAAU,EAAQ,CAAC,MAC5C,CACX,MAAO,EAAE,KAKU,CACtB,CAAC"}