@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,71 +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 getEmptyNode_exports = {};
20
- __export(getEmptyNode_exports, {
21
- getEmptyNode: () => getEmptyNode
22
- });
23
- module.exports = __toCommonJS(getEmptyNode_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/dictionaryManipulator/getEmptyNode.ts
25
6
  const getEmptyNode = (section) => {
26
- if (typeof section === "string") {
27
- return "";
28
- }
29
- if (typeof section === "number") {
30
- return 0;
31
- }
32
- if (typeof section === "boolean") {
33
- return true;
34
- }
35
- if (typeof section?.nodeType === "string") {
36
- const typedNode = section;
37
- const content = typedNode[typedNode.nodeType];
38
- if (typedNode.nodeType === import_types.NodeType.Translation || typedNode.nodeType === import_types.NodeType.Enumeration || typedNode.nodeType === import_types.NodeType.Condition || typedNode.nodeType === import_types.NodeType.Insertion) {
39
- return getEmptyNode(content);
40
- }
41
- if (typedNode.nodeType === import_types.NodeType.Nested) {
42
- return "dictionary-key";
43
- }
44
- if (typedNode.nodeType === import_types.NodeType.File) {
45
- return "file/path";
46
- }
47
- if (typedNode.nodeType === import_types.NodeType.Markdown) {
48
- return getEmptyNode(typedNode);
49
- }
50
- return content;
51
- }
52
- if (!section || typeof section !== "object") {
53
- return section;
54
- }
55
- if (Array.isArray(section)) {
56
- return section.map(
57
- getEmptyNode
58
- );
59
- }
60
- const mappedSectionObject = Object.entries(section).map(([key, value]) => [
61
- key,
62
- getEmptyNode(value)
63
- ]);
64
- const mappedSectionArray = Object.fromEntries(mappedSectionObject);
65
- return mappedSectionArray;
7
+ if (typeof section === "string") return "";
8
+ if (typeof section === "number") return 0;
9
+ if (typeof section === "boolean") return true;
10
+ if (typeof section?.nodeType === "string") {
11
+ const typedNode = section;
12
+ const content = typedNode[typedNode.nodeType];
13
+ if (typedNode.nodeType === __intlayer_types.NodeType.Translation || typedNode.nodeType === __intlayer_types.NodeType.Enumeration || typedNode.nodeType === __intlayer_types.NodeType.Condition || typedNode.nodeType === __intlayer_types.NodeType.Insertion) return getEmptyNode(content);
14
+ if (typedNode.nodeType === __intlayer_types.NodeType.Nested) return "dictionary-key";
15
+ if (typedNode.nodeType === __intlayer_types.NodeType.File) return "file/path";
16
+ if (typedNode.nodeType === __intlayer_types.NodeType.Markdown) return getEmptyNode(typedNode);
17
+ return content;
18
+ }
19
+ if (!section || typeof section !== "object") return section;
20
+ if (Array.isArray(section)) return section.map(getEmptyNode);
21
+ const mappedSectionObject = Object.entries(section).map(([key, value]) => [key, getEmptyNode(value)]);
22
+ return Object.fromEntries(mappedSectionObject);
66
23
  };
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- getEmptyNode
70
- });
24
+
25
+ //#endregion
26
+ exports.getEmptyNode = getEmptyNode;
71
27
  //# sourceMappingURL=getEmptyNode.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/getEmptyNode.ts"],"sourcesContent":["import { type ContentNode, type TypedNode, NodeType } from '../types';\n\nexport const getEmptyNode = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return '';\n }\n if (typeof section === 'number') {\n return 0;\n }\n if (typeof section === 'boolean') {\n return true;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content = typedNode[typedNode.nodeType as keyof TypedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition ||\n typedNode.nodeType === NodeType.Insertion\n ) {\n return getEmptyNode(content as ContentNode);\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return 'dictionary-key';\n }\n\n if (typedNode.nodeType === NodeType.File) {\n return 'file/path';\n }\n\n if (typedNode.nodeType === NodeType.Markdown) {\n return getEmptyNode(typedNode);\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[]).map(\n getEmptyNode\n ) as unknown as ContentNode;\n }\n\n const mappedSectionObject = Object.entries(section).map(([key, value]) => [\n key,\n getEmptyNode(value as ContentNode),\n ]);\n\n const mappedSectionArray = Object.fromEntries(mappedSectionObject);\n\n return mappedSectionArray;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2D;AAEpD,MAAM,eAAe,CAAC,YAAsC;AACjE,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAQ,SAAuB,aAAa,UAAU;AACxD,UAAM,YAAY;AAClB,UAAM,UAAU,UAAU,UAAU,QAA2B;AAE/D,QACE,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,aAChC,UAAU,aAAa,sBAAS,WAChC;AACA,aAAO,aAAa,OAAsB;AAAA,IAC5C;AAEA,QAAI,UAAU,aAAa,sBAAS,QAAQ;AAC1C,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,aAAa,sBAAS,MAAM;AACxC,aAAO;AAAA,IACT;AAEA,QAAI,UAAU,aAAa,sBAAS,UAAU;AAC5C,aAAO,aAAa,SAAS;AAAA,IAC/B;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAQ,QAA0B;AAAA,MAChC;AAAA,IACF;AAAA,EACF;AAEA,QAAM,sBAAsB,OAAO,QAAQ,OAAO,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,IACxE;AAAA,IACA,aAAa,KAAoB;AAAA,EACnC,CAAC;AAED,QAAM,qBAAqB,OAAO,YAAY,mBAAmB;AAEjE,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"getEmptyNode.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/getEmptyNode.ts"],"sourcesContent":["import { type ContentNode, NodeType, type TypedNode } from '@intlayer/types';\n\nexport const getEmptyNode = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return '';\n }\n if (typeof section === 'number') {\n return 0;\n }\n if (typeof section === 'boolean') {\n return true;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content =\n typedNode[typedNode.nodeType as unknown as keyof typeof typedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition ||\n typedNode.nodeType === NodeType.Insertion\n ) {\n return getEmptyNode(content as ContentNode);\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return 'dictionary-key';\n }\n\n if (typedNode.nodeType === NodeType.File) {\n return 'file/path';\n }\n\n if (typedNode.nodeType === NodeType.Markdown) {\n return getEmptyNode(typedNode);\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[]).map(\n getEmptyNode\n ) as unknown as ContentNode;\n }\n\n const mappedSectionObject = Object.entries(section).map(([key, value]) => [\n key,\n getEmptyNode(value as ContentNode),\n ]);\n\n const mappedSectionArray = Object.fromEntries(mappedSectionObject);\n\n return mappedSectionArray;\n};\n"],"mappings":";;;;;AAEA,MAAa,gBAAgB,YAAsC;AACjE,KAAI,OAAO,YAAY,SACrB,QAAO;AAET,KAAI,OAAO,YAAY,SACrB,QAAO;AAET,KAAI,OAAO,YAAY,UACrB,QAAO;AAET,KAAI,OAAQ,SAAuB,aAAa,UAAU;EACxD,MAAM,YAAY;EAClB,MAAM,UACJ,UAAU,UAAU;AAEtB,MACE,UAAU,aAAaA,0BAAS,eAChC,UAAU,aAAaA,0BAAS,eAChC,UAAU,aAAaA,0BAAS,aAChC,UAAU,aAAaA,0BAAS,UAEhC,QAAO,aAAa,QAAuB;AAG7C,MAAI,UAAU,aAAaA,0BAAS,OAClC,QAAO;AAGT,MAAI,UAAU,aAAaA,0BAAS,KAClC,QAAO;AAGT,MAAI,UAAU,aAAaA,0BAAS,SAClC,QAAO,aAAa,UAAU;AAGhC,SAAO;;AAGT,KAAI,CAAC,WAAW,OAAO,YAAY,SACjC,QAAO;AAGT,KAAI,MAAM,QAAQ,QAAQ,CACxB,QAAQ,QAA0B,IAChC,aACD;CAGH,MAAM,sBAAsB,OAAO,QAAQ,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW,CACxE,KACA,aAAa,MAAqB,CACnC,CAAC;AAIF,QAF2B,OAAO,YAAY,oBAAoB"}
