@intlayer/core 6.1.6 → 7.0.0-canary.0

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 (600) hide show
  1. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  2. package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs +213 -0
  3. package/dist/cjs/deepTransformPlugins/getFilterMissingTranslationsContent.cjs.map +1 -0
  4. package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs +95 -0
  5. package/dist/cjs/deepTransformPlugins/getFilterTranslationsOnlyContent.cjs.map +1 -0
  6. package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs +46 -0
  7. package/dist/cjs/deepTransformPlugins/getFilteredLocalesContent.cjs.map +1 -0
  8. package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs +33 -0
  9. package/dist/cjs/deepTransformPlugins/getLocalizedContent.cjs.map +1 -0
  10. package/dist/cjs/deepTransformPlugins/getMaskContent.cjs +27 -0
  11. package/dist/cjs/deepTransformPlugins/getMaskContent.cjs.map +1 -0
  12. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs +45 -0
  13. package/dist/cjs/deepTransformPlugins/getMissingLocalesContent.cjs.map +1 -0
  14. package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs +60 -0
  15. package/dist/cjs/deepTransformPlugins/getReplacedValuesContent.cjs.map +1 -0
  16. package/dist/cjs/deepTransformPlugins/index.cjs +25 -0
  17. package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs +107 -0
  18. package/dist/cjs/deepTransformPlugins/insertContentInDictionary.cjs.map +1 -0
  19. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs +59 -91
  20. package/dist/cjs/dictionaryManipulator/editDictionaryByKeyPath.cjs.map +1 -1
  21. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs +13 -39
  22. package/dist/cjs/dictionaryManipulator/getContentNodeByKeyPath.cjs.map +1 -1
  23. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs +48 -94
  24. package/dist/cjs/dictionaryManipulator/getDefaultNode.cjs.map +1 -1
  25. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs +24 -68
  26. package/dist/cjs/dictionaryManipulator/getEmptyNode.cjs.map +1 -1
  27. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs +21 -56
  28. package/dist/cjs/dictionaryManipulator/getNodeChildren.cjs.map +1 -1
  29. package/dist/cjs/dictionaryManipulator/getNodeType.cjs +32 -49
  30. package/dist/cjs/dictionaryManipulator/getNodeType.cjs.map +1 -1
  31. package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs +18 -50
  32. package/dist/cjs/dictionaryManipulator/getUnmergedDictionaryByKeyPath.cjs.map +1 -1
  33. package/dist/cjs/dictionaryManipulator/index.cjs +28 -41
  34. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs +69 -0
  35. package/dist/cjs/dictionaryManipulator/mergeDictionaries.cjs.map +1 -0
  36. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs +30 -0
  37. package/dist/cjs/dictionaryManipulator/normalizeDictionary.cjs.map +1 -0
  38. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs +48 -0
  39. package/dist/cjs/dictionaryManipulator/orderDictionaries.cjs.map +1 -0
  40. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs +29 -54
  41. package/dist/cjs/dictionaryManipulator/removeContentNodeByKeyPath.cjs.map +1 -1
  42. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs +37 -63
  43. package/dist/cjs/dictionaryManipulator/renameContentNodeByKeyPath.cjs.map +1 -1
  44. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs +36 -76
  45. package/dist/cjs/dictionaryManipulator/updateNodeChildren.cjs.map +1 -1
  46. package/dist/cjs/formatters/compact.cjs +24 -46
  47. package/dist/cjs/formatters/compact.cjs.map +1 -1
  48. package/dist/cjs/formatters/currency.cjs +28 -50
  49. package/dist/cjs/formatters/currency.cjs.map +1 -1
  50. package/dist/cjs/formatters/date.cjs +56 -79
  51. package/dist/cjs/formatters/date.cjs.map +1 -1
  52. package/dist/cjs/formatters/index.cjs +17 -37
  53. package/dist/cjs/formatters/list.cjs +29 -47
  54. package/dist/cjs/formatters/list.cjs.map +1 -1
  55. package/dist/cjs/formatters/number.cjs +17 -43
  56. package/dist/cjs/formatters/number.cjs.map +1 -1
  57. package/dist/cjs/formatters/percentage.cjs +22 -51
  58. package/dist/cjs/formatters/percentage.cjs.map +1 -1
  59. package/dist/cjs/formatters/relativeTime.cjs +28 -70
  60. package/dist/cjs/formatters/relativeTime.cjs.map +1 -1
  61. package/dist/cjs/formatters/units.cjs +22 -48
  62. package/dist/cjs/formatters/units.cjs.map +1 -1
  63. package/dist/cjs/getStorageAttributes.cjs +116 -0
  64. package/dist/cjs/getStorageAttributes.cjs.map +1 -0
  65. package/dist/cjs/index.cjs +154 -45
  66. package/dist/cjs/interpreter/getCondition.cjs +30 -30
  67. package/dist/cjs/interpreter/getCondition.cjs.map +1 -1
  68. package/dist/cjs/interpreter/getContent/deepTransform.cjs +38 -63
  69. package/dist/cjs/interpreter/getContent/deepTransform.cjs.map +1 -1
  70. package/dist/cjs/interpreter/getContent/getContent.cjs +31 -54
  71. package/dist/cjs/interpreter/getContent/getContent.cjs.map +1 -1
  72. package/dist/cjs/interpreter/getContent/index.cjs +13 -27
  73. package/dist/cjs/interpreter/getContent/plugins.cjs +135 -175
  74. package/dist/cjs/interpreter/getContent/plugins.cjs.map +1 -1
  75. package/dist/cjs/interpreter/getDictionary.cjs +21 -39
  76. package/dist/cjs/interpreter/getDictionary.cjs.map +1 -1
  77. package/dist/cjs/interpreter/getEnumeration.cjs +69 -42
  78. package/dist/cjs/interpreter/getEnumeration.cjs.map +1 -1
  79. package/dist/cjs/interpreter/getGender.cjs +33 -34
  80. package/dist/cjs/interpreter/getGender.cjs.map +1 -1
  81. package/dist/cjs/interpreter/getInsertion.cjs +18 -27
  82. package/dist/cjs/interpreter/getInsertion.cjs.map +1 -1
  83. package/dist/cjs/interpreter/getIntlayer.cjs +13 -48
  84. package/dist/cjs/interpreter/getIntlayer.cjs.map +1 -1
  85. package/dist/cjs/interpreter/getNesting.cjs +26 -41
  86. package/dist/cjs/interpreter/getNesting.cjs.map +1 -1
  87. package/dist/cjs/interpreter/getTranslation.cjs +29 -32
  88. package/dist/cjs/interpreter/getTranslation.cjs.map +1 -1
  89. package/dist/cjs/interpreter/index.cjs +26 -39
  90. package/dist/cjs/localization/getBrowserLocale.cjs +144 -0
  91. package/dist/cjs/localization/getBrowserLocale.cjs.map +1 -0
  92. package/dist/cjs/localization/getHTMLTextDir.cjs +49 -255
  93. package/dist/cjs/localization/getHTMLTextDir.cjs.map +1 -1
  94. package/dist/cjs/localization/getLocaleFromPath.cjs +40 -56
  95. package/dist/cjs/localization/getLocaleFromPath.cjs.map +1 -1
  96. package/dist/cjs/localization/getLocaleLang.cjs +18 -27
  97. package/dist/cjs/localization/getLocaleLang.cjs.map +1 -1
  98. package/dist/cjs/localization/getLocaleName.cjs +7 -32
  99. package/dist/cjs/localization/getLocaleName.cjs.map +1 -1
  100. package/dist/cjs/localization/getLocalizedUrl.cjs +46 -47
  101. package/dist/cjs/localization/getLocalizedUrl.cjs.map +1 -1
  102. package/dist/cjs/localization/getMultilingualUrls.cjs +69 -65
  103. package/dist/cjs/localization/getMultilingualUrls.cjs.map +1 -1
  104. package/dist/cjs/localization/getPathWithoutLocale.cjs +53 -61
  105. package/dist/cjs/localization/getPathWithoutLocale.cjs.map +1 -1
  106. package/dist/cjs/localization/index.cjs +26 -63
  107. package/dist/cjs/localization/localeDetector.cjs +108 -39
  108. package/dist/cjs/localization/localeDetector.cjs.map +1 -1
  109. package/dist/cjs/localization/localeMapper.cjs +118 -72
  110. package/dist/cjs/localization/localeMapper.cjs.map +1 -1
  111. package/dist/cjs/localization/localeResolver.cjs +26 -61
  112. package/dist/cjs/localization/localeResolver.cjs.map +1 -1
  113. package/dist/cjs/transpiler/condition/condition.cjs +26 -29
  114. package/dist/cjs/transpiler/condition/condition.cjs.map +1 -1
  115. package/dist/cjs/transpiler/condition/index.cjs +3 -23
  116. package/dist/cjs/transpiler/enumeration/enumeration.cjs +28 -29
  117. package/dist/cjs/transpiler/enumeration/enumeration.cjs.map +1 -1
  118. package/dist/cjs/transpiler/enumeration/index.cjs +3 -23
  119. package/dist/cjs/transpiler/file/file.cjs +52 -71
  120. package/dist/cjs/transpiler/file/file.cjs.map +1 -1
  121. package/dist/cjs/transpiler/file/fileBrowser.cjs +24 -33
  122. package/dist/cjs/transpiler/file/fileBrowser.cjs.map +1 -1
  123. package/dist/cjs/transpiler/file/index.cjs +4 -23
  124. package/dist/cjs/transpiler/gender/gender.cjs +26 -29
  125. package/dist/cjs/transpiler/gender/gender.cjs.map +1 -1
  126. package/dist/cjs/transpiler/gender/index.cjs +3 -23
  127. package/dist/cjs/transpiler/index.cjs +19 -35
  128. package/dist/cjs/transpiler/insertion/getInsertionValues.cjs +8 -31
  129. package/dist/cjs/transpiler/insertion/getInsertionValues.cjs.map +1 -1
  130. package/dist/cjs/transpiler/insertion/index.cjs +5 -25
  131. package/dist/cjs/transpiler/insertion/insertion.cjs +34 -51
  132. package/dist/cjs/transpiler/insertion/insertion.cjs.map +1 -1
  133. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs +53 -86
  134. package/dist/cjs/transpiler/markdown/getMarkdownMetadata.cjs.map +1 -1
  135. package/dist/cjs/transpiler/markdown/index.cjs +5 -25
  136. package/dist/cjs/transpiler/markdown/markdown.cjs +33 -52
  137. package/dist/cjs/transpiler/markdown/markdown.cjs.map +1 -1
  138. package/dist/cjs/transpiler/nesting/index.cjs +3 -23
  139. package/dist/cjs/transpiler/nesting/nesting.cjs +26 -31
  140. package/dist/cjs/transpiler/nesting/nesting.cjs.map +1 -1
  141. package/dist/cjs/transpiler/translation/index.cjs +3 -23
  142. package/dist/cjs/transpiler/translation/translation.cjs +29 -29
  143. package/dist/cjs/transpiler/translation/translation.cjs.map +1 -1
  144. package/dist/cjs/utils/checkIsURLAbsolute.cjs +5 -27
  145. package/dist/cjs/utils/checkIsURLAbsolute.cjs.map +1 -1
  146. package/dist/cjs/utils/intl.cjs +48 -74
  147. package/dist/cjs/utils/intl.cjs.map +1 -1
  148. package/dist/cjs/utils/isSameKeyPath.cjs +6 -30
  149. package/dist/cjs/utils/isSameKeyPath.cjs.map +1 -1
  150. package/dist/cjs/utils/isValidReactElement.cjs +12 -27
  151. package/dist/cjs/utils/isValidReactElement.cjs.map +1 -1
  152. package/dist/cjs/utils/localeStorage.cjs +143 -0
  153. package/dist/cjs/utils/localeStorage.cjs.map +1 -0
  154. package/dist/cjs/utils/parseYaml.cjs +185 -55
  155. package/dist/cjs/utils/parseYaml.cjs.map +1 -1
  156. package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs +208 -0
  157. package/dist/esm/deepTransformPlugins/getFilterMissingTranslationsContent.mjs.map +1 -0
  158. package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs +90 -0
  159. package/dist/esm/deepTransformPlugins/getFilterTranslationsOnlyContent.mjs.map +1 -0
  160. package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs +43 -0
  161. package/dist/esm/deepTransformPlugins/getFilteredLocalesContent.mjs.map +1 -0
  162. package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs +32 -0
  163. package/dist/esm/deepTransformPlugins/getLocalizedContent.mjs.map +1 -0
  164. package/dist/esm/deepTransformPlugins/getMaskContent.mjs +26 -0
  165. package/dist/esm/deepTransformPlugins/getMaskContent.mjs.map +1 -0
  166. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs +41 -0
  167. package/dist/esm/deepTransformPlugins/getMissingLocalesContent.mjs.map +1 -0
  168. package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs +60 -0
  169. package/dist/esm/deepTransformPlugins/getReplacedValuesContent.mjs.map +1 -0
  170. package/dist/esm/deepTransformPlugins/index.mjs +10 -0
  171. package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs +105 -0
  172. package/dist/esm/deepTransformPlugins/insertContentInDictionary.mjs.map +1 -0
  173. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs +57 -67
  174. package/dist/esm/dictionaryManipulator/editDictionaryByKeyPath.mjs.map +1 -1
  175. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs +11 -15
  176. package/dist/esm/dictionaryManipulator/getContentNodeByKeyPath.mjs.map +1 -1
  177. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs +46 -70
  178. package/dist/esm/dictionaryManipulator/getDefaultNode.mjs.map +1 -1
  179. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs +22 -44
  180. package/dist/esm/dictionaryManipulator/getEmptyNode.mjs.map +1 -1
  181. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs +19 -32
  182. package/dist/esm/dictionaryManipulator/getNodeChildren.mjs.map +1 -1
  183. package/dist/esm/dictionaryManipulator/getNodeType.mjs +31 -26
  184. package/dist/esm/dictionaryManipulator/getNodeType.mjs.map +1 -1
  185. package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs +14 -15
  186. package/dist/esm/dictionaryManipulator/getUnmergedDictionaryByKeyPath.mjs.map +1 -1
  187. package/dist/esm/dictionaryManipulator/index.mjs +15 -11
  188. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs +66 -0
  189. package/dist/esm/dictionaryManipulator/mergeDictionaries.mjs.map +1 -0
  190. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs +29 -0
  191. package/dist/esm/dictionaryManipulator/normalizeDictionary.mjs.map +1 -0
  192. package/dist/esm/dictionaryManipulator/orderDictionaries.mjs +46 -0
  193. package/dist/esm/dictionaryManipulator/orderDictionaries.mjs.map +1 -0
  194. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs +27 -30
  195. package/dist/esm/dictionaryManipulator/removeContentNodeByKeyPath.mjs.map +1 -1
  196. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs +35 -39
  197. package/dist/esm/dictionaryManipulator/renameContentNodeByKeyPath.mjs.map +1 -1
  198. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs +34 -52
  199. package/dist/esm/dictionaryManipulator/updateNodeChildren.mjs.map +1 -1
  200. package/dist/esm/formatters/compact.mjs +21 -11
  201. package/dist/esm/formatters/compact.mjs.map +1 -1
  202. package/dist/esm/formatters/currency.mjs +25 -15
  203. package/dist/esm/formatters/currency.mjs.map +1 -1
  204. package/dist/esm/formatters/date.mjs +53 -44
  205. package/dist/esm/formatters/date.mjs.map +1 -1
  206. package/dist/esm/formatters/index.mjs +10 -9
  207. package/dist/esm/formatters/list.mjs +26 -12
  208. package/dist/esm/formatters/list.mjs.map +1 -1
  209. package/dist/esm/formatters/number.mjs +14 -8
  210. package/dist/esm/formatters/number.mjs.map +1 -1
  211. package/dist/esm/formatters/percentage.mjs +19 -16
  212. package/dist/esm/formatters/percentage.mjs.map +1 -1
  213. package/dist/esm/formatters/relativeTime.mjs +25 -35
  214. package/dist/esm/formatters/relativeTime.mjs.map +1 -1
  215. package/dist/esm/formatters/units.mjs +19 -13
  216. package/dist/esm/formatters/units.mjs.map +1 -1
  217. package/dist/esm/getStorageAttributes.mjs +114 -0
  218. package/dist/esm/getStorageAttributes.mjs.map +1 -0
  219. package/dist/esm/index.mjs +67 -13
  220. package/dist/esm/interpreter/getCondition.mjs +29 -6
  221. package/dist/esm/interpreter/getCondition.mjs.map +1 -1
  222. package/dist/esm/interpreter/getContent/deepTransform.mjs +36 -39
  223. package/dist/esm/interpreter/getContent/deepTransform.mjs.map +1 -1
  224. package/dist/esm/interpreter/getContent/getContent.mjs +28 -26
  225. package/dist/esm/interpreter/getContent/getContent.mjs.map +1 -1
  226. package/dist/esm/interpreter/getContent/index.mjs +5 -4
  227. package/dist/esm/interpreter/getContent/plugins.mjs +121 -139
  228. package/dist/esm/interpreter/getContent/plugins.mjs.map +1 -1
  229. package/dist/esm/interpreter/getDictionary.mjs +20 -14
  230. package/dist/esm/interpreter/getDictionary.mjs.map +1 -1
  231. package/dist/esm/interpreter/getEnumeration.mjs +67 -17
  232. package/dist/esm/interpreter/getEnumeration.mjs.map +1 -1
  233. package/dist/esm/interpreter/getGender.mjs +32 -10
  234. package/dist/esm/interpreter/getGender.mjs.map +1 -1
  235. package/dist/esm/interpreter/getInsertion.mjs +17 -3
  236. package/dist/esm/interpreter/getInsertion.mjs.map +1 -1
  237. package/dist/esm/interpreter/getIntlayer.mjs +10 -13
  238. package/dist/esm/interpreter/getIntlayer.mjs.map +1 -1
  239. package/dist/esm/interpreter/getNesting.mjs +25 -16
  240. package/dist/esm/interpreter/getNesting.mjs.map +1 -1
  241. package/dist/esm/interpreter/getTranslation.mjs +28 -8
  242. package/dist/esm/interpreter/getTranslation.mjs.map +1 -1
  243. package/dist/esm/interpreter/index.mjs +11 -10
  244. package/dist/esm/localization/getBrowserLocale.mjs +139 -0
  245. package/dist/esm/localization/getBrowserLocale.mjs.map +1 -0
  246. package/dist/esm/localization/getHTMLTextDir.mjs +47 -231
  247. package/dist/esm/localization/getHTMLTextDir.mjs.map +1 -1
  248. package/dist/esm/localization/getLocaleFromPath.mjs +36 -21
  249. package/dist/esm/localization/getLocaleFromPath.mjs.map +1 -1
  250. package/dist/esm/localization/getLocaleLang.mjs +17 -3
  251. package/dist/esm/localization/getLocaleLang.mjs.map +1 -1
  252. package/dist/esm/localization/getLocaleName.mjs +7 -8
  253. package/dist/esm/localization/getLocaleName.mjs.map +1 -1
  254. package/dist/esm/localization/getLocalizedUrl.mjs +43 -12
  255. package/dist/esm/localization/getLocalizedUrl.mjs.map +1 -1
  256. package/dist/esm/localization/getMultilingualUrls.mjs +65 -29
  257. package/dist/esm/localization/getMultilingualUrls.mjs.map +1 -1
  258. package/dist/esm/localization/getPathWithoutLocale.mjs +50 -26
  259. package/dist/esm/localization/getPathWithoutLocale.mjs.map +1 -1
  260. package/dist/esm/localization/index.mjs +7 -21
  261. package/dist/esm/localization/localeDetector.mjs +109 -6
  262. package/dist/esm/localization/localeDetector.mjs.map +1 -1
  263. package/dist/esm/localization/localeMapper.mjs +112 -35
  264. package/dist/esm/localization/localeMapper.mjs.map +1 -1
  265. package/dist/esm/localization/localeResolver.mjs +23 -26
  266. package/dist/esm/localization/localeResolver.mjs.map +1 -1
  267. package/dist/esm/transpiler/condition/condition.mjs +23 -7
  268. package/dist/esm/transpiler/condition/condition.mjs.map +1 -1
  269. package/dist/esm/transpiler/condition/index.mjs +3 -2
  270. package/dist/esm/transpiler/enumeration/enumeration.mjs +25 -7
  271. package/dist/esm/transpiler/enumeration/enumeration.mjs.map +1 -1
  272. package/dist/esm/transpiler/enumeration/index.mjs +3 -2
  273. package/dist/esm/transpiler/file/file.mjs +46 -40
  274. package/dist/esm/transpiler/file/file.mjs.map +1 -1
  275. package/dist/esm/transpiler/file/fileBrowser.mjs +22 -9
  276. package/dist/esm/transpiler/file/fileBrowser.mjs.map +1 -1
  277. package/dist/esm/transpiler/file/index.mjs +3 -2
  278. package/dist/esm/transpiler/gender/gender.mjs +23 -7
  279. package/dist/esm/transpiler/gender/gender.mjs.map +1 -1
  280. package/dist/esm/transpiler/gender/index.mjs +3 -2
  281. package/dist/esm/transpiler/index.mjs +11 -8
  282. package/dist/esm/transpiler/insertion/getInsertionValues.mjs +7 -7
  283. package/dist/esm/transpiler/insertion/getInsertionValues.mjs.map +1 -1
  284. package/dist/esm/transpiler/insertion/index.mjs +4 -3
  285. package/dist/esm/transpiler/insertion/insertion.mjs +31 -29
  286. package/dist/esm/transpiler/insertion/insertion.mjs.map +1 -1
  287. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs +52 -61
  288. package/dist/esm/transpiler/markdown/getMarkdownMetadata.mjs.map +1 -1
  289. package/dist/esm/transpiler/markdown/index.mjs +4 -3
  290. package/dist/esm/transpiler/markdown/markdown.mjs +29 -29
  291. package/dist/esm/transpiler/markdown/markdown.mjs.map +1 -1
  292. package/dist/esm/transpiler/nesting/index.mjs +3 -2
  293. package/dist/esm/transpiler/nesting/nesting.mjs +23 -9
  294. package/dist/esm/transpiler/nesting/nesting.mjs.map +1 -1
  295. package/dist/esm/transpiler/translation/index.mjs +3 -2
  296. package/dist/esm/transpiler/translation/translation.mjs +26 -7
  297. package/dist/esm/transpiler/translation/translation.mjs.map +1 -1
  298. package/dist/esm/utils/checkIsURLAbsolute.mjs +4 -3
  299. package/dist/esm/utils/checkIsURLAbsolute.mjs.map +1 -1
  300. package/dist/esm/utils/intl.mjs +44 -49
  301. package/dist/esm/utils/intl.mjs.map +1 -1
  302. package/dist/esm/utils/isSameKeyPath.mjs +5 -6
  303. package/dist/esm/utils/isSameKeyPath.mjs.map +1 -1
  304. package/dist/esm/utils/isValidReactElement.mjs +11 -3
  305. package/dist/esm/utils/isValidReactElement.mjs.map +1 -1
  306. package/dist/esm/utils/localeStorage.mjs +139 -0
  307. package/dist/esm/utils/localeStorage.mjs.map +1 -0
  308. package/dist/esm/utils/parseYaml.mjs +184 -31
  309. package/dist/esm/utils/parseYaml.mjs.map +1 -1
  310. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts +46 -0
  311. package/dist/types/deepTransformPlugins/getFilterMissingTranslationsContent.d.ts.map +1 -0
  312. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts +38 -0
  313. package/dist/types/deepTransformPlugins/getFilterTranslationsOnlyContent.d.ts.map +1 -0
  314. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts +30 -0
  315. package/dist/types/deepTransformPlugins/getFilteredLocalesContent.d.ts.map +1 -0
  316. package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts +18 -0
  317. package/dist/types/deepTransformPlugins/getLocalizedContent.d.ts.map +1 -0
  318. package/dist/types/deepTransformPlugins/getMaskContent.d.ts +10 -0
  319. package/dist/types/deepTransformPlugins/getMaskContent.d.ts.map +1 -0
  320. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts +16 -0
  321. package/dist/types/deepTransformPlugins/getMissingLocalesContent.d.ts.map +1 -0
  322. package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts +8 -0
  323. package/dist/types/deepTransformPlugins/getReplacedValuesContent.d.ts.map +1 -0
  324. package/dist/types/deepTransformPlugins/index.d.ts +9 -0
  325. package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts +25 -0
  326. package/dist/types/deepTransformPlugins/insertContentInDictionary.d.ts.map +1 -0
  327. package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts +6 -3
  328. package/dist/types/dictionaryManipulator/editDictionaryByKeyPath.d.ts.map +1 -1
  329. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts +6 -3
  330. package/dist/types/dictionaryManipulator/getContentNodeByKeyPath.d.ts.map +1 -1
  331. package/dist/types/dictionaryManipulator/getDefaultNode.d.ts +6 -3
  332. package/dist/types/dictionaryManipulator/getDefaultNode.d.ts.map +1 -1
  333. package/dist/types/dictionaryManipulator/getEmptyNode.d.ts +6 -2
  334. package/dist/types/dictionaryManipulator/getEmptyNode.d.ts.map +1 -1
  335. package/dist/types/dictionaryManipulator/getNodeChildren.d.ts +6 -2
  336. package/dist/types/dictionaryManipulator/getNodeChildren.d.ts.map +1 -1
  337. package/dist/types/dictionaryManipulator/getNodeType.d.ts +6 -3
  338. package/dist/types/dictionaryManipulator/getNodeType.d.ts.map +1 -1
  339. package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts +8 -3
  340. package/dist/types/dictionaryManipulator/getUnmergedDictionaryByKeyPath.d.ts.map +1 -1
  341. package/dist/types/dictionaryManipulator/index.d.ts +14 -11
  342. package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts +7 -0
  343. package/dist/types/dictionaryManipulator/mergeDictionaries.d.ts.map +1 -0
  344. package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts +8 -0
  345. package/dist/types/dictionaryManipulator/normalizeDictionary.d.ts.map +1 -0
  346. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts +16 -0
  347. package/dist/types/dictionaryManipulator/orderDictionaries.d.ts.map +1 -0
  348. package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts +6 -3
  349. package/dist/types/dictionaryManipulator/removeContentNodeByKeyPath.d.ts.map +1 -1
  350. package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts +6 -3
  351. package/dist/types/dictionaryManipulator/renameContentNodeByKeyPath.d.ts.map +1 -1
  352. package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts +6 -2
  353. package/dist/types/dictionaryManipulator/updateNodeChildren.d.ts.map +1 -1
  354. package/dist/types/formatters/compact.d.ts +8 -3
  355. package/dist/types/formatters/compact.d.ts.map +1 -1
  356. package/dist/types/formatters/currency.d.ts +8 -3
  357. package/dist/types/formatters/currency.d.ts.map +1 -1
  358. package/dist/types/formatters/date.d.ts +8 -3
  359. package/dist/types/formatters/date.d.ts.map +1 -1
  360. package/dist/types/formatters/index.d.ts +9 -9
  361. package/dist/types/formatters/list.d.ts +8 -3
  362. package/dist/types/formatters/list.d.ts.map +1 -1
  363. package/dist/types/formatters/number.d.ts +8 -3
  364. package/dist/types/formatters/number.d.ts.map +1 -1
  365. package/dist/types/formatters/percentage.d.ts +8 -3
  366. package/dist/types/formatters/percentage.d.ts.map +1 -1
  367. package/dist/types/formatters/relativeTime.d.ts +8 -5
  368. package/dist/types/formatters/relativeTime.d.ts.map +1 -1
  369. package/dist/types/formatters/units.d.ts +8 -3
  370. package/dist/types/formatters/units.d.ts.map +1 -1
  371. package/dist/types/getStorageAttributes.d.ts +25 -0
  372. package/dist/types/getStorageAttributes.d.ts.map +1 -0
  373. package/dist/types/index.d.ts +67 -13
  374. package/dist/types/interpreter/getCondition.d.ts +7 -2
  375. package/dist/types/interpreter/getCondition.d.ts.map +1 -1
  376. package/dist/types/interpreter/getContent/deepTransform.d.ts +7 -2
  377. package/dist/types/interpreter/getContent/deepTransform.d.ts.map +1 -1
  378. package/dist/types/interpreter/getContent/getContent.d.ts +8 -4
  379. package/dist/types/interpreter/getContent/getContent.d.ts.map +1 -1
  380. package/dist/types/interpreter/getContent/index.d.ts +4 -4
  381. package/dist/types/interpreter/getContent/plugins.d.ts +68 -66
  382. package/dist/types/interpreter/getContent/plugins.d.ts.map +1 -1
  383. package/dist/types/interpreter/getDictionary.d.ts +8 -4
  384. package/dist/types/interpreter/getDictionary.d.ts.map +1 -1
  385. package/dist/types/interpreter/getEnumeration.d.ts +8 -3
  386. package/dist/types/interpreter/getEnumeration.d.ts.map +1 -1
  387. package/dist/types/interpreter/getGender.d.ts +7 -4
  388. package/dist/types/interpreter/getGender.d.ts.map +1 -1
  389. package/dist/types/interpreter/getInsertion.d.ts +7 -2
  390. package/dist/types/interpreter/getInsertion.d.ts.map +1 -1
  391. package/dist/types/interpreter/getIntlayer.d.ts +7 -5
  392. package/dist/types/interpreter/getIntlayer.d.ts.map +1 -1
  393. package/dist/types/interpreter/getNesting.d.ts +9 -6
  394. package/dist/types/interpreter/getNesting.d.ts.map +1 -1
  395. package/dist/types/interpreter/getTranslation.d.ts +7 -3
  396. package/dist/types/interpreter/getTranslation.d.ts.map +1 -1
  397. package/dist/types/interpreter/index.d.ts +10 -10
  398. package/dist/types/localization/getBrowserLocale.d.ts +35 -0
  399. package/dist/types/localization/getBrowserLocale.d.ts.map +1 -0
  400. package/dist/types/localization/getHTMLTextDir.d.ts +6 -3
  401. package/dist/types/localization/getHTMLTextDir.d.ts.map +1 -1
  402. package/dist/types/localization/getLocaleFromPath.d.ts +7 -2
  403. package/dist/types/localization/getLocaleFromPath.d.ts.map +1 -1
  404. package/dist/types/localization/getLocaleLang.d.ts +7 -2
  405. package/dist/types/localization/getLocaleLang.d.ts.map +1 -1
  406. package/dist/types/localization/getLocaleName.d.ts +6 -2
  407. package/dist/types/localization/getLocaleName.d.ts.map +1 -1
  408. package/dist/types/localization/getLocalizedUrl.d.ts +30 -17
  409. package/dist/types/localization/getLocalizedUrl.d.ts.map +1 -1
  410. package/dist/types/localization/getMultilingualUrls.d.ts +28 -12
  411. package/dist/types/localization/getMultilingualUrls.d.ts.map +1 -1
  412. package/dist/types/localization/getPathWithoutLocale.d.ts +11 -3
  413. package/dist/types/localization/getPathWithoutLocale.d.ts.map +1 -1
  414. package/dist/types/localization/index.d.ts +12 -12
  415. package/dist/types/localization/localeDetector.d.ts +7 -2
  416. package/dist/types/localization/localeDetector.d.ts.map +1 -1
  417. package/dist/types/localization/localeMapper.d.ts +23 -19
  418. package/dist/types/localization/localeMapper.d.ts.map +1 -1
  419. package/dist/types/localization/localeResolver.d.ts +7 -2
  420. package/dist/types/localization/localeResolver.d.ts.map +1 -1
  421. package/dist/types/transpiler/condition/condition.d.ts +8 -5
  422. package/dist/types/transpiler/condition/condition.d.ts.map +1 -1
  423. package/dist/types/transpiler/condition/index.d.ts +2 -2
  424. package/dist/types/transpiler/enumeration/enumeration.d.ts +9 -6
  425. package/dist/types/transpiler/enumeration/enumeration.d.ts.map +1 -1
  426. package/dist/types/transpiler/enumeration/index.d.ts +2 -2
  427. package/dist/types/transpiler/file/file.d.ts +11 -6
  428. package/dist/types/transpiler/file/file.d.ts.map +1 -1
  429. package/dist/types/transpiler/file/fileBrowser.d.ts +7 -2
  430. package/dist/types/transpiler/file/fileBrowser.d.ts.map +1 -1
  431. package/dist/types/transpiler/file/index.d.ts +2 -2
  432. package/dist/types/transpiler/gender/gender.d.ts +9 -6
  433. package/dist/types/transpiler/gender/gender.d.ts.map +1 -1
  434. package/dist/types/transpiler/gender/index.d.ts +2 -2
  435. package/dist/types/transpiler/index.d.ts +11 -9
  436. package/dist/types/transpiler/insertion/getInsertionValues.d.ts +4 -1
  437. package/dist/types/transpiler/insertion/getInsertionValues.d.ts.map +1 -1
  438. package/dist/types/transpiler/insertion/index.d.ts +3 -3
  439. package/dist/types/transpiler/insertion/insertion.d.ts +8 -5
  440. package/dist/types/transpiler/insertion/insertion.d.ts.map +1 -1
  441. package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts +4 -1
  442. package/dist/types/transpiler/markdown/getMarkdownMetadata.d.ts.map +1 -1
  443. package/dist/types/transpiler/markdown/index.d.ts +3 -3
  444. package/dist/types/transpiler/markdown/markdown.d.ts +8 -5
  445. package/dist/types/transpiler/markdown/markdown.d.ts.map +1 -1
  446. package/dist/types/transpiler/nesting/index.d.ts +2 -2
  447. package/dist/types/transpiler/nesting/nesting.d.ts +24 -25
  448. package/dist/types/transpiler/nesting/nesting.d.ts.map +1 -1
  449. package/dist/types/transpiler/translation/index.d.ts +2 -2
  450. package/dist/types/transpiler/translation/translation.d.ts +9 -6
  451. package/dist/types/transpiler/translation/translation.d.ts.map +1 -1
  452. package/dist/types/utils/checkIsURLAbsolute.d.ts +4 -1
  453. package/dist/types/utils/checkIsURLAbsolute.d.ts.map +1 -1
  454. package/dist/types/utils/intl.d.ts +9 -10
  455. package/dist/types/utils/intl.d.ts.map +1 -1
  456. package/dist/types/utils/isSameKeyPath.d.ts +6 -2
  457. package/dist/types/utils/isSameKeyPath.d.ts.map +1 -1
  458. package/dist/types/utils/isValidReactElement.d.ts +4 -1
  459. package/dist/types/utils/isValidReactElement.d.ts.map +1 -1
  460. package/dist/types/utils/localeStorage.d.ts +105 -0
  461. package/dist/types/utils/localeStorage.d.ts.map +1 -0
  462. package/dist/types/utils/parseYaml.d.ts +4 -1
  463. package/dist/types/utils/parseYaml.d.ts.map +1 -1
  464. package/package.json +36 -121
  465. package/LICENSE +0 -202
  466. package/dist/cjs/deepTranformPlugins/getFilterTranslationsOnlyContent.cjs +0 -130
  467. package/dist/cjs/deepTranformPlugins/getFilterTranslationsOnlyContent.cjs.map +0 -1
  468. package/dist/cjs/deepTranformPlugins/getFilteredLocalesContent.cjs +0 -62
  469. package/dist/cjs/deepTranformPlugins/getFilteredLocalesContent.cjs.map +0 -1
  470. package/dist/cjs/deepTranformPlugins/getLocalisedContent.cjs +0 -51
  471. package/dist/cjs/deepTranformPlugins/getLocalisedContent.cjs.map +0 -1
  472. package/dist/cjs/deepTranformPlugins/getMaskContent.cjs +0 -49
  473. package/dist/cjs/deepTranformPlugins/getMaskContent.cjs.map +0 -1
  474. package/dist/cjs/deepTranformPlugins/getMissingLocalesContent.cjs +0 -78
  475. package/dist/cjs/deepTranformPlugins/getMissingLocalesContent.cjs.map +0 -1
  476. package/dist/cjs/deepTranformPlugins/getReplacedValuesContent.cjs +0 -82
  477. package/dist/cjs/deepTranformPlugins/getReplacedValuesContent.cjs.map +0 -1
  478. package/dist/cjs/deepTranformPlugins/index.cjs +0 -33
  479. package/dist/cjs/deepTranformPlugins/index.cjs.map +0 -1
  480. package/dist/cjs/dictionaryManipulator/index.cjs.map +0 -1
  481. package/dist/cjs/formatters/index.cjs.map +0 -1
  482. package/dist/cjs/index.cjs.map +0 -1
  483. package/dist/cjs/interpreter/getContent/index.cjs.map +0 -1
  484. package/dist/cjs/interpreter/getIntlayerAsync.cjs +0 -37
  485. package/dist/cjs/interpreter/getIntlayerAsync.cjs.map +0 -1
  486. package/dist/cjs/interpreter/index.cjs.map +0 -1
  487. package/dist/cjs/localization/index.cjs.map +0 -1
  488. package/dist/cjs/localization/localeList.cjs +0 -256
  489. package/dist/cjs/localization/localeList.cjs.map +0 -1
  490. package/dist/cjs/transpiler/condition/index.cjs.map +0 -1
  491. package/dist/cjs/transpiler/enumeration/index.cjs.map +0 -1
  492. package/dist/cjs/transpiler/file/index.cjs.map +0 -1
  493. package/dist/cjs/transpiler/gender/index.cjs.map +0 -1
  494. package/dist/cjs/transpiler/index.cjs.map +0 -1
  495. package/dist/cjs/transpiler/insertion/index.cjs.map +0 -1
  496. package/dist/cjs/transpiler/markdown/index.cjs.map +0 -1
  497. package/dist/cjs/transpiler/nesting/index.cjs.map +0 -1
  498. package/dist/cjs/transpiler/translation/index.cjs.map +0 -1
  499. package/dist/cjs/types/dictionary.cjs +0 -17
  500. package/dist/cjs/types/dictionary.cjs.map +0 -1
  501. package/dist/cjs/types/index.cjs +0 -29
  502. package/dist/cjs/types/index.cjs.map +0 -1
  503. package/dist/cjs/types/intlayer.cjs +0 -35
  504. package/dist/cjs/types/intlayer.cjs.map +0 -1
  505. package/dist/cjs/types/keyPath.cjs +0 -17
  506. package/dist/cjs/types/keyPath.cjs.map +0 -1
  507. package/dist/cjs/types/nodeType.cjs +0 -53
  508. package/dist/cjs/types/nodeType.cjs.map +0 -1
  509. package/dist/cjs/types/translation.cjs +0 -17
  510. package/dist/cjs/types/translation.cjs.map +0 -1
  511. package/dist/esm/deepTranformPlugins/getFilterTranslationsOnlyContent.mjs +0 -95
  512. package/dist/esm/deepTranformPlugins/getFilterTranslationsOnlyContent.mjs.map +0 -1
  513. package/dist/esm/deepTranformPlugins/getFilteredLocalesContent.mjs +0 -40
  514. package/dist/esm/deepTranformPlugins/getFilteredLocalesContent.mjs.map +0 -1
  515. package/dist/esm/deepTranformPlugins/getLocalisedContent.mjs +0 -19
  516. package/dist/esm/deepTranformPlugins/getLocalisedContent.mjs.map +0 -1
  517. package/dist/esm/deepTranformPlugins/getMaskContent.mjs +0 -24
  518. package/dist/esm/deepTranformPlugins/getMaskContent.mjs.map +0 -1
  519. package/dist/esm/deepTranformPlugins/getMissingLocalesContent.mjs +0 -43
  520. package/dist/esm/deepTranformPlugins/getMissingLocalesContent.mjs.map +0 -1
  521. package/dist/esm/deepTranformPlugins/getReplacedValuesContent.mjs +0 -60
  522. package/dist/esm/deepTranformPlugins/getReplacedValuesContent.mjs.map +0 -1
  523. package/dist/esm/deepTranformPlugins/index.mjs +0 -7
  524. package/dist/esm/deepTranformPlugins/index.mjs.map +0 -1
  525. package/dist/esm/dictionaryManipulator/index.mjs.map +0 -1
  526. package/dist/esm/formatters/index.mjs.map +0 -1
  527. package/dist/esm/index.mjs.map +0 -1
  528. package/dist/esm/interpreter/getContent/index.mjs.map +0 -1
  529. package/dist/esm/interpreter/getIntlayerAsync.mjs +0 -13
  530. package/dist/esm/interpreter/getIntlayerAsync.mjs.map +0 -1
  531. package/dist/esm/interpreter/index.mjs.map +0 -1
  532. package/dist/esm/localization/index.mjs.map +0 -1
  533. package/dist/esm/localization/localeList.mjs +0 -232
  534. package/dist/esm/localization/localeList.mjs.map +0 -1
  535. package/dist/esm/transpiler/condition/index.mjs.map +0 -1
  536. package/dist/esm/transpiler/enumeration/index.mjs.map +0 -1
  537. package/dist/esm/transpiler/file/index.mjs.map +0 -1
  538. package/dist/esm/transpiler/gender/index.mjs.map +0 -1
  539. package/dist/esm/transpiler/index.mjs.map +0 -1
  540. package/dist/esm/transpiler/insertion/index.mjs.map +0 -1
  541. package/dist/esm/transpiler/markdown/index.mjs.map +0 -1
  542. package/dist/esm/transpiler/nesting/index.mjs.map +0 -1
  543. package/dist/esm/transpiler/translation/index.mjs.map +0 -1
  544. package/dist/esm/types/dictionary.mjs +0 -1
  545. package/dist/esm/types/dictionary.mjs.map +0 -1
  546. package/dist/esm/types/index.mjs +0 -5
  547. package/dist/esm/types/index.mjs.map +0 -1
  548. package/dist/esm/types/intlayer.mjs +0 -13
  549. package/dist/esm/types/intlayer.mjs.map +0 -1
  550. package/dist/esm/types/keyPath.mjs +0 -1
  551. package/dist/esm/types/keyPath.mjs.map +0 -1
  552. package/dist/esm/types/nodeType.mjs +0 -28
  553. package/dist/esm/types/nodeType.mjs.map +0 -1
  554. package/dist/esm/types/translation.mjs +0 -1
  555. package/dist/esm/types/translation.mjs.map +0 -1
  556. package/dist/types/deepTranformPlugins/getFilterTranslationsOnlyContent.d.ts +0 -13
  557. package/dist/types/deepTranformPlugins/getFilterTranslationsOnlyContent.d.ts.map +0 -1
  558. package/dist/types/deepTranformPlugins/getFilteredLocalesContent.d.ts +0 -5
  559. package/dist/types/deepTranformPlugins/getFilteredLocalesContent.d.ts.map +0 -1
  560. package/dist/types/deepTranformPlugins/getLocalisedContent.d.ts +0 -13
  561. package/dist/types/deepTranformPlugins/getLocalisedContent.d.ts.map +0 -1
  562. package/dist/types/deepTranformPlugins/getMaskContent.d.ts +0 -6
  563. package/dist/types/deepTranformPlugins/getMaskContent.d.ts.map +0 -1
  564. package/dist/types/deepTranformPlugins/getMissingLocalesContent.d.ts +0 -13
  565. package/dist/types/deepTranformPlugins/getMissingLocalesContent.d.ts.map +0 -1
  566. package/dist/types/deepTranformPlugins/getReplacedValuesContent.d.ts +0 -4
  567. package/dist/types/deepTranformPlugins/getReplacedValuesContent.d.ts.map +0 -1
  568. package/dist/types/deepTranformPlugins/index.d.ts +0 -7
  569. package/dist/types/deepTranformPlugins/index.d.ts.map +0 -1
  570. package/dist/types/dictionaryManipulator/index.d.ts.map +0 -1
  571. package/dist/types/formatters/index.d.ts.map +0 -1
  572. package/dist/types/index.d.ts.map +0 -1
  573. package/dist/types/interpreter/getContent/index.d.ts.map +0 -1
  574. package/dist/types/interpreter/getIntlayerAsync.d.ts +0 -13
  575. package/dist/types/interpreter/getIntlayerAsync.d.ts.map +0 -1
  576. package/dist/types/interpreter/index.d.ts.map +0 -1
  577. package/dist/types/localization/index.d.ts.map +0 -1
  578. package/dist/types/localization/localeList.d.ts +0 -3
  579. package/dist/types/localization/localeList.d.ts.map +0 -1
  580. package/dist/types/transpiler/condition/index.d.ts.map +0 -1
  581. package/dist/types/transpiler/enumeration/index.d.ts.map +0 -1
  582. package/dist/types/transpiler/file/index.d.ts.map +0 -1
  583. package/dist/types/transpiler/gender/index.d.ts.map +0 -1
  584. package/dist/types/transpiler/index.d.ts.map +0 -1
  585. package/dist/types/transpiler/insertion/index.d.ts.map +0 -1
  586. package/dist/types/transpiler/markdown/index.d.ts.map +0 -1
  587. package/dist/types/transpiler/nesting/index.d.ts.map +0 -1
  588. package/dist/types/transpiler/translation/index.d.ts.map +0 -1
  589. package/dist/types/types/dictionary.d.ts +0 -307
  590. package/dist/types/types/dictionary.d.ts.map +0 -1
  591. package/dist/types/types/index.d.ts +0 -5
  592. package/dist/types/types/index.d.ts.map +0 -1
  593. package/dist/types/types/intlayer.d.ts +0 -5
  594. package/dist/types/types/intlayer.d.ts.map +0 -1
  595. package/dist/types/types/keyPath.d.ts +0 -47
  596. package/dist/types/types/keyPath.d.ts.map +0 -1
  597. package/dist/types/types/nodeType.d.ts +0 -30
  598. package/dist/types/types/nodeType.d.ts.map +0 -1
  599. package/dist/types/types/translation.d.ts +0 -25
  600. package/dist/types/types/translation.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { Locales, LocalesValues } from '@intlayer/config/client';\n\nexport type LocaleData = {\n locale: LocalesValues;\n defaultLocale: LocalesValues;\n isDefault: boolean;\n locales: LocalesValues[];\n urlPrefix: string;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale,\n prefixDefault: boolean = configuration.middleware.prefixDefault\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n })\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n * {\n * en: { ... }, // Content of translations/en.json\n * fr: { ... }, // Content of translations/fr.json\n * es: { ... } // Content of translations/es.json\n * }\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param prefixDefault - Whether to prefix the default locale in URLs (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: Locales[] = configuration?.internationalization.locales,\n defaultLocale: Locales = configuration?.internationalization.defaultLocale,\n prefixDefault: boolean = configuration?.middleware.prefixDefault\n): Record<Locales, T> =>\n locales.reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix:\n locale === defaultLocale && !prefixDefault ? '' : `/${locale}`,\n });\n return acc;\n },\n {} as Record<Locales, T>\n );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAqCnB,MAAM,YAAY,CACvB,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAI,CAAC,WACX,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AA4BK,MAAM,gBAAgB,CAC3B,QACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,eACH,gBAAyB,aAAAA,QAAc,WAAW,kBAElD,QAAQ;AAAA,EAAQ,CAAC,WACf,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA,WAAW,WAAW;AAAA,IACtB,WAAW,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,EACzE,CAAC;AACH;AAyBK,MAAM,eAAe,CAC1B,QACA,UAAqB,aAAAA,SAAe,qBAAqB,SACzD,gBAAyB,aAAAA,SAAe,qBAAqB,eAC7D,gBAAyB,aAAAA,SAAe,WAAW,kBAEnD,QAAQ;AAAA,EACN,CAAC,KAAK,WAAW;AACf,QAAI,MAAM,IAAI,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,WAAW;AAAA,MACtB,WACE,WAAW,iBAAiB,CAAC,gBAAgB,KAAK,IAAI,MAAM;AAAA,IAChE,CAAC;AACD,WAAO;AAAA,EACT;AAAA,EACA,CAAC;AACH;","names":["configuration"]}
1
+ {"version":3,"file":"localeMapper.cjs","names":["configuration","Locales"],"sources":["../../../src/localization/localeMapper.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { type Locale, Locales, type LocalesValues } from '@intlayer/types';\n\nexport type LocaleData = {\n locale: Locale;\n defaultLocale: Locale;\n isDefault: boolean;\n locales: Locale[];\n urlPrefix: string;\n};\n\n/**\n * Determine if the locale should be prefixed in the URL based on routing mode\n */\nconst shouldPrefixLocale = (\n locale: LocalesValues,\n defaultLocale: LocalesValues,\n mode: 'prefix-no-default' | 'prefix-all' | 'no-prefix' | 'search-params'\n): boolean => {\n if (mode === 'no-prefix' || mode === 'search-params') {\n return false;\n }\n if (mode === 'prefix-all') {\n return true;\n }\n // 'prefix-no-default'\n return locale !== defaultLocale;\n};\n\n/**\n * Map the locale data to an array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * ({\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }),\n * );\n *\n * // Result\n * [\n * { path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' },\n * { path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' },\n * { path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' },\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an object\n * @returns An array of objects\n */\nexport const localeMap = <T>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration?.internationalization.locales ?? [],\n defaultLocale: LocalesValues = configuration?.internationalization\n .defaultLocale ?? Locales.ENGLISH,\n mode:\n | 'prefix-no-default'\n | 'prefix-all'\n | 'no-prefix'\n | 'search-params' = configuration?.routing?.mode ?? 'prefix-no-default'\n): T[] =>\n (locales ?? []).map((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: shouldPrefixLocale(locale, defaultLocale, mode)\n ? `/${locale}`\n : '',\n } as LocaleData)\n );\n\n/**\n * Flatten the locale map into a single array of objects\n *\n * @example\n * ```ts\n * const routes = localeMap((localizedData) =>\n * [{\n * path: localizedData.urlPrefix,\n * name: localizedData.locale,\n * isDefault: localizedData.isDefault,\n * locales: localizedData.locales,\n * defaultLocale: localizedData.defaultLocale,\n * }],\n * );\n *\n * // Result\n * [\n * path: '/', name: 'en', isDefault: true, locales: ['en'], defaultLocale: 'en', urlPrefix: '' ,\n * path: '/fr', name: 'fr', isDefault: false, locales: ['fr'], defaultLocale: 'en', urlPrefix: '/fr' ,\n * path: '/es', name: 'es', isDefault: false, locales: ['es'], defaultLocale: 'en', urlPrefix: '/es' ,\n * ]\n * ```\n *\n * @param mapper - The mapper function that returns an array of objects\n * @returns An array of objects\n */\nexport const localeFlatMap = <T>(\n mapper: (locale: LocaleData) => T[],\n locales: LocalesValues[] = configuration?.internationalization.locales ?? [],\n defaultLocale: LocalesValues = configuration?.internationalization\n .defaultLocale ?? Locales.ENGLISH,\n mode:\n | 'prefix-no-default'\n | 'prefix-all'\n | 'no-prefix'\n | 'search-params' = configuration?.routing?.mode ?? 'prefix-no-default'\n): T[] =>\n locales.flatMap((locale) =>\n mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: shouldPrefixLocale(locale, defaultLocale, mode)\n ? `/${locale}`\n : '',\n } as LocaleData)\n );\n\n/**\n * Creates a record object mapping locales to values transformed by the mapper function\n *\n * @example\n * ```ts\n * const translations = localeRecord(({ locale }) =>\n * require(`./translations/${locale}.json`)\n * );\n *\n * // Result\n *\n * en: ... , // Content of translations/en.json\n * fr: ... , // Content of translations/fr.json\n * es: ...\n *\n * ```\n *\n * @param mapper - Function that takes locale data and returns a value for that locale\n * @param locales - Array of locale codes to map over (defaults to configured locales)\n * @param defaultLocale - The default locale (defaults to configured default)\n * @param mode - URL routing mode for locale handling (defaults to configured value)\n * @returns Record mapping locale codes to mapped values\n */\nexport const localeRecord = <T>(\n mapper: (locale: LocaleData) => T,\n locales: LocalesValues[] = configuration?.internationalization.locales ?? [],\n defaultLocale: LocalesValues = configuration?.internationalization\n .defaultLocale ?? Locales.ENGLISH,\n mode:\n | 'prefix-no-default'\n | 'prefix-all'\n | 'no-prefix'\n | 'search-params' = configuration?.routing?.mode ?? 'prefix-no-default'\n): Record<LocalesValues, T> =>\n (locales ?? []).reduce(\n (acc, locale) => {\n acc[locale] = mapper({\n locale,\n defaultLocale,\n locales,\n isDefault: locale === defaultLocale,\n urlPrefix: shouldPrefixLocale(locale, defaultLocale, mode)\n ? `/${locale}`\n : '',\n } as LocaleData);\n return acc;\n },\n {} as Record<LocalesValues, T>\n );\n"],"mappings":";;;;;;;;;;AAcA,MAAM,sBACJ,QACA,eACA,SACY;AACZ,KAAI,SAAS,eAAe,SAAS,gBACnC,QAAO;AAET,KAAI,SAAS,aACX,QAAO;AAGT,QAAO,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BpB,MAAa,aACX,QACA,UAA2BA,iCAAe,qBAAqB,WAAW,EAAE,EAC5E,gBAA+BA,iCAAe,qBAC3C,iBAAiBC,yBAAQ,SAC5B,OAIsBD,iCAAe,SAAS,QAAQ,yBAErD,WAAW,EAAE,EAAE,KAAK,WACnB,OAAO;CACL;CACA;CACA;CACA,WAAW,WAAW;CACtB,WAAW,mBAAmB,QAAQ,eAAe,KAAK,GACtD,IAAI,WACJ;CACL,CAAe,CACjB;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BH,MAAa,iBACX,QACA,UAA2BA,iCAAe,qBAAqB,WAAW,EAAE,EAC5E,gBAA+BA,iCAAe,qBAC3C,iBAAiBC,yBAAQ,SAC5B,OAIsBD,iCAAe,SAAS,QAAQ,wBAEtD,QAAQ,SAAS,WACf,OAAO;CACL;CACA;CACA;CACA,WAAW,WAAW;CACtB,WAAW,mBAAmB,QAAQ,eAAe,KAAK,GACtD,IAAI,WACJ;CACL,CAAe,CACjB;;;;;;;;;;;;;;;;;;;;;;;;AAyBH,MAAa,gBACX,QACA,UAA2BA,iCAAe,qBAAqB,WAAW,EAAE,EAC5E,gBAA+BA,iCAAe,qBAC3C,iBAAiBC,yBAAQ,SAC5B,OAIsBD,iCAAe,SAAS,QAAQ,yBAErD,WAAW,EAAE,EAAE,QACb,KAAK,WAAW;AACf,KAAI,UAAU,OAAO;EACnB;EACA;EACA;EACA,WAAW,WAAW;EACtB,WAAW,mBAAmB,QAAQ,eAAe,KAAK,GACtD,IAAI,WACJ;EACL,CAAe;AAChB,QAAO;GAET,EAAE,CACH"}
@@ -1,63 +1,28 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_config_built = require("@intlayer/config/built");
3
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
4
+
5
+ //#region src/localization/localeResolver.ts
6
+ /**
7
+ * Resolves the most specific locale from a user-provided list,
8
+ * or falls back to the default locale if no match is found.
9
+ */
10
+ const localeResolver = (selectedLocale, locales = __intlayer_config_built.default?.internationalization?.locales, defaultLocale = __intlayer_config_built.default?.internationalization?.defaultLocale) => {
11
+ const requestedLocales = [selectedLocale].flat();
12
+ const normalize = (locale) => locale.trim().toLowerCase();
13
+ try {
14
+ for (const requested of requestedLocales) {
15
+ const normalizedRequested = normalize(requested);
16
+ const exactMatch = locales.find((loc) => normalize(loc) === normalizedRequested);
17
+ if (exactMatch) return exactMatch;
18
+ const [requestedLang] = normalizedRequested.split("-");
19
+ const partialMatch = locales.find((loc) => normalize(loc).split("-")[0] === requestedLang);
20
+ if (partialMatch) return partialMatch;
21
+ }
22
+ } catch (_error) {}
23
+ return defaultLocale;
11
24
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var localeResolver_exports = {};
30
- __export(localeResolver_exports, {
31
- localeResolver: () => localeResolver
32
- });
33
- module.exports = __toCommonJS(localeResolver_exports);
34
- var import_built = __toESM(require("@intlayer/config/built"));
35
- const localeResolver = (selectedLocale, locales = import_built.default.internationalization.locales, defaultLocale = import_built.default.internationalization.defaultLocale) => {
36
- const requestedLocales = [selectedLocale].flat();
37
- const normalize = (locale) => locale.trim().toLowerCase();
38
- try {
39
- for (const requested of requestedLocales) {
40
- const normalizedRequested = normalize(requested);
41
- const exactMatch = locales.find(
42
- (loc) => normalize(loc) === normalizedRequested
43
- );
44
- if (exactMatch) {
45
- return exactMatch;
46
- }
47
- const [requestedLang] = normalizedRequested.split("-");
48
- const partialMatch = locales.find(
49
- (loc) => normalize(loc).split("-")[0] === requestedLang
50
- );
51
- if (partialMatch) {
52
- return partialMatch;
53
- }
54
- }
55
- } catch (_error) {
56
- }
57
- return defaultLocale;
58
- };
59
- // Annotate the CommonJS export names for ESM import in node:
60
- 0 && (module.exports = {
61
- localeResolver
62
- });
25
+
26
+ //#endregion
27
+ exports.localeResolver = localeResolver;
63
28
  //# sourceMappingURL=localeResolver.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/localization/localeResolver.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locales, LocalesValues } from '@intlayer/config/client';\n\n/**\n * Resolves the most specific locale from a user-provided list,\n * or falls back to the default locale if no match is found.\n */\nexport const localeResolver = (\n selectedLocale: LocalesValues | LocalesValues[],\n locales: LocalesValues[] = configuration.internationalization.locales,\n defaultLocale: LocalesValues = configuration.internationalization\n .defaultLocale\n): Locales => {\n // Ensure we can handle both a single locale or an array of locales uniformly\n const requestedLocales = [selectedLocale].flat();\n\n // Simple helper to normalize locale strings (e.g. \"en-US\" => \"en-us\")\n const normalize = (locale: string): string => locale.trim().toLowerCase();\n\n try {\n // Check each requested locale in order\n for (const requested of requestedLocales) {\n const normalizedRequested = normalize(requested);\n\n // 1) Attempt exact match\n const exactMatch = locales.find(\n (loc) => normalize(loc) === normalizedRequested\n );\n if (exactMatch) {\n return exactMatch as Locales;\n }\n\n // 2) Attempt partial match on language subtag\n // e.g. if requested is \"en-US\" and not found,\n // see if \"en\" is available among locales\n const [requestedLang] = normalizedRequested.split('-');\n const partialMatch = locales.find(\n (loc) => normalize(loc).split('-')[0] === requestedLang\n );\n if (partialMatch) {\n return partialMatch as Locales;\n }\n }\n } catch (_error) {\n // If anything unexpected happened, fall back to default\n }\n\n // If no match was found, return the default\n return defaultLocale as Locales;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAOnB,MAAM,iBAAiB,CAC5B,gBACA,UAA2B,aAAAA,QAAc,qBAAqB,SAC9D,gBAA+B,aAAAA,QAAc,qBAC1C,kBACS;AAEZ,QAAM,mBAAmB,CAAC,cAAc,EAAE,KAAK;AAG/C,QAAM,YAAY,CAAC,WAA2B,OAAO,KAAK,EAAE,YAAY;AAExE,MAAI;AAEF,eAAW,aAAa,kBAAkB;AACxC,YAAM,sBAAsB,UAAU,SAAS;AAG/C,YAAM,aAAa,QAAQ;AAAA,QACzB,CAAC,QAAQ,UAAU,GAAG,MAAM;AAAA,MAC9B;AACA,UAAI,YAAY;AACd,eAAO;AAAA,MACT;AAKA,YAAM,CAAC,aAAa,IAAI,oBAAoB,MAAM,GAAG;AACrD,YAAM,eAAe,QAAQ;AAAA,QAC3B,CAAC,QAAQ,UAAU,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,MAAM;AAAA,MAC5C;AACA,UAAI,cAAc;AAChB,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,SAAS,QAAQ;AAAA,EAEjB;AAGA,SAAO;AACT;","names":["configuration"]}
1
+ {"version":3,"file":"localeResolver.cjs","names":["configuration"],"sources":["../../../src/localization/localeResolver.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type { Locale, LocalesValues } from '@intlayer/types';\n\n/**\n * Resolves the most specific locale from a user-provided list,\n * or falls back to the default locale if no match is found.\n */\nexport const localeResolver = (\n selectedLocale: LocalesValues | LocalesValues[],\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n defaultLocale: LocalesValues = configuration?.internationalization\n ?.defaultLocale\n): Locale => {\n // Ensure we can handle both a single locale or an array of locales uniformly\n const requestedLocales = [selectedLocale].flat();\n\n // Simple helper to normalize locale strings (e.g. \"en-US\" => \"en-us\")\n const normalize = (locale: string): string => locale.trim().toLowerCase();\n\n try {\n // Check each requested locale in order\n for (const requested of requestedLocales) {\n const normalizedRequested = normalize(requested);\n\n // 1) Attempt exact match\n const exactMatch = locales.find(\n (loc) => normalize(loc) === normalizedRequested\n );\n if (exactMatch) {\n return exactMatch as Locale;\n }\n\n // 2) Attempt partial match on language subtag\n // e.g. if requested is \"en-US\" and not found,\n // see if \"en\" is available among locales\n const [requestedLang] = normalizedRequested.split('-');\n const partialMatch = locales.find(\n (loc) => normalize(loc).split('-')[0] === requestedLang\n );\n if (partialMatch) {\n return partialMatch as Locale;\n }\n }\n } catch (_error) {\n // If anything unexpected happened, fall back to default\n }\n\n // If no match was found, return the default\n return defaultLocale as Locale;\n};\n"],"mappings":";;;;;;;;;AAOA,MAAa,kBACX,gBACA,UAA2BA,iCAAe,sBAAsB,SAChE,gBAA+BA,iCAAe,sBAC1C,kBACO;CAEX,MAAM,mBAAmB,CAAC,eAAe,CAAC,MAAM;CAGhD,MAAM,aAAa,WAA2B,OAAO,MAAM,CAAC,aAAa;AAEzE,KAAI;AAEF,OAAK,MAAM,aAAa,kBAAkB;GACxC,MAAM,sBAAsB,UAAU,UAAU;GAGhD,MAAM,aAAa,QAAQ,MACxB,QAAQ,UAAU,IAAI,KAAK,oBAC7B;AACD,OAAI,WACF,QAAO;GAMT,MAAM,CAAC,iBAAiB,oBAAoB,MAAM,IAAI;GACtD,MAAM,eAAe,QAAQ,MAC1B,QAAQ,UAAU,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,cAC3C;AACD,OAAI,aACF,QAAO;;UAGJ,QAAQ;AAKjB,QAAO"}
@@ -1,30 +1,27 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var condition_exports = {};
20
- __export(condition_exports, {
21
- cond: () => condition
22
- });
23
- module.exports = __toCommonJS(condition_exports);
24
- var import_types = require('../../types/index.cjs');
25
- const condition = (content) => (0, import_types.formatNodeType)(import_types.NodeType.Condition, content);
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {
28
- cond
29
- });
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_types = require("@intlayer/types");
3
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
+
5
+ //#region src/transpiler/condition/condition.ts
6
+ /**
7
+ * Function intended to be used to build intlayer dictionaries.
8
+ *
9
+ * Allow to pick a content based on a condition.
10
+ *
11
+ * Usage:
12
+ *
13
+ * ```ts
14
+ * cond({
15
+ * 'true': 'The condition is validated',
16
+ * 'false': 'The condition is not validated',
17
+ * });
18
+ * ```
19
+ *
20
+ * The last key provided will be used as the fallback value.
21
+ *
22
+ */
23
+ const condition = (content) => (0, __intlayer_types.formatNodeType)(__intlayer_types.NodeType.Condition, content);
24
+
25
+ //#endregion
26
+ exports.cond = condition;
30
27
  //# sourceMappingURL=condition.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/condition/condition.ts"],"sourcesContent":["import {\n formatNodeType,\n NodeType,\n type TypedNodeModel,\n} from '../../types/index';\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAIO;AA4BP,MAAM,YAAY,CAAU,gBAC1B,6BAAe,sBAAS,WAAW,OAAO;","names":[]}
1
+ {"version":3,"file":"condition.cjs","names":["NodeType"],"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,iDACXA,0BAAS,WAAW,QAAQ"}
@@ -1,23 +1,3 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var condition_exports = {};
17
- module.exports = __toCommonJS(condition_exports);
18
- __reExport(condition_exports, require('./condition.cjs'), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require('./condition.cjs')
22
- });
23
- //# sourceMappingURL=index.cjs.map
1
+ const require_transpiler_condition_condition = require('./condition.cjs');
2
+
3
+ exports.cond = require_transpiler_condition_condition.cond;
@@ -1,30 +1,29 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var enumeration_exports = {};
20
- __export(enumeration_exports, {
21
- enu: () => enumeration
22
- });
23
- module.exports = __toCommonJS(enumeration_exports);
24
- var import_types = require('../../types/index.cjs');
25
- const enumeration = (content) => (0, import_types.formatNodeType)(import_types.NodeType.Enumeration, content);
26
- // Annotate the CommonJS export names for ESM import in node:
27
- 0 && (module.exports = {
28
- enu
29
- });
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_types = require("@intlayer/types");
3
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
+
5
+ //#region src/transpiler/enumeration/enumeration.ts
6
+ /**
7
+ * Function intended to be used to build intlayer dictionaries.
8
+ *
9
+ * Allow to pick a content based on a quantity.
10
+ *
11
+ * Usage:
12
+ *
13
+ * ```ts
14
+ * enu({
15
+ * '<=-2.3': 'You have less than -2.3',
16
+ * '<1': 'You have less than one',
17
+ * '2': 'You have two',
18
+ * '>=3': 'You have three or more',
19
+ * });
20
+ * ```
21
+ *
22
+ * > The order of the keys will define the priority of the content.
23
+ *
24
+ */
25
+ const enumeration = (content) => (0, __intlayer_types.formatNodeType)(__intlayer_types.NodeType.Enumeration, content);
26
+
27
+ //#endregion
28
+ exports.enu = enumeration;
30
29
  //# sourceMappingURL=enumeration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/enumeration/enumeration.ts"],"sourcesContent":["import {\n type TypedNodeModel,\n formatNodeType,\n NodeType,\n} from '../../types/index';\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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAIO;AAmDP,MAAM,cAAc,CAAU,gBAC5B,6BAAe,sBAAS,aAAa,OAAO;","names":[]}
