@intlayer/engine 9.0.0-canary.17 → 9.0.0-canary.19

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 (597) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +4 -3
  2. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +0 -1
  3. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  4. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +0 -1
  5. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +0 -1
  7. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  8. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +0 -1
  9. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  10. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +2 -2
  11. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +2 -2
  13. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +4 -3
  15. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  16. package/dist/cjs/cleanOutputDir.cjs +0 -1
  17. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  18. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  19. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +0 -1
  20. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  21. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +0 -1
  22. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  23. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  25. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  28. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  29. package/dist/cjs/createType/createType.cjs +0 -1
  30. package/dist/cjs/createType/createType.cjs.map +1 -1
  31. package/dist/cjs/detectFormatCommand.cjs +0 -1
  32. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  33. package/dist/cjs/docReview/alignBlocks.cjs.map +1 -1
  34. package/dist/cjs/docReview/computeSimilarity.cjs +1 -1
  35. package/dist/cjs/docReview/computeSimilarity.cjs.map +1 -1
  36. package/dist/cjs/docReview/fingerprintBlock.cjs +3 -1
  37. package/dist/cjs/docReview/fingerprintBlock.cjs.map +1 -1
  38. package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs.map +1 -1
  39. package/dist/cjs/docReview/normalizeBlock.cjs +4 -2
  40. package/dist/cjs/docReview/normalizeBlock.cjs.map +1 -1
  41. package/dist/cjs/docReview/pipeline.cjs +3 -2
  42. package/dist/cjs/docReview/pipeline.cjs.map +1 -1
  43. package/dist/cjs/docReview/planActions.cjs.map +1 -1
  44. package/dist/cjs/docReview/rebuildDocument.cjs.map +1 -1
  45. package/dist/cjs/docReview/reviewReport.cjs.map +1 -1
  46. package/dist/cjs/docReview/segmentDocument.cjs.map +1 -1
  47. package/dist/cjs/fetchDistantDictionaries.cjs +0 -1
  48. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  49. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  50. package/dist/cjs/formatDictionary.cjs +0 -1
  51. package/dist/cjs/formatDictionary.cjs.map +1 -1
  52. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +0 -1
  53. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  54. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +0 -1
  55. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  56. package/dist/cjs/handleContentDeclarationFileChange.cjs +0 -1
  57. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  58. package/dist/cjs/handleContentDeclarationFileMoved.cjs +0 -1
  59. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  60. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +0 -1
  61. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  62. package/dist/cjs/init/cms.cjs.map +1 -1
  63. package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -1
  64. package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs +0 -1
  65. package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs.map +1 -1
  66. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -1
  67. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +4 -3
  68. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs.map +1 -1
  69. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -1
  70. package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs +0 -1
  71. package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs.map +1 -1
  72. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -1
  73. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +2 -2
  74. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs.map +1 -1
  75. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -1
  76. package/dist/cjs/init/index.cjs.map +1 -1
  77. package/dist/cjs/init/utils/astImports.cjs.map +1 -1
  78. package/dist/cjs/init/utils/configManipulation.cjs +12 -6
  79. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  80. package/dist/cjs/init/utils/fileSystem.cjs +1 -1
  81. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  82. package/dist/cjs/init/utils/githubActions.cjs +0 -1
  83. package/dist/cjs/init/utils/githubActions.cjs.map +1 -1
  84. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
  85. package/dist/cjs/init/utils/nextCompilerBabel.cjs.map +1 -1
  86. package/dist/cjs/init/utils/packageManager.cjs +4 -3
  87. package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
  88. package/dist/cjs/init/utils/tsConfig.cjs +0 -1
  89. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  90. package/dist/cjs/init/utils/version.cjs.map +1 -1
  91. package/dist/cjs/initConfig/index.cjs +0 -1
  92. package/dist/cjs/initConfig/index.cjs.map +1 -1
  93. package/dist/cjs/installLSP.cjs.map +1 -1
  94. package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
  95. package/dist/cjs/installSkills/index.cjs +1 -1
  96. package/dist/cjs/installSkills/index.cjs.map +1 -1
  97. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  98. package/dist/cjs/listGitFiles.cjs.map +1 -1
  99. package/dist/cjs/listProjects.cjs.map +1 -1
  100. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +0 -1
  101. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  102. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +3 -3
  103. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  104. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +3 -2
  105. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  106. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +0 -1
  107. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  108. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +0 -1
  109. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -1
  110. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +2 -2
  111. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  112. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +0 -1
  113. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -1
  114. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  115. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +0 -1
  116. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  117. package/dist/cjs/logConfigDetails.cjs +6 -3
  118. package/dist/cjs/logConfigDetails.cjs.map +1 -1
  119. package/dist/cjs/prepareIntlayer.cjs +2 -1
  120. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  121. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  122. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +0 -1
  123. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  124. package/dist/cjs/scan/analyzeBundleContent.cjs +0 -1
  125. package/dist/cjs/scan/analyzeBundleContent.cjs.map +1 -1
  126. package/dist/cjs/scan/calculateScore.cjs.map +1 -1
  127. package/dist/cjs/scan/checks.cjs +0 -1
  128. package/dist/cjs/scan/checks.cjs.map +1 -1
  129. package/dist/cjs/scan/parseHtml.cjs.map +1 -1
  130. package/dist/cjs/scan/scanWebsite.cjs +2 -2
  131. package/dist/cjs/scan/scanWebsite.cjs.map +1 -1
  132. package/dist/cjs/syncPluginKit/createFileAdapter.cjs.map +1 -1
  133. package/dist/cjs/syncPluginKit/createSyncPlugin.cjs +9 -4
  134. package/dist/cjs/syncPluginKit/createSyncPlugin.cjs.map +1 -1
  135. package/dist/cjs/syncPluginKit/extractKeyAndLocaleFromPath.cjs.map +1 -1
  136. package/dist/cjs/syncPluginKit/filePathPatternHelpers.cjs.map +1 -1
  137. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  138. package/dist/cjs/utils/buildComponentFilesList.cjs +2 -2
  139. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
  140. package/dist/cjs/utils/buildFilesList.cjs +2 -1
  141. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  142. package/dist/cjs/utils/chunkJSON.cjs +2 -1
  143. package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
  144. package/dist/cjs/utils/formatter.cjs.map +1 -1
  145. package/dist/cjs/utils/getChunk.cjs.map +1 -1
  146. package/dist/cjs/utils/getContentExtension.cjs.map +1 -1
  147. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  148. package/dist/cjs/utils/getPathHash.cjs.map +1 -1
  149. package/dist/cjs/utils/mergeChunks.cjs.map +1 -1
  150. package/dist/cjs/utils/pLimit.cjs.map +1 -1
  151. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  152. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
  153. package/dist/cjs/utils/readDictionariesFromDisk.cjs +0 -1
  154. package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -1
  155. package/dist/cjs/utils/recastBabelParser.cjs +3 -4
  156. package/dist/cjs/utils/recastBabelParser.cjs.map +1 -1
  157. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
  158. package/dist/cjs/utils/resolveObjectPromises.cjs +8 -2
  159. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  160. package/dist/cjs/utils/resolveRelativePath.cjs +0 -1
  161. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  162. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  163. package/dist/cjs/utils/runParallel/bin.cjs +0 -1
  164. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  165. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
  166. package/dist/cjs/utils/runParallel/index.cjs +2 -3
  167. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  168. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
  169. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
  170. package/dist/cjs/utils/runParallel/runTask.cjs +0 -1
  171. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  172. package/dist/cjs/utils/runParallel/spawnPosix.cjs +0 -1
  173. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  174. package/dist/cjs/utils/runParallel/spawnWin32.cjs +0 -1
  175. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  176. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
  177. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  178. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
  179. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
  180. package/dist/cjs/watcher.cjs.map +1 -1
  181. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs.map +1 -1
  182. package/dist/cjs/writeConfiguration/index.cjs +0 -1
  183. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  184. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  185. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  186. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  187. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  188. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +3 -4
  189. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  190. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +0 -1
  191. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  192. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +5 -4
  193. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -1
  194. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +1 -2
  195. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -1
  196. package/dist/cjs/writeFileIfChanged.cjs +0 -1
  197. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  198. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  199. package/dist/esm/_virtual/_utils_asset.mjs +4 -2
  200. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
  201. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  202. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  203. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
  204. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +2 -1
  205. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  206. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +2 -1
  207. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  208. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +4 -2
  209. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  210. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  211. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
  212. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  213. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  214. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
  215. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
  216. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
  217. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
  218. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
  219. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  220. package/dist/esm/createType/createType.mjs.map +1 -1
  221. package/dist/esm/detectFormatCommand.mjs.map +1 -1
  222. package/dist/esm/docReview/alignBlocks.mjs.map +1 -1
  223. package/dist/esm/docReview/computeSimilarity.mjs +1 -1
  224. package/dist/esm/docReview/computeSimilarity.mjs.map +1 -1
  225. package/dist/esm/docReview/fingerprintBlock.mjs +3 -1
  226. package/dist/esm/docReview/fingerprintBlock.mjs.map +1 -1
  227. package/dist/esm/docReview/mapChangedLinesToBlocks.mjs.map +1 -1
  228. package/dist/esm/docReview/normalizeBlock.mjs +4 -2
  229. package/dist/esm/docReview/normalizeBlock.mjs.map +1 -1
  230. package/dist/esm/docReview/pipeline.mjs +3 -2
  231. package/dist/esm/docReview/pipeline.mjs.map +1 -1
  232. package/dist/esm/docReview/planActions.mjs.map +1 -1
  233. package/dist/esm/docReview/rebuildDocument.mjs.map +1 -1
  234. package/dist/esm/docReview/reviewReport.mjs.map +1 -1
  235. package/dist/esm/docReview/segmentDocument.mjs.map +1 -1
  236. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  237. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  238. package/dist/esm/formatDictionary.mjs.map +1 -1
  239. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
  240. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  241. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  242. package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
  243. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
  244. package/dist/esm/init/cms.mjs.map +1 -1
  245. package/dist/esm/init/frameworkSetup/index.mjs.map +1 -1
  246. package/dist/esm/init/frameworkSetup/nextAppRouter/detect.mjs.map +1 -1
  247. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -1
  248. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +4 -3
  249. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs.map +1 -1
  250. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -1
  251. package/dist/esm/init/frameworkSetup/tanstackStart/detect.mjs.map +1 -1
  252. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -1
  253. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +2 -2
  254. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs.map +1 -1
  255. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -1
  256. package/dist/esm/init/index.mjs.map +1 -1
  257. package/dist/esm/init/utils/astImports.mjs.map +1 -1
  258. package/dist/esm/init/utils/configManipulation.mjs +12 -6
  259. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  260. package/dist/esm/init/utils/fileSystem.mjs +1 -1
  261. package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
  262. package/dist/esm/init/utils/githubActions.mjs.map +1 -1
  263. package/dist/esm/init/utils/jsonParser.mjs.map +1 -1
  264. package/dist/esm/init/utils/nextCompilerBabel.mjs.map +1 -1
  265. package/dist/esm/init/utils/packageManager.mjs +4 -2
  266. package/dist/esm/init/utils/packageManager.mjs.map +1 -1
  267. package/dist/esm/init/utils/tsConfig.mjs.map +1 -1
  268. package/dist/esm/init/utils/version.mjs.map +1 -1
  269. package/dist/esm/initConfig/index.mjs.map +1 -1
  270. package/dist/esm/installLSP.mjs.map +1 -1
  271. package/dist/esm/installMCP/installMCP.mjs.map +1 -1
  272. package/dist/esm/installSkills/index.mjs +1 -1
  273. package/dist/esm/installSkills/index.mjs.map +1 -1
  274. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  275. package/dist/esm/listGitFiles.mjs.map +1 -1
  276. package/dist/esm/listProjects.mjs.map +1 -1
  277. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  278. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +3 -2
  279. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  280. package/dist/esm/loadDictionaries/loadDictionaries.mjs +3 -2
  281. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  282. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  283. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs.map +1 -1
  284. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +2 -1
  285. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  286. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs.map +1 -1
  287. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  288. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  289. package/dist/esm/logConfigDetails.mjs +6 -3
  290. package/dist/esm/logConfigDetails.mjs.map +1 -1
  291. package/dist/esm/prepareIntlayer.mjs +2 -1
  292. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  293. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
  294. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  295. package/dist/esm/scan/analyzeBundleContent.mjs.map +1 -1
  296. package/dist/esm/scan/calculateScore.mjs.map +1 -1
  297. package/dist/esm/scan/checks.mjs.map +1 -1
  298. package/dist/esm/scan/parseHtml.mjs.map +1 -1
  299. package/dist/esm/scan/scanWebsite.mjs +2 -1
  300. package/dist/esm/scan/scanWebsite.mjs.map +1 -1
  301. package/dist/esm/syncPluginKit/createFileAdapter.mjs.map +1 -1
  302. package/dist/esm/syncPluginKit/createSyncPlugin.mjs +9 -3
  303. package/dist/esm/syncPluginKit/createSyncPlugin.mjs.map +1 -1
  304. package/dist/esm/syncPluginKit/extractKeyAndLocaleFromPath.mjs.map +1 -1
  305. package/dist/esm/syncPluginKit/filePathPatternHelpers.mjs.map +1 -1
  306. package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
  307. package/dist/esm/utils/buildComponentFilesList.mjs +2 -2
  308. package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -1
  309. package/dist/esm/utils/buildFilesList.mjs +2 -1
  310. package/dist/esm/utils/buildFilesList.mjs.map +1 -1
  311. package/dist/esm/utils/chunkJSON.mjs +2 -1
  312. package/dist/esm/utils/chunkJSON.mjs.map +1 -1
  313. package/dist/esm/utils/formatter.mjs.map +1 -1
  314. package/dist/esm/utils/getChunk.mjs.map +1 -1
  315. package/dist/esm/utils/getContentExtension.mjs.map +1 -1
  316. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
  317. package/dist/esm/utils/getPathHash.mjs.map +1 -1
  318. package/dist/esm/utils/mergeChunks.mjs.map +1 -1
  319. package/dist/esm/utils/pLimit.mjs.map +1 -1
  320. package/dist/esm/utils/parallelize.mjs.map +1 -1
  321. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -1
  322. package/dist/esm/utils/readDictionariesFromDisk.mjs.map +1 -1
  323. package/dist/esm/utils/recastBabelParser.mjs +1 -1
  324. package/dist/esm/utils/recastBabelParser.mjs.map +1 -1
  325. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -1
  326. package/dist/esm/utils/resolveObjectPromises.mjs +8 -2
  327. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
  328. package/dist/esm/utils/resolveRelativePath.mjs.map +1 -1
  329. package/dist/esm/utils/runOnce.mjs.map +1 -1
  330. package/dist/esm/utils/runParallel/bin.mjs.map +1 -1
  331. package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -1
  332. package/dist/esm/utils/runParallel/index.mjs +2 -2
  333. package/dist/esm/utils/runParallel/index.mjs.map +1 -1
  334. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
  335. package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
  336. package/dist/esm/utils/runParallel/runTask.mjs.map +1 -1
  337. package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -1
  338. package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -1
  339. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
  340. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
  341. package/dist/esm/utils/splitTextByLine.mjs.map +1 -1
  342. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -1
  343. package/dist/esm/watcher.mjs.map +1 -1
  344. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs.map +1 -1
  345. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  346. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
  347. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
  348. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  349. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
  350. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +3 -3
  351. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  352. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  353. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +5 -3
  354. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -1
  355. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +1 -1
  356. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -1
  357. package/dist/esm/writeFileIfChanged.mjs.map +1 -1
  358. package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
  359. package/dist/types/build.d.ts +5 -0
  360. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +0 -1
  361. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
  362. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +0 -1
  363. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -1
  364. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +4 -5
  365. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
  366. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +2 -3
  367. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  368. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +0 -1
  369. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
  370. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +0 -1
  371. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
  372. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +1 -2
  373. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
  374. package/dist/types/cleanOutputDir.d.ts +0 -1
  375. package/dist/types/cleanOutputDir.d.ts.map +1 -1
  376. package/dist/types/cleanRemovedContentDeclaration.d.ts +0 -1
  377. package/dist/types/cleanRemovedContentDeclaration.d.ts.map +1 -1
  378. package/dist/types/cli.d.ts +2 -0
  379. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +1 -3
  380. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
  381. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +1 -3
  382. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
  383. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +0 -1
  384. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -1
  385. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +1 -2
  386. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -1
  387. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +1 -2
  388. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -1
  389. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +0 -1
  390. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -1
  391. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +0 -1
  392. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -1
  393. package/dist/types/createType/createModuleAugmentation.d.ts +0 -1
  394. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
  395. package/dist/types/createType/createType.d.ts +0 -1
  396. package/dist/types/createType/createType.d.ts.map +1 -1
  397. package/dist/types/detectFormatCommand.d.ts +0 -1
  398. package/dist/types/detectFormatCommand.d.ts.map +1 -1
  399. package/dist/types/docReview/alignBlocks.d.ts +0 -1
  400. package/dist/types/docReview/alignBlocks.d.ts.map +1 -1
  401. package/dist/types/docReview/computeSimilarity.d.ts.map +1 -1
  402. package/dist/types/docReview/fingerprintBlock.d.ts +0 -1
  403. package/dist/types/docReview/fingerprintBlock.d.ts.map +1 -1
  404. package/dist/types/docReview/mapChangedLinesToBlocks.d.ts +0 -1
  405. package/dist/types/docReview/mapChangedLinesToBlocks.d.ts.map +1 -1
  406. package/dist/types/docReview/normalizeBlock.d.ts +0 -1
  407. package/dist/types/docReview/normalizeBlock.d.ts.map +1 -1
  408. package/dist/types/docReview/pipeline.d.ts +6 -8
  409. package/dist/types/docReview/pipeline.d.ts.map +1 -1
  410. package/dist/types/docReview/planActions.d.ts +0 -1
  411. package/dist/types/docReview/planActions.d.ts.map +1 -1
  412. package/dist/types/docReview/rebuildDocument.d.ts +6 -8
  413. package/dist/types/docReview/rebuildDocument.d.ts.map +1 -1
  414. package/dist/types/docReview/reviewReport.d.ts +23 -14
  415. package/dist/types/docReview/reviewReport.d.ts.map +1 -1
  416. package/dist/types/docReview/segmentDocument.d.ts +0 -1
  417. package/dist/types/docReview/segmentDocument.d.ts.map +1 -1
  418. package/dist/types/docReview/types.d.ts +10 -4
  419. package/dist/types/docReview/types.d.ts.map +1 -1
  420. package/dist/types/fetchDistantDictionaries.d.ts +1 -1
  421. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -1
  422. package/dist/types/filterInvalidDictionaries.d.ts +0 -1
  423. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
  424. package/dist/types/formatDictionary.d.ts +27 -30
  425. package/dist/types/formatDictionary.d.ts.map +1 -1
  426. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +0 -1
  427. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -1
  428. package/dist/types/handleAdditionalContentDeclarationFile.d.ts +0 -1
  429. package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -1
  430. package/dist/types/handleContentDeclarationFileChange.d.ts +0 -1
  431. package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -1
  432. package/dist/types/handleContentDeclarationFileMoved.d.ts +0 -1
  433. package/dist/types/handleContentDeclarationFileMoved.d.ts.map +1 -1
  434. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +0 -1
  435. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -1
  436. package/dist/types/init/cms.d.ts +2 -6
  437. package/dist/types/init/cms.d.ts.map +1 -1
  438. package/dist/types/init/frameworkSetup/index.d.ts +0 -1
  439. package/dist/types/init/frameworkSetup/index.d.ts.map +1 -1
  440. package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts +3 -2
  441. package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts.map +1 -1
  442. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +0 -1
  443. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -1
  444. package/dist/types/init/frameworkSetup/nextAppRouter/restructure.d.ts.map +1 -1
  445. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -1
  446. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -1
  447. package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts +3 -1
  448. package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts.map +1 -1
  449. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +0 -1
  450. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -1
  451. package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts +0 -1
  452. package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts.map +1 -1
  453. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -1
  454. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -1
  455. package/dist/types/init/frameworkSetup/types.d.ts +9 -5
  456. package/dist/types/init/frameworkSetup/types.d.ts.map +1 -1
  457. package/dist/types/init/index.d.ts +7 -3
  458. package/dist/types/init/index.d.ts.map +1 -1
  459. package/dist/types/init/utils/astImports.d.ts.map +1 -1
  460. package/dist/types/init/utils/configManipulation.d.ts +0 -1
  461. package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
  462. package/dist/types/init/utils/fileSystem.d.ts +6 -3
  463. package/dist/types/init/utils/fileSystem.d.ts.map +1 -1
  464. package/dist/types/init/utils/githubActions.d.ts +7 -4
  465. package/dist/types/init/utils/githubActions.d.ts.map +1 -1
  466. package/dist/types/init/utils/jsonParser.d.ts.map +1 -1
  467. package/dist/types/init/utils/nextCompilerBabel.d.ts +2 -8
  468. package/dist/types/init/utils/nextCompilerBabel.d.ts.map +1 -1
  469. package/dist/types/init/utils/packageManager.d.ts +9 -3
  470. package/dist/types/init/utils/packageManager.d.ts.map +1 -1
  471. package/dist/types/init/utils/tsConfig.d.ts.map +1 -1
  472. package/dist/types/init/utils/version.d.ts.map +1 -1
  473. package/dist/types/initConfig/index.d.ts +2 -2
  474. package/dist/types/initConfig/index.d.ts.map +1 -1
  475. package/dist/types/installLSP.d.ts.map +1 -1
  476. package/dist/types/installMCP/installMCP.d.ts +0 -1
  477. package/dist/types/installMCP/installMCP.d.ts.map +1 -1
  478. package/dist/types/installSkills/index.d.ts +14 -14
  479. package/dist/types/installSkills/index.d.ts.map +1 -1
  480. package/dist/types/listDictionariesPath.d.ts +1 -3
  481. package/dist/types/listDictionariesPath.d.ts.map +1 -1
  482. package/dist/types/listGitFiles.d.ts +2 -11
  483. package/dist/types/listGitFiles.d.ts.map +1 -1
  484. package/dist/types/listProjects.d.ts.map +1 -1
  485. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +0 -1
  486. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -1
  487. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +0 -1
  488. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  489. package/dist/types/loadDictionaries/loadDictionaries.d.ts +0 -1
  490. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -1
  491. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +0 -1
  492. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -1
  493. package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts +0 -1
  494. package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts.map +1 -1
  495. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +1 -3
  496. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  497. package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts +0 -1
  498. package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts.map +1 -1
  499. package/dist/types/loadDictionaries/log.d.ts +0 -1
  500. package/dist/types/loadDictionaries/log.d.ts.map +1 -1
  501. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +0 -1
  502. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -1
  503. package/dist/types/logConfigDetails.d.ts +0 -1
  504. package/dist/types/logConfigDetails.d.ts.map +1 -1
  505. package/dist/types/prepareIntlayer.d.ts +0 -1
  506. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  507. package/dist/types/reduceDictionaryContent/applyMask.d.ts +0 -1
  508. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -1
  509. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +0 -1
  510. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -1
  511. package/dist/types/scan/analyzeBundleContent.d.ts +0 -1
  512. package/dist/types/scan/analyzeBundleContent.d.ts.map +1 -1
  513. package/dist/types/scan/calculateScore.d.ts +3 -1
  514. package/dist/types/scan/calculateScore.d.ts.map +1 -1
  515. package/dist/types/scan/checks.d.ts +0 -1
  516. package/dist/types/scan/checks.d.ts.map +1 -1
  517. package/dist/types/scan/parseHtml.d.ts.map +1 -1
  518. package/dist/types/scan/scanWebsite.d.ts +0 -1
  519. package/dist/types/scan/scanWebsite.d.ts.map +1 -1
  520. package/dist/types/scan/types.d.ts +32 -17
  521. package/dist/types/scan/types.d.ts.map +1 -1
  522. package/dist/types/syncPluginKit/createFileAdapter.d.ts +0 -1
  523. package/dist/types/syncPluginKit/createFileAdapter.d.ts.map +1 -1
  524. package/dist/types/syncPluginKit/createSyncPlugin.d.ts +0 -1
  525. package/dist/types/syncPluginKit/createSyncPlugin.d.ts.map +1 -1
  526. package/dist/types/syncPluginKit/extractKeyAndLocaleFromPath.d.ts +0 -1
  527. package/dist/types/syncPluginKit/extractKeyAndLocaleFromPath.d.ts.map +1 -1
  528. package/dist/types/syncPluginKit/filePathPatternHelpers.d.ts +0 -1
  529. package/dist/types/syncPluginKit/filePathPatternHelpers.d.ts.map +1 -1
  530. package/dist/types/syncPluginKit/types.d.ts +8 -4
  531. package/dist/types/syncPluginKit/types.d.ts.map +1 -1
  532. package/dist/types/utils/autoDecorateContent.d.ts.map +1 -1
  533. package/dist/types/utils/buildComponentFilesList.d.ts +0 -1
  534. package/dist/types/utils/buildComponentFilesList.d.ts.map +1 -1
  535. package/dist/types/utils/buildFilesList.d.ts +0 -1
  536. package/dist/types/utils/buildFilesList.d.ts.map +1 -1
  537. package/dist/types/utils/chunkJSON.d.ts.map +1 -1
  538. package/dist/types/utils/formatter.d.ts +0 -1
  539. package/dist/types/utils/formatter.d.ts.map +1 -1
  540. package/dist/types/utils/getChunk.d.ts.map +1 -1
  541. package/dist/types/utils/getContentExtension.d.ts +1 -2
  542. package/dist/types/utils/getContentExtension.d.ts.map +1 -1
  543. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  544. package/dist/types/utils/getPathHash.d.ts.map +1 -1
  545. package/dist/types/utils/mergeChunks.d.ts.map +1 -1
  546. package/dist/types/utils/pLimit.d.ts.map +1 -1
  547. package/dist/types/utils/parallelize.d.ts.map +1 -1
  548. package/dist/types/utils/parallelizeGlobal.d.ts +3 -2
  549. package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -1
  550. package/dist/types/utils/readDictionariesFromDisk.d.ts.map +1 -1
  551. package/dist/types/utils/recastBabelParser.d.ts.map +1 -1
  552. package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -1
  553. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -1
  554. package/dist/types/utils/resolveRelativePath.d.ts.map +1 -1
  555. package/dist/types/utils/runOnce.d.ts.map +1 -1
  556. package/dist/types/utils/runParallel/bin.d.ts +0 -1
  557. package/dist/types/utils/runParallel/bin.d.ts.map +1 -1
  558. package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -1
  559. package/dist/types/utils/runParallel/index.d.ts.map +1 -1
  560. package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -1
  561. package/dist/types/utils/runParallel/ps.d.ts.map +1 -1
  562. package/dist/types/utils/runParallel/runTask.d.ts.map +1 -1
  563. package/dist/types/utils/runParallel/spawnPosix.d.ts +0 -1
  564. package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -1
  565. package/dist/types/utils/runParallel/spawnWin32.d.ts +0 -1
  566. package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -1
  567. package/dist/types/utils/runParallel/wmic.d.ts.map +1 -1
  568. package/dist/types/utils/sortAlphabetically.d.ts.map +1 -1
  569. package/dist/types/utils/splitTextByLine.d.ts.map +1 -1
  570. package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -1
  571. package/dist/types/watcher.d.ts +0 -1
  572. package/dist/types/watcher.d.ts.map +1 -1
  573. package/dist/types/writeConfiguration/generateConfigurationContent.d.ts +1 -2
  574. package/dist/types/writeConfiguration/generateConfigurationContent.d.ts.map +1 -1
  575. package/dist/types/writeConfiguration/index.d.ts +0 -1
  576. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  577. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -1
  578. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -1
  579. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +0 -1
  580. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -1
  581. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +0 -1
  582. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -1
  583. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts +0 -1
  584. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -1
  585. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +0 -1
  586. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  587. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +0 -1
  588. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -1
  589. package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts +0 -1
  590. package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts.map +1 -1
  591. package/dist/types/writeContentDeclaration/writeYamlFile.d.ts +0 -1
  592. package/dist/types/writeContentDeclaration/writeYamlFile.d.ts.map +1 -1
  593. package/dist/types/writeFileIfChanged.d.ts +4 -6
  594. package/dist/types/writeFileIfChanged.d.ts.map +1 -1
  595. package/dist/types/writeJsonIfChanged.d.ts +1 -3
  596. package/dist/types/writeJsonIfChanged.d.ts.map +1 -1
  597. package/package.json +20 -13
