@intlayer/chokidar 6.1.6 → 7.0.0-canary.1

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 (464) hide show
  1. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/cjsTemplate.txt +3 -2
  2. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/esmTemplate.txt +2 -1
  3. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/jsonTemplate.txt +2 -1
  4. package/dist/{cjs → assets}/getContentDeclarationFileTemplate/tsTemplate.txt +2 -1
  5. package/dist/cjs/_virtual/_utils_asset.cjs +104 -0
  6. package/dist/cjs/_virtual/rolldown_runtime.cjs +25 -0
  7. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +42 -80
  8. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  9. package/dist/cjs/buildIntlayerDictionary/index.cjs +5 -25
  10. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +21 -42
  11. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +79 -116
  13. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +62 -86
  15. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  16. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +48 -69
  17. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  18. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +42 -52
  19. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  20. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +60 -82
  21. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  22. package/dist/cjs/cleanOutputDir.cjs +20 -60
  23. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +64 -103
  25. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +41 -73
  27. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +19 -49
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +20 -50
  31. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  32. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +20 -50
  33. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  34. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +19 -49
  35. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  36. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +19 -49
  37. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  38. package/dist/cjs/createDictionaryEntryPoint/index.cjs +15 -35
  39. package/dist/cjs/createType/createModuleAugmentation.cjs +56 -108
  40. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  41. package/dist/cjs/createType/createType.cjs +29 -58
  42. package/dist/cjs/createType/createType.cjs.map +1 -1
  43. package/dist/cjs/createType/index.cjs +7 -25
  44. package/dist/cjs/fetchDistantDictionaries.cjs +49 -77
  45. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  46. package/dist/cjs/filterInvalidDictionaries.cjs +26 -59
  47. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  48. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +32 -68
  49. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  50. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +32 -51
  51. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  52. package/dist/cjs/handleContentDeclarationFileChange.cjs +35 -56
  53. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  54. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +36 -0
  55. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -0
  56. package/dist/cjs/index.cjs +103 -156
  57. package/dist/cjs/listDictionariesPath.cjs +27 -59
  58. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  59. package/dist/cjs/listGitFiles.cjs +93 -162
  60. package/dist/cjs/listGitFiles.cjs.map +1 -1
  61. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +70 -0
  62. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -0
  63. package/dist/cjs/loadDictionaries/index.cjs +11 -29
  64. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +68 -90
  65. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  66. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +111 -166
  67. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  68. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +27 -53
  69. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  70. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +60 -102
  71. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  72. package/dist/cjs/loadDictionaries/log.cjs +107 -182
  73. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  74. package/dist/cjs/prepareIntlayer.cjs +73 -130
  75. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  76. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +27 -61
  77. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  78. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +10 -32
  79. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  80. package/dist/cjs/utils/chunkJSON.cjs +329 -0
  81. package/dist/cjs/utils/chunkJSON.cjs.map +1 -0
  82. package/dist/cjs/utils/extractErrorMessage.cjs +92 -135
  83. package/dist/cjs/utils/extractErrorMessage.cjs.map +1 -1
  84. package/dist/cjs/utils/formatter.cjs +19 -49
  85. package/dist/cjs/utils/formatter.cjs.map +1 -1
  86. package/dist/cjs/utils/getChunk.cjs +34 -0
  87. package/dist/cjs/utils/getChunk.cjs.map +1 -0
  88. package/dist/cjs/utils/getFileHash.cjs +9 -40
  89. package/dist/cjs/utils/getFileHash.cjs.map +1 -1
  90. package/dist/cjs/utils/getFormatFromExtension.cjs +23 -54
  91. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  92. package/dist/cjs/utils/kebabCaseToCamelCase.cjs +11 -36
  93. package/dist/cjs/utils/kebabCaseToCamelCase.cjs.map +1 -1
  94. package/dist/cjs/utils/pLimit.cjs +128 -0
  95. package/dist/cjs/utils/pLimit.cjs.map +1 -0
  96. package/dist/cjs/utils/parallelize.cjs +10 -169
  97. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  98. package/dist/cjs/utils/parallelizeGlobal.cjs +29 -0
  99. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -0
  100. package/dist/cjs/utils/reduceObjectFormat.cjs +31 -0
  101. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -0
  102. package/dist/cjs/utils/resolveObjectPromises.cjs +18 -48
  103. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  104. package/dist/cjs/utils/runOnce.cjs +80 -57
  105. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  106. package/dist/cjs/utils/runParallel.cjs +163 -74
  107. package/dist/cjs/utils/runParallel.cjs.map +1 -1
  108. package/dist/cjs/utils/sortAlphabetically.cjs +5 -27
  109. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  110. package/dist/cjs/utils/splitTextByLine.cjs +11 -0
  111. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
  112. package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs +54 -0
  113. package/dist/cjs/utils/verifyIdenticObjectFormat copy.cjs.map +1 -0
  114. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +60 -0
  115. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -0
  116. package/dist/cjs/watcher.cjs +61 -83
  117. package/dist/cjs/watcher.cjs.map +1 -1
  118. package/dist/cjs/writeConfiguration/index.cjs +15 -35
  119. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  120. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +25 -51
  121. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  122. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +0 -17
  123. package/dist/cjs/writeContentDeclaration/index.cjs +9 -33
  124. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +77 -0
  125. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
  126. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1731 -755
  127. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  128. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +113 -112
  129. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  130. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +56 -66
  131. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  132. package/dist/cjs/writeFileIfChanged.cjs +10 -43
  133. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  134. package/dist/cjs/writeJsonIfChanged.cjs +14 -31
  135. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  136. package/dist/esm/_virtual/_utils_asset.mjs +100 -0
  137. package/dist/esm/_virtual/rolldown_runtime.mjs +8 -0
  138. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +35 -54
  139. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
  140. package/dist/esm/buildIntlayerDictionary/index.mjs +4 -3
  141. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +18 -17
  142. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  143. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +69 -91
  144. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  145. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +53 -61
  146. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
  147. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +40 -42
  148. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  149. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +35 -25
  150. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  151. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +53 -56
  152. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  153. package/dist/esm/cleanOutputDir.mjs +17 -36
  154. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  155. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +51 -70
  156. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  157. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +36 -47
  158. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  159. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +14 -14
  160. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
  161. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +15 -15
  162. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
  163. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +15 -15
  164. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
  165. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +14 -14
  166. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
  167. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +14 -14
  168. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
  169. package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -8
  170. package/dist/esm/createType/createModuleAugmentation.mjs +48 -71
  171. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  172. package/dist/esm/createType/createType.mjs +24 -35
  173. package/dist/esm/createType/createType.mjs.map +1 -1
  174. package/dist/esm/createType/index.mjs +4 -3
  175. package/dist/esm/fetchDistantDictionaries.mjs +45 -52
  176. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  177. package/dist/esm/filterInvalidDictionaries.mjs +22 -37
  178. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  179. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +31 -42
  180. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
  181. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +27 -24
  182. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  183. package/dist/esm/handleContentDeclarationFileChange.mjs +30 -29
  184. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  185. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +34 -0
  186. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -0
  187. package/dist/esm/index.mjs +39 -99
  188. package/dist/esm/listDictionariesPath.mjs +24 -24
  189. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  190. package/dist/esm/listGitFiles.mjs +83 -124
  191. package/dist/esm/listGitFiles.mjs.map +1 -1
  192. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +66 -0
  193. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -0
  194. package/dist/esm/loadDictionaries/index.mjs +6 -5
  195. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +61 -70
  196. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  197. package/dist/esm/loadDictionaries/loadDictionaries.mjs +105 -146
  198. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  199. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +23 -31
  200. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  201. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +52 -74
  202. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  203. package/dist/esm/loadDictionaries/log.mjs +105 -165
  204. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  205. package/dist/esm/prepareIntlayer.mjs +64 -97
  206. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  207. package/dist/esm/reduceDictionaryContent/applyMask.mjs +26 -37
  208. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
  209. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +7 -7
  210. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  211. package/dist/esm/utils/chunkJSON.mjs +327 -0
  212. package/dist/esm/utils/chunkJSON.mjs.map +1 -0
  213. package/dist/esm/utils/extractErrorMessage.mjs +91 -111
  214. package/dist/esm/utils/extractErrorMessage.mjs.map +1 -1
  215. package/dist/esm/utils/formatter.mjs +10 -12
  216. package/dist/esm/utils/formatter.mjs.map +1 -1
  217. package/dist/esm/utils/getChunk.mjs +34 -0
  218. package/dist/esm/utils/getChunk.mjs.map +1 -0
  219. package/dist/esm/utils/getFileHash.mjs +6 -5
  220. package/dist/esm/utils/getFileHash.mjs.map +1 -1
  221. package/dist/esm/utils/getFormatFromExtension.mjs +21 -29
  222. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
  223. package/dist/esm/utils/kebabCaseToCamelCase.mjs +10 -12
  224. package/dist/esm/utils/kebabCaseToCamelCase.mjs.map +1 -1
  225. package/dist/esm/utils/pLimit.mjs +126 -0
  226. package/dist/esm/utils/pLimit.mjs.map +1 -0
  227. package/dist/esm/utils/parallelize.mjs +10 -144
  228. package/dist/esm/utils/parallelize.mjs.map +1 -1
  229. package/dist/esm/utils/parallelizeGlobal.mjs +27 -0
  230. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -0
  231. package/dist/esm/utils/reduceObjectFormat.mjs +30 -0
  232. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -0
  233. package/dist/esm/utils/resolveObjectPromises.mjs +17 -24
  234. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
  235. package/dist/esm/utils/runOnce.mjs +76 -33
  236. package/dist/esm/utils/runOnce.mjs.map +1 -1
  237. package/dist/esm/utils/runParallel.mjs +160 -40
  238. package/dist/esm/utils/runParallel.mjs.map +1 -1
  239. package/dist/esm/utils/sortAlphabetically.mjs +4 -3
  240. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
  241. package/dist/esm/utils/splitTextByLine.mjs +10 -0
  242. package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
  243. package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs +53 -0
  244. package/dist/esm/utils/verifyIdenticObjectFormat copy.mjs.map +1 -0
  245. package/dist/esm/utils/verifyIdenticObjectFormat.mjs +59 -0
  246. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -0
  247. package/dist/esm/watcher.mjs +53 -58
  248. package/dist/esm/watcher.mjs.map +1 -1
  249. package/dist/esm/writeConfiguration/index.mjs +11 -10
  250. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  251. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +24 -27
  252. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
  253. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +0 -1
  254. package/dist/esm/writeContentDeclaration/index.mjs +6 -7
  255. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +71 -0
  256. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
  257. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1726 -735
  258. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  259. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +105 -76
  260. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  261. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +48 -46
  262. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  263. package/dist/esm/writeFileIfChanged.mjs +7 -18
  264. package/dist/esm/writeFileIfChanged.mjs.map +1 -1
  265. package/dist/esm/writeJsonIfChanged.mjs +14 -7
  266. package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
  267. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +14 -7
  268. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
  269. package/dist/types/buildIntlayerDictionary/index.d.ts +3 -3
  270. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +7 -2
  271. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -1
  272. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +14 -10
  273. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
  274. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +8 -3
  275. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  276. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +12 -7
  277. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
  278. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +8 -2
  279. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
  280. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +10 -6
  281. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
  282. package/dist/types/cleanOutputDir.d.ts +6 -1
  283. package/dist/types/cleanOutputDir.d.ts.map +1 -1
  284. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +6 -1
  285. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
  286. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +6 -1
  287. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
  288. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +7 -1
  289. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -1
  290. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +7 -1
  291. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -1
  292. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +7 -1
  293. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -1
  294. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +7 -1
  295. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -1
  296. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +7 -1
  297. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -1
  298. package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -8
  299. package/dist/types/createType/createModuleAugmentation.d.ts +8 -5
  300. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
  301. package/dist/types/createType/createType.d.ts +7 -4
  302. package/dist/types/createType/createType.d.ts.map +1 -1
  303. package/dist/types/createType/index.d.ts +3 -3
  304. package/dist/types/fetchDistantDictionaries.d.ts +10 -7
  305. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  306. package/dist/types/filterInvalidDictionaries.d.ts +7 -4
  307. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
  308. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +6 -2
  309. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -1
  310. package/dist/types/handleAdditionalContentDeclarationFile.d.ts +6 -2
  311. package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -1
  312. package/dist/types/handleContentDeclarationFileChange.d.ts +6 -2
  313. package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -1
  314. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +7 -0
  315. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -0
  316. package/dist/types/index.d.ts +49 -33
  317. package/dist/types/listDictionariesPath.d.ts +7 -2
  318. package/dist/types/listDictionariesPath.d.ts.map +1 -1
  319. package/dist/types/listGitFiles.d.ts +24 -12
  320. package/dist/types/listGitFiles.d.ts.map +1 -1
  321. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +11 -0
  322. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -0
  323. package/dist/types/loadDictionaries/index.d.ts +5 -5
  324. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +8 -5
  325. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  326. package/dist/types/loadDictionaries/loadDictionaries.d.ts +18 -14
  327. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  328. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +6 -3
  329. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
  330. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +13 -8
  331. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  332. package/dist/types/loadDictionaries/log.d.ts +28 -24
  333. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  334. package/dist/types/prepareIntlayer.d.ts +12 -2
  335. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  336. package/dist/types/reduceDictionaryContent/applyMask.d.ts +6 -2
  337. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -1
  338. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +6 -2
  339. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
  340. package/dist/types/utils/chunkJSON.d.ts +56 -0
  341. package/dist/types/utils/chunkJSON.d.ts.map +1 -0
  342. package/dist/types/utils/extractErrorMessage.d.ts +4 -1
  343. package/dist/types/utils/extractErrorMessage.d.ts.map +1 -1
  344. package/dist/types/utils/formatter.d.ts +8 -3
  345. package/dist/types/utils/formatter.d.ts.map +1 -1
  346. package/dist/types/utils/getChunk.d.ts +11 -0
  347. package/dist/types/utils/getChunk.d.ts.map +1 -0
  348. package/dist/types/utils/getFileHash.d.ts +4 -1
  349. package/dist/types/utils/getFileHash.d.ts.map +1 -1
  350. package/dist/types/utils/getFormatFromExtension.d.ts +7 -4
  351. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  352. package/dist/types/utils/kebabCaseToCamelCase.d.ts +4 -1
  353. package/dist/types/utils/kebabCaseToCamelCase.d.ts.map +1 -1
  354. package/dist/types/utils/pLimit.d.ts +16 -0
  355. package/dist/types/utils/pLimit.d.ts.map +1 -0
  356. package/dist/types/utils/parallelize.d.ts +4 -13
  357. package/dist/types/utils/parallelize.d.ts.map +1 -1
  358. package/dist/types/utils/parallelizeGlobal.d.ts +22 -0
  359. package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -0
  360. package/dist/types/utils/reduceObjectFormat.d.ts +17 -0
  361. package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -0
  362. package/dist/types/utils/resolveObjectPromises.d.ts +4 -1
  363. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -1
  364. package/dist/types/utils/runOnce.d.ts +23 -2
  365. package/dist/types/utils/runOnce.d.ts.map +1 -1
  366. package/dist/types/utils/runParallel.d.ts +9 -6
  367. package/dist/types/utils/runParallel.d.ts.map +1 -1
  368. package/dist/types/utils/sortAlphabetically.d.ts +4 -1
  369. package/dist/types/utils/sortAlphabetically.d.ts.map +1 -1
  370. package/dist/types/utils/splitTextByLine.d.ts +5 -0
  371. package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
  372. package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts +23 -0
  373. package/dist/types/utils/verifyIdenticObjectFormat copy.d.ts.map +1 -0
  374. package/dist/types/utils/verifyIdenticObjectFormat.d.ts +23 -0
  375. package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -0
  376. package/dist/types/watcher.d.ts +13 -9
  377. package/dist/types/watcher.d.ts.map +1 -1
  378. package/dist/types/writeConfiguration/index.d.ts +6 -2
  379. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  380. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +4 -1
  381. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -1
  382. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +4 -1
  383. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
  384. package/dist/types/writeContentDeclaration/index.d.ts +6 -7
  385. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +7 -0
  386. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -0
  387. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +33 -6
  388. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
  389. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +14 -6
  390. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  391. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +7 -3
  392. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  393. package/dist/types/writeFileIfChanged.d.ts +7 -2
  394. package/dist/types/writeFileIfChanged.d.ts.map +1 -1
  395. package/dist/types/writeJsonIfChanged.d.ts +7 -2
  396. package/dist/types/writeJsonIfChanged.d.ts.map +1 -1
  397. package/package.json +48 -54
  398. package/LICENSE +0 -202
  399. package/dist/cjs/buildIntlayerDictionary/index.cjs.map +0 -1
  400. package/dist/cjs/createDictionaryEntryPoint/index.cjs.map +0 -1
  401. package/dist/cjs/createType/index.cjs.map +0 -1
  402. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs +0 -57
  403. package/dist/cjs/handleUnlikedContentDeclarationFile.cjs.map +0 -1
  404. package/dist/cjs/index.cjs.map +0 -1
  405. package/dist/cjs/loadDictionaries/index.cjs.map +0 -1
  406. package/dist/cjs/mergeDictionaries.cjs +0 -143
  407. package/dist/cjs/mergeDictionaries.cjs.map +0 -1
  408. package/dist/cjs/orderDictionaries.cjs +0 -71
  409. package/dist/cjs/orderDictionaries.cjs.map +0 -1
  410. package/dist/cjs/prepareContentDeclaration.cjs +0 -93
  411. package/dist/cjs/prepareContentDeclaration.cjs.map +0 -1
  412. package/dist/cjs/processPerLocaleDictionary.cjs +0 -49
  413. package/dist/cjs/processPerLocaleDictionary.cjs.map +0 -1
  414. package/dist/cjs/utils/getExtention.cjs +0 -37
  415. package/dist/cjs/utils/getExtention.cjs.map +0 -1
  416. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs.map +0 -1
  417. package/dist/cjs/writeContentDeclaration/formatCode.cjs +0 -78
  418. package/dist/cjs/writeContentDeclaration/formatCode.cjs.map +0 -1
  419. package/dist/cjs/writeContentDeclaration/index.cjs.map +0 -1
  420. package/dist/esm/buildIntlayerDictionary/index.mjs.map +0 -1
  421. package/dist/esm/createDictionaryEntryPoint/index.mjs.map +0 -1
  422. package/dist/esm/createType/index.mjs.map +0 -1
  423. package/dist/esm/getContentDeclarationFileTemplate/cjsTemplate.txt +0 -9
  424. package/dist/esm/getContentDeclarationFileTemplate/esmTemplate.txt +0 -9
  425. package/dist/esm/getContentDeclarationFileTemplate/jsonTemplate.txt +0 -5
  426. package/dist/esm/getContentDeclarationFileTemplate/tsTemplate.txt +0 -8
  427. package/dist/esm/handleUnlikedContentDeclarationFile.mjs +0 -33
  428. package/dist/esm/handleUnlikedContentDeclarationFile.mjs.map +0 -1
  429. package/dist/esm/index.mjs.map +0 -1
  430. package/dist/esm/loadDictionaries/index.mjs.map +0 -1
  431. package/dist/esm/mergeDictionaries.mjs +0 -109
  432. package/dist/esm/mergeDictionaries.mjs.map +0 -1
  433. package/dist/esm/orderDictionaries.mjs +0 -37
  434. package/dist/esm/orderDictionaries.mjs.map +0 -1
  435. package/dist/esm/prepareContentDeclaration.mjs +0 -72
  436. package/dist/esm/prepareContentDeclaration.mjs.map +0 -1
  437. package/dist/esm/processPerLocaleDictionary.mjs +0 -25
  438. package/dist/esm/processPerLocaleDictionary.mjs.map +0 -1
  439. package/dist/esm/utils/getExtention.mjs +0 -13
  440. package/dist/esm/utils/getExtention.mjs.map +0 -1
  441. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs.map +0 -1
  442. package/dist/esm/writeContentDeclaration/formatCode.mjs +0 -44
  443. package/dist/esm/writeContentDeclaration/formatCode.mjs.map +0 -1
  444. package/dist/esm/writeContentDeclaration/index.mjs.map +0 -1
  445. package/dist/types/buildIntlayerDictionary/index.d.ts.map +0 -1
  446. package/dist/types/createDictionaryEntryPoint/index.d.ts.map +0 -1
  447. package/dist/types/createType/index.d.ts.map +0 -1
  448. package/dist/types/handleUnlikedContentDeclarationFile.d.ts +0 -3
  449. package/dist/types/handleUnlikedContentDeclarationFile.d.ts.map +0 -1
  450. package/dist/types/index.d.ts.map +0 -1
  451. package/dist/types/loadDictionaries/index.d.ts.map +0 -1
  452. package/dist/types/mergeDictionaries.d.ts +0 -3
  453. package/dist/types/mergeDictionaries.d.ts.map +0 -1
  454. package/dist/types/orderDictionaries.d.ts +0 -10
  455. package/dist/types/orderDictionaries.d.ts.map +0 -1
  456. package/dist/types/prepareContentDeclaration.d.ts +0 -3
  457. package/dist/types/prepareContentDeclaration.d.ts.map +0 -1
  458. package/dist/types/processPerLocaleDictionary.d.ts +0 -32
  459. package/dist/types/processPerLocaleDictionary.d.ts.map +0 -1
  460. package/dist/types/utils/getExtention.d.ts +0 -3
  461. package/dist/types/utils/getExtention.d.ts.map +0 -1
  462. package/dist/types/writeContentDeclaration/formatCode.d.ts +0 -2
  463. package/dist/types/writeContentDeclaration/formatCode.d.ts.map +0 -1
  464. package/dist/types/writeContentDeclaration/index.d.ts.map +0 -1