1
+ {"version":3,"file":"enumeration.cjs","names":["NodeType"],"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,iDACbA,0BAAS,aAAa,QAAQ"}
@@ -1,23 +1,3 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var enumeration_exports = {};
17
- module.exports = __toCommonJS(enumeration_exports);
18
- __reExport(enumeration_exports, require('./enumeration.cjs'), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require('./enumeration.cjs')
22
- });
23
- //# sourceMappingURL=index.cjs.map
1
+ const require_transpiler_enumeration_enumeration = require('./enumeration.cjs');
2
+
3
+ exports.enu = require_transpiler_enumeration_enumeration.enu;
@@ -1,75 +1,56 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_types = require("@intlayer/types");
3
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
+ let node_fs = require("node:fs");
5
+ node_fs = require_rolldown_runtime.__toESM(node_fs);
6
+ let node_path = require("node:path");
7
+ node_path = require_rolldown_runtime.__toESM(node_path);
8
+ let __intlayer_config = require("@intlayer/config");
9
+ __intlayer_config = require_rolldown_runtime.__toESM(__intlayer_config);
10
+
11
+ //#region src/transpiler/file/file.ts
12
+ const fileContent = (path, callerDir, baseDir) => {
13
+ const isRelativePath = path.startsWith("./") || path.startsWith("../");
14
+ const appLogger = (0, __intlayer_config.getAppLogger)();
15
+ let filePath;
16
+ if ((0, node_path.isAbsolute)(path)) {
17
+ appLogger(`Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${callerDir}`, { level: "warn" });
18
+ filePath = path;
19
+ } else if (isRelativePath) filePath = (0, node_path.resolve)(callerDir, path);
20
+ else filePath = (0, node_path.resolve)(baseDir, path);
21
+ if ((0, node_fs.existsSync)(filePath) && (0, node_fs.statSync)(filePath).isFile()) try {
22
+ const content = (0, node_fs.readFileSync)(filePath, "utf8");
23
+ return (0, __intlayer_types.formatNodeType)(__intlayer_types.NodeType.File, path, {
24
+ content,
25
+ fixedPath: (0, node_path.relative)(baseDir, filePath)
26
+ });
27
+ } catch {
28
+ appLogger(`Unable to read path: ${(0, __intlayer_config.colorizePath)((0, node_path.relative)(baseDir, filePath))}`, { level: "warn" });
29
+ }
30
+ else appLogger(`File not found: ${(0, __intlayer_config.colorizePath)((0, node_path.relative)(baseDir, filePath))}`, { level: "warn" });
31
+ return (0, __intlayer_types.formatNodeType)(__intlayer_types.NodeType.File, path, { content: `-` });
11
32
  };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var file_exports = {};