@@ -1,59 +1,24 @@
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 getNodeChildren_exports = {};
20
- __export(getNodeChildren_exports, {
21
- getNodeChildren: () => getNodeChildren
22
- });
23
- module.exports = __toCommonJS(getNodeChildren_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/dictionaryManipulator/getNodeChildren.ts
25
6
  const getNodeChildren = (section) => {
26
- if (typeof section === "string") {
27
- return section;
28
- }
29
- if (typeof section === "number") {
30
- return section;
31
- }
32
- if (typeof section === "boolean") {
33
- return section;
34
- }
35
- if (typeof section?.nodeType === "string") {
36
- const typedNode = section;
37
- const content = typedNode[typedNode.nodeType];
38
- if (typedNode.nodeType === import_types.NodeType.Translation || typedNode.nodeType === import_types.NodeType.Enumeration || typedNode.nodeType === import_types.NodeType.Condition || typedNode.nodeType === import_types.NodeType.Insertion || typedNode.nodeType === import_types.NodeType.Gender || typedNode.nodeType === import_types.NodeType.File || typedNode.nodeType === import_types.NodeType.Markdown) {
39
- const firstKey = Object.keys(content)[0];
40
- return content[firstKey];
41
- }
42
- if (typedNode.nodeType === import_types.NodeType.Nested) {
43
- return void 0;
44
- }
45
- return content;
46
- }
47
- if (!section || typeof section !== "object") {
48
- return section;
49
- }
50
- if (Array.isArray(section)) {
51
- return section[0];
52
- }
53
- return section;
7
+ if (typeof section === "string") return section;
8
+ if (typeof section === "number") return section;
9
+ if (typeof section === "boolean") return section;
10
+ if (typeof section?.nodeType === "string") {
11
+ const typedNode = section;
12
+ const content = typedNode[typedNode.nodeType];
13
+ if (typedNode.nodeType === __intlayer_types.NodeType.Translation || typedNode.nodeType === __intlayer_types.NodeType.Enumeration || typedNode.nodeType === __intlayer_types.NodeType.Condition || typedNode.nodeType === __intlayer_types.NodeType.Insertion || typedNode.nodeType === __intlayer_types.NodeType.Gender || typedNode.nodeType === __intlayer_types.NodeType.File || typedNode.nodeType === __intlayer_types.NodeType.Markdown) return content[Object.keys(content)[0]];
14
+ if (typedNode.nodeType === __intlayer_types.NodeType.Nested) return;
15
+ return content;
16
+ }
17
+ if (!section || typeof section !== "object") return section;
18
+ if (Array.isArray(section)) return section[0];
19
+ return section;
54
20
  };
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- getNodeChildren
58
- });
21
+
22
+ //#endregion
23
+ exports.getNodeChildren = getNodeChildren;
59
24
  //# sourceMappingURL=getNodeChildren.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/getNodeChildren.ts"],"sourcesContent":["import { type ContentNode, type TypedNode, NodeType } from '../types';\n\nexport const getNodeChildren = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return section;\n }\n if (typeof section === 'number') {\n return section;\n }\n if (typeof section === 'boolean') {\n return section;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content = typedNode[typedNode.nodeType as keyof TypedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition ||\n typedNode.nodeType === NodeType.Insertion ||\n typedNode.nodeType === NodeType.Gender ||\n typedNode.nodeType === NodeType.File ||\n typedNode.nodeType === NodeType.Markdown\n ) {\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n return content[firstKey] as ContentNode;\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return undefined;\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[])[0];\n }\n\n return section;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2D;AAEpD,MAAM,kBAAkB,CAAC,YAAsC;AACpE,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO;AAAA,EACT;AACA,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO;AAAA,EACT;AACA,MAAI,OAAQ,SAAuB,aAAa,UAAU;AACxD,UAAM,YAAY;AAClB,UAAM,UAAU,UAAU,UAAU,QAA2B;AAE/D,QACE,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,eAChC,UAAU,aAAa,sBAAS,aAChC,UAAU,aAAa,sBAAS,aAChC,UAAU,aAAa,sBAAS,UAChC,UAAU,aAAa,sBAAS,QAChC,UAAU,aAAa,sBAAS,UAChC;AACA,YAAM,WAAW,OAAO,KAAK,OAAO,EAAE,CAAC;AACvC,aAAO,QAAQ,QAAQ;AAAA,IACzB;AAEA,QAAI,UAAU,aAAa,sBAAS,QAAQ;AAC1C,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT;AAEA,MAAI,CAAC,WAAW,OAAO,YAAY,UAAU;AAC3C,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAQ,QAA0B,CAAC;AAAA,EACrC;AAEA,SAAO;AACT;","names":[]}