@@ -1 +1 @@
1
- {"version":3,"file":"loadDictionaries.mjs","names":["logger"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const resolvedPlugins = await Promise.all(plugins ?? []);\n\n const pluginsWithLoadDictionaries = resolvedPlugins.filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":";;;;;;;;;AA8BA,IAAI,yBAA+C,EAAE;AACrD,MAAMA,WAAS,IAAI,oBAAoB;AAEvC,MAAM,6BAA6B,aAAmC;CACpE,MAAM,UAAgC,CAAC,GAAG,uBAAuB;AAEjE,MAAK,MAAM,YAAY,UAA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GAGd;CAED,MAAM,qBAAmC,MAAM,QAAQ,IACrD,8BACD,CACE,MAAM,iBAAiB,aAAa,MAAM,CAAC,CAC3C,MAAM,iBACL,0BAA0B,cAAc,cAAc,CACvD,CACA,MAAM,iBAAiB,mBAAmB,aAAa,CAAC;AAE3D,UAAO,eAAe,mBAAmB,OAAO;AAChD,UAAO,cAAc,mBAAmB,OAAO;CAE/C,MAAM,yBAAyB,KAAK,KAAK;CAMzC,MAAM,oBAAkC,MAAM,wBAJhC,MAAM,QAAQ,yBAAyB,GACjD,2BACA,CAAC,yBAAyB,EAI5B,eACA,0BACD,CACE,MAAM,iBACL,0BAA0B,cAAc,cAAc,CACvD,CACA,MAAM,iBAAiB,mBAAmB,aAAa,CAAC;CAE3D,MAAM,wBAAwB,KAAK,KAAK;AAWxC,2BATgC,kBAAkB,KAC/C,gBACE;EACC,eAAe,WAAW;EAC1B,MAAM;EACN,QAAQ;EACT,EAG4C,CAAC;CAElD,MAAM,wBAAwB,QAC5B,cAAc,OAAO,YAAY,cAAc,OAAO,aACvD;AAED,KAAI,sBAEF,UAAO,gBAAgB,KAAK;CAG9B,IAAI,qBAAmC,EAAE;AAEzC,KAAI,sBACF,sBAAqB,MAAM,uBACzB,eACA,2BACA;EACE,0BAA0BA,SAAO,kBAAkB;EACnD,yBAAyBA,SAAO,iBAAiB;EACjD,UAAU,MAAMA,SAAO,eAAe,EAAE;EACzC,CACF,CACE,MAAM,iBACL,0BAA0B,cAAc,cAAc,CACvD,CACA,MAAM,iBAAiB,mBAAmB,aAAa,CAAC;CAG7D,MAAM,yBAAyB,KAAK,KAAK;AAGzC,UAAO,QAAQ;AAEf,cAAa,cAAc;AAE3B,QAAO;EACL;EACA;EACA;EACA,MAAM;GACJ,mBAAmB,wBAAwB;GAC3C,oBAAoB,yBAAyB;GAC7C,oBAAoB,yBAAyB;GAC9C;EACF"}
1
+ {"version":3,"file":"loadDictionaries.mjs","names":["logger"],"sources":["../../../src/loadDictionaries/loadDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colon,\n colorize,\n colorizeKey,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { filterInvalidDictionaries } from '../filterInvalidDictionaries';\nimport { formatDictionaries } from '../formatDictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\nimport { loadRemoteDictionaries } from './loadRemoteDictionaries';\nimport { DictionariesLogger } from './log';\n\nexport type DictionariesStatus = {\n dictionaryKey: string;\n type: 'local' | 'remote';\n status:\n | 'pending' // Key found but not fetched yet\n | 'fetching' // If dictionary fetch is in progress\n | 'fetched' // If dictionary fetch succeeded\n | 'error' // If dictionary fetch failed\n | 'imported' // If dictionary already fetched and still up to date\n | 'found' // If dictionary key is found but promise is not resolved yet (ex: fetching distant content)\n | 'building' // If dictionary is being built\n | 'built'; // If dictionary is built;\n error?: string;\n};\n\nlet loadDictionariesStatus: DictionariesStatus[] = [];\nconst logger = new DictionariesLogger();\n\nconst setLoadDictionariesStatus = (statuses: DictionariesStatus[]) => {\n const updated: DictionariesStatus[] = [...loadDictionariesStatus];\n\n for (const incoming of statuses) {\n const index = updated.findIndex(\n (s) =>\n s.dictionaryKey === incoming.dictionaryKey && s.type === incoming.type\n );\n if (index >= 0) {\n updated[index] = incoming;\n } else {\n updated.push(incoming);\n }\n }\n\n loadDictionariesStatus = updated;\n logger.update(statuses);\n\n return updated;\n};\n\ntype StatusRecord = {\n local?: DictionariesStatus['status'];\n remote?: DictionariesStatus['status'];\n};\n\nconst iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n};\n\nconst colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'built':\n case 'imported':\n case 'fetched':\n return ANSIColors.GREEN;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n};\n\nconst printSummary = (configuration: IntlayerConfig) => {\n if (configuration.log.mode !== 'verbose') return;\n\n const appLogger = getAppLogger(configuration);\n\n // Aggregate by dictionary key\n const byKey = new Map<string, StatusRecord>();\n for (const status of loadDictionariesStatus) {\n const rec = byKey.get(status.dictionaryKey) ?? {};\n if (status.type === 'local') rec.local = status.status;\n if (status.type === 'remote') rec.remote = status.status;\n byKey.set(status.dictionaryKey, rec);\n }\n\n const keys = Array.from(byKey.keys()).sort((a, b) => a.localeCompare(b));\n\n // Compute the max visible length of the local label to align distant labels\n let maxLocalLabelLen = 0;\n for (const key of keys) {\n const rec = byKey.get(key)!;\n if (rec.local) {\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n if (visibleLocal.length > maxLocalLabelLen) {\n maxLocalLabelLen = visibleLocal.length;\n }\n }\n }\n\n for (const key of keys) {\n const rec = byKey.get(key)!;\n const labels: string[] = [];\n\n if (rec.local) {\n const inner = colorize(\n `${iconFor(rec.local)} ${rec.local}`,\n colorFor(rec.local)\n );\n const coloredLocal =\n `${ANSIColors.GREY}[` +\n colorize('local: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`;\n\n // Pad to align distant label across rows\n const visibleLocal = `[local: ${iconFor(rec.local)} ${rec.local}]`;\n const pad = Math.max(0, maxLocalLabelLen - visibleLocal.length);\n labels.push(coloredLocal + ' '.repeat(pad));\n } else {\n // If no local label, insert spaces to keep distant aligned\n labels.push(' '.repeat(maxLocalLabelLen));\n }\n\n if (rec.remote) {\n const inner = colorize(\n `${iconFor(rec.remote)} ${rec.remote}`,\n colorFor(rec.remote)\n );\n labels.push(\n `${ANSIColors.GREY}[` +\n colorize('distant: ', ANSIColors.GREY) +\n inner +\n `${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n appLogger(\n ` - ${colon(colorizeKey(key), { colSize: keys })} ${labels.join(' ')}`\n );\n }\n};\n\nexport const loadDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<{\n localDictionaries: Dictionary[];\n remoteDictionaries: Dictionary[];\n pluginDictionaries: Dictionary[];\n time: {\n localDictionaries: number;\n remoteDictionaries: number;\n pluginDictionaries: number;\n };\n}> => {\n const { plugins } = configuration;\n const loadDictionariesStartTime = Date.now();\n const appLogger = getAppLogger(configuration);\n\n appLogger('Dictionaries:', { isVerbose: true });\n\n // Load additional dictionaries via plugins (e.g., ICU JSON ingestion)\n const resolvedPlugins = await Promise.all(plugins ?? []);\n\n const pluginsWithLoadDictionaries = resolvedPlugins.filter(\n (plugin) => plugin.loadDictionaries\n );\n\n const loadPluginDictionariesPromise = pluginsWithLoadDictionaries.map(\n async (plugin) => {\n try {\n const res = await plugin.loadDictionaries?.({\n configuration,\n });\n\n return (res as Dictionary[] | undefined) ?? [];\n } catch (error) {\n logger.setPluginError(error as Error);\n\n return [];\n }\n }\n );\n\n const pluginDictionaries: Dictionary[] = await Promise.all(\n loadPluginDictionariesPromise as Promise<Dictionary[]>[]\n )\n .then((dictionaries) => dictionaries.flat())\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n logger.setPluginTotal(pluginDictionaries.length);\n logger.setPluginDone(pluginDictionaries.length);\n\n const pluginDictionariesTime = Date.now();\n\n const files = Array.isArray(contentDeclarationsPaths)\n ? contentDeclarationsPaths\n : [contentDeclarationsPaths];\n\n const localDictionaries: Dictionary[] = await loadContentDeclarations(\n files,\n configuration,\n setLoadDictionariesStatus\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n\n const localDictionariesTime = Date.now();\n\n const localDictionariesStatus = localDictionaries.map(\n (dictionary) =>\n ({\n dictionaryKey: dictionary.key,\n type: 'local',\n status: 'built',\n }) as const\n );\n\n setLoadDictionariesStatus(localDictionariesStatus);\n\n const hasRemoteDictionaries = Boolean(\n configuration.editor.clientId && configuration.editor.clientSecret\n );\n\n if (hasRemoteDictionaries) {\n // We expect to fetch remote dictionaries soon; suppress a transient local-only render\n logger.setExpectRemote(true);\n }\n\n let remoteDictionaries: Dictionary[] = [];\n\n if (hasRemoteDictionaries) {\n remoteDictionaries = await loadRemoteDictionaries(\n configuration,\n setLoadDictionariesStatus,\n {\n onStartRemoteCheck: () => logger.startRemoteCheck(),\n onStopRemoteCheck: () => logger.stopRemoteCheck(),\n onError: (e) => logger.setRemoteError(e),\n }\n )\n .then((dictionaries) =>\n filterInvalidDictionaries(dictionaries, configuration)\n )\n .then((dictionaries) => formatDictionaries(dictionaries));\n }\n\n const remoteDictionariesTime = Date.now();\n\n // Stop spinner and show final progress line(s)\n logger.finish();\n\n printSummary(configuration);\n\n return {\n localDictionaries,\n remoteDictionaries,\n pluginDictionaries,\n time: {\n localDictionaries: localDictionariesTime - pluginDictionariesTime,\n remoteDictionaries: remoteDictionariesTime - localDictionariesTime,\n pluginDictionaries: pluginDictionariesTime - loadDictionariesStartTime,\n },\n };\n};\n"],"mappings":";;;;;;;;;AA8BA,IAAI,yBAA+C,CAAC;AACpD,MAAMA,WAAS,IAAI,mBAAmB;AAEtC,MAAM,6BAA6B,aAAmC;CACpE,MAAM,UAAgC,CAAC,GAAG,sBAAsB;CAEhE,KAAK,MAAM,YAAY,UAAU;EAC/B,MAAM,QAAQ,QAAQ,WACnB,MACC,EAAE,kBAAkB,SAAS,iBAAiB,EAAE,SAAS,SAAS,IACtE;EACA,IAAI,SAAS,GACX,QAAQ,SAAS;OAEjB,QAAQ,KAAK,QAAQ;CAEzB;CAEA,yBAAyB;CACzB,SAAO,OAAO,QAAQ;CAEtB,OAAO;AACT;AAOA,MAAM,WAAW,WAAyC;CACxD,QAAQ,QAAR;EACE,KAAK;EACL,KAAK;EACL,KAAK,WACH,OAAO;EACT,KAAK,SACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAEA,MAAM,YAAY,WAAyC;CACz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CAMxC,MAAM,oBAAkC,MAAM,wBAJhC,MAAM,QAAQ,wBAAwB,IAChD,2BACA,CAAC,wBAAwB,GAI3B,eACA,yBACF,CAAC,CACE,MAAM,iBACL,0BAA0B,cAAc,aAAa,CACvD,CAAC,CACA,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;CAE1D,MAAM,wBAAwB,KAAK,IAAI;CAEvC,MAAM,0BAA0B,kBAAkB,KAC/C,gBACE;EACC,eAAe,WAAW;EAC1B,MAAM;EACN,QAAQ;CACV,EACJ;CAEA,0BAA0B,uBAAuB;CAEjD,MAAM,wBAAwB,QAC5B,cAAc,OAAO,YAAY,cAAc,OAAO,YACxD;CAEA,IAAI,uBAEF,SAAO,gBAAgB,IAAI;CAG7B,IAAI,qBAAmC,CAAC;CAExC,IAAI,uBACF,qBAAqB,MAAM,uBACzB,eACA,2BACA;EACE,0BAA0BA,SAAO,iBAAiB;EAClD,yBAAyBA,SAAO,gBAAgB;EAChD,UAAU,MAAMA,SAAO,eAAe,CAAC;CACzC,CACF,CAAC,CACE,MAAM,iBACL,0BAA0B,cAAc,aAAa,CACvD,CAAC,CACA,MAAM,iBAAiB,mBAAmB,YAAY,CAAC;CAG5D,MAAM,yBAAyB,KAAK,IAAI;CAGxC,SAAO,OAAO;CAEd,aAAa,aAAa;CAE1B,OAAO;EACL;EACA;EACA;EACA,MAAM;GACJ,mBAAmB,wBAAwB;GAC3C,oBAAoB,yBAAyB;GAC7C,oBAAoB,yBAAyB;EAC/C;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadLocalDictionaries.mjs","names":[],"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<Dictionary[]> => {\n const { system } = configuration;\n const { dictionariesDir, baseDir } = system;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations(\n [contentDeclarationPath],\n configuration\n );\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":";;;;;AAMA,MAAa,wBAAwB,OACnC,0BACA,kBAC0B;CAC1B,MAAM,EAAE,WAAW;CACnB,MAAM,EAAE,iBAAiB,YAAY;AAErC,KAAI,OAAO,6BAA6B,SACtC,4BAA2B,CAAC,yBAAyB;AAIvD,OAAM,MAAM,QAAQ,gBAAgB,EAAE,EAAE,WAAW,MAAM,CAAC;CAE1D,MAAM,SAAuB,EAAE;AAE/B,YAAW,MAAM,0BAA0B,0BAA0B;EACnE,MAAM,aAAa,MAAM,wBACvB,CAAC,uBAAuB,EACxB,cACD;EAED,MAAM,mBAAmB,SAAS,SAAS,uBAAuB;EAElE,MAAM,qBAAiC;GACrC,GAAG,WAAW;GACd,UAAU;GACX;AAED,SAAO,KAAK,mBAAmB;;AAGjC,QAAO"}
1
+ {"version":3,"file":"loadLocalDictionaries.mjs","names":[],"sources":["../../../src/loadDictionaries/loadLocalDictionaries.ts"],"sourcesContent":["import { mkdir } from 'node:fs/promises';\nimport { relative, resolve } from 'node:path';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { loadContentDeclarations } from './loadContentDeclaration';\n\nexport const loadLocalDictionaries = async (\n contentDeclarationsPaths: string[] | string,\n configuration: IntlayerConfig\n): Promise<Dictionary[]> => {\n const { system } = configuration;\n const { dictionariesDir, baseDir } = system;\n\n if (typeof contentDeclarationsPaths === 'string') {\n contentDeclarationsPaths = [contentDeclarationsPaths];\n }\n\n // Create the dictionaries folder if it doesn't exist\n await mkdir(resolve(dictionariesDir), { recursive: true });\n\n const result: Dictionary[] = [];\n\n for await (const contentDeclarationPath of contentDeclarationsPaths) {\n const dictionary = await loadContentDeclarations(\n [contentDeclarationPath],\n configuration\n );\n\n const relativeFilePath = relative(baseDir, contentDeclarationPath);\n\n const dictionaryWithPath: Dictionary = {\n ...dictionary[0],\n filePath: relativeFilePath,\n };\n\n result.push(dictionaryWithPath);\n }\n\n return result;\n};\n"],"mappings":";;;;;AAMA,MAAa,wBAAwB,OACnC,0BACA,kBAC0B;CAC1B,MAAM,EAAE,WAAW;CACnB,MAAM,EAAE,iBAAiB,YAAY;CAErC,IAAI,OAAO,6BAA6B,UACtC,2BAA2B,CAAC,wBAAwB;CAItD,MAAM,MAAM,QAAQ,eAAe,GAAG,EAAE,WAAW,KAAK,CAAC;CAEzD,MAAM,SAAuB,CAAC;CAE9B,WAAW,MAAM,0BAA0B,0BAA0B;EACnE,MAAM,aAAa,MAAM,wBACvB,CAAC,sBAAsB,GACvB,aACF;EAEA,MAAM,mBAAmB,SAAS,SAAS,sBAAsB;EAEjE,MAAM,qBAAiC;GACrC,GAAG,WAAW;GACd,UAAU;EACZ;EAEA,OAAO,KAAK,kBAAkB;CAChC;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadMarkdownContentDeclaration.mjs","names":[],"sources":["../../../src/loadDictionaries/loadMarkdownContentDeclaration.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { MARKDOWN } from '@intlayer/types/nodeType';\n\ntype MarkdownFrontmatter = {\n key?: string;\n locale?: string;\n title?: string;\n description?: string;\n tags?: string[];\n fill?: any;\n importMode?: string;\n location?: string;\n priority?: number;\n version?: string;\n [key: string]: any;\n};\n\nexport const loadMarkdownContentDeclaration = async (\n path: string\n): Promise<Dictionary | undefined> => {\n try {\n const fileContent = await readFile(path, 'utf-8');\n const frontmatter = getMarkdownMetadata<MarkdownFrontmatter>(fileContent);\n\n // Derive key from filename (e.g. \"my-doc.content.md\" → \"my-doc\") if not in frontmatter\n const fileName = basename(path).replace(/\\.content\\.md$/, '');\n const key = frontmatter.key ?? fileName;\n\n if (!key) {\n console.error(\n `[intlayer] Missing key in markdown content declaration: ${path}`\n );\n return undefined;\n }\n\n const {\n key: _key,\n locale,\n title,\n description,\n tags,\n fill,\n importMode,\n location,\n priority,\n version,\n } = frontmatter;\n\n return {\n key,\n ...(locale !== undefined && { locale }),\n ...(title !== undefined && { title }),\n ...(description !== undefined && { description }),\n ...(tags !== undefined && { tags }),\n ...(fill !== undefined && { fill }),\n ...(importMode !== undefined && { importMode }),\n ...(location !== undefined && { location }),\n ...(priority !== undefined && { priority }),\n ...(version !== undefined && { version }),\n content: {\n nodeType: MARKDOWN,\n [MARKDOWN]: fileContent,\n metadata: frontmatter,\n },\n } as Dictionary;\n } catch (error) {\n console.error(\n `Error loading markdown content declaration at ${path}:`,\n error\n );\n return undefined;\n }\n};\n"],"mappings":";;;;;;AAoBA,MAAa,iCAAiC,OAC5C,SACoC;AACpC,KAAI;EACF,MAAM,cAAc,MAAM,SAAS,MAAM,QAAQ;EACjD,MAAM,cAAc,oBAAyC,YAAY;EAGzE,MAAM,WAAW,SAAS,KAAK,CAAC,QAAQ,kBAAkB,GAAG;EAC7D,MAAM,MAAM,YAAY,OAAO;AAE/B,MAAI,CAAC,KAAK;AACR,WAAQ,MACN,2DAA2D,OAC5D;AACD;;EAGF,MAAM,EACJ,KAAK,MACL,QACA,OACA,aACA,MACA,MACA,YACA,UACA,UACA,YACE;AAEJ,SAAO;GACL;GACA,GAAI,WAAW,UAAa,EAAE,QAAQ;GACtC,GAAI,UAAU,UAAa,EAAE,OAAO;GACpC,GAAI,gBAAgB,UAAa,EAAE,aAAa;GAChD,GAAI,SAAS,UAAa,EAAE,MAAM;GAClC,GAAI,SAAS,UAAa,EAAE,MAAM;GAClC,GAAI,eAAe,UAAa,EAAE,YAAY;GAC9C,GAAI,aAAa,UAAa,EAAE,UAAU;GAC1C,GAAI,aAAa,UAAa,EAAE,UAAU;GAC1C,GAAI,YAAY,UAAa,EAAE,SAAS;GACxC,SAAS;IACP,UAAU;KACT,WAAW;IACZ,UAAU;IACX;GACF;UACM,OAAO;AACd,UAAQ,MACN,iDAAiD,KAAK,IACtD,MACD;AACD"}
1
+ {"version":3,"file":"loadMarkdownContentDeclaration.mjs","names":[],"sources":["../../../src/loadDictionaries/loadMarkdownContentDeclaration.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { basename } from 'node:path';\nimport { getMarkdownMetadata } from '@intlayer/core/markdown';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { MARKDOWN } from '@intlayer/types/nodeType';\n\ntype MarkdownFrontmatter = {\n key?: string;\n locale?: string;\n title?: string;\n description?: string;\n tags?: string[];\n fill?: any;\n importMode?: string;\n location?: string;\n priority?: number;\n version?: string;\n [key: string]: any;\n};\n\nexport const loadMarkdownContentDeclaration = async (\n path: string\n): Promise<Dictionary | undefined> => {\n try {\n const fileContent = await readFile(path, 'utf-8');\n const frontmatter = getMarkdownMetadata<MarkdownFrontmatter>(fileContent);\n\n // Derive key from filename (e.g. \"my-doc.content.md\" → \"my-doc\") if not in frontmatter\n const fileName = basename(path).replace(/\\.content\\.md$/, '');\n const key = frontmatter.key ?? fileName;\n\n if (!key) {\n console.error(\n `[intlayer] Missing key in markdown content declaration: ${path}`\n );\n return undefined;\n }\n\n const {\n key: _key,\n locale,\n title,\n description,\n tags,\n fill,\n importMode,\n location,\n priority,\n version,\n } = frontmatter;\n\n return {\n key,\n ...(locale !== undefined && { locale }),\n ...(title !== undefined && { title }),\n ...(description !== undefined && { description }),\n ...(tags !== undefined && { tags }),\n ...(fill !== undefined && { fill }),\n ...(importMode !== undefined && { importMode }),\n ...(location !== undefined && { location }),\n ...(priority !== undefined && { priority }),\n ...(version !== undefined && { version }),\n content: {\n nodeType: MARKDOWN,\n [MARKDOWN]: fileContent,\n metadata: frontmatter,\n },\n } as Dictionary;\n } catch (error) {\n console.error(\n `Error loading markdown content declaration at ${path}:`,\n error\n );\n return undefined;\n }\n};\n"],"mappings":";;;;;;AAoBA,MAAa,iCAAiC,OAC5C,SACoC;CACpC,IAAI;EACF,MAAM,cAAc,MAAM,SAAS,MAAM,OAAO;EAChD,MAAM,cAAc,oBAAyC,WAAW;EAGxE,MAAM,WAAW,SAAS,IAAI,CAAC,CAAC,QAAQ,kBAAkB,EAAE;EAC5D,MAAM,MAAM,YAAY,OAAO;EAE/B,IAAI,CAAC,KAAK;GACR,QAAQ,MACN,2DAA2D,MAC7D;GACA;EACF;EAEA,MAAM,EACJ,KAAK,MACL,QACA,OACA,aACA,MACA,MACA,YACA,UACA,UACA,YACE;EAEJ,OAAO;GACL;GACA,GAAI,WAAW,UAAa,EAAE,OAAO;GACrC,GAAI,UAAU,UAAa,EAAE,MAAM;GACnC,GAAI,gBAAgB,UAAa,EAAE,YAAY;GAC/C,GAAI,SAAS,UAAa,EAAE,KAAK;GACjC,GAAI,SAAS,UAAa,EAAE,KAAK;GACjC,GAAI,eAAe,UAAa,EAAE,WAAW;GAC7C,GAAI,aAAa,UAAa,EAAE,SAAS;GACzC,GAAI,aAAa,UAAa,EAAE,SAAS;GACzC,GAAI,YAAY,UAAa,EAAE,QAAQ;GACvC,SAAS;IACP,UAAU;KACT,WAAW;IACZ,UAAU;GACZ;EACF;CACF,SAAS,OAAO;EACd,QAAQ,MACN,iDAAiD,KAAK,IACtD,KACF;EACA;CACF;AACF"}
@@ -45,7 +45,8 @@ const loadRemoteDictionaries = async (configuration = getConfiguration(), onStat
45
45
  type: "remote",
46
46
  status: "pending"
47
47
  })));
