@intlayer/cli 9.7.0 → 9.7.2

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 (320) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -2
  2. package/dist/cjs/_virtual/_rolldown/runtime.cjs +1 -2
  3. package/dist/cjs/_virtual/_utils_asset.cjs +1 -2
  4. package/dist/cjs/auth/login.cjs +8 -9
  5. package/dist/cjs/auth/sessionToken.cjs +1 -2
  6. package/dist/cjs/auth/setupRepository.cjs +6 -7
  7. package/dist/cjs/build.cjs +2 -3
  8. package/dist/cjs/bundle.cjs +1 -2
  9. package/dist/cjs/bundle.cjs.map +1 -1
  10. package/dist/cjs/ci.cjs +2 -3
  11. package/dist/cjs/cli.cjs +8 -5
  12. package/dist/cjs/cli.cjs.map +1 -1
  13. package/dist/cjs/config.cjs +2 -3
  14. package/dist/cjs/editor.cjs +3 -4
  15. package/dist/cjs/extract.cjs +6 -7
  16. package/dist/cjs/fill/deepMergeContent.cjs +1 -2
  17. package/dist/cjs/fill/extractTranslatableContent.cjs +1 -2
  18. package/dist/cjs/fill/fill.cjs +9 -10
  19. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +1 -2
  20. package/dist/cjs/fill/formatFillData.cjs +2 -3
  21. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +1 -2
  22. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +1 -2
  23. package/dist/cjs/fill/index.cjs +2 -2
  24. package/dist/cjs/fill/listTranslationsTasks.cjs +4 -5
  25. package/dist/cjs/fill/translateDictionary.cjs +7 -8
  26. package/dist/cjs/fill/writeFill.cjs +4 -5
  27. package/dist/cjs/getTargetDictionary.cjs +2 -3
  28. package/dist/cjs/index.cjs +28 -27
  29. package/dist/cjs/init.cjs +30 -13
  30. package/dist/cjs/init.cjs.map +1 -1
  31. package/dist/cjs/initChromeExtension.cjs +5 -6
  32. package/dist/cjs/initInfra.cjs +4 -5
  33. package/dist/cjs/initMCP.cjs +6 -7
  34. package/dist/cjs/initSkills.cjs +6 -7
  35. package/dist/cjs/listContentDeclaration.cjs +3 -4
  36. package/dist/cjs/listProjects.cjs +2 -3
  37. package/dist/cjs/liveSync.cjs +7 -8
  38. package/dist/cjs/loadPrompts.cjs +1 -2
  39. package/dist/cjs/pull.cjs +20 -13
  40. package/dist/cjs/pull.cjs.map +1 -1
  41. package/dist/cjs/push/pullLog.cjs +2 -3
  42. package/dist/cjs/push/push.cjs +12 -12
  43. package/dist/cjs/push/push.cjs.map +1 -1
  44. package/dist/cjs/pushConfig.cjs +4 -5
  45. package/dist/cjs/pushLog.cjs +2 -3
  46. package/dist/cjs/reviewDoc/reviewDoc.cjs +14 -14
  47. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  48. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +9 -10
  49. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  50. package/dist/cjs/reviewDoc/reviewDocLog.cjs +2 -3
  51. package/dist/cjs/reviewDoc/reviewDocProgress.cjs +2 -3
  52. package/dist/cjs/reviewDoc/reviewDocSynthesis.cjs +2 -3
  53. package/dist/cjs/scan.cjs +2 -3
  54. package/dist/cjs/searchDoc.cjs +2 -3
  55. package/dist/cjs/test/index.cjs +2 -2
  56. package/dist/cjs/test/listMissingTranslations.cjs +2 -3
  57. package/dist/cjs/test/test.cjs +4 -5
  58. package/dist/cjs/translateDoc/index.cjs +3 -3
  59. package/dist/cjs/translateDoc/translateDoc.cjs +10 -11
  60. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  61. package/dist/cjs/translateDoc/translateFile.cjs +10 -11
  62. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  63. package/dist/cjs/translateDoc/validation.cjs +1 -2
  64. package/dist/cjs/upgrade.cjs +3 -4
  65. package/dist/cjs/utils/calculateChunks.cjs +1 -2
  66. package/dist/cjs/utils/checkAccess.cjs +6 -7
  67. package/dist/cjs/utils/checkConfigConsistency.cjs +1 -2
  68. package/dist/cjs/utils/checkFileModifiedRange.cjs +3 -4
  69. package/dist/cjs/utils/checkLastUpdateTime.cjs +1 -2
  70. package/dist/cjs/utils/chunkInference.cjs +2 -3
  71. package/dist/cjs/utils/detectGitRepository.cjs +1 -2
  72. package/dist/cjs/utils/fixChunkStartEndChars.cjs +1 -2
  73. package/dist/cjs/utils/formatLineRanges.cjs +1 -2
  74. package/dist/cjs/utils/formatTimeDiff.cjs +1 -2
  75. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
  76. package/dist/cjs/utils/getOutputFilePath.cjs +1 -2
  77. package/dist/cjs/utils/getParentPackageJSON.cjs +1 -2
  78. package/dist/cjs/utils/isInteractiveTerminal.cjs +1 -2
  79. package/dist/cjs/utils/listSpecialChars.cjs +1 -2
  80. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +2 -3
  81. package/dist/cjs/utils/openBrowser.cjs +1 -2
  82. package/dist/cjs/utils/parseChoice.cjs +1 -2
  83. package/dist/cjs/utils/reorderParagraphs.cjs +2 -3
  84. package/dist/cjs/utils/selectCmsEnvironment.cjs +2 -3
  85. package/dist/cjs/utils/setupAI.cjs +3 -4
  86. package/dist/cjs/watch.cjs +2 -3
  87. package/dist/esm/IntlayerEventListener.mjs +1 -2
  88. package/dist/esm/_virtual/_rolldown/runtime.mjs +1 -2
  89. package/dist/esm/_virtual/_utils_asset.mjs +1 -2
  90. package/dist/esm/auth/login.mjs +4 -5
  91. package/dist/esm/auth/sessionToken.mjs +1 -2
  92. package/dist/esm/auth/setupRepository.mjs +3 -4
  93. package/dist/esm/build.mjs +2 -3
  94. package/dist/esm/bundle.mjs +1 -2
  95. package/dist/esm/bundle.mjs.map +1 -1
  96. package/dist/esm/ci.mjs +2 -3
  97. package/dist/esm/cli.mjs +7 -4
  98. package/dist/esm/cli.mjs.map +1 -1
  99. package/dist/esm/config.mjs +2 -3
  100. package/dist/esm/editor.mjs +2 -3
  101. package/dist/esm/extract.mjs +6 -7
  102. package/dist/esm/extract.mjs.map +1 -1
  103. package/dist/esm/fill/deepMergeContent.mjs +1 -2
  104. package/dist/esm/fill/extractTranslatableContent.mjs +1 -2
  105. package/dist/esm/fill/fill.mjs +5 -6
  106. package/dist/esm/fill/fill.mjs.map +1 -1
  107. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -2
  108. package/dist/esm/fill/formatFillData.mjs +1 -2
  109. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +1 -2
  110. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +1 -2
  111. package/dist/esm/fill/index.mjs +1 -1
  112. package/dist/esm/fill/listTranslationsTasks.mjs +2 -3
  113. package/dist/esm/fill/translateDictionary.mjs +3 -4
  114. package/dist/esm/fill/writeFill.mjs +2 -3
  115. package/dist/esm/getTargetDictionary.mjs +2 -3
  116. package/dist/esm/index.mjs +14 -14
  117. package/dist/esm/init.mjs +24 -8
  118. package/dist/esm/init.mjs.map +1 -1
  119. package/dist/esm/initChromeExtension.mjs +2 -3
  120. package/dist/esm/initInfra.mjs +2 -3
  121. package/dist/esm/initMCP.mjs +3 -4
  122. package/dist/esm/initSkills.mjs +2 -3
  123. package/dist/esm/listContentDeclaration.mjs +3 -4
  124. package/dist/esm/listProjects.mjs +2 -3
  125. package/dist/esm/liveSync.mjs +4 -5
  126. package/dist/esm/loadPrompts.mjs +1 -2
  127. package/dist/esm/pull.mjs +16 -9
  128. package/dist/esm/pull.mjs.map +1 -1
  129. package/dist/esm/push/pullLog.mjs +1 -2
  130. package/dist/esm/push/push.mjs +9 -9
  131. package/dist/esm/push/push.mjs.map +1 -1
  132. package/dist/esm/pushConfig.mjs +2 -3
  133. package/dist/esm/pushLog.mjs +1 -2
  134. package/dist/esm/reviewDoc/reviewDoc.mjs +6 -6
  135. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  136. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +4 -5
  137. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  138. package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -3
  139. package/dist/esm/reviewDoc/reviewDocProgress.mjs +1 -2
  140. package/dist/esm/reviewDoc/reviewDocSynthesis.mjs +1 -2
  141. package/dist/esm/scan.mjs +1 -2
  142. package/dist/esm/searchDoc.mjs +2 -3
  143. package/dist/esm/test/listMissingTranslations.mjs +2 -3
  144. package/dist/esm/test/test.mjs +2 -3
  145. package/dist/esm/translateDoc/index.mjs +2 -2
  146. package/dist/esm/translateDoc/translateDoc.mjs +5 -6
  147. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  148. package/dist/esm/translateDoc/translateFile.mjs +6 -7
  149. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  150. package/dist/esm/translateDoc/validation.mjs +1 -2
  151. package/dist/esm/upgrade.mjs +2 -3
  152. package/dist/esm/utils/calculateChunks.mjs +1 -2
  153. package/dist/esm/utils/checkAccess.mjs +3 -4
  154. package/dist/esm/utils/checkConfigConsistency.mjs +1 -2
  155. package/dist/esm/utils/checkFileModifiedRange.mjs +1 -2
  156. package/dist/esm/utils/checkLastUpdateTime.mjs +1 -2
  157. package/dist/esm/utils/chunkInference.mjs +1 -2
  158. package/dist/esm/utils/detectGitRepository.mjs +1 -2
  159. package/dist/esm/utils/fixChunkStartEndChars.mjs +1 -2
  160. package/dist/esm/utils/formatLineRanges.mjs +1 -2
  161. package/dist/esm/utils/formatTimeDiff.mjs +1 -2
  162. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -2
  163. package/dist/esm/utils/getOutputFilePath.mjs +1 -2
  164. package/dist/esm/utils/getParentPackageJSON.mjs +1 -2
  165. package/dist/esm/utils/isInteractiveTerminal.mjs +1 -2
  166. package/dist/esm/utils/listSpecialChars.mjs +1 -2
  167. package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -2
  168. package/dist/esm/utils/openBrowser.mjs +1 -2
  169. package/dist/esm/utils/parseChoice.mjs +1 -2
  170. package/dist/esm/utils/reorderParagraphs.mjs +1 -2
  171. package/dist/esm/utils/selectCmsEnvironment.mjs +1 -2
  172. package/dist/esm/utils/setupAI.mjs +1 -2
  173. package/dist/esm/watch.mjs +2 -3
  174. package/dist/types/IntlayerEventListener.d.ts +1 -3
  175. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  176. package/dist/types/auth/login.d.ts +1 -2
  177. package/dist/types/auth/login.d.ts.map +1 -1
  178. package/dist/types/auth/sessionToken.d.ts +0 -2
  179. package/dist/types/auth/sessionToken.d.ts.map +1 -1
  180. package/dist/types/auth/setupRepository.d.ts +1 -2
  181. package/dist/types/auth/setupRepository.d.ts.map +1 -1
  182. package/dist/types/build.d.ts +1 -2
  183. package/dist/types/build.d.ts.map +1 -1
  184. package/dist/types/bundle.d.ts +0 -2
  185. package/dist/types/bundle.d.ts.map +1 -1
  186. package/dist/types/ci.d.ts +1 -2
  187. package/dist/types/ci.d.ts.map +1 -1
  188. package/dist/types/cli.d.ts +1 -2
  189. package/dist/types/cli.d.ts.map +1 -1
  190. package/dist/types/config.d.ts +1 -2
  191. package/dist/types/config.d.ts.map +1 -1
  192. package/dist/types/editor.d.ts +1 -2
  193. package/dist/types/editor.d.ts.map +1 -1
  194. package/dist/types/extract.d.ts +1 -2
  195. package/dist/types/extract.d.ts.map +1 -1
  196. package/dist/types/fill/deepMergeContent.d.ts +0 -2
  197. package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
  198. package/dist/types/fill/extractTranslatableContent.d.ts +0 -2
  199. package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
  200. package/dist/types/fill/fill.d.ts +1 -3
  201. package/dist/types/fill/fill.d.ts.map +1 -1
  202. package/dist/types/fill/formatAutoFilledFilePath.d.ts +1 -3
  203. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  204. package/dist/types/fill/formatFillData.d.ts +0 -2
  205. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  206. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -2
  207. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
  208. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -2
  209. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
  210. package/dist/types/fill/listTranslationsTasks.d.ts +0 -2
  211. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
  212. package/dist/types/fill/translateDictionary.d.ts +2 -3
  213. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  214. package/dist/types/fill/writeFill.d.ts +0 -2
  215. package/dist/types/fill/writeFill.d.ts.map +1 -1
  216. package/dist/types/getTargetDictionary.d.ts +0 -2
  217. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  218. package/dist/types/index.d.ts +4 -4
  219. package/dist/types/init.d.ts +6 -3
  220. package/dist/types/init.d.ts.map +1 -1
  221. package/dist/types/initChromeExtension.d.ts +0 -2
  222. package/dist/types/initChromeExtension.d.ts.map +1 -1
  223. package/dist/types/initInfra.d.ts +0 -2
  224. package/dist/types/initInfra.d.ts.map +1 -1
  225. package/dist/types/initMCP.d.ts +0 -2
  226. package/dist/types/initMCP.d.ts.map +1 -1
  227. package/dist/types/initSkills.d.ts +0 -2
  228. package/dist/types/initSkills.d.ts.map +1 -1
  229. package/dist/types/listContentDeclaration.d.ts +1 -2
  230. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  231. package/dist/types/listProjects.d.ts +0 -2
  232. package/dist/types/listProjects.d.ts.map +1 -1
  233. package/dist/types/liveSync.d.ts +1 -2
  234. package/dist/types/liveSync.d.ts.map +1 -1
  235. package/dist/types/loadPrompts.d.ts +0 -2
  236. package/dist/types/loadPrompts.d.ts.map +1 -1
  237. package/dist/types/pull.d.ts +15 -3
  238. package/dist/types/pull.d.ts.map +1 -1
  239. package/dist/types/push/pullLog.d.ts +0 -2
  240. package/dist/types/push/pullLog.d.ts.map +1 -1
  241. package/dist/types/push/push.d.ts +1 -2
  242. package/dist/types/push/push.d.ts.map +1 -1
  243. package/dist/types/pushConfig.d.ts +1 -2
  244. package/dist/types/pushConfig.d.ts.map +1 -1
  245. package/dist/types/pushLog.d.ts +0 -2
  246. package/dist/types/pushLog.d.ts.map +1 -1
  247. package/dist/types/reviewDoc/reviewDoc.d.ts +2 -3
  248. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  249. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -2
  250. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
  251. package/dist/types/reviewDoc/reviewDocLog.d.ts +0 -2
  252. package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
  253. package/dist/types/reviewDoc/reviewDocProgress.d.ts +0 -2
  254. package/dist/types/reviewDoc/reviewDocProgress.d.ts.map +1 -1
  255. package/dist/types/reviewDoc/reviewDocSynthesis.d.ts +0 -2
  256. package/dist/types/reviewDoc/reviewDocSynthesis.d.ts.map +1 -1
  257. package/dist/types/scan.d.ts +0 -2
  258. package/dist/types/scan.d.ts.map +1 -1
  259. package/dist/types/searchDoc.d.ts +1 -2
  260. package/dist/types/searchDoc.d.ts.map +1 -1
  261. package/dist/types/test/listMissingTranslations.d.ts +1 -3
  262. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  263. package/dist/types/test/test.d.ts +1 -2
  264. package/dist/types/test/test.d.ts.map +1 -1
  265. package/dist/types/translateDoc/index.d.ts +1 -1
  266. package/dist/types/translateDoc/translateDoc.d.ts +0 -2
  267. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  268. package/dist/types/translateDoc/translateFile.d.ts +0 -2
  269. package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
  270. package/dist/types/translateDoc/types.d.ts +2 -4
  271. package/dist/types/translateDoc/types.d.ts.map +1 -1
  272. package/dist/types/translateDoc/validation.d.ts +0 -2
  273. package/dist/types/translateDoc/validation.d.ts.map +1 -1
  274. package/dist/types/upgrade.d.ts +0 -2
  275. package/dist/types/upgrade.d.ts.map +1 -1
  276. package/dist/types/utils/calculateChunks.d.ts +0 -2
  277. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  278. package/dist/types/utils/checkAccess.d.ts +1 -3
  279. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  280. package/dist/types/utils/checkConfigConsistency.d.ts +0 -2
  281. package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
  282. package/dist/types/utils/checkFileModifiedRange.d.ts +1 -2
  283. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  284. package/dist/types/utils/checkLastUpdateTime.d.ts +0 -2
  285. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  286. package/dist/types/utils/chunkInference.d.ts +1 -2
  287. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  288. package/dist/types/utils/detectGitRepository.d.ts +0 -2
  289. package/dist/types/utils/detectGitRepository.d.ts.map +1 -1
  290. package/dist/types/utils/fixChunkStartEndChars.d.ts +0 -2
  291. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  292. package/dist/types/utils/formatLineRanges.d.ts +0 -2
  293. package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
  294. package/dist/types/utils/formatTimeDiff.d.ts +0 -2
  295. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  296. package/dist/types/utils/getIsFileUpdatedRecently.d.ts +0 -2
  297. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  298. package/dist/types/utils/getOutputFilePath.d.ts +0 -2
  299. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  300. package/dist/types/utils/getParentPackageJSON.d.ts +1 -2
  301. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  302. package/dist/types/utils/isInteractiveTerminal.d.ts +0 -2
  303. package/dist/types/utils/isInteractiveTerminal.d.ts.map +1 -1
  304. package/dist/types/utils/listSpecialChars.d.ts +1 -2
  305. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  306. package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -2
  307. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  308. package/dist/types/utils/openBrowser.d.ts +0 -2
  309. package/dist/types/utils/openBrowser.d.ts.map +1 -1
  310. package/dist/types/utils/parseChoice.d.ts +0 -2
  311. package/dist/types/utils/parseChoice.d.ts.map +1 -1
  312. package/dist/types/utils/reorderParagraphs.d.ts +0 -2
  313. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  314. package/dist/types/utils/selectCmsEnvironment.d.ts +1 -3
  315. package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
  316. package/dist/types/utils/setupAI.d.ts +1 -2
  317. package/dist/types/utils/setupAI.d.ts.map +1 -1
  318. package/dist/types/watch.d.ts +1 -2
  319. package/dist/types/watch.d.ts.map +1 -1
  320. package/package.json +32 -32
