@intlayer/chokidar 8.4.4 → 8.4.6

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 (497) hide show
  1. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  2. package/dist/cjs/_virtual/_utils_asset.cjs +98 -0
  3. package/dist/cjs/build.cjs +58 -1
  4. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +62 -1
  5. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/index.cjs +6 -1
  7. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +26 -1
  8. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +107 -5
  10. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  11. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +80 -3
  12. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  13. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +46 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  15. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +50 -1
  16. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  17. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +59 -1
  18. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  19. package/dist/cjs/cleanOutputDir.cjs +30 -1
  20. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  21. package/dist/cjs/cleanRemovedContentDeclaration.cjs +97 -1
  22. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  23. package/dist/cjs/cli.cjs +35 -1
  24. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +70 -1
  25. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +42 -7
  27. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  28. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +23 -1
  29. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  30. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +24 -1
  31. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  32. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +24 -1
  33. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  34. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +23 -1
  35. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  36. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +23 -1
  37. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  38. package/dist/cjs/createDictionaryEntryPoint/index.cjs +16 -1
  39. package/dist/cjs/createType/createModuleAugmentation.cjs +112 -9
  40. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  41. package/dist/cjs/createType/createType.cjs +29 -1
  42. package/dist/cjs/createType/createType.cjs.map +1 -1
  43. package/dist/cjs/createType/index.cjs +8 -1
  44. package/dist/cjs/detectFormatCommand.cjs +32 -1
  45. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  46. package/dist/cjs/fetchDistantDictionaries.cjs +51 -1
  47. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  48. package/dist/cjs/filterInvalidDictionaries.cjs +52 -1
  49. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  50. package/dist/cjs/formatDictionary.cjs +49 -1
  51. package/dist/cjs/formatDictionary.cjs.map +1 -1
  52. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +61 -7
  53. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  54. package/dist/cjs/getContentDeclarationFileTemplate/index.cjs +4 -1
  55. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +34 -1
  56. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  57. package/dist/cjs/handleContentDeclarationFileChange.cjs +49 -1
  58. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  59. package/dist/cjs/handleContentDeclarationFileMoved.cjs +24 -1
  60. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  61. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +37 -1
  62. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  63. package/dist/cjs/init/index.cjs +284 -1
  64. package/dist/cjs/init/index.cjs.map +1 -1
  65. package/dist/cjs/init/utils/configManipulation.cjs +111 -1
  66. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  67. package/dist/cjs/init/utils/fileSystem.cjs +39 -1
  68. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  69. package/dist/cjs/init/utils/index.cjs +14 -1
  70. package/dist/cjs/init/utils/jsonParser.cjs +42 -3
  71. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
  72. package/dist/cjs/init/utils/tsConfig.cjs +18 -1
  73. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  74. package/dist/cjs/initConfig/index.cjs +39 -1
  75. package/dist/cjs/initConfig/index.cjs.map +1 -1
  76. package/dist/cjs/installMCP/installMCP.cjs +50 -1
  77. package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
  78. package/dist/cjs/installSkills/index.cjs +303 -1
  79. package/dist/cjs/installSkills/index.cjs.map +1 -1
  80. package/dist/cjs/listDictionariesPath.cjs +42 -1
  81. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  82. package/dist/cjs/listGitFiles.cjs +105 -5
  83. package/dist/cjs/listGitFiles.cjs.map +1 -1
  84. package/dist/cjs/listProjects.cjs +47 -1
  85. package/dist/cjs/listProjects.cjs.map +1 -1
  86. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +68 -1
  87. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  88. package/dist/cjs/loadDictionaries/index.cjs +14 -1
  89. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +93 -2
  90. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  91. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +127 -1
  92. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  93. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +27 -1
  94. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  95. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +61 -1
  96. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  97. package/dist/cjs/loadDictionaries/log.cjs +138 -3
  98. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  99. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +63 -2
  100. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  101. package/dist/cjs/logConfigDetails.cjs +39 -2
  102. package/dist/cjs/logConfigDetails.cjs.map +1 -1
  103. package/dist/cjs/prepareIntlayer.cjs +103 -1
  104. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  105. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +30 -1
  106. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  107. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +12 -1
  108. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  109. package/dist/cjs/utils/autoDecorateContent.cjs +89 -1
  110. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  111. package/dist/cjs/utils/buildComponentFilesList.cjs +67 -1
  112. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
  113. package/dist/cjs/utils/buildFilesList.cjs +83 -1
  114. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  115. package/dist/cjs/utils/chunkJSON.cjs +336 -1
  116. package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
  117. package/dist/cjs/utils/formatter.cjs +18 -1
  118. package/dist/cjs/utils/formatter.cjs.map +1 -1
  119. package/dist/cjs/utils/getChunk.cjs +34 -1
  120. package/dist/cjs/utils/getChunk.cjs.map +1 -1
  121. package/dist/cjs/utils/getContentExtension.cjs +29 -1
  122. package/dist/cjs/utils/getContentExtension.cjs.map +1 -1
  123. package/dist/cjs/utils/getFormatFromExtension.cjs +34 -1
  124. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  125. package/dist/cjs/utils/getPathHash.cjs +10 -1
  126. package/dist/cjs/utils/getPathHash.cjs.map +1 -1
  127. package/dist/cjs/utils/index.cjs +49 -1
  128. package/dist/cjs/utils/mergeChunks.cjs +28 -1
  129. package/dist/cjs/utils/mergeChunks.cjs.map +1 -1
  130. package/dist/cjs/utils/pLimit.cjs +128 -1
  131. package/dist/cjs/utils/pLimit.cjs.map +1 -1
  132. package/dist/cjs/utils/parallelize.cjs +11 -1
  133. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  134. package/dist/cjs/utils/parallelizeGlobal.cjs +29 -1
  135. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
  136. package/dist/cjs/utils/reduceObjectFormat.cjs +31 -1
  137. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
  138. package/dist/cjs/utils/resolveObjectPromises.cjs +21 -1
  139. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  140. package/dist/cjs/utils/resolveRelativePath.cjs +21 -1
  141. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  142. package/dist/cjs/utils/runOnce.cjs +95 -1
  143. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  144. package/dist/cjs/utils/runParallel/bin.cjs +54 -1
  145. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  146. package/dist/cjs/utils/runParallel/bootstrap.cjs +24 -1
  147. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
  148. package/dist/cjs/utils/runParallel/index.cjs +115 -1
  149. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  150. package/dist/cjs/utils/runParallel/pidTree.cjs +145 -1
  151. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
  152. package/dist/cjs/utils/runParallel/ps.cjs +49 -1
  153. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
  154. package/dist/cjs/utils/runParallel/runTask.cjs +154 -1
  155. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  156. package/dist/cjs/utils/runParallel/spawnPosix.cjs +59 -1
  157. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  158. package/dist/cjs/utils/runParallel/spawnWin32.cjs +43 -1
  159. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  160. package/dist/cjs/utils/runParallel/wmic.cjs +52 -1
  161. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
  162. package/dist/cjs/utils/sortAlphabetically.cjs +7 -1
  163. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  164. package/dist/cjs/utils/splitTextByLine.cjs +11 -1
  165. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
  166. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +60 -1
  167. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
  168. package/dist/cjs/watcher.cjs +120 -1
  169. package/dist/cjs/watcher.cjs.map +1 -1
  170. package/dist/cjs/writeConfiguration/index.cjs +42 -1
  171. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  172. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +28 -1
  173. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  174. package/dist/cjs/writeContentDeclaration/index.cjs +10 -1
  175. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +94 -1
  176. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  177. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +412 -3
  178. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  179. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +127 -2
  180. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  181. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +148 -1
  182. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  183. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +92 -1
  184. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  185. package/dist/cjs/writeFileIfChanged.cjs +50 -1
  186. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  187. package/dist/cjs/writeJsonIfChanged.cjs +17 -1
  188. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  189. package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
  190. package/dist/esm/_virtual/_utils_asset.mjs +97 -0
  191. package/dist/esm/build.mjs +25 -1
  192. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +60 -1
  193. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
  194. package/dist/esm/buildIntlayerDictionary/index.mjs +4 -1
  195. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +24 -1
  196. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  197. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +102 -5
  198. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  199. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +76 -3
  200. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
  201. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +44 -1
  202. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  203. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +48 -1
  204. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  205. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +56 -1
  206. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  207. package/dist/esm/cleanOutputDir.mjs +28 -1
  208. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  209. package/dist/esm/cleanRemovedContentDeclaration.mjs +94 -1
  210. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
  211. package/dist/esm/cli.mjs +15 -1
  212. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +68 -1
  213. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  214. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +40 -7
  215. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  216. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +20 -1
  217. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
  218. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +21 -1
  219. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
  220. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +21 -1
  221. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
  222. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +20 -1
  223. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
  224. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +20 -1
  225. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
  226. package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -1
  227. package/dist/esm/createType/createModuleAugmentation.mjs +108 -9
  228. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  229. package/dist/esm/createType/createType.mjs +26 -1
  230. package/dist/esm/createType/createType.mjs.map +1 -1
  231. package/dist/esm/createType/index.mjs +4 -1
  232. package/dist/esm/detectFormatCommand.mjs +30 -1
  233. package/dist/esm/detectFormatCommand.mjs.map +1 -1
  234. package/dist/esm/fetchDistantDictionaries.mjs +49 -1
  235. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  236. package/dist/esm/filterInvalidDictionaries.mjs +48 -1
  237. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  238. package/dist/esm/formatDictionary.mjs +44 -1
  239. package/dist/esm/formatDictionary.mjs.map +1 -1
  240. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +59 -7
  241. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
  242. package/dist/esm/getContentDeclarationFileTemplate/index.mjs +3 -1
  243. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +32 -1
  244. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  245. package/dist/esm/handleContentDeclarationFileChange.mjs +47 -1
  246. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  247. package/dist/esm/handleContentDeclarationFileMoved.mjs +22 -1
  248. package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
  249. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +35 -1
  250. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
  251. package/dist/esm/init/index.mjs +281 -1
  252. package/dist/esm/init/index.mjs.map +1 -1
  253. package/dist/esm/init/utils/configManipulation.mjs +108 -1
  254. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  255. package/dist/esm/init/utils/fileSystem.mjs +34 -1
  256. package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
  257. package/dist/esm/init/utils/index.mjs +6 -1
  258. package/dist/esm/init/utils/jsonParser.mjs +40 -3
  259. package/dist/esm/init/utils/jsonParser.mjs.map +1 -1
  260. package/dist/esm/init/utils/tsConfig.mjs +16 -1
  261. package/dist/esm/init/utils/tsConfig.mjs.map +1 -1
  262. package/dist/esm/initConfig/index.mjs +37 -1
  263. package/dist/esm/initConfig/index.mjs.map +1 -1
  264. package/dist/esm/installMCP/installMCP.mjs +46 -1
  265. package/dist/esm/installMCP/installMCP.mjs.map +1 -1
  266. package/dist/esm/installSkills/index.mjs +295 -1
  267. package/dist/esm/installSkills/index.mjs.map +1 -1
  268. package/dist/esm/listDictionariesPath.mjs +38 -1
  269. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  270. package/dist/esm/listGitFiles.mjs +100 -5
  271. package/dist/esm/listGitFiles.mjs.map +1 -1
  272. package/dist/esm/listProjects.mjs +43 -1
  273. package/dist/esm/listProjects.mjs.map +1 -1
  274. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +67 -1
  275. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  276. package/dist/esm/loadDictionaries/index.mjs +6 -1
  277. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +88 -2
  278. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  279. package/dist/esm/loadDictionaries/loadDictionaries.mjs +124 -1
  280. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  281. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +25 -1
  282. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  283. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +58 -1
  284. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  285. package/dist/esm/loadDictionaries/log.mjs +134 -3
  286. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  287. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +61 -2
  288. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  289. package/dist/esm/logConfigDetails.mjs +36 -2
  290. package/dist/esm/logConfigDetails.mjs.map +1 -1
  291. package/dist/esm/prepareIntlayer.mjs +99 -1
  292. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  293. package/dist/esm/reduceDictionaryContent/applyMask.mjs +28 -1
  294. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
  295. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +10 -1
  296. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  297. package/dist/esm/utils/autoDecorateContent.mjs +86 -1
  298. package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
  299. package/dist/esm/utils/buildComponentFilesList.mjs +64 -1
  300. package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -1
  301. package/dist/esm/utils/buildFilesList.mjs +79 -1
  302. package/dist/esm/utils/buildFilesList.mjs.map +1 -1
  303. package/dist/esm/utils/chunkJSON.mjs +333 -1
  304. package/dist/esm/utils/chunkJSON.mjs.map +1 -1
  305. package/dist/esm/utils/formatter.mjs +13 -1
  306. package/dist/esm/utils/formatter.mjs.map +1 -1
  307. package/dist/esm/utils/getChunk.mjs +33 -1
  308. package/dist/esm/utils/getChunk.mjs.map +1 -1
  309. package/dist/esm/utils/getContentExtension.mjs +27 -1
  310. package/dist/esm/utils/getContentExtension.mjs.map +1 -1
  311. package/dist/esm/utils/getFormatFromExtension.mjs +31 -1
  312. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
  313. package/dist/esm/utils/getPathHash.mjs +7 -1
  314. package/dist/esm/utils/getPathHash.mjs.map +1 -1
  315. package/dist/esm/utils/index.mjs +22 -1
  316. package/dist/esm/utils/mergeChunks.mjs +26 -1
  317. package/dist/esm/utils/mergeChunks.mjs.map +1 -1
  318. package/dist/esm/utils/pLimit.mjs +125 -1
  319. package/dist/esm/utils/pLimit.mjs.map +1 -1
  320. package/dist/esm/utils/parallelize.mjs +10 -1
  321. package/dist/esm/utils/parallelize.mjs.map +1 -1
  322. package/dist/esm/utils/parallelizeGlobal.mjs +26 -1
  323. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -1
  324. package/dist/esm/utils/reduceObjectFormat.mjs +29 -1
  325. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -1
  326. package/dist/esm/utils/resolveObjectPromises.mjs +19 -1
  327. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
  328. package/dist/esm/utils/resolveRelativePath.mjs +19 -1
  329. package/dist/esm/utils/resolveRelativePath.mjs.map +1 -1
  330. package/dist/esm/utils/runOnce.mjs +92 -1
  331. package/dist/esm/utils/runOnce.mjs.map +1 -1
  332. package/dist/esm/utils/runParallel/bin.mjs +52 -1
  333. package/dist/esm/utils/runParallel/bin.mjs.map +1 -1
  334. package/dist/esm/utils/runParallel/bootstrap.mjs +22 -1
  335. package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -1
  336. package/dist/esm/utils/runParallel/index.mjs +113 -1
  337. package/dist/esm/utils/runParallel/index.mjs.map +1 -1
  338. package/dist/esm/utils/runParallel/pidTree.mjs +142 -1
  339. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
  340. package/dist/esm/utils/runParallel/ps.mjs +46 -1
  341. package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
  342. package/dist/esm/utils/runParallel/runTask.mjs +152 -1
  343. package/dist/esm/utils/runParallel/runTask.mjs.map +1 -1
  344. package/dist/esm/utils/runParallel/spawnPosix.mjs +57 -1
  345. package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -1
  346. package/dist/esm/utils/runParallel/spawnWin32.mjs +41 -1
  347. package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -1
  348. package/dist/esm/utils/runParallel/wmic.mjs +49 -1
  349. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
  350. package/dist/esm/utils/sortAlphabetically.mjs +5 -1
  351. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
  352. package/dist/esm/utils/splitTextByLine.mjs +9 -1
  353. package/dist/esm/utils/splitTextByLine.mjs.map +1 -1
  354. package/dist/esm/utils/verifyIdenticObjectFormat.mjs +58 -1
  355. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -1
  356. package/dist/esm/watcher.mjs +117 -1
  357. package/dist/esm/watcher.mjs.map +1 -1
  358. package/dist/esm/writeConfiguration/index.mjs +39 -1
  359. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  360. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +26 -1
  361. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
  362. package/dist/esm/writeContentDeclaration/index.mjs +6 -1
  363. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +91 -1
  364. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
  365. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +407 -3
  366. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  367. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +124 -2
  368. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
  369. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +146 -1
  370. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  371. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +90 -1
  372. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  373. package/dist/esm/writeFileIfChanged.mjs +48 -1
  374. package/dist/esm/writeFileIfChanged.mjs.map +1 -1
  375. package/dist/esm/writeJsonIfChanged.mjs +16 -1
  376. package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
  377. package/dist/types/build.d.ts +20 -20
  378. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +25 -2
  379. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -0
  380. package/dist/types/buildIntlayerDictionary/index.d.ts +2 -2
  381. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +11 -2
  382. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -0
  383. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +49 -2
  384. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -0
  385. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +1 -1
  386. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  387. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +30 -2
  388. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -0
  389. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +34 -2
  390. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -0
  391. package/dist/types/cli.d.ts +6 -6
  392. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +14 -2
  393. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -0
  394. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +10 -2
  395. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -0
  396. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +10 -2
  397. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -0
  398. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +10 -2
  399. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
  400. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +10 -2
  401. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -0
  402. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +10 -2
  403. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
  404. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +10 -2
  405. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
  406. package/dist/types/createDictionaryEntryPoint/index.d.ts +7 -7
  407. package/dist/types/createType/createModuleAugmentation.d.ts +9 -2
  408. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -0
  409. package/dist/types/createType/createType.d.ts +12 -2
  410. package/dist/types/createType/createType.d.ts.map +1 -0
  411. package/dist/types/createType/index.d.ts +2 -2
  412. package/dist/types/fetchDistantDictionaries.d.ts +1 -1
  413. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  414. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +7 -2
  415. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -0
  416. package/dist/types/getContentDeclarationFileTemplate/index.d.ts +1 -1
  417. package/dist/types/loadDictionaries/index.d.ts +4 -4
  418. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +12 -2
  419. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -0
  420. package/dist/types/loadDictionaries/loadDictionaries.d.ts +23 -2
  421. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -0
  422. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +8 -2
  423. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -0
  424. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +15 -2
  425. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
  426. package/dist/types/loadDictionaries/log.d.ts +1 -1
  427. package/dist/types/utils/getFormatFromExtension.d.ts +8 -2
  428. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -0
  429. package/dist/types/utils/index.d.ts +1 -1
  430. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  431. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +12 -2
  432. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -0
  433. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +5 -2
  434. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -0
  435. package/dist/types/writeContentDeclaration/index.d.ts +5 -5
  436. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
  437. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +11 -2
  438. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -0
  439. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +19 -2
  440. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -0
  441. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +14 -2
  442. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -0
  443. package/package.json +8 -8
  444. package/dist/cjs/_utils_asset-SJVy1xMD.cjs +0 -2
  445. package/dist/cjs/chunk-Bmb41Sf3.cjs +0 -1
  446. package/dist/esm/_utils_asset-4w8dPH9r.mjs +0 -2
  447. package/dist/esm/chunk-DDgYwkfe.mjs +0 -1
  448. package/dist/types/buildIntlayerDictionary-C-LWgPIL.d.ts +0 -25
  449. package/dist/types/buildIntlayerDictionary-C-LWgPIL.d.ts.map +0 -1
  450. package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts +0 -14
  451. package/dist/types/createDictionaryEntryPoint-Bc5lHSiY.d.ts.map +0 -1
  452. package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts +0 -9
  453. package/dist/types/createModuleAugmentation-D1eIVnjg.d.ts.map +0 -1
  454. package/dist/types/createType--rDwdg2t.d.ts +0 -12
  455. package/dist/types/createType--rDwdg2t.d.ts.map +0 -1
  456. package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts +0 -12
  457. package/dist/types/detectExportedComponentName-DVXsp_FG.d.ts.map +0 -1
  458. package/dist/types/dictionaryStatus-DPVO37qe.d.ts +0 -5
  459. package/dist/types/dictionaryStatus-DPVO37qe.d.ts.map +0 -1
  460. package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts +0 -10
  461. package/dist/types/generateDictionaryListContent-DAtHG6SR.d.ts.map +0 -1
  462. package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts +0 -10
  463. package/dist/types/getBuiltDictionariesPath-C4it65a1.d.ts.map +0 -1
  464. package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts +0 -10
  465. package/dist/types/getBuiltDynamicDictionariesPath-Cj9EWnjT.d.ts.map +0 -1
  466. package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts +0 -10
  467. package/dist/types/getBuiltFetchDictionariesPath-1JleRhT3.d.ts.map +0 -1
  468. package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts +0 -10
  469. package/dist/types/getBuiltRemoteDictionariesPath-DHOmqNCr.d.ts.map +0 -1
  470. package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts +0 -10
  471. package/dist/types/getBuiltUnmergedDictionariesPath-GUmmLxTB.d.ts.map +0 -1
  472. package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts +0 -7
  473. package/dist/types/getContentDeclarationFileTemplate-Dz3rnFy9.d.ts.map +0 -1
  474. package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts +0 -8
  475. package/dist/types/getFormatFromExtension-SdXYWfPx.d.ts.map +0 -1
  476. package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts +0 -12
  477. package/dist/types/loadContentDeclaration-CBMS4vkA.d.ts.map +0 -1
  478. package/dist/types/loadDictionaries-BIqHwtYE.d.ts +0 -23
  479. package/dist/types/loadDictionaries-BIqHwtYE.d.ts.map +0 -1
  480. package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts +0 -8
  481. package/dist/types/loadLocalDictionaries-CNmVaw0c.d.ts.map +0 -1
  482. package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts +0 -15
  483. package/dist/types/loadRemoteDictionaries-MoITTb7W.d.ts.map +0 -1
  484. package/dist/types/processContentDeclaration-CAvrHaIT.d.ts +0 -11
  485. package/dist/types/processContentDeclaration-CAvrHaIT.d.ts.map +0 -1
  486. package/dist/types/transformJSFile-Cg0LkeLb.d.ts +0 -11
  487. package/dist/types/transformJSFile-Cg0LkeLb.d.ts.map +0 -1
  488. package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts +0 -19
  489. package/dist/types/writeContentDeclaration-XdGxj0KP.d.ts.map +0 -1
  490. package/dist/types/writeDynamicDictionary-BE0mF2zZ.d.ts +0 -49
  491. package/dist/types/writeDynamicDictionary-BE0mF2zZ.d.ts.map +0 -1
  492. package/dist/types/writeJSFile-kK95jzg_.d.ts +0 -14
  493. package/dist/types/writeJSFile-kK95jzg_.d.ts.map +0 -1
  494. package/dist/types/writeMergedDictionary-CMeghcRI.d.ts +0 -30
  495. package/dist/types/writeMergedDictionary-CMeghcRI.d.ts.map +0 -1
  496. package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts +0 -34
  497. package/dist/types/writeUnmergedDictionary-Cxx51isz.d.ts.map +0 -1