30
- __export(file_exports, {
31
- file: () => file
32
- });
33
- module.exports = __toCommonJS(file_exports);
34
- var import_config = require("@intlayer/config");
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_fs = require("fs");
37
- var import_path = require("path");
38
- var import_types = require('../../types/index.cjs');
33
+ /**
34
+ * Function intended to be used to build intlayer dictionaries.
35
+ *
36
+ * Allow identify the usage of an external resource.
37
+ *
38
+ * Usage:
39
+ *
40
+ * ```ts
41
+ * file('/path/to/file.md') // absolute path
42
+ *
43
+ * // or
44
+ *
45
+ * file('path/to/file.md') // relative path
46
+ * ```
47
+ */
39
48
  const file = (path) => {
40
- const callerDir = intlayer_file_dir ?? process.cwd();
41
- const isAbsolutePath = path.startsWith("/");
42
- const isRelativePath = path.startsWith("./") || path.startsWith("../");
43
- const appLogger = (0, import_config.getAppLogger)(import_built.default);
44
- let filePath;
45
- if (isAbsolutePath) {
46
- appLogger(
47
- `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${intlayer_file_path}`,
48
- { level: "warn" }
49
- );
50
- filePath = path;
51
- } else if (isRelativePath) {
52
- filePath = (0, import_path.resolve)(callerDir, path);
53
- } else {
54
- filePath = (0, import_path.resolve)(process.cwd(), path);
55
- }
56
- let content;
57
- if ((0, import_fs.existsSync)(filePath)) {
58
- content = (0, import_fs.readFileSync)(filePath, "utf8");
59
- } else {
60
- appLogger(
61
- `File not found: ${(0, import_config.colorizePath)((0, import_path.relative)(import_built.default.content.baseDir, filePath))}`,
62
- { level: "warn" }
63
- );
64
- content = `File not found`;
65
- }
66
- return (0, import_types.formatNodeType)(import_types.NodeType.File, path, {
67
- content,
68
- fixedPath: (0, import_path.relative)(process.cwd(), filePath)
69
- });
49
+ const { INTLAYER_FILE_PATH, INTLAYER_BASE_DIR } = globalThis;
50
+ return fileContent(path, (0, node_path.dirname)(INTLAYER_FILE_PATH), INTLAYER_BASE_DIR);
70
51
  };
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- file
74
- });
52
+
53
+ //#endregion
54
+ exports.file = file;
55
+ exports.fileContent = fileContent;
75
56
  //# sourceMappingURL=file.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/file/file.ts"],"sourcesContent":["import { colorizePath, getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { existsSync, readFileSync } from 'fs';\nimport { relative, resolve } from 'path';\nimport {\n formatNodeType,\n NodeType,\n type TypedNodeModel,\n} from '../../types/index';\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\ndeclare const intlayer_file_path: string; // Injected by esbuild to track the file content\ndeclare const intlayer_file_dir: string; // Injected by esbuild to track the file path\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 callerDir = intlayer_file_dir ?? process.cwd();\n\n const isAbsolutePath = path.startsWith('/');\n const isRelativePath = path.startsWith('./') || path.startsWith('../');\n const appLogger = getAppLogger(configuration);\n\n let filePath: string;\n if (isAbsolutePath) {\n appLogger(\n `Using absolute path for file is not recommended. Use relative paths instead. Path: ${path}, imported from: ${intlayer_file_path}`,\n { level: 'warn' }\n );\n filePath = path;\n } else if (isRelativePath) {\n filePath = resolve(callerDir, path);\n } else {\n filePath = resolve(process.cwd(), path);\n }\n\n let content: string;\n\n if (existsSync(filePath)) {\n content = readFileSync(filePath, 'utf8');\n } else {\n appLogger(\n `File not found: ${colorizePath(relative(configuration.content.baseDir, filePath))}`,\n { level: 'warn' }\n );\n\n content = `File not found`;\n }\n\n return formatNodeType(NodeType.File, path, {\n content,\n fixedPath: relative(process.cwd(), filePath),\n });\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2C;AAC3C,mBAA0B;AAC1B,gBAAyC;AACzC,kBAAkC;AAClC,mBAIO;AA4BA,MAAM,OAAO,CAAC,SAA8B;AACjD,QAAM,YAAY,qBAAqB,QAAQ,IAAI;AAEnD,QAAM,iBAAiB,KAAK,WAAW,GAAG;AAC1C,QAAM,iBAAiB,KAAK,WAAW,IAAI,KAAK,KAAK,WAAW,KAAK;AACrE,QAAM,gBAAY,4BAAa,aAAAA,OAAa;AAE5C,MAAI;AACJ,MAAI,gBAAgB;AAClB;AAAA,MACE,sFAAsF,IAAI,oBAAoB,kBAAkB;AAAA,MAChI,EAAE,OAAO,OAAO;AAAA,IAClB;AACA,eAAW;AAAA,EACb,WAAW,gBAAgB;AACzB,mBAAW,qBAAQ,WAAW,IAAI;AAAA,EACpC,OAAO;AACL,mBAAW,qBAAQ,QAAQ,IAAI,GAAG,IAAI;AAAA,EACxC;AAEA,MAAI;AAEJ,UAAI,sBAAW,QAAQ,GAAG;AACxB,kBAAU,wBAAa,UAAU,MAAM;AAAA,EACzC,OAAO;AACL;AAAA,MACE,uBAAmB,gCAAa,sBAAS,aAAAA,QAAc,QAAQ,SAAS,QAAQ,CAAC,CAAC;AAAA,MAClF,EAAE,OAAO,OAAO;AAAA,IAClB;AAEA,cAAU;AAAA,EACZ;AAEA,aAAO,6BAAe,sBAAS,MAAM,MAAM;AAAA,IACzC;AAAA,IACA,eAAW,sBAAS,QAAQ,IAAI,GAAG,QAAQ;AAAA,EAC7C,CAAC;AACH;","names":["configuration"]}