@@ -1,15 +1,15 @@
1
- import { logConfigDetails } from "@intlayer/engine/cli";
2
1
  import { existsSync } from "node:fs";
3
2
  import { relative, resolve } from "node:path";
4
3
  import * as ANSIColors from "@intlayer/config/colors";
5
4
  import { colorize, getAppLogger, x } from "@intlayer/config/logger";
6
5
  import { getConfiguration } from "@intlayer/config/node";
7
- import enquirer from "enquirer";
8
- import { buildComponentFilesList, formatPath } from "@intlayer/engine/utils";
9
6
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
10
- import { prepareIntlayer as prepareIntlayer$1 } from "@intlayer/engine/build";
7
+ import { prepareIntlayer } from "@intlayer/engine/build";
8
+ import { logConfigDetails } from "@intlayer/engine/cli";
9
+ import { buildComponentFilesList, formatPath } from "@intlayer/engine/utils";
10
+ import enquirer from "enquirer";
11
11
 
12
- //#region src/extract.ts
12
+ // src/extract.ts
13
13
  const extract = async (options) => {
14
14
  const configuration = getConfiguration(options.configOptions);
15
15
  logConfigDetails(options?.configOptions);
@@ -95,9 +95,8 @@ const extract = async (options) => {
95
95
  } catch (error) {
96
96
  appLogger(`Failed to transform ${filePath}: ${error.message}`);
97
97
  }
98
- await prepareIntlayer$1(configuration);
98
+ await prepareIntlayer(configuration);
99
99
  };