@@ -1,2 +1,50 @@
1
- import{parallelize as e}from"./utils/parallelize.mjs";import{getAppLogger as t,x as n}from"@intlayer/config/logger";import{getConfiguration as r}from"@intlayer/config/node";import{getIntlayerAPIProxy as i}from"@intlayer/api";const a=async(a,o)=>{let s=r(),c=t(s);try{let t=i(void 0,s),n=a.dictionaryKeys,r=async e=>{o?.([{dictionaryKey:e,type:`remote`,status:`fetching`}]);try{let n=(await t.dictionary.getDictionary(e)).data;if(!n)throw Error(`Dictionary ${e} not found on remote`);return o?.([{dictionaryKey:e,type:`remote`,status:`fetched`}]),n}catch(t){o?.([{dictionaryKey:e,type:`remote`,status:`error`,error:`Error fetching dictionary ${e}: ${t}`}]);return}};return(await e(n,async e=>await r(e))).filter(e=>e!==void 0)}catch{return c(`${n} Failed to fetch distant dictionaries`,{level:`error`}),[]}};export{a as fetchDistantDictionaries};
1
+ import { parallelize } from "./utils/parallelize.mjs";
2
+ import { getAppLogger, x } from "@intlayer/config/logger";
3
+ import { getConfiguration } from "@intlayer/config/node";
4
+ import { getIntlayerAPIProxy } from "@intlayer/api";
5
+
6
+ //#region src/fetchDistantDictionaries.ts
7
+ /**
8
+ * Fetch distant dictionaries and update the logger with their statuses.
9
+ */
10
+ const fetchDistantDictionaries = async (options, onStatusUpdate) => {
11
+ const config = getConfiguration();
12
+ const appLogger = getAppLogger(config);
13
+ try {
14
+ const intlayerAPI = getIntlayerAPIProxy(void 0, config);
15
+ const distantDictionariesKeys = options.dictionaryKeys;
16
+ const processDictionary = async (dictionaryKey) => {
17
+ onStatusUpdate?.([{
18
+ dictionaryKey,
19
+ type: "remote",
20
+ status: "fetching"
21
+ }]);
22
+ try {
23
+ const distantDictionary = (await intlayerAPI.dictionary.getDictionary(dictionaryKey)).data;
24
+ if (!distantDictionary) throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
25
+ onStatusUpdate?.([{
26
+ dictionaryKey,
27
+ type: "remote",
28
+ status: "fetched"
29
+ }]);
30
+ return distantDictionary;
31
+ } catch (error) {
32
+ onStatusUpdate?.([{
33
+ dictionaryKey,
34
+ type: "remote",
35
+ status: "error",
36
+ error: `Error fetching dictionary ${dictionaryKey}: ${error}`
37
+ }]);
38
+ return;
39
+ }
40
+ };
41
+ return (await parallelize(distantDictionariesKeys, async (dictionaryKey) => await processDictionary(dictionaryKey))).filter((dict) => dict !== void 0);
42
+ } catch (_error) {
43
+ appLogger(`${x} Failed to fetch distant dictionaries`, { level: "error" });
44
+ return [];
45
+ }
46
+ };
47
+
48
+ //#endregion
49
+ export { fetchDistantDictionaries };
2
50
  //# sourceMappingURL=fetchDistantDictionaries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.mjs","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":"iOAiBA,MAAa,EAA2B,MACtC,EACA,IAC6B,CAC7B,IAAM,EAAS,GAAkB,CAC3B,EAAY,EAAa,EAAO,CACtC,GAAI,CACF,IAAM,EAAc,EAAoB,IAAA,GAAW,EAAO,CAEpD,EAA0B,EAAQ,eAElC,EAAoB,KACxB,IACuC,CACvC,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,WACT,CACF,CAAC,CAEF,GAAI,CAKF,IAAM,GAFJ,MAAM,EAAY,WAAW,cAAc,EAAc,EAEb,KAE9C,GAAI,CAAC,EACH,MAAU,MAAM,cAAc,EAAc,sBAAsB,CAOpE,OAJA,IAAiB,CACf,CAAE,gBAAe,KAAM,SAAU,OAAQ,UAAW,CACrD,CAAC,CAEK,QACA,EAAO,CACd,IAAiB,CACf,CACE,gBACA,KAAM,SACN,OAAQ,QACR,MAAO,6BAA6B,EAAc,IAAI,IACvD,CACF,CAAC,CACF,SAeJ,OAXe,MAAM,EACnB,EACA,KAAO,IAAkB,MAAM,EAAkB,EAAc,CAChE,EAG6B,OAC3B,GACC,IAAS,IAAA,GACZ,MAGc,CAEf,OADA,EAAU,GAAG,EAAE,uCAAwC,CAAE,MAAO,QAAS,CAAC,CACnE,EAAE"}