1
+ {"version":3,"file":"file.cjs","names":["filePath: string","NodeType"],"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,iDAA0B;CAEhC,IAAIA;AACJ,+BAAe,KAAK,EAAE;AACpB,YACE,sFAAsF,KAAK,mBAAmB,aAC9G,EAAE,OAAO,QAAQ,CAClB;AACD,aAAW;YACF,eACT,mCAAmB,WAAW,KAAK;KAEnC,mCAAmB,SAAS,KAAK;AAGnC,6BAAe,SAAS,0BAAa,SAAS,CAAC,QAAQ,CACrD,KAAI;EACF,MAAM,oCAAuB,UAAU,OAAO;AAE9C,8CAAsBC,0BAAS,MAAM,MAAM;GACzC;GACA,mCAAoB,SAAS,SAAS;GACvC,CAAC;SACI;AACN,YACE,oFAA8C,SAAS,SAAS,CAAC,IACjE,EAAE,OAAO,QAAQ,CAClB;;KAGH,WAAU,+EAAyC,SAAS,SAAS,CAAC,IAAI,EACxE,OAAO,QACR,CAAC;AAGJ,6CAAsBA,0BAAS,MAAM,MAAM,EACzC,SAAS,KACV,CAAC;;;;;;;;;;;;;;;;;AAuBJ,MAAa,QAAQ,SAA8B;CACjD,MAAM,EAAE,oBAAoB,sBAC1B;AAKF,QAAO,YAAY,6BAHO,mBAAmB,EAC7B,kBAE4B"}
@@ -1,36 +1,27 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var fileBrowser_exports = {};
20
- __export(fileBrowser_exports, {
21
- file: () => file
22
- });
23
- module.exports = __toCommonJS(fileBrowser_exports);
24
- var import_types = require('../../types/index.cjs');
1
+ const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
+ let __intlayer_types = require("@intlayer/types");
3
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
4
+
5
+ //#region src/transpiler/file/fileBrowser.ts
6
+ /**
7
+ * Function intended to be used to build intlayer dictionaries.
8
+ *
9
+ * Allow identify the usage of an external resource.
10
+ *
11
+ * Usage:
12
+ *
13
+ * ```ts
14
+ * file('/path/to/file.md') // absolute path
15
+ *
16
+ * // or
17
+ *
18
+ * file('path/to/file.md') // relative path
19
+ * ```
20
+ */
25
21
  const file = (path) => {
26
- throw new Error("file is not available in browser");
27
- return (0, import_types.formatNodeType)(import_types.NodeType.File, path, {
28
- content: "",
29
- fixedPath: ""
30
- });
22
+ throw new Error("file is not available in browser");
31
23
  };
32
- // Annotate the CommonJS export names for ESM import in node:
33
- 0 && (module.exports = {
34
- file
35
- });
24
+
25
+ //#endregion
26
+ exports.file = file;
36
27
  //# sourceMappingURL=fileBrowser.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/transpiler/file/fileBrowser.ts"],"sourcesContent":["import { formatNodeType, NodeType } from '../../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":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AAkBlC,MAAM,OAAO,CAAC,SAA8B;AACjD,QAAM,IAAI,MAAM,kCAAkC;AAElD,aAAO,6BAAe,sBAAS,MAAM,MAAM;AAAA,IACzC,SAAS;AAAA,IACT,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
1
+ {"version":3,"file":"fileBrowser.cjs","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,23 +1,4 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var file_exports = {};
17
- module.exports = __toCommonJS(file_exports);
18
- __reExport(file_exports, require('./file.cjs'), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require('./file.cjs')
22
- });
23
- //# sourceMappingURL=index.cjs.map
1
+ const require_transpiler_file_file = require('./file.cjs');
2
+
3
+ exports.file = require_transpiler_file_file.file;
4
+ exports.fileContent = require_transpiler_file_file.fileContent;