100
100
 
101
- //#endregion
102
101
  export { extract };
103
102
  //# sourceMappingURL=extract.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"extract.mjs","names":["prepareIntlayer"],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport type { PackageName } from '@intlayer/babel';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger, x } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { buildComponentFilesList, formatPath } from '@intlayer/engine/utils';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\nimport enquirer from 'enquirer';\n\ntype ExtractOptions = {\n files?: string[];\n output?: FilePathPattern;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\nexport const extract = async (options: ExtractOptions) => {\n const configuration = getConfiguration(options.configOptions);\n\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n const { baseDir } = configuration.system;\n const { output } = configuration.compiler;\n\n if (!output) {\n appLogger(\n `${x} No output configuration found. Add a ${colorize('compiler.output', ANSIColors.BLUE)} in your configuration.`,\n {\n level: 'error',\n }\n );\n return;\n }\n\n const { detectPackageName, extractContent } = await import('@intlayer/babel');\n\n // Detect package\n const packageName: PackageName = detectPackageName(baseDir);\n\n let filesToExtract = options.files ?? [];\n\n if (filesToExtract.length === 0) {\n // Await all promises simultaneously\n const fileList = buildComponentFilesList(configuration);\n\n // Flatten the nested arrays and remove duplicates\n // Relative paths for selection\n const choices = fileList.map((file) => {\n const relPath = relative(baseDir, file);\n\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No extractable files found in the project.');\n return;\n }\n\n const SELECT_ALL = '__select_all__';\n\n type PromptChoice = {\n name: string;\n enabled: boolean;\n disabled?: boolean | string;\n };\n\n type PromptContext = {\n choices: PromptChoice[];\n render(): void | Promise<void>;\n state: { submitted: boolean };\n selected: PromptChoice[];\n input: string;\n options: { multiple?: boolean };\n };\n\n let selectedFiles: string[] | symbol;\n try {\n const maxLen = Math.max((process.stdout.columns || 80) - 15, 20);\n const truncatePath = (path: string) =>\n path.length > maxLen ? `...${path.slice(-(maxLen - 3))}` : path;\n\n const { files: enquirerSelectedFiles } = await enquirer.prompt<{\n files: string[];\n }>({\n type: 'autocomplete',\n name: 'files',\n message: 'Select files to extract (Type to search):',\n multiple: true,\n // @ts-ignore limit exist but is not typed\n limit: 40,\n choices: [\n { name: SELECT_ALL, message: '────── Select all ──────' },\n ...choices.map((choice) => ({\n name: choice.value,\n message: truncatePath(choice.label),\n })),\n ],\n async toggle(\n this: PromptContext,\n choice: PromptChoice,\n enabled?: boolean\n ) {\n if (!choice || choice.disabled) return;\n choice.enabled = enabled == null ? !choice.enabled : enabled;\n\n if (choice.name === SELECT_ALL) {\n this.choices\n .filter((choiceEl) => choiceEl.name !== SELECT_ALL)\n .forEach((choiceEl) => {\n choiceEl.enabled = choice.enabled;\n });\n }\n\n return this.render();\n },\n format(this: PromptContext) {\n if (this.state?.submitted && this.options?.multiple) {\n return `${this.selected.filter((s) => s.name !== SELECT_ALL).length} file(s) selected`;\n }\n return this.input ?? '';\n },\n });\n\n selectedFiles = enquirerSelectedFiles.filter(\n (file) => file !== SELECT_ALL\n );\n } catch {\n selectedFiles = Symbol('cancel');\n }\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToExtract = selectedFiles as string[];\n }\n\n if (filesToExtract.length === 0) {\n appLogger('No files selected for extraction.');\n return;\n }\n\n const absoluteFiles = filesToExtract\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n for (const filePath of absoluteFiles) {\n try {\n await extractContent(filePath, packageName, {\n unmergedDictionaries,\n configuration,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n } catch (error) {\n appLogger(`Failed to transform ${filePath}: ${(error as Error).message}`);\n }\n }\n\n await prepareIntlayer(configuration); // Prepare Intlayer to apply the changes\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,UAAU,OAAO,YAA4B;CACxD,MAAM,gBAAgB,iBAAiB,QAAQ,aAAa;CAE5D,iBAAiB,SAAS,aAAa;CAEvC,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,EAAE,WAAW,cAAc;CAEjC,IAAI,CAAC,QAAQ;EACX,UACE,GAAG,EAAE,wCAAwC,SAAS,mBAAmB,WAAW,IAAI,EAAE,0BAC1F,EACE,OAAO,QACT,CACF;EACA;CACF;CAEA,MAAM,EAAE,mBAAmB,mBAAmB,MAAM,OAAO;CAG3D,MAAM,cAA2B,kBAAkB,OAAO;CAE1D,IAAI,iBAAiB,QAAQ,SAAS,CAAC;CAEvC,IAAI,eAAe,WAAW,GAAG;EAM/B,MAAM,UAJW,wBAAwB,aAIlB,CAAC,CAAC,KAAK,SAAS;GAGrC,OAAO;IACL,OAAO;IACP,OAJc,SAAS,SAAS,IAInB;GACf;EACF,CAAC;EAED,IAAI,QAAQ,WAAW,GAAG;GACxB,UAAU,4CAA4C;GACtD;EACF;EAEA,MAAM,aAAa;EAiBnB,IAAI;EACJ,IAAI;GACF,MAAM,SAAS,KAAK,KAAK,QAAQ,OAAO,WAAW,MAAM,IAAI,EAAE;GAC/D,MAAM,gBAAgB,SACpB,KAAK,SAAS,SAAS,MAAM,KAAK,MAA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,KAAK,MAAM,YAAY,eACrB,IAAI;EACF,MAAM,eAAe,UAAU,aAAa;GAC1C;GACA;GACA,UAAU,QAAQ;GAClB,iBAAiB,QAAQ;EAC3B,CAAC;CACH,SAAS,OAAO;EACd,UAAU,uBAAuB,SAAS,IAAK,MAAgB,SAAS;CAC1E;CAGF,MAAMA,kBAAgB,aAAa;AACrC"}