1
+ {"version":3,"file":"getNodeChildren.cjs","names":["NodeType"],"sources":["../../../src/dictionaryManipulator/getNodeChildren.ts"],"sourcesContent":["import { type ContentNode, NodeType, type TypedNode } from '@intlayer/types';\n\nexport const getNodeChildren = (section: ContentNode): ContentNode => {\n if (typeof section === 'string') {\n return section;\n }\n if (typeof section === 'number') {\n return section;\n }\n if (typeof section === 'boolean') {\n return section;\n }\n if (typeof (section as TypedNode)?.nodeType === 'string') {\n const typedNode = section as TypedNode;\n const content =\n typedNode[typedNode.nodeType as unknown as keyof typeof typedNode];\n\n if (\n typedNode.nodeType === NodeType.Translation ||\n typedNode.nodeType === NodeType.Enumeration ||\n typedNode.nodeType === NodeType.Condition ||\n typedNode.nodeType === NodeType.Insertion ||\n typedNode.nodeType === NodeType.Gender ||\n typedNode.nodeType === NodeType.File ||\n typedNode.nodeType === NodeType.Markdown\n ) {\n const firstKey = Object.keys(content)[0] as keyof typeof content;\n return content[firstKey] as ContentNode;\n }\n\n if (typedNode.nodeType === NodeType.Nested) {\n return undefined;\n }\n\n return content;\n }\n\n if (!section || typeof section !== 'object') {\n return section;\n }\n\n if (Array.isArray(section)) {\n return (section as ContentNode[])[0];\n }\n\n return section;\n};\n"],"mappings":";;;;;AAEA,MAAa,mBAAmB,YAAsC;AACpE,KAAI,OAAO,YAAY,SACrB,QAAO;AAET,KAAI,OAAO,YAAY,SACrB,QAAO;AAET,KAAI,OAAO,YAAY,UACrB,QAAO;AAET,KAAI,OAAQ,SAAuB,aAAa,UAAU;EACxD,MAAM,YAAY;EAClB,MAAM,UACJ,UAAU,UAAU;AAEtB,MACE,UAAU,aAAaA,0BAAS,eAChC,UAAU,aAAaA,0BAAS,eAChC,UAAU,aAAaA,0BAAS,aAChC,UAAU,aAAaA,0BAAS,aAChC,UAAU,aAAaA,0BAAS,UAChC,UAAU,aAAaA,0BAAS,QAChC,UAAU,aAAaA,0BAAS,SAGhC,QAAO,QADU,OAAO,KAAK,QAAQ,CAAC;AAIxC,MAAI,UAAU,aAAaA,0BAAS,OAClC;AAGF,SAAO;;AAGT,KAAI,CAAC,WAAW,OAAO,YAAY,SACjC,QAAO;AAGT,KAAI,MAAM,QAAQ,QAAQ,CACxB,QAAQ,QAA0B;AAGpC,QAAO"}
@@ -1,54 +1,37 @@
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 });
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_utils_isValidReactElement = require('../utils/isValidReactElement.cjs');
3
+ let __intlayer_types = require("@intlayer/types");
4
+ __intlayer_types = require_rolldown_runtime.__toESM(__intlayer_types);
5
+
6
+ //#region src/dictionaryManipulator/getNodeType.ts
7
+ /**
8
+ * Type guard to check if content is a TypedNode
9
+ */
10
+ const isTypedNode = (content) => {
11
+ return typeof content === "object" && content !== null && "nodeType" in content && typeof content.nodeType === "string";
9
12
  };
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;
13
+ /**
14
+ * Type guard to check if content is a valid NodeType
15
+ */
16
+ const isValidNodeType = (nodeType) => {
17
+ return Object.values(__intlayer_types.NodeType).includes(nodeType);
17
18
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var getNodeType_exports = {};
20
- __export(getNodeType_exports, {
21
- getNodeType: () => getNodeType
22
- });
23
- module.exports = __toCommonJS(getNodeType_exports);
24
- var import_types = require('../types/index.cjs');
25
- var import_isValidReactElement = require('../utils/isValidReactElement.cjs');
26
19
  const getNodeType = (content) => {
27
- if (typeof content === "string") {
28
- return import_types.NodeType.Text;
29
- }
30
- if (typeof content?.nodeType === "string") {
31
- return content.nodeType;
32
- }
33
- if (Array.isArray(content)) {
34
- return import_types.NodeType.Array;
35
- }
36
- if ((0, import_isValidReactElement.isValidElement)(content)) {
37
- return import_types.NodeType.ReactNode;
38
- }
39
- if (typeof content === "number") {
40
- return import_types.NodeType.Number;
41
- }
42
- if (typeof content === "boolean") {
43
- return import_types.NodeType.Boolean;
44
- }
45
- if (content && typeof content === "object") {
46
- return import_types.NodeType.Object;
47
- }
48
- return import_types.NodeType.Unknown;
20
+ if (typeof content === "string") return __intlayer_types.NodeType.Text;
21
+ if (isTypedNode(content)) {
22
+ const nodeType = content.nodeType;
23
+ if (isValidNodeType(nodeType)) return nodeType;
24
+ return __intlayer_types.NodeType.Unknown;
25
+ }
26
+ if (Array.isArray(content)) return __intlayer_types.NodeType.Array;
27
+ if (require_utils_isValidReactElement.isValidElement(content)) return __intlayer_types.NodeType.ReactNode;
28
+ if (typeof content === "number") return __intlayer_types.NodeType.Number;
29
+ if (typeof content === "boolean") return __intlayer_types.NodeType.Boolean;
30
+ if (content && typeof content === "object") return __intlayer_types.NodeType.Object;
31
+ if (content === null) return __intlayer_types.NodeType.Null;
32
+ return __intlayer_types.NodeType.Unknown;
49
33
  };
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- getNodeType
53
- });
34
+
35
+ //#endregion
36
+ exports.getNodeType = getNodeType;
54
37
  //# sourceMappingURL=getNodeType.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/getNodeType.ts"],"sourcesContent":["import { NodeType, type TypedNode } from '../types';\nimport type { ContentNode } from '../types/dictionary';\nimport { isValidElement } from '../utils/isValidReactElement';\n\nexport const getNodeType = (content: ContentNode): NodeType => {\n if (typeof content === 'string') {\n return NodeType.Text;\n }\n\n if (typeof (content as TypedNode)?.nodeType === 'string') {\n return (content as TypedNode).nodeType as NodeType;\n }\n\n if (Array.isArray(content)) {\n return NodeType.Array;\n }\n\n if (isValidElement(content)) {\n return NodeType.ReactNode;\n }\n\n if (typeof content === 'number') {\n return NodeType.Number;\n }\n\n if (typeof content === 'boolean') {\n return NodeType.Boolean;\n }\n\n if (content && typeof content === 'object') {\n return NodeType.Object;\n }\n\n return NodeType.Unknown;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AAEzC,iCAA+B;AAExB,MAAM,cAAc,CAAC,YAAmC;AAC7D,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO,sBAAS;AAAA,EAClB;AAEA,MAAI,OAAQ,SAAuB,aAAa,UAAU;AACxD,WAAQ,QAAsB;AAAA,EAChC;AAEA,MAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,WAAO,sBAAS;AAAA,EAClB;AAEA,UAAI,2CAAe,OAAO,GAAG;AAC3B,WAAO,sBAAS;AAAA,EAClB;AAEA,MAAI,OAAO,YAAY,UAAU;AAC/B,WAAO,sBAAS;AAAA,EAClB;AAEA,MAAI,OAAO,YAAY,WAAW;AAChC,WAAO,sBAAS;AAAA,EAClB;AAEA,MAAI,WAAW,OAAO,YAAY,UAAU;AAC1C,WAAO,sBAAS;AAAA,EAClB;AAEA,SAAO,sBAAS;AAClB;","names":[]}