48
- const distantDictionaries = formatDistantDictionaries(await fetchDistantDictionaries({ dictionaryKeys: orderedDistantDictionaryKeys }, onStatusUpdate));
48
+ const distantDictionariesData = await fetchDistantDictionaries({ dictionaryKeys: orderedDistantDictionaryKeys }, onStatusUpdate);
49
+ const distantDictionaries = formatDistantDictionaries(distantDictionariesData);
49
50
  return [...cachedDictionaries, ...distantDictionaries];
50
51
  } catch (error) {
51
52
  options?.onError?.(error);
@@ -1 +1 @@
1
- {"version":3,"file":"loadRemoteDictionaries.mjs","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["import { createIntlayerCMS } from '@intlayer/api';\nimport { dictionaryEndpoint } from '@intlayer/api/dictionary';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getRemoteDictionaries } from '@intlayer/remote-dictionaries-entry';\nimport type {\n Dictionary,\n DictionaryId,\n DictionaryKey,\n} from '@intlayer/types/dictionary';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatDistantDictionaries = (\n dictionaries: (DictionaryAPI | Dictionary)[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'remote' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void,\n options?: {\n onStartRemoteCheck?: () => void;\n onStopRemoteCheck?: () => void;\n onError?: (error: Error) => void;\n }\n): Promise<Dictionary[]> => {\n const { editor } = configuration;\n const remoteDictionariesRecord = getRemoteDictionaries(configuration);\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n options?.onStartRemoteCheck?.();\n\n const dictionary = dictionaryEndpoint(createIntlayerCMS(configuration));\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await dictionary.getDictionariesUpdateTimestamp();\n\n const distantDictionaryUpdateTimeStamp: Record<\n DictionaryId,\n { key: DictionaryKey; updatedAt: number }\n > | null = getDictionariesKeysResult.data;\n\n if (!distantDictionaryUpdateTimeStamp) {\n throw new Error('No distant dictionaries found');\n }\n\n const dictionariesIdToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n ).filter(([dictionaryId, data]) => {\n // If remote doesn't provide updatedAt, fetch to be safe\n if (!data.updatedAt) return true;\n\n // If no local cache exists, fetch\n const local: Dictionary | undefined = remoteDictionariesRecord[\n data.key\n ]?.find((dictionary) => dictionary.id === dictionaryId);\n if (!local) return true;\n\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // If local timestamp missing or older than remote, fetch\n if (typeof localUpdatedAt !== 'number') return true;\n\n return data.updatedAt > localUpdatedAt;\n });\n\n const flatRemoteDictionariesRecord: DictionaryAPI[] = Object.values(\n remoteDictionariesRecord\n ).flat();\n\n const cachedDictionaries: Dictionary[] =\n flatRemoteDictionariesRecord.filter((dictionary) => {\n const remoteUpdatedAt =\n distantDictionaryUpdateTimeStamp[dictionary.id!].updatedAt;\n\n const localUpdatedAtRaw = dictionary.updatedAt;\n\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // Consider as cached/imported when local exists and is up-to-date or newer\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n });\n\n // Report cached as already imported\n if (cachedDictionaries.length > 0) {\n onStatusUpdate?.(\n cachedDictionaries.map((dictionary) => ({\n dictionaryKey: dictionary.key,\n type: 'remote',\n status: 'imported',\n }))\n );\n }\n\n const orderedDistantDictionaryKeys = dictionariesIdToFetch\n .map(([, data]) => data.key)\n .sort(sortAlphabetically);\n\n // Report pending for keys to be fetched so totals are visible immediately\n if (orderedDistantDictionaryKeys.length > 0) {\n onStatusUpdate?.(\n orderedDistantDictionaryKeys.map((key) => ({\n dictionaryKey: key,\n type: 'remote',\n status: 'pending',\n }))\n );\n }\n\n const distantDictionariesData = await fetchDistantDictionaries(\n {\n dictionaryKeys: orderedDistantDictionaryKeys,\n },\n onStatusUpdate\n );\n\n const distantDictionaries: Dictionary[] = formatDistantDictionaries(\n distantDictionariesData\n );\n\n return [...cachedDictionaries, ...distantDictionaries];\n } catch (error) {\n options?.onError?.(error as Error);\n return [];\n } finally {\n options?.onStopRemoteCheck?.();\n }\n};\n"],"mappings":";;;;;;;;AAeA,MAAa,6BACX,iBAEA,aAAa,KAAK,UAAU;CAC1B,GAAG;CACH,SAAS,GAAG,KAAK,IAAI,YAAY,KAAK;CACtC,UAAU;CACX,EAAE;AAEL,MAAa,yBAAyB,OACpC,gBAAgB,kBAAkB,EAClC,gBACA,YAK0B;CAC1B,MAAM,EAAE,WAAW;CACnB,MAAM,2BAA2B,sBAAsB,cAAc;AAIrE,KAAI,CAF0B,QAAQ,OAAO,YAAY,OAAO,aAEtC,CAAE,QAAO,EAAE;AAErC,KAAI;AACF,WAAS,sBAAsB;EAQ/B,MAAM,oCAGK,MATQ,mBAAmB,kBAAkB,cAAc,CAIpD,CAAC,gCAAgC,EAKd;AAErC,MAAI,CAAC,iCACH,OAAM,IAAI,MAAM,gCAAgC;EAGlD,MAAM,wBAAwB,OAAO,QACnC,iCACD,CAAC,QAAQ,CAAC,cAAc,UAAU;AAEjC,OAAI,CAAC,KAAK,UAAW,QAAO;GAG5B,MAAM,QAAgC,yBACpC,KAAK,MACJ,MAAM,eAAe,WAAW,OAAO,aAAa;AACvD,OAAI,CAAC,MAAO,QAAO;GAEnB,MAAM,oBAAqB,OAAe;GAK1C,MAAM,iBACJ,OAAO,sBAAsB,WACzB,oBACA,oBACE,IAAI,KAAK,kBAAkB,CAAC,SAAS,GACrC;AAGR,OAAI,OAAO,mBAAmB,SAAU,QAAO;AAE/C,UAAO,KAAK,YAAY;IACxB;EAMF,MAAM,qBAJgD,OAAO,OAC3D,yBACD,CAAC,MAG4B,CAAC,QAAQ,eAAe;GAClD,MAAM,kBACJ,iCAAiC,WAAW,IAAK;GAEnD,MAAM,oBAAoB,WAAW;GAErC,MAAM,iBACJ,OAAO,sBAAsB,WACzB,oBACA,oBACE,IAAI,KAAK,kBAAkB,CAAC,SAAS,GACrC;AAGR,UACE,OAAO,mBAAmB,YAC1B,OAAO,oBAAoB,YAC3B,kBAAkB;IAEpB;AAGJ,MAAI,mBAAmB,SAAS,EAC9B,kBACE,mBAAmB,KAAK,gBAAgB;GACtC,eAAe,WAAW;GAC1B,MAAM;GACN,QAAQ;GACT,EAAE,CACJ;EAGH,MAAM,+BAA+B,sBAClC,KAAK,GAAG,UAAU,KAAK,IAAI,CAC3B,KAAK,mBAAmB;AAG3B,MAAI,6BAA6B,SAAS,EACxC,kBACE,6BAA6B,KAAK,SAAS;GACzC,eAAe;GACf,MAAM;GACN,QAAQ;GACT,EAAE,CACJ;EAUH,MAAM,sBAAoC,0BACxC,MARoC,yBACpC,EACE,gBAAgB,8BACjB,EACD,eACD,CAIA;AAED,SAAO,CAAC,GAAG,oBAAoB,GAAG,oBAAoB;UAC/C,OAAO;AACd,WAAS,UAAU,MAAe;AAClC,SAAO,EAAE;WACD;AACR,WAAS,qBAAqB"}
1
+ {"version":3,"file":"loadRemoteDictionaries.mjs","names":[],"sources":["../../../src/loadDictionaries/loadRemoteDictionaries.ts"],"sourcesContent":["import { createIntlayerCMS } from '@intlayer/api';\nimport { dictionaryEndpoint } from '@intlayer/api/dictionary';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/node';\nimport { getRemoteDictionaries } from '@intlayer/remote-dictionaries-entry';\nimport type {\n Dictionary,\n DictionaryId,\n DictionaryKey,\n} from '@intlayer/types/dictionary';\nimport { fetchDistantDictionaries } from '../fetchDistantDictionaries';\nimport { sortAlphabetically } from '../utils/sortAlphabetically';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport const formatDistantDictionaries = (\n dictionaries: (DictionaryAPI | Dictionary)[]\n): Dictionary[] =>\n dictionaries.map((dict) => ({\n ...dict,\n localId: `${dict.key}::remote::${dict.id}`,\n location: 'remote' as const,\n }));\n\nexport const loadRemoteDictionaries = async (\n configuration = getConfiguration(),\n onStatusUpdate?: (status: DictionariesStatus[]) => void,\n options?: {\n onStartRemoteCheck?: () => void;\n onStopRemoteCheck?: () => void;\n onError?: (error: Error) => void;\n }\n): Promise<Dictionary[]> => {\n const { editor } = configuration;\n const remoteDictionariesRecord = getRemoteDictionaries(configuration);\n\n const hasRemoteDictionaries = Boolean(editor.clientId && editor.clientSecret);\n\n if (!hasRemoteDictionaries) return [];\n\n try {\n options?.onStartRemoteCheck?.();\n\n const dictionary = dictionaryEndpoint(createIntlayerCMS(configuration));\n\n // Get the list of dictionary keys\n const getDictionariesKeysResult =\n await dictionary.getDictionariesUpdateTimestamp();\n\n const distantDictionaryUpdateTimeStamp: Record<\n DictionaryId,\n { key: DictionaryKey; updatedAt: number }\n > | null = getDictionariesKeysResult.data;\n\n if (!distantDictionaryUpdateTimeStamp) {\n throw new Error('No distant dictionaries found');\n }\n\n const dictionariesIdToFetch = Object.entries(\n distantDictionaryUpdateTimeStamp\n ).filter(([dictionaryId, data]) => {\n // If remote doesn't provide updatedAt, fetch to be safe\n if (!data.updatedAt) return true;\n\n // If no local cache exists, fetch\n const local: Dictionary | undefined = remoteDictionariesRecord[\n data.key\n ]?.find((dictionary) => dictionary.id === dictionaryId);\n if (!local) return true;\n\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // If local timestamp missing or older than remote, fetch\n if (typeof localUpdatedAt !== 'number') return true;\n\n return data.updatedAt > localUpdatedAt;\n });\n\n const flatRemoteDictionariesRecord: DictionaryAPI[] = Object.values(\n remoteDictionariesRecord\n ).flat();\n\n const cachedDictionaries: Dictionary[] =\n flatRemoteDictionariesRecord.filter((dictionary) => {\n const remoteUpdatedAt =\n distantDictionaryUpdateTimeStamp[dictionary.id!].updatedAt;\n\n const localUpdatedAtRaw = dictionary.updatedAt;\n\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n\n // Consider as cached/imported when local exists and is up-to-date or newer\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n });\n\n // Report cached as already imported\n if (cachedDictionaries.length > 0) {\n onStatusUpdate?.(\n cachedDictionaries.map((dictionary) => ({\n dictionaryKey: dictionary.key,\n type: 'remote',\n status: 'imported',\n }))\n );\n }\n\n const orderedDistantDictionaryKeys = dictionariesIdToFetch\n .map(([, data]) => data.key)\n .sort(sortAlphabetically);\n\n // Report pending for keys to be fetched so totals are visible immediately\n if (orderedDistantDictionaryKeys.length > 0) {\n onStatusUpdate?.(\n orderedDistantDictionaryKeys.map((key) => ({\n dictionaryKey: key,\n type: 'remote',\n status: 'pending',\n }))\n );\n }\n\n const distantDictionariesData = await fetchDistantDictionaries(\n {\n dictionaryKeys: orderedDistantDictionaryKeys,\n },\n onStatusUpdate\n );\n\n const distantDictionaries: Dictionary[] = formatDistantDictionaries(\n distantDictionariesData\n );\n\n return [...cachedDictionaries, ...distantDictionaries];\n } catch (error) {\n options?.onError?.(error as Error);\n return [];\n } fin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AO,mBAAmB,YAC1B,OAAO,oBAAoB,YAC3B,kBAAkB;EAEtB,CAAC;EAGH,IAAI,mBAAmB,SAAS,GAC9B,iBACE,mBAAmB,KAAK,gBAAgB;GACtC,eAAe,WAAW;GAC1B,MAAM;GACN,QAAQ;EACV,EAAE,CACJ;EAGF,MAAM,+BAA+B,sBAClC,KAAK,GAAG,UAAU,KAAK,GAAG,CAAC,CAC3B,KAAK,kBAAkB;EAG1B,IAAI,6BAA6B,SAAS,GACxC,iBACE,6BAA6B,KAAK,SAAS;GACzC,eAAe;GACf,MAAM;GACN,QAAQ;EACV,EAAE,CACJ;EAGF,MAAM,0BAA0B,MAAM,yBACpC,EACE,gBAAgB,6BAClB,GACA,cACF;EAEA,MAAM,sBAAoC,0BACxC,uBACF;EAEA,OAAO,CAAC,GAAG,oBAAoB,GAAG,mBAAmB;CACvD,SAAS,OAAO;EACd,SAAS,UAAU,KAAc;EACjC,OAAO,CAAC;CACV,UAAU;EACR,SAAS,oBAAoB;CAC/B;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadYamlContentDeclaration.mjs","names":[],"sources":["../../../src/loadDictionaries/loadYamlContentDeclaration.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { parseYaml } from '@intlayer/core/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const loadYamlContentDeclaration = async (\n path: string\n): Promise<Dictionary | undefined> => {\n try {\n const fileContent = await readFile(path, 'utf-8');\n const parsed = parseYaml<Dictionary>(fileContent);\n\n if (!parsed || typeof parsed !== 'object') {\n console.error(`[intlayer] Invalid YAML content declaration: ${path}`);\n return undefined;\n }\n\n if (!parsed.key) {\n console.error(\n `[intlayer] Missing key in YAML content declaration: ${path}`\n );\n return undefined;\n }\n\n return parsed;\n } catch (error) {\n console.error(`Error loading YAML content declaration at ${path}:`, error);\n return undefined;\n }\n};\n"],"mappings":";;;;AAIA,MAAa,6BAA6B,OACxC,SACoC;AACpC,KAAI;EAEF,MAAM,SAAS,UAAsB,MADX,SAAS,MAAM,QAAQ,CACA;AAEjD,MAAI,CAAC,UAAU,OAAO,WAAW,UAAU;AACzC,WAAQ,MAAM,gDAAgD,OAAO;AACrE;;AAGF,MAAI,CAAC,OAAO,KAAK;AACf,WAAQ,MACN,uDAAuD,OACxD;AACD;;AAGF,SAAO;UACA,OAAO;AACd,UAAQ,MAAM,6CAA6C,KAAK,IAAI,MAAM;AAC1E"}
1
+ {"version":3,"file":"loadYamlContentDeclaration.mjs","names":[],"sources":["../../../src/loadDictionaries/loadYamlContentDeclaration.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { parseYaml } from '@intlayer/core/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const loadYamlContentDeclaration = async (\n path: string\n): Promise<Dictionary | undefined> => {\n try {\n const fileContent = await readFile(path, 'utf-8');\n const parsed = parseYaml<Dictionary>(fileContent);\n\n if (!parsed || typeof parsed !== 'object') {\n console.error(`[intlayer] Invalid YAML content declaration: ${path}`);\n return undefined;\n }\n\n if (!parsed.key) {\n console.error(\n `[intlayer] Missing key in YAML content declaration: ${path}`\n );\n return undefined;\n }\n\n return parsed;\n } catch (error) {\n console.error(`Error loading YAML content declaration at ${path}:`, error);\n return undefined;\n }\n};\n"],"mappings":";;;;AAIA,MAAa,6BAA6B,OACxC,SACoC;CACpC,IAAI;EAEF,MAAM,SAAS,UAAsB,MADX,SAAS,MAAM,OAAO,CACA;EAEhD,IAAI,CAAC,UAAU,OAAO,WAAW,UAAU;GACzC,QAAQ,MAAM,gDAAgD,MAAM;GACpE;EACF;EAEA,IAAI,CAAC,OAAO,KAAK;GACf,QAAQ,MACN,uDAAuD,MACzD;GACA;EACF;EAEA,OAAO;CACT,SAAS,OAAO;EACd,QAAQ,MAAM,6CAA6C,KAAK,IAAI,KAAK;EACzE;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"log.mjs","names":[],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":";;;;;;AAYA,IAAa,qBAAb,MAAgC;CAC9B,AAAQ,WAAiC,EAAE;CAC3C,AAAQ,eAAsC;CAC9C,AAAQ,eAAe;CACvB,AAAQ,gBAAgB;CACxB,AAAiB,gBAAgB;CACjC,AAAQ,aAAa;CACrB,AAAiB;CACjB,AAAQ,oBAA4B;CACpC,AAAQ,wBAAwB;CAChC,AAAQ,eAAe;CACvB,AAAQ;CACR,AAAQ,cAAc;CACtB,AAAQ,aAAa;CACrB,AAAQ;CAER,cAAc;AACZ,OAAK,SAAS,UAAU,KAAK,OAAO,IAAI;;CAG1C,gBAAgB,QAAiB;AAC/B,OAAK,eAAe;;CAGtB,mBAAmB;AACjB,MAAI,KAAK,WAAY;AACrB,OAAK,wBAAwB;AAC7B,OAAK,cAAc;AACnB,OAAK,QAAQ;;CAGf,kBAAkB;AAChB,OAAK,wBAAwB;;CAG/B,OAAO,aAAmC;AACxC,MAAI,KAAK,WAAY;AACrB,OAAK,MAAM,UAAU,aAAa;GAChC,MAAM,QAAQ,KAAK,SAAS,WACzB,MACC,EAAE,kBAAkB,OAAO,iBAAiB,EAAE,SAAS,OAAO,KACjE;AACD,OAAI,SAAS,EACX,MAAK,SAAS,SAAS;OAEvB,MAAK,SAAS,KAAK,OAAO;;EAK9B,MAAM,EAAE,gBAAgB,KAAK,iBAAiB;AAC9C,MAAI,KAAK,gBAAgB,CAAC,KAAK,yBAAyB,gBAAgB,EAEtE;AAGF,OAAK,cAAc;AACnB,OAAK,QAAQ;;CAGf,SAAS;AACP,OAAK,aAAa;AAClB,OA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B,KAAK;AAC1C,WAAQ,OAAO,MAAM,UAAU;GAC/B,MAAM,OAAO,MAAM;AACnB,OAAI,SAAS,OACX,SAAQ,OAAO,MAAM,KAAK;AAE5B,WAAQ,OAAO,MAAM,KAAK;;AAG5B,OAAK,gBAAgB,MAAM;;CAG7B,AAAQ,kBAAkB;EACxB,MAAM,YAAY,IAAI,IACpB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,QAAQ,CACjC,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,SAC/D,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,SAAS,CAClC,KAAK,MAAM,EAAE,cAAc,CAC/B;EAED,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,SAClB,CACA,KAAK,MAAM,EAAE,cAAc,CAC/B;AAED,SAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC3B,aAAa,KAAK;GAClB,YAAY,KAAK;GAClB"}
1
+ {"version":3,"file":"log.mjs","names":[],"sources":["../../../src/loadDictionaries/log.ts"],"sourcesContent":["import { log } from '@intlayer/config/built';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n getPrefix,\n spinnerFrames,\n v,\n x,\n} from '@intlayer/config/logger';\nimport { extractErrorMessage } from '@intlayer/config/utils';\nimport type { DictionariesStatus } from './loadDictionaries';\n\nexport class DictionariesLogger {\n private statuses: DictionariesStatus[] = [];\n private spinnerTimer: NodeJS.Timeout | null = null;\n private spinnerIndex = 0;\n private renderedLines = 0;\n private readonly spinnerFrames = spinnerFrames;\n private isFinished = false;\n private readonly prefix: string;\n private lastRenderedState: string = '';\n private remoteCheckInProgress = false;\n private expectRemote = false;\n private remoteError: string | undefined;\n private pluginTotal = 0;\n private pluginDone = 0;\n private pluginError: string | undefined;\n\n constructor() {\n this.prefix = getPrefix(log?.prefix) ?? '';\n }\n\n setExpectRemote(expect: boolean) {\n this.expectRemote = expect;\n }\n\n startRemoteCheck() {\n if (this.isFinished) return;\n this.remoteCheckInProgress = true;\n this.startSpinner();\n this.render();\n }\n\n stopRemoteCheck() {\n this.remoteCheckInProgress = false;\n }\n\n update(newStatuses: DictionariesStatus[]) {\n if (this.isFinished) return;\n for (const status of newStatuses) {\n const index = this.statuses.findIndex(\n (s) =>\n s.dictionaryKey === status.dictionaryKey && s.type === status.type\n );\n if (index >= 0) {\n this.statuses[index] = status;\n } else {\n this.statuses.push(status);\n }\n }\n\n // If we expect remote fetch later, avoid rendering a local-only line first\n const { remoteTotal } = this.computeProgress();\n if (this.expectRemote && !this.remoteCheckInProgress && remoteTotal === 0) {\n // Do not start spinner or render yet; wait until remote check starts\n return;\n }\n\n this.startSpinner();\n this.render();\n }\n\n finish() {\n this.isFinished = true;\n this.stopSpinner();\n // Render final state and keep it visible\n this.render();\n }\n\n private startSpinner() {\n if (this.spinnerTimer || this.isFinished) return;\n this.spinnerTimer = setInterval(() => {\n this.spinnerIndex = (this.spinnerIndex + 1) % this.spinnerFrames.length;\n this.render();\n }, 100);\n }\n\n private stopSpinner() {\n if (!this.spinnerTimer) return;\n clearInterval(this.spinnerTimer);\n this.spinnerTimer = null;\n }\n\n public setRemoteError = (error?: Error) => {\n this.remoteError = extractErrorMessage(error);\n // Avoid rendering a transient remote-only line while the remote check flag is still true\n // Ensure local + remote are rendered together after a failure\n this.stopRemoteCheck();\n this.render();\n };\n\n setPluginTotal(total: number) {\n if (this.isFinished) return;\n this.pluginTotal = total;\n if (total > 0) {\n this.startSpinner();\n }\n this.render();\n }\n\n setPluginDone(done: number) {\n if (this.isFinished) return;\n this.pluginDone = done;\n this.render();\n }\n\n setPluginError(error?: Error) {\n if (this.isFinished) return;\n this.pluginError = extractErrorMessage(error);\n this.render();\n }\n\n private render() {\n const {\n localTotal,\n localDone,\n remoteTotal,\n remoteDone,\n pluginTotal,\n pluginDone,\n } = this.computeProgress();\n\n const frame = this.spinnerFrames[this.spinnerIndex];\n const clock = colorize(frame, ANSIColors.BLUE);\n const lines: string[] = [];\n\n const isLocalDone = localDone === localTotal;\n const isRemoteDone = remoteDone === remoteTotal;\n const isPluginDone = pluginDone === pluginTotal;\n\n const suppressLocalWhileCheckingRemote =\n this.expectRemote && this.remoteCheckInProgress && remoteTotal === 0;\n\n if (!suppressLocalWhileCheckingRemote) {\n if (isLocalDone) {\n lines.push(\n `${this.prefix} ${v} Local content: ${colorize(`${localDone}`, ANSIColors.GREEN)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Local content: ${colorize(`${localDone}`, ANSIColors.BLUE)}${colorize(`/${localTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Single remote line: show error, check, or progress counts\n if (remoteTotal > 0 || this.remoteCheckInProgress || this.remoteError) {\n if (this.remoteError) {\n lines.push(\n `${this.prefix} ${x} Remote content: ${colorize(\n this.remoteError,\n ANSIColors.RED\n )}`\n );\n } else if (remoteTotal === 0) {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize('Check server', ANSIColors.BLUE)}`\n );\n } else if (isRemoteDone) {\n lines.push(\n `${this.prefix} ${v} Remote content: ${colorize(`${remoteDone}`, ANSIColors.GREEN)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Remote content: ${colorize(`${remoteDone}`, ANSIColors.BLUE)}${colorize(`/${remoteTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Plugin line: show error or progress counts\n if (pluginTotal > 0 || this.pluginError) {\n if (this.pluginError) {\n lines.push(\n `${this.prefix} ${x} Plugin content: ${colorize(\n this.pluginError,\n ANSIColors.RED\n )}`\n );\n } else if (isPluginDone) {\n lines.push(\n `${this.prefix} ${v} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.GREEN)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n } else {\n lines.push(\n `${this.prefix} ${clock} Plugin content: ${colorize(`${pluginDone}`, ANSIColors.BLUE)}${colorize(`/${pluginTotal}`, ANSIColors.GREY)}`\n );\n }\n }\n\n // Check if the state has changed to avoid duplicate rendering\n const currentState = lines.join('\\n');\n if (currentState === this.lastRenderedState) {\n return;\n }\n this.lastRenderedState = currentState;\n\n if (this.renderedLines > 0) {\n process.stdout.write(`\\x1b[${this.renderedLines}F`);\n }\n\n const totalLinesToClear = Math.max(this.renderedLines, lines.length);\n for (let i = 0; i < totalLinesToClear; i++) {\n process.stdout.write('\\x1b[2K');\n const line = lines[i];\n if (line !== undefined) {\n process.stdout.write(line);\n }\n process.stdout.write('\\n');\n }\n\n this.renderedLines = lines.length;\n }\n\n private computeProgress() {\n const localKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'local')\n .map((s) => s.dictionaryKey)\n );\n\n const localDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'local' && (s.status === 'built' || s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n const remoteKeys = new Set(\n this.statuses\n .filter((s) => s.type === 'remote')\n .map((s) => s.dictionaryKey)\n );\n\n const remoteDoneKeys = new Set(\n this.statuses\n .filter(\n (s) =>\n s.type === 'remote' &&\n (s.status === 'fetched' ||\n s.status === 'imported' ||\n s.status === 'error')\n )\n .map((s) => s.dictionaryKey)\n );\n\n return {\n localTotal: localKeys.size,\n localDone: localDoneKeys.size,\n remoteTotal: remoteKeys.size,\n remoteDone: remoteDoneKeys.size,\n pluginTotal: this.pluginTotal,\n pluginDone: this.pluginDone,\n } as const;\n }\n}\n"],"mappings":";;;;;;AAYA,IAAa,qBAAb,MAAgC;CAC9B,AAA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ACF,QAAQ,MAAM,EAAE,SAAS,OAAO,CAAC,CACjC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,gBAAgB,IAAI,IACxB,KAAK,SACF,QACE,MACC,EAAE,SAAS,YAAY,EAAE,WAAW,WAAW,EAAE,WAAW,QAChE,CAAC,CACA,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,aAAa,IAAI,IACrB,KAAK,SACF,QAAQ,MAAM,EAAE,SAAS,QAAQ,CAAC,CAClC,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,MAAM,iBAAiB,IAAI,IACzB,KAAK,SACF,QACE,MACC,EAAE,SAAS,aACV,EAAE,WAAW,aACZ,EAAE,WAAW,cACb,EAAE,WAAW,QACnB,CAAC,CACA,KAAK,MAAM,EAAE,aAAa,CAC/B;EAEA,OAAO;GACL,YAAY,UAAU;GACtB,WAAW,cAAc;GACzB,aAAa,WAAW;GACxB,YAAY,eAAe;GAC3B,aAAa,KAAK;GAClB,YAAY,KAAK;EACnB;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"logTypeScriptErrors.mjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.system?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":";;;;AAIA,MAAa,sBAAsB,OACjC,WACA,kBACG;CACH,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,eAAe,UAAU,QAAQ,SAAS;EAC9C,MAAM,MAAM,QAAQ,KAAK;AAEzB,SAAO;GAAC;GAAO;GAAQ;GAAO;GAAQ;GAAQ;GAAQ;GAAQ,CAAC,SAC7D,IACD;GACD;AAEF,KAAI,aAAa,WAAW,EAAG;CAE/B,IAAI;AAEJ,KAAI;AACF,QAAM,MAAM,OAAO,eAAe,WAAY,MAAM,OAAO;SACrD;AAGN;;CAGF,MAAM,iBAAiB,GAAG,eACxB,cAAc,QAAQ,WAAW,QAAQ,KAAK,EAC9C,GAAG,IAAI,YACP,gBACD;CAED,IAAI,kBAAuB;EACzB,QAAQ;EAER,SAAS;EAET,mBAAmB;EACpB;AAED,KAAI,gBAAgB;EAClB,MAAM,iBAAiB,GAAG,IAAI,SAAS,eAAe;AAEtD,MAAI,gBAAgB;GAClB,MAAM,aAAa,GAAG,0BACpB,gBAEA,eACD;AAED,OAAI,CAAC,WAAW,OAAO;IASrB,MAAM,EAAE,aAAa,iBAAiB,GAAG,gBARpB,GAAG,2BACtB,WAAW,QAEX,GAAG,KAEH,QAAQ,eAAe,CAIX,CAAC;AAEf,sBAAkB;KAAE,GAAG;KAAiB,GAAG;KAAa,QAAQ;KAAM;;;;CAK5E,MAAM,UAAU,GAAG,cAAc,cAAc,gBAAgB;AAE/D,cAAa,SAAS,aAAa;EACjC,MAAM,aAAa,QAAQ,cAAc,SAAS;AAElD,MAAI,CAAC,WAAY;AAIjB,EAFoB,GAAG,sBAAsB,SAAS,WAE3C,CAAC,SAAS,eAAe;GAClC,MAAM,UAAU,GAAG,6BACjB,WAAW,aAEX,KACD;AAED,OAAI,WAAW,QAAQ,WAAW,UAAU,QAAW;IACrD,MAAM,EAAE,MAAM,cACZ,WAAW,KAAK,8BAA8B,WAAW,MAAM;AAEjE,cACE,eAAe,WAAW,KAAK,SAAS,IAAI,OAAO,EAAE,GAAG,YAAY,EAAE,KAAK,WAE3E,EAAE,OAAO,QAAQ,CAClB;;IAEH;GACF"}
1
+ {"version":3,"file":"logTypeScriptErrors.mjs","names":[],"sources":["../../../src/loadDictionaries/logTypeScriptErrors.ts"],"sourcesContent":["import { dirname, extname } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\n\nexport const logTypeScriptErrors = async (\n filePaths: string[],\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n\n const filesToCheck = filePaths.filter((path) => {\n const ext = extname(path);\n\n return ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.mjs', '.json'].includes(\n ext\n );\n });\n\n if (filesToCheck.length === 0) return;\n\n let ts: typeof import('typescript');\n\n try {\n ts = (await import('typescript')).default || (await import('typescript'));\n } catch {\n // TypeScript not installed, skip type checking\n\n return;\n }\n\n const configFileName = ts.findConfigFile(\n configuration.system?.baseDir ?? process.cwd(),\n ts.sys.fileExists,\n 'tsconfig.json'\n );\n\n let compilerOptions: any = {\n noEmit: true,\n\n allowJs: true,\n\n resolveJsonModule: true,\n };\n\n if (configFileName) {\n const configFileText = ts.sys.readFile(configFileName);\n\n if (configFileText) {\n const configJson = ts.parseConfigFileTextToJson(\n configFileName,\n\n configFileText\n );\n\n if (!configJson.error) {\n const parsedConfig = ts.parseJsonConfigFileContent(\n configJson.config,\n\n ts.sys,\n\n dirname(configFileName)\n );\n\n const { incremental, tsBuildInfoFile, ...restOptions } =\n parsedConfig.options;\n\n compilerOptions = { ...compilerOptions, ...restOptions, noEmit: true };\n }\n }\n }\n\n const program = ts.createProgram(filesToCheck, compilerOptions);\n\n filesToCheck.forEach((filePath) => {\n const sourceFile = program.getSourceFile(filePath);\n\n if (!sourceFile) return;\n\n const diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);\n\n diagnostics.forEach((diagnostic) => {\n const message = ts.flattenDiagnosticMessageText(\n diagnostic.messageText,\n\n '\\n'\n );\n\n if (diagnostic.file && diagnostic.start !== undefined) {\n const { line, character } =\n diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);\n\n appLogger(\n `TS Error in ${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`,\n\n { level: 'warn' }\n );\n }\n });\n });\n};\n"],"mappings":";;;;AAIA,MAAa,sBAAsB,OACjC,WACA,kBACG;CACH,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,eAAe,UAAU,QAAQ,SAAS;EAC9C,MAAM,MAAM,QAAQ,IAAI;EAExB,OAAO;GAAC;GAAO;GAAQ;GAAO;GAAQ;GAAQ;GAAQ;EAAO,CAAC,CAAC,SAC7D,GACF;CACF,CAAC;CAED,IAAI,aAAa,WAAW,GAAG;CAE/B,IAAI;CAEJ,IAAI;EACF,MAAM,MAAM,OAAO,cAAa,CAAE,WAAY,MAAM,OAAO;CAC7D,QAAQ;EAGN;CACF;CAEA,MAAM,iBAAiB,GAAG,eACxB,cAAc,QAAQ,WAAW,QAAQ,IAAI,GAC7C,GAAG,IAAI,YACP,eACF;CAEA,IAAI,kBAAuB;EACzB,QAAQ;EAER,SAAS;EAET,mBAAmB;CACrB;CAEA,IAAI,gBAAgB;EAClB,MAAM,iBAAiB,GAAG,IAAI,SAAS,cAAc;EAErD,IAAI,gBAAgB;GAClB,MAAM,aAAa,GAAG,0BACpB,gBAEA,cACF;GAEA,IAAI,CAAC,WAAW,OAAO;IASrB,MAAM,EAAE,aAAa,iBAAiB,GAAG,gBARpB,GAAG,2BACtB,WAAW,QAEX,GAAG,KAEH,QAAQ,cAAc,CAIX,CAAC,CAAC;IAEf,kBAAkB;KAAE,GAAG;KAAiB,GAAG;KAAa,QAAQ;IAAK;GACvE;EACF;CACF;CAEA,MAAM,UAAU,GAAG,cAAc,cAAc,eAAe;CAE9D,aAAa,SAAS,aAAa;EACjC,MAAM,aAAa,QAAQ,cAAc,QAAQ;EAEjD,IAAI,CAAC,YAAY;EAIjB,AAFoB,GAAG,sBAAsB,SAAS,UAE5C,CAAC,CAAC,SAAS,eAAe;GAClC,MAAM,UAAU,GAAG,6BACjB,WAAW,aAEX,IACF;GAEA,IAAI,WAAW,QAAQ,WAAW,UAAU,QAAW;IACrD,MAAM,EAAE,MAAM,cACZ,WAAW,KAAK,8BAA8B,WAAW,KAAK;IAEhE,UACE,eAAe,WAAW,KAAK,SAAS,IAAI,OAAO,EAAE,GAAG,YAAY,EAAE,KAAK,WAE3E,EAAE,OAAO,OAAO,CAClB;GACF;EACF,CAAC;CACH,CAAC;AACH"}
@@ -22,9 +22,12 @@ const logConfigDetails = (options) => {
22
22
  }
23
23
  if (customConfiguration) {
24
24
  const validation = intlayerConfigSchema.safeParse(customConfiguration);
25
- if (!validation.success) appLogger(`${x} Invalid configuration:\n${validation.error.issues.map((error) => {
26
- return `${colorizePath(` - ${error.path.join(".")}:`)} ${colorize(error.message, ANSIColors.GREY_DARK)}`;
27
- }).join("\n")}`);
25
+ if (!validation.success) {
26
+ const errorMessage = `${x} Invalid configuration:\n${validation.error.issues.map((error) => {
27
+ return `${colorizePath(` - ${error.path.join(".")}:`)} ${colorize(error.message, ANSIColors.GREY_DARK)}`;
28
+ }).join("\n")}`;
29
+ appLogger(errorMessage);
30
+ }
28
31
  if (customConfiguration.build?.importMode) appLogger(`${colorize("build.importMode", ANSIColors.BLUE)} is deprecated, use ${colorize("dictionary.importMode", ANSIColors.BLUE)} instead`);
29
32
  if (customConfiguration.compiler?.transformPattern) appLogger(`${colorize("compiler.transformPattern", ANSIColors.BLUE)} is deprecated, use ${colorize("build.traversePattern", ANSIColors.BLUE)} instead`);
30
33
  if (customConfiguration.compiler?.excludePattern) appLogger(`${colorize("compiler.excludePattern", ANSIColors.BLUE)} is deprecated, use ${colorize("build.traversePattern", ANSIColors.BLUE)} instead`);
@@ -1 +1 @@
1
- {"version":3,"file":"logConfigDetails.mjs","names":[],"sources":["../../src/logConfigDetails.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport {\n colorize,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfigurationAndFilePath,\n intlayerConfigSchema,\n} from '@intlayer/config/node';\nimport { formatPath, runOnce } from './utils';\n\nexport const logConfigDetails = (options?: GetConfigurationOptions) => {\n const {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n } = getConfigurationAndFilePath(options);\n const appLogger = getAppLogger(configuration);\n\n runOnce(\n join(\n configuration.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-config-locaded.lock'\n ),\n () => {\n if (numCustomConfiguration === 0) {\n appLogger(\n 'Configuration file not found, using default configuration.',\n {\n isVerbose: true,\n }\n );\n } else {\n const baseDir = configuration.system.baseDir;\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${formatPath(relativeOutputPath)}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n\n if (customConfiguration) {\n const validation = intlayerConfigSchema.safeParse(customConfiguration);\n\n if (!validation.success) {\n const errorMessages = validation.error.issues\n .map((error) => {\n const path = colorizePath(` - ${error.path.join('.')}:`);\n const message = colorize(error.message, ANSIColors.GREY_DARK);\n return `${path} ${message}`;\n })\n .join('\\n');\n const errorMessage = `${x} Invalid configuration:\\n${errorMessages}`;\n\n appLogger(errorMessage);\n }\n\n if (customConfiguration.build?.importMode) {\n appLogger(\n `${colorize('build.importMode', ANSIColors.BLUE)} is deprecated, use ${colorize('dictionary.importMode', ANSIColors.BLUE)} instead`\n );\n }\n if (customConfiguration.compiler?.transformPattern) {\n appLogger(\n `${colorize('compiler.transformPattern', ANSIColors.BLUE)} is deprecated, use ${colorize('build.traversePattern', ANSIColors.BLUE)} instead`\n );\n }\n if (customConfiguration.compiler?.excludePattern) {\n appLogger(\n `${colorize('compiler.excludePattern', ANSIColors.BLUE)} is deprecated, use ${colorize('build.traversePattern', ANSIColors.BLUE)} instead`\n );\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 60, // 1 minute\n }\n );\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,YAAsC;CACrE,MAAM,EACJ,eACA,qBACA,wBACA,0BACE,4BAA4B,QAAQ;CACxC,MAAM,YAAY,aAAa,cAAc;AAE7C,SACE,KACE,cAAc,OAAO,SACrB,aACA,SACA,+BACD,QACK;AACJ,MAAI,2BAA2B,EAC7B,WACE,8DACA,EACE,WAAW,MACZ,CACF;OACI;GACL,MAAM,UAAU,cAAc,OAAO;GACrC,MAAM,qBAAqB,SAAS,SAAS,sBAAuB;AAEpE,OAAI,2BAA2B,GAAG;IAChC,MAAM,iBAAiB,eAAe,SAAS,KAAK,SAAS,QAAQ;AAErE,cACE,wBAAwB,WAAW,mBAAmB,GAAG,iBAAiB,WAAW,WAAW,eAAe,KAAK,MACpH,EACE,WAAW,MACZ,CACF;SAED,WACE,6CAA6C,WAAW,mBAAmB,CAAC,IAC5E,EACE,WAAW,MACZ,CACF;;AAIL,MAAI,qBAAqB;GACvB,MAAM,aAAa,qBAAqB,UAAU,oBAAoB;AAEtE,OAAI,CAAC,WAAW,QAUd,WAAU,GAFc,EAAE,2BAPJ,WAAW,MAAM,OACpC,KAAK,UAAU;AAGd,WAAO,GAFM,aAAa,MAAM,MAAM,KAAK,KAAK,IAAI,CAAC,GAEvC,CAAC,GADC,SAAS,MAAM,SAAS,WAAW,UAC1B;KACzB,CACD,KAAK,KAC0D,GAE3C;AAGzB,OAAI,oBAAoB,OAAO,WAC7B,WACE,GAAG,SAAS,oBAAoB,WAAW,KAAK,CAAC,sBAAsB,SAAS,yBAAyB,WAAW,KAAK,CAAC,UAC3H;AAEH,OAAI,oBAAoB,UAAU,iBAChC,WACE,GAAG,SAAS,6BAA6B,WAAW,KAAK,CAAC,sBAAsB,SAAS,yBAAyB,WAAW,KAAK,CAAC,UACpI;AAEH,OAAI,oBAAoB,UAAU,eAChC,WACE,GAAG,SAAS,2BAA2B,WAAW,KAAK,CAAC,sBAAsB,SAAS,yBAAyB,WAAW,KAAK,CAAC,UAClI;;IAIP,EACE,gBAAgB,MAAO,IACxB,CACF"}
1
+ {"version":3,"file":"logConfigDetails.mjs","names":[],"sources":["../../src/logConfigDetails.ts"],"sourcesContent":["import { join, relative } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getEnvFilePath } from '@intlayer/config/env';\nimport {\n colorize,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfigurationAndFilePath,\n intlayerConfigSchema,\n} from '@intlayer/config/node';\nimport { formatPath, runOnce } from './utils';\n\nexport const logConfigDetails = (options?: GetConfigurationOptions) => {\n const {\n configuration,\n customConfiguration,\n numCustomConfiguration,\n configurationFilePath,\n } = getConfigurationAndFilePath(options);\n const appLogger = getAppLogger(configuration);\n\n runOnce(\n join(\n configuration.system.baseDir,\n '.intlayer',\n 'cache',\n 'intlayer-config-locaded.lock'\n ),\n () => {\n if (numCustomConfiguration === 0) {\n appLogger(\n 'Configuration file not found, using default configuration.',\n {\n isVerbose: true,\n }\n );\n } else {\n const baseDir = configuration.system.baseDir;\n const relativeOutputPath = relative(baseDir, configurationFilePath!);\n\n if (numCustomConfiguration === 1) {\n const dotEnvFilePath = getEnvFilePath(options?.env, options?.envFile);\n\n appLogger(\n `Configuration loaded ${formatPath(relativeOutputPath)}${dotEnvFilePath ? ` - Env: ${formatPath(dotEnvFilePath)}` : ''}`,\n {\n isVerbose: true,\n }\n );\n } else {\n appLogger(\n `Multiple configuration files found, using ${formatPath(relativeOutputPath)}.`,\n {\n isVerbose: true,\n }\n );\n }\n }\n\n if (customConfiguration) {\n const validation = intlayerConfigSchema.safeParse(customConfiguration);\n\n if (!validation.success) {\n const errorMessages = validation.error.issues\n .map((error) => {\n const path = colorizePath(` - ${error.path.join('.')}:`);\n const message = colorize(error.message, ANSIColors.GREY_DARK);\n return `${path} ${message}`;\n })\n .join('\\n');\n const errorMessage = `${x} Invalid configuration:\\n${errorMessages}`;\n\n appLogger(errorMessage);\n }\n\n if (customConfiguration.build?.importMode) {\n appLogger(\n `${colorize('build.importMode', ANSIColors.BLUE)} is deprecated, use ${colorize('dictionary.importMode', ANSIColors.BLUE)} instead`\n );\n }\n if (customConfiguration.compiler?.transformPattern) {\n appLogger(\n `${colorize('compiler.transformPattern', ANSIColors.BLUE)} is deprecated, use ${colorize('build.traversePattern', ANSIColors.BLUE)} instead`\n );\n }\n if (customConfiguration.compiler?.excludePattern) {\n appLogger(\n `${colorize('compiler.excludePattern', ANSIColors.BLUE)} is deprecated, use ${colorize('build.traversePattern', ANSIColors.BLUE)} instead`\n );\n }\n }\n },\n {\n cacheTimeoutMs: 1000 * 60, // 1 minute\n }\n );\n};\n"],"mappings":";;;;;;;;;AAgBA,MAAa,oBAAoB,YAAsC;CACrE,MAAM,EACJ,eACA,qBACA,wBACA,0BACE,4BAA4B,OAAO;CACvC,MAAM,YAAY,aAAa,aAAa;CAE5C,QACE,KACE,cAAc,OAAO,SACrB,aACA,SACA,8BACF,SACM;EACJ,IAAI,2BAA2B,GAC7B,UACE,8DACA,EACE,WAAW,KACb,CACF;OACK;GACL,MAAM,UAAU,cAAc,OAAO;GACrC,MAAM,qBAAqB,SAAS,SAAS,qBAAsB;GAEnE,IAAI,2BAA2B,GAAG;IAChC,MAAM,iBAAiB,eAAe,SAAS,KAAK,SAAS,OAAO;IAEpE,UACE,wBAAwB,WAAW,kBAAkB,IAAI,iBAAiB,WAAW,WAAW,cAAc,MAAM,MACpH,EACE,WAAW,KACb,CACF;GACF,OACE,UACE,6CAA6C,WAAW,kBAAkB,EAAE,IAC5E,EACE,WAAW,KACb,CACF;EAEJ;EAEA,IAAI,qBAAqB;GACvB,MAAM,aAAa,qBAAqB,UAAU,mBAAmB;GAErE,IAAI,CAAC,WAAW,SAAS;IAQvB,MAAM,eAAe,GAAG,EAAE,2BAPJ,WAAW,MAAM,OACpC,KAAK,UAAU;KAGd,OAAO,GAFM,aAAa,MAAM,MAAM,KAAK,KAAK,GAAG,EAAE,EAExC,EAAE,GADC,SAAS,MAAM,SAAS,WAAW,SAC3B;IAC1B,CAAC,CAAC,CACD,KAAK,IACyD;IAEjE,UAAU,YAAY;GACxB;GAEA,IAAI,oBAAoB,OAAO,YAC7B,UACE,GAAG,SAAS,oBAAoB,WAAW,IAAI,EAAE,sBAAsB,SAAS,yBAAyB,WAAW,IAAI,EAAE,SAC5H;GAEF,IAAI,oBAAoB,UAAU,kBAChC,UACE,GAAG,SAAS,6BAA6B,WAAW,IAAI,EAAE,sBAAsB,SAAS,yBAAyB,WAAW,IAAI,EAAE,SACrI;GAEF,IAAI,oBAAoB,UAAU,gBAChC,UACE,GAAG,SAAS,2BAA2B,WAAW,IAAI,EAAE,sBAAsB,SAAS,yBAAyB,WAAW,IAAI,EAAE,SACnI;EAEJ;CACF,GACA,EACE,gBAAgB,MAAO,GACzB,CACF;AACF"}
@@ -88,7 +88,8 @@ const prepareIntlayer = async (configuration, options) => {
88
88
  appLogger([`Plugin ${plugin.name} afterBuild failed:`, error.message], { level: "error" });
89
89
  }
90
90
  }
91
- appLogger([`Done`, colorize(`${Date.now() - preparationStartMs}ms`, ANSIColors.GREEN)], {
91
+ const preparationElapsedMs = Date.now() - preparationStartMs;
92
+ appLogger([`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)], {
92
93
  level: "info",
93
94
  isVerbose: true
94
95
  });
@@ -1 +1 @@
1
- {"version":3,"file":"prepareIntlayer.mjs","names":[],"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { cacheDisk } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './buildIntlayerDictionary/writeRemoteDictionary';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { listDictionariesWithStats } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { runOnce } from './utils/runOnce';\nimport {\n isCachedConfigurationUpToDate,\n writeConfiguration,\n} from './writeConfiguration';\n\ntype PrepareIntlayerOptions = {\n clean?: boolean;\n env?: 'prod' | 'dev';\n format?: ('cjs' | 'esm')[];\n forceRun?: boolean;\n cacheTimeoutMs?: number;\n onIsCached?: () => void | Promise<void>;\n};\n\nconst DEFAULT_PREPARE_INTLAYER_OPTIONS = {\n clean: false,\n env: 'dev',\n format: ['cjs', 'esm'],\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n} satisfies PrepareIntlayerOptions;\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig,\n options?: PrepareIntlayerOptions\n) => {\n const appLogger = getAppLogger(configuration);\n\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n // Clean output dir if the intlayer version has changed\n const versionCache = cacheDisk(configuration, ['intlayer-version']);\n const intlayerCacheVersion = await versionCache.get();\n const isCorrectVersion = Boolean(\n intlayerCacheVersion && intlayerCacheVersion === packageJson.version\n );\n\n const isConfigSimilar = await isCachedConfigurationUpToDate(configuration);\n\n // Check if any dictionary has been changed to force a new rebuild\n const dictionariesWithStats = await listDictionariesWithStats(configuration);\n let isDictionaryChanged = false;\n try {\n // Try catch as sentinel file may not exist yet\n const sentinelStats = await stat(sentinelPath);\n isDictionaryChanged = dictionariesWithStats.some(\n (dictionary) =>\n dictionary.stats.mtime.getTime() > sentinelStats.mtime.getTime()\n );\n } catch {}\n\n const resolvedPlugins = await Promise.all(configuration.plugins ?? []);\n const hasPluginLoadDictionaries = resolvedPlugins.some((plugin) =>\n Boolean(plugin.loadDictionaries)\n ); // Disable cache if any plugin because it can have custom behavior\n\n const { clean, format, forceRun, onIsCached, cacheTimeoutMs, env } = {\n ...DEFAULT_PREPARE_INTLAYER_OPTIONS,\n forceRun:\n !isCorrectVersion ||\n !isConfigSimilar ||\n isDictionaryChanged ||\n hasPluginLoadDictionaries,\n ...(options ?? {}),\n };\n\n // Skip preparation if it has already been done recently\n await runOnce(\n sentinelPath,\n async () => {\n // comment because of issue with next and webpack\n // await checkVersionsConsistency(configuration);\n\n if (clean || !isCorrectVersion) {\n await cleanOutputDir(configuration);\n }\n\n await versionCache.set(packageJson.version);\n\n const preparationStartMs = Date.now();\n\n appLogger([\n 'Preparing Intlayer',\n colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK),\n ]);\n\n await writeConfiguration(configuration);\n\n const configurationWrittenTime = Date.now();\n\n appLogger(\n [\n 'Configuration written',\n colorize(\n `(${configurationWrittenTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n const contentDeclarationPaths = dictionariesWithStats.map(\n (dictionary) => dictionary.path\n );\n\n const dictionaries = await loadDictionaries(\n contentDeclarationPaths,\n configuration\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger(\n [\n 'Content loaded',\n colorize(\n [\n dictionaries.remoteDictionaries.length +\n dictionaries.pluginDictionaries.length >\n 0\n ? [\n `(Total: ${dictionariesLoadedTime - configurationWrittenTime}ms`,\n dictionaries.localDictionaries.length > 0\n ? ` - Local: ${dictionaries.time.localDictionaries}ms`\n : '',\n dictionaries.remoteDictionaries.length > 0\n ? ` - Remote: ${dictionaries.time.remoteDictionaries}ms`\n : '',\n dictionaries.pluginDictionaries.length > 0\n ? ` - Plugin: ${dictionaries.time.pluginDictionaries}ms`\n : '',\n `)`,\n ].join('')\n : `(${dictionariesLoadedTime - configurationWrittenTime}ms)`,\n ].join(''),\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n // Build local dictionaries\n const dictionariesOutput = await buildDictionary(\n [\n ...dictionaries.localDictionaries,\n ...dictionaries.remoteDictionaries,\n ...dictionaries.pluginDictionaries,\n ],\n configuration,\n { formats: format, importOtherDictionaries: false, env }\n );\n\n // Write remote dictionaries\n // Used as cache for next fetch\n await writeRemoteDictionary(\n dictionaries.remoteDictionaries,\n configuration\n );\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, configuration);\n\n await createDictionaryEntryPoint(configuration, {\n formats: options?.format,\n });\n\n const dictionariesBuiltTime = Date.now();\n\n appLogger([\n 'Dictionaries built',\n colorize(\n `(${dictionariesBuiltTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ]);\n\n await createModuleAugmentation(configuration);\n\n const moduleAugmentationBuiltTime = Date.now();\n\n appLogger(\n [\n 'Module augmentation built',\n colorize(\n `(${moduleAugmentationBuiltTime - dictionariesBuiltTime}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\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 configuration.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n try {\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration,\n });\n } catch (error) {\n // A failing write-back (e.g. transient network error on a remote\n // target) must not invalidate the dictionaries already built.\n appLogger(\n [\n `Plugin ${plugin.name} afterBuild failed:`,\n (error as Error).message,\n ],\n { level: 'error' }\n );\n }\n }\n\n const preparationElapsedMs = Date.now() - preparationStartMs;\n appLogger(\n [`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)],\n {\n level: 'info',\n isVerbose: true,\n }\n );\n },\n {\n forceRun,\n onIsCached,\n cacheTimeoutMs,\n }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAM,mCAAmC;CACvC,OAAO;CACP,KAAK;CACL,QAAQ,CAAC,OAAO,MAAM;CACtB,gBAAgB,MAAO,KAAK;CAC7B;AAED,MAAa,kBAAkB,OAC7B,eACA,YACG;CACH,MAAM,YAAY,aAAa,cAAc;CAE7C,MAAM,eAAe,KACnB,cAAc,OAAO,UACrB,yBACD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AK,KAAK,GAAG,mBAEE,KAAK,WAAW,MAAM,CAAC,EACjE;GACE,OAAO;GACP,WAAW;GACZ,CACF;IAEH;EACE;EACA;EACA;EACD,CACF"}
1
+ {"version":3,"file":"prepareIntlayer.mjs","names":[],"sources":["../../src/prepareIntlayer.ts"],"sourcesContent":["import { stat } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { cacheDisk } from '@intlayer/config/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { writeRemoteDictionary } from './buildIntlayerDictionary/writeRemoteDictionary';\nimport { cleanOutputDir } from './cleanOutputDir';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { listDictionariesWithStats } from './listDictionariesPath';\nimport { loadDictionaries } from './loadDictionaries/loadDictionaries';\nimport { runOnce } from './utils/runOnce';\nimport {\n isCachedConfigurationUpToDate,\n writeConfiguration,\n} from './writeConfiguration';\n\ntype PrepareIntlayerOptions = {\n clean?: boolean;\n env?: 'prod' | 'dev';\n format?: ('cjs' | 'esm')[];\n forceRun?: boolean;\n cacheTimeoutMs?: number;\n onIsCached?: () => void | Promise<void>;\n};\n\nconst DEFAULT_PREPARE_INTLAYER_OPTIONS = {\n clean: false,\n env: 'dev',\n format: ['cjs', 'esm'],\n cacheTimeoutMs: 1000 * 60 * 60, // 1 hour\n} satisfies PrepareIntlayerOptions;\n\nexport const prepareIntlayer = async (\n configuration: IntlayerConfig,\n options?: PrepareIntlayerOptions\n) => {\n const appLogger = getAppLogger(configuration);\n\n const sentinelPath = join(\n configuration.system.cacheDir,\n 'intlayer-prepared.lock'\n );\n // Clean output dir if the intlayer version has changed\n const versionCache = cacheDisk(configuration, ['intlayer-version']);\n const intlayerCacheVersion = await versionCache.get();\n const isCorrectVersion = Boolean(\n intlayerCacheVersion && intlayerCacheVersion === packageJson.version\n );\n\n const isConfigSimilar = await isCachedConfigurationUpToDate(configuration);\n\n // Check if any dictionary has been changed to force a new rebuild\n const dictionariesWithStats = await listDictionariesWithStats(configuration);\n let isDictionaryChanged = false;\n try {\n // Try catch as sentinel file may not exist yet\n const sentinelStats = await stat(sentinelPath);\n isDictionaryChanged = dictionariesWithStats.some(\n (dictionary) =>\n dictionary.stats.mtime.getTime() > sentinelStats.mtime.getTime()\n );\n } catch {}\n\n const resolvedPlugins = await Promise.all(configuration.plugins ?? []);\n const hasPluginLoadDictionaries = resolvedPlugins.some((plugin) =>\n Boolean(plugin.loadDictionaries)\n ); // Disable cache if any plugin because it can have custom behavior\n\n const { clean, format, forceRun, onIsCached, cacheTimeoutMs, env } = {\n ...DEFAULT_PREPARE_INTLAYER_OPTIONS,\n forceRun:\n !isCorrectVersion ||\n !isConfigSimilar ||\n isDictionaryChanged ||\n hasPluginLoadDictionaries,\n ...(options ?? {}),\n };\n\n // Skip preparation if it has already been done recently\n await runOnce(\n sentinelPath,\n async () => {\n // comment because of issue with next and webpack\n // await checkVersionsConsistency(configuration);\n\n if (clean || !isCorrectVersion) {\n await cleanOutputDir(configuration);\n }\n\n await versionCache.set(packageJson.version);\n\n const preparationStartMs = Date.now();\n\n appLogger([\n 'Preparing Intlayer',\n colorize(`(v${packageJson.version})`, ANSIColors.GREY_DARK),\n ]);\n\n await writeConfiguration(configuration);\n\n const configurationWrittenTime = Date.now();\n\n appLogger(\n [\n 'Configuration written',\n colorize(\n `(${configurationWrittenTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n const contentDeclarationPaths = dictionariesWithStats.map(\n (dictionary) => dictionary.path\n );\n\n const dictionaries = await loadDictionaries(\n contentDeclarationPaths,\n configuration\n );\n\n const dictionariesLoadedTime = Date.now();\n\n appLogger(\n [\n 'Content loaded',\n colorize(\n [\n dictionaries.remoteDictionaries.length +\n dictionaries.pluginDictionaries.length >\n 0\n ? [\n `(Total: ${dictionariesLoadedTime - configurationWrittenTime}ms`,\n dictionaries.localDictionaries.length > 0\n ? ` - Local: ${dictionaries.time.localDictionaries}ms`\n : '',\n dictionaries.remoteDictionaries.length > 0\n ? ` - Remote: ${dictionaries.time.remoteDictionaries}ms`\n : '',\n dictionaries.pluginDictionaries.length > 0\n ? ` - Plugin: ${dictionaries.time.pluginDictionaries}ms`\n : '',\n `)`,\n ].join('')\n : `(${dictionariesLoadedTime - configurationWrittenTime}ms)`,\n ].join(''),\n ANSIColors.GREY_DARK\n ),\n ],\n {\n isVerbose: true,\n }\n );\n\n // Build local dictionaries\n const dictionariesOutput = await buildDictionary(\n [\n ...dictionaries.localDictionaries,\n ...dictionaries.remoteDictionaries,\n ...dictionaries.pluginDictionaries,\n ],\n configuration,\n { formats: format, importOtherDictionaries: false, env }\n );\n\n // Write remote dictionaries\n // Used as cache for next fetch\n await writeRemoteDictionary(\n dictionaries.remoteDictionaries,\n configuration\n );\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, configuration);\n\n await createDictionaryEntryPoint(configuration, {\n formats: options?.format,\n });\n\n const dictionariesBuiltTime = Date.now();\n\n appLogger([\n 'Dictionaries built',\n colorize(\n `(${dictionariesBuiltTime - preparationStartMs}ms)`,\n ANSIColors.GREY_DARK\n ),\n ]);\n\n await createModuleAugmentation(configuration);\n\n const moduleAugmentationBuiltTime = Date.now();\n\n appLogger(\n [\n 'Module augmentation built',\n colorize(\n `(${moduleAugmentationBuiltTime - dictionariesBuiltTime}ms)`,\n ANSIColors.GREY_DARK\n ),\n ],\n {\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 configuration.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n try {\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration,\n });\n } catch (error) {\n // A failing write-back (e.g. transient network error on a remote\n // target) must not invalidate the dictionaries already built.\n appLogger(\n [\n `Plugin ${plugin.name} afterBuild failed:`,\n (error as Error).message,\n ],\n { level: 'error' }\n );\n }\n }\n\n const preparationElapsedMs = Date.now() - preparationStartMs;\n appLogger(\n [`Done`, colorize(`${preparationElapsedMs}ms`, ANSIColors.GREEN)],\n {\n level: 'info',\n isVerbose: true,\n }\n );\n },\n {\n forceRun,\n onIsCached,\n cacheTimeoutMs,\n }\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AA6BA,MAAM,mCAAmC;CACvC,OAAO;CACP,KAAK;CACL,QAAQ,CAAC,OAAO,KAAK;CACrB,gBAAgB,MAAO,KAAK;AAC9B;AAEA,MAAa,kBAAkB,OAC7B,eACA,YACG;CACH,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,eAAe,KACnB,cAAc,OAAO,UACrB,wBACF;CAEA,MAAM,eAAe,UAAU,eAAe,CAAC,kBAAkB,CAAC;CAClE,MAAM,uBAAuB,MAAM,aAAa,IAAI;CACpD,MAAM,mBAAmB,QACvB,wBAAwB,yBAAyB,YAAY,OAC/D;CAEA,MAAM,kBAAkB,MAAM,8BAA8B,aAAa;CAGzE,MAAM,wBAAwB,MAAM,0BAA0B,aAAa;CAC3E,IAAI,sBAAsB;CAC1B,IAAI;EAEF,MAAM,gBAAgB,MAAM,KAAK,YAAY;EAC7C,sBAAsB,sBAAsB,MACzC,eACC,WAAW,MAAM,MAAM,QAAQ,IAAI,cAAc,MAAM,QAAQ,CACnE;CACF,QAAQ,CAAC;CAGT,MAAM,6BAA4B,MADJ,QAAQ,IAAI,cAAc,WAAW,CAAC,CAAC,EACpB,CAAC,MAAM,WACtD,QAAQ,OAAO,gBAAgB,CACjC;CAEA,MAAM,EAAE,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BACb,aACF;EAMA,MAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,CAAC,CAC7C,CAAC,CAAC,KAAK,eAAe,WAAW,UAEG,GAAG,aAAa;EAEpD,MAAM,2BAA2B,eAAe,EAC9C,SAAS,SAAS,OACpB,CAAC;EAED,MAAM,wBAAwB,KAAK,IAAI;EAEvC,UAAU,CACR,sBACA,SACE,IAAI,wBAAwB,mBAAmB,MAC/C,WAAW,SACb,CACF,CAAC;EAED,MAAM,yBAAyB,aAAa;EAI5C,UACE,CACE,6BACA,SACE,IAN8B,KAAK,IAML,IAAI,sBAAsB,MACxD,WAAW,SACb,CACF,GACA,EACE,WAAW,KACb,CACF;EAIA,WAAW,MAAM,UAAU,cAAc,WAAW,CAAC,GAAG;GACtD,MAAM,EAAE,sBAAsB,uBAAuB;GAErD,IAAI;IACF,MAAM,OAAO,aAAa;KACxB,cAAc;MACZ;MACA;KACF;KACA;IACF,CAAC;GACH,SAAS,OAAO;IAGd,UACE,CACE,UAAU,OAAO,KAAK,sBACrB,MAAgB,OACnB,GACA,EAAE,OAAO,QAAQ,CACnB;GACF;EACF;EAEA,MAAM,uBAAuB,KAAK,IAAI,IAAI;EAC1C,UACE,CAAC,QAAQ,SAAS,GAAG,qBAAqB,KAAK,WAAW,KAAK,CAAC,GAChE;GACE,OAAO;GACP,WAAW;EACb,CACF;CACF,GACA;EACE;EACA;EACA;CACF,CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"applyMask.mjs","names":[],"sources":["../../../src/reduceDictionaryContent/applyMask.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const applyMask = (full: Dictionary, mask: any): Dictionary => {\n // the mask \"true\" → we don't filter\n if (mask === true) {\n return full;\n }\n\n // arrays\n if (Array.isArray(mask) && Array.isArray(full)) {\n return mask.map((m, i) => applyMask(full[i], m)) as any;\n }\n\n // handle node with nodeType property\n if (full && typeof full === 'object' && 'nodeType' in full) {\n if (mask && typeof mask === 'object') {\n return full; // Keep the full object with nodeType intact\n }\n return full;\n }\n\n // generic object\n if (mask && typeof mask === 'object' && full && typeof full === 'object') {\n const out: any = {};\n const maskEntries = Object.entries(mask);\n const allChildrenAreArrays = maskEntries.every(([, value]) =>\n Array.isArray(value)\n );\n\n for (const [k, m] of maskEntries) {\n const fullValue = (full as any)[k];\n\n // If this child is an array, decide preservation rules.\n // - Preserve when all children at this level are arrays in the mask\n // - Also preserve when the array is an array of translation nodes\n if (Array.isArray(m) && Array.isArray(fullValue)) {\n const isTranslationNode = (val: unknown): boolean =>\n !!val && typeof val === 'object' && 'nodeType' in (val as any);\n const isArrayOfTranslationNodes = fullValue.every((item: any) =>\n isTranslationNode(item)\n );\n\n if (!allChildrenAreArrays && !isArrayOfTranslationNodes) {\n continue; // skip incidental arrays when mixed with non-arrays\n }\n }\n\n out[k] = applyMask(fullValue, m);\n }\n return out;\n }\n\n // unexpected case: we return the original value\n return full;\n};\n"],"mappings":";AAEA,MAAa,aAAa,MAAkB,SAA0B;AAEpE,KAAI,SAAS,KACX,QAAO;AAIT,KAAI,MAAM,QAAQ,KAAK,IAAI,MAAM,QAAQ,KAAK,CAC5C,QAAO,KAAK,KAAK,GAAG,MAAM,UAAU,KAAK,IAAI,EAAE,CAAC;AAIlD,KAAI,QAAQ,OAAO,SAAS,YAAY,cAAc,MAAM;AAC1D,MAAI,QAAQ,OAAO,SAAS,SAC1B,QAAO;AAET,SAAO;;AAIT,KAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,OAAO,SAAS,UAAU;EACxE,MAAM,MAAW,EAAE;EACnB,MAAM,cAAc,OAAO,QAAQ,KAAK;EACxC,MAAM,uBAAuB,YAAY,OAAO,GAAG,WACjD,MAAM,QAAQ,MAAM,CACrB;AAED,OAAK,MAAM,CAAC,GAAG,MAAM,aAAa;GAChC,MAAM,YAAa,KAAa;AAKhC,OAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,QAAQ,UAAU,EAAE;IAChD,MAAM,qBAAqB,QACzB,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY,cAAe;IACrD,MAAM,4BAA4B,UAAU,OAAO,SACjD,kBAAkB,KAAK,CACxB;AAED,QAAI,CAAC,wBAAwB,CAAC,0BAC5B;;AAIJ,OAAI,KAAK,UAAU,WAAW,EAAE;;AAElC,SAAO;;AAIT,QAAO"}
1
+ {"version":3,"file":"applyMask.mjs","names":[],"sources":["../../../src/reduceDictionaryContent/applyMask.ts"],"sourcesContent":["import type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const applyMask = (full: Dictionary, mask: any): Dictionary => {\n // the mask \"true\" → we don't filter\n if (mask === true) {\n return full;\n }\n\n // arrays\n if (Array.isArray(mask) && Array.isArray(full)) {\n return mask.map((m, i) => applyMask(full[i], m)) as any;\n }\n\n // handle node with nodeType property\n if (full && typeof full === 'object' && 'nodeType' in full) {\n if (mask && typeof mask === 'object') {\n return full; // Keep the full object with nodeType intact\n }\n return full;\n }\n\n // generic object\n if (mask && typeof mask === 'object' && full && typeof full === 'object') {\n const out: any = {};\n const maskEntries = Object.entries(mask);\n const allChildrenAreArrays = maskEntries.every(([, value]) =>\n Array.isArray(value)\n );\n\n for (const [k, m] of maskEntries) {\n const fullValue = (full as any)[k];\n\n // If this child is an array, decide preservation rules.\n // - Preserve when all children at this level are arrays in the mask\n // - Also preserve when the array is an array of translation nodes\n if (Array.isArray(m) && Array.isArray(fullValue)) {\n const isTranslationNode = (val: unknown): boolean =>\n !!val && typeof val === 'object' && 'nodeType' in (val as any);\n const isArrayOfTranslationNodes = fullValue.every((item: any) =>\n isTranslationNode(item)\n );\n\n if (!allChildrenAreArrays && !isArrayOfTranslationNodes) {\n continue; // skip incidental arrays when mixed with non-arrays\n }\n }\n\n out[k] = applyMask(fullValue, m);\n }\n return out;\n }\n\n // unexpected case: we return the original value\n return full;\n};\n"],"mappings":";AAEA,MAAa,aAAa,MAAkB,SAA0B;CAEpE,IAAI,SAAS,MACX,OAAO;CAIT,IAAI,MAAM,QAAQ,IAAI,KAAK,MAAM,QAAQ,IAAI,GAC3C,OAAO,KAAK,KAAK,GAAG,MAAM,UAAU,KAAK,IAAI,CAAC,CAAC;CAIjD,IAAI,QAAQ,OAAO,SAAS,YAAY,cAAc,MAAM;EAC1D,IAAI,QAAQ,OAAO,SAAS,UAC1B,OAAO;EAET,OAAO;CACT;CAGA,IAAI,QAAQ,OAAO,SAAS,YAAY,QAAQ,OAAO,SAAS,UAAU;EACxE,MAAM,MAAW,CAAC;EAClB,MAAM,cAAc,OAAO,QAAQ,IAAI;EACvC,MAAM,uBAAuB,YAAY,OAAO,GAAG,WACjD,MAAM,QAAQ,KAAK,CACrB;EAEA,KAAK,MAAM,CAAC,GAAG,MAAM,aAAa;GAChC,MAAM,YAAa,KAAa;GAKhC,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,SAAS,GAAG;IAChD,MAAM,qBAAqB,QACzB,CAAC,CAAC,OAAO,OAAO,QAAQ,YAAY,cAAe;IACrD,MAAM,4BAA4B,UAAU,OAAO,SACjD,kBAAkB,IAAI,CACxB;IAEA,IAAI,CAAC,wBAAwB,CAAC,2BAC5B;GAEJ;GAEA,IAAI,KAAK,UAAU,WAAW,CAAC;EACjC;EACA,OAAO;CACT;CAGA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"reduceDictionaryContent.mjs","names":[],"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import { getMaskContent } from '@intlayer/core/plugins';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { applyMask } from './applyMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = getMaskContent(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":";;;;AAIA,MAAa,2BACX,gBACA,sBACG;AAIH,QAFe,UAAU,gBADZ,eAAe,kBACiB,CAEhC"}
1
+ {"version":3,"file":"reduceDictionaryContent.mjs","names":[],"sources":["../../../src/reduceDictionaryContent/reduceDictionaryContent.ts"],"sourcesContent":["import { getMaskContent } from '@intlayer/core/plugins';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { applyMask } from './applyMask';\n\nexport const reduceDictionaryContent = (\n fullDictionary: Dictionary,\n partialDictionary: Dictionary\n) => {\n const mask = getMaskContent(partialDictionary);\n const result = applyMask(fullDictionary, mask);\n\n return result;\n};\n"],"mappings":";;;;AAIA,MAAa,2BACX,gBACA,sBACG;CAIH,OAFe,UAAU,gBADZ,eAAe,iBACgB,CAEhC;AACd"}
@@ -1 +1 @@
1
- {"version":3,"file":"analyzeBundleContent.mjs","names":[],"sources":["../../../src/scan/analyzeBundleContent.ts"],"sourcesContent":["import { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport { byteLength, extractVisibleTextStrings } from './parseHtml';\nimport type {\n BundleChunkInput,\n BundleContentAnalysis,\n ChunkAnalysis,\n} from './types';\n\n/**\n * Detect and measure localized (i18n) content embedded in JavaScript bundles.\n *\n * This is a dependency-free port of the hosted backend bundle analyzer: it\n * estimates how many translation strings ship in each chunk and, of those, how\n * many belong to locales other than the one currently rendered (i.e. dead\n * weight that a build-time optimization could strip).\n */\n\nconst allLocaleValues = new Set(Object.values(ALL_LOCALES) as string[]);\n\nconst isLocaleCode = (key: string): boolean =>\n allLocaleValues.has(key) || /^[a-z]{2}(-[A-Z]{2,4})?$/.test(key);\n\n/** Find the end index of the value following a `locale:` key. */\nconst extractValueEnd = (text: string, valueStart: number): number => {\n let cursor = valueStart;\n while (cursor < text.length && ' \\t\\n\\r'.includes(text[cursor])) cursor++;\n if (cursor >= text.length) return valueStart;\n\n const char = text[cursor];\n if (char === '{' || char === '[') {\n const endChar = char === '{' ? '}' : ']';\n let depth = 1;\n cursor++;\n while (cursor < text.length && depth > 0) {\n if (text[cursor] === char) depth++;\n else if (text[cursor] === endChar) depth--;\n else if (text[cursor] === '\"' || text[cursor] === '`') {\n const quote = text[cursor];\n cursor++;\n while (cursor < text.length) {\n if (text[cursor] === '\\\\') {\n cursor += 2;\n continue;\n }\n if (text[cursor] === quote) break;\n cursor++;\n }\n }\n cursor++;\n }\n return cursor;\n }\n if (char === '\"' || char === '`') {\n const quote = char;\n cursor++;\n while (cursor < text.length) {\n if (text[cursor] === '\\\\') {\n cursor += 2;\n continue;\n }\n if (text[cursor] === quote) {\n cursor++;\n break;\n }\n cursor++;\n }\n return cursor;\n }\n const endMatch = text.slice(cursor).search(/[,}\\]\\s]/);\n return endMatch === -1 ? text.length : cursor + endMatch;\n};\n\n// Matches both quoted (\"en\":) and unquoted (en:) locale keys followed by {\n// Works for any i18n solution — intlayer, i18next, vue-i18n, FormatJS, etc.\nconst LOCALE_KEY_PATTERN =\n /(?:\"([a-z]{2}(?:-[A-Z]{2,4})?)\"|\\b([a-z]{2}(?:-[A-Z]{2,4})?)\\b)\\s*:\\s*(?=\\{)/g;\n\n// Maximum character gap between two locale key positions to consider them\n// part of the same i18n object. Large enough for big translation objects.\nconst LOCALE_CLUSTER_WINDOW = 10_000;\n\n// Returns false when a candidate value is clearly not i18n text:\n// - contains hex/control escape sequences (ANSI codes, binary data)\nconst looksLikeI18nContent = (valueText: string): boolean => {\n if (/\\\\x[0-9a-fA-F]{2}/.test(valueText)) return false;\n if (/\\\\u00[01][0-9a-fA-F]/.test(valueText)) return false;\n return true;\n};\n\ntype LocaleMatch = {\n locale: string;\n position: number;\n valueStart: number;\n valueEnd: number;\n valueSize: number;\n};\n\nconst analyzeChunkLocaleContent = (\n text: string,\n baseCurrent: string\n): {\n unusedLocaleSize: number;\n usedLocaleSize: number;\n dictionariesFound: number;\n} => {\n // Step 1: collect all candidate locale key matches\n const candidates: LocaleMatch[] = [];\n const regex = new RegExp(LOCALE_KEY_PATTERN.source, 'g');\n let match = regex.exec(text);\n\n while (match !== null) {\n const locale = match[1] ?? match[2];\n if (isLocaleCode(locale)) {\n const valueStart = match.index + match[0].length;\n const valueEnd = extractValueEnd(text, valueStart);\n const valueSize = valueEnd - valueStart;\n const valueText = text.slice(valueStart, valueEnd);\n if (valueSize >= 5 && looksLikeI18nContent(valueText)) {\n candidates.push({\n locale,\n position: match.index,\n valueStart,\n valueEnd,\n valueSize,\n });\n }\n }\n match = regex.exec(text);\n }\n\n // Step 2: a locale key is i18n content only if another locale key with a\n // DIFFERENT locale code exists within LOCALE_CLUSTER_WINDOW chars.\n const isI18nMatch = (idx: number): boolean => {\n const base = candidates[idx].locale.split('-')[0].toLowerCase();\n for (let j = 0; j < candidates.length; j++) {\n if (j === idx) continue;\n const dist = Math.abs(candidates[j].position - candidates[idx].position);\n if (dist > LOCALE_CLUSTER_WINDOW) continue;\n if (candidates[j].locale.split('-')[0].toLowerCase() !== base)\n return true;\n }\n return false;\n };\n\n let unusedLocaleSize = 0;\n let usedLocaleSize = 0;\n let dictionariesFound = 0;\n\n for (let i = 0; i < candidates.length; i++) {\n if (!isI18nMatch(i)) continue;\n\n const { locale, valueSize } = candidates[i];\n dictionariesFound++;\n\n if (locale.split('-')[0].toLowerCase() === baseCurrent) {\n usedLocaleSize += valueSize;\n } else {\n unusedLocaleSize += valueSize;\n }\n }\n\n return { unusedLocaleSize, usedLocaleSize, dictionariesFound };\n};\n\n/**\n * Analyze the locale weight of a page's JavaScript bundles.\n *\n * @param chunks - The fetched JavaScript chunks (main + lazy).\n * @param htmlContent - The page HTML, used to estimate rendered content size.\n * @param currentLocale - The locale currently rendered by the page.\n * @param totalPageSize - The total transferred bytes measured for the page.\n * @returns The aggregated {@link BundleContentAnalysis}.\n */\nexport const analyzeBundleContent = (\n chunks: BundleChunkInput[],\n htmlContent: string,\n currentLocale: string,\n totalPageSize: number\n): BundleContentAnalysis => {\n const empty: BundleContentAnalysis = {\n currentLocale,\n totalPageSize,\n renderedContentSize: 0,\n contentSize: 0,\n totalLocaleSize: 0,\n totalUnusedLocaleSize: 0,\n unusedPercentOfLocale: 0,\n mainBundleChunks: [],\n lazyBundleChunks: [],\n };\n\n if (!chunks.length && !htmlContent) return empty;\n\n // Rendered content size from HTML visible text (deduplicated).\n const pageStrings = new Set(extractVisibleTextStrings(htmlContent));\n\n let renderedContentSize = 0;\n pageStrings.forEach((text) => {\n renderedContentSize += byteLength(text);\n });\n\n const baseCurrent = currentLocale.split('-')[0].toLowerCase();\n\n const mainBundleChunks: ChunkAnalysis[] = [];\n const lazyBundleChunks: ChunkAnalysis[] = [];\n\n for (const chunk of chunks) {\n const { unusedLocaleSize, usedLocaleSize, dictionariesFound } =\n analyzeChunkLocaleContent(chunk.content, baseCurrent);\n\n const totalLocaleSize = unusedLocaleSize + usedLocaleSize;\n const analysis: ChunkAnalysis = {\n url: chunk.url,\n fileSize: byteLength(chunk.content),\n totalLocaleSize,\n unusedLocaleSize,\n usedLocaleSize,\n dictionariesFound,\n unusedPercent:\n totalLocaleSize > 0\n ? Math.round((unusedLocaleSize / totalLocaleSize) * 100)\n : 0,\n };\n\n if (chunk.isMainBundle) {\n mainBundleChunks.push(analysis);\n } else if (dictionariesFound > 0) {\n lazyBundleChunks.push(analysis);\n }\n }\n\n const totalUnusedLocaleSize =\n mainBundleChunks.reduce((sum, c) => sum + c.unusedLocaleSize, 0) +\n lazyBundleChunks.reduce((sum, c) => sum + c.unusedLocaleSize, 0);\n const totalLocaleSize =\n mainBundleChunks.reduce((sum, c) => sum + c.totalLocaleSize, 0) +\n lazyBundleChunks.reduce((sum, c) => sum + c.totalLocaleSize, 0);\n const contentSize = renderedContentSize + totalLocaleSize;\n\n const unusedPercentOfLocale =\n totalLocaleSize > 0\n ? Math.round((totalUnusedLocaleSize / totalLocaleSize) * 100)\n : 0;\n\n return {\n currentLocale,\n totalPageSize,\n renderedContentSize,\n contentSize,\n totalLocaleSize,\n totalUnusedLocaleSize,\n unusedPercentOfLocale,\n mainBundleChunks,\n lazyBundleChunks,\n };\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,kBAAkB,IAAI,IAAI,OAAO,OAAO,YAAY,CAAa;AAEvE,MAAM,gBAAgB,QACpB,gBAA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EACpB,kBAAkB,EAAE;EACrB;AAED,KAAI,CAAC,OAAO,UAAU,CAAC,YAAa,QAAO;CAG3C,MAAM,cAAc,IAAI,IAAI,0BAA0B,YAAY,CAAC;CAEnE,IAAI,sBAAsB;AAC1B,aAAY,SAAS,SAAS;AAC5B,yBAAuB,WAAW,KAAK;GACvC;CAEF,MAAM,cAAc,cAAc,MAAM,IAAI,CAAC,GAAG,aAAa;CAE7D,MAAM,mBAAoC,EAAE;CAC5C,MAAM,mBAAoC,EAAE;AAE5C,MAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,EAAE,kBAAkB,gBAAgB,sBACxC,0BAA0B,MAAM,SAAS,YAAY;EAEvD,MAAM,kBAAkB,mBAAmB;EAC3C,MAAM,WAA0B;GAC9B,KAAK,MAAM;GACX,UAAU,WAAW,MAAM,QAAQ;GACnC;GACA;GACA;GACA;GACA,eACE,kBAAkB,IACd,KAAK,MAAO,mBAAmB,kBAAmB,IAAI,GACtD;GACP;AAED,MAAI,MAAM,aACR,kBAAiB,KAAK,SAAS;WACtB,oBAAoB,EAC7B,kBAAiB,KAAK,SAAS;;CAInC,MAAM,wBACJ,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,kBAAkB,EAAE,GAChE,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,kBAAkB,EAAE;CAClE,MAAM,kBACJ,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,iBAAiB,EAAE,GAC/D,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,iBAAiB,EAAE;CACjE,MAAM,cAAc,sBAAsB;CAE1C,MAAM,wBACJ,kBAAkB,IACd,KAAK,MAAO,wBAAwB,kBAAmB,IAAI,GAC3D;AAEN,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"analyzeBundleContent.mjs","names":[],"sources":["../../../src/scan/analyzeBundleContent.ts"],"sourcesContent":["import { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport { byteLength, extractVisibleTextStrings } from './parseHtml';\nimport type {\n BundleChunkInput,\n BundleContentAnalysis,\n ChunkAnalysis,\n} from './types';\n\n/**\n * Detect and measure localized (i18n) content embedded in JavaScript bundles.\n *\n * This is a dependency-free port of the hosted backend bundle analyzer: it\n * estimates how many translation strings ship in each chunk and, of those, how\n * many belong to locales other than the one currently rendered (i.e. dead\n * weight that a build-time optimization could strip).\n */\n\nconst allLocaleValues = new Set(Object.values(ALL_LOCALES) as string[]);\n\nconst isLocaleCode = (key: string): boolean =>\n allLocaleValues.has(key) || /^[a-z]{2}(-[A-Z]{2,4})?$/.test(key);\n\n/** Find the end index of the value following a `locale:` key. */\nconst extractValueEnd = (text: string, valueStart: number): number => {\n let cursor = valueStart;\n while (cursor < text.length && ' \\t\\n\\r'.includes(text[cursor])) cursor++;\n if (cursor >= text.length) return valueStart;\n\n const char = text[cursor];\n if (char === '{' || char === '[') {\n const endChar = char === '{' ? '}' : ']';\n let depth = 1;\n cursor++;\n while (cursor < text.length && depth > 0) {\n if (text[cursor] === char) depth++;\n else if (text[cursor] === endChar) depth--;\n else if (text[cursor] === '\"' || text[cursor] === '`') {\n const quote = text[cursor];\n cursor++;\n while (cursor < text.length) {\n if (text[cursor] === '\\\\') {\n cursor += 2;\n continue;\n }\n if (text[cursor] === quote) break;\n cursor++;\n }\n }\n cursor++;\n }\n return cursor;\n }\n if (char === '\"' || char === '`') {\n const quote = char;\n cursor++;\n while (cursor < text.length) {\n if (text[cursor] === '\\\\') {\n cursor += 2;\n continue;\n }\n if (text[cursor] === quote) {\n cursor++;\n break;\n }\n cursor++;\n }\n return cursor;\n }\n const endMatch = text.slice(cursor).search(/[,}\\]\\s]/);\n return endMatch === -1 ? text.length : cursor + endMatch;\n};\n\n// Matches both quoted (\"en\":) and unquoted (en:) locale keys followed by {\n// Works for any i18n solution — intlayer, i18next, vue-i18n, FormatJS, etc.\nconst LOCALE_KEY_PATTERN =\n /(?:\"([a-z]{2}(?:-[A-Z]{2,4})?)\"|\\b([a-z]{2}(?:-[A-Z]{2,4})?)\\b)\\s*:\\s*(?=\\{)/g;\n\n// Maximum character gap between two locale key positions to consider them\n// part of the same i18n object. Large enough for big translation objects.\nconst LOCALE_CLUSTER_WINDOW = 10_000;\n\n// Returns false when a candidate value is clearly not i18n text:\n// - contains hex/control escape sequences (ANSI codes, binary data)\nconst looksLikeI18nContent = (valueText: string): boolean => {\n if (/\\\\x[0-9a-fA-F]{2}/.test(valueText)) return false;\n if (/\\\\u00[01][0-9a-fA-F]/.test(valueText)) return false;\n return true;\n};\n\ntype LocaleMatch = {\n locale: string;\n position: number;\n valueStart: number;\n valueEnd: number;\n valueSize: number;\n};\n\nconst analyzeChunkLocaleContent = (\n text: string,\n baseCurrent: string\n): {\n unusedLocaleSize: number;\n usedLocaleSize: number;\n dictionariesFound: number;\n} => {\n // Step 1: collect all candidate locale key matches\n const candidates: LocaleMatch[] = [];\n const regex = new RegExp(LOCALE_KEY_PATTERN.source, 'g');\n let match = regex.exec(text);\n\n while (match !== null) {\n const locale = match[1] ?? match[2];\n if (isLocaleCode(locale)) {\n const valueStart = match.index + match[0].length;\n const valueEnd = extractValueEnd(text, valueStart);\n const valueSize = valueEnd - valueStart;\n const valueText = text.slice(valueStart, valueEnd);\n if (valueSize >= 5 && looksLikeI18nContent(valueText)) {\n candidates.push({\n locale,\n position: match.index,\n valueStart,\n valueEnd,\n valueSize,\n });\n }\n }\n match = regex.exec(text);\n }\n\n // Step 2: a locale key is i18n content only if another locale key with a\n // DIFFERENT locale code exists within LOCALE_CLUSTER_WINDOW chars.\n const isI18nMatch = (idx: number): boolean => {\n const base = candidates[idx].locale.split('-')[0].toLowerCase();\n for (let j = 0; j < candidates.length; j++) {\n if (j === idx) continue;\n const dist = Math.abs(candidates[j].position - candidates[idx].position);\n if (dist > LOCALE_CLUSTER_WINDOW) continue;\n if (candidates[j].locale.split('-')[0].toLowerCase() !== base)\n return true;\n }\n return false;\n };\n\n let unusedLocaleSize = 0;\n let usedLocaleSize = 0;\n let dictionariesFound = 0;\n\n for (let i = 0; i < candidates.length; i++) {\n if (!isI18nMatch(i)) continue;\n\n const { locale, valueSize } = candidates[i];\n dictionariesFound++;\n\n if (locale.split('-')[0].toLowerCase() === baseCurrent) {\n usedLocaleSize += valueSize;\n } else {\n unusedLocaleSize += valueSize;\n }\n }\n\n return { unusedLocaleSize, usedLocaleSize, dictionariesFound };\n};\n\n/**\n * Analyze the locale weight of a page's JavaScript bundles.\n *\n * @param chunks - The fetched JavaScript chunks (main + lazy).\n * @param htmlContent - The page HTML, used to estimate rendered content size.\n * @param currentLocale - The locale currently rendered by the page.\n * @param totalPageSize - The total transferred bytes measured for the page.\n * @returns The aggregated {@link BundleContentAnalysis}.\n */\nexport const analyzeBundleContent = (\n chunks: BundleChunkInput[],\n htmlContent: string,\n currentLocale: string,\n totalPageSize: number\n): BundleContentAnalysis => {\n const empty: BundleContentAnalysis = {\n currentLocale,\n totalPageSize,\n renderedContentSize: 0,\n contentSize: 0,\n totalLocaleSize: 0,\n totalUnusedLocaleSize: 0,\n unusedPercentOfLocale: 0,\n mainBundleChunks: [],\n lazyBundleChunks: [],\n };\n\n if (!chunks.length && !htmlContent) return empty;\n\n // Rendered content size from HTML visible text (deduplicated).\n const pageStrings = new Set(extractVisibleTextStrings(htmlContent));\n\n let renderedContentSize = 0;\n pageStrings.forEach((text) => {\n renderedContentSize += byteLength(text);\n });\n\n const baseCurrent = currentLocale.split('-')[0].toLowerCase();\n\n const mainBundleChunks: ChunkAnalysis[] = [];\n const lazyBundleChunks: ChunkAnalysis[] = [];\n\n for (const chunk of chunks) {\n const { unusedLocaleSize, usedLocaleSize, dictionariesFound } =\n analyzeChunkLocaleContent(chunk.content, baseCurrent);\n\n const totalLocaleSize = unusedLocaleSize + usedLocaleSize;\n const analysis: ChunkAnalysis = {\n url: chunk.url,\n fileSize: byteLength(chunk.content),\n totalLocaleSize,\n unusedLocaleSize,\n usedLocaleSize,\n dictionariesFound,\n unusedPercent:\n totalLocaleSize > 0\n ? Math.round((unusedLocaleSize / totalLocaleSize) * 100)\n : 0,\n };\n\n if (chunk.isMainBundle) {\n mainBundleChunks.push(analysis);\n } else if (dictionariesFound > 0) {\n lazyBundleChunks.push(analysis);\n }\n }\n\n const totalUnusedLocaleSize =\n mainBundleChunks.reduce((sum, c) => sum + c.unusedLocaleSize, 0) +\n lazyBundleChunks.reduce((sum, c) => sum + c.unusedLocaleSize, 0);\n const totalLocaleSize =\n mainBundleChunks.reduce((sum, c) => sum + c.totalLocaleSize, 0) +\n lazyBundleChunks.reduce((sum, c) => sum + c.totalLocaleSize, 0);\n const contentSize = renderedContentSize + totalLocaleSize;\n\n const unusedPercentOfLocale =\n totalLocaleSize > 0\n ? Math.round((totalUnusedLocaleSize / totalLocaleSize) * 100)\n : 0;\n\n return {\n currentLocale,\n totalPageSize,\n renderedContentSize,\n contentSize,\n totalLocaleSize,\n totalUnusedLocaleSize,\n unusedPercentOfLocale,\n mainBundleChunks,\n lazyBundleChunks,\n };\n};\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAM,kBAAkB,IAAI,IAAI,OAAO,OAAO,WAAW,CAAa;AAEtE,MAAM,gBAAgB,QACpB,gBAAgB,IAAI,GAAG,KAAK,2BAA2B,KAAK,GAAG;;AAGjE,MAAM,mBAAmB,MAAc,eAA+B;CACpE,IAAI,SAAS;CACb,OAAO,SAAS,KAAK,UAAU,SAAU,SAAS,KAAK,OAAO,GAAG;CACjE,IAAI,UAAU,KAAK,QAAQ,OAAO;CAElC,MAAM,OAAO,KAAK;CAClB,IAAI,SAAS,OAAO,SAAS,KAAK;EAChC,MAAM,UAAU,SAAS,MAAM,MAAM;EACrC,IAAI,QAAQ;EACZ;EACA,OAAO,SAAS,KAAK,UAAU,QAAQ,GAAG;GACxC,IAAI,KAAK,YAAY,MAAM;QACtB,IAAI,KAAK,YAAY,SAAS;QAC9B,IAAI,KAAK,YAAY,QAAO,KAAK,YAAY,KAAK;IACrD,MAAM,QA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,MAAM,SAAS,QAAQ;EAC1B,MAAM,EAAE,kBAAkB,gBAAgB,sBACxC,0BAA0B,MAAM,SAAS,WAAW;EAEtD,MAAM,kBAAkB,mBAAmB;EAC3C,MAAM,WAA0B;GAC9B,KAAK,MAAM;GACX,UAAU,WAAW,MAAM,OAAO;GAClC;GACA;GACA;GACA;GACA,eACE,kBAAkB,IACd,KAAK,MAAO,mBAAmB,kBAAmB,GAAG,IACrD;EACR;EAEA,IAAI,MAAM,cACR,iBAAiB,KAAK,QAAQ;OACzB,IAAI,oBAAoB,GAC7B,iBAAiB,KAAK,QAAQ;CAElC;CAEA,MAAM,wBACJ,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,kBAAkB,CAAC,IAC/D,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,kBAAkB,CAAC;CACjE,MAAM,kBACJ,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,iBAAiB,CAAC,IAC9D,iBAAiB,QAAQ,KAAK,MAAM,MAAM,EAAE,iBAAiB,CAAC;CAChE,MAAM,cAAc,sBAAsB;CAE1C,MAAM,wBACJ,kBAAkB,IACd,KAAK,MAAO,wBAAwB,kBAAmB,GAAG,IAC1D;CAEN,OAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"calculateScore.mjs","names":[],"sources":["../../../src/scan/calculateScore.ts"],"sourcesContent":["/**\n * Mutualized SEO/i18n scoring logic.\n *\n * This module is the single source of truth for turning audit/scan events into\n * a weighted score. It is consumed both by the hosted backend SEO audit\n * (`apps/backend`) and by the `intlayer scan` CLI command, so it must stay free\n * of any server-only dependency (no Fastify, no Cheerio, no logger coupling).\n */\n\n/** Accumulated score across all checks that ran. */\nexport type Score = {\n /** Sum of points obtained (success = full, warning = half, error = none). */\n score: number;\n /** Maximum achievable points for the checks that ran. */\n totalScore: number;\n};\n\n/**\n * Minimal shape of an event needed to contribute to the score.\n *\n * The `type` is the check identifier. URL-scoped checks are suffixed with the\n * URL using a backslash separator (e.g. `url_htmlLang\\https://example.com`), so\n * only the part before the first backslash is used to look up the weight.\n */\nexport type ScorableEvent = {\n type?: string;\n status?: string;\n};\n\n/**\n * Resolve how many points an event contributes based on its status.\n * - `warning` → half of the weight\n * - `error` → none\n * - anything else (`success`, `started`, `done`, …) → full weight\n */\nconst scoreCheck = (score: number, event: ScorableEvent): number => {\n if (event.status === 'warning') return score / 2;\n if (event.status === 'error') return 0;\n return score;\n};\n\n/** Weight (in points) of every scorable check. */\nexport const scoreRecord = {\n robots_robotsPresent: 10,\n robots_noLocalizedUrlsForgotten: 8,\n sitemap_sitemapPresent: 10,\n sitemap_noLocalizedUrlsForgotten: 9,\n sitemap_hasAlternates: 8,\n sitemap_hasXDefault: 7,\n url_htmlLang: 9,\n url_htmlDir: 3,\n url_hasCanonical: 10,\n url_hreflang: 9,\n url_hasLocalizedLinks: 8,\n url_hasXDefault: 7,\n url_allAnchorsLocalized: 6,\n url_currentLocale: 3,\n url_unusedBundleContent: 8,\n} as const;\n\n/** Identifier of a scorable check (without the URL suffix). */\nexport type ScoreCheckType = keyof typeof scoreRecord;\n\n/**\n * Apply a single event to the running score, returning a new {@link Score}.\n * Unknown check types are ignored so the function is safe to call on every\n * emitted event.\n *\n * @param score - The current accumulated score.\n * @param event - The event to fold into the score.\n * @returns A new score with the event applied.\n */\nexport const mutateScore = (score: Score, event: ScorableEvent): Score => {\n const newScore: Score = { ...score };\n\n const typeWithoutUrl = event.type?.split('\\\\')[0];\n\n if (!typeWithoutUrl) {\n return newScore;\n }\n\n const scoreValue = scoreRecord[typeWithoutUrl as ScoreCheckType];\n\n if (typeof scoreValue === 'number') {\n newScore.score += scoreCheck(scoreValue, event);\n newScore.totalScore += scoreValue;\n }\n\n return newScore;\n};\n\n/**\n * Convert a raw {@link Score} into a 0–100 percentage.\n *\n * @param score - The accumulated score.\n * @returns The rounded percentage, or 0 when no check ran.\n */\nexport const toScorePercent = (score: Score): number =>\n Math.round(score.totalScore > 0 ? (score.score / score.totalScore) * 100 : 0);\n"],"mappings":";;;;;;;AAmCA,MAAM,cAAc,OAAe,UAAiC;AAClE,KAAI,MAAM,WAAW,UAAW,QAAO,QAAQ;AAC/C,KAAI,MAAM,WAAW,QAAS,QAAO;AACrC,QAAO;;;AAIT,MAAa,cAAc;CACzB,sBAAsB;CACtB,iCAAiC;CACjC,wBAAwB;CACxB,kCAAkC;CAClC,uBAAuB;CACvB,qBAAqB;CACrB,cAAc;CACd,aAAa;CACb,kBAAkB;CAClB,cAAc;CACd,uBAAuB;CACvB,iBAAiB;CACjB,yBAAyB;CACzB,mBAAmB;CACnB,yBAAyB;CAC1B;;;;;;;;;;AAcD,MAAa,eAAe,OAAc,UAAgC;CACxE,MAAM,WAAkB,EAAE,GAAG,OAAO;CAEpC,MAAM,iBAAiB,MAAM,MAAM,MAAM,KAAK,CAAC;AAE/C,KAAI,CAAC,eACH,QAAO;CAGT,MAAM,aAAa,YAAY;AAE/B,KAAI,OAAO,eAAe,UAAU;AAClC,WAAS,SAAS,WAAW,YAAY,MAAM;AAC/C,WAAS,cAAc;;AAGzB,QAAO;;;;;;;;AAST,MAAa,kBAAkB,UAC7B,KAAK,MAAM,MAAM,aAAa,IAAK,MAAM,QAAQ,MAAM,aAAc,MAAM,EAAE"}
1
+ {"version":3,"file":"calculateScore.mjs","names":[],"sources":["../../../src/scan/calculateScore.ts"],"sourcesContent":["/**\n * Mutualized SEO/i18n scoring logic.\n *\n * This module is the single source of truth for turning audit/scan events into\n * a weighted score. It is consumed both by the hosted backend SEO audit\n * (`apps/backend`) and by the `intlayer scan` CLI command, so it must stay free\n * of any server-only dependency (no Fastify, no Cheerio, no logger coupling).\n */\n\n/** Accumulated score across all checks that ran. */\nexport type Score = {\n /** Sum of points obtained (success = full, warning = half, error = none). */\n score: number;\n /** Maximum achievable points for the checks that ran. */\n totalScore: number;\n};\n\n/**\n * Minimal shape of an event needed to contribute to the score.\n *\n * The `type` is the check identifier. URL-scoped checks are suffixed with the\n * URL using a backslash separator (e.g. `url_htmlLang\\https://example.com`), so\n * only the part before the first backslash is used to look up the weight.\n */\nexport type ScorableEvent = {\n type?: string;\n status?: string;\n};\n\n/**\n * Resolve how many points an event contributes based on its status.\n * - `warning` → half of the weight\n * - `error` → none\n * - anything else (`success`, `started`, `done`, …) → full weight\n */\nconst scoreCheck = (score: number, event: ScorableEvent): number => {\n if (event.status === 'warning') return score / 2;\n if (event.status === 'error') return 0;\n return score;\n};\n\n/** Weight (in points) of every scorable check. */\nexport const scoreRecord = {\n robots_robotsPresent: 10,\n robots_noLocalizedUrlsForgotten: 8,\n sitemap_sitemapPresent: 10,\n sitemap_noLocalizedUrlsForgotten: 9,\n sitemap_hasAlternates: 8,\n sitemap_hasXDefault: 7,\n url_htmlLang: 9,\n url_htmlDir: 3,\n url_hasCanonical: 10,\n url_hreflang: 9,\n url_hasLocalizedLinks: 8,\n url_hasXDefault: 7,\n url_allAnchorsLocalized: 6,\n url_currentLocale: 3,\n url_unusedBundleContent: 8,\n} as const;\n\n/** Identifier of a scorable check (without the URL suffix). */\nexport type ScoreCheckType = keyof typeof scoreRecord;\n\n/**\n * Apply a single event to the running score, returning a new {@link Score}.\n * Unknown check types are ignored so the function is safe to call on every\n * emitted event.\n *\n * @param score - The current accumulated score.\n * @param event - The event to fold into the score.\n * @returns A new score with the event applied.\n */\nexport const mutateScore = (score: Score, event: ScorableEvent): Score => {\n const newScore: Score = { ...score };\n\n const typeWithoutUrl = event.type?.split('\\\\')[0];\n\n if (!typeWithoutUrl) {\n return newScore;\n }\n\n const scoreValue = scoreRecord[typeWithoutUrl as ScoreCheckType];\n\n if (typeof scoreValue === 'number') {\n newScore.score += scoreCheck(scoreValue, event);\n newScore.totalScore += scoreValue;\n }\n\n return newScore;\n};\n\n/**\n * Convert a raw {@link Score} into a 0–100 percentage.\n *\n * @param score - The accumulated score.\n * @returns The rounded percentage, or 0 when no check ran.\n */\nexport const toScorePercent = (score: Score): number =>\n Math.round(score.totalScore > 0 ? (score.score / score.totalScore) * 100 : 0);\n"],"mappings":";;;;;;;AAmCA,MAAM,cAAc,OAAe,UAAiC;CAClE,IAAI,MAAM,WAAW,WAAW,OAAO,QAAQ;CAC/C,IAAI,MAAM,WAAW,SAAS,OAAO;CACrC,OAAO;AACT;;AAGA,MAAa,cAAc;CACzB,sBAAsB;CACtB,iCAAiC;CACjC,wBAAwB;CACxB,kCAAkC;CAClC,uBAAuB;CACvB,qBAAqB;CACrB,cAAc;CACd,aAAa;CACb,kBAAkB;CAClB,cAAc;CACd,uBAAuB;CACvB,iBAAiB;CACjB,yBAAyB;CACzB,mBAAmB;CACnB,yBAAyB;AAC3B;;;;;;;;;;AAcA,MAAa,eAAe,OAAc,UAAgC;CACxE,MAAM,WAAkB,EAAE,GAAG,MAAM;CAEnC,MAAM,iBAAiB,MAAM,MAAM,MAAM,IAAI,CAAC,CAAC;CAE/C,IAAI,CAAC,gBACH,OAAO;CAGT,MAAM,aAAa,YAAY;CAE/B,IAAI,OAAO,eAAe,UAAU;EAClC,SAAS,SAAS,WAAW,YAAY,KAAK;EAC9C,SAAS,cAAc;CACzB;CAEA,OAAO;AACT;;;;;;;AAQA,MAAa,kBAAkB,UAC7B,KAAK,MAAM,MAAM,aAAa,IAAK,MAAM,QAAQ,MAAM,aAAc,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"checks.mjs","names":[],"sources":["../../../src/scan/checks.ts"],"sourcesContent":["import { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport { analyzeBundleContent } from './analyzeBundleContent';\nimport {\n type Anchor,\n extractHreflangs,\n extractHtmlDir,\n extractHtmlLang,\n hasCanonical,\n} from './parseHtml';\nimport type {\n BundleChunkInput,\n BundleContentAnalysis,\n ScanEvent,\n} from './types';\n\n/** Format a byte count as a human-readable size. */\nexport const formatSize = (bytes: number): string => {\n if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;\n if (bytes >= 1024) return `${(bytes / 1024).toFixed(2)} KB`;\n return `${bytes} B`;\n};\n\n/**\n * Check the `<html>` element attributes (`lang`, `dir`) and the resulting\n * current-locale signal. Returns the detected language tag.\n */\nexport const checkHtmlAttributes = (\n html: string,\n targetUrl: string,\n events: ScanEvent[]\n): { langTag: string | undefined } => {\n const langTag = extractHtmlLang(html);\n const dirTag = extractHtmlDir(html);\n\n events.push({\n type: `url_htmlLang\\\\${targetUrl}`,\n status: langTag ? 'success' : 'error',\n details: {\n success: langTag,\n error: langTag ? undefined : 'Missing html lang attribute',\n },\n });\n\n events.push({\n type: `url_currentLocale\\\\${targetUrl}`,\n status: langTag ? 'success' : 'warning',\n details: {\n success: langTag,\n warning: langTag ? undefined : 'No locale detected',\n },\n });\n\n events.push({\n type: `url_htmlDir\\\\${targetUrl}`,\n status: dirTag ? 'success' : 'warning',\n details: {\n success: dirTag,\n warning: dirTag ? undefined : 'Missing html dir attribute',\n },\n });\n\n return { langTag };\n};\n\n/** Check the presence of a canonical link. */\nexport const checkCanonical = (\n html: string,\n targetUrl: string,\n events: ScanEvent[]\n): void => {\n const present = hasCanonical(html);\n events.push({\n type: `url_hasCanonical\\\\${targetUrl}`,\n status: present ? 'success' : 'warning',\n details: { warning: present ? undefined : 'Missing canonical link' },\n });\n};\n\n/**\n * Check the page's hreflang structure and collect discovered locales into\n * `localesSet`.\n */\nexport const checkLinguisticStructure = (\n html: string,\n targetUrl: string,\n localesSet: Set<string>,\n events: ScanEvent[]\n): void => {\n const langTag = extractHtmlLang(html);\n if (langTag) localesSet.add(langTag);\n\n const hreflangs = extractHreflangs(html);\n for (const { hreflang } of hreflangs) {\n if (hreflang !== 'x-default') localesSet.add(hreflang);\n }\n\n const hasXDefault = hreflangs.some((h) => h.hreflang === 'x-default');\n\n events.push({\n type: `url_hreflang\\\\${targetUrl}`,\n status: hreflangs.length > 0 ? 'success' : 'warning',\n details: {\n success: hreflangs.length > 0 ? hreflangs : undefined,\n warning: hreflangs.length === 0 ? 'No hreflang tags found' : undefined,\n },\n });\n\n events.push({\n type: `url_hasXDefault\\\\${targetUrl}`,\n status: hasXDefault ? 'success' : 'error',\n details: {\n error: hasXDefault ? undefined : 'Missing x-default hreflang link',\n },\n });\n};\n\nconst normalizeHost = (host: string): string =>\n host.startsWith('www.') ? host.slice(4) : host;\n\nconst localeValues = Object.values(ALL_LOCALES) as string[];\n\n/**\n * Check whether internal links carry a locale segment, mirroring the hosted\n * audit's URL-structure analysis but operating on parsed anchors instead of a\n * live DOM.\n */\nexport const checkUrlStructure = (\n anchors: Anchor[],\n origin: string,\n targetUrl: string,\n events: ScanEvent[]\n): void => {\n const targetHostname = normalizeHost(new URL(origin).hostname);\n\n let localizedCount = 0;\n let totalInternalCount = 0;\n const nonLocalizedLinks: string[] = [];\n\n for (const { href } of anchors) {\n if (!href || href.startsWith('#') || href.startsWith('javascript:'))\n continue;\n\n try {\n const url = new URL(href, origin);\n if (normalizeHost(url.hostname) !== targetHostname) continue;\n\n totalInternalCount++;\n const path = url.pathname.toLowerCase();\n const hostname = url.hostname.toLowerCase();\n\n const hasLocaleInPath = localeValues.some((locale) => {\n const l = locale.toLowerCase();\n return path === `/${l}` || path.includes(`/${l}/`);\n });\n const hasLocaleInSubdomain = localeValues.some((locale) => {\n const l = locale.toLowerCase();\n return hostname.startsWith(`${l}.`) || hostname.includes(`.${l}.`);\n });\n\n if (hasLocaleInPath || hasLocaleInSubdomain) {\n localizedCount++;\n } else {\n nonLocalizedLinks.push(href);\n }\n } catch {\n /* ignore malformed URLs */\n }\n }\n\n const hasLocalizedLinks = localizedCount > 0;\n const allAnchorsLocalized =\n totalInternalCount === 0 || localizedCount === totalInternalCount;\n\n events.push({\n type: `url_hasLocalizedLinks\\\\${targetUrl}`,\n status: hasLocalizedLinks ? 'success' : 'warning',\n details: {\n success: hasLocalizedLinks\n ? `${localizedCount} localized links found out of ${totalInternalCount} internal links`\n : undefined,\n warning: hasLocalizedLinks ? undefined : 'No localized links found',\n },\n });\n\n events.push({\n type: `url_allAnchorsLocalized\\\\${targetUrl}`,\n status: allAnchorsLocalized ? 'success' : 'warning',\n details: {\n warning: allAnchorsLocalized\n ? undefined\n : {\n message: 'Some internal links are not localized',\n links: nonLocalizedLinks,\n },\n },\n });\n};\n\n/**\n * Analyze the JavaScript bundles for unused locale content and emit the\n * corresponding event. Returns the analysis so callers can report on it.\n */\nexport const checkBundleContent = (\n chunks: BundleChunkInput[],\n html: string,\n currentLocale: string | undefined,\n targetUrl: string,\n totalPageSize: number,\n events: ScanEvent[]\n): BundleContentAnalysis | undefined => {\n if (!currentLocale) {\n events.push({\n type: `url_unusedBundleContent\\\\${targetUrl}`,\n status: 'warning',\n details: {\n warning: 'Cannot analyse bundle content: page locale not detected',\n },\n });\n return undefined;\n }\n\n const analysis = analyzeBundleContent(\n chunks,\n html,\n currentLocale,\n totalPageSize\n );\n\n // Status is driven by the main bundle — lazy chunks with unused content are expected.\n const mainBundleMaxUnused = analysis.mainBundleChunks.reduce(\n (max, c) => Math.max(max, c.unusedPercent),\n 0\n );\n\n const status =\n mainBundleMaxUnused === 0\n ? 'success'\n : mainBundleMaxUnused <= 30\n ? 'warning'\n : 'error';\n\n events.push({\n type: `url_unusedBundleContent\\\\${targetUrl}`,\n status,\n details: { [status]: analysis },\n });\n\n return analysis;\n};\n\n/** Fetch and check `robots.txt`, emitting robots-related events. */\nexport const checkRobots = async (\n origin: string,\n discoveredLocales: Set<string>,\n userAgent: string,\n events: ScanEvent[]\n): Promise<void> => {\n let robotsPresent = false;\n let noLocalizedUrlsForgotten = true;\n const errors: string[] = [];\n\n try {\n const response = await fetch(`${origin}/robots.txt`, {\n headers: { 'User-Agent': userAgent },\n });\n\n if (response.ok) {\n robotsPresent = true;\n const content = await response.text();\n\n if (content && discoveredLocales.size > 0) {\n const disallowedPaths = content\n .split('\\n')\n .map((line) => line.trim().toLowerCase())\n .filter((line) => line.startsWith('disallow:'))\n .map((line) => line.slice('disallow:'.length).trim());\n\n for (const locale of discoveredLocales) {\n for (const path of disallowedPaths) {\n if (path === `/${locale}` || path === `/${locale}/`) {\n noLocalizedUrlsForgotten = false;\n errors.push(\n `Locale path \"${locale}\" appears to be blocked in robots.txt: ${path}`\n );\n }\n }\n }\n }\n }\n } catch (error) {\n errors.push(\n `Failed to fetch robots.txt: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n events.push({\n type: 'robots_robotsPresent',\n status: robotsPresent ? 'success' : 'warning',\n details: {\n warning: robotsPresent ? undefined : 'No robots.txt found',\n error: errors.length > 0 ? errors : undefined,\n },\n });\n\n if (robotsPresent) {\n events.push({\n type: 'robots_noLocalizedUrlsForgotten',\n status: noLocalizedUrlsForgotten ? 'success' : 'error',\n details: { error: noLocalizedUrlsForgotten ? undefined : errors },\n });\n }\n};\n\n/** Fetch and check `sitemap.xml`, emitting sitemap-related events. */\nexport const checkSitemap = async (\n origin: string,\n discoveredLocales: Set<string>,\n userAgent: string,\n events: ScanEvent[]\n): Promise<void> => {\n let sitemapPresent = false;\n let hasXDefault = false;\n let hasAlternates = false;\n let noLocalizedUrlsForgotten = true;\n const errors: string[] = [];\n\n try {\n const response = await fetch(`${origin}/sitemap.xml`, {\n headers: { 'User-Agent': userAgent },\n });\n\n if (response.ok) {\n sitemapPresent = true;\n const content = await response.text();\n\n const hreflangMatches = content.match(/hreflang\\s*=\\s*\"([^\"]+)\"/gi) ?? [];\n const hreflangs = hreflangMatches.map((m) =>\n m.replace(/hreflang\\s*=\\s*\"/i, '').replace(/\"$/, '')\n );\n hasAlternates = hreflangs.length > 0;\n hasXDefault = hreflangs.includes('x-default');\n\n if (discoveredLocales.size > 0) {\n const urlBlocks = content.match(/<url\\b[\\s\\S]*?<\\/url>/gi) ?? [];\n const allFoundLocales = new Set<string>();\n let anyUrlMissingLocale = false;\n\n for (const block of urlBlocks) {\n const localesInUrl = new Set<string>();\n\n for (const hreflang of block.match(/hreflang\\s*=\\s*\"([^\"]+)\"/gi) ??\n []) {\n const value = hreflang\n .replace(/hreflang\\s*=\\s*\"/i, '')\n .replace(/\"$/, '');\n if (value !== 'x-default') {\n localesInUrl.add(value);\n allFoundLocales.add(value);\n }\n }\n\n const loc = block.match(/<loc>([\\s\\S]*?)<\\/loc>/i)?.[1]?.trim();\n if (loc) {\n try {\n const firstSegment = new URL(loc).pathname\n .split('/')\n .filter(Boolean)[0];\n if (firstSegment && discoveredLocales.has(firstSegment)) {\n localesInUrl.add(firstSegment);\n allFoundLocales.add(firstSegment);\n }\n } catch {\n /* invalid loc URL, skip */\n }\n }\n\n const missing = [...discoveredLocales].filter(\n (locale) => !localesInUrl.has(locale)\n );\n if (missing.length > 0 && missing.length < discoveredLocales.size) {\n anyUrlMissingLocale = true;\n }\n }\n\n const completelyMissing = [...discoveredLocales].filter(\n (locale) => !allFoundLocales.has(locale)\n );\n if (anyUrlMissingLocale || completelyMissing.length > 0) {\n noLocalizedUrlsForgotten = false;\n if (completelyMissing.length > 0) {\n errors.push(\n `The following locales are completely missing from the sitemap: ${completelyMissing.join(', ')}`\n );\n }\n }\n }\n }\n } catch (error) {\n errors.push(\n `Failed to fetch sitemap.xml: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n events.push({\n type: 'sitemap_sitemapPresent',\n status: sitemapPresent ? 'success' : 'warning',\n details: {\n warning: sitemapPresent ? undefined : 'No sitemap.xml found',\n error: errors.length > 0 ? errors : undefined,\n },\n });\n\n if (sitemapPresent) {\n events.push({\n type: 'sitemap_noLocalizedUrlsForgotten',\n status: noLocalizedUrlsForgotten ? 'success' : 'warning',\n details: { warning: noLocalizedUrlsForgotten ? undefined : errors },\n });\n\n events.push({\n type: 'sitemap_hasXDefault',\n status: hasXDefault ? 'success' : 'warning',\n details: {\n warning: hasXDefault ? undefined : 'No x-default hreflang in sitemap',\n },\n });\n\n events.push({\n type: 'sitemap_hasAlternates',\n status: hasAlternates ? 'success' : 'warning',\n details: {\n warning: hasAlternates\n ? undefined\n : 'No alternate language links found in sitemap',\n },\n });\n }\n};\n"],"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,2BAA2B,YAAY;GAC/C,SAAS,EAAE,SAAS,2BAA2B,SAAY,QAAQ;GACpE,CAAC;AAEF,SAAO,KAAK;GACV,MAAM;GACN,QAAQ,cAAc,YAAY;GAClC,SAAS,EACP,SAAS,cAAc,SAAY,oCACpC;GACF,CAAC;AAEF,SAAO,KAAK;GACV,MAAM;GACN,QAAQ,gBAAgB,YAAY;GACpC,SAAS,EACP,SAAS,gBACL,SACA,gDACL;GACF,CAAC"}
1
+ {"version":3,"file":"checks.mjs","names":[],"sources":["../../../src/scan/checks.ts"],"sourcesContent":["import { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport { analyzeBundleContent } from './analyzeBundleContent';\nimport {\n type Anchor,\n extractHreflangs,\n extractHtmlDir,\n extractHtmlLang,\n hasCanonical,\n} from './parseHtml';\nimport type {\n BundleChunkInput,\n BundleContentAnalysis,\n ScanEvent,\n} from './types';\n\n/** Format a byte count as a human-readable size. */\nexport const formatSize = (bytes: number): string => {\n if (bytes >= 1024 * 1024) return `${(bytes / (1024 * 1024)).toFixed(2)} MB`;\n if (bytes >= 1024) return `${(bytes / 1024).toFixed(2)} KB`;\n return `${bytes} B`;\n};\n\n/**\n * Check the `<html>` element attributes (`lang`, `dir`) and the resulting\n * current-locale signal. Returns the detected language tag.\n */\nexport const checkHtmlAttributes = (\n html: string,\n targetUrl: string,\n events: ScanEvent[]\n): { langTag: string | undefined } => {\n const langTag = extractHtmlLang(html);\n const dirTag = extractHtmlDir(html);\n\n events.push({\n type: `url_htmlLang\\\\${targetUrl}`,\n status: langTag ? 'success' : 'error',\n details: {\n success: langTag,\n error: langTag ? undefined : 'Missing html lang attribute',\n },\n });\n\n events.push({\n type: `url_currentLocale\\\\${targetUrl}`,\n status: langTag ? 'success' : 'warning',\n details: {\n success: langTag,\n warning: langTag ? undefined : 'No locale detected',\n },\n });\n\n events.push({\n type: `url_htmlDir\\\\${targetUrl}`,\n status: dirTag ? 'success' : 'warning',\n details: {\n success: dirTag,\n warning: dirTag ? undefined : 'Missing html dir attribute',\n },\n });\n\n return { langTag };\n};\n\n/** Check the presence of a canonical link. */\nexport const checkCanonical = (\n html: string,\n targetUrl: string,\n events: ScanEvent[]\n): void => {\n const present = hasCanonical(html);\n events.push({\n type: `url_hasCanonical\\\\${targetUrl}`,\n status: present ? 'success' : 'warning',\n details: { warning: present ? undefined : 'Missing canonical link' },\n });\n};\n\n/**\n * Check the page's hreflang structure and collect discovered locales into\n * `localesSet`.\n */\nexport const checkLinguisticStructure = (\n html: string,\n targetUrl: string,\n localesSet: Set<string>,\n events: ScanEvent[]\n): void => {\n const langTag = extractHtmlLang(html);\n if (langTag) localesSet.add(langTag);\n\n const hreflangs = extractHreflangs(html);\n for (const { hreflang } of hreflangs) {\n if (hreflang !== 'x-default') localesSet.add(hreflang);\n }\n\n const hasXDefault = hreflangs.some((h) => h.hreflang === 'x-default');\n\n events.push({\n type: `url_hreflang\\\\${targetUrl}`,\n status: hreflangs.length > 0 ? 'success' : 'warning',\n details: {\n success: hreflangs.length > 0 ? hreflangs : undefined,\n warning: hreflangs.length === 0 ? 'No hreflang tags found' : undefined,\n },\n });\n\n events.push({\n type: `url_hasXDefault\\\\${targetUrl}`,\n status: hasXDefault ? 'success' : 'error',\n details: {\n error: hasXDefault ? undefined : 'Missing x-default hreflang link',\n },\n });\n};\n\nconst normalizeHost = (host: string): string =>\n host.startsWith('www.') ? host.slice(4) : host;\n\nconst localeValues = Object.values(ALL_LOCALES) as string[];\n\n/**\n * Check whether internal links carry a locale segment, mirroring the hosted\n * audit's URL-structure analysis but operating on parsed anchors instead of a\n * live DOM.\n */\nexport const checkUrlStructure = (\n anchors: Anchor[],\n origin: string,\n targetUrl: string,\n events: ScanEvent[]\n): void => {\n const targetHostname = normalizeHost(new URL(origin).hostname);\n\n let localizedCount = 0;\n let totalInternalCount = 0;\n const nonLocalizedLinks: string[] = [];\n\n for (const { href } of anchors) {\n if (!href || href.startsWith('#') || href.startsWith('javascript:'))\n continue;\n\n try {\n const url = new URL(href, origin);\n if (normalizeHost(url.hostname) !== targetHostname) continue;\n\n totalInternalCount++;\n const path = url.pathname.toLowerCase();\n const hostname = url.hostname.toLowerCase();\n\n const hasLocaleInPath = localeValues.some((locale) => {\n const l = locale.toLowerCase();\n return path === `/${l}` || path.includes(`/${l}/`);\n });\n const hasLocaleInSubdomain = localeValues.some((locale) => {\n const l = locale.toLowerCase();\n return hostname.startsWith(`${l}.`) || hostname.includes(`.${l}.`);\n });\n\n if (hasLocaleInPath || hasLocaleInSubdomain) {\n localizedCount++;\n } else {\n nonLocalizedLinks.push(href);\n }\n } catch {\n /* ignore malformed URLs */\n }\n }\n\n const hasLocalizedLinks = localizedCount > 0;\n const allAnchorsLocalized =\n totalInternalCount === 0 || localizedCount === totalInternalCount;\n\n events.push({\n type: `url_hasLocalizedLinks\\\\${targetUrl}`,\n status: hasLocalizedLinks ? 'success' : 'warning',\n details: {\n success: hasLocalizedLinks\n ? `${localizedCount} localized links found out of ${totalInternalCount} internal links`\n : undefined,\n warning: hasLocalizedLinks ? undefined : 'No localized links found',\n },\n });\n\n events.push({\n type: `url_allAnchorsLocalized\\\\${targetUrl}`,\n status: allAnchorsLocalized ? 'success' : 'warning',\n details: {\n warning: allAnchorsLocalized\n ? undefined\n : {\n message: 'Some internal links are not localized',\n links: nonLocalizedLinks,\n },\n },\n });\n};\n\n/**\n * Analyze the JavaScript bundles for unused locale content and emit the\n * corresponding event. Returns the analysis so callers can report on it.\n */\nexport const checkBundleContent = (\n chunks: BundleChunkInput[],\n html: string,\n currentLocale: string | undefined,\n targetUrl: string,\n totalPageSize: number,\n events: ScanEvent[]\n): BundleContentAnalysis | undefined => {\n if (!currentLocale) {\n events.push({\n type: `url_unusedBundleContent\\\\${targetUrl}`,\n status: 'warning',\n details: {\n warning: 'Cannot analyse bundle content: page locale not detected',\n },\n });\n return undefined;\n }\n\n const analysis = analyzeBundleContent(\n chunks,\n html,\n currentLocale,\n totalPageSize\n );\n\n // Status is driven by the main bundle — lazy chunks with unused content are expected.\n const mainBundleMaxUnused = analysis.mainBundleChunks.reduce(\n (max, c) => Math.max(max, c.unusedPercent),\n 0\n );\n\n const status =\n mainBundleMaxUnused === 0\n ? 'success'\n : mainBundleMaxUnused <= 30\n ? 'warning'\n : 'error';\n\n events.push({\n type: `url_unusedBundleContent\\\\${targetUrl}`,\n status,\n details: { [status]: analysis },\n });\n\n return analysis;\n};\n\n/** Fetch and check `robots.txt`, emitting robots-related events. */\nexport const checkRobots = async (\n origin: string,\n discoveredLocales: Set<string>,\n userAgent: string,\n events: ScanEvent[]\n): Promise<void> => {\n let robotsPresent = false;\n let noLocalizedUrlsForgotten = true;\n const errors: string[] = [];\n\n try {\n const response = await fetch(`${origin}/robots.txt`, {\n headers: { 'User-Agent': userAgent },\n });\n\n if (response.ok) {\n robotsPresent = true;\n const content = await response.text();\n\n if (content && discoveredLocales.size > 0) {\n const disallowedPaths = content\n .split('\\n')\n .map((line) => line.trim().toLowerCase())\n .filter((line) => line.startsWith('disallow:'))\n .map((line) => line.slice('disallow:'.length).trim());\n\n for (const locale of discoveredLocales) {\n for (const path of disallowedPaths) {\n if (path === `/${locale}` || path === `/${locale}/`) {\n noLocalizedUrlsForgotten = false;\n errors.push(\n `Locale path \"${locale}\" appears to be blocked in robots.txt: ${path}`\n );\n }\n }\n }\n }\n }\n } catch (error) {\n errors.push(\n `Failed to fetch robots.txt: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n events.push({\n type: 'robots_robotsPresent',\n status: robotsPresent ? 'success' : 'warning',\n details: {\n warning: robotsPresent ? undefined : 'No robots.txt found',\n error: errors.length > 0 ? errors : undefined,\n },\n });\n\n if (robotsPresent) {\n events.push({\n type: 'robots_noLocalizedUrlsForgotten',\n status: noLocalizedUrlsForgotten ? 'success' : 'error',\n details: { error: noLocalizedUrlsForgotten ? undefined : errors },\n });\n }\n};\n\n/** Fetch and check `sitemap.xml`, emitting sitemap-related events. */\nexport const checkSitemap = async (\n origin: string,\n discoveredLocales: Set<string>,\n userAgent: string,\n events: ScanEvent[]\n): Promise<void> => {\n let sitemapPresent = false;\n let hasXDefault = false;\n let hasAlternates = false;\n let noLocalizedUrlsForgotten = true;\n const errors: string[] = [];\n\n try {\n const response = await fetch(`${origin}/sitemap.xml`, {\n headers: { 'User-Agent': userAgent },\n });\n\n if (response.ok) {\n sitemapPresent = true;\n const content = await response.text();\n\n const hreflangMatches = content.match(/hreflang\\s*=\\s*\"([^\"]+)\"/gi) ?? [];\n const hreflangs = hreflangMatches.map((m) =>\n m.replace(/hreflang\\s*=\\s*\"/i, '').replace(/\"$/, '')\n );\n hasAlternates = hreflangs.length > 0;\n hasXDefault = hreflangs.includes('x-default');\n\n if (discoveredLocales.size > 0) {\n const urlBlocks = content.match(/<url\\b[\\s\\S]*?<\\/url>/gi) ?? [];\n const allFoundLocales = new Set<string>();\n let anyUrlMissingLocale = false;\n\n for (const block of urlBlocks) {\n const localesInUrl = new Set<string>();\n\n for (const hreflang of block.match(/hreflang\\s*=\\s*\"([^\"]+)\"/gi) ??\n []) {\n const value = hreflang\n .replace(/hreflang\\s*=\\s*\"/i, '')\n .replace(/\"$/, '');\n if (value !== 'x-default') {\n localesInUrl.add(value);\n allFoundLocales.add(value);\n }\n }\n\n const loc = block.match(/<loc>([\\s\\S]*?)<\\/loc>/i)?.[1]?.trim();\n if (loc) {\n try {\n const firstSegment = new URL(loc).pathname\n .split('/')\n .filter(Boolean)[0];\n if (firstSegment && discoveredLocales.has(firstSegment)) {\n localesInUrl.add(firstSegment);\n allFoundLocales.add(firstSegment);\n }\n } catch {\n /* invalid loc URL, skip */\n }\n }\n\n const missing = [...discoveredLocales].filter(\n (locale) => !localesInUrl.has(locale)\n );\n if (missing.length > 0 && missing.length < discoveredLocales.size) {\n anyUrlMissingLocale = true;\n }\n }\n\n const completelyMissing = [...discoveredLocales].filter(\n (locale) => !allFoundLocales.has(locale)\n );\n if (anyUrlMissingLocale || completelyMissing.length > 0) {\n noLocalizedUrlsForgotten = false;\n if (completelyMissing.length > 0) {\n errors.push(\n `The following locales are completely missing from the sitemap: ${completelyMissing.join(', ')}`\n );\n }\n }\n }\n }\n } catch (error) {\n errors.push(\n `Failed to fetch sitemap.xml: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n events.push({\n type: 'sitemap_sitemapPresent',\n status: sitemapPresent ? 'success' : 'warning',\n details: {\n warning: sitemapPresent ? undefined : 'No sitemap.xml found',\n error: errors.length > 0 ? errors : undefined,\n },\n });\n\n if (sitemapPresent) {\n events.push({\n type: 'sitemap_noLocalizedUrlsForgotten',\n status: noLocalizedUrlsForgotten ? 'success' : 'warning',\n details: { warning: noLocalizedUrlsForgotten ? undefined : errors },\n });\n\n events.push({\n type: 'sitemap_hasXDefault',\n status: hasXDefault ? 'success' : 'warning',\n details: {\n warning: hasXDefault ? undefined : 'No x-default hreflang in sitemap',\n },\n });\n\n events.push({\n type: 'sitemap_hasAlternates',\n status: hasAlternates ? 'success' : 'warning',\n details: {\n warning: hasAlternates\n ? undefined\n : 'No alternate language links found in sitemap',\n },\n });\n }\n};\n"],"mappings":";;;;;;AAgBA,MAAa,cAAc,UAA0B;CACnD,IAAI,SAAS,OAAO,MAAM,OAAO,IAAI,SAAS,OAAO,MAAK,CAAE,QAAQ,CAAC,EAAE;CACvE,IAAI,SAAS,MAAM,OAAO,IAAI,QAAQ,KAAI,CAAE,QAAQ,CAAC,EAAE;CACvD,OAAO,GAAG,MAAM;AAClB;;;;;AAMA,MAAa,uBACX,MACA,WACA,WACoC;CACpC,MAAM,UAAU,gBAAgB,IAAI;CACpC,MAAM,SAAS,eAAe,IAAI;CAElC,OAAO,KAAK;EACV,MAAM,iBAAiB;EACvB,QAAQ,UAAU,YAAY;EAC9B,SAAS;GACP,SAAS;GACT,OAAO,UAAU,SAAY;EAC/B;CACF,CAAC;CAED,OAAO,KAAK;EACV,MAAM,sBAAsB;EAC5B,QAAQ,UAAU,YAAY;EAC9B,SAAS;GACP,SAAS;GACT,SAAS,UAAU,SA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