@@ -1,49 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var processPerLocaleDictionary_exports = {};
20
- __export(processPerLocaleDictionary_exports, {
21
- processPerLocaleDictionary: () => processPerLocaleDictionary
22
- });
23
- module.exports = __toCommonJS(processPerLocaleDictionary_exports);
24
- var import_core = require("@intlayer/core");
25
- const processPerLocaleDictionary = (dictionary) => {
26
- const isPerLocaleDictionary = typeof dictionary.locale === "string";
27
- if (!isPerLocaleDictionary) {
28
- return dictionary;
29
- }
30
- const transformStringToTranslationPlugin = {
31
- id: "transform-string-to-translation-plugin",
32
- canHandle: (node) => typeof node === "string" || typeof node === "number",
33
- transform: (node) => (0, import_core.t)({ [dictionary.locale]: node })
34
- };
35
- return {
36
- ...dictionary,
37
- locale: void 0,
38
- content: (0, import_core.deepTransformNode)(dictionary.content, {
39
- dictionaryKey: dictionary.key,
40
- keyPath: [],
41
- plugins: [transformStringToTranslationPlugin]
42
- })
43
- };
44
- };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- processPerLocaleDictionary
48
- });
49
- //# sourceMappingURL=processPerLocaleDictionary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/processPerLocaleDictionary.ts"],"sourcesContent":["import { deepTransformNode, Plugins, t, type Dictionary } from '@intlayer/core';\n\n/**\n *\n * Should transform per local dictionaries to multi-local dictionaries\n *\n * Example:\n *\n * ```json5\n * // .intlayer/dictionaries/home.fr.json\n * { 'key': 'home', 'locale': 'fr', 'content': { 'example': \"value\", ... } },\n * ```\n *\n * Result:\n *\n * ```json5\n * // .intlayer/dictionaries/home.json\n * {\n * 'key': 'home',\n * 'content': {\n * 'example': {\n * 'nodeType': 'translation',\n * 'translation': {\n * 'fr': 'valeur',\n * }\n * }, ... } },\n * ```\n *\n * @param dictionary\n * @returns\n */\nexport const processPerLocaleDictionary = (dictionary: Dictionary) => {\n const isPerLocaleDictionary = typeof dictionary.locale === 'string';\n\n if (!isPerLocaleDictionary) {\n return dictionary;\n }\n\n const transformStringToTranslationPlugin: Plugins = {\n id: 'transform-string-to-translation-plugin',\n canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n transform: (node: string | number) =>\n t({ [dictionary.locale as string]: node }),\n };\n\n return {\n ...dictionary,\n locale: undefined,\n content: deepTransformNode(dictionary.content, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [transformStringToTranslationPlugin],\n }),\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAA+D;AA+BxD,MAAM,6BAA6B,CAAC,eAA2B;AACpE,QAAM,wBAAwB,OAAO,WAAW,WAAW;AAE3D,MAAI,CAAC,uBAAuB;AAC1B,WAAO;AAAA,EACT;AAEA,QAAM,qCAA8C;AAAA,IAClD,IAAI;AAAA,IACJ,WAAW,CAAC,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;AAAA,IACjE,WAAW,CAAC,aACV,eAAE,EAAE,CAAC,WAAW,MAAgB,GAAG,KAAK,CAAC;AAAA,EAC7C;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,IACR,aAAS,+BAAkB,WAAW,SAAS;AAAA,MAC7C,eAAe,WAAW;AAAA,MAC1B,SAAS,CAAC;AAAA,MACV,SAAS,CAAC,kCAAkC;AAAA,IAC9C,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var getExtention_exports = {};
20
- __export(getExtention_exports, {
21
- getExtension: () => getExtension
22
- });
23
- module.exports = __toCommonJS(getExtention_exports);
24
- var import_config = require("@intlayer/config");
25
- const getExtension = (configuration = (0, import_config.getConfiguration)(), format) => {
26
- const outputFormats = configuration.build.outputFormat;
27
- if (format === "esm") return "mjs";
28
- if (format === "cjs") return "cjs";
29
- if (outputFormats.includes("esm")) return "mjs";
30
- if (outputFormats.includes("cjs")) return "cjs";
31
- return "mjs";
32
- };
33
- // Annotate the CommonJS export names for ESM import in node:
34
- 0 && (module.exports = {
35
- getExtension
36
- });
37
- //# sourceMappingURL=getExtention.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/getExtention.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\n\nexport const getExtension = (\n configuration: IntlayerConfig = getConfiguration(),\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'esm') return 'mjs';\n if (format === 'cjs') return 'cjs';\n\n if (outputFormats.includes('esm')) return 'mjs';\n if (outputFormats.includes('cjs')) return 'cjs';\n\n return 'mjs';\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAsD;AAE/C,MAAM,eAAe,CAC1B,oBAAgC,gCAAiB,GACjD,WACG;AACH,QAAM,gBAAgB,cAAc,MAAM;AAE1C,MAAI,WAAW,MAAO,QAAO;AAC7B,MAAI,WAAW,MAAO,QAAO;AAE7B,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAC1C,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAE1C,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/dictionaryStatus.ts"],"sourcesContent":["export type DictionaryStatus =\n | 'pending'\n | 'fetching'\n | 'up-to-date'\n | 'replaced'\n | 'updated'\n | 'fetched'\n | 'unknown'\n | 'error'\n | 'imported'\n | 'reimported in JSON'\n | 'new content file';\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,78 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var formatCode_exports = {};
30
- __export(formatCode_exports, {
31
- formatCode: () => formatCode
32
- });
33
- module.exports = __toCommonJS(formatCode_exports);
34
- var import_config = require("@intlayer/config");
35
- var import_built = __toESM(require("@intlayer/config/built"));
36
- var import_path = require("path");
37
- const formatCode = async (filePath, code) => {
38
- const appLogger = (0, import_config.getAppLogger)(import_built.default);
39
- let prettier;
40
- try {
41
- prettier = require("prettier");
42
- } catch (error) {
43
- }
44
- if (prettier) {
45
- try {
46
- const prettierConfig = await prettier.resolveConfig(filePath ?? "");
47
- const formattedCode = await prettier.format(code, {
48
- ...prettierConfig,
49
- filepath: filePath
50
- // Explicitly provide the filepath so Prettier can infer the parser
51
- });
52
- const relativePath = (0, import_path.relative)(import_built.default.content.baseDir, filePath);
53
- appLogger(
54
- `Applied Prettier formatting to ${import_config.ANSIColors.GREY}${relativePath}${import_config.ANSIColors.RESET}`,
55
- {
56
- level: "info",
57
- isVerbose: true
58
- }
59
- );
60
- return formattedCode;
61
- } catch (error) {
62
- const err = error;
63
- appLogger(
64
- `Failed to apply Prettier formatting to ${filePath}: ${err.message}`,
65
- {
66
- level: "warn",
67
- isVerbose: true
68
- }
69
- );
70
- }
71
- }
72
- return code;
73
- };
74
- // Annotate the CommonJS export names for ESM import in node:
75
- 0 && (module.exports = {
76
- formatCode
77
- });
78
- //# sourceMappingURL=formatCode.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/formatCode.ts"],"sourcesContent":["import { ANSIColors, getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { relative } from 'path';\n\nexport const formatCode = async (filePath: string, code: string) => {\n const appLogger = getAppLogger(configuration);\n // Try to import prettier if it exists\n let prettier: any;\n try {\n prettier = require('prettier');\n } catch (error) {\n // Prettier is not installed, continue without it\n }\n\n // Apply Prettier formatting if it's available\n if (prettier) {\n try {\n // Try to find a prettier config file\n const prettierConfig = await prettier.resolveConfig(filePath ?? '');\n\n // Format the code with Prettier\n const formattedCode = await prettier.format(code, {\n ...prettierConfig,\n filepath: filePath, // Explicitly provide the filepath so Prettier can infer the parser\n });\n\n const relativePath = relative(configuration.content.baseDir, filePath);\n\n appLogger(\n `Applied Prettier formatting to ${ANSIColors.GREY}${relativePath}${ANSIColors.RESET}`,\n {\n level: 'info',\n isVerbose: true,\n }\n );\n\n return formattedCode;\n } catch (error) {\n const err = error as Error;\n appLogger(\n `Failed to apply Prettier formatting to ${filePath}: ${err.message}`,\n {\n level: 'warn',\n isVerbose: true,\n }\n );\n // Continue with unformatted code on prettier error\n }\n }\n\n return code;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAyC;AACzC,mBAA0B;AAC1B,kBAAyB;AAElB,MAAM,aAAa,OAAO,UAAkB,SAAiB;AAClE,QAAM,gBAAY,4BAAa,aAAAA,OAAa;AAE5C,MAAI;AACJ,MAAI;AACF,eAAW,QAAQ,UAAU;AAAA,EAC/B,SAAS,OAAO;AAAA,EAEhB;AAGA,MAAI,UAAU;AACZ,QAAI;AAEF,YAAM,iBAAiB,MAAM,SAAS,cAAc,YAAY,EAAE;AAGlE,YAAM,gBAAgB,MAAM,SAAS,OAAO,MAAM;AAAA,QAChD,GAAG;AAAA,QACH,UAAU;AAAA;AAAA,MACZ,CAAC;AAED,YAAM,mBAAe,sBAAS,aAAAA,QAAc,QAAQ,SAAS,QAAQ;AAErE;AAAA,QACE,kCAAkC,yBAAW,IAAI,GAAG,YAAY,GAAG,yBAAW,KAAK;AAAA,QACnF;AAAA,UACE,OAAO;AAAA,UACP,WAAW;AAAA,QACb;AAAA,MACF;AAEA,aAAO;AAAA,IACT,SAAS,OAAO;AACd,YAAM,MAAM;AACZ;AAAA,QACE,0CAA0C,QAAQ,KAAK,IAAI,OAAO;AAAA,QAClE;AAAA,UACE,OAAO;AAAA,UACP,WAAW;AAAA,QACb;AAAA,MACF;AAAA,IAEF;AAAA,EACF;AAEA,SAAO;AACT;","names":["configuration"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/writeContentDeclaration/index.ts"],"sourcesContent":["export * from './detectExportedComponentName';\nexport * from './dictionaryStatus';\nexport * from './formatCode';\nexport * from './transformJSFile';\nexport * from './writeContentDeclaration';\nexport * from './writeJSFile';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4CAAc,0CAAd;AACA,4CAAc,+BADd;AAEA,4CAAc,yBAFd;AAGA,4CAAc,8BAHd;AAIA,4CAAc,sCAJd;AAKA,4CAAc,0BALd;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/buildIntlayerDictionary/index.ts"],"sourcesContent":["export * from './buildIntlayerDictionary';\nexport * from './processContentDeclaration';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/createDictionaryEntryPoint/index.ts"],"sourcesContent":["export * from './createDictionaryEntryPoint';\nexport * from './generateDictionaryListContent';\nexport * from './getBuiltDictionariesPath';\nexport * from './getBuiltDynamicDictionariesPath';\nexport * from './getBuiltFetchDictionariesPath';\nexport * from './getBuiltRemoteDictionariesPath';\nexport * from './getBuiltUnmergedDictionariesPath';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/createType/index.ts"],"sourcesContent":["export * from './createModuleAugmentation';\nexport * from './createType';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
@@ -1,9 +0,0 @@
1
- import { t } from 'intlayer';
2
-
3
- /** @type {import('intlayer').Dictionary} **/
4
- const {{name}}Content = {
5
- key: '{{key}}',{{fileParams}}
6
- content: {},
7
- };
8
-
9
- module.exports = {{name}}Content;
@@ -1,9 +0,0 @@
1
- import { t } from 'intlayer';
2
-
3
- /** @type {import('intlayer').Dictionary} **/
4
- const {{name}}Content = {
5
- key: '{{key}}',{{fileParams}}
6
- content: {},
7
- };
8
-
9
- export default {{name}}Content;
@@ -1,5 +0,0 @@
1
- {
2
- "$schema": "https://intlayer.org/schema.json",
3
- "key": "{{key}}",{{fileParams}}
4
- "content": {}
5
- }
@@ -1,8 +0,0 @@
1
- import { t, type Dictionary } from 'intlayer';
2
-
3
- const {{name}}Content = {
4
- key: '{{key}}',{{fileParams}}
5
- content: {},
6
- } satisfies Dictionary;
7
-
8
- export default {{name}}Content;
@@ -1,33 +0,0 @@
1
- import { getAppLogger } from "@intlayer/config";
2
- import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
3
- import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
4
- import { createTypes } from "./createType/index.mjs";
5
- import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
6
- import { listDictionaries } from "./listDictionariesPath.mjs";
7
- import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
8
- import { formatPath } from "./utils/formatter.mjs";
9
- const handleUnlikedContentDeclarationFile = async (filePath, config) => {
10
- const appLogger = getAppLogger(config);
11
- appLogger(`Unlinked detected: ${formatPath(filePath)}`, {
12
- isVerbose: true
13
- });
14
- const files = listDictionaries(config);
15
- const localeDictionaries = await loadLocalDictionaries(files, config);
16
- const dictionariesOutput = await buildDictionary(localeDictionaries, config);
17
- const dictionariesPaths = Object.values(
18
- dictionariesOutput?.mergedDictionaries ?? {}
19
- ).map((dictionary) => dictionary.dictionaryPath);
20
- await createTypes(dictionariesPaths);
21
- await createDictionaryEntryPoint();
22
- appLogger("Dictionaries rebuilt", {
23
- isVerbose: true
24
- });
25
- await createModuleAugmentation();
26
- appLogger("Module augmentation built", {
27
- isVerbose: true
28
- });
29
- };
30
- export {
31
- handleUnlikedContentDeclarationFile
32
- };
33
- //# sourceMappingURL=handleUnlikedContentDeclarationFile.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/handleUnlikedContentDeclarationFile.ts"],"sourcesContent":["import { type IntlayerConfig, getAppLogger } from '@intlayer/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlikedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = listDictionaries(config);\n\n const localeDictionaries = await loadLocalDictionaries(files, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesPaths = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionaryPath);\n\n await createTypes(dictionariesPaths);\n\n await createDictionaryEntryPoint();\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation();\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n};\n"],"mappings":"AAAA,SAA8B,oBAAoB;AAClD,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,wBAAwB;AACjC,SAAS,6BAA6B;AACtC,SAAS,kBAAkB;AAEpB,MAAM,sCAAsC,OACjD,UACA,WACG;AACH,QAAM,YAAY,aAAa,MAAM;AAGrC,YAAU,sBAAsB,WAAW,QAAQ,CAAC,IAAI;AAAA,IACtD,WAAW;AAAA,EACb,CAAC;AAED,QAAM,QAAkB,iBAAiB,MAAM;AAE/C,QAAM,qBAAqB,MAAM,sBAAsB,OAAO,MAAM;AAEpE,QAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;AAE3E,QAAM,oBAAoB,OAAO;AAAA,IAC/B,oBAAoB,sBAAsB,CAAC;AAAA,EAC7C,EAAE,IAAI,CAAC,eAAe,WAAW,cAAc;AAE/C,QAAM,YAAY,iBAAiB;AAEnC,QAAM,2BAA2B;AAEjC,YAAU,wBAAwB;AAAA,IAChC,WAAW;AAAA,EACb,CAAC;AAED,QAAM,yBAAyB;AAE/B,YAAU,6BAA6B;AAAA,IACrC,WAAW;AAAA,EACb,CAAC;AACH;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts"],"sourcesContent":["export { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nexport { cleanOutputDir } from './cleanOutputDir';\nexport {\n createDictionaryEntryPoint,\n generateDictionaryListContent,\n getBuiltDictionariesPath,\n getBuiltDynamicDictionariesPath,\n getBuiltFetchDictionariesPath,\n getBuiltRemoteDictionariesPath,\n getBuiltUnmergedDictionariesPath,\n} from './createDictionaryEntryPoint';\nexport { createTypes } from './createType';\nexport { createModuleAugmentation } from './createType/createModuleAugmentation';\nexport { fetchDistantDictionaries } from './fetchDistantDictionaries';\nexport { isInvalidDictionary } from './filterInvalidDictionaries';\nexport { getContentDeclarationFileTemplate } from './getContentDeclarationFileTemplate/getContentDeclarationFileTemplate';\nexport { handleAdditionalContentDeclarationFile } from './handleAdditionalContentDeclarationFile';\nexport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nexport { handleUnlikedContentDeclarationFile } from './handleUnlikedContentDeclarationFile';\nexport { listDictionaries } from './listDictionariesPath';\nexport {\n listGitFiles,\n listGitLines,\n type DiffMode,\n type ListGitFilesOptions,\n type ListGitLinesOptions,\n} from './listGitFiles';\nexport {\n loadContentDeclarations,\n loadDictionaries,\n loadLocalDictionaries,\n loadRemoteDictionaries,\n} from './loadDictionaries';\nexport { mergeDictionaries } from './mergeDictionaries';\nexport { prepareContentDeclaration } from './prepareContentDeclaration';\nexport { prepareIntlayer } from './prepareIntlayer';\nexport { processPerLocaleDictionary } from './processPerLocaleDictionary';\nexport { reduceDictionaryContent } from './reduceDictionaryContent/reduceDictionaryContent';\nexport { extractErrorMessage } from './utils/extractErrorMessage';\nexport { formatLocale, formatPath } from './utils/formatter';\nexport { getExtension } from './utils/getExtention';\nexport { getFileHash } from './utils/getFileHash';\nexport {\n getExtensionFromFormat,\n getFormatFromExtension,\n type Extension,\n type Format,\n} from './utils/getFormatFromExtension';\nexport { kebabCaseToCamelCase } from './utils/kebabCaseToCamelCase';\nexport { parallelize } from './utils/parallelize';\nexport { resolveObjectPromises } from './utils/resolveObjectPromises';\nexport { runOnce } from './utils/runOnce';\nexport { runParallel, type ParallelHandle } from './utils/runParallel';\nexport { sortAlphabetically } from './utils/sortAlphabetically';\nexport { buildAndWatchIntlayer, watch } from './watcher';\nexport {\n detectExportedComponentName,\n formatCode,\n transformJSFile,\n writeContentDeclaration,\n writeJSFile,\n type DictionaryStatus,\n} from './writeContentDeclaration';\n"],"mappings":"AAAA,SAAS,uBAAuB;AAChC,SAAS,sBAAsB;AAC/B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,mBAAmB;AAC5B,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,2BAA2B;AACpC,SAAS,yCAAyC;AAClD,SAAS,8CAA8C;AACvD,SAAS,0CAA0C;AACnD,SAAS,2CAA2C;AACpD,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,OAIK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,yBAAyB;AAClC,SAAS,iCAAiC;AAC1C,SAAS,uBAAuB;AAChC,SAAS,kCAAkC;AAC3C,SAAS,+BAA+B;AACxC,SAAS,2BAA2B;AACpC,SAAS,cAAc,kBAAkB;AACzC,SAAS,oBAAoB;AAC7B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AACP,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,6BAA6B;AACtC,SAAS,eAAe;AACxB,SAAS,mBAAwC;AACjD,SAAS,0BAA0B;AACnC,SAAS,uBAAuB,aAAa;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/loadDictionaries/index.ts"],"sourcesContent":["export * from './loadContentDeclaration';\nexport * from './loadDictionaries';\nexport * from './loadLocalDictionaries';\nexport * from './loadRemoteDictionaries';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
@@ -1,109 +0,0 @@
1
- import { colorizeKey, getAppLogger } from "@intlayer/config";
2
- import configuration from "@intlayer/config/built";
3
- import { getNodeType } from "@intlayer/core";
4
- import merge from "deepmerge";
5
- import { orderDictionaries } from "./orderDictionaries.mjs";
6
- const checkTypesMatch = (obj1, obj2, dictionaryKey, path = []) => {
7
- const appLogger = getAppLogger(configuration);
8
- const type1 = getNodeType(obj1);
9
- const type2 = getNodeType(obj2);
10
- if (type1 !== type2) {
11
- appLogger(
12
- `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path "${path.join(".")}": Cannot merge ${type1} with ${type2}`,
13
- {
14
- level: "error"
15
- }
16
- );
17
- }
18
- if (type1 === "object" && obj1 && obj2) {
19
- const allKeys = /* @__PURE__ */ new Set([...Object.keys(obj1), ...Object.keys(obj2)]);
20
- for (const key of allKeys) {
21
- if (key in obj1 && key in obj2) {
22
- checkTypesMatch(obj1[key], obj2[key], dictionaryKey, [...path, key]);
23
- }
24
- }
25
- }
26
- };
27
- const arrayMerge = (destinationArray, sourceArray) => {
28
- const isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
29
- const getKey = (item) => {
30
- if (!isObject(item)) return void 0;
31
- const key = item.key;
32
- if (typeof key === "string" || typeof key === "number") return key;
33
- return void 0;
34
- };
35
- const result = [];
36
- const destKeyToIndex = /* @__PURE__ */ new Map();
37
- const destUsed = new Array(destinationArray.length).fill(false);
38
- for (let i = 0; i < destinationArray.length; i++) {
39
- const k = getKey(destinationArray[i]);
40
- if (k !== void 0 && !destKeyToIndex.has(k)) {
41
- destKeyToIndex.set(k, i);
42
- }
43
- }
44
- for (let i = 0; i < sourceArray.length; i++) {
45
- const sourceItem = sourceArray[i];
46
- const sourceKey = getKey(sourceItem);
47
- if (sourceKey !== void 0 && destKeyToIndex.has(sourceKey)) {
48
- const destIndex = destKeyToIndex.get(sourceKey);
49
- const destItem2 = destinationArray[destIndex];
50
- destUsed[destIndex] = true;
51
- if (isObject(destItem2) && isObject(sourceItem)) {
52
- result.push(merge(sourceItem, destItem2, { arrayMerge }));
53
- } else {
54
- result.push(destItem2 !== void 0 ? destItem2 : sourceItem);
55
- }
56
- continue;
57
- }
58
- const destItem = destinationArray[i];
59
- if (destItem !== void 0 && !destUsed[i]) {
60
- destUsed[i] = true;
61
- if (isObject(destItem) && isObject(sourceItem)) {
62
- result.push(merge(sourceItem, destItem, { arrayMerge }));
63
- } else if (destItem !== void 0) {
64
- result.push(destItem);
65
- } else {
66
- result.push(sourceItem);
67
- }
68
- } else {
69
- result.push(sourceItem);
70
- }
71
- }
72
- for (let i = 0; i < destinationArray.length; i++) {
73
- if (!destUsed[i]) {
74
- result.push(destinationArray[i]);
75
- destUsed[i] = true;
76
- }
77
- }
78
- return result;
79
- };
80
- const mergeDictionaries = (dictionaries) => {
81
- const orderedDictionaries = orderDictionaries(dictionaries, configuration);
82
- let mergedContent = orderedDictionaries[0].content;
83
- const mergeOptions = {
84
- arrayMerge
85
- };
86
- for (let i = 1; i < orderedDictionaries.length; i++) {
87
- const currentDictionary = orderedDictionaries[i];
88
- checkTypesMatch(
89
- mergedContent,
90
- currentDictionary.content,
91
- currentDictionary.key,
92
- []
93
- );
94
- mergedContent = merge(
95
- currentDictionary.content,
96
- mergedContent,
97
- mergeOptions
98
- );
99
- }
100
- return {
101
- key: orderedDictionaries[0].key,
102
- content: mergedContent,
103
- localIds: dictionaries.filter((dict) => dict.localId).map((dict) => dict.localId)
104
- };
105
- };
106
- export {
107
- mergeDictionaries
108
- };
109
- //# sourceMappingURL=mergeDictionaries.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/mergeDictionaries.ts"],"sourcesContent":["import { colorizeKey, getAppLogger } from '@intlayer/config';\nimport configuration from '@intlayer/config/built';\nimport { type Dictionary, getNodeType } from '@intlayer/core';\nimport merge, { Options } from 'deepmerge';\nimport { orderDictionaries } from './orderDictionaries';\n\nconst checkTypesMatch = (\n obj1: any,\n obj2: any,\n dictionaryKey: string,\n path: string[] = []\n): void => {\n const appLogger = getAppLogger(configuration);\n const type1 = getNodeType(obj1);\n const type2 = getNodeType(obj2);\n\n if (type1 !== type2) {\n appLogger(\n `Error: Dictionary ${colorizeKey(dictionaryKey)} has a multiple content files with type mismatch at path \"${path.join('.')}\": Cannot merge ${type1} with ${type2}`,\n {\n level: 'error',\n }\n );\n }\n\n if (type1 === 'object' && obj1 && obj2) {\n const allKeys = new Set([...Object.keys(obj1), ...Object.keys(obj2)]);\n for (const key of allKeys) {\n if (key in obj1 && key in obj2) {\n checkTypesMatch(obj1[key], obj2[key], dictionaryKey, [...path, key]);\n }\n }\n }\n};\n\n// Custom array merge strategy that merges arrays by key when present, otherwise by index\nconst arrayMerge = (destinationArray: any[], sourceArray: any[]): any[] => {\n const isObject = (value: unknown): value is Record<string, any> =>\n !!value && typeof value === 'object' && !Array.isArray(value);\n\n const getKey = (item: any): string | number | undefined => {\n if (!isObject(item)) return undefined;\n const key = (item as any).key;\n if (typeof key === 'string' || typeof key === 'number') return key;\n return undefined;\n };\n\n const result: any[] = [];\n\n // Build a lookup for destination keyed items and track usage of all destination indices\n const destKeyToIndex = new Map<string | number, number>();\n const destUsed: boolean[] = new Array(destinationArray.length).fill(false);\n for (let i = 0; i < destinationArray.length; i++) {\n const k = getKey(destinationArray[i]);\n if (k !== undefined && !destKeyToIndex.has(k)) {\n destKeyToIndex.set(k, i);\n }\n }\n\n // First pass: respect source (already merged) order\n for (let i = 0; i < sourceArray.length; i++) {\n const sourceItem = sourceArray[i];\n const sourceKey = getKey(sourceItem);\n\n if (sourceKey !== undefined && destKeyToIndex.has(sourceKey)) {\n const destIndex = destKeyToIndex.get(sourceKey)!;\n const destItem = destinationArray[destIndex];\n destUsed[destIndex] = true;\n\n if (isObject(destItem) && isObject(sourceItem)) {\n result.push(merge(sourceItem, destItem, { arrayMerge }));\n } else {\n // Prefer destination item (later dictionary) when primitive\n result.push(destItem !== undefined ? destItem : sourceItem);\n }\n continue;\n }\n\n // Fallback to index-based merge when no key match\n const destItem = destinationArray[i];\n if (destItem !== undefined && !destUsed[i]) {\n destUsed[i] = true;\n if (isObject(destItem) && isObject(sourceItem)) {\n result.push(merge(sourceItem, destItem, { arrayMerge }));\n } else if (destItem !== undefined) {\n result.push(destItem);\n } else {\n result.push(sourceItem);\n }\n } else {\n result.push(sourceItem);\n }\n }\n\n // Second pass: append remaining unused destination items (including keyed-only in destination or extra by index)\n for (let i = 0; i < destinationArray.length; i++) {\n if (!destUsed[i]) {\n result.push(destinationArray[i]);\n destUsed[i] = true;\n }\n }\n\n return result;\n};\n\nexport const mergeDictionaries = (dictionaries: Dictionary[]): Dictionary => {\n // Order dictionaries based on priority strategy\n const orderedDictionaries = orderDictionaries(dictionaries, configuration);\n\n let mergedContent: Dictionary['content'] = orderedDictionaries[0].content;\n\n // Configure deepmerge options with custom array merge strategy\n const mergeOptions: Options = {\n arrayMerge,\n };\n\n for (let i = 1; i < orderedDictionaries.length; i++) {\n const currentDictionary = orderedDictionaries[i];\n\n // Check types before merging\n checkTypesMatch(\n mergedContent,\n currentDictionary.content,\n currentDictionary.key,\n []\n );\n\n mergedContent = merge(\n currentDictionary.content,\n mergedContent,\n mergeOptions\n );\n }\n\n return {\n key: orderedDictionaries[0].key,\n content: mergedContent,\n localIds: dictionaries\n .filter((dict) => dict.localId)\n .map((dict) => dict.localId!),\n };\n};\n"],"mappings":"AAAA,SAAS,aAAa,oBAAoB;AAC1C,OAAO,mBAAmB;AAC1B,SAA0B,mBAAmB;AAC7C,OAAO,WAAwB;AAC/B,SAAS,yBAAyB;AAElC,MAAM,kBAAkB,CACtB,MACA,MACA,eACA,OAAiB,CAAC,MACT;AACT,QAAM,YAAY,aAAa,aAAa;AAC5C,QAAM,QAAQ,YAAY,IAAI;AAC9B,QAAM,QAAQ,YAAY,IAAI;AAE9B,MAAI,UAAU,OAAO;AACnB;AAAA,MACE,qBAAqB,YAAY,aAAa,CAAC,6DAA6D,KAAK,KAAK,GAAG,CAAC,mBAAmB,KAAK,SAAS,KAAK;AAAA,MAChK;AAAA,QACE,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AAEA,MAAI,UAAU,YAAY,QAAQ,MAAM;AACtC,UAAM,UAAU,oBAAI,IAAI,CAAC,GAAG,OAAO,KAAK,IAAI,GAAG,GAAG,OAAO,KAAK,IAAI,CAAC,CAAC;AACpE,eAAW,OAAO,SAAS;AACzB,UAAI,OAAO,QAAQ,OAAO,MAAM;AAC9B,wBAAgB,KAAK,GAAG,GAAG,KAAK,GAAG,GAAG,eAAe,CAAC,GAAG,MAAM,GAAG,CAAC;AAAA,MACrE;AAAA,IACF;AAAA,EACF;AACF;AAGA,MAAM,aAAa,CAAC,kBAAyB,gBAA8B;AACzE,QAAM,WAAW,CAAC,UAChB,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK;AAE9D,QAAM,SAAS,CAAC,SAA2C;AACzD,QAAI,CAAC,SAAS,IAAI,EAAG,QAAO;AAC5B,UAAM,MAAO,KAAa;AAC1B,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,SAAU,QAAO;AAC/D,WAAO;AAAA,EACT;AAEA,QAAM,SAAgB,CAAC;AAGvB,QAAM,iBAAiB,oBAAI,IAA6B;AACxD,QAAM,WAAsB,IAAI,MAAM,iBAAiB,MAAM,EAAE,KAAK,KAAK;AACzE,WAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK;AAChD,UAAM,IAAI,OAAO,iBAAiB,CAAC,CAAC;AACpC,QAAI,MAAM,UAAa,CAAC,eAAe,IAAI,CAAC,GAAG;AAC7C,qBAAe,IAAI,GAAG,CAAC;AAAA,IACzB;AAAA,EACF;AAGA,WAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AAC3C,UAAM,aAAa,YAAY,CAAC;AAChC,UAAM,YAAY,OAAO,UAAU;AAEnC,QAAI,cAAc,UAAa,eAAe,IAAI,SAAS,GAAG;AAC5D,YAAM,YAAY,eAAe,IAAI,SAAS;AAC9C,YAAMA,YAAW,iBAAiB,SAAS;AAC3C,eAAS,SAAS,IAAI;AAEtB,UAAI,SAASA,SAAQ,KAAK,SAAS,UAAU,GAAG;AAC9C,eAAO,KAAK,MAAM,YAAYA,WAAU,EAAE,WAAW,CAAC,CAAC;AAAA,MACzD,OAAO;AAEL,eAAO,KAAKA,cAAa,SAAYA,YAAW,UAAU;AAAA,MAC5D;AACA;AAAA,IACF;AAGA,UAAM,WAAW,iBAAiB,CAAC;AACnC,QAAI,aAAa,UAAa,CAAC,SAAS,CAAC,GAAG;AAC1C,eAAS,CAAC,IAAI;AACd,UAAI,SAAS,QAAQ,KAAK,SAAS,UAAU,GAAG;AAC9C,eAAO,KAAK,MAAM,YAAY,UAAU,EAAE,WAAW,CAAC,CAAC;AAAA,MACzD,WAAW,aAAa,QAAW;AACjC,eAAO,KAAK,QAAQ;AAAA,MACtB,OAAO;AACL,eAAO,KAAK,UAAU;AAAA,MACxB;AAAA,IACF,OAAO;AACL,aAAO,KAAK,UAAU;AAAA,IACxB;AAAA,EACF;AAGA,WAAS,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK;AAChD,QAAI,CAAC,SAAS,CAAC,GAAG;AAChB,aAAO,KAAK,iBAAiB,CAAC,CAAC;AAC/B,eAAS,CAAC,IAAI;AAAA,IAChB;AAAA,EACF;AAEA,SAAO;AACT;AAEO,MAAM,oBAAoB,CAAC,iBAA2C;AAE3E,QAAM,sBAAsB,kBAAkB,cAAc,aAAa;AAEzE,MAAI,gBAAuC,oBAAoB,CAAC,EAAE;AAGlE,QAAM,eAAwB;AAAA,IAC5B;AAAA,EACF;AAEA,WAAS,IAAI,GAAG,IAAI,oBAAoB,QAAQ,KAAK;AACnD,UAAM,oBAAoB,oBAAoB,CAAC;AAG/C;AAAA,MACE;AAAA,MACA,kBAAkB;AAAA,MAClB,kBAAkB;AAAA,MAClB,CAAC;AAAA,IACH;AAEA,oBAAgB;AAAA,MACd,kBAAkB;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AAAA,IACL,KAAK,oBAAoB,CAAC,EAAE;AAAA,IAC5B,SAAS;AAAA,IACT,UAAU,aACP,OAAO,CAAC,SAAS,KAAK,OAAO,EAC7B,IAAI,CAAC,SAAS,KAAK,OAAQ;AAAA,EAChC;AACF;","names":["destItem"]}
@@ -1,37 +0,0 @@
1
- import intlayerConfig from "@intlayer/config/built";
2
- const orderDictionaries = (dictionaries, configuration = intlayerConfig) => {
3
- const { editor } = configuration;
4
- const { dictionaryPriorityStrategy } = editor;
5
- if (dictionaries.length <= 1) {
6
- return dictionaries;
7
- }
8
- const withIndex = dictionaries.map((dict, index) => ({ dict, index }));
9
- const getPriority = (d) => {
10
- const p = d.priority ?? 0;
11
- return Number.isFinite(p) ? p : 0;
12
- };
13
- const getLocationWeight = (d) => {
14
- const location = d.location ?? "distant";
15
- if (dictionaryPriorityStrategy === "distant_first") {
16
- return location === "distant" ? 0 : 1;
17
- }
18
- return location === "locale" ? 0 : 1;
19
- };
20
- withIndex.sort((a, b) => {
21
- const aAuto = a.dict.autoFilled ? 1 : 0;
22
- const bAuto = b.dict.autoFilled ? 1 : 0;
23
- if (aAuto !== bAuto) return aAuto - bAuto;
24
- const aP = getPriority(a.dict);
25
- const bP = getPriority(b.dict);
26
- if (aP !== bP) return bP - aP;
27
- const aLoc = getLocationWeight(a.dict);
28
- const bLoc = getLocationWeight(b.dict);
29
- if (aLoc !== bLoc) return aLoc - bLoc;
30
- return a.index - b.index;
31
- });
32
- return withIndex.map(({ dict }) => dict);
33
- };
34
- export {
35
- orderDictionaries
36
- };
37
- //# sourceMappingURL=orderDictionaries.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/orderDictionaries.ts"],"sourcesContent":["import intlayerConfig from '@intlayer/config/built';\nimport type { Dictionary } from '@intlayer/core';\n\n/**\n * Orders dictionaries based on the dictionary priority strategy.\n *\n * @param dictionaries - Array of dictionaries to order\n * @param priorityStrategy - The priority strategy ('local_first' or 'distant_first')\n * @returns Ordered array of dictionaries\n */\nexport const orderDictionaries = (\n dictionaries: Dictionary[],\n configuration = intlayerConfig\n): Dictionary[] => {\n const { editor } = configuration;\n const { dictionaryPriorityStrategy } = editor;\n\n if (dictionaries.length <= 1) {\n return dictionaries;\n }\n\n // Stabilize original indices to preserve relative order for complete ties\n const withIndex = dictionaries.map((dict, index) => ({ dict, index }));\n\n const getPriority = (d: Dictionary): number => {\n const p = d.priority ?? 0;\n\n return Number.isFinite(p) ? p : 0;\n };\n\n const getLocationWeight = (d: Dictionary): number => {\n const location = d.location ?? 'distant';\n\n if (dictionaryPriorityStrategy === 'distant_first') {\n // distant should come first\n return location === 'distant' ? 0 : 1;\n }\n // default: local_first\n return location === 'locale' ? 0 : 1;\n };\n\n withIndex.sort((a, b) => {\n // 1) Non-autoFilled before autoFilled (autoFilled have lower precedence)\n const aAuto = a.dict.autoFilled ? 1 : 0;\n const bAuto = b.dict.autoFilled ? 1 : 0;\n if (aAuto !== bAuto) return aAuto - bAuto; // 0 before 1\n\n // 2) Higher priority first (larger number wins)\n const aP = getPriority(a.dict);\n const bP = getPriority(b.dict);\n if (aP !== bP) return bP - aP; // descending\n\n // 3) Location according to strategy\n const aLoc = getLocationWeight(a.dict);\n const bLoc = getLocationWeight(b.dict);\n if (aLoc !== bLoc) return aLoc - bLoc;\n\n // 4) Stable fallback by original index\n return a.index - b.index;\n });\n\n return withIndex.map(({ dict }) => dict);\n};\n"],"mappings":"AAAA,OAAO,oBAAoB;AAUpB,MAAM,oBAAoB,CAC/B,cACA,gBAAgB,mBACC;AACjB,QAAM,EAAE,OAAO,IAAI;AACnB,QAAM,EAAE,2BAA2B,IAAI;AAEvC,MAAI,aAAa,UAAU,GAAG;AAC5B,WAAO;AAAA,EACT;AAGA,QAAM,YAAY,aAAa,IAAI,CAAC,MAAM,WAAW,EAAE,MAAM,MAAM,EAAE;AAErE,QAAM,cAAc,CAAC,MAA0B;AAC7C,UAAM,IAAI,EAAE,YAAY;AAExB,WAAO,OAAO,SAAS,CAAC,IAAI,IAAI;AAAA,EAClC;AAEA,QAAM,oBAAoB,CAAC,MAA0B;AACnD,UAAM,WAAW,EAAE,YAAY;AAE/B,QAAI,+BAA+B,iBAAiB;AAElD,aAAO,aAAa,YAAY,IAAI;AAAA,IACtC;AAEA,WAAO,aAAa,WAAW,IAAI;AAAA,EACrC;AAEA,YAAU,KAAK,CAAC,GAAG,MAAM;AAEvB,UAAM,QAAQ,EAAE,KAAK,aAAa,IAAI;AACtC,UAAM,QAAQ,EAAE,KAAK,aAAa,IAAI;AACtC,QAAI,UAAU,MAAO,QAAO,QAAQ;AAGpC,UAAM,KAAK,YAAY,EAAE,IAAI;AAC7B,UAAM,KAAK,YAAY,EAAE,IAAI;AAC7B,QAAI,OAAO,GAAI,QAAO,KAAK;AAG3B,UAAM,OAAO,kBAAkB,EAAE,IAAI;AACrC,UAAM,OAAO,kBAAkB,EAAE,IAAI;AACrC,QAAI,SAAS,KAAM,QAAO,OAAO;AAGjC,WAAO,EAAE,QAAQ,EAAE;AAAA,EACrB,CAAC;AAED,SAAO,UAAU,IAAI,CAAC,EAAE,KAAK,MAAM,IAAI;AACzC;","names":[]}
@@ -1,72 +0,0 @@
1
- import { colorizePath, x } from "@intlayer/config";
2
- import {
3
- deepTransformNode,
4
- NodeType
5
- } from "@intlayer/core";
6
- import { existsSync, mkdirSync, writeFileSync } from "fs";
7
- import { join } from "path";
8
- const writeFilePlugin = {
9
- id: "write-file-plugin",
10
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.File,
11
- transform: (node) => {
12
- const fileContent = node.content;
13
- const filePath = node.fixedPath;
14
- if (typeof fileContent !== "string") {
15
- throw new Error("File content must be a string");
16
- }
17
- if (typeof filePath !== "string") {
18
- throw new Error("File path must be a string");
19
- }
20
- try {
21
- const abolsuteFilePath = join(process.cwd(), filePath);
22
- const fileDirectory = join(process.cwd(), filePath);
23
- if (!fileDirectory.startsWith(process.cwd())) {
24
- throw new Error("File directory not found");
25
- }
26
- if (!existsSync(fileDirectory)) {
27
- mkdirSync(fileDirectory, { recursive: true });
28
- }
29
- writeFileSync(abolsuteFilePath, fileContent);
30
- } catch (error) {
31
- throw new Error(
32
- `${x} Error writing file to ${colorizePath(filePath)}: ${error}`
33
- );
34
- }
35
- const transformedFileContent = {
36
- nodeType: NodeType.File,
37
- [NodeType.File]: node.file
38
- };
39
- return transformedFileContent;
40
- }
41
- };
42
- const mardownFilePlugin = {
43
- id: "markdown-file-plugin",
44
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Markdown,
45
- transform: (node, props, deepTransformNode2) => {
46
- const simplifiedMarkdownNode = {
47
- nodeType: NodeType.Markdown,
48
- [NodeType.Markdown]: deepTransformNode2(node.markdown, props)
49
- };
50
- return simplifiedMarkdownNode;
51
- }
52
- };
53
- const insertionFilePlugin = {
54
- id: "insertion-file-plugin",
55
- canHandle: (node) => typeof node === "object" && node?.nodeType === NodeType.Insertion,
56
- transform: (node, props, deepTransformNode2) => {
57
- const simplifiedInsertionNode = {
58
- nodeType: NodeType.Insertion,
59
- [NodeType.Insertion]: deepTransformNode2(node.insertion, props)
60
- };
61
- return simplifiedInsertionNode;
62
- }
63
- };
64
- const prepareContentDeclaration = async (dictionary) => deepTransformNode(dictionary, {
65
- dictionaryKey: dictionary.key,
66
- keyPath: [],
67
- plugins: [writeFilePlugin, mardownFilePlugin, insertionFilePlugin]
68
- });
69
- export {
70
- prepareContentDeclaration
71
- };
72
- //# sourceMappingURL=prepareContentDeclaration.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/prepareContentDeclaration.ts"],"sourcesContent":["import { colorizePath, x } from '@intlayer/config';\nimport {\n deepTransformNode,\n NodeType,\n type Dictionary,\n type FileContent,\n type FileContentConstructor,\n type InsertionContent,\n type InsertionContentConstructor,\n type MarkdownContent,\n type MarkdownContentConstructor,\n type Plugins,\n} from '@intlayer/core';\nimport { existsSync, mkdirSync, writeFileSync } from 'fs';\nimport { join } from 'path';\n\n/**\n * Write file plugin\n */\n\nconst writeFilePlugin: Plugins = {\n id: 'write-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.File,\n transform: (node: FileContent) => {\n const fileContent = node.content;\n const filePath = node.fixedPath;\n\n if (typeof fileContent !== 'string') {\n throw new Error('File content must be a string');\n }\n\n if (typeof filePath !== 'string') {\n throw new Error('File path must be a string');\n }\n\n // Write the file to the file system\n try {\n const abolsuteFilePath = join(process.cwd(), filePath);\n\n // Create the file directory if it doesn't exist\n const fileDirectory = join(process.cwd(), filePath);\n if (!fileDirectory.startsWith(process.cwd())) {\n throw new Error('File directory not found');\n }\n\n if (!existsSync(fileDirectory)) {\n mkdirSync(fileDirectory, { recursive: true });\n }\n\n // Write the file\n writeFileSync(abolsuteFilePath, fileContent);\n } catch (error) {\n throw new Error(\n `${x} Error writing file to ${colorizePath(filePath)}: ${error}`\n );\n }\n\n const transformedFileContent: FileContentConstructor = {\n nodeType: NodeType.File,\n [NodeType.File]: node.file,\n };\n\n return transformedFileContent;\n },\n};\n\n/**\n * Markdown file plugin\n */\n\nconst mardownFilePlugin: Plugins = {\n id: 'markdown-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Markdown,\n transform: (node: MarkdownContent, props, deepTransformNode) => {\n const simplifiedMarkdownNode: MarkdownContentConstructor = {\n nodeType: NodeType.Markdown,\n [NodeType.Markdown]: deepTransformNode(node.markdown, props),\n };\n\n return simplifiedMarkdownNode;\n },\n};\n\n/**\n * Insertion file plugin\n */\n\nconst insertionFilePlugin: Plugins = {\n id: 'insertion-file-plugin',\n canHandle: (node) =>\n typeof node === 'object' && node?.nodeType === NodeType.Insertion,\n transform: (node: InsertionContent, props, deepTransformNode) => {\n const simplifiedInsertionNode: InsertionContentConstructor = {\n nodeType: NodeType.Insertion,\n [NodeType.Insertion]: deepTransformNode(node.insertion, props),\n };\n\n return simplifiedInsertionNode;\n },\n};\n\nexport const prepareContentDeclaration = async (dictionary: Dictionary) =>\n deepTransformNode(dictionary, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [writeFilePlugin, mardownFilePlugin, insertionFilePlugin],\n });\n"],"mappings":"AAAA,SAAS,cAAc,SAAS;AAChC;AAAA,EACE;AAAA,EACA;AAAA,OASK;AACP,SAAS,YAAY,WAAW,qBAAqB;AACrD,SAAS,YAAY;AAMrB,MAAM,kBAA2B;AAAA,EAC/B,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,SAAsB;AAChC,UAAM,cAAc,KAAK;AACzB,UAAM,WAAW,KAAK;AAEtB,QAAI,OAAO,gBAAgB,UAAU;AACnC,YAAM,IAAI,MAAM,+BAA+B;AAAA,IACjD;AAEA,QAAI,OAAO,aAAa,UAAU;AAChC,YAAM,IAAI,MAAM,4BAA4B;AAAA,IAC9C;AAGA,QAAI;AACF,YAAM,mBAAmB,KAAK,QAAQ,IAAI,GAAG,QAAQ;AAGrD,YAAM,gBAAgB,KAAK,QAAQ,IAAI,GAAG,QAAQ;AAClD,UAAI,CAAC,cAAc,WAAW,QAAQ,IAAI,CAAC,GAAG;AAC5C,cAAM,IAAI,MAAM,0BAA0B;AAAA,MAC5C;AAEA,UAAI,CAAC,WAAW,aAAa,GAAG;AAC9B,kBAAU,eAAe,EAAE,WAAW,KAAK,CAAC;AAAA,MAC9C;AAGA,oBAAc,kBAAkB,WAAW;AAAA,IAC7C,SAAS,OAAO;AACd,YAAM,IAAI;AAAA,QACR,GAAG,CAAC,0BAA0B,aAAa,QAAQ,CAAC,KAAK,KAAK;AAAA,MAChE;AAAA,IACF;AAEA,UAAM,yBAAiD;AAAA,MACrD,UAAU,SAAS;AAAA,MACnB,CAAC,SAAS,IAAI,GAAG,KAAK;AAAA,IACxB;AAEA,WAAO;AAAA,EACT;AACF;AAMA,MAAM,oBAA6B;AAAA,EACjC,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,MAAuB,OAAOA,uBAAsB;AAC9D,UAAM,yBAAqD;AAAA,MACzD,UAAU,SAAS;AAAA,MACnB,CAAC,SAAS,QAAQ,GAAGA,mBAAkB,KAAK,UAAU,KAAK;AAAA,IAC7D;AAEA,WAAO;AAAA,EACT;AACF;AAMA,MAAM,sBAA+B;AAAA,EACnC,IAAI;AAAA,EACJ,WAAW,CAAC,SACV,OAAO,SAAS,YAAY,MAAM,aAAa,SAAS;AAAA,EAC1D,WAAW,CAAC,MAAwB,OAAOA,uBAAsB;AAC/D,UAAM,0BAAuD;AAAA,MAC3D,UAAU,SAAS;AAAA,MACnB,CAAC,SAAS,SAAS,GAAGA,mBAAkB,KAAK,WAAW,KAAK;AAAA,IAC/D;AAEA,WAAO;AAAA,EACT;AACF;AAEO,MAAM,4BAA4B,OAAO,eAC9C,kBAAkB,YAAY;AAAA,EAC5B,eAAe,WAAW;AAAA,EAC1B,SAAS,CAAC;AAAA,EACV,SAAS,CAAC,iBAAiB,mBAAmB,mBAAmB;AACnE,CAAC;","names":["deepTransformNode"]}
@@ -1,25 +0,0 @@
1
- import { deepTransformNode, t } from "@intlayer/core";
2
- const processPerLocaleDictionary = (dictionary) => {
3
- const isPerLocaleDictionary = typeof dictionary.locale === "string";
4
- if (!isPerLocaleDictionary) {
5
- return dictionary;
6
- }
7
- const transformStringToTranslationPlugin = {
8
- id: "transform-string-to-translation-plugin",
9
- canHandle: (node) => typeof node === "string" || typeof node === "number",
10
- transform: (node) => t({ [dictionary.locale]: node })
11
- };
12
- return {
13
- ...dictionary,
14
- locale: void 0,
15
- content: deepTransformNode(dictionary.content, {
16
- dictionaryKey: dictionary.key,
17
- keyPath: [],
18
- plugins: [transformStringToTranslationPlugin]
19
- })
20
- };
21
- };
22
- export {
23
- processPerLocaleDictionary
24
- };
25
- //# sourceMappingURL=processPerLocaleDictionary.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/processPerLocaleDictionary.ts"],"sourcesContent":["import { deepTransformNode, Plugins, t, type Dictionary } from '@intlayer/core';\n\n/**\n *\n * Should transform per local dictionaries to multi-local dictionaries\n *\n * Example:\n *\n * ```json5\n * // .intlayer/dictionaries/home.fr.json\n * { 'key': 'home', 'locale': 'fr', 'content': { 'example': \"value\", ... } },\n * ```\n *\n * Result:\n *\n * ```json5\n * // .intlayer/dictionaries/home.json\n * {\n * 'key': 'home',\n * 'content': {\n * 'example': {\n * 'nodeType': 'translation',\n * 'translation': {\n * 'fr': 'valeur',\n * }\n * }, ... } },\n * ```\n *\n * @param dictionary\n * @returns\n */\nexport const processPerLocaleDictionary = (dictionary: Dictionary) => {\n const isPerLocaleDictionary = typeof dictionary.locale === 'string';\n\n if (!isPerLocaleDictionary) {\n return dictionary;\n }\n\n const transformStringToTranslationPlugin: Plugins = {\n id: 'transform-string-to-translation-plugin',\n canHandle: (node) => typeof node === 'string' || typeof node === 'number',\n transform: (node: string | number) =>\n t({ [dictionary.locale as string]: node }),\n };\n\n return {\n ...dictionary,\n locale: undefined,\n content: deepTransformNode(dictionary.content, {\n dictionaryKey: dictionary.key,\n keyPath: [],\n plugins: [transformStringToTranslationPlugin],\n }),\n };\n};\n"],"mappings":"AAAA,SAAS,mBAA4B,SAA0B;AA+BxD,MAAM,6BAA6B,CAAC,eAA2B;AACpE,QAAM,wBAAwB,OAAO,WAAW,WAAW;AAE3D,MAAI,CAAC,uBAAuB;AAC1B,WAAO;AAAA,EACT;AAEA,QAAM,qCAA8C;AAAA,IAClD,IAAI;AAAA,IACJ,WAAW,CAAC,SAAS,OAAO,SAAS,YAAY,OAAO,SAAS;AAAA,IACjE,WAAW,CAAC,SACV,EAAE,EAAE,CAAC,WAAW,MAAgB,GAAG,KAAK,CAAC;AAAA,EAC7C;AAEA,SAAO;AAAA,IACL,GAAG;AAAA,IACH,QAAQ;AAAA,IACR,SAAS,kBAAkB,WAAW,SAAS;AAAA,MAC7C,eAAe,WAAW;AAAA,MAC1B,SAAS,CAAC;AAAA,MACV,SAAS,CAAC,kCAAkC;AAAA,IAC9C,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -1,13 +0,0 @@
1
- import { getConfiguration } from "@intlayer/config";
2
- const getExtension = (configuration = getConfiguration(), format) => {
3
- const outputFormats = configuration.build.outputFormat;
4
- if (format === "esm") return "mjs";
5
- if (format === "cjs") return "cjs";
6
- if (outputFormats.includes("esm")) return "mjs";
7
- if (outputFormats.includes("cjs")) return "cjs";
8
- return "mjs";
9
- };
10
- export {
11
- getExtension
12
- };
13
- //# sourceMappingURL=getExtention.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/utils/getExtention.ts"],"sourcesContent":["import { type IntlayerConfig, getConfiguration } from '@intlayer/config';\n\nexport const getExtension = (\n configuration: IntlayerConfig = getConfiguration(),\n format?: 'esm' | 'cjs' | undefined\n) => {\n const outputFormats = configuration.build.outputFormat;\n\n if (format === 'esm') return 'mjs';\n if (format === 'cjs') return 'cjs';\n\n if (outputFormats.includes('esm')) return 'mjs';\n if (outputFormats.includes('cjs')) return 'cjs';\n\n return 'mjs';\n};\n"],"mappings":"AAAA,SAA8B,wBAAwB;AAE/C,MAAM,eAAe,CAC1B,gBAAgC,iBAAiB,GACjD,WACG;AACH,QAAM,gBAAgB,cAAc,MAAM;AAE1C,MAAI,WAAW,MAAO,QAAO;AAC7B,MAAI,WAAW,MAAO,QAAO;AAE7B,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAC1C,MAAI,cAAc,SAAS,KAAK,EAAG,QAAO;AAE1C,SAAO;AACT;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}