1
+ {"version":3,"file":"getNodeType.cjs","names":["NodeType","isValidElement"],"sources":["../../../src/dictionaryManipulator/getNodeType.ts"],"sourcesContent":["import { type ContentNode, NodeType, type TypedNode } from '@intlayer/types';\nimport { isValidElement } from '../utils/isValidReactElement';\n\n/**\n * Type guard to check if content is a TypedNode\n */\nconst isTypedNode = (content: unknown): content is TypedNode => {\n return (\n typeof content === 'object' &&\n content !== null &&\n 'nodeType' in content &&\n typeof (content as TypedNode).nodeType === 'string'\n );\n};\n\n/**\n * Type guard to check if content is a valid NodeType\n */\nconst isValidNodeType = (nodeType: string): nodeType is NodeType => {\n return Object.values(NodeType).includes(nodeType as NodeType);\n};\n\nexport const getNodeType = (content: ContentNode): NodeType => {\n if (typeof content === 'string') {\n return NodeType.Text;\n }\n\n if (isTypedNode(content)) {\n const nodeType = content.nodeType;\n if (isValidNodeType(nodeType)) {\n return nodeType;\n }\n // Fallback for unknown node types\n return NodeType.Unknown;\n }\n\n if (Array.isArray(content)) {\n return NodeType.Array;\n }\n\n if (isValidElement(content)) {\n return NodeType.ReactNode;\n }\n\n if (typeof content === 'number') {\n return NodeType.Number;\n }\n\n if (typeof content === 'boolean') {\n return NodeType.Boolean;\n }\n\n if (content && typeof content === 'object') {\n return NodeType.Object;\n }\n\n if (content === null) {\n return NodeType.Null;\n }\n\n return NodeType.Unknown;\n};\n"],"mappings":";;;;;;;;;AAMA,MAAM,eAAe,YAA2C;AAC9D,QACE,OAAO,YAAY,YACnB,YAAY,QACZ,cAAc,WACd,OAAQ,QAAsB,aAAa;;;;;AAO/C,MAAM,mBAAmB,aAA2C;AAClE,QAAO,OAAO,OAAOA,0BAAS,CAAC,SAAS,SAAqB;;AAG/D,MAAa,eAAe,YAAmC;AAC7D,KAAI,OAAO,YAAY,SACrB,QAAOA,0BAAS;AAGlB,KAAI,YAAY,QAAQ,EAAE;EACxB,MAAM,WAAW,QAAQ;AACzB,MAAI,gBAAgB,SAAS,CAC3B,QAAO;AAGT,SAAOA,0BAAS;;AAGlB,KAAI,MAAM,QAAQ,QAAQ,CACxB,QAAOA,0BAAS;AAGlB,KAAIC,iDAAe,QAAQ,CACzB,QAAOD,0BAAS;AAGlB,KAAI,OAAO,YAAY,SACrB,QAAOA,0BAAS;AAGlB,KAAI,OAAO,YAAY,UACrB,QAAOA,0BAAS;AAGlB,KAAI,WAAW,OAAO,YAAY,SAChC,QAAOA,0BAAS;AAGlB,KAAI,YAAY,KACd,QAAOA,0BAAS;AAGlB,QAAOA,0BAAS"}
@@ -1,52 +1,20 @@
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
+ const require_dictionaryManipulator_getContentNodeByKeyPath = require('./getContentNodeByKeyPath.cjs');
3
+ const require_dictionaryManipulator_normalizeDictionary = require('./normalizeDictionary.cjs');
4
+ let __intlayer_config_built = require("@intlayer/config/built");
5
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
6
+ let __intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
7
+ __intlayer_unmerged_dictionaries_entry = require_rolldown_runtime.__toESM(__intlayer_unmerged_dictionaries_entry);
8
+
9
+ //#region src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts
10
+ const getUnmergedDictionaryByKeyPath = (dictionaryKey, keyPath, dictionariesRecord, configuration = __intlayer_config_built.default) => {
11
+ const unmergedEntries = (dictionariesRecord ?? (0, __intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration))?.[dictionaryKey];
12
+ if (!unmergedEntries) return null;
13
+ const normalizedUnmergedEntries = require_dictionaryManipulator_normalizeDictionary.normalizeDictionaries(unmergedEntries, configuration);
14
+ for (const dictionary of normalizedUnmergedEntries) if (require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
15
+ for (const dictionary of unmergedEntries) if (require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath(dictionary.content, keyPath)) return dictionary;
11
16
  };
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 getUnmergedDictionaryByKeyPath_exports = {};
30
- __export(getUnmergedDictionaryByKeyPath_exports, {
31
- getUnmergedDictionaryByKeyPath: () => getUnmergedDictionaryByKeyPath
32
- });
33
- module.exports = __toCommonJS(getUnmergedDictionaryByKeyPath_exports);
34
- var import_unmerged_dictionaries_entry = __toESM(require("@intlayer/unmerged-dictionaries-entry"));
35
- var import_getContentNodeByKeyPath = require('./getContentNodeByKeyPath.cjs');
36
- const getUnmergedDictionaryByKeyPath = (dictionaryKey, keyPath, dictionariesRecord = import_unmerged_dictionaries_entry.default) => {
37
- const unmergedEntries = dictionariesRecord?.[dictionaryKey];
38
- if (!unmergedEntries) {
39
- return null;
40
- }
41
- for (const dictionary of unmergedEntries) {
42
- const content = (0, import_getContentNodeByKeyPath.getContentNodeByKeyPath)(dictionary.content, keyPath);
43
- if (content) {
44
- return dictionary;
45
- }
46
- }
47
- };
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- getUnmergedDictionaryByKeyPath
51
- });
17
+
18
+ //#endregion
19
+ exports.getUnmergedDictionaryByKeyPath = getUnmergedDictionaryByKeyPath;
52
20
  //# sourceMappingURL=getUnmergedDictionaryByKeyPath.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import unmergedDictionary from '@intlayer/unmerged-dictionaries-entry';\nimport { type KeyPath } from '../types';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord: keyof typeof unmergedDictionary = unmergedDictionary\n) => {\n const unmergedEntries = dictionariesRecord?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yCAA+B;AAE/B,qCAAwC;AAEjC,MAAM,iCAAiC,CAC5C,eACA,SACA,qBAAsD,mCAAAA,YACnD;AACH,QAAM,kBAAkB,qBAAqB,aAAa;AAE1D,MAAI,CAAC,iBAAiB;AACpB,WAAO;AAAA,EACT;AAEA,aAAW,cAAc,iBAAiB;AACxC,UAAM,cAAU,wDAAwB,WAAW,SAAS,OAAO;AAEnE,QAAI,SAAS;AACX,aAAO;AAAA,IACT;AAAA,EACF;AACF;","names":["unmergedDictionary"]}