1
+ {"version":3,"file":"extract.mjs","names":[],"sources":["../../src/extract.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { relative, resolve } from 'node:path';\nimport type { PackageName } from '@intlayer/babel';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger, x } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/dictionaries-entry/unmerged';\nimport { prepareIntlayer } from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { buildComponentFilesList, formatPath } from '@intlayer/engine/utils';\nimport type { FilePathPattern } from '@intlayer/types/filePathPattern';\nimport enquirer from 'enquirer';\n\ntype ExtractOptions = {\n files?: string[];\n output?: FilePathPattern;\n configOptions?: GetConfigurationOptions;\n codeOnly?: boolean;\n declarationOnly?: boolean;\n};\n\nexport const extract = async (options: ExtractOptions) => {\n const configuration = getConfiguration(options.configOptions);\n\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n const { baseDir } = configuration.system;\n const { output } = configuration.compiler;\n\n if (!output) {\n appLogger(\n `${x} No output configuration found. Add a ${colorize('compiler.output', ANSIColors.BLUE)} in your configuration.`,\n {\n level: 'error',\n }\n );\n return;\n }\n\n const { detectPackageName, extractContent } = await import('@intlayer/babel');\n\n // Detect package\n const packageName: PackageName = detectPackageName(baseDir);\n\n let filesToExtract = options.files ?? [];\n\n if (filesToExtract.length === 0) {\n // Await all promises simultaneously\n const fileList = buildComponentFilesList(configuration);\n\n // Flatten the nested arrays and remove duplicates\n // Relative paths for selection\n const choices = fileList.map((file) => {\n const relPath = relative(baseDir, file);\n\n return {\n value: file,\n label: relPath,\n };\n });\n\n if (choices.length === 0) {\n appLogger('No extractable files found in the project.');\n return;\n }\n\n const SELECT_ALL = '__select_all__';\n\n type PromptChoice = {\n name: string;\n enabled: boolean;\n disabled?: boolean | string;\n };\n\n type PromptContext = {\n choices: PromptChoice[];\n render(): void | Promise<void>;\n state: { submitted: boolean };\n selected: PromptChoice[];\n input: string;\n options: { multiple?: boolean };\n };\n\n let selectedFiles: string[] | symbol;\n try {\n const maxLen = Math.max((process.stdout.columns || 80) - 15, 20);\n const truncatePath = (path: string) =>\n path.length > maxLen ? `...${path.slice(-(maxLen - 3))}` : path;\n\n const { files: enquirerSelectedFiles } = await enquirer.prompt<{\n files: string[];\n }>({\n type: 'autocomplete',\n name: 'files',\n message: 'Select files to extract (Type to search):',\n multiple: true,\n // @ts-ignore limit exist but is not typed\n limit: 40,\n choices: [\n { name: SELECT_ALL, message: '────── Select all ──────' },\n ...choices.map((choice) => ({\n name: choice.value,\n message: truncatePath(choice.label),\n })),\n ],\n async toggle(\n this: PromptContext,\n choice: PromptChoice,\n enabled?: boolean\n ) {\n if (!choice || choice.disabled) return;\n choice.enabled = enabled == null ? !choice.enabled : enabled;\n\n if (choice.name === SELECT_ALL) {\n this.choices\n .filter((choiceEl) => choiceEl.name !== SELECT_ALL)\n .forEach((choiceEl) => {\n choiceEl.enabled = choice.enabled;\n });\n }\n\n return this.render();\n },\n format(this: PromptContext) {\n if (this.state?.submitted && this.options?.multiple) {\n return `${this.selected.filter((s) => s.name !== SELECT_ALL).length} file(s) selected`;\n }\n return this.input ?? '';\n },\n });\n\n selectedFiles = enquirerSelectedFiles.filter(\n (file) => file !== SELECT_ALL\n );\n } catch {\n selectedFiles = Symbol('cancel');\n }\n\n if (typeof selectedFiles === 'symbol') {\n // User cancelled\n process.exit(0);\n }\n\n filesToExtract = selectedFiles as string[];\n }\n\n if (filesToExtract.length === 0) {\n appLogger('No files selected for extraction.');\n return;\n }\n\n const absoluteFiles = filesToExtract\n .map((file) => resolve(baseDir, file))\n .filter((file) => {\n if (!existsSync(file)) {\n appLogger(`File not found: ${formatPath(file)}`);\n return false;\n }\n return true;\n });\n\n if (absoluteFiles.length === 0) {\n return;\n }\n\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n for (const filePath of absoluteFiles) {\n try {\n await extractContent(filePath, packageName, {\n unmergedDictionaries,\n configuration,\n codeOnly: options.codeOnly,\n declarationOnly: options.declarationOnly,\n });\n } catch (error) {\n appLogger(`Failed to transform ${filePath}: ${(error as Error).message}`);\n }\n }\n\n await prepareIntlayer(configuration); // Prepare Intlayer to apply the changes\n};\n"],"mappings":";;;;;;;;;;;;AAwBA,MAAa,UAAU,OAAO,YAA4B;CACxD,MAAM,gBAAgB,iBAAiB,QAAQ,aAAa;CAE5D,iBAAiB,SAAS,aAAa;CAEvC,MAAM,YAAY,aAAa,aAAa;CAE5C,MAAM,EAAE,YAAY,cAAc;CAClC,MAAM,EAAE,WAAW,cAAc;CAEjC,IAAI,CAAC,QAAQ;EACX,UACE,GAAG,EAAE,wCAAwC,SAAS,mBAAmB,WAAW,IAAI,EAAE,0BAC1F,EACE,OAAO,QACT,CACF;EACA;CACF;CAEA,MAAM,EAAE,mBAAmB,mBAAmB,MAAM,OAAO;CAG3D,MAAM,cAA2B,kBAAkB,OAAO;CAE1D,IAAI,iBAAiB,QAAQ,SAAS,CAAC;CAEvC,IAAI,eAAe,WAAW,GAAG;EAM/B,MAAM,UAJW,wBAAwB,aAIlB,CAAC,CAAC,KAAK,SAAS;GAGrC,OAAO;IACL,OAAO;IACP,OAJc,SAAS,SAAS,IAInB;GACf;EACF,CAAC;EAED,IAAI,QAAQ,WAAW,GAAG;GACxB,UAAU,4CAA4C;GACtD;EACF;EAEA,MAAM,aAAa;EAiBnB,IAAI;EACJ,IAAI;GACF,MAAM,SAAS,KAAK,KAAK,QAAQ,OAAO,WAAW,MAAM,IAAI,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H,IAAI,cAAc,WAAW,GAC3B;CAGF,MAAM,uBAAuB,wBAAwB,aAAa;CAElE,KAAK,MAAM,YAAY,eACrB,IAAI;EACF,MAAM,eAAe,UAAU,aAAa;GAC1C;GACA;GACA,UAAU,QAAQ;GAClB,iBAAiB,QAAQ;EAC3B,CAAC;CACH,SAAS,OAAO;EACd,UAAU,uBAAuB,SAAS,IAAK,MAAgB,SAAS;CAC1E;CAGF,MAAM,gBAAgB,aAAa;AACrC"}
@@ -1,4 +1,4 @@
1
- //#region src/fill/deepMergeContent.ts
1
+ // src/fill/deepMergeContent.ts
2
2
  /**
3
3
  * Deep merge two plain objects (for per-locale content).
4
4
  * The second object's values take precedence over the first.
@@ -21,6 +21,5 @@ const deepMergeContent = (target, source) => {
21
21
  return result;
22
22
  };
23
23
 
24
- //#endregion
25
24
  export { deepMergeContent };
26
25
  //# sourceMappingURL=deepMergeContent.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/fill/extractTranslatableContent.ts
1
+ // src/fill/extractTranslatableContent.ts
2
2
  const extractTranslatableContent = (content, currentPath = [], state = {
3
3
  currentIndex: 1,
4
4
  extractedContent: [],
@@ -50,6 +50,5 @@ const reinsertTranslatedContent = (baseContent, extractedContentProps, translate
50
50
  return result;
51
51
  };
52
52
 
53
- //#endregion
54
53
  export { extractTranslatableContent, reinsertTranslatedContent };
55
54
  //# sourceMappingURL=extractTranslatableContent.mjs.map
@@ -3,15 +3,15 @@ import { setupAI } from "../utils/setupAI.mjs";
3
3
  import { listTranslationsTasks } from "./listTranslationsTasks.mjs";
4
4
  import { translateDictionary } from "./translateDictionary.mjs";
5
5
  import { writeFill } from "./writeFill.mjs";
6
- import { logConfigDetails } from "@intlayer/engine/cli";
7
6
  import { basename, join, relative } from "node:path";
8
7
  import * as ANSIColors from "@intlayer/config/colors";
9
8
  import { colorize, colorizeKey, colorizePath, getAppLogger, x } from "@intlayer/config/logger";
10
9
  import { getConfiguration } from "@intlayer/config/node";
10
+ import { loadContentDeclarations, prepareIntlayer, writeContentDeclaration } from "@intlayer/engine/build";
11
+ import { logConfigDetails } from "@intlayer/engine/cli";
11
12
  import { formatPath, getGlobalLimiter, getTaskLimiter } from "@intlayer/engine/utils";
12
- import { loadContentDeclarations, prepareIntlayer as prepareIntlayer$1, writeContentDeclaration } from "@intlayer/engine/build";
13
13
 
14
- //#region src/fill/fill.ts
14
+ // src/fill/fill.ts
15
15
  const NB_CONCURRENT_TRANSLATIONS = 7;
16
16
  /**
17
17
  * Fill translations based on the provided options.
@@ -23,8 +23,8 @@ const fill = async (options) => {
23
23
  const configuration = getConfiguration(options?.configOptions);
24
24
  logConfigDetails(options?.configOptions);
25
25
  const appLogger = getAppLogger(configuration);
26
- if (options?.build === true) await prepareIntlayer$1(configuration, { forceRun: true });
27
- else if (typeof options?.build === "undefined") await prepareIntlayer$1(configuration);
26
+ if (options?.build === true) await prepareIntlayer(configuration, { forceRun: true });
27
+ else if (typeof options?.build === "undefined") await prepareIntlayer(configuration);
28
28
  const { defaultLocale, locales } = configuration.internationalization;
29
29
  const mode = options?.mode ?? "complete";
30
30
  const baseLocale = options?.sourceLocale ?? defaultLocale;
@@ -107,6 +107,5 @@ const fill = async (options) => {
107
107
  };
108
108
  };
109
109
 
110
- //#endregion
111
110
  export { fill };
112
111
  //# sourceMappingURL=fill.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"fill.mjs","names":["prepareIntlayer"],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/ai';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/** Outcome of a {@link fill} run. */\nexport type FillResult =\n | {\n /** No AI provider is reachable: nothing was translated. */\n status: 'no-ai-access';\n /** Why the AI provider could not be used, when known. */\n error?: string;\n }\n | {\n /** No dictionary matched the filters: nothing was translated. */\n status: 'no-dictionaries';\n }\n | {\n status: 'completed';\n /** Keys of the dictionaries processed. */\n dictionaryKeys: string[];\n /** Translation tasks (one per dictionary and locale set) run. */\n taskCount: number;\n /** Tasks whose translation was written. */\n writtenCount: number;\n };\n\n/**\n * Fill translations based on the provided options.\n *\n * @returns What was done, so callers without a terminal (editor extension,\n * MCP) can tell a completed run from one that translated nothing.\n */\nexport const fill = async (options?: FillOptions): Promise<FillResult> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return { status: 'no-ai-access' };\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return { status: 'no-ai-access', error };\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return { status: 'no-dictionaries' };\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n let writtenCount = 0;\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n writtenCount++;\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n writtenCount++;\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n\n return {\n status: 'completed',\n dictionaryKeys: keysToProcess,\n taskCount: translationTasks.length,\n writtenCount,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAwCA,MAAM,6BAA6B;;;;;;;AA4CnC,MAAa,OAAO,OAAO,YAA+C;CACxE,MAAM,gBAAgB,iBAAiB,SAAS,aAAa;CAC7D,iBAAiB,SAAS,aAAa;CAEvC,MAAM,YAAY,aAAa,aAAa;CAE5C,IAAI,SAAS,UAAU,MACrB,MAAMA,kBAAgB,eAAe,EAAE,UAAU,KAAK,CAAC;MAClD,IAAI,OAAO,SAAS,UAAU,aACnC,MAAMA,kBAAgB,aAAa;CAG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ACE,GAAG;IAEH,MAAM;GACR,GACA,eACA,CAAC,YAAY,GACb,aACF;GACA;EACF,OAAO;GACL,MAAM,wBAAwB,kBAAkB,aAAa;GAC7D;GAEA,IAAI,iBAAiB,UACnB,UACE,GAAG,KAAK,iBAAiB,kCAAkC,WAAW,SAAS,iBAAiB,QAAQ,CAAC,KACzG,EAAE,OAAO,OAAO,CAClB;EAEJ;CACF,CAAC,CACH;CAEA,MAAM,QAAQ,IAAI,OAAO;CACzB,MAAO,cAAsB,OAAO;CAEpC,OAAO;EACL,QAAQ;EACR,gBAAgB;EAChB,WAAW,iBAAiB;EAC5B;CACF;AACF"}
1
+ {"version":3,"file":"fill.mjs","names":[],"sources":["../../../src/fill/fill.ts"],"sourcesContent":["import { basename, join, relative } from 'node:path';\nimport type { AIOptions } from '@intlayer/ai';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport {\n loadContentDeclarations,\n prepareIntlayer,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport {\n type ListGitFilesOptions,\n logConfigDetails,\n} from '@intlayer/engine/cli';\nimport {\n formatPath,\n getGlobalLimiter,\n getTaskLimiter,\n} from '@intlayer/engine/utils';\nimport type { Locale } from '@intlayer/types/allLocales';\nimport type { Fill } from '@intlayer/types/dictionary';\nimport {\n ensureArray,\n type GetTargetDictionaryOptions,\n getTargetUnmergedDictionaries,\n} from '../getTargetDictionary';\nimport { setupAI } from '../utils/setupAI';\nimport {\n listTranslationsTasks,\n type TranslationTask,\n} from './listTranslationsTasks';\nimport { translateDictionary } from './translateDictionary';\nimport { writeFill } from './writeFill';\n\nconst NB_CONCURRENT_TRANSLATIONS = 7;\n\n// Arguments for the fill function\nexport type FillOptions = {\n sourceLocale?: Locale;\n outputLocales?: Locale | Locale[];\n mode?: 'complete' | 'review';\n gitOptions?: ListGitFilesOptions;\n aiOptions?: AIOptions; // Added aiOptions to be passed to translateJSON\n verbose?: boolean;\n nbConcurrentTranslations?: number;\n nbConcurrentTasks?: number; // NEW: number of tasks that may run at once\n build?: boolean;\n skipMetadata?: boolean;\n} & GetTargetDictionaryOptions;\n\n/** Outcome of a {@link fill} run. */\nexport type FillResult =\n | {\n /** No AI provider is reachable: nothing was translated. */\n status: 'no-ai-access';\n /** Why the AI provider could not be used, when known. */\n error?: string;\n }\n | {\n /** No dictionary matched the filters: nothing was translated. */\n status: 'no-dictionaries';\n }\n | {\n status: 'completed';\n /** Keys of the dictionaries processed. */\n dictionaryKeys: string[];\n /** Translation tasks (one per dictionary and locale set) run. */\n taskCount: number;\n /** Tasks whose translation was written. */\n writtenCount: number;\n };\n\n/**\n * Fill translations based on the provided options.\n *\n * @returns What was done, so callers without a terminal (editor extension,\n * MCP) can tell a completed run from one that translated nothing.\n */\nexport const fill = async (options?: FillOptions): Promise<FillResult> => {\n const configuration = getConfiguration(options?.configOptions);\n logConfigDetails(options?.configOptions);\n\n const appLogger = getAppLogger(configuration);\n\n if (options?.build === true) {\n await prepareIntlayer(configuration, { forceRun: true });\n } else if (typeof options?.build === 'undefined') {\n await prepareIntlayer(configuration);\n }\n\n const { defaultLocale, locales } = configuration.internationalization;\n const mode = options?.mode ?? 'complete';\n const baseLocale = options?.sourceLocale ?? defaultLocale;\n\n const outputLocales = options?.outputLocales\n ? ensureArray(options.outputLocales)\n : locales;\n\n const aiResult = await setupAI(configuration, options?.aiOptions);\n\n if (!aiResult?.hasAIAccess) return { status: 'no-ai-access' };\n\n const { aiClient, aiConfig, isCustomAI } = aiResult;\n\n if (isCustomAI && aiClient && aiConfig) {\n const { hasAIAccess, error } = await aiClient.checkAISDKAccess(aiConfig);\n if (!hasAIAccess) {\n appLogger(`${x} ${error}`);\n return { status: 'no-ai-access', error };\n }\n }\n\n const targetUnmergedDictionaries =\n await getTargetUnmergedDictionaries(options);\n\n // Load the original source content declaration files to recover function-type\n // `fill` values that are lost when dictionaries are JSON-serialised into\n // unmerged_dictionaries.cjs. Dictionary-level fill takes priority over the\n // config-level fill, but we can only know that by reading the source files.\n const uniqueSourcePaths = [\n ...new Set(\n targetUnmergedDictionaries\n .filter((unmergedDictionary) =>\n ['local', 'hybrid'].includes(unmergedDictionary.location!)\n )\n .map((unmergedDictionary) => unmergedDictionary.filePath)\n .filter(Boolean) as string[]\n ),\n ];\n const sourceDictionaries = await loadContentDeclarations(\n uniqueSourcePaths.map((sourcePath) =>\n join(configuration.system.baseDir, sourcePath)\n ),\n configuration,\n undefined,\n {\n logError: false,\n }\n );\n // Map relative filePath → original fill value from the source file\n const originalFillByPath = new Map<string, Fill | undefined>();\n\n for (const dictionary of sourceDictionaries) {\n if (dictionary.filePath) {\n originalFillByPath.set(\n dictionary.filePath,\n dictionary.fill as Fill | undefined\n );\n }\n }\n\n const affectedDictionaryKeys = new Set<string>();\n\n targetUnmergedDictionaries.forEach((dict) => {\n affectedDictionaryKeys.add(dict.key);\n });\n\n const keysToProcess = Array.from(affectedDictionaryKeys);\n\n appLogger([\n 'Affected dictionary keys for processing:',\n keysToProcess.length > 0\n ? keysToProcess.map((key) => colorizeKey(key)).join(', ')\n : colorize('No keys found', ANSIColors.YELLOW),\n ]);\n\n if (keysToProcess.length === 0) return { status: 'no-dictionaries' };\n\n /**\n * List the translations tasks\n *\n * Create a list of per-locale dictionaries to translate\n *\n * In 'complete' mode, filter only the missing locales to translate\n */\n const translationTasks: TranslationTask[] = listTranslationsTasks(\n targetUnmergedDictionaries.map((dictionary) => dictionary.localId!),\n outputLocales,\n mode,\n baseLocale,\n configuration\n );\n\n // AI calls in flight at once (translateJSON + metadata audit)\n const nbConcurrentTranslations =\n options?.nbConcurrentTranslations ?? NB_CONCURRENT_TRANSLATIONS;\n const globalLimiter = getGlobalLimiter(nbConcurrentTranslations);\n\n // NEW: number of *tasks* that may run at once (start/prepare/log/write)\n const nbConcurrentTasks = Math.max(\n 1,\n Math.min(\n options?.nbConcurrentTasks ?? nbConcurrentTranslations,\n translationTasks.length\n )\n );\n\n const taskLimiter = getTaskLimiter(nbConcurrentTasks);\n\n let writtenCount = 0;\n\n const runners = translationTasks.map((task) =>\n taskLimiter(async () => {\n const relativePath = relative(\n configuration?.system?.baseDir ?? process.cwd(),\n task?.dictionaryFilePath ?? ''\n );\n\n // log AFTER acquiring a task slot\n appLogger(\n `${task.dictionaryPreset} Processing ${colorizePath(basename(relativePath))}`,\n { level: 'info' }\n );\n\n const translationTaskResult = await translateDictionary(\n task,\n configuration,\n {\n mode,\n aiOptions: options?.aiOptions,\n fillMetadata: !options?.skipMetadata,\n onHandle: globalLimiter,\n aiClient,\n aiConfig,\n }\n );\n\n if (!translationTaskResult?.dictionaryOutput) return;\n\n const { dictionaryOutput, sourceLocale } = translationTaskResult;\n\n // Determine if we should write to separate files\n // - If dictionary has explicit fill setting (string, function, or object), use it\n // - If dictionary is per-locale AND has no explicit fill=false, use global fill config\n // - If dictionary is multilingual (no locale property), always write to same file\n //\n // NOTE: function-type fill values are lost during JSON serialisation of\n // unmerged_dictionaries.cjs. We recover them by checking the original\n // source file that was loaded above (originalFillByPath). Dictionary-level\n // fill always takes priority over config-level fill.\n const originalFill = originalFillByPath.get(\n dictionaryOutput.filePath ?? ''\n );\n\n // originalFill is undefined when the source file had no fill property; use\n // the (possibly JSON-preserved) dictionaryOutput.fill as a fallback so that\n // string/boolean fill values set directly on the dict still work.\n const dictFill: Fill | undefined =\n originalFill !== undefined ? originalFill : dictionaryOutput.fill;\n\n const hasDictionaryLevelFill =\n typeof dictFill === 'string' ||\n typeof dictFill === 'function' ||\n (typeof dictFill === 'object' && dictFill !== null);\n\n const isPerLocale = typeof dictionaryOutput.locale === 'string';\n\n const effectiveFill = hasDictionaryLevelFill\n ? dictFill\n : isPerLocale\n ? (configuration.dictionary?.fill ?? true)\n : false; // Multilingual dictionaries (no locale property) always write to same file unless explicitly set on the dictionary\n\n const isFillOtherFile =\n typeof effectiveFill === 'string' ||\n typeof effectiveFill === 'function' ||\n (typeof effectiveFill === 'object' && effectiveFill !== null);\n\n if (isFillOtherFile) {\n await writeFill(\n {\n ...dictionaryOutput,\n // Ensure fill is set on the dictionary for writeFill to use\n fill: effectiveFill,\n },\n outputLocales,\n [sourceLocale],\n configuration\n );\n writtenCount++;\n } else {\n await writeContentDeclaration(dictionaryOutput, configuration);\n writtenCount++;\n\n if (dictionaryOutput.filePath) {\n appLogger(\n `${task.dictionaryPreset} Content declaration written to ${formatPath(basename(dictionaryOutput.filePath))}`,\n { level: 'info' }\n );\n }\n }\n })\n );\n\n await Promise.all(runners);\n await (globalLimiter as any).onIdle();\n\n return {\n status: 'completed',\n dictionaryKeys: keysToProcess,\n taskCount: translationTasks.length,\n writtenCount,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAwCA,MAAM,6BAA6B;;;;;;;AA4CnC,MAAa,OAAO,OAAO,YAA+C;CACxE,MAAM,gBAAgB,iBAAiB,SAAS,aAAa;CAC7D,iBAAiB,SAAS,aAAa;CAEvC,MAAM,YAAY,aAAa,aAAa;CAE5C,IAAI,SAAS,UAAU,MACrB,MAAM,gBAAgB,eAAe,EAAE,UAAU,KAAK,CAAC;MAClD,IAAI,OAAO,SAAS,UAAU,aACnC,MAAM,gBAAgB,aAAa;CAGrC,MAAM,EAAE,eAAe,YAAY,cAAc;CACjD,MAAM,OAAO,SAAS,QAAQ;CAC9B,MAAM,aAAa,SAAS,gBAAgB;CAE5C,MAAM,gBAAgB,SAAS,gBAC3B,YAAY,QAAQ,aAAa,IACjC;CAEJ,MAAM,WAAW,MAAM,QAAQ,eAAe,SAAS,SAAS;CAEhE,IAAI,CAAC,UAAU,aAAa,OAAO,EAAE,QAAQ,eAAe;CAE5D,MAAM,EAAE,UAAU,UAAU,eAAe;CAE3C,IAAI,cAAc,YAAY,UAAU;EACtC,MAAM,EAAE,aAAa,UAAU,MAAM,SAAS,iBAAiB,QAAQ;EACvE,IAAI,CAAC,aAAa;GAChB,UAAU,GAAG,EAAE,GAAG,OA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
  import { getFormatFromExtension } from "@intlayer/engine/utils";
5
5
  import { parseFilePathPattern } from "@intlayer/config/utils";
6
6
 
7
- //#region src/fill/formatAutoFilledFilePath.ts
7
+ // src/fill/formatAutoFilledFilePath.ts
8
8
  const formatAutoFilledFilePath = async (autoFillField, dictionaryKey, dictionaryFilePath, baseDir, configuration, locale) => {
9
9
  if (!autoFillField) throw new Error("autoFillField must be provided");
10
10
  if (!dictionaryKey || typeof dictionaryKey !== "string") throw new Error("dictionaryKey must be a non-empty string");
@@ -40,6 +40,5 @@ const formatAutoFilledFilePath = async (autoFillField, dictionaryKey, dictionary
40
40
  return normalize(result);
41
41
  };
42
42
 
43
- //#endregion
44
43
  export { formatAutoFilledFilePath };
45
44
  //# sourceMappingURL=formatAutoFilledFilePath.mjs.map
@@ -2,7 +2,7 @@ import { getPatternForLocale, resolveOutputPattern } from "../utils/getOutputFil
2
2
  import { basename, dirname, extname, relative } from "node:path";
3
3
  import { getFormatFromExtension } from "@intlayer/engine/utils";
4
4
 
5
- //#region src/fill/formatFillData.ts
5
+ // src/fill/formatFillData.ts
6
6
  /** Merge FillData entries that resolve to the same file path. */
7
7
  const groupByFilePath = (entries) => entries.reduce((acc, curr) => {
8
8
  const existing = acc.find((item) => item.filePath === curr.filePath);
@@ -89,6 +89,5 @@ const formatFillData = async (fillField, localeList, filePath, dictionaryKey, co
89
89
  return processPattern(fillField, localeList);
90
90
  };
91
91
 
92
- //#endregion
93
92
  export { formatFillData };
94
93
  //# sourceMappingURL=formatFillData.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/fill/getAvailableLocalesInDictionary.ts
1
+ // src/fill/getAvailableLocalesInDictionary.ts
2
2
  /**
3
3
  * Recursively traverses dictionary content to find all locales that have actual translations.
4
4
  * Returns a Set of locale strings that are present in the translation nodes.
@@ -20,6 +20,5 @@ const getAvailableLocalesInDictionary = (dictionary) => {
20
20
  return Array.from(localesSet);
21
21
  };
22
22
 
23
- //#endregion
24
23
  export { getAvailableLocalesInDictionary };
25
24
  //# sourceMappingURL=getAvailableLocalesInDictionary.mjs.map
@@ -1,4 +1,4 @@
1
- //#region src/fill/getFilterMissingContentPerLocale.ts
1
+ // src/fill/getFilterMissingContentPerLocale.ts
2
2
  /**
3
3
  * Recursively compares source content with target content and returns only the missing parts.
4
4
  * For per-locale files where content is simple JSON (not translation nodes).
@@ -45,6 +45,5 @@ const getFilterMissingContentPerLocale = (sourceDictionary, targetDictionary) =>
45
45
  };
46
46
  };
47
47
 
48
- //#endregion
49
48
  export { getFilterMissingContentPerLocale };
50
49
  //# sourceMappingURL=getFilterMissingContentPerLocale.mjs.map
@@ -1,4 +1,4 @@
1
- import { writeFill } from "./writeFill.mjs";
2
1
  import { fill } from "./fill.mjs";
2
+ import { writeFill } from "./writeFill.mjs";
3
3
 
4
4
  export { fill, writeFill };
@@ -2,12 +2,12 @@ import { listMissingTranslationsWithConfig } from "../test/listMissingTranslatio
2
2
  import { basename } from "node:path";
3
3
  import * as ANSIColors from "@intlayer/config/colors";
4
4
  import { colon, colorize, colorizeKey, colorizePath, getAppLogger } from "@intlayer/config/logger";
5
- import { formatLocale } from "@intlayer/engine/utils";
6
5
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
6
+ import { formatLocale } from "@intlayer/engine/utils";
7
7
  import { getFilterTranslationsOnlyDictionary } from "@intlayer/core/plugins";
8
8
  import { getDictionaries } from "@intlayer/dictionaries-entry";
9
9
 
10
- //#region src/fill/listTranslationsTasks.ts
10
+ // src/fill/listTranslationsTasks.ts
11
11
  const listTranslationsTasks = (localIds, outputLocales, mode, baseLocale, configuration) => {
12
12
  const appLogger = getAppLogger(configuration);
13
13
  const mergedDictionariesRecord = getDictionaries(configuration);
@@ -65,6 +65,5 @@ const listTranslationsTasks = (localIds, outputLocales, mode, baseLocale, config
65
65
  return translationTasks;
66
66
  };
67
67
 
68
- //#endregion
69
68
  export { listTranslationsTasks };
70
69
  //# sourceMappingURL=listTranslationsTasks.mjs.map
@@ -4,12 +4,12 @@ import { extractTranslatableContent, reinsertTranslatedContent } from "./extract
4
4
  import { basename } from "node:path";
5
5
  import * as ANSIColors from "@intlayer/config/colors";
6
6
  import { colon, colorize, colorizeNumber, colorizePath, getAppLogger } from "@intlayer/config/logger";
7
- import { chunkJSON, excludeObjectFormat, formatLocale, mergeChunks, reconstructFromSingleChunk, verifyIdenticObjectFormat } from "@intlayer/engine/utils";
8
- import { retryManager } from "@intlayer/config/utils";
9
7
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
8
+ import { chunkJSON, excludeObjectFormat, formatLocale, mergeChunks, reconstructFromSingleChunk, verifyIdenticObjectFormat } from "@intlayer/engine/utils";
10
9
  import { getFilterMissingTranslationsDictionary, getMultilingualDictionary, getPerLocaleDictionary, insertContentInDictionary } from "@intlayer/core/plugins";
10
+ import { retryManager } from "@intlayer/config/utils";
11
11
 
12
- //#region src/fill/translateDictionary.ts
12
+ // src/fill/translateDictionary.ts
13
13
  const createChunkPreset = (chunkIndex, totalChunks) => {
14
14
  if (totalChunks <= 1) return "";
15
15
  return colon([
@@ -212,6 +212,5 @@ const translateDictionary = async (task, configuration, options) => {
212
212
  })();
213
213
  };
214
214
 
215
- //#endregion
216
215
  export { translateDictionary };
217
216
  //# sourceMappingURL=translateDictionary.mjs.map
@@ -2,11 +2,11 @@ import { formatFillData } from "./formatFillData.mjs";
2
2
  import { getAvailableLocalesInDictionary } from "./getAvailableLocalesInDictionary.mjs";
3
3
  import { resolve } from "node:path";
4
4
  import { colorizeKey, getAppLogger } from "@intlayer/config/logger";
5
- import { formatLocale, formatPath } from "@intlayer/engine/utils";
6
5
  import { writeContentDeclaration } from "@intlayer/engine/build";
6
+ import { formatLocale, formatPath } from "@intlayer/engine/utils";
7
7
  import { getDictionaries } from "@intlayer/dictionaries-entry";
8
8
 
9
- //#region src/fill/writeFill.ts
9
+ // src/fill/writeFill.ts
10
10
  const writeFill = async (contentDeclarationFile, outputLocales, parentLocales, configuration) => {
11
11
  const appLogger = getAppLogger(configuration);
12
12
  const fullDictionary = getDictionaries(configuration)[contentDeclarationFile.key];
@@ -46,6 +46,5 @@ const writeFill = async (contentDeclarationFile, outputLocales, parentLocales, c
46
46
  }
47
47
  };
48
48
 
49
- //#endregion
50
49
  export { writeFill };
51
50
  //# sourceMappingURL=writeFill.mjs.map
@@ -1,9 +1,9 @@
1
- import { listGitFiles } from "@intlayer/engine/cli";
2
1
  import { join, relative } from "node:path";
3
2
  import { getConfiguration } from "@intlayer/config/node";
4
3
  import { getUnmergedDictionaries } from "@intlayer/dictionaries-entry/unmerged";
4
+ import { listGitFiles } from "@intlayer/engine/cli";
5
5
 
6
- //#region src/getTargetDictionary.ts
6
+ // src/getTargetDictionary.ts
7
7
  const ensureArray = (value) => [value].flat();
8
8
  const getTargetUnmergedDictionaries = async (options) => {
9
9
  const configuration = getConfiguration(options?.configOptions);
@@ -29,6 +29,5 @@ const getTargetUnmergedDictionaries = async (options) => {
29
29
  return result;
30
30
  };
31
31
 
32
- //#endregion
33
32
  export { ensureArray, getTargetUnmergedDictionaries };
34
33
  //# sourceMappingURL=getTargetDictionary.mjs.map
@@ -1,29 +1,29 @@
1
- import { clearCliSessionToken, readCliSessionToken } from "./auth/sessionToken.mjs";
2
1
  import { login } from "./auth/login.mjs";
3
- import { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, MOZILLA_EXTENSION_URL, initChromeExtension, parseExtensionBrowsers } from "./initChromeExtension.mjs";
4
- import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode } from "./initInfra.mjs";
5
- import { PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
6
- import { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot } from "./init.mjs";
2
+ import { clearCliSessionToken, readCliSessionToken } from "./auth/sessionToken.mjs";
7
3
  import { build } from "./build.mjs";
8
- import { listProjectsCommand } from "./listProjects.mjs";
9
- import { getRemoteEditorRunners, startEditor } from "./editor.mjs";
10
- import { scan } from "./scan.mjs";
4
+ import { bundle } from "./bundle.mjs";
11
5
  import { dirname, setAPI } from "./cli.mjs";
6
+ import { getRemoteEditorRunners, startEditor } from "./editor.mjs";
12
7
  import { extract } from "./extract.mjs";
13
- import { bundle } from "./bundle.mjs";
14
- import { checkConfigConsistency } from "./utils/checkConfigConsistency.mjs";
15
- import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
16
- import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.mjs";
17
- import { testMissingTranslations } from "./test/test.mjs";
18
8
  import { fill } from "./fill/fill.mjs";
19
9
  import { IntlayerEventListener } from "./IntlayerEventListener.mjs";
10
+ import { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, isPrettierInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot } from "./init.mjs";
11
+ import { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, MOZILLA_EXTENSION_URL, initChromeExtension, parseExtensionBrowsers } from "./initChromeExtension.mjs";
12
+ import { INFRA_MODES, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, initInfra, parseInfraMode } from "./initInfra.mjs";
13
+ import { PLATFORM_OPTIONS, initSkills, parsePlatform, parseSkills, promptPlatform, resolvePlatformWithoutPrompt } from "./initSkills.mjs";
20
14
  import { listContentDeclaration, listContentDeclarationRows } from "./listContentDeclaration.mjs";
15
+ import { listProjectsCommand } from "./listProjects.mjs";
21
16
  import { liveSync } from "./liveSync.mjs";
22
17
  import { pull } from "./pull.mjs";
23
18
  import { push } from "./push/push.mjs";
19
+ import { listMissingTranslations, listMissingTranslationsWithConfig } from "./test/listMissingTranslations.mjs";
20
+ import { testMissingTranslations } from "./test/test.mjs";
24
21
  import { pushConfig } from "./pushConfig.mjs";
25
22
  import { reviewDoc } from "./reviewDoc/reviewDoc.mjs";
23
+ import { scan } from "./scan.mjs";
26
24
  import { searchDoc } from "./searchDoc.mjs";
27
25
  import { translateDoc } from "./translateDoc/translateDoc.mjs";
26
+ import { checkCMSAuth, getAuthenticatedAPI } from "./utils/checkAccess.mjs";
27
+ import { checkConfigConsistency } from "./utils/checkConfigConsistency.mjs";
28
28
 
29
- export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, INFRA_MODES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, IntlayerEventListener, LOCALE_ROUTING_CHOICES, MOZILLA_EXTENSION_URL, OPT_IN_INIT_STEPS, PLATFORM_OPTIONS, build, bundle, checkCMSAuth, checkConfigConsistency, clearCliSessionToken, dirname, extract, fill, findProjectRoot, getAuthenticatedAPI, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRemoteEditorRunners, getRoutingInitOptions, init, initChromeExtension, initCms, initInfra, initRepository, initSkills, initSteps, isEslintInstalled, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, login, parseContentLayoutChoice, parseExtensionBrowsers, parseInfraMode, parseLocaleRoutingChoice, parsePlatform, parseSkills, promptPlatform, pull, push, pushConfig, readCliSessionToken, resolvePlatformWithoutPrompt, resolveProjectRoot, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
29
+ export { BROWSER_EXTENSION_OPTIONS, CHROME_EXTENSION_URL, CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, EXTENSION_BROWSERS, EXTENSION_URL_BY_BROWSER, INFRA_MODES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, INSTALL_SCRIPT_URL, INSTALL_SCRIPT_URL_WINDOWS, IntlayerEventListener, LOCALE_ROUTING_CHOICES, MOZILLA_EXTENSION_URL, OPT_IN_INIT_STEPS, PLATFORM_OPTIONS, build, bundle, checkCMSAuth, checkConfigConsistency, clearCliSessionToken, dirname, extract, fill, findProjectRoot, getAuthenticatedAPI, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRemoteEditorRunners, getRoutingInitOptions, init, initChromeExtension, initCms, initInfra, initRepository, initSkills, initSteps, isEslintInstalled, isPrettierInstalled, listContentDeclaration, listContentDeclarationRows, listMissingTranslations, listMissingTranslationsWithConfig, listProjectsCommand, liveSync, login, parseContentLayoutChoice, parseExtensionBrowsers, parseInfraMode, parseLocaleRoutingChoice, parsePlatform, parseSkills, promptPlatform, pull, push, pushConfig, readCliSessionToken, resolvePlatformWithoutPrompt, resolveProjectRoot, reviewDoc, scan, searchDoc, setAPI, startEditor, testMissingTranslations, translateDoc };
package/dist/esm/init.mjs CHANGED
@@ -1,18 +1,18 @@
1
1
  import { login } from "./auth/login.mjs";
2
2
  import { setupRepository } from "./auth/setupRepository.mjs";
3
- import { loadPrompts } from "./loadPrompts.mjs";
4
- import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
5
- import { parseChoice } from "./utils/parseChoice.mjs";
6
3
  import { initChromeExtension } from "./initChromeExtension.mjs";
7
4
  import { initInfra } from "./initInfra.mjs";
5
+ import { initMCP } from "./initMCP.mjs";
8
6
  import { initSkills } from "./initSkills.mjs";
7
+ import { loadPrompts } from "./loadPrompts.mjs";
9
8
  import { detectGitRepository } from "./utils/detectGitRepository.mjs";
10
- import { initMCP } from "./initMCP.mjs";
11
- import { CATALOG_MESSAGE_FORMATS, CONTENT_FORMATS_BY_LAYOUT, detectCompatI18nLibraries, hasLintTooling, hasUrlRoutingFramework, initIntlayer, logInitSuccessMessage, setupCmsCredentials } from "@intlayer/engine/cli";
9
+ import { isInteractiveTerminal } from "./utils/isInteractiveTerminal.mjs";
10
+ import { parseChoice } from "./utils/parseChoice.mjs";
12
11
  import { existsSync, readFileSync } from "node:fs";
13
12
  import { join, resolve } from "node:path";
13
+ import { CATALOG_MESSAGE_FORMATS, CONTENT_FORMATS_BY_LAYOUT, PRETTIER_CONFIG_FILES, detectCompatI18nLibraries, hasLintTooling, hasPrettier, hasUrlRoutingFramework, initIntlayer, logInitSuccessMessage, setupCmsCredentials } from "@intlayer/engine/cli";
14
14
 
15
- //#region src/init.ts
15
+ // src/init.ts
16
16
  const findProjectRoot = (startDir) => {
17
17
  let currentDir = startDir;
18
18
  while (currentDir !== resolve(currentDir, "..")) {
@@ -46,6 +46,7 @@ const INIT_STEP_COMMANDS = {
46
46
  githubActions: "intlayer init github-actions",
47
47
  vscodeExtension: "intlayer init vscode-extension",
48
48
  eslint: "intlayer init eslint",
49
+ prettier: "intlayer init prettier",
49
50
  chromeExtension: "intlayer init extension [--browser <chrome|firefox>]",
50
51
  skills: "intlayer init skills [--platform <platform>] [--skills <skills...>]",
51
52
  mcp: "intlayer init mcp [--platform <platform>] [--transport <stdio|sse>]",
@@ -68,6 +69,7 @@ const getInitOptionsForSteps = (steps, baseOptions) => ({
68
69
  noVscodeExtension: baseOptions?.noVscodeExtension || !steps.includes("vscodeExtension"),
69
70
  noLsp: baseOptions?.noLsp || !steps.includes("lsp"),
70
71
  noEslint: baseOptions?.noEslint || !steps.includes("eslint"),
72
+ noPrettier: baseOptions?.noPrettier || !steps.includes("prettier"),
71
73
  skipFinalMessage: baseOptions?.skipFinalMessage || !steps.includes("projectSetup")
72
74
  });
73
75
  /**
@@ -139,6 +141,11 @@ const INIT_STEP_GROUPS = {
139
141
  label: "Lint rules (ESLint / oxlint)",
140
142
  hint: "flag hardcoded text and dynamic calls the compiler cannot optimize"
141
143
  },
144
+ {
145
+ value: "prettier",
146
+ label: "Prettier plugin",
147
+ hint: "sort the keys of t(), plural(), enu() and select() on format"
148
+ },
142
149
  {
143
150
  value: "chromeExtension",
144
151
  label: "Chrome extension",
@@ -324,15 +331,25 @@ const isEslintInstalled = (dependencies, root) => {
324
331
  return false;
325
332
  };
326
333
  /**
334
+ * Checks whether Prettier is installed or configured in the project.
335
+ */
336
+ const isPrettierInstalled = (dependencies, root) => {
337
+ if (hasPrettier(dependencies)) return true;
338
+ if (root) return PRETTIER_CONFIG_FILES.some((file) => existsSync(join(root, file)));
339
+ return false;
340
+ };
341
+ /**
327
342
  * Computes the initial setup steps selected by default in the interactive prompt.
328
343
  * Steps like infrastructure and browser extension require opt-in, while
329
344
  * eslint is preselected only if installed on the project.
330
345
  */
331
346
  const getInitialInitSteps = (dependencies, root) => {
332
347
  const isEslintPresent = isEslintInstalled(dependencies, root);
348
+ const isPrettierPresent = isPrettierInstalled(dependencies, root);
333
349
  return Object.values(INIT_STEP_GROUPS).flat().map((option) => option.value).filter((step) => {
334
350
  if (OPT_IN_INIT_STEPS.includes(step)) return false;
335
351
  if (step === "eslint" && !isEslintPresent) return false;
352
+ if (step === "prettier" && !isPrettierPresent) return false;
336
353
  return true;
337
354
  });
338
355
  };
@@ -472,6 +489,5 @@ const init = async (projectRoot, options, interactive) => {
472
489
  await runInteractiveInit(resolveProjectRoot(projectRoot), options);
473
490
  };
474
491
 
475
- //#endregion
476
- export { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot };
492
+ export { CONTENT_LAYOUT_CHOICES, DEFAULT_INIT_STEPS, ESLINT_CONFIG_FILES, INIT_STEP_COMMANDS, INIT_STEP_GROUPS, LOCALE_ROUTING_CHOICES, OPT_IN_INIT_STEPS, findProjectRoot, getContentInitOptions, getInitOptionsForSteps, getInitialInitSteps, getProjectDependencies, getRoutingInitOptions, init, initCms, initRepository, initSteps, isEslintInstalled, isPrettierInstalled, parseContentLayoutChoice, parseLocaleRoutingChoice, resolveProjectRoot };
477
493
  //# sourceMappingURL=init.mjs.map