1
+ {"version":3,"file":"fetchDistantDictionaries.mjs","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,2BAA2B,OACtC,SACA,mBAC6B;CAC7B,MAAM,SAAS,kBAAkB;CACjC,MAAM,YAAY,aAAa,OAAO;AACtC,KAAI;EACF,MAAM,cAAc,oBAAoB,QAAW,OAAO;EAE1D,MAAM,0BAA0B,QAAQ;EAExC,MAAM,oBAAoB,OACxB,kBACuC;AACvC,oBAAiB,CACf;IACE;IACA,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,OAAI;IAKF,MAAM,qBAFJ,MAAM,YAAY,WAAW,cAAc,cAAc,EAEb;AAE9C,QAAI,CAAC,kBACH,OAAM,IAAI,MAAM,cAAc,cAAc,sBAAsB;AAGpE,qBAAiB,CACf;KAAE;KAAe,MAAM;KAAU,QAAQ;KAAW,CACrD,CAAC;AAEF,WAAO;YACA,OAAO;AACd,qBAAiB,CACf;KACE;KACA,MAAM;KACN,QAAQ;KACR,OAAO,6BAA6B,cAAc,IAAI;KACvD,CACF,CAAC;AACF;;;AAeJ,UAXe,MAAM,YACnB,yBACA,OAAO,kBAAkB,MAAM,kBAAkB,cAAc,CAChE,EAG6B,QAC3B,SACC,SAAS,OACZ;UAGM,QAAQ;AACf,YAAU,GAAG,EAAE,wCAAwC,EAAE,OAAO,SAAS,CAAC;AAC1E,SAAO,EAAE"}
@@ -1,2 +1,49 @@
1
- import{formatLocale as e,formatPath as t}from"./utils/formatter.mjs";import{colorize as n,colorizeKey as r,colorizePath as i,getAppLogger as a,x as o}from"@intlayer/config/logger";import*as s from"@intlayer/config/colors";import{getBasePlugins as c,getContent as l}from"@intlayer/core/interpreter";const u=(u,d,f)=>{let p=a(d);if(!u)return!1;let m=u.location===`local`||typeof u.filePath==`string`?`Local`:`Remote`,h=!!u.key,g=!!u.content;if(!h)return p(`${m} dictionary has no key`,{level:`error`}),!1;if(!g)return p(`${m} dictionary ${r(u.key)} has no content - ${u.filePath?t(u.filePath):i(`Remote`)}`,{level:`error`}),!1;if(u.schema&&f?.checkSchema&&!(typeof u.content==`function`||typeof u.content==`object`&&u.content!==null&&typeof u.content.then==`function`)){let a=d?.internationalization?.locales??[],f=d?.internationalization.strictMode===`strict`,h=typeof u.schema==`string`?d?.schemas?.[u.schema]:void 0;if(h&&typeof h.safeParse==`function`)for(let d of a){let a=l(u.content,{dictionaryKey:u.key,keyPath:[],locale:d},c(d,!f)),g=h.safeParse(a);if(!g.success)return p(`${m} dictionary ${r(u.key)} has invalid content according to schema ${n(u.schema,s.ORANGE)} for locale ${e(d)} - ${u.filePath?t(u.filePath):i(`Remote`)}`,{level:`error`}),g.error.issues.forEach(t=>{p(`${o} Error: ${r(u.key)} - ${e(d)} - ${n(`${t.path.join(`.`)}:`,s.BLUE)} ${n(t.message,s.GREY)}`,{level:`error`})}),!1}}return!0},d=(e,t,n)=>(e??[])?.filter(e=>u(e,t,n));export{d as filterInvalidDictionaries,u as isInvalidDictionary};
1
+ import { formatLocale, formatPath } from "./utils/formatter.mjs";
2
+ import { colorize, colorizeKey, colorizePath, getAppLogger, x } from "@intlayer/config/logger";
3
+ import * as ANSIColors from "@intlayer/config/colors";
4
+ import { getBasePlugins, getContent } from "@intlayer/core/interpreter";
5
+
6
+ //#region src/filterInvalidDictionaries.ts
7
+ const isInvalidDictionary = (dictionary, configuration, options) => {
8
+ const appLogger = getAppLogger(configuration);
9
+ if (!dictionary) return false;
10
+ const location = Boolean(dictionary.location === "local" || typeof dictionary.filePath === "string") ? "Local" : "Remote";
11
+ const hasKey = Boolean(dictionary.key);
12
+ const hasContent = Boolean(dictionary.content);
13
+ if (!hasKey) {
14
+ appLogger(`${location} dictionary has no key`, { level: "error" });
15
+ return false;
16
+ }
17
+ if (!hasContent) {
18
+ appLogger(`${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath("Remote")}`, { level: "error" });
19
+ return false;
20
+ }
21
+ if (dictionary.schema && options?.checkSchema) {
22
+ if (!(typeof dictionary.content === "function" || typeof dictionary.content === "object" && dictionary.content !== null && typeof dictionary.content.then === "function")) {
23
+ const locales = configuration?.internationalization?.locales ?? [];
24
+ const isStrict = configuration?.internationalization.strictMode === "strict";
25
+ const schema = typeof dictionary.schema === "string" ? configuration?.schemas?.[dictionary.schema] : void 0;
26
+ if (schema && typeof schema.safeParse === "function") for (const locale of locales) {
27
+ const resolvedContent = getContent(dictionary.content, {
28
+ dictionaryKey: dictionary.key,
29
+ keyPath: [],
30
+ locale
31
+ }, getBasePlugins(locale, !isStrict));
32
+ const result = schema.safeParse(resolvedContent);
33
+ if (!result.success) {
34
+ appLogger(`${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath("Remote")}`, { level: "error" });
35
+ result.error.issues.forEach((issue) => {
36
+ appLogger(`${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join(".")}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`, { level: "error" });
37
+ });
38
+ return false;
39
+ }
40
+ }
41
+ }
42
+ }
43
+ return true;
44
+ };
45
+ const filterInvalidDictionaries = (dictionaries, configuration, options) => (dictionaries ?? [])?.filter((dictionary) => isInvalidDictionary(dictionary, configuration, options));
46
+
47
+ //#endregion
48
+ export { filterInvalidDictionaries, isInvalidDictionary };
2
49
  //# sourceMappingURL=filterInvalidDictionaries.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":"0SAeA,MAAa,GACX,EACA,EACA,IACY,CACZ,IAAM,EAAY,EAAa,EAAc,CAE7C,GAAI,CAAC,EAAY,MAAO,GAKxB,IAAM,EAFJ,EAAW,WAAa,SAAW,OAAO,EAAW,UAAa,SAEzC,QAAU,SAC/B,EAAS,EAAQ,EAAW,IAC5B,EAAa,EAAQ,EAAW,QAEtC,GAAI,CAAC,EAKH,OAJA,EAAU,GAAG,EAAS,wBAAyB,CAC7C,MAAO,QACR,CAAC,CAEK,GAGT,GAAI,CAAC,EAOH,OANA,EACE,GAAG,EAAS,cAAc,EAAY,EAAW,IAAI,CAAC,oBAAoB,EAAW,SAAW,EAAW,EAAW,SAAS,CAAG,EAAa,SAAS,GACxJ,CACE,MAAO,QACR,CACF,CACM,GAGT,GAAI,EAAW,QAAU,GAAS,aAO5B,EALF,OAAO,EAAW,SAAY,YAC7B,OAAO,EAAW,SAAY,UAC7B,EAAW,UAAY,MACvB,OAAQ,EAAW,QAAgB,MAAS,YAElC,CACZ,IAAM,EAAU,GAAe,sBAAsB,SAAW,EAAE,CAC5D,EACJ,GAAe,qBAAqB,aAAe,SAE/C,EACJ,OAAO,EAAW,QAAW,SACzB,GAAe,UAAU,EAAW,QACpC,IAAA,GAEN,GAAI,GAAU,OAAO,EAAO,WAAc,WACxC,IAAK,IAAM,KAAU,EAAS,CAC5B,IAAM,EAAkB,EACtB,EAAW,QACX,CACE,cAAe,EAAW,IAC1B,QAAS,EAAE,CACX,SACD,CACD,EAAe,EAAQ,CAAC,EAAS,CAClC,CACK,EAAU,EAAe,UAAU,EAAgB,CAEzD,GAAI,CAAC,EAAO,QAiBV,OAhBA,EACE,GAAG,EAAS,cAAc,EAAY,EAAW,IAAI,CAAC,2CAA2C,EAAS,EAAW,OAAkB,EAAW,OAAO,CAAC,cAAc,EAAa,EAAO,CAAC,KAAK,EAAW,SAAW,EAAW,EAAW,SAAS,CAAG,EAAa,SAAS,GAChR,CACE,MAAO,QACR,CACF,CAED,EAAO,MAAM,OAAO,QAAS,GAAe,CAC1C,EACE,GAAG,EAAE,UAAU,EAAY,EAAW,IAAI,CAAC,KAAK,EAAa,EAAO,CAAC,KAAK,EAAS,GAAG,EAAM,KAAK,KAAK,IAAI,CAAC,GAAI,EAAW,KAAK,CAAC,GAAG,EAAS,EAAM,QAAS,EAAW,KAAK,GAC3K,CACE,MAAO,QACR,CACF,EACD,CAEK,IAOjB,MAAO,IAGI,GACX,EACA,EACA,KAEC,GAAgB,EAAE,GAAG,OAAQ,GAC5B,EAAoB,EAAY,EAAe,EAAQ,CACxD"}
