@intlayer/core 6.1.6-canary.0 → 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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFilterMissingTranslationsContent.mjs","names":["deepTransformNode","tCore","result: Record<string, any>","arrayKeysIncluded: string[]","primitiveSiblingsToAppend: any[]","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getFilterMissingTranslationsContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport {\n type DeepTransformContent,\n getTranslation,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport { type TranslationContent, t as tCore } from '../transpiler';\n\n/**\n * Helper function to check if a node or its children contain translation nodes\n */\nconst hasTranslationNodes = (node: any): boolean => {\n if (typeof node !== 'object' || node === null) {\n return false;\n }\n\n if (node?.nodeType === NodeType.Translation) {\n return true;\n }\n\n if (Array.isArray(node)) {\n return node.some(hasTranslationNodes);\n }\n\n return Object.values(node).some(hasTranslationNodes);\n};\n\n/**\n * Get all keys from an object, recursively\n */\nconst getObjectKeys = (obj: any): Set<string> => {\n const keys = new Set<string>();\n\n if (typeof obj !== 'object' || obj === null) {\n return keys;\n }\n\n for (const key in obj) {\n keys.add(key);\n }\n\n return keys;\n};\n\n/**\n * Check if two objects have the same structure (same keys)\n */\nconst hasSameStructure = (obj1: any, obj2: any): boolean => {\n if (typeof obj1 !== 'object' || typeof obj2 !== 'object') {\n return typeof obj1 === typeof obj2;\n }\n\n if (obj1 === null || obj2 === null) {\n return obj1 === obj2;\n }\n\n if (Array.isArray(obj1) !== Array.isArray(obj2)) {\n return false;\n }\n\n const keys1 = getObjectKeys(obj1);\n const keys2 = getObjectKeys(obj2);\n\n if (keys1.size !== keys2.size) {\n return false;\n }\n\n for (const key of keys1) {\n if (!keys2.has(key)) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * Check if all locales in a translation node have the same structure (recursively)\n * Returns an object with locales that have missing keys\n */\nconst checkTranslationStructureConsistency = (\n translationNode: Record<string, any>\n): { hasInconsistency: boolean; localesWithMissingKeys: Set<string> } => {\n const locales = Object.keys(translationNode);\n const localesWithMissingKeys = new Set<string>();\n\n if (locales.length <= 1) {\n return { hasInconsistency: false, localesWithMissingKeys };\n }\n\n // Helper function to check structure recursively\n const checkStructureRecursive = (\n path: string,\n localeValues: Map<string, any>\n ): Set<string> => {\n const localesWithIssues = new Set<string>();\n\n // Get all unique keys across all locale values at this path\n const allKeys = new Set<string>();\n const objectLocales = new Map<string, any>();\n\n for (const [locale, value] of localeValues.entries()) {\n if (\n typeof value === 'object' &&\n value !== null &&\n !Array.isArray(value)\n ) {\n objectLocales.set(locale, value);\n const keys = getObjectKeys(value);\n for (const key of keys) {\n allKeys.add(key);\n }\n }\n }\n\n // If no objects at this level, no inconsistency\n if (objectLocales.size === 0) {\n return localesWithIssues;\n }\n\n // Check if each locale has all the keys at this level\n for (const [locale, value] of objectLocales.entries()) {\n const keys = getObjectKeys(value);\n if (keys.size !== allKeys.size) {\n localesWithIssues.add(locale);\n }\n }\n\n // Recursively check nested objects\n for (const key of allKeys) {\n const nestedValues = new Map<string, any>();\n for (const [locale, value] of objectLocales.entries()) {\n if (value[key] !== undefined) {\n nestedValues.set(locale, value[key]);\n }\n }\n\n if (nestedValues.size > 1) {\n const nestedIssues = checkStructureRecursive(\n path ? `${path}.${key}` : key,\n nestedValues\n );\n for (const locale of nestedIssues) {\n localesWithIssues.add(locale);\n }\n }\n }\n\n return localesWithIssues;\n };\n\n // Start recursive check from root\n const rootValues = new Map<string, any>();\n for (const locale of locales) {\n rootValues.set(locale, translationNode[locale]);\n }\n\n const issuesFound = checkStructureRecursive('', rootValues);\n const hasInconsistency = issuesFound.size > 0;\n\n for (const locale of issuesFound) {\n localesWithMissingKeys.add(locale);\n }\n\n return { hasInconsistency, localesWithMissingKeys };\n};\n\n/**\n * Check if array elements have consistent structures\n */\nconst checkArrayStructureConsistency = (arr: any[]): boolean => {\n if (arr.length <= 1) {\n return true;\n }\n\n const firstElement = arr[0];\n\n for (let i = 1; i < arr.length; i++) {\n if (!hasSameStructure(firstElement, arr[i])) {\n return false;\n }\n }\n\n return true;\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const filterMissingTranslationsOnlyPlugin = (\n localeToCheck: LocalesValues\n): Plugins => ({\n id: 'filter-missing-translations-only-plugin',\n canHandle: (node: ContentNode) => {\n // Only handle objects and arrays, not primitives\n return typeof node === 'object' && node !== null;\n },\n transform: (node: ContentNode, props, deepTransformNode) => {\n if (typeof node === 'object' && node?.nodeType === NodeType.Translation) {\n const result = structuredClone(\n (node as TranslationContent)[NodeType.Translation]\n );\n\n const hasLocaleTranslation = Object.keys(result).includes(localeToCheck);\n\n // Check for structural inconsistencies across locales\n const { hasInconsistency, localesWithMissingKeys } =\n checkTranslationStructureConsistency(result);\n\n // If there's a structural inconsistency and the locale being checked\n // has missing keys, treat it as a missing translation\n const hasStructuralIssue =\n hasInconsistency && localesWithMissingKeys.has(localeToCheck);\n\n if (hasLocaleTranslation && !hasStructuralIssue) {\n return undefined; // Return undefined to remove the node\n }\n\n // Transform nested content\n for (const key in result) {\n const childProps = {\n ...props,\n children: result[key as unknown as keyof typeof result],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Translation, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n result[key as unknown as keyof typeof result],\n {\n ...childProps,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) =>\n plugin.id !== 'filter-missing-translations-only-plugin'\n ),\n ],\n }\n );\n }\n\n // Return the base locale content as a translation node\n // If base locale is missing, use any available locale as fallback\n const baseLocale = configuration?.internationalization?.defaultLocale;\n const availableLocales = Object.keys(result);\n\n if (availableLocales.length === 0) {\n return undefined; // No translations available\n }\n\n // Try to get the base locale first, then any available locale as fallback\n const fallbackLocale = availableLocales.includes(baseLocale)\n ? baseLocale\n : availableLocales[0];\n\n const fallbackValue = getTranslation(result, baseLocale, fallbackLocale);\n\n // Return the translation node structure with only the fallback locale\n return tCore({ [fallbackLocale]: fallbackValue });\n } else if (\n typeof node === 'object' &&\n node !== null &&\n !Array.isArray(node) &&\n !node?.nodeType\n ) {\n // For regular objects, include only children that are related to translations\n // - Keep children that contain translation nodes (directly or nested)\n // - Keep arrays (they may mix translated and non-translated values)\n // - Exclude primitive values (string/number/boolean/null/undefined) at object level\n const result: Record<string, any> = {};\n let hasMissingTranslations = false;\n const arrayKeysIncluded: string[] = [];\n const primitiveSiblingsToAppend: any[] = [];\n\n for (const key in node as any) {\n const originalChild = (node as any)[key];\n const childProps = {\n ...props,\n children: originalChild,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key } as KeyPath,\n ],\n };\n const transformedChild = deepTransformNode(originalChild, childProps);\n\n const isPrimitiveSibling =\n originalChild === null ||\n (typeof originalChild !== 'object' &&\n typeof originalChild !== 'function');\n\n if (isPrimitiveSibling) {\n // Defer primitives; they may be appended to an array sibling later\n if (originalChild !== undefined) {\n primitiveSiblingsToAppend.push(originalChild);\n }\n continue;\n }\n\n const includeChild =\n transformedChild !== undefined &&\n (hasTranslationNodes(originalChild) || Array.isArray(originalChild));\n\n if (includeChild) {\n result[key] = transformedChild;\n hasMissingTranslations = true;\n if (Array.isArray(transformedChild)) {\n arrayKeysIncluded.push(key);\n }\n }\n }\n\n // If any array child is present, append primitive siblings into the first array\n if (\n arrayKeysIncluded.length > 0 &&\n primitiveSiblingsToAppend.length > 0\n ) {\n const targetArrayKey = arrayKeysIncluded[0];\n // Ensure array exists in result (it should, but be defensive)\n if (Array.isArray(result[targetArrayKey])) {\n result[targetArrayKey] = [\n ...result[targetArrayKey],\n ...primitiveSiblingsToAppend,\n ];\n hasMissingTranslations = true;\n }\n }\n\n // Only return the object if it has missing translations-related content\n return hasMissingTranslations ? result : undefined;\n } else if (Array.isArray(node)) {\n // Check if array elements have consistent structures\n const hasConsistentStructure = checkArrayStructureConsistency(node);\n\n // For arrays, only include items that have missing translations\n const result = node\n .map((child, index) => {\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Array, key: index } as KeyPath,\n ],\n };\n return deepTransformNode(child, childProps);\n })\n .filter((item) => item !== null && item !== undefined);\n\n // If there's structural inconsistency in the array, include it\n // even if it has no missing translations, to flag the issue\n if (!hasConsistentStructure && result.length === 0) {\n // Return a marker to indicate structural inconsistency\n return node; // Return original array to show the issue\n }\n\n // Only return the array if it has items with missing translations\n return result.length > 0 ? result : undefined;\n }\n\n return node; // Return non-translation content as is\n },\n});\n\n/**\n * For each translation node, it compare is both localeToCheck and baseLocale are present.\n *\n * If yes, it should remove the node from the content.\n * If no, it should keep the node\n *\n * In complete mode, for large dictionaries, we want to filter all content that is already translated\n *\n * locale: fr\n *\n * { test1: t({ ar: 'Hello', en: 'Hello', fr: 'Bonjour' } }) -> {}\n * { test2: t({ ar: 'Hello', en: 'Hello' }) } -> { test2: t({ ar: 'Hello', en: 'Hello' }) }\n *\n */\nexport const getFilterMissingTranslationsContent = <\n T extends ContentNode,\n L extends LocalesValues = DeclaredLocales,\n>(\n node: T,\n localeToCheck: L,\n nodeProps: NodeProps\n) => {\n const plugins: Plugins[] = [\n filterMissingTranslationsOnlyPlugin(localeToCheck),\n ...(nodeProps.plugins ?? []),\n ];\n\n const result = deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n // Stringify the result to remove the undefined values\n if (result === undefined) {\n // No missing translations found\n return {} as DeepTransformContent<T>;\n }\n return JSON.parse(JSON.stringify(result));\n};\n\nexport const getFilterMissingTranslationsDictionary = (\n dictionary: Dictionary,\n localeToCheck: LocalesValues\n) => ({\n ...dictionary,\n content: getFilterMissingTranslationsContent(\n dictionary.content,\n localeToCheck,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [],\n }\n ),\n});\n"],"mappings":";;;;;;;;;;AAmBA,MAAM,uBAAuB,SAAuB;AAClD,KAAI,OAAO,SAAS,YAAY,SAAS,KACvC,QAAO;AAGT,KAAI,MAAM,aAAa,SAAS,YAC9B,QAAO;AAGT,KAAI,MAAM,QAAQ,KAAK,CACrB,QAAO,KAAK,KAAK,oBAAoB;AAGvC,QAAO,OAAO,OAAO,KAAK,CAAC,KAAK,oBAAoB;;;;;AAMtD,MAAM,iBAAiB,QAA0B;CAC/C,MAAM,uBAAO,IAAI,KAAa;AAE9B,KAAI,OAAO,QAAQ,YAAY,QAAQ,KACrC,QAAO;AAGT,MAAK,MAAM,OAAO,IAChB,MAAK,IAAI,IAAI;AAGf,QAAO;;;;;AAMT,MAAM,oBAAoB,MAAW,SAAuB;AAC1D,KAAI,OAAO,SAAS,YAAY,OAAO,SAAS,SAC9C,QAAO,OAAO,SAAS,OAAO;AAGhC,KAAI,SAAS,QAAQ,SAAS,KAC5B,QAAO,SAAS;AAGlB,KAAI,MAAM,QAAQ,KAAK,KAAK,MAAM,QAAQ,KAAK,CAC7C,QAAO;CAGT,MAAM,QAAQ,cAAc,KAAK;CACjC,MAAM,QAAQ,cAAc,KAAK;AAEjC,KAAI,MAAM,SAAS,MAAM,KACvB,QAAO;AAGT,MAAK,MAAM,OAAO,MAChB,KAAI,CAAC,MAAM,IAAI,IAAI,CACjB,QAAO;AAIX,QAAO;;;;;;AAOT,MAAM,wCACJ,oBACuE;CACvE,MAAM,UAAU,OAAO,KAAK,gBAAgB;CAC5C,MAAM,yCAAyB,IAAI,KAAa;AAEhD,KAAI,Q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AgBD,MAAa,uCAIX,MACA,eACA,cACG;CACH,MAAMK,UAAqB,CACzB,oCAAoC,cAAc,EAClD,GAAI,UAAU,WAAW,EAAE,CAC5B;CAED,MAAM,SAAS,kBAAkB,MAAM;EACrC,GAAG;EACH;EACD,CAAC;AAGF,KAAI,WAAW,OAEb,QAAO,EAAE;AAEX,QAAO,KAAK,MAAM,KAAK,UAAU,OAAO,CAAC;;AAG3C,MAAa,0CACX,YACA,mBACI;CACJ,GAAG;CACH,SAAS,oCACP,WAAW,SACX,eACA;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,EAAE;EACZ,CACF;CACF"}
@@ -0,0 +1,90 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+ import { getTranslation } from "../interpreter/getTranslation.mjs";
3
+ import { NodeType } from "@intlayer/types";
4
+ import configuration from "@intlayer/config/built";
5
+
6
+ //#region src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts
7
+ /**
8
+ * Helper function to check if a node or its children contain translation nodes
9
+ */
10
+ const hasTranslationNodes = (node) => {
11
+ if (typeof node !== "object" || node === null) return false;
12
+ if (node?.nodeType === NodeType.Translation) return true;
13
+ if (Array.isArray(node)) return node.some(hasTranslationNodes);
14
+ return Object.values(node).some(hasTranslationNodes);
15
+ };
16
+ /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
17
+ const filterTranslationsOnlyPlugin = (locale, fallback) => ({
18
+ id: "filter-translations-only-plugin",
19
+ canHandle: (node) => {
20
+ return typeof node === "object" && node !== null;
21
+ },
22
+ transform: (node, props, deepTransformNode$1) => {
23
+ if (typeof node === "object" && node?.nodeType === NodeType.Translation) {
24
+ const result = structuredClone(node[NodeType.Translation]);
25
+ for (const key in result) {
26
+ const childProps = {
27
+ ...props,
28
+ children: result[key],
29
+ keyPath: [...props.keyPath, {
30
+ type: NodeType.Translation,
31
+ key
32
+ }]
33
+ };
34
+ result[key] = deepTransformNode$1(result[key], {
35
+ ...childProps,
36
+ plugins: [...(props.plugins ?? []).filter((plugin) => plugin.id !== "filter-translations-only-plugin")]
37
+ });
38
+ }
39
+ return getTranslation(result, locale, fallback);
40
+ } else if (typeof node === "object" && node !== null && !Array.isArray(node) && !node?.nodeType) {
41
+ const result = {};
42
+ for (const key in node) if (hasTranslationNodes(node[key])) {
43
+ const childProps = {
44
+ ...props,
45
+ children: node[key],
46
+ keyPath: [...props.keyPath, {
47
+ type: NodeType.Object,
48
+ key
49
+ }]
50
+ };
51
+ result[key] = deepTransformNode$1(node[key], childProps);
52
+ }
53
+ return result;
54
+ } else if (Array.isArray(node)) return node.map((child, index) => {
55
+ return deepTransformNode$1(child, {
56
+ ...props,
57
+ children: child,
58
+ keyPath: [...props.keyPath, {
59
+ type: NodeType.Array,
60
+ key: index
61
+ }]
62
+ });
63
+ });
64
+ return "to remove from the object";
65
+ }
66
+ });
67
+ /**
68
+ * Return the content of a node with only the translation plugin.
69
+ *
70
+ * @param node The node to transform.
71
+ * @param locale The locale to use if your transformers need it (e.g. for translations).
72
+ */
73
+ const getFilterTranslationsOnlyContent = (node, locale = configuration?.internationalization?.defaultLocale, nodeProps, fallback) => {
74
+ const plugins = [filterTranslationsOnlyPlugin(locale, fallback), ...nodeProps.plugins ?? []];
75
+ return deepTransformNode(node, {
76
+ ...nodeProps,
77
+ plugins
78
+ });
79
+ };
80
+ const getFilterTranslationsOnlyDictionary = (dictionary, locale = configuration?.internationalization?.defaultLocale, fallback) => ({
81
+ ...dictionary,
82
+ content: getFilterTranslationsOnlyContent(dictionary.content, locale, {
83
+ dictionaryKey: dictionary.key,
84
+ keyPath: []
85
+ }, fallback)
86
+ });
87
+
88
+ //#endregion
89
+ export { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary };
90
+ //# sourceMappingURL=getFilterTranslationsOnlyContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFilterTranslationsOnlyContent.mjs","names":["deepTransformNode","result: Record<string, any>","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getFilterTranslationsOnlyContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport type {\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport { type ContentNode, type KeyPath, NodeType } from '@intlayer/types';\nimport {\n type DeepTransformContent,\n getTranslation,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/**\n * Helper function to check if a node or its children contain translation nodes\n */\nconst hasTranslationNodes = (node: any): boolean => {\n if (typeof node !== 'object' || node === null) {\n return false;\n }\n\n if (node?.nodeType === NodeType.Translation) {\n return true;\n }\n\n if (Array.isArray(node)) {\n return node.some(hasTranslationNodes);\n }\n\n return Object.values(node).some(hasTranslationNodes);\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const filterTranslationsOnlyPlugin = (\n locale: LocalesValues,\n fallback?: LocalesValues\n): Plugins => ({\n id: 'filter-translations-only-plugin',\n canHandle: (node: ContentNode) => {\n // Only handle objects and arrays, not primitives\n return typeof node === 'object' && node !== null;\n },\n transform: (node: ContentNode, props, deepTransformNode) => {\n if (typeof node === 'object' && node?.nodeType === NodeType.Translation) {\n const result = structuredClone(\n (node as TranslationContent)[NodeType.Translation]\n );\n\n for (const key in result) {\n const childProps = {\n ...props,\n children: result[key as unknown as keyof typeof result],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Translation, key } as KeyPath,\n ],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n result[key as unknown as keyof typeof result],\n {\n ...childProps,\n plugins: [\n ...(props.plugins ?? ([] as Plugins[])).filter(\n (plugin) => plugin.id !== 'filter-translations-only-plugin'\n ),\n ],\n }\n );\n }\n return getTranslation(result, locale, fallback);\n } else if (\n typeof node === 'object' &&\n node !== null &&\n !Array.isArray(node) &&\n !node?.nodeType\n ) {\n // For regular objects, filter out properties that don't contain translations\n const result: Record<string, any> = {};\n for (const key in node as any) {\n if (hasTranslationNodes(node[key as unknown as keyof typeof node])) {\n const childProps = {\n ...props,\n children: node[key as unknown as keyof typeof node],\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key } as KeyPath,\n ],\n };\n result[key] = deepTransformNode(\n node[key as unknown as keyof typeof node],\n childProps\n );\n }\n }\n return result;\n } else if (Array.isArray(node)) {\n // For arrays, keep all items but transform them\n return node.map((child, index) => {\n const childProps = {\n ...props,\n children: child,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Array, key: index } as KeyPath,\n ],\n };\n return deepTransformNode(child, childProps);\n });\n }\n\n return 'to remove from the object';\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getFilterTranslationsOnlyContent = <\n T extends ContentNode,\n L extends LocalesValues = DeclaredLocales,\n>(\n node: T,\n locale: L = configuration?.internationalization?.defaultLocale as L,\n nodeProps: NodeProps,\n fallback?: LocalesValues\n) => {\n const plugins: Plugins[] = [\n filterTranslationsOnlyPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n\nexport const getFilterTranslationsOnlyDictionary = (\n dictionary: Dictionary,\n locale: LocalesValues = configuration?.internationalization\n ?.defaultLocale as LocalesValues,\n fallback?: LocalesValues\n) => ({\n ...dictionary,\n content: getFilterTranslationsOnlyContent(\n dictionary.content,\n locale,\n { dictionaryKey: dictionary.key, keyPath: [] },\n fallback\n ),\n});\n"],"mappings":";;;;;;;;;AAmBA,MAAM,uBAAuB,SAAuB;AAClD,KAAI,OAAO,SAAS,YAAY,SAAS,KACvC,QAAO;AAGT,KAAI,MAAM,aAAa,SAAS,YAC9B,QAAO;AAGT,KAAI,MAAM,QAAQ,KAAK,CACrB,QAAO,KAAK,KAAK,oBAAoB;AAGvC,QAA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AsB,eACjD,WACA,aACG;CACH,MAAME,UAAqB,CACzB,6BAA6B,QAAQ,SAAS,EAC9C,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,QAAO,kBAAkB,MAAM;EAC7B,GAAG;EACH;EACD,CAAC;;AAGJ,MAAa,uCACX,YACA,SAAwB,eAAe,sBACnC,eACJ,cACI;CACJ,GAAG;CACH,SAAS,iCACP,WAAW,SACX,QACA;EAAE,eAAe,WAAW;EAAK,SAAS,EAAE;EAAE,EAC9C,SACD;CACF"}
@@ -0,0 +1,43 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+ import { NodeType } from "@intlayer/types";
3
+
4
+ //#region src/deepTransformPlugins/getFilteredLocalesContent.ts
5
+ const filterTranslationsPlugin = (locales) => ({
6
+ id: "filter-translations-plugin",
7
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Translation,
8
+ transform: (node, props, deepTransformNode$1) => {
9
+ const translationMap = node.translation;
10
+ const filteredTranslationMap = Object.fromEntries(Object.entries(translationMap).filter(([key]) => locales.includes(key)));
11
+ return {
12
+ ...node,
13
+ translation: deepTransformNode$1(filteredTranslationMap, {
14
+ ...props,
15
+ keyPath: [...props.keyPath, {
16
+ type: NodeType.Object,
17
+ key: NodeType.Translation
18
+ }]
19
+ })
20
+ };
21
+ }
22
+ });
23
+ const getFilteredLocalesContent = (node, locales, nodeProps) => {
24
+ const plugins = [filterTranslationsPlugin(Array.isArray(locales) ? locales : [locales]), ...nodeProps.plugins ?? []];
25
+ return deepTransformNode(node, {
26
+ ...nodeProps,
27
+ plugins
28
+ });
29
+ };
30
+ const getFilteredLocalesDictionary = (dictionary, locale) => {
31
+ const localesArray = Array.isArray(locale) ? locale : [locale];
32
+ return {
33
+ ...dictionary,
34
+ content: getFilteredLocalesContent(dictionary.content, localesArray, {
35
+ dictionaryKey: dictionary.key,
36
+ keyPath: []
37
+ })
38
+ };
39
+ };
40
+
41
+ //#endregion
42
+ export { getFilteredLocalesContent, getFilteredLocalesDictionary };
43
+ //# sourceMappingURL=getFilteredLocalesContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getFilteredLocalesContent.mjs","names":["deepTransformNode","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getFilteredLocalesContent.ts"],"sourcesContent":["import {\n type ContentNode,\n type Dictionary,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\n\nconst filterTranslationsPlugin = (locales: LocalesValues[]): Plugins => ({\n id: 'filter-translations-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node, props, deepTransformNode) => {\n const translationMap = node.translation as Record<LocalesValues, string>;\n\n const filteredTranslationMap = Object.fromEntries(\n Object.entries(translationMap).filter(([key]) =>\n locales.includes(key as LocalesValues)\n )\n );\n\n return {\n ...node,\n translation: deepTransformNode(filteredTranslationMap, {\n ...props,\n keyPath: [\n ...props.keyPath,\n { type: NodeType.Object, key: NodeType.Translation },\n ],\n }),\n };\n },\n});\n\nexport const getFilteredLocalesContent = (\n node: ContentNode,\n locales: LocalesValues | LocalesValues[],\n nodeProps: NodeProps\n) => {\n const localesArray = Array.isArray(locales) ? locales : [locales];\n\n const plugins: Plugins[] = [\n filterTranslationsPlugin(localesArray),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n });\n};\n\n/*\n * Remove all unneeded translation from translation node\n *\n * locale: fr\n * t({ ar: 'Hello', en: 'Hello', fr: 'Bonjour' }) -> t({ fr: 'Bonjour' })\n *\n * locales: [fr, en]\n * t({ ar: 'Hello', en: 'Hello', fr: 'Bonjour' }) -> t({ en: 'Hello', fr: 'Bonjour' })\n */\nexport const getFilteredLocalesDictionary = (\n dictionary: Dictionary,\n locale: LocalesValues | LocalesValues[]\n) => {\n const localesArray = Array.isArray(locale) ? locale : [locale];\n\n return {\n ...dictionary,\n content: getFilteredLocalesContent(dictionary.content, localesArray, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n }),\n };\n};\n"],"mappings":";;;;AAYA,MAAM,4BAA4B,aAAuC;CACvE,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAAM,OAAO,wBAAsB;EAC7C,MAAM,iBAAiB,KAAK;EAE5B,MAAM,yBAAyB,OAAO,YACpC,OAAO,QAAQ,eAAe,CAAC,QAAQ,CAAC,SACtC,QAAQ,SAAS,IAAqB,CACvC,CACF;AAED,SAAO;GACL,GAAG;GACH,aAAaA,oBAAkB,wBAAwB;IACrD,GAAG;IACH,SAAS,CACP,GAAG,MAAM,SACT;KAAE,MAAM,SAAS;KAAQ,KAAK,SAAS;KAAa,CACrD;IACF,CAAC;GACH;;CAEJ;AAED,MAAa,6BACX,MACA,SACA,cACG;CAGH,MAAMC,UAAqB,CACzB,yBAHmB,MAAM,QAAQ,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAGzB,EACtC,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,QAAO,kBAAkB,MAAM;EAC7B,GAAG;EACH;EACD,CAAC;;AAYJ,MAAa,gCACX,YACA,WACG;CACH,MAAM,eAAe,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;AAE9D,QAAO;EACL,GAAG;EACH,SAAS,0BAA0B,WAAW,SAAS,cAAc;GACnE,eAAe,WAAW;GAC1B,SAAS,EAAE;GACZ,CAAC;EACH"}
@@ -0,0 +1,32 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+ import { translationPlugin } from "../interpreter/getContent/plugins.mjs";
3
+
4
+ //#region src/deepTransformPlugins/getLocalizedContent.ts
5
+ /**
6
+ * Transforms a node in a single pass, applying each plugin as needed.
7
+ * In comparison to `getContent`, this function will only apply the translation plugin.
8
+ * It will not transform enumerations, insertions, or other content types.
9
+ *
10
+ * @param node The node to transform.
11
+ * @param locale The locale to use if your transformers need it (e.g. for translations).
12
+ */
13
+ const getLocalizedContent = (node, locale, nodeProps, fallback) => {
14
+ const plugins = [translationPlugin(locale, fallback), ...nodeProps.plugins ?? []];
15
+ return deepTransformNode(node, {
16
+ ...nodeProps,
17
+ plugins
18
+ });
19
+ };
20
+ const getPerLocaleDictionary = (dictionary, locale, fallback) => ({
21
+ ...dictionary,
22
+ locale,
23
+ content: getLocalizedContent(dictionary.content, locale, {
24
+ dictionaryKey: dictionary.key,
25
+ keyPath: [],
26
+ plugins: []
27
+ }, fallback)
28
+ });
29
+
30
+ //#endregion
31
+ export { getLocalizedContent, getPerLocaleDictionary };
32
+ //# sourceMappingURL=getLocalizedContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getLocalizedContent.mjs","names":["plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getLocalizedContent.ts"],"sourcesContent":["import type {\n ContentNode,\n DeclaredLocales,\n Dictionary,\n LocalesValues,\n} from '@intlayer/types';\nimport {\n type DeepTransformContent,\n type NodeProps,\n type Plugins,\n translationPlugin,\n} from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\n\n/**\n * Transforms a node in a single pass, applying each plugin as needed.\n * In comparison to `getContent`, this function will only apply the translation plugin.\n * It will not transform enumerations, insertions, or other content types.\n *\n * @param node The node to transform.\n * @param locale The locale to use if your transformers need it (e.g. for translations).\n */\nexport const getLocalizedContent = <\n T extends ContentNode,\n L extends LocalesValues = DeclaredLocales,\n>(\n node: T,\n locale: L,\n nodeProps: NodeProps,\n fallback?: LocalesValues // fallback mean that if field is not translated, it will use the default locale\n) => {\n const plugins: Plugins[] = [\n translationPlugin(locale, fallback),\n ...(nodeProps.plugins ?? []),\n ];\n\n return deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n};\n\nexport const getPerLocaleDictionary = <\n T extends Dictionary,\n L extends LocalesValues,\n>(\n dictionary: T,\n locale: L,\n fallback?: LocalesValues\n): Dictionary => ({\n ...dictionary,\n locale,\n content: getLocalizedContent(\n dictionary.content,\n locale,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [],\n },\n fallback\n ),\n});\n"],"mappings":";;;;;;;;;;;;AAsBA,MAAa,uBAIX,MACA,QACA,WACA,aACG;CACH,MAAMA,UAAqB,CACzB,kBAAkB,QAAQ,SAAS,EACnC,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,QAAO,kBAAkB,MAAM;EAC7B,GAAG;EACH;EACD,CAAC;;AAGJ,MAAa,0BAIX,YACA,QACA,cACgB;CAChB,GAAG;CACH;CACA,SAAS,oBACP,WAAW,SACX,QACA;EACE,eAAe,WAAW;EAC1B,SAAS,EAAE;EACX,SAAS,EAAE;EACZ,EACD,SACD;CACF"}
@@ -0,0 +1,26 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+
3
+ //#region src/deepTransformPlugins/getMaskContent.ts
4
+ const passTypedNodePlugin = {
5
+ id: "pass-typed-node-plugin",
6
+ canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string",
7
+ transform: (node, props, deepTransformNode$1) => deepTransformNode$1(node[node.nodeType], props)
8
+ };
9
+ /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
10
+ const buildMaskPlugin = {
11
+ id: "build-mask-plugin",
12
+ canHandle: (node) => typeof node === "string" || typeof node === "number",
13
+ transform: () => true
14
+ };
15
+ const getMaskContent = (source) => ({
16
+ ...source,
17
+ content: deepTransformNode(source.content, {
18
+ dictionaryKey: source.key,
19
+ keyPath: [],
20
+ plugins: [passTypedNodePlugin, buildMaskPlugin]
21
+ })
22
+ });
23
+
24
+ //#endregion
25
+ export { buildMaskPlugin, getMaskContent };
26
+ //# sourceMappingURL=getMaskContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMaskContent.mjs","names":["passTypedNodePlugin: Plugins","deepTransformNode","buildMaskPlugin: Plugins"],"sources":["../../../src/deepTransformPlugins/getMaskContent.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types';\nimport { deepTransformNode, type Plugins } from '../interpreter';\n\nconst passTypedNodePlugin: Plugins = {\n id: 'pass-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof node?.nodeType === 'string',\n transform: (node, props, deepTransformNode) =>\n deepTransformNode(node[node.nodeType], props),\n};\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const buildMaskPlugin: Plugins = {\n id: 'build-mask-plugin',\n canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n transform: () => true,\n};\n\nexport const getMaskContent = (source: Dictionary): any => ({\n ...source,\n content: deepTransformNode(source.content, {\n dictionaryKey: source.key,\n keyPath: [],\n plugins: [passTypedNodePlugin, buildMaskPlugin],\n }),\n});\n"],"mappings":";;;AAGA,MAAMA,sBAA+B;CACnC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAO,MAAM,aAAa;CACxD,YAAY,MAAM,OAAO,wBACvBC,oBAAkB,KAAK,KAAK,WAAW,MAAM;CAChD;;AAGD,MAAaC,kBAA2B;CACtC,IAAI;CACJ,YAAY,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;CACjE,iBAAiB;CAClB;AAED,MAAa,kBAAkB,YAA6B;CAC1D,GAAG;CACH,SAAS,kBAAkB,OAAO,SAAS;EACzC,eAAe,OAAO;EACtB,SAAS,EAAE;EACX,SAAS,CAAC,qBAAqB,gBAAgB;EAChD,CAAC;CACH"}
@@ -0,0 +1,41 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+ import { NodeType } from "@intlayer/types";
3
+ import configuration from "@intlayer/config/built";
4
+
5
+ //#region src/deepTransformPlugins/getMissingLocalesContent.ts
6
+ /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
7
+ const checkMissingLocalesPlugin = (locales, onMissingLocale) => ({
8
+ id: "check-missing-locales-plugin",
9
+ canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Translation,
10
+ transform: (node, props, deepTransformNode$1) => {
11
+ for (const locale of locales) if (!node[NodeType.Translation][locale]) onMissingLocale(locale);
12
+ const translations = node[NodeType.Translation];
13
+ for (const key in translations) {
14
+ const child = translations[key];
15
+ deepTransformNode$1(child, {
16
+ ...props,
17
+ children: child
18
+ });
19
+ }
20
+ return node;
21
+ }
22
+ });
23
+ /**
24
+ * Return the content of a node with only the translation plugin.
25
+ *
26
+ * @param node The node to transform.
27
+ * @param locales The locales to check for missing translations.
28
+ */
29
+ const getMissingLocalesContent = (node, locales = configuration?.internationalization?.locales, nodeProps) => {
30
+ const missingLocales = /* @__PURE__ */ new Set();
31
+ const plugins = [checkMissingLocalesPlugin(locales, (locale) => missingLocales.add(locale)), ...nodeProps.plugins ?? []];
32
+ deepTransformNode(node, {
33
+ ...nodeProps,
34
+ plugins
35
+ });
36
+ return Array.from(missingLocales);
37
+ };
38
+
39
+ //#endregion
40
+ export { checkMissingLocalesPlugin, getMissingLocalesContent };
41
+ //# sourceMappingURL=getMissingLocalesContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMissingLocalesContent.mjs","names":["plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getMissingLocalesContent.ts"],"sourcesContent":["import configuration from '@intlayer/config/built';\nimport {\n type ContentNode,\n type Locale,\n type LocalesValues,\n NodeType,\n} from '@intlayer/types';\nimport type { DeepTransformContent, NodeProps, Plugins } from '../interpreter';\nimport { deepTransformNode } from '../interpreter/getContent/deepTransform';\nimport type { TranslationContent } from '../transpiler';\n\n/** Translation plugin. Replaces node with a locale string if nodeType = Translation. */\nexport const checkMissingLocalesPlugin = (\n locales: Locale[],\n onMissingLocale: (locale: Locale) => void\n): Plugins => ({\n id: 'check-missing-locales-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Translation,\n transform: (node: TranslationContent, props, deepTransformNode) => {\n for (const locale of locales) {\n if (\n !node[NodeType.Translation][\n locale as keyof (typeof node)[NodeType.Translation]\n ]\n ) {\n onMissingLocale(locale);\n }\n }\n\n // Continue traversal inside the translation values, but avoid re-applying this plugin on the same node\n const translations = node[NodeType.Translation] as Record<string, any>;\n for (const key in translations) {\n const child = translations[key];\n deepTransformNode(child, {\n ...props,\n children: child,\n });\n }\n\n // Return the original node; the return value is ignored by the caller\n return node;\n },\n});\n\n/**\n * Return the content of a node with only the translation plugin.\n *\n * @param node The node to transform.\n * @param locales The locales to check for missing translations.\n */\nexport const getMissingLocalesContent = <T extends ContentNode>(\n node: T,\n locales: LocalesValues[] = configuration?.internationalization?.locales,\n nodeProps: NodeProps\n): Locale[] => {\n const missingLocales = new Set<Locale>();\n\n const plugins: Plugins[] = [\n checkMissingLocalesPlugin(locales as Locale[], (locale) =>\n missingLocales.add(locale)\n ),\n ...(nodeProps.plugins ?? []),\n ];\n\n deepTransformNode(node, {\n ...nodeProps,\n plugins,\n }) as DeepTransformContent<T>;\n\n return Array.from(missingLocales);\n};\n"],"mappings":";;;;;;AAYA,MAAa,6BACX,SACA,qBACa;CACb,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;CAC1D,YAAY,MAA0B,OAAO,wBAAsB;AACjE,OAAK,MAAM,UAAU,QACnB,KACE,CAAC,KAAK,SAAS,aACb,QAGF,iBAAgB,OAAO;EAK3B,MAAM,eAAe,KAAK,SAAS;AACnC,OAAK,MAAM,OAAO,cAAc;GAC9B,MAAM,QAAQ,aAAa;AAC3B,uBAAkB,OAAO;IACvB,GAAG;IACH,UAAU;IACX,CAAC;;AAIJ,SAAO;;CAEV;;;;;;;AAQD,MAAa,4BACX,MACA,UAA2B,eAAe,sBAAsB,SAChE,cACa;CACb,MAAM,iCAAiB,IAAI,KAAa;CAExC,MAAMA,UAAqB,CACzB,0BAA0B,UAAsB,WAC9C,eAAe,IAAI,OAAO,CAC3B,EACD,GAAI,UAAU,WAAW,EAAE,CAC5B;AAED,mBAAkB,MAAM;EACtB,GAAG;EACH;EACD,CAAC;AAEF,QAAO,MAAM,KAAK,eAAe"}
@@ -0,0 +1,60 @@
1
+ import { deepTransformNode } from "../interpreter/getContent/deepTransform.mjs";
2
+
3
+ //#region src/deepTransformPlugins/getReplacedValuesContent.ts
4
+ const replaceValuesPlugin = (value) => ({
5
+ id: "replace-values-plugin",
6
+ canHandle: (node) => typeof node === "string" || typeof node === "number" || typeof node === "boolean",
7
+ transform: () => value
8
+ });
9
+ const skipTypedNodePlugin = {
10
+ id: "skip-typed-node-plugin",
11
+ canHandle: (node) => typeof node === "object" && typeof node?.nodeType === "string",
12
+ transform: (node, props, deepTransformNode$1) => {
13
+ const nodeType = node.nodeType;
14
+ const result = structuredClone(node[nodeType]);
15
+ if (typeof result !== "object" || result === null) {
16
+ const transformedResult = deepTransformNode$1(result, {
17
+ ...props,
18
+ children: result,
19
+ keyPath: [...props.keyPath, {
20
+ type: nodeType,
21
+ key: nodeType
22
+ }]
23
+ });
24
+ return {
25
+ ...node,
26
+ [nodeType]: transformedResult
27
+ };
28
+ }
29
+ for (const key in result) {
30
+ const childProps = {
31
+ ...props,
32
+ children: result[key],
33
+ keyPath: [...props.keyPath, {
34
+ type: nodeType,
35
+ key
36
+ }]
37
+ };
38
+ result[key] = deepTransformNode$1(result[key], childProps);
39
+ }
40
+ return {
41
+ ...node,
42
+ [nodeType]: result
43
+ };
44
+ }
45
+ };
46
+ const getReplacedValuesContent = (node, value, nodeProps) => {
47
+ const plugins = [
48
+ skipTypedNodePlugin,
49
+ replaceValuesPlugin(value),
50
+ ...nodeProps.plugins ?? []
51
+ ];
52
+ return deepTransformNode(JSON.parse(JSON.stringify(node)), {
53
+ ...nodeProps,
54
+ plugins
55
+ });
56
+ };
57
+
58
+ //#endregion
59
+ export { getReplacedValuesContent };
60
+ //# sourceMappingURL=getReplacedValuesContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getReplacedValuesContent.mjs","names":["skipTypedNodePlugin: Plugins","deepTransformNode","plugins: Plugins[]"],"sources":["../../../src/deepTransformPlugins/getReplacedValuesContent.ts"],"sourcesContent":["import type {\n ContentNode,\n KeyPath,\n NodeType,\n TypedNode,\n} from '@intlayer/types';\nimport {\n deepTransformNode,\n type NodeProps,\n type Plugins,\n} from '../interpreter';\n\nconst replaceValuesPlugin = (value: string | number | boolean): Plugins => ({\n id: 'replace-values-plugin',\n canHandle: (node) =>\n typeof node === 'string' ||\n typeof node === 'number' ||\n typeof node === 'boolean',\n transform: () => value,\n});\n\nconst skipTypedNodePlugin: Plugins = {\n id: 'skip-typed-node-plugin',\n canHandle: (node) =>\n typeof node === 'object' && typeof node?.nodeType === 'string',\n transform: (node: TypedNode, props, deepTransformNode) => {\n const nodeType = node.nodeType as NodeType;\n const result = structuredClone(\n node[nodeType as unknown as keyof TypedNode] as any\n );\n\n // If the result is a primitive value (string, number, boolean),\n // we need to transform it directly instead of iterating over its properties\n if (typeof result !== 'object' || result === null) {\n const transformedResult = deepTransformNode(result, {\n ...props,\n children: result,\n keyPath: [\n ...props.keyPath,\n { type: nodeType, key: nodeType } as KeyPath,\n ],\n });\n return {\n ...node,\n [nodeType as unknown as keyof TypedNode]: transformedResult,\n };\n }\n\n // For objects and arrays, iterate over their properties\n for (const key in result) {\n const childProps = {\n ...props,\n children: result[key as unknown as keyof typeof result],\n keyPath: [...props.keyPath, { type: nodeType, key } as KeyPath],\n };\n result[key as unknown as keyof typeof result] = deepTransformNode(\n result[key as unknown as keyof typeof result],\n childProps\n );\n }\n\n return { ...node, [nodeType as unknown as keyof TypedNode]: result };\n },\n};\n\nexport const getReplacedValuesContent = (\n node: ContentNode,\n value: string | number | boolean,\n nodeProps: NodeProps\n) => {\n const plugins: Plugins[] = [\n skipTypedNodePlugin,\n replaceValuesPlugin(value),\n ...(nodeProps.plugins ?? []),\n ];\n\n const JSONNode = JSON.parse(JSON.stringify(node));\n\n return deepTransformNode(JSONNode, {\n ...nodeProps,\n plugins,\n });\n};\n"],"mappings":";;;AAYA,MAAM,uBAAuB,WAA+C;CAC1E,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAChB,OAAO,SAAS,YAChB,OAAO,SAAS;CAClB,iBAAiB;CAClB;AAED,MAAMA,sBAA+B;CACnC,IAAI;CACJ,YAAY,SACV,OAAO,SAAS,YAAY,OAAO,MAAM,aAAa;CACxD,YAAY,MAAiB,OAAO,wBAAsB;EACxD,MAAM,WAAW,KAAK;EACtB,MAAM,SAAS,gBACb,KAAK,UACN;AAID,MAAI,OAAO,WAAW,YAAY,WAAW,MAAM;GACjD,MAAM,oBAAoBC,oBAAkB,QAAQ;IAClD,GAAG;IACH,UAAU;IACV,SAAS,CACP,GAAG,MAAM,SACT;KAAE,MAAM;KAAU,KAAK;KAAU,CAClC;IACF,CAAC;AACF,UAAO;IACL,GAAG;KACF,WAAyC;IAC3C;;AAIH,OAAK,MAAM,OAAO,QAAQ;GACxB,MAAM,aAAa;IACjB,GAAG;IACH,UAAU,OAAO;IACjB,SAAS,CAAC,GAAG,MAAM,SAAS;KAAE,MAAM;KAAU;KAAK,CAAY;IAChE;AACD,UAAO,OAAyCA,oBAC9C,OAAO,MACP,WACD;;AAGH,SAAO;GAAE,GAAG;IAAO,WAAyC;GAAQ;;CAEvE;AAED,MAAa,4BACX,MACA,OACA,cACG;CACH,MAAMC,UAAqB;EACzB;EACA,oBAAoB,MAAM;EAC1B,GAAI,UAAU,WAAW,EAAE;EAC5B;AAID,QAAO,kBAFU,KAAK,MAAM,KAAK,UAAU,KAAK,CAAC,EAEd;EACjC,GAAG;EACH;EACD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { getFilteredLocalesContent, getFilteredLocalesDictionary } from "./getFilteredLocalesContent.mjs";
2
+ import { filterMissingTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary } from "./getFilterMissingTranslationsContent.mjs";
3
+ import { filterTranslationsOnlyPlugin, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary } from "./getFilterTranslationsOnlyContent.mjs";
4
+ import { getLocalizedContent, getPerLocaleDictionary } from "./getLocalizedContent.mjs";
5
+ import { buildMaskPlugin, getMaskContent } from "./getMaskContent.mjs";
6
+ import { checkMissingLocalesPlugin, getMissingLocalesContent } from "./getMissingLocalesContent.mjs";
7
+ import { getReplacedValuesContent } from "./getReplacedValuesContent.mjs";
8
+ import { insertContentInDictionary } from "./insertContentInDictionary.mjs";
9
+
10
+ export { buildMaskPlugin, checkMissingLocalesPlugin, filterMissingTranslationsOnlyPlugin, filterTranslationsOnlyPlugin, getFilterMissingTranslationsContent, getFilterMissingTranslationsDictionary, getFilterTranslationsOnlyContent, getFilterTranslationsOnlyDictionary, getFilteredLocalesContent, getFilteredLocalesDictionary, getLocalizedContent, getMaskContent, getMissingLocalesContent, getPerLocaleDictionary, getReplacedValuesContent, insertContentInDictionary };
@@ -0,0 +1,105 @@
1
+ import { NodeType } from "@intlayer/types";
2
+
3
+ //#region src/deepTransformPlugins/insertContentInDictionary.ts
4
+ /**
5
+ * Deep merge helper that handles translation blocks
6
+ * @param target - The target object (dictionary content)
7
+ * @param source - The source object (new content to merge)
8
+ * @param locale - Optional locale to target specific translation
9
+ * @returns Merged content
10
+ */
11
+ const deepMergeContent = (target, source, locale) => {
12
+ if (source === null || source === void 0) return target;
13
+ if (target === null || target === void 0) if (Array.isArray(source)) target = [];
14
+ else if (typeof source === "object") target = {};
15
+ else return source;
16
+ if (target && typeof target === "object" && target.nodeType === NodeType.Translation) if (locale) {
17
+ const existingLocaleContent = target.translation[locale];
18
+ let newLocaleContent;
19
+ if (typeof source === "object" && !Array.isArray(source)) newLocaleContent = deepMergeContent(existingLocaleContent, source, void 0);
20
+ else if (Array.isArray(source)) newLocaleContent = source;
21
+ else newLocaleContent = source;
22
+ return {
23
+ ...target,
24
+ translation: {
25
+ ...target.translation,
26
+ [locale]: newLocaleContent
27
+ }
28
+ };
29
+ } else if (typeof source === "object" && !Array.isArray(source) && source.nodeType === NodeType.Translation) return {
30
+ ...target,
31
+ translation: {
32
+ ...target.translation,
33
+ ...source.translation
34
+ }
35
+ };
36
+ else return processNewContent(source, locale);
37
+ if (Array.isArray(source)) if (locale && Array.isArray(target)) {
38
+ const result = [];
39
+ const maxLength = Math.max(source.length, target.length);
40
+ for (let i = 0; i < maxLength; i++) if (i < source.length) if (i < target.length && target[i] !== void 0) result[i] = deepMergeContent(target[i], source[i], locale);
41
+ else result[i] = processNewContent(source[i], locale);
42
+ else result[i] = target[i];
43
+ return result;
44
+ } else return source.map((item) => {
45
+ if (item && typeof item === "object" && item.nodeType === NodeType.Translation) return item;
46
+ return processNewContent(item, locale);
47
+ });
48
+ if (typeof source === "object" && !Array.isArray(source)) {
49
+ if (typeof target !== "object" || Array.isArray(target)) target = {};
50
+ const result = { ...target };
51
+ for (const key in source) if (Object.hasOwn(source, key)) if (target[key] !== void 0) result[key] = deepMergeContent(target[key], source[key], locale);
52
+ else result[key] = processNewContent(source[key], locale);
53
+ return result;
54
+ }
55
+ return source;
56
+ };
57
+ /**
58
+ * Process new content that doesn't exist in target
59
+ * @param content - New content to process
60
+ * @param locale - Optional locale
61
+ * @returns Processed content
62
+ */
63
+ const processNewContent = (content, locale) => {
64
+ if (content === null || content === void 0) return content;
65
+ if (content && typeof content === "object" && content.nodeType === NodeType.Translation) return content;
66
+ if (Array.isArray(content)) return content.map((item) => processNewContent(item, locale));
67
+ if (content && typeof content === "object") {
68
+ const result = {};
69
+ for (const key in content) if (Object.hasOwn(content, key)) result[key] = processNewContent(content[key], locale);
70
+ return result;
71
+ }
72
+ if (locale) return {
73
+ nodeType: NodeType.Translation,
74
+ translation: { [locale]: content }
75
+ };
76
+ else return content;
77
+ };
78
+ /**
79
+ * Insert content into a dictionary with deep merge support
80
+ * Handles translation blocks and nested structures
81
+ *
82
+ * @param dictionary - The dictionary to insert content into
83
+ * @param content - The content to insert
84
+ * @param locale - Optional locale to target specific translation
85
+ * @returns Updated dictionary
86
+ *
87
+ * @example
88
+ * // Without locale - deep merge all content
89
+ * insertContentInDictionary(dictionary, { title: 'New Title' })
90
+ *
91
+ * @example
92
+ * // With locale - insert content for specific locale
93
+ * insertContentInDictionary(dictionary, { title: 'このページ' }, 'ja')
94
+ */
95
+ const insertContentInDictionary = (dictionary, content, locale) => {
96
+ const mergedContent = deepMergeContent(Array.isArray(dictionary.content) ? [...dictionary.content] : { ...dictionary.content }, content, locale);
97
+ return {
98
+ ...dictionary,
99
+ content: mergedContent
100
+ };
101
+ };
102
+
103
+ //#endregion
104
+ export { insertContentInDictionary };
105
+ //# sourceMappingURL=insertContentInDictionary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insertContentInDictionary.mjs","names":["newLocaleContent: any","result: any"],"sources":["../../../src/deepTransformPlugins/insertContentInDictionary.ts"],"sourcesContent":["import { type Dictionary, type LocalesValues, NodeType } from '@intlayer/types';\n\n// {\n// {\n// title: 'このページ',\n// linkLabel: 'セクションへ移動',\n// collapseButton: { label: '折りたたむ' }\n// },\n// }\n// {\n// dictionary: {\n// key: 'aside-navigation',\n// content: {\n// title: {\n// nodeType: 'translation',\n// translation: {\n// ar: 'في هذه الصفحة',\n// de: 'Auf dieser Seite',\n// en: 'In this page',\n// 'en-GB': 'On this page',\n// es: 'En esta página',\n// fr: 'Dans cette page',\n// hi: 'इस पृष्ठ में',\n// it: 'In questa pagina',\n// ko: '이 페이지에서',\n// pt: 'Nesta página',\n// ru: 'На этой странице',\n// tr: 'Bu sayfada',\n// zh: '在此页面'\n// }\n// },\n// linkLabel: {\n// nodeType: 'translation',\n// translation: {\n// ar: 'اذهب إلى القسم',\n// de: 'Gehe zur Sektion',\n// en: 'Go to section',\n// 'en-GB': 'Go to section',\n// es: 'Ir a la sección',\n// fr: 'Aller à la section',\n// hi: 'सेक्शन पर जाएं',\n// it: 'Vai alla sezione',\n// ja: 'セクションへ行く',\n// ko: '섹션으로 이동',\n// pt: 'Ir para a seção',\n// ru: 'Перейти к разделу',\n// tr: 'Bölüme git',\n// zh: '转到节'\n// }\n// },\n// collapseButton: {\n// label: {\n// nodeType: 'translation',\n// translation: {\n// en: 'Collapse',\n// fr: 'Réduire',\n// es: 'Colapsar',\n// 'en-GB': 'Collapse',\n// de: 'Zuklappen',\n// ja: '折りたたむ',\n// ko: '접기',\n// zh: '折叠',\n// it: 'Comprimi',\n// pt: 'Recolher',\n// hi: 'संकुचित करें',\n// ar: 'اطوي التوسيع',\n// ru: 'Свернуть',\n// tr: 'Daralt'\n// }\n// }\n// }\n// },\n// localId: 'aside-navigation::local::src/components/AsideNavigation/asideNavigation.content.ts',\n// location: 'local',\n// filePath: 'src/components/AsideNavigation/asideNavigation.content.ts'\n// }\n// }\n\n/**\n * Deep merge helper that handles translation blocks\n * @param target - The target object (dictionary content)\n * @param source - The source object (new content to merge)\n * @param locale - Optional locale to target specific translation\n * @returns Merged content\n */\nconst deepMergeContent = (\n target: any,\n source: any,\n locale?: LocalesValues\n): any => {\n // If source is null or undefined, return target\n if (source === null || source === undefined) return target;\n\n // If target is null or undefined, initialize based on source type\n if (target === null || target === undefined) {\n if (Array.isArray(source)) {\n target = [];\n } else if (typeof source === 'object') {\n target = {};\n } else {\n return source;\n }\n }\n\n // Handle translation nodes FIRST (before arrays) to support arrays within translations\n if (\n target &&\n typeof target === 'object' &&\n target.nodeType === NodeType.Translation\n ) {\n // Target is a translation block\n if (locale) {\n // Update only the specific locale - create new object to preserve order\n const existingLocaleContent = target.translation[locale];\n let newLocaleContent: any;\n\n if (typeof source === 'object' && !Array.isArray(source)) {\n // Source is an object, need to deep merge for this locale\n newLocaleContent = deepMergeContent(\n existingLocaleContent,\n source,\n undefined // Don't pass locale down for nested content\n );\n } else if (Array.isArray(source)) {\n // Source is an array, set it directly for this locale\n newLocaleContent = source;\n } else {\n // Source is a primitive, directly set it\n newLocaleContent = source;\n }\n\n // Return new object with locale appended at the end (preserve insertion order)\n return {\n ...target,\n translation: {\n ...target.translation,\n [locale]: newLocaleContent,\n },\n };\n } else {\n // No locale specified, replace/merge the entire translation\n if (\n typeof source === 'object' &&\n !Array.isArray(source) &&\n source.nodeType === NodeType.Translation\n ) {\n // Source is also a translation node, merge translations\n return {\n ...target,\n translation: {\n ...target.translation,\n ...source.translation,\n },\n };\n } else {\n // Source is not a translation node, wrap it\n return processNewContent(source, locale);\n }\n }\n }\n\n // Handle arrays\n if (Array.isArray(source)) {\n if (locale && Array.isArray(target)) {\n // When locale is specified and target is also an array, merge element by element\n const result = [];\n const maxLength = Math.max(source.length, target.length);\n\n for (let i = 0; i < maxLength; i++) {\n if (i < source.length) {\n if (i < target.length && target[i] !== undefined) {\n // Both source and target have element at this index - merge them\n result[i] = deepMergeContent(target[i], source[i], locale);\n } else {\n // Only source has element at this index - process new content\n result[i] = processNewContent(source[i], locale);\n }\n } else {\n // Only target has element at this index - keep it\n result[i] = target[i];\n }\n }\n\n return result;\n } else {\n // No locale or target is not an array - replace entirely\n return source.map((item) => {\n // Process each item in case it needs locale wrapping\n if (\n item &&\n typeof item === 'object' &&\n item.nodeType === NodeType.Translation\n ) {\n return item;\n }\n return processNewContent(item, locale);\n });\n }\n }\n\n // Handle objects\n if (typeof source === 'object' && !Array.isArray(source)) {\n if (typeof target !== 'object' || Array.isArray(target)) {\n target = {};\n }\n\n // Create new object to preserve key order and avoid mutation\n const result: any = { ...target };\n\n for (const key in source) {\n if (Object.hasOwn(source, key)) {\n if (target[key] !== undefined) {\n result[key] = deepMergeContent(target[key], source[key], locale);\n } else {\n result[key] = processNewContent(source[key], locale);\n }\n }\n }\n\n return result;\n }\n\n // For primitives, just return the source\n return source;\n};\n\n/**\n * Process new content that doesn't exist in target\n * @param content - New content to process\n * @param locale - Optional locale\n * @returns Processed content\n */\nconst processNewContent = (content: any, locale?: LocalesValues): any => {\n // Handle null and undefined\n if (content === null || content === undefined) {\n return content;\n }\n\n // If content is already a translation node, return as-is\n if (\n content &&\n typeof content === 'object' &&\n content.nodeType === NodeType.Translation\n ) {\n return content;\n }\n\n // Handle arrays\n if (Array.isArray(content)) {\n return content.map((item) => processNewContent(item, locale));\n }\n\n // Handle objects\n if (content && typeof content === 'object') {\n const result: any = {};\n\n for (const key in content) {\n if (Object.hasOwn(content, key)) {\n result[key] = processNewContent(content[key], locale);\n }\n }\n return result;\n }\n\n // Handle primitives\n if (locale) {\n // Wrap in translation node with the specific locale\n return {\n nodeType: NodeType.Translation,\n translation: {\n [locale]: content,\n },\n };\n } else {\n // If no locale, just return the content as-is (don't wrap)\n return content;\n }\n};\n\n/**\n * Insert content into a dictionary with deep merge support\n * Handles translation blocks and nested structures\n *\n * @param dictionary - The dictionary to insert content into\n * @param content - The content to insert\n * @param locale - Optional locale to target specific translation\n * @returns Updated dictionary\n *\n * @example\n * // Without locale - deep merge all content\n * insertContentInDictionary(dictionary, { title: 'New Title' })\n *\n * @example\n * // With locale - insert content for specific locale\n * insertContentInDictionary(dictionary, { title: 'このページ' }, 'ja')\n */\nexport const insertContentInDictionary = (\n dictionary: Dictionary,\n content: Dictionary['content'],\n locale?: LocalesValues\n): Dictionary => {\n const mergedContent = deepMergeContent(\n Array.isArray(dictionary.content)\n ? [...dictionary.content]\n : { ...dictionary.content },\n content,\n locale\n );\n\n return {\n ...dictionary,\n content: mergedContent,\n };\n};\n"],"mappings":";;;;;;;;;;AAqFA,MAAM,oBACJ,QACA,QACA,WACQ;AAER,KAAI,WAAW,QAAQ,WAAW,OAAW,QAAO;AAGpD,KAAI,WAAW,QAAQ,WAAW,OAChC,KAAI,MAAM,QAAQ,OAAO,CACvB,UAAS,EAAE;UACF,OAAO,WAAW,SAC3B,UAAS,EAAE;KAEX,QAAO;AAKX,KACE,UACA,OAAO,WAAW,YAClB,OAAO,aAAa,SAAS,YAG7B,KAAI,QAAQ;EAEV,MAAM,wBAAwB,OAAO,YAAY;EACjD,IAAIA;AAEJ,MAAI,OAAO,WAAW,YAAY,CAAC,MAAM,QAAQ,OAAO,CAEtD,oBAAmB,iBACjB,uBACA,QACA,OACD;WACQ,MAAM,QAAQ,OAAO,CAE9B,oBAAmB;MAGnB,oBAAmB;AA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