1
+ {"version":3,"file":"getUnmergedDictionaryByKeyPath.cjs","names":["intlayerConfiguration","normalizeDictionaries","getContentNodeByKeyPath"],"sources":["../../../src/dictionaryManipulator/getUnmergedDictionaryByKeyPath.ts"],"sourcesContent":["import intlayerConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig, KeyPath } from '@intlayer/types';\nimport {\n getUnmergedDictionaries,\n type UnmergedDictionaries,\n} from '@intlayer/unmerged-dictionaries-entry';\nimport { getContentNodeByKeyPath } from './getContentNodeByKeyPath';\nimport { normalizeDictionaries } from './normalizeDictionary';\n\nexport const getUnmergedDictionaryByKeyPath = (\n dictionaryKey: string,\n keyPath: KeyPath[],\n dictionariesRecord?: UnmergedDictionaries,\n configuration: IntlayerConfig = intlayerConfiguration\n) => {\n const unmergedEntries = (dictionariesRecord ??\n getUnmergedDictionaries(configuration))?.[dictionaryKey];\n\n if (!unmergedEntries) {\n return null;\n }\n\n const normalizedUnmergedEntries = normalizeDictionaries(\n unmergedEntries,\n configuration\n );\n\n for (const dictionary of normalizedUnmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n\n for (const dictionary of unmergedEntries) {\n const content = getContentNodeByKeyPath(dictionary.content, keyPath);\n\n if (content) {\n return dictionary;\n }\n }\n};\n"],"mappings":";;;;;;;;;AASA,MAAa,kCACX,eACA,SACA,oBACA,gBAAgCA,oCAC7B;CACH,MAAM,mBAAmB,0FACC,cAAc,IAAI;AAE5C,KAAI,CAAC,gBACH,QAAO;CAGT,MAAM,4BAA4BC,wEAChC,iBACA,cACD;AAED,MAAK,MAAM,cAAc,0BAGvB,KAFgBC,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO;AAIX,MAAK,MAAM,cAAc,gBAGvB,KAFgBA,8EAAwB,WAAW,SAAS,QAAQ,CAGlE,QAAO"}
@@ -1,41 +1,28 @@
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 dictionaryManipulator_exports = {};
17
- module.exports = __toCommonJS(dictionaryManipulator_exports);
18
- __reExport(dictionaryManipulator_exports, require('./editDictionaryByKeyPath.cjs'), module.exports);
19
- __reExport(dictionaryManipulator_exports, require('./getContentNodeByKeyPath.cjs'), module.exports);
20
- __reExport(dictionaryManipulator_exports, require('./getDefaultNode.cjs'), module.exports);
21
- __reExport(dictionaryManipulator_exports, require('./getEmptyNode.cjs'), module.exports);
22
- __reExport(dictionaryManipulator_exports, require('./getNodeChildren.cjs'), module.exports);
23
- __reExport(dictionaryManipulator_exports, require('./getNodeType.cjs'), module.exports);
24
- __reExport(dictionaryManipulator_exports, require('./getUnmergedDictionaryByKeyPath.cjs'), module.exports);
25
- __reExport(dictionaryManipulator_exports, require('./removeContentNodeByKeyPath.cjs'), module.exports);
26
- __reExport(dictionaryManipulator_exports, require('./renameContentNodeByKeyPath.cjs'), module.exports);
27
- __reExport(dictionaryManipulator_exports, require('./updateNodeChildren.cjs'), module.exports);
28
- // Annotate the CommonJS export names for ESM import in node:
29
- 0 && (module.exports = {
30
- ...require('./editDictionaryByKeyPath.cjs'),
31
- ...require('./getContentNodeByKeyPath.cjs'),
32
- ...require('./getDefaultNode.cjs'),
33
- ...require('./getEmptyNode.cjs'),
34
- ...require('./getNodeChildren.cjs'),
35
- ...require('./getNodeType.cjs'),
36
- ...require('./getUnmergedDictionaryByKeyPath.cjs'),
37
- ...require('./removeContentNodeByKeyPath.cjs'),
38
- ...require('./renameContentNodeByKeyPath.cjs'),
39
- ...require('./updateNodeChildren.cjs')
40
- });
41
- //# sourceMappingURL=index.cjs.map
1
+ const require_dictionaryManipulator_editDictionaryByKeyPath = require('./editDictionaryByKeyPath.cjs');
2
+ const require_dictionaryManipulator_getContentNodeByKeyPath = require('./getContentNodeByKeyPath.cjs');
3
+ const require_dictionaryManipulator_getDefaultNode = require('./getDefaultNode.cjs');
4
+ const require_dictionaryManipulator_getEmptyNode = require('./getEmptyNode.cjs');
5
+ const require_dictionaryManipulator_getNodeChildren = require('./getNodeChildren.cjs');
6
+ const require_dictionaryManipulator_getNodeType = require('./getNodeType.cjs');
7
+ const require_dictionaryManipulator_orderDictionaries = require('./orderDictionaries.cjs');
8
+ const require_dictionaryManipulator_normalizeDictionary = require('./normalizeDictionary.cjs');
9
+ const require_dictionaryManipulator_getUnmergedDictionaryByKeyPath = require('./getUnmergedDictionaryByKeyPath.cjs');
10
+ const require_dictionaryManipulator_mergeDictionaries = require('./mergeDictionaries.cjs');
11
+ const require_dictionaryManipulator_removeContentNodeByKeyPath = require('./removeContentNodeByKeyPath.cjs');
12
+ const require_dictionaryManipulator_renameContentNodeByKeyPath = require('./renameContentNodeByKeyPath.cjs');
13
+ const require_dictionaryManipulator_updateNodeChildren = require('./updateNodeChildren.cjs');
14
+
15
+ exports.editDictionaryByKeyPath = require_dictionaryManipulator_editDictionaryByKeyPath.editDictionaryByKeyPath;
16
+ exports.getContentNodeByKeyPath = require_dictionaryManipulator_getContentNodeByKeyPath.getContentNodeByKeyPath;
17
+ exports.getDefaultNode = require_dictionaryManipulator_getDefaultNode.getDefaultNode;
18
+ exports.getEmptyNode = require_dictionaryManipulator_getEmptyNode.getEmptyNode;
19
+ exports.getNodeChildren = require_dictionaryManipulator_getNodeChildren.getNodeChildren;
20
+ exports.getNodeType = require_dictionaryManipulator_getNodeType.getNodeType;
21
+ exports.getUnmergedDictionaryByKeyPath = require_dictionaryManipulator_getUnmergedDictionaryByKeyPath.getUnmergedDictionaryByKeyPath;
22
+ exports.mergeDictionaries = require_dictionaryManipulator_mergeDictionaries.mergeDictionaries;
23
+ exports.normalizeDictionaries = require_dictionaryManipulator_normalizeDictionary.normalizeDictionaries;
24
+ exports.normalizeDictionary = require_dictionaryManipulator_normalizeDictionary.normalizeDictionary;
25
+ exports.orderDictionaries = require_dictionaryManipulator_orderDictionaries.orderDictionaries;
26
+ exports.removeContentNodeByKeyPath = require_dictionaryManipulator_removeContentNodeByKeyPath.removeContentNodeByKeyPath;
27
+ exports.renameContentNodeByKeyPath = require_dictionaryManipulator_renameContentNodeByKeyPath.renameContentNodeByKeyPath;
28
+ exports.updateNodeChildren = require_dictionaryManipulator_updateNodeChildren.updateNodeChildren;
@@ -0,0 +1,69 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_dictionaryManipulator_getNodeType = require('./getNodeType.cjs');
3
+ let __intlayer_config_client = require("@intlayer/config/client");
4
+ __intlayer_config_client = require_rolldown_runtime.__toESM(__intlayer_config_client);
5
+ let __intlayer_config_built = require("@intlayer/config/built");
6
+ __intlayer_config_built = require_rolldown_runtime.__toESM(__intlayer_config_built);
7
+
8
+ //#region src/dictionaryManipulator/mergeDictionaries.ts
9
+ const checkTypesMatch = (object1, object2, object2LocalId, dictionaryKey, path = []) => {
10
+ const appLogger = (0, __intlayer_config_client.getAppLogger)(__intlayer_config_built.default);
11
+ if (object1 === void 0 || object1 === null || object2 === void 0 || object2 === null) return;
12
+ const type1 = require_dictionaryManipulator_getNodeType.getNodeType(object1);
13
+ const type2 = require_dictionaryManipulator_getNodeType.getNodeType(object2);
14
+ if (type1 === "unknown" || type2 === "unknown") return;
15
+ if (type1 !== type2) {
16
+ appLogger([`Error: Dictionary ${(0, __intlayer_config_client.colorizeKey)(dictionaryKey)} has a multiple content files with type mismatch at path "${path.join(".")}": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`], { level: "error" });
17
+ return;
18
+ }
19
+ };
20
+ const customMerge = (destination, source) => {
21
+ if (destination === void 0 || destination === null) return source;
22
+ if (source === void 0 || source === null) return destination;
23
+ if (typeof destination !== "object" || typeof source !== "object") return destination;
24
+ if (Array.isArray(destination) && Array.isArray(source)) return arrayMerge(destination, source);
25
+ if (typeof destination === "object" && typeof source === "object") {
26
+ const result = {};
27
+ const allKeys = new Set([...Object.keys(destination), ...Object.keys(source)]);
28
+ for (const key of allKeys) result[key] = customMerge(destination[key], source[key]);
29
+ return result;
30
+ }
31
+ return destination;
32
+ };
33
+ const arrayMerge = (destinationArray, sourceArray) => {
34
+ const destHasOnlyPrimitives = destinationArray.every((item) => typeof item !== "object" || item === null);
35
+ const sourceHasOnlyPrimitives = sourceArray.every((item) => typeof item !== "object" || item === null);
36
+ if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) return sourceArray;
37
+ const result = [];
38
+ const maxLength = Math.max(destinationArray.length, sourceArray.length);
39
+ for (let i = 0; i < maxLength; i++) {
40
+ const destItem = destinationArray[i];
41
+ const sourceItem = sourceArray[i];
42
+ if (destItem === void 0 && sourceItem === void 0) {} else if (destItem === void 0) result.push(sourceItem);
43
+ else if (sourceItem === void 0) result.push(destItem);
44
+ else if (typeof destItem === "object" && typeof sourceItem === "object" && destItem !== null && sourceItem !== null) if ("key" in destItem && "key" in sourceItem && destItem.key === sourceItem.key) result.push(customMerge(destItem, sourceItem));
45
+ else result.push(customMerge(destItem, sourceItem));
46
+ else result.push(destItem);
47
+ }
48
+ return result;
49
+ };
50
+ const mergeDictionaries = (dictionaries) => {
51
+ const localIds = Array.from(new Set(dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId)));
52
+ const dictionariesKeys = dictionaries.map((dict) => dict.key);
53
+ if (new Set(dictionariesKeys).size !== 1) throw new Error("All dictionaries must have the same key");
54
+ let mergedContent = dictionaries[0].content;
55
+ for (let i = 1; i < dictionaries.length; i++) {
56
+ const currentDictionary = dictionaries[i];
57
+ checkTypesMatch(mergedContent, currentDictionary.content, currentDictionary.localId, currentDictionary.key, []);
58
+ mergedContent = customMerge(mergedContent, currentDictionary.content);
59
+ }
60
+ return {
61
+ key: dictionaries[0].key,
62
+ content: mergedContent,
63
+ localIds
64
+ };
65
+ };
66
+
67
+ //#endregion
68
+ exports.mergeDictionaries = mergeDictionaries;
69
+ //# sourceMappingURL=mergeDictionaries.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mergeDictionaries.cjs","names":["configuration","getNodeType","result: Record<string, MergeableContent>","result: MergeableContent[]","mergedContent: Dictionary['content']"],"sources":["../../../src/dictionaryManipulator/mergeDictionaries.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport { colorizeKey, getAppLogger } from '@intlayer/config/client';\nimport type {\n ContentNode,\n Dictionary,\n LocalDictionaryId,\n} from '@intlayer/types';\nimport { getNodeType } from './getNodeType';\n\n// Extended type that includes arrays for internal merge operations\ntype MergeableContent = ContentNode | ContentNode[];\n\nconst checkTypesMatch = (\n object1: ContentNode,\n object2: ContentNode,\n object2LocalId: LocalDictionaryId | undefined,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n\n // If either side is missing/undefined, allow merge without error\n if (\n object1 === undefined ||\n object1 === null ||\n object2 === undefined ||\n object2 === null\n )\n return;\n\n const type1 = getNodeType(object1);\n const type2 = getNodeType(object2);\n\n // Unknown types are treated as flexible; skip strict mismatch reporting\n if (type1 === 'unknown' || type2 === 'unknown') return;\n\n if (type1 !== type2) {\n appLogger(\n [\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2} while merging ${object2LocalId}`,\n ],\n {\n level: 'error',\n }\n );\n\n return;\n }\n};\n\n// Custom merge function that prefers destination (first dictionary) values\nconst customMerge = (\n destination: ContentNode,\n source: ContentNode\n): MergeableContent => {\n // If destination is undefined/null, use source\n if (destination === undefined || destination === null) {\n return source;\n }\n\n // If source is undefined/null, use destination\n if (source === undefined || source === null) {\n return destination;\n }\n\n // For primitive values, prefer destination (first dictionary)\n if (typeof destination !== 'object' || typeof source !== 'object') {\n return destination;\n }\n\n // For arrays, use our custom array merge\n if (Array.isArray(destination) && Array.isArray(source)) {\n return arrayMerge(\n destination as ContentNode[],\n source as ContentNode[]\n ) as MergeableContent;\n }\n\n // For objects, recursively merge with our custom logic\n if (typeof destination === 'object' && typeof source === 'object') {\n const result: Record<string, MergeableContent> = {};\n const allKeys = new Set([\n ...Object.keys(destination as unknown as Record<string, ContentNode>),\n ...Object.keys(source as unknown as Record<string, ContentNode>),\n ]);\n\n for (const key of allKeys) {\n result[key] = customMerge(\n (destination as unknown as Record<string, ContentNode>)[key],\n (source as unknown as Record<string, ContentNode>)[key]\n );\n }\n\n return result as unknown as MergeableContent;\n }\n\n // Fallback to destination\n return destination;\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (\n destinationArray: ContentNode[],\n sourceArray: ContentNode[]\n): MergeableContent[] => {\n // Check if both arrays contain only primitives\n const destHasOnlyPrimitives = destinationArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n const sourceHasOnlyPrimitives = sourceArray.every(\n (item) => typeof item !== 'object' || item === null\n );\n\n // If both arrays contain only primitives, use the source array (second dictionary)\n if (destHasOnlyPrimitives && sourceHasOnlyPrimitives) {\n return sourceArray;\n }\n\n // Otherwise, merge by index with object merging logic\n const result: MergeableContent[] = [];\n const maxLength = Math.max(destinationArray.length, sourceArray.length);\n\n for (let i = 0; i < maxLength; i++) {\n const destItem = destinationArray[i];\n const sourceItem = sourceArray[i];\n\n if (destItem === undefined && sourceItem === undefined) {\n } else if (destItem === undefined) {\n // Only source exists, add it\n result.push(sourceItem);\n } else if (sourceItem === undefined) {\n // Only destination exists, add it\n result.push(destItem);\n } else {\n // Both exist, merge them\n if (\n typeof destItem === 'object' &&\n typeof sourceItem === 'object' &&\n destItem !== null &&\n sourceItem !== null\n ) {\n // Check if both objects have a 'key' property for keyed merging\n if (\n 'key' in destItem &&\n 'key' in sourceItem &&\n (destItem as Record<string, string>).key ===\n (sourceItem as Record<string, string>).key\n ) {\n // Merge objects with same key, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n } else {\n // Merge objects by index, preferring destination (first dictionary) values\n result.push(customMerge(destItem, sourceItem));\n }\n } else {\n // For primitives or non-objects, use destination value (first dictionary)\n result.push(destItem);\n }\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n const localIds = Array.from(\n new Set<LocalDictionaryId>(\n dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId!)\n )\n );\n\n const dictionariesKeys = dictionaries.map((dict) => dict.key);\n\n // Check if all dictionaries have the same key\n if (new Set(dictionariesKeys).size !== 1) {\n throw new Error('All dictionaries must have the same key');\n }\n\n let mergedContent: Dictionary['content'] = dictionaries[0].content;\n\n for (let i = 1; i < dictionaries.length; i++) {\n const currentDictionary = dictionaries[i];\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.localId,\n currentDictionary.key,\n []\n );\n\n mergedContent = customMerge(\n mergedContent,\n currentDictionary.content\n ) as ContentNode;\n }\n\n const mergedDictionary: Dictionary = {\n key: dictionaries[0].key,\n\n content: mergedContent,\n localIds,\n };\n\n return mergedDictionary;\n};\n"],"mappings":";;;;;;;;AAYA,MAAM,mBACJ,SACA,SACA,gBACA,eACA,OAAiB,EAAE,KACV;CACT,MAAM,uDAAyBA,gCAAc;AAG7C,KACE,YAAY,UACZ,YAAY,QACZ,YAAY,UACZ,YAAY,KAEZ;CAEF,MAAM,QAAQC,sDAAY,QAAQ;CAClC,MAAM,QAAQA,sDAAY,QAAQ;AAGlC,KAAI,UAAU,aAAa,UAAU,UAAW;AAEhD,KAAI,UAAU,OAAO;AACnB,YACE,CACE,+DAAiC,cAAc,CAAC,4DAA4D,KAAK,KAAK,IAAI,CAAC,kBAAkB,MAAM,QAAQ,MAAM,iBAAiB,iBACnL,EACD,EACE,OAAO,SACR,CACF;AAED;;;AAKJ,MAAM,eACJ,aACA,WACqB;AAErB,KAAI,gBAAgB,UAAa,gBAAgB,KAC/C,QAAO;AAIT,KAAI,WAAW,UAAa,WAAW,KACrC,QAAO;AAIT,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,SACvD,QAAO;AAIT,KAAI,MAAM,QAAQ,YAAY,IAAI,MAAM,QAAQ,OAAO,CACrD,QAAO,WACL,aACA,OACD;AAIH,KAAI,OAAO,gBAAgB,YAAY,OAAO,WAAW,UAAU;EACjE,MAAMC,SAA2C,EAAE;EACnD,MAAM,UAAU,IAAI,IAAI,CACtB,GAAG,OAAO,KAAK,YAAsD,EACrE,GAAG,OAAO,KAAK,OAAiD,CACjE,CAAC;AAEF,OAAK,MAAM,OAAO,QAChB,QAAO,OAAO,YACX,YAAuD,MACvD,OAAkD,KACpD;AAGH,SAAO;;AAIT,QAAO;;AAIT,MAAM,cACJ,kBACA,gBACuB;CAEvB,MAAM,wBAAwB,iBAAiB,OAC5C,SAAS,OAAO,SAAS,YAAY,SAAS,KAChD;CACD,MAAM,0BAA0B,YAAY,OACzC,SAAS,OAAO,SAAS,YAAY,SAAS,KAChD;AAGD,KAAI,yBAAyB,wBAC3B,QAAO;CAIT,MAAMC,SAA6B,EAAE;CACrC,MAAM,YAAY,KAAK,IAAI,iBAAiB,QAAQ,YAAY,OAAO;AAEvE,MAAK,IAAI,IAAI,GAAG,IAAI,WAAW,KAAK;EAClC,MAAM,WAAW,iBAAiB;EAClC,MAAM,aAAa,YAAY;AAE/B,MAAI,aAAa,UAAa,eAAe,QAAW,YAC7C,aAAa,OAEtB,QAAO,KAAK,WAAW;WACd,eAAe,OAExB,QAAO,KAAK,SAAS;WAInB,OAAO,aAAa,YACpB,OAAO,eAAe,YACtB,aAAa,QACb,eAAe,KAGf,KACE,SAAS,YACT,SAAS,cACR,SAAoC,QAClC,WAAsC,IAGzC,QAAO,KAAK,YAAY,UAAU,WAAW,CAAC;MAG9C,QAAO,KAAK,YAAY,UAAU,WAAW,CAAC;MAIhD,QAAO,KAAK,SAAS;;AAK3B,QAAO;;AAGT,MAAa,qBAAqB,iBAA2C;CAC3E,MAAM,WAAW,MAAM,KACrB,IAAI,IACF,aAAa,QAAQ,SAAS,KAAK,QAAQ,CAAC,KAAK,SAAS,KAAK,QAAS,CACzE,CACF;CAED,MAAM,mBAAmB,aAAa,KAAK,SAAS,KAAK,IAAI;AAG7D,KAAI,IAAI,IAAI,iBAAiB,CAAC,SAAS,EACrC,OAAM,IAAI,MAAM,0CAA0C;CAG5D,IAAIC,gBAAuC,aAAa,GAAG;AAE3D,MAAK,IAAI,IAAI,GAAG,IAAI,aAAa,QAAQ,KAAK;EAC5C,MAAM,oBAAoB,aAAa;AAGvC,kBACE,eACA,kBAAkB,SAClB,kBAAkB,SAClB,kBAAkB,KAClB,EAAE,CACH;AAED,kBAAgB,YACd,eACA,kBAAkB,QACnB;;AAUH,QAPqC;EACnC,KAAK,aAAa,GAAG;EAErB,SAAS;EACT;EACD"}
@@ -0,0 +1,30 @@
1
+ const require_transpiler_translation_translation = require('../transpiler/translation/translation.cjs');
2
+ const require_deepTransformPlugins_getLocalizedContent = require('../deepTransformPlugins/getLocalizedContent.cjs');
3
+ const require_dictionaryManipulator_orderDictionaries = require('./orderDictionaries.cjs');
4
+
5
+ //#region src/dictionaryManipulator/normalizeDictionary.ts
6
+ const normalizeDictionary = (dictionary, configuration) => {
7
+ const { locales } = configuration.internationalization;
8
+ const parsedDictionary = JSON.parse(JSON.stringify(dictionary));
9
+ if (dictionary.locale) return {
10
+ ...dictionary,
11
+ locale: void 0,
12
+ content: require_transpiler_translation_translation.t({ [dictionary.locale]: require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary(dictionary.content, dictionary.locale) })
13
+ };
14
+ const perLocaleContent = locales.reduce((acc, locale) => {
15
+ acc[locale] = require_deepTransformPlugins_getLocalizedContent.getPerLocaleDictionary(parsedDictionary, locale).content;
16
+ return acc;
17
+ }, {});
18
+ return {
19
+ ...dictionary,
20
+ content: require_transpiler_translation_translation.t(perLocaleContent)
21
+ };
22
+ };
23
+ const normalizeDictionaries = (dictionaries, configuration) => {
24
+ return require_dictionaryManipulator_orderDictionaries.orderDictionaries(dictionaries, configuration).map((dictionary) => normalizeDictionary(dictionary, configuration));
25
+ };
26
+
27
+ //#endregion
28
+ exports.normalizeDictionaries = normalizeDictionaries;
29
+ exports.normalizeDictionary = normalizeDictionary;
30
+ //# sourceMappingURL=normalizeDictionary.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalizeDictionary.cjs","names":["t","getPerLocaleDictionary","orderDictionaries"],"sources":["../../../src/dictionaryManipulator/normalizeDictionary.ts"],"sourcesContent":["import type { Dictionary, IntlayerConfig, Locale } from '@intlayer/types';\nimport { getPerLocaleDictionary } from '../deepTransformPlugins';\nimport { t } from '../transpiler/translation';\nimport { orderDictionaries } from './orderDictionaries';\n\nexport const normalizeDictionary = (\n dictionary: Dictionary,\n configuration: IntlayerConfig\n): Dictionary => {\n const { locales } = configuration.internationalization;\n\n const parsedDictionary = JSON.parse(JSON.stringify(dictionary));\n\n // If the dictionary is a per-locale dictionary, transform it to a partial multilingual dictionary\n if (dictionary.locale) {\n return {\n ...dictionary,\n locale: undefined,\n content: t({\n // @ts-ignore Type instantiation is excessively deep and possibly infinite.\n [dictionary.locale]: getPerLocaleDictionary(\n dictionary.content,\n dictionary.locale\n ),\n }),\n };\n }\n\n const perLocaleContent = locales.reduce(\n (acc, locale) => {\n const perLocaleDictionary = getPerLocaleDictionary(\n parsedDictionary,\n locale\n );\n\n acc[locale] = perLocaleDictionary.content;\n return acc;\n },\n {} as Record<Locale, Dictionary['content']>\n );\n\n return {\n ...dictionary,\n content: t(perLocaleContent),\n };\n};\n\nexport const normalizeDictionaries = (\n dictionaries: Dictionary[],\n configuration: IntlayerConfig\n): Dictionary[] => {\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n const structuredDictionaries = orderedDictionaries.map((dictionary) =>\n normalizeDictionary(dictionary, configuration)\n );\n\n return structuredDictionaries;\n};\n"],"mappings":";;;;;AAKA,MAAa,uBACX,YACA,kBACe;CACf,MAAM,EAAE,YAAY,cAAc;CAElC,MAAM,mBAAmB,KAAK,MAAM,KAAK,UAAU,WAAW,CAAC;AAG/D,KAAI,WAAW,OACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAASA,6CAAE,GAER,WAAW,SAASC,wEACnB,WAAW,SACX,WAAW,OACZ,EACF,CAAC;EACH;CAGH,MAAM,mBAAmB,QAAQ,QAC9B,KAAK,WAAW;AAMf,MAAI,UALwBA,wEAC1B,kBACA,OACD,CAEiC;AAClC,SAAO;IAET,EAAE,CACH;AAED,QAAO;EACL,GAAG;EACH,SAASD,6CAAE,iBAAiB;EAC7B;;AAGH,MAAa,yBACX,cACA,kBACiB;AAOjB,QAN4BE,kEAAkB,cAAc,cAAc,CAEvB,KAAK,eACtD,oBAAoB,YAAY,cAAc,CAC/C"}