1
+ {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":";;;;;;AAeA,MAAa,uBACX,YACA,eACA,YACY;CACZ,MAAM,YAAY,aAAa,cAAc;AAE7C,KAAI,CAAC,WAAY,QAAO;CAKxB,MAAM,WAHU,QACd,WAAW,aAAa,WAAW,OAAO,WAAW,aAAa,SACnE,GAC0B,UAAU;CACrC,MAAM,SAAS,QAAQ,WAAW,IAAI;CACtC,MAAM,aAAa,QAAQ,WAAW,QAAQ;AAE9C,KAAI,CAAC,QAAQ;AACX,YAAU,GAAG,SAAS,yBAAyB,EAC7C,OAAO,SACR,CAAC;AAEF,SAAO;;AAGT,KAAI,CAAC,YAAY;AACf,YACE,GAAG,SAAS,cAAc,YAAY,WAAW,IAAI,CAAC,oBAAoB,WAAW,WAAW,WAAW,WAAW,SAAS,GAAG,aAAa,SAAS,IACxJ,EACE,OAAO,SACR,CACF;AACD,SAAO;;AAGT,KAAI,WAAW,UAAU,SAAS,aAOhC;MAAI,EALF,OAAO,WAAW,YAAY,cAC7B,OAAO,WAAW,YAAY,YAC7B,WAAW,YAAY,QACvB,OAAQ,WAAW,QAAgB,SAAS,aAElC;GACZ,MAAM,UAAU,eAAe,sBAAsB,WAAW,EAAE;GAClE,MAAM,WACJ,eAAe,qBAAqB,eAAe;GAErD,MAAM,SACJ,OAAO,WAAW,WAAW,WACzB,eAAe,UAAU,WAAW,UACpC;AAEN,OAAI,UAAU,OAAO,OAAO,cAAc,WACxC,MAAK,MAAM,UAAU,SAAS;IAC5B,MAAM,kBAAkB,WACtB,WAAW,SACX;KACE,eAAe,WAAW;KAC1B,SAAS,EAAE;KACX;KACD,EACD,eAAe,QAAQ,CAAC,SAAS,CAClC;IACD,MAAM,SAAU,OAAe,UAAU,gBAAgB;AAEzD,QAAI,CAAC,OAAO,SAAS;AACnB,eACE,GAAG,SAAS,cAAc,YAAY,WAAW,IAAI,CAAC,2CAA2C,SAAS,WAAW,QAAkB,WAAW,OAAO,CAAC,cAAc,aAAa,OAAO,CAAC,KAAK,WAAW,WAAW,WAAW,WAAW,SAAS,GAAG,aAAa,SAAS,IAChR,EACE,OAAO,SACR,CACF;AAED,YAAO,MAAM,OAAO,SAAS,UAAe;AAC1C,gBACE,GAAG,EAAE,UAAU,YAAY,WAAW,IAAI,CAAC,KAAK,aAAa,OAAO,CAAC,KAAK,SAAS,GAAG,MAAM,KAAK,KAAK,IAAI,CAAC,IAAI,WAAW,KAAK,CAAC,GAAG,SAAS,MAAM,SAAS,WAAW,KAAK,IAC3K,EACE,OAAO,SACR,CACF;OACD;AAEF,YAAO;;;;;AAOjB,QAAO;;AAGT,MAAa,6BACX,cACA,eACA,aAEC,gBAAgB,EAAE,GAAG,QAAQ,eAC5B,oBAAoB,YAAY,eAAe,QAAQ,CACxD"}
@@ -1,2 +1,45 @@
1
- import{i18nextToIntlayerFormatter as e,icuToIntlayerFormatter as t,intlayerToI18nextFormatter as n,intlayerToICUFormatter as r,intlayerToVueI18nFormatter as i,vueI18nToIntlayerFormatter as a}from"@intlayer/core/messageFormat";const o=n=>n.format===`icu`?{...n,format:`intlayer`,content:t(n.content)}:n.format===`i18next`?{...n,format:`intlayer`,content:e(n.content)}:n.format===`vue-i18n`?{...n,format:`intlayer`,content:a(n.content)}:n,s=e=>e.map(o),c=e=>e.format===`icu`?{...e,format:`icu`,content:r(e.content)}:e.format===`i18next`?{...e,format:`i18next`,content:n(e.content)}:e.format===`vue-i18n`?{...e,format:`vue-i18n`,content:i(e.content)}:e,l=e=>e.map(c);export{s as formatDictionaries,l as formatDictionariesOutput,o as formatDictionary,c as formatDictionaryOutput};
1
+ import { i18nextToIntlayerFormatter, icuToIntlayerFormatter, intlayerToI18nextFormatter, intlayerToICUFormatter, intlayerToVueI18nFormatter, vueI18nToIntlayerFormatter } from "@intlayer/core/messageFormat";
2
+
3
+ //#region src/formatDictionary.ts
4
+ const formatDictionary = (dictionary) => {
5
+ if (dictionary.format === "icu") return {
6
+ ...dictionary,
7
+ format: "intlayer",
8
+ content: icuToIntlayerFormatter(dictionary.content)
9
+ };
10
+ if (dictionary.format === "i18next") return {
11
+ ...dictionary,
12
+ format: "intlayer",
13
+ content: i18nextToIntlayerFormatter(dictionary.content)
14
+ };
15
+ if (dictionary.format === "vue-i18n") return {
16
+ ...dictionary,
17
+ format: "intlayer",
18
+ content: vueI18nToIntlayerFormatter(dictionary.content)
19
+ };
20
+ return dictionary;
21
+ };
22
+ const formatDictionaries = (dictionaries) => dictionaries.map(formatDictionary);
23
+ const formatDictionaryOutput = (dictionary) => {
24
+ if (dictionary.format === "icu") return {
25
+ ...dictionary,
26
+ format: "icu",
27
+ content: intlayerToICUFormatter(dictionary.content)
28
+ };
29
+ if (dictionary.format === "i18next") return {
30
+ ...dictionary,
31
+ format: "i18next",
32
+ content: intlayerToI18nextFormatter(dictionary.content)
33
+ };
34
+ if (dictionary.format === "vue-i18n") return {
35
+ ...dictionary,
36
+ format: "vue-i18n",
37
+ content: intlayerToVueI18nFormatter(dictionary.content)
38
+ };
39
+ return dictionary;
40
+ };
41
+ const formatDictionariesOutput = (dictionaries) => dictionaries.map(formatDictionaryOutput);
42
+
43
+ //#endregion
44
+ export { formatDictionaries, formatDictionariesOutput, formatDictionary, formatDictionaryOutput };
2
45
  //# sourceMappingURL=formatDictionary.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"formatDictionary.mjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":"kOAUA,MAAa,EAAoB,GAC3B,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,WACR,QAAS,EAAuB,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,WACR,QAAS,EAA2B,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,QAAS,EAA2B,EAAW,QAAQ,CACxD,CAGI,EAGI,EAAsB,GACjC,EAAa,IAAI,EAAiB,CAEvB,EAA0B,GACjC,EAAW,SAAW,MACjB,CACL,GAAG,EACH,OAAQ,MACR,QAAS,EAAuB,EAAW,QAAQ,CACpD,CAGC,EAAW,SAAW,UACjB,CACL,GAAG,EACH,OAAQ,UACR,QAAS,EAA2B,EAAW,QAAQ,CACxD,CAGC,EAAW,SAAW,WACjB,CACL,GAAG,EACH,OAAQ,WACR,QAAS,EAA2B,EAAW,QAAQ,CACxD,CAGI,EAGI,EAA4B,GACvC,EAAa,IAAI,EAAuB"}
1
+ {"version":3,"file":"formatDictionary.mjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToVueI18nFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = (dictionaries: Dictionary[]): Dictionary[] =>\n dictionaries.map(formatDictionary);\n\nexport const formatDictionaryOutput = (dictionary: Dictionary) => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (dictionaries: Dictionary[]) =>\n dictionaries.map(formatDictionaryOutput);\n"],"mappings":";;;AAUA,MAAa,oBAAoB,eAAuC;AACtE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,sBAAsB,iBACjC,aAAa,IAAI,iBAAiB;AAEpC,MAAa,0BAA0B,eAA2B;AAChE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,QAAO;;AAGT,MAAa,4BAA4B,iBACvC,aAAa,IAAI,uBAAuB"}
@@ -1,8 +1,60 @@
1
- import{kebabCaseToCamelCase as e}from"@intlayer/config/utils";const t=async(t,n,r={},i)=>{let a=e(t),o=a.charAt(0).toLowerCase()+a.slice(1),s=Object.entries(r).filter(([,e])=>e!==void 0).map(([e,t])=>`\n ${/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?e:JSON.stringify(e)}: ${typeof t==`object`||typeof t==`string`?JSON.stringify(t):t},`).join(``),c;c=i?`{}`:n===`json`||n===`jsonc`||n===`json5`?[`{`,` "$schema": "https://intlayer.org/schema.json",`,` "key": "${t}",${s}`,` "content": {`,` }`,`}`].join(`
2
- `):[`{`,` key: '${t}',${s}`,` content: {`,` },`,`}`].join(`
3
- `);let l=`/** @type {import('intlayer').Dictionary${i?`['content']`:``}} **/`,u=i?`Dictionary['content']`:`Dictionary`;switch(n){case`ts`:return[`import { type Dictionary } from 'intlayer';`,``,`const ${o}Content = ${c} satisfies ${u};`,``,`export default ${o}Content;`,``].join(`
4
- `);case`cjs`:return[l,`const ${o}Content = ${c};`,``,`module.exports = ${o}Content;`,``].join(`
5
- `);case`json`:case`jsonc`:case`json5`:return[c,``].join(`
6
- `);default:return[l,`const ${o}Content = ${c};`,``,`export default ${o}Content;`,``].join(`
7
- `)}};export{t as getContentDeclarationFileTemplate};
1
+ import { kebabCaseToCamelCase } from "@intlayer/config/utils";
2
+
3
+ //#region src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts
4
+ const getContentDeclarationFileTemplate = async (key, format, fileParams = {}, noMetadata) => {
5
+ const camelCaseKey = kebabCaseToCamelCase(key);
6
+ const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);
7
+ const fileParamsString = Object.entries(fileParams).filter(([, value]) => value !== void 0).map(([paramKey, value]) => {
8
+ return `\n ${/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey) ? paramKey : JSON.stringify(paramKey)}: ${typeof value === "object" || typeof value === "string" ? JSON.stringify(value) : value},`;
9
+ }).join("");
10
+ let content;
11
+ if (noMetadata) content = "{}";
12
+ else if (format === "json" || format === "jsonc" || format === "json5") content = [
13
+ "{",
14
+ " \"$schema\": \"https://intlayer.org/schema.json\",",
15
+ ` "key": "${key}",${fileParamsString}`,
16
+ " \"content\": {",
17
+ " }",
18
+ "}"
19
+ ].join("\n");
20
+ else content = [
21
+ "{",
22
+ ` key: '${key}',${fileParamsString}`,
23
+ " content: {",
24
+ " },",
25
+ "}"
26
+ ].join("\n");
27
+ const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? "['content']" : ""}} **/`;
28
+ const satisfiesType = noMetadata ? "Dictionary['content']" : "Dictionary";
29
+ switch (format) {
30
+ case "ts": return [
31
+ "import { type Dictionary } from 'intlayer';",
32
+ "",
33
+ `const ${name}Content = ${content} satisfies ${satisfiesType};`,
34
+ "",
35
+ `export default ${name}Content;`,
36
+ ""
37
+ ].join("\n");
38
+ case "cjs": return [
39
+ jsdoc,
40
+ `const ${name}Content = ${content};`,
41
+ "",
42
+ `module.exports = ${name}Content;`,
43
+ ""
44
+ ].join("\n");
45
+ case "json":
46
+ case "jsonc":
47
+ case "json5": return [content, ""].join("\n");
48
+ default: return [
49
+ jsdoc,
50
+ `const ${name}Content = ${content};`,
51
+ "",
52
+ `export default ${name}Content;`,
53
+ ""
54
+ ].join("\n");
55
+ }
56
+ };
57
+
58
+ //#endregion
59
+ export { getContentDeclarationFileTemplate };
8
60
  //# sourceMappingURL=getContentDeclarationFileTemplate.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"getContentDeclarationFileTemplate.mjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":"8DAGA,MAAa,EAAoC,MAC/C,EACA,EACA,EAAkC,EAAE,CACpC,IACG,CACH,IAAM,EAAe,EAAqB,EAAI,CACxC,EAAO,EAAa,OAAO,EAAE,CAAC,aAAa,CAAG,EAAa,MAAM,EAAE,CAEnE,EAAmB,OAAO,QAAQ,EAAW,CAChD,QAAQ,EAAG,KAAW,IAAU,IAAA,GAAU,CAC1C,KAAK,CAAC,EAAU,KAUR,OATc,6BAA6B,KAAK,EAAS,CAC5D,EACA,KAAK,UAAU,EAAS,CAOD,IAJzB,OAAO,GAAU,UAAY,OAAO,GAAU,SAC1C,KAAK,UAAU,EAAM,CACrB,EAEwC,GAC9C,CACD,KAAK,GAAG,CAEP,EAEJ,AAYE,EAZE,EACQ,KACD,IAAW,QAAU,IAAW,SAAW,IAAW,QACrD,CACR,IACA,mDACA,aAAa,EAAI,IAAI,IACrB,iBACA,MACA,IACD,CAAC,KAAK;EAAK,CAEF,CACR,IACA,WAAW,EAAI,IAAI,IACnB,eACA,OACA,IACD,CAAC,KAAK;EAAK,CAGd,IAAM,EAAQ,2CAA2C,EAAa,cAAgB,GAAG,OACnF,EAAgB,EAAa,wBAA0B,aAE7D,OAAQ,EAAR,CACE,IAAK,KACH,MAAO,CACL,8CACA,GACA,SAAS,EAAK,YAAY,EAAQ,aAAa,EAAc,GAC7D,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,MACH,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,oBAAoB,EAAK,UACzB,GACD,CAAC,KAAK;EAAK,CAEd,IAAK,OACL,IAAK,QACL,IAAK,QACH,MAAO,CAAC,EAAS,GAAG,CAAC,KAAK;EAAK,CAEjC,QACE,MAAO,CACL,EACA,SAAS,EAAK,YAAY,EAAQ,GAClC,GACA,kBAAkB,EAAK,UACvB,GACD,CAAC,KAAK;EAAK"}
1
+ {"version":3,"file":"getContentDeclarationFileTemplate.mjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":";;;AAGA,MAAa,oCAAoC,OAC/C,KACA,QACA,aAAkC,EAAE,EACpC,eACG;CACH,MAAM,eAAe,qBAAqB,IAAI;CAC9C,MAAM,OAAO,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAEzE,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAChD,QAAQ,GAAG,WAAW,UAAU,OAAU,CAC1C,KAAK,CAAC,UAAU,WAAW;AAU1B,SAAO,OATc,6BAA6B,KAAK,SAAS,GAC5D,WACA,KAAK,UAAU,SAAS,CAOD,IAJzB,OAAO,UAAU,YAAY,OAAO,UAAU,WAC1C,KAAK,UAAU,MAAM,GACrB,MAEwC;GAC9C,CACD,KAAK,GAAG;CAEX,IAAI;AAEJ,KAAI,WACF,WAAU;UACD,WAAW,UAAU,WAAW,WAAW,WAAW,QAC/D,WAAU;EACR;EACA;EACA,aAAa,IAAI,IAAI;EACrB;EACA;EACA;EACD,CAAC,KAAK,KAAK;KAEZ,WAAU;EACR;EACA,WAAW,IAAI,IAAI;EACnB;EACA;EACA;EACD,CAAC,KAAK,KAAK;CAGd,MAAM,QAAQ,2CAA2C,aAAa,gBAAgB,GAAG;CACzF,MAAM,gBAAgB,aAAa,0BAA0B;AAE7D,SAAQ,QAAR;EACE,KAAK,KACH,QAAO;GACL;GACA;GACA,SAAS,KAAK,YAAY,QAAQ,aAAa,cAAc;GAC7D;GACA,kBAAkB,KAAK;GACvB;GACD,CAAC,KAAK,KAAK;EAEd,KAAK,MACH,QAAO;GACL;GACA,SAAS,KAAK,YAAY,QAAQ;GAClC;GACA,oBAAoB,KAAK;GACzB;GACD,CAAC,KAAK,KAAK;EAEd,KAAK;EACL,KAAK;EACL,KAAK,QACH,QAAO,CAAC,SAAS,GAAG,CAAC,KAAK,KAAK;EAEjC,QACE,QAAO;GACL;GACA,SAAS,KAAK,YAAY,QAAQ;GAClC;GACA,kBAAkB,KAAK;GACvB;GACD,CAAC,KAAK,KAAK"}
@@ -1 +1,3 @@
1
- import{getContentDeclarationFileTemplate as e}from"./getContentDeclarationFileTemplate.mjs";export{e as getContentDeclarationFileTemplate};
1
+ import { getContentDeclarationFileTemplate } from "./getContentDeclarationFileTemplate.mjs";
2
+
3
+ export { getContentDeclarationFileTemplate };
@@ -1,2 +1,33 @@
1
- import{createDictionaryEntryPoint as e}from"./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";import{formatPath as t}from"./utils/formatter.mjs";import{buildDictionary as n}from"./buildIntlayerDictionary/buildIntlayerDictionary.mjs";import{createModuleAugmentation as r}from"./createType/createModuleAugmentation.mjs";import{createTypes as i}from"./createType/createType.mjs";import{loadLocalDictionaries as a}from"./loadDictionaries/loadLocalDictionaries.mjs";import{getAppLogger as o}from"@intlayer/config/logger";const s=async(s,c)=>{let l=o(c);l(`Additional file detected: ${t(s)}`,{isVerbose:!0});let u=await n(await a(s,c),c);await i(Object.values(u?.mergedDictionaries??{}).map(e=>e.dictionary),c),await e(c),l(`Dictionaries built`,{isVerbose:!0}),r(c),l(`Module augmentation built`,{isVerbose:!0});for await(let e of c.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=u;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:c})}};export{s as handleAdditionalContentDeclarationFile};
1
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
2
+ import { formatPath } from "./utils/formatter.mjs";
3
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
4
+ import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
5
+ import { createTypes } from "./createType/createType.mjs";
6
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
7
+ import { getAppLogger } from "@intlayer/config/logger";
8
+
9
+ //#region src/handleAdditionalContentDeclarationFile.ts
10
+ const handleAdditionalContentDeclarationFile = async (filePath, config) => {
11
+ const appLogger = getAppLogger(config);
12
+ appLogger(`Additional file detected: ${formatPath(filePath)}`, { isVerbose: true });
13
+ const dictionariesOutput = await buildDictionary(await loadLocalDictionaries(filePath, config), config);
14
+ await createTypes(Object.values(dictionariesOutput?.mergedDictionaries ?? {}).map((dictionary) => dictionary.dictionary), config);
15
+ await createDictionaryEntryPoint(config);
16
+ appLogger("Dictionaries built", { isVerbose: true });
17
+ createModuleAugmentation(config);
18
+ appLogger("Module augmentation built", { isVerbose: true });
19
+ for await (const plugin of config.plugins ?? []) {
20
+ const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;
21
+ await plugin.afterBuild?.({
22
+ dictionaries: {
23
+ unmergedDictionaries,
24
+ mergedDictionaries
25
+ },
26
+ configuration: config
27
+ });
28
+ }
29
+ };
30
+
31
+ //#endregion
32
+ export { handleAdditionalContentDeclarationFile };
2
33
  //# sourceMappingURL=handleAdditionalContentDeclarationFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdditionalContentDeclarationFile.mjs","names":[],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"+gBAQA,MAAa,EAAyC,MACpD,EACA,IACG,CACH,IAAM,EAAY,EAAa,EAAO,CAGtC,EAAU,6BAA6B,EAAW,EAAS,GAAI,CAC7D,UAAW,GACZ,CAAC,CAIF,IAAM,EAAqB,MAAM,EAFN,MAAM,EAAsB,EAAU,EAAO,CAEH,EAAO,CAM5E,MAAM,EAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,MAAM,EAA2B,EAAO,CAExC,EAAU,qBAAsB,CAC9B,UAAW,GACZ,CAAC,CAEF,EAAyB,EAAO,CAEhC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleAdditionalContentDeclarationFile.mjs","names":[],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,6BAA6B,WAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAM,gBAFN,MAAM,sBAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,OAAM,2BAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,0BAAyB,OAAO;AAEhC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1,2 +1,48 @@
1
- import{getBuiltDictionariesPath as e}from"./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";import{createDictionaryEntryPoint as t}from"./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";import{cleanRemovedContentDeclaration as n}from"./cleanRemovedContentDeclaration.mjs";import{formatPath as r}from"./utils/formatter.mjs";import{buildDictionary as i}from"./buildIntlayerDictionary/buildIntlayerDictionary.mjs";import{createModuleAugmentation as a}from"./createType/createModuleAugmentation.mjs";import{createTypes as o}from"./createType/createType.mjs";import{loadLocalDictionaries as s}from"./loadDictionaries/loadLocalDictionaries.mjs";import{getAppLogger as c}from"@intlayer/config/logger";const l=async(l,u)=>{let d=c(u);d(`Change detected: ${r(l)}`,{isVerbose:!0});let f=await e(u),p=await s(l,u),m=await i(p,u),h=Object.values(m?.mergedDictionaries??{}),g=h.map(e=>e.dictionaryPath),{excludeKeys:_,hasRebuilt:v}=await n(l,p.map(e=>e.key),u),y=g.some(e=>!f.includes(e));(v||y)&&(v||(await t(u,{excludeKeys:_}),d(`Dictionary list built`,{isVerbose:!0}))),await o(h.map(e=>e.dictionary),u),d(`TypeScript types built`,{isVerbose:!0}),y&&(await a(u),d(`Module augmentation built`,{isVerbose:!0}));for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=m;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};export{l as handleContentDeclarationFileChange};
1
+ import { getBuiltDictionariesPath } from "./createDictionaryEntryPoint/getBuiltDictionariesPath.mjs";
2
+ import { createDictionaryEntryPoint } from "./createDictionaryEntryPoint/createDictionaryEntryPoint.mjs";
3
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
4
+ import { formatPath } from "./utils/formatter.mjs";
5
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
6
+ import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
7
+ import { createTypes } from "./createType/createType.mjs";
8
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
9
+ import { getAppLogger } from "@intlayer/config/logger";
10
+
11
+ //#region src/handleContentDeclarationFileChange.ts
12
+ const handleContentDeclarationFileChange = async (filePath, config) => {
13
+ const appLogger = getAppLogger(config);
14
+ appLogger(`Change detected: ${formatPath(filePath)}`, { isVerbose: true });
15
+ const allDictionariesPaths = await getBuiltDictionariesPath(config);
16
+ const localeDictionaries = await loadLocalDictionaries(filePath, config);
17
+ const dictionariesOutput = await buildDictionary(localeDictionaries, config);
18
+ const updatedDictionaries = Object.values(dictionariesOutput?.mergedDictionaries ?? {});
19
+ const updatedDictionariesPaths = updatedDictionaries.map((dictionary) => dictionary.dictionaryPath);
20
+ const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(filePath, localeDictionaries.map((dictionary) => dictionary.key), config);
21
+ const hasNewDictionaries = updatedDictionariesPaths.some((updatedDictionaryPath) => !allDictionariesPaths.includes(updatedDictionaryPath));
22
+ if (hasRebuilt || hasNewDictionaries) {
23
+ if (!hasRebuilt) {
24
+ await createDictionaryEntryPoint(config, { excludeKeys });
25
+ appLogger("Dictionary list built", { isVerbose: true });
26
+ }
27
+ }
28
+ await createTypes(updatedDictionaries.map((dictionary) => dictionary.dictionary), config);
29
+ appLogger("TypeScript types built", { isVerbose: true });
30
+ if (hasNewDictionaries) {
31
+ await createModuleAugmentation(config);
32
+ appLogger("Module augmentation built", { isVerbose: true });
33
+ }
34
+ for await (const plugin of config.plugins ?? []) {
35
+ const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;
36
+ await plugin.afterBuild?.({
37
+ dictionaries: {
38
+ unmergedDictionaries,
39
+ mergedDictionaries
40
+ },
41
+ configuration: config
42
+ });
43
+ }
44
+ };
45
+
46
+ //#endregion
47
+ export { handleContentDeclarationFileChange };
2
48
  //# sourceMappingURL=handleContentDeclarationFileChange.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileChange.mjs","names":[],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"0sBAWA,MAAa,EAAqC,MAChD,EACA,IACG,CACH,IAAM,EAAY,EAAa,EAAO,CAGtC,EAAU,oBAAoB,EAAW,EAAS,GAAI,CACpD,UAAW,GACZ,CAAC,CAEF,IAAM,EAAiC,MAAM,EAAyB,EAAO,CAEvE,EAAqB,MAAM,EAAsB,EAAU,EAAO,CAElE,EAAqB,MAAM,EAAgB,EAAoB,EAAO,CACtE,EAAsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CACK,EAA2B,EAAoB,IAClD,GAAe,EAAW,eAC5B,CAEK,CAAE,cAAa,cAAe,MAAM,EACxC,EACA,EAAmB,IAAK,GAAe,EAAW,IAAI,CACtD,EACD,CAEK,EAAqB,EAAyB,KACjD,GACC,CAAC,EAAqB,SAAS,EAAsB,CACxD,EAIG,GAAc,KAIX,IACH,MAAM,EAA2B,EAAQ,CAAE,cAAa,CAAC,CACzD,EAAU,wBAAyB,CACjC,UAAW,GACZ,CAAC,GAWN,MAAM,EAJsB,EAAoB,IAC7C,GAAe,EAAW,WAC5B,CAEsC,EAAO,CAC9C,EAAU,yBAA0B,CAClC,UAAW,GACZ,CAAC,CAEE,IACF,MAAM,EAAyB,EAAO,CACtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,EAKJ,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleContentDeclarationFileChange.mjs","names":[],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Entry Point & Module Augmentation\n // These only need to be updated if the *list* of dictionaries changed (Add/Remove/Rename)\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,oBAAoB,WAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAEF,MAAM,uBAAiC,MAAM,yBAAyB,OAAO;CAE7E,MAAM,qBAAqB,MAAM,sBAAsB,UAAU,OAAO;CAExE,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,OAAO;CAC5E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C;CACD,MAAM,2BAA2B,oBAAoB,KAClD,eAAe,WAAW,eAC5B;CAED,MAAM,EAAE,aAAa,eAAe,MAAM,+BACxC,UACA,mBAAmB,KAAK,eAAe,WAAW,IAAI,EACtD,OACD;CAED,MAAM,qBAAqB,yBAAyB,MACjD,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD;AAID,KAAI,cAAc,oBAIhB;MAAI,CAAC,YAAY;AACf,SAAM,2BAA2B,QAAQ,EAAE,aAAa,CAAC;AACzD,aAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;;AAWN,OAAM,YAJsB,oBAAoB,KAC7C,eAAe,WAAW,WAC5B,EAEsC,OAAO;AAC9C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAEF,KAAI,oBAAoB;AACtB,QAAM,yBAAyB,OAAO;AACtC,YAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;;AAKJ,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1,2 +1,23 @@
1
- import{cleanRemovedContentDeclaration as e}from"./cleanRemovedContentDeclaration.mjs";import{formatPath as t}from"./utils/formatter.mjs";import{loadLocalDictionaries as n}from"./loadDictionaries/loadLocalDictionaries.mjs";import{handleContentDeclarationFileChange as r}from"./handleContentDeclarationFileChange.mjs";import{getAppLogger as i}from"@intlayer/config/logger";const a=async(a,o,s)=>{let c=i(s);c(`File moved from ${t(a)} to ${t(o)}`,{isVerbose:!0});let l=[];try{l=(await n(o,s)).map(e=>e.key)}catch{c(`Error parsing new file during move operation: ${t(o)}`,{isVerbose:!0})}await e(a,l,s),await r(o,s)};export{a as handleContentDeclarationFileMoved};
1
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
2
+ import { formatPath } from "./utils/formatter.mjs";
3
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
4
+ import { handleContentDeclarationFileChange } from "./handleContentDeclarationFileChange.mjs";
5
+ import { getAppLogger } from "@intlayer/config/logger";
6
+
7
+ //#region src/handleContentDeclarationFileMoved.ts
8
+ const handleContentDeclarationFileMoved = async (oldFilePath, newFilePath, config) => {
9
+ const appLogger = getAppLogger(config);
10
+ appLogger(`File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`, { isVerbose: true });
11
+ let keysToKeep = [];
12
+ try {
13
+ keysToKeep = (await loadLocalDictionaries(newFilePath, config)).map((d) => d.key);
14
+ } catch {
15
+ appLogger(`Error parsing new file during move operation: ${formatPath(newFilePath)}`, { isVerbose: true });
16
+ }
17
+ await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);
18
+ await handleContentDeclarationFileChange(newFilePath, config);
19
+ };
20
+
21
+ //#endregion
22
+ export { handleContentDeclarationFileMoved };
2
23
  //# sourceMappingURL=handleContentDeclarationFileMoved.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileMoved.mjs","names":[],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":"mXAOA,MAAa,EAAoC,MAC/C,EACA,EACA,IACG,CACH,IAAM,EAAY,EAAa,EAAO,CAEtC,EACE,mBAAmB,EAAW,EAAY,CAAC,MAAM,EAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CAED,IAAI,EAAuB,EAAE,CAE7B,GAAI,CAQF,GAJ8B,MAAM,EAClC,EACA,EACD,EACkC,IAAK,GAAM,EAAE,IAAI,MAC9C,CACN,EACE,iDAAiD,EAAW,EAAY,GACxE,CACE,UAAW,GACZ,CACF,CASH,MAAM,EAA+B,EAAa,EAAY,EAAO,CAKrE,MAAM,EAAmC,EAAa,EAAO"}
1
+ {"version":3,"file":"handleContentDeclarationFileMoved.mjs","names":[],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":";;;;;;;AAOA,MAAa,oCAAoC,OAC/C,aACA,aACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAEtC,WACE,mBAAmB,WAAW,YAAY,CAAC,MAAM,WAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;CAED,IAAI,aAAuB,EAAE;AAE7B,KAAI;AAQF,gBAJ8B,MAAM,sBAClC,aACA,OACD,EACkC,KAAK,MAAM,EAAE,IAAI;SAC9C;AACN,YACE,iDAAiD,WAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;;AASH,OAAM,+BAA+B,aAAa,YAAY,OAAO;AAKrE,OAAM,mCAAmC,aAAa,OAAO"}
@@ -1,2 +1,36 @@
1
- import{cleanRemovedContentDeclaration as e}from"./cleanRemovedContentDeclaration.mjs";import{formatPath as t}from"./utils/formatter.mjs";import{buildDictionary as n}from"./buildIntlayerDictionary/buildIntlayerDictionary.mjs";import{createModuleAugmentation as r}from"./createType/createModuleAugmentation.mjs";import{createTypes as i}from"./createType/createType.mjs";import{loadLocalDictionaries as a}from"./loadDictionaries/loadLocalDictionaries.mjs";import{listDictionaries as o}from"./listDictionariesPath.mjs";import{normalize as s}from"node:path";import{getAppLogger as c}from"@intlayer/config/logger";const l=async(l,u)=>{let d=c(u);d(`Unlinked detected: ${t(l)}`,{isVerbose:!0});let f=await a((await o(u)).filter(e=>s(e)!==s(l)),u);await e(l,[],u);let p=await n(f,u);await i(Object.values(p?.mergedDictionaries??{}).map(e=>e.dictionary),u),d(`Dictionaries rebuilt`,{isVerbose:!0}),await r(u),d(`Module augmentation built`,{isVerbose:!0});for await(let e of u.plugins??[]){let{unmergedDictionaries:t,mergedDictionaries:n}=p;await e.afterBuild?.({dictionaries:{unmergedDictionaries:t,mergedDictionaries:n},configuration:u})}};export{l as handleUnlinkedContentDeclarationFile};
1
+ import { cleanRemovedContentDeclaration } from "./cleanRemovedContentDeclaration.mjs";
2
+ import { formatPath } from "./utils/formatter.mjs";
3
+ import { buildDictionary } from "./buildIntlayerDictionary/buildIntlayerDictionary.mjs";
4
+ import { createModuleAugmentation } from "./createType/createModuleAugmentation.mjs";
5
+ import { createTypes } from "./createType/createType.mjs";
6
+ import { loadLocalDictionaries } from "./loadDictionaries/loadLocalDictionaries.mjs";
7
+ import { listDictionaries } from "./listDictionariesPath.mjs";
8
+ import { normalize } from "node:path";
9
+ import { getAppLogger } from "@intlayer/config/logger";
10
+
11
+ //#region src/handleUnlinkedContentDeclarationFile.ts
12
+ const handleUnlinkedContentDeclarationFile = async (filePath, config) => {
13
+ const appLogger = getAppLogger(config);
14
+ appLogger(`Unlinked detected: ${formatPath(filePath)}`, { isVerbose: true });
15
+ const localeDictionaries = await loadLocalDictionaries((await listDictionaries(config)).filter((file) => normalize(file) !== normalize(filePath)), config);
16
+ await cleanRemovedContentDeclaration(filePath, [], config);
17
+ const dictionariesOutput = await buildDictionary(localeDictionaries, config);
18
+ await createTypes(Object.values(dictionariesOutput?.mergedDictionaries ?? {}).map((dictionary) => dictionary.dictionary), config);
19
+ appLogger("Dictionaries rebuilt", { isVerbose: true });
20
+ await createModuleAugmentation(config);
21
+ appLogger("Module augmentation built", { isVerbose: true });
22
+ for await (const plugin of config.plugins ?? []) {
23
+ const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;
24
+ await plugin.afterBuild?.({
25
+ dictionaries: {
26
+ unmergedDictionaries,
27
+ mergedDictionaries
28
+ },
29
+ configuration: config
30
+ });
31
+ }
32
+ };
33
+
34
+ //#endregion
35
+ export { handleUnlinkedContentDeclarationFile };
2
36
  //# sourceMappingURL=handleUnlinkedContentDeclarationFile.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"handleUnlinkedContentDeclarationFile.mjs","names":[],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\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 handleUnlinkedContentDeclarationFile = 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[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":"gmBAWA,MAAa,EAAuC,MAClD,EACA,IACG,CACH,IAAM,EAAY,EAAa,EAAO,CAGtC,EAAU,sBAAsB,EAAW,EAAS,GAAI,CACtD,UAAW,GACZ,CAAC,CAQF,IAAM,EAAqB,MAAM,GANT,MAAM,EAAiB,EAAO,EAE1B,OACzB,GAAS,EAAU,EAAK,GAAK,EAAU,EAAS,CAClD,CAEqE,EAAO,CAE7E,MAAM,EAA+B,EAAU,EAAE,CAAE,EAAO,CAE1D,IAAM,EAAqB,MAAM,EAAgB,EAAoB,EAAO,CAM5E,MAAM,EAJsB,OAAO,OACjC,GAAoB,oBAAsB,EAAE,CAC7C,CAAC,IAAK,GAAe,EAAW,WAAW,CAEL,EAAO,CAE9C,EAAU,uBAAwB,CAChC,UAAW,GACZ,CAAC,CAEF,MAAM,EAAyB,EAAO,CAEtC,EAAU,4BAA6B,CACrC,UAAW,GACZ,CAAC,CAIF,UAAW,IAAM,KAAU,EAAO,SAAW,EAAE,CAAE,CAC/C,GAAM,CAAE,uBAAsB,sBAAuB,EAErD,MAAM,EAAO,aAAa,CACxB,aAAc,CACZ,uBACA,qBACD,CACD,cAAe,EAChB,CAAC"}
1
+ {"version":3,"file":"handleUnlinkedContentDeclarationFile.mjs","names":[],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\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 handleUnlinkedContentDeclarationFile = 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[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,uCAAuC,OAClD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,sBAAsB,WAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAQF,MAAM,qBAAqB,MAAM,uBANT,MAAM,iBAAiB,OAAO,EAE1B,QACzB,SAAS,UAAU,KAAK,KAAK,UAAU,SAAS,CAClD,EAEqE,OAAO;AAE7E,OAAM,+BAA+B,UAAU,EAAE,EAAE,OAAO;CAE1D,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,OAAO;AAM5E,OAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAM,yBAAyB,OAAO;AAEtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}