@intlayer/cli 9.0.0-canary.2 → 9.0.0-canary.21

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 (333) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +1 -1
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_utils_asset.cjs +4 -3
  4. package/dist/cjs/auth/login.cjs +44 -31
  5. package/dist/cjs/auth/login.cjs.map +1 -1
  6. package/dist/cjs/auth/sessionToken.cjs +0 -1
  7. package/dist/cjs/auth/sessionToken.cjs.map +1 -1
  8. package/dist/cjs/build.cjs +6 -7
  9. package/dist/cjs/build.cjs.map +1 -1
  10. package/dist/cjs/bundle.cjs +32 -1
  11. package/dist/cjs/bundle.cjs.map +1 -1
  12. package/dist/cjs/ci.cjs +96 -29
  13. package/dist/cjs/ci.cjs.map +1 -1
  14. package/dist/cjs/cli.cjs +163 -125
  15. package/dist/cjs/cli.cjs.map +1 -1
  16. package/dist/cjs/config.cjs +2 -3
  17. package/dist/cjs/config.cjs.map +1 -1
  18. package/dist/cjs/editor.cjs +0 -1
  19. package/dist/cjs/editor.cjs.map +1 -1
  20. package/dist/cjs/extract.cjs +7 -7
  21. package/dist/cjs/extract.cjs.map +1 -1
  22. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  23. package/dist/cjs/fill/extractTranslatableContent.cjs.map +1 -1
  24. package/dist/cjs/fill/fill.cjs +11 -11
  25. package/dist/cjs/fill/fill.cjs.map +1 -1
  26. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +2 -3
  27. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  28. package/dist/cjs/fill/formatFillData.cjs +3 -4
  29. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  30. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  31. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  32. package/dist/cjs/fill/listTranslationsTasks.cjs +2 -2
  33. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  34. package/dist/cjs/fill/translateDictionary.cjs +7 -7
  35. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  36. package/dist/cjs/fill/writeFill.cjs +5 -6
  37. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  38. package/dist/cjs/getTargetDictionary.cjs +2 -3
  39. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  40. package/dist/cjs/index.cjs +4 -4
  41. package/dist/cjs/init.cjs +369 -3
  42. package/dist/cjs/init.cjs.map +1 -1
  43. package/dist/cjs/initBuildOptimization.cjs +81 -0
  44. package/dist/cjs/initBuildOptimization.cjs.map +1 -0
  45. package/dist/cjs/initCompiler.cjs +117 -0
  46. package/dist/cjs/initCompiler.cjs.map +1 -0
  47. package/dist/cjs/initMCP.cjs +24 -21
  48. package/dist/cjs/initMCP.cjs.map +1 -1
  49. package/dist/cjs/initSkills.cjs +31 -28
  50. package/dist/cjs/initSkills.cjs.map +1 -1
  51. package/dist/cjs/listContentDeclaration.cjs +4 -5
  52. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  53. package/dist/cjs/listProjects.cjs +2 -3
  54. package/dist/cjs/listProjects.cjs.map +1 -1
  55. package/dist/cjs/liveSync.cjs +4 -4
  56. package/dist/cjs/liveSync.cjs.map +1 -1
  57. package/dist/cjs/pull.cjs +7 -7
  58. package/dist/cjs/pull.cjs.map +1 -1
  59. package/dist/cjs/push/pullLog.cjs +2 -2
  60. package/dist/cjs/push/pullLog.cjs.map +1 -1
  61. package/dist/cjs/push/push.cjs +13 -13
  62. package/dist/cjs/push/push.cjs.map +1 -1
  63. package/dist/cjs/pushConfig.cjs +2 -3
  64. package/dist/cjs/pushConfig.cjs.map +1 -1
  65. package/dist/cjs/pushLog.cjs.map +1 -1
  66. package/dist/cjs/reviewDoc/reviewDoc.cjs +16 -16
  67. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  68. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +12 -12
  69. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  70. package/dist/cjs/reviewDoc/reviewDocLog.cjs +7 -8
  71. package/dist/cjs/reviewDoc/reviewDocLog.cjs.map +1 -1
  72. package/dist/cjs/scan.cjs +5 -5
  73. package/dist/cjs/scan.cjs.map +1 -1
  74. package/dist/cjs/searchDoc.cjs +2 -3
  75. package/dist/cjs/searchDoc.cjs.map +1 -1
  76. package/dist/cjs/test/listMissingTranslations.cjs +3 -4
  77. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  78. package/dist/cjs/test/test.cjs +11 -11
  79. package/dist/cjs/test/test.cjs.map +1 -1
  80. package/dist/cjs/translateDoc/translateDoc.cjs +6 -6
  81. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  82. package/dist/cjs/translateDoc/translateFile.cjs +6 -6
  83. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  84. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  85. package/dist/cjs/utils/calculateChunks.cjs +4 -5
  86. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  87. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  88. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  89. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  90. package/dist/cjs/utils/checkLastUpdateTime.cjs +0 -1
  91. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  92. package/dist/cjs/utils/chunkInference.cjs +0 -1
  93. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  94. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  95. package/dist/cjs/utils/formatLineRanges.cjs.map +1 -1
  96. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  97. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +1 -2
  98. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  99. package/dist/cjs/utils/getOutputFilePath.cjs +2 -3
  100. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  101. package/dist/cjs/utils/getParentPackageJSON.cjs +0 -1
  102. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  103. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  104. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +4 -5
  105. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  106. package/dist/cjs/utils/openBrowser.cjs +0 -1
  107. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  108. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  109. package/dist/cjs/utils/selectCmsEnvironment.cjs.map +1 -1
  110. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  111. package/dist/cjs/watch.cjs +28 -9
  112. package/dist/cjs/watch.cjs.map +1 -1
  113. package/dist/esm/IntlayerEventListener.mjs +1 -0
  114. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  115. package/dist/esm/_virtual/_utils_asset.mjs +4 -2
  116. package/dist/esm/auth/login.mjs +43 -30
  117. package/dist/esm/auth/login.mjs.map +1 -1
  118. package/dist/esm/auth/sessionToken.mjs.map +1 -1
  119. package/dist/esm/build.mjs +3 -3
  120. package/dist/esm/build.mjs.map +1 -1
  121. package/dist/esm/bundle.mjs +32 -1
  122. package/dist/esm/bundle.mjs.map +1 -1
  123. package/dist/esm/ci.mjs +95 -30
  124. package/dist/esm/ci.mjs.map +1 -1
  125. package/dist/esm/cli.mjs +141 -102
  126. package/dist/esm/cli.mjs.map +1 -1
  127. package/dist/esm/config.mjs +1 -1
  128. package/dist/esm/config.mjs.map +1 -1
  129. package/dist/esm/editor.mjs.map +1 -1
  130. package/dist/esm/extract.mjs +3 -3
  131. package/dist/esm/extract.mjs.map +1 -1
  132. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  133. package/dist/esm/fill/extractTranslatableContent.mjs.map +1 -1
  134. package/dist/esm/fill/fill.mjs +3 -3
  135. package/dist/esm/fill/fill.mjs.map +1 -1
  136. package/dist/esm/fill/formatAutoFilledFilePath.mjs +1 -1
  137. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  138. package/dist/esm/fill/formatFillData.mjs +1 -1
  139. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  140. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  141. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  142. package/dist/esm/fill/listTranslationsTasks.mjs +1 -1
  143. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  144. package/dist/esm/fill/translateDictionary.mjs +1 -1
  145. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  146. package/dist/esm/fill/writeFill.mjs +2 -2
  147. package/dist/esm/fill/writeFill.mjs.map +1 -1
  148. package/dist/esm/getTargetDictionary.mjs +1 -1
  149. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  150. package/dist/esm/index.mjs +4 -4
  151. package/dist/esm/init.mjs +368 -4
  152. package/dist/esm/init.mjs.map +1 -1
  153. package/dist/esm/initBuildOptimization.mjs +78 -0
  154. package/dist/esm/initBuildOptimization.mjs.map +1 -0
  155. package/dist/esm/initCompiler.mjs +114 -0
  156. package/dist/esm/initCompiler.mjs.map +1 -0
  157. package/dist/esm/initMCP.mjs +23 -20
  158. package/dist/esm/initMCP.mjs.map +1 -1
  159. package/dist/esm/initSkills.mjs +22 -19
  160. package/dist/esm/initSkills.mjs.map +1 -1
  161. package/dist/esm/listContentDeclaration.mjs +2 -2
  162. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  163. package/dist/esm/listProjects.mjs +1 -1
  164. package/dist/esm/listProjects.mjs.map +1 -1
  165. package/dist/esm/liveSync.mjs +2 -2
  166. package/dist/esm/liveSync.mjs.map +1 -1
  167. package/dist/esm/pull.mjs +4 -4
  168. package/dist/esm/pull.mjs.map +1 -1
  169. package/dist/esm/push/pullLog.mjs +2 -2
  170. package/dist/esm/push/pullLog.mjs.map +1 -1
  171. package/dist/esm/push/push.mjs +3 -3
  172. package/dist/esm/push/push.mjs.map +1 -1
  173. package/dist/esm/pushConfig.mjs +1 -1
  174. package/dist/esm/pushConfig.mjs.map +1 -1
  175. package/dist/esm/pushLog.mjs.map +1 -1
  176. package/dist/esm/reviewDoc/reviewDoc.mjs +3 -3
  177. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  178. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +3 -3
  179. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  180. package/dist/esm/reviewDoc/reviewDocLog.mjs +2 -2
  181. package/dist/esm/reviewDoc/reviewDocLog.mjs.map +1 -1
  182. package/dist/esm/scan.mjs +1 -1
  183. package/dist/esm/scan.mjs.map +1 -1
  184. package/dist/esm/searchDoc.mjs +1 -1
  185. package/dist/esm/searchDoc.mjs.map +1 -1
  186. package/dist/esm/test/listMissingTranslations.mjs +2 -2
  187. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  188. package/dist/esm/test/test.mjs +2 -2
  189. package/dist/esm/test/test.mjs.map +1 -1
  190. package/dist/esm/translateDoc/translateDoc.mjs +2 -2
  191. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  192. package/dist/esm/translateDoc/translateFile.mjs +2 -2
  193. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  194. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  195. package/dist/esm/utils/calculateChunks.mjs +1 -1
  196. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  197. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  198. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  199. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  200. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  201. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  202. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  203. package/dist/esm/utils/formatLineRanges.mjs.map +1 -1
  204. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  205. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +1 -1
  206. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  207. package/dist/esm/utils/getOutputFilePath.mjs +1 -1
  208. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  209. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  210. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  211. package/dist/esm/utils/mapChunksBetweenFiles.mjs +1 -1
  212. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  213. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  214. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  215. package/dist/esm/utils/selectCmsEnvironment.mjs.map +1 -1
  216. package/dist/esm/utils/setupAI.mjs.map +1 -1
  217. package/dist/esm/watch.mjs +25 -5
  218. package/dist/esm/watch.mjs.map +1 -1
  219. package/dist/types/IntlayerEventListener.d.ts +0 -1
  220. package/dist/types/IntlayerEventListener.d.ts.map +1 -1
  221. package/dist/types/auth/login.d.ts +13 -5
  222. package/dist/types/auth/login.d.ts.map +1 -1
  223. package/dist/types/auth/sessionToken.d.ts +0 -1
  224. package/dist/types/auth/sessionToken.d.ts.map +1 -1
  225. package/dist/types/build.d.ts +0 -1
  226. package/dist/types/build.d.ts.map +1 -1
  227. package/dist/types/bundle.d.ts +0 -1
  228. package/dist/types/bundle.d.ts.map +1 -1
  229. package/dist/types/ci.d.ts +40 -1
  230. package/dist/types/ci.d.ts.map +1 -1
  231. package/dist/types/cli.d.ts +0 -1
  232. package/dist/types/cli.d.ts.map +1 -1
  233. package/dist/types/config.d.ts +0 -1
  234. package/dist/types/config.d.ts.map +1 -1
  235. package/dist/types/editor.d.ts.map +1 -1
  236. package/dist/types/extract.d.ts +0 -1
  237. package/dist/types/extract.d.ts.map +1 -1
  238. package/dist/types/fill/deepMergeContent.d.ts.map +1 -1
  239. package/dist/types/fill/extractTranslatableContent.d.ts.map +1 -1
  240. package/dist/types/fill/fill.d.ts +1 -2
  241. package/dist/types/fill/fill.d.ts.map +1 -1
  242. package/dist/types/fill/formatAutoFilledFilePath.d.ts +0 -1
  243. package/dist/types/fill/formatAutoFilledFilePath.d.ts.map +1 -1
  244. package/dist/types/fill/formatFillData.d.ts +0 -1
  245. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  246. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts +0 -1
  247. package/dist/types/fill/getAvailableLocalesInDictionary.d.ts.map +1 -1
  248. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts +0 -1
  249. package/dist/types/fill/getFilterMissingContentPerLocale.d.ts.map +1 -1
  250. package/dist/types/fill/listTranslationsTasks.d.ts +1 -2
  251. package/dist/types/fill/listTranslationsTasks.d.ts.map +1 -1
  252. package/dist/types/fill/translateDictionary.d.ts +1 -3
  253. package/dist/types/fill/translateDictionary.d.ts.map +1 -1
  254. package/dist/types/fill/writeFill.d.ts +0 -1
  255. package/dist/types/fill/writeFill.d.ts.map +1 -1
  256. package/dist/types/getTargetDictionary.d.ts +1 -2
  257. package/dist/types/getTargetDictionary.d.ts.map +1 -1
  258. package/dist/types/index.d.ts +5 -4
  259. package/dist/types/init.d.ts +2 -3
  260. package/dist/types/init.d.ts.map +1 -1
  261. package/dist/types/initBuildOptimization.d.ts +20 -0
  262. package/dist/types/initBuildOptimization.d.ts.map +1 -0
  263. package/dist/types/initCompiler.d.ts +18 -0
  264. package/dist/types/initCompiler.d.ts.map +1 -0
  265. package/dist/types/initMCP.d.ts +2 -1
  266. package/dist/types/initMCP.d.ts.map +1 -1
  267. package/dist/types/initSkills.d.ts +2 -3
  268. package/dist/types/initSkills.d.ts.map +1 -1
  269. package/dist/types/listContentDeclaration.d.ts +0 -1
  270. package/dist/types/listContentDeclaration.d.ts.map +1 -1
  271. package/dist/types/listProjects.d.ts +1 -2
  272. package/dist/types/listProjects.d.ts.map +1 -1
  273. package/dist/types/liveSync.d.ts +0 -1
  274. package/dist/types/liveSync.d.ts.map +1 -1
  275. package/dist/types/pull.d.ts +0 -1
  276. package/dist/types/pull.d.ts.map +1 -1
  277. package/dist/types/push/pullLog.d.ts +1 -2
  278. package/dist/types/push/pullLog.d.ts.map +1 -1
  279. package/dist/types/push/push.d.ts +1 -2
  280. package/dist/types/push/push.d.ts.map +1 -1
  281. package/dist/types/pushConfig.d.ts +0 -1
  282. package/dist/types/pushConfig.d.ts.map +1 -1
  283. package/dist/types/pushLog.d.ts.map +1 -1
  284. package/dist/types/reviewDoc/reviewDoc.d.ts +2 -17
  285. package/dist/types/reviewDoc/reviewDoc.d.ts.map +1 -1
  286. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +0 -1
  287. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts.map +1 -1
  288. package/dist/types/reviewDoc/reviewDocLog.d.ts +1 -2
  289. package/dist/types/reviewDoc/reviewDocLog.d.ts.map +1 -1
  290. package/dist/types/scan.d.ts +3 -2
  291. package/dist/types/scan.d.ts.map +1 -1
  292. package/dist/types/searchDoc.d.ts +1 -6
  293. package/dist/types/searchDoc.d.ts.map +1 -1
  294. package/dist/types/test/listMissingTranslations.d.ts +0 -1
  295. package/dist/types/test/listMissingTranslations.d.ts.map +1 -1
  296. package/dist/types/test/test.d.ts +0 -1
  297. package/dist/types/test/test.d.ts.map +1 -1
  298. package/dist/types/translateDoc/translateDoc.d.ts +1 -16
  299. package/dist/types/translateDoc/translateDoc.d.ts.map +1 -1
  300. package/dist/types/translateDoc/translateFile.d.ts +1 -16
  301. package/dist/types/translateDoc/translateFile.d.ts.map +1 -1
  302. package/dist/types/translateDoc/types.d.ts +1 -2
  303. package/dist/types/translateDoc/types.d.ts.map +1 -1
  304. package/dist/types/translateDoc/validation.d.ts +0 -1
  305. package/dist/types/translateDoc/validation.d.ts.map +1 -1
  306. package/dist/types/utils/calculateChunks.d.ts.map +1 -1
  307. package/dist/types/utils/checkAccess.d.ts +0 -1
  308. package/dist/types/utils/checkAccess.d.ts.map +1 -1
  309. package/dist/types/utils/checkConfigConsistency.d.ts.map +1 -1
  310. package/dist/types/utils/checkFileModifiedRange.d.ts.map +1 -1
  311. package/dist/types/utils/checkLastUpdateTime.d.ts.map +1 -1
  312. package/dist/types/utils/chunkInference.d.ts +0 -1
  313. package/dist/types/utils/chunkInference.d.ts.map +1 -1
  314. package/dist/types/utils/fixChunkStartEndChars.d.ts.map +1 -1
  315. package/dist/types/utils/formatLineRanges.d.ts.map +1 -1
  316. package/dist/types/utils/formatTimeDiff.d.ts.map +1 -1
  317. package/dist/types/utils/getIsFileUpdatedRecently.d.ts.map +1 -1
  318. package/dist/types/utils/getOutputFilePath.d.ts +0 -1
  319. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  320. package/dist/types/utils/getParentPackageJSON.d.ts.map +1 -1
  321. package/dist/types/utils/listSpecialChars.d.ts +4 -2
  322. package/dist/types/utils/listSpecialChars.d.ts.map +1 -1
  323. package/dist/types/utils/mapChunksBetweenFiles.d.ts +0 -1
  324. package/dist/types/utils/mapChunksBetweenFiles.d.ts.map +1 -1
  325. package/dist/types/utils/openBrowser.d.ts.map +1 -1
  326. package/dist/types/utils/reorderParagraphs.d.ts.map +1 -1
  327. package/dist/types/utils/selectCmsEnvironment.d.ts +0 -1
  328. package/dist/types/utils/selectCmsEnvironment.d.ts.map +1 -1
  329. package/dist/types/utils/setupAI.d.ts +1 -3
  330. package/dist/types/utils/setupAI.d.ts.map +1 -1
  331. package/dist/types/watch.d.ts +0 -1
  332. package/dist/types/watch.d.ts.map +1 -1
  333. package/package.json +17 -17
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initCompiler.cjs","names":["findProjectRoot","p"],"sources":["../../src/initCompiler.ts"],"sourcesContent":["import { existsSync, readFileSync, writeFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport { detectPackageManager, installPackages } from '@intlayer/engine/cli';\nimport { findProjectRoot } from './init';\n\n/** Framework the Intlayer compiler can be wired into during init. */\ntype CompilerFramework = 'vite' | 'nextjs' | 'unknown';\n\n/**\n * babel.config.js that runs the Intlayer compiler passes for Next.js.\n *\n * Mirrors the Next.js (Babel) tab of `docs/docs/en/compiler.md`: the extract\n * plugin pulls inline content into dictionaries and the optimize plugin\n * rewrites `useIntlayer` into direct dictionary imports. On Vite the same work\n * is handled by the `intlayer()` plugin (which bundles the compiler in v9), so\n * no Babel config is needed.\n */\nconst BABEL_COMPILER_CONFIG_CONTENT = `const {\n intlayerExtractBabelPlugin,\n intlayerOptimizeBabelPlugin,\n getExtractPluginOptions,\n getOptimizePluginOptions,\n} = require(\"@intlayer/babel\");\n\nmodule.exports = {\n presets: [\"next/babel\"],\n plugins: [\n // Extract content from components into dictionaries\n [intlayerExtractBabelPlugin, getExtractPluginOptions()],\n // Optimize imports by replacing useIntlayer with direct dictionary imports\n [intlayerOptimizeBabelPlugin, getOptimizePluginOptions()],\n ],\n};\n`;\n\n/**\n * Reads the project dependencies and detects which framework the compiler\n * should target. Next.js is checked before Vite because a Next.js project may\n * transitively depend on Vite tooling.\n */\nconst detectCompilerFramework = (root: string): CompilerFramework => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return 'unknown';\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n const allDependencies = { ...dependencies, ...devDependencies };\n\n if (allDependencies.next) return 'nextjs';\n if (allDependencies.vite) return 'vite';\n\n return 'unknown';\n } catch {\n return 'unknown';\n }\n};\n\n/**\n * Scaffolds the Intlayer compiler for the current project during interactive\n * init.\n *\n * - **Vite** — nothing to do: since v9 the compiler is built into the\n * `intlayer()` plugin in `vite.config.ts`, so this only confirms the setup\n * to the user.\n * - **Next.js** — installs `@intlayer/babel` and writes a `babel.config.js`\n * that runs the extract + optimize compiler passes.\n *\n * In non-interactive init this function is never called, so the compiler setup\n * is left untouched.\n */\nexport const initCompiler = async (projectRoot?: string): Promise<void> => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n const framework = detectCompilerFramework(root);\n\n if (framework === 'vite') {\n // Since v9 the compiler is bundled inside intlayer() — nothing to scaffold.\n p.log.info(\n 'Vite detected — the compiler is built into `intlayer()` in your vite.config. Nothing to configure.'\n );\n return;\n }\n\n if (framework !== 'nextjs') {\n p.log.warn(\n 'No supported framework detected for the compiler — skipping. See the compiler docs for manual setup.'\n );\n return;\n }\n\n p.intro('Configuring the Intlayer compiler for Next.js');\n\n const packageManager = detectPackageManager(root);\n const devPackagesToInstall = ['@intlayer/babel'];\n\n const spinner = p.spinner();\n spinner.start('Installing packages...');\n\n try {\n installPackages(root, devPackagesToInstall, packageManager, true);\n spinner.stop(`Installed: ${devPackagesToInstall.join(', ')}`);\n } catch {\n spinner.stop('Package installation failed');\n p.log.warn(\n `Please install manually: ${devPackagesToInstall.join(' ')} (dev dependency)`\n );\n }\n\n const babelConfigCandidates = [\n 'babel.config.js',\n 'babel.config.cjs',\n 'babel.config.mjs',\n 'babel.config.ts',\n '.babelrc',\n '.babelrc.js',\n ];\n\n const existingBabelConfig = babelConfigCandidates.find((file) =>\n existsSync(join(root, file))\n );\n\n if (existingBabelConfig) {\n p.log.warn(\n `${existingBabelConfig} already exists — add the Intlayer compiler plugins manually.`\n );\n p.note(\n BABEL_COMPILER_CONFIG_CONTENT,\n 'Plugins to add to your babel config'\n );\n } else {\n try {\n writeFileSync(\n join(root, 'babel.config.js'),\n BABEL_COMPILER_CONFIG_CONTENT,\n { encoding: 'utf-8' }\n );\n p.log.success(\n 'Created babel.config.js with the Intlayer compiler extract and optimize plugins'\n );\n } catch {\n p.log.warn(\n 'Could not create babel.config.js — please create it manually.'\n );\n p.note(BABEL_COMPILER_CONFIG_CONTENT, 'babel.config.js');\n }\n }\n\n p.outro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I,qBAAqB;EACvB,eAAE,IAAI,KACJ,GAAG,oBAAoB,8DACzB;EACA,eAAE,KACA,+BACA,qCACF;CACF,OACE,IAAI;EACF,+CACO,MAAM,iBAAiB,GAC5B,+BACA,EAAE,UAAU,QAAQ,CACtB;EACA,eAAE,IAAI,QACJ,iFACF;CACF,QAAQ;EACN,eAAE,IAAI,KACJ,+DACF;EACA,eAAE,KAAK,+BAA+B,iBAAiB;CACzD;CAGF,eAAE,MAAM,iCAAiC;AAC3C"}
@@ -1,36 +1,39 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- const require_init = require('./init.cjs');
4
3
  const require_initSkills = require('./initSkills.cjs');
4
+ const require_init = require('./init.cjs');
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let enquirer = require("enquirer");
8
8
  enquirer = require_runtime.__toESM(enquirer);
9
9
  let _clack_prompts = require("@clack/prompts");
10
10
  _clack_prompts = require_runtime.__toESM(_clack_prompts);
11
11
 
12
12
  //#region src/initMCP.ts
13
- const initMCP = async (projectRoot) => {
13
+ const initMCP = async (projectRoot, preselectedPlatform) => {
14
14
  const root = require_init.findProjectRoot(projectRoot ? (0, node_path.resolve)(projectRoot) : process.cwd());
15
15
  _clack_prompts.intro("Initializing Intlayer MCP Server");
16
- const detectedPlatform = require_initSkills.getDetectedPlatform();
17
16
  let platform;
18
- try {
19
- platform = (await enquirer.default.prompt({
20
- type: "autocomplete",
21
- name: "platforms",
22
- message: "Which platform are you using? (Type to search)",
23
- multiple: false,
24
- initial: detectedPlatform ? _intlayer_chokidar_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
25
- choices: require_initSkills.PLATFORM_OPTIONS.map((opt) => ({
26
- name: opt.value,
27
- message: opt.label,
28
- hint: opt.hint
29
- }))
30
- })).platforms;
31
- } catch {
32
- _clack_prompts.cancel("Operation cancelled.");
33
- return;
17
+ if (preselectedPlatform) platform = preselectedPlatform;
18
+ else {
19
+ const detectedPlatform = require_initSkills.getDetectedPlatform();
20
+ try {
21
+ platform = (await enquirer.default.prompt({
22
+ type: "autocomplete",
23
+ name: "platforms",
24
+ message: "Which platform are you using? (Type to search)",
25
+ multiple: false,
26
+ initial: detectedPlatform ? _intlayer_engine_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
27
+ choices: require_initSkills.PLATFORM_OPTIONS.map((opt) => ({
28
+ name: opt.value,
29
+ message: opt.label,
30
+ hint: opt.hint
31
+ }))
32
+ })).platforms;
33
+ } catch {
34
+ _clack_prompts.cancel("Operation cancelled.");
35
+ return;
36
+ }
34
37
  }
35
38
  if (!platform) {
36
39
  _clack_prompts.cancel("Operation cancelled. No platform selected.");
@@ -55,7 +58,7 @@ const initMCP = async (projectRoot) => {
55
58
  const s = _clack_prompts.spinner();
56
59
  s.start("Configuring MCP Server...");
57
60
  try {
58
- const result = await (0, _intlayer_chokidar_cli.installMCP)(root, platform, transport);
61
+ const result = await (0, _intlayer_engine_cli.installMCP)(root, platform, transport);
59
62
  s.stop("MCP Server configured successfully");
60
63
  _clack_prompts.note(result, "Success");
61
64
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"initMCP.cjs","names":["findProjectRoot","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","p"],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: any;\n try {\n const response = await enquirer.prompt<{ platforms: any }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,UAAU,OAAO,gBAAyB;CACrD,MAAM,OAAOA,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,mCAAmC;CAE3C,MAAM,mBAAmBC,wCAAqB;CAE9C,IAAI;AACJ,KAAI;AAeF,cAAW,MAdY,iBAAS,OAA2B;GACzD,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS,mBACLC,iCAAU,QAAQ,iBAAiB,GACnC;GACJ,SAASC,oCAAiB,KAAK,SAAS;IACtC,MAAM,IAAI;IACV,SAAS,IAAI;IACb,MAAM,IAAI;IACX,EAAE;GACJ,CAAC,EACkB;SACd;AACN,iBAAE,OAAO,uBAAuB;AAChC;;AAGF,KAAI,CAAC,UAAU;AACb,iBAAE,OAAO,6CAA6C;AACtD;;CAGF,MAAM,YAAa,MAAMC,eAAE,OAAO;EAChC,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,EACD;GACE,OAAO;GACP,OAAO;GACP,MAAM;GACP,CACF;EACF,CAAC;AAEF,KAAIA,eAAE,SAAS,UAAU,IAAI,CAAC,WAAW;AACvC,iBAAE,OAAO,uBAAuB;AAChC;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,4BAA4B;AAEpC,KAAI;EACF,MAAM,SAAS,6CAAiB,MAAM,UAAU,UAAU;AAE1D,IAAE,KAAK,qCAAqC;AAE5C,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,iCAAiC;AACxC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,8CAA8C"}
1
+ {"version":3,"file":"initMCP.cjs","names":["findProjectRoot","getDetectedPlatform","PLATFORMS","PLATFORM_OPTIONS","p"],"sources":["../../src/initMCP.ts"],"sourcesContent":["import { resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n installMCP,\n type MCPTransport,\n PLATFORMS,\n type Platform,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\nimport { getDetectedPlatform, PLATFORM_OPTIONS } from './initSkills';\n\nexport const initMCP = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer MCP Server');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platform are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.cancel('Operation cancelled. No platform selected.');\n return;\n }\n\n const transport = (await p.select({\n message: 'Which transport method do you want to use?',\n options: [\n {\n value: 'stdio',\n label: 'Local server (stdio)',\n hint: 'Recommended. Integrates all features including CLI tools.',\n },\n {\n value: 'sse',\n label: 'Remote server (SSE)',\n hint: 'Hosted by Intlayer. Documentation only.',\n },\n ],\n })) as MCPTransport;\n\n if (p.isCancel(transport) || !transport) {\n p.cancel('Operation cancelled.');\n return;\n }\n\n const s = p.spinner();\n s.start('Configuring MCP Server...');\n\n try {\n const result = await installMCP(root, platform, transport);\n\n s.stop('MCP Server configured successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to configure MCP Server');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer MCP Server initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,UAAU,OACrB,aACA,wBACG;CACH,MAAM,OAAOA,6BACX,qCAAsB,WAAW,IAAI,QAAQ,IAAI,CACnD;CAEA,eAAE,MAAM,kCAAkC;CAE1C,IAAI;CAEJ,IAAI,qBACF,WAAW;MACN;EACL,MAAM,mBAAmBC,uCAAoB;EAE7C,IAAI;GAeF,YAAW,MAdY,iBAAS,OAAgC;IAC9D,MAAM;IACN,MAAM;IACN,SAAS;IACT,UAAU;IACV,SAAS,mBACLC,+BAAU,QAAQ,gBAAgB,IAClC;IACJ,SAASC,oCAAiB,KAAK,SAAS;KACtC,MAAM,IAAI;KACV,SAAS,IAAI;KACb,MAAM,IAAI;IACZ,EAAE;GACJ,CAAC,EACkB,CAAC;EACtB,QAAQ;GACN,eAAE,OAAO,sBAAsB;GAC/B;EACF;CACF;CAEA,IAAI,CAAC,UAAU;EACb,eAAE,OAAO,4CAA4C;EACrD;CACF;CAEA,MAAM,YAAa,MAAMC,eAAE,OAAO;EAChC,SAAS;EACT,SAAS,CACP;GACE,OAAO;GACP,OAAO;GACP,MAAM;EACR,GACA;GACE,OAAO;GACP,OAAO;GACP,MAAM;EACR,CACF;CACF,CAAC;CAED,IAAIA,eAAE,SAAS,SAAS,KAAK,CAAC,WAAW;EACvC,eAAE,OAAO,sBAAsB;EAC/B;CACF;CAEA,MAAM,IAAIA,eAAE,QAAQ;CACpB,EAAE,MAAM,2BAA2B;CAEnC,IAAI;EACF,MAAM,SAAS,2CAAiB,MAAM,UAAU,SAAS;EAEzD,EAAE,KAAK,oCAAoC;EAE3C,eAAE,KAAK,QAAQ,SAAS;CAC1B,SAAS,OAAO;EACd,EAAE,KAAK,gCAAgC;EACvC,eAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;CACpE;CAEA,eAAE,MAAM,6CAA6C;AACvD"}
@@ -3,21 +3,21 @@ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_init = require('./init.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
6
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
6
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
7
7
  let enquirer = require("enquirer");
8
8
  enquirer = require_runtime.__toESM(enquirer);
9
9
  let _clack_prompts = require("@clack/prompts");
10
10
  _clack_prompts = require_runtime.__toESM(_clack_prompts);
11
11
 
12
12
  //#region src/initSkills.ts
13
- const PLATFORM_CHECKS = _intlayer_chokidar_cli.PLATFORMS.filter((platform) => _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.check).map((platform) => ({
14
- check: _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.check ?? (() => false),
13
+ const PLATFORM_CHECKS = _intlayer_engine_cli.PLATFORMS.filter((platform) => _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.check).map((platform) => ({
14
+ check: _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.check ?? (() => false),
15
15
  platform
16
16
  }));
17
- const PLATFORM_OPTIONS = _intlayer_chokidar_cli.PLATFORMS.map((platform) => ({
17
+ const PLATFORM_OPTIONS = _intlayer_engine_cli.PLATFORMS.map((platform) => ({
18
18
  value: platform,
19
- label: _intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.label ?? "",
20
- hint: `(${_intlayer_chokidar_cli.PLATFORMS_METADATA[platform]?.dir})`
19
+ label: _intlayer_engine_cli.PLATFORMS_METADATA[platform]?.label ?? "",
20
+ hint: `(${_intlayer_engine_cli.PLATFORMS_METADATA[platform]?.dir})`
21
21
  }));
22
22
  const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
23
23
  const getDependencies = (root) => {
@@ -33,40 +33,43 @@ const getDependencies = (root) => {
33
33
  return {};
34
34
  }
35
35
  };
36
- const initSkills = async (projectRoot) => {
36
+ const initSkills = async (projectRoot, preselectedPlatform) => {
37
37
  const root = require_init.findProjectRoot(projectRoot ? (0, node_path.resolve)(projectRoot) : process.cwd());
38
38
  _clack_prompts.intro("Initializing Intlayer skills");
39
- const detectedPlatform = getDetectedPlatform();
40
39
  let platform;
41
- try {
42
- platform = (await enquirer.default.prompt({
43
- type: "autocomplete",
44
- name: "platforms",
45
- message: "Which platforms are you using? (Type to search)",
46
- multiple: false,
47
- initial: detectedPlatform ? _intlayer_chokidar_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
48
- choices: PLATFORM_OPTIONS.map((opt) => ({
49
- name: opt.value,
50
- message: opt.label,
51
- hint: opt.hint
52
- }))
53
- })).platforms;
54
- } catch {
55
- _clack_prompts.cancel("Operation cancelled.");
56
- return;
40
+ if (preselectedPlatform) platform = preselectedPlatform;
41
+ else {
42
+ const detectedPlatform = getDetectedPlatform();
43
+ try {
44
+ platform = (await enquirer.default.prompt({
45
+ type: "autocomplete",
46
+ name: "platforms",
47
+ message: "Which platforms are you using? (Type to search)",
48
+ multiple: false,
49
+ initial: detectedPlatform ? _intlayer_engine_cli.PLATFORMS.indexOf(detectedPlatform) : void 0,
50
+ choices: PLATFORM_OPTIONS.map((opt) => ({
51
+ name: opt.value,
52
+ message: opt.label,
53
+ hint: opt.hint
54
+ }))
55
+ })).platforms;
56
+ } catch {
57
+ _clack_prompts.cancel("Operation cancelled.");
58
+ return;
59
+ }
57
60
  }
58
61
  if (!platform) {
59
62
  _clack_prompts.log.warn("No platform selected. Nothing to install.");
60
63
  return;
61
64
  }
62
- const initialValues = (0, _intlayer_chokidar_cli.getInitialSkills)(getDependencies(root));
65
+ const initialValues = (0, _intlayer_engine_cli.getInitialSkills)(getDependencies(root));
63
66
  const selectedSkills = await _clack_prompts.multiselect({
64
67
  message: "Select the documentation skills to provide to your AI:",
65
68
  initialValues,
66
- options: _intlayer_chokidar_cli.SKILLS.map((skill) => ({
69
+ options: _intlayer_engine_cli.SKILLS.map((skill) => ({
67
70
  value: skill,
68
71
  label: skill,
69
- hint: _intlayer_chokidar_cli.SKILLS_METADATA[skill]
72
+ hint: _intlayer_engine_cli.SKILLS_METADATA[skill]
70
73
  })),
71
74
  required: false
72
75
  });
@@ -77,7 +80,7 @@ const initSkills = async (projectRoot) => {
77
80
  const s = _clack_prompts.spinner();
78
81
  s.start("Installing skills...");
79
82
  try {
80
- const result = await (0, _intlayer_chokidar_cli.installSkills)(root, platform, selectedSkills);
83
+ const result = await (0, _intlayer_engine_cli.installSkills)(root, platform, selectedSkills);
81
84
  s.stop("Skills installed successfully");
82
85
  _clack_prompts.note(result, "Success");
83
86
  } catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"initSkills.cjs","names":["PLATFORMS","PLATFORMS_METADATA","findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/chokidar/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform]?.check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform]?.check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform]?.label ?? '',\n hint: `(${PLATFORMS_METADATA[platform]?.dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (projectRoot?: string) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n const detectedPlatform = getDetectedPlatform();\n\n let platform: Platform;\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,kBACJA,iCAAU,QAAQ,aAAaC,0CAAmB,WAAW,MAAM,CAAC,KACjE,cAAc;CACb,OAAOA,0CAAmB,WAAW,gBAAgB;CACrD;CACD,EACF;AAEH,MAAa,mBAIRD,iCAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAOC,0CAAmB,WAAW,SAAS;CAC9C,MAAM,IAAIA,0CAAmB,WAAW,IAAI;CAC7C,EAAE;AAEH,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,OAAO,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;AAChE,KAAI;EACF,MAAM,sCAAuB,MAAM,eAAe;AAClD,MAAI,yBAAY,gBAAgB,CAAE,QAAO,EAAE;EAE3C,MAAM,EAAE,eAAe,EAAE,EAAE,kBAAkB,EAAE,KAAK,KAAK,gCAC1C,iBAAiB,QAAQ,CACvC;AACD,SAAO;GAAE,GAAG;GAAc,GAAG;GAAiB;SACxC;AACN,SAAO,EAAE;;;AAIb,MAAa,aAAa,OAAO,gBAAyB;CACxD,MAAM,OAAOC,6BACX,qCAAsB,YAAY,GAAG,QAAQ,KAAK,CACnD;AAED,gBAAE,MAAM,+BAA+B;CAEvC,MAAM,mBAAmB,qBAAqB;CAE9C,IAAI;AACJ,KAAI;AAeF,cAAW,MAdY,iBAAS,OAAgC;GAC9D,MAAM;GACN,MAAM;GACN,SAAS;GACT,UAAU;GACV,SAAS,mBACLF,iCAAU,QAAQ,iBAAiB,GACnC;GACJ,SAAS,iBAAiB,KAAK,SAAS;IACtC,MAAM,IAAI;IACV,SAAS,IAAI;IACb,MAAM,IAAI;IACX,EAAE;GACJ,CAAC,EACkB;SACd;AACN,iBAAE,OAAO,uBAAuB;AAChC;;AAGF,KAAI,CAAC,UAAU;AACb,iBAAE,IAAI,KAAK,4CAA4C;AACvD;;CAIF,MAAM,6DADe,gBAAgB,KACc,CAAC;CAEpD,MAAM,iBAAiB,MAAMG,eAAE,YAAY;EACzC,SAAS;EACT;EACA,SAASC,8BAAO,KAAK,WAAW;GAC9B,OAAO;GACP,OAAO;GACP,MAAMC,uCAAgB;GACvB,EAAE;EACH,UAAU;EACX,CAAC;AAEF,KACEF,eAAE,SAAS,eAAe,IAC1B,CAAC,kBACA,eAA4B,WAAW,GACxC;AACA,iBAAE,OAAO,2CAA2C;AACpD;;CAGF,MAAM,IAAIA,eAAE,SAAS;AACrB,GAAE,MAAM,uBAAuB;AAE/B,KAAI;EACF,MAAM,SAAS,gDAAoB,MAAM,UAAU,eAAe;AAElE,IAAE,KAAK,gCAAgC;AAEvC,iBAAE,KAAK,QAAQ,UAAU;UAClB,OAAO;AACd,IAAE,KAAK,2BAA2B;AAClC,iBAAE,IAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,CAAC;;AAGrE,gBAAE,MAAM,0CAA0C"}
1
+ {"version":3,"file":"initSkills.cjs","names":["PLATFORMS","PLATFORMS_METADATA","findProjectRoot","p","SKILLS","SKILLS_METADATA"],"sources":["../../src/initSkills.ts"],"sourcesContent":["import { existsSync, readFileSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport * as p from '@clack/prompts';\nimport {\n getInitialSkills,\n installSkills,\n PLATFORMS,\n PLATFORMS_METADATA,\n type Platform,\n SKILLS,\n SKILLS_METADATA,\n} from '@intlayer/engine/cli';\nimport enquirer from 'enquirer';\nimport { findProjectRoot } from './init';\n\nconst PLATFORM_CHECKS: Array<{ check: () => boolean; platform: Platform }> =\n PLATFORMS.filter((platform) => PLATFORMS_METADATA[platform]?.check).map(\n (platform) => ({\n check: PLATFORMS_METADATA[platform]?.check ?? (() => false),\n platform,\n })\n );\n\nexport const PLATFORM_OPTIONS: Array<{\n value: Platform;\n label: string;\n hint: string;\n}> = PLATFORMS.map((platform) => ({\n value: platform,\n label: PLATFORMS_METADATA[platform]?.label ?? '',\n hint: `(${PLATFORMS_METADATA[platform]?.dir})`,\n}));\n\nexport const getDetectedPlatform = (): Platform | undefined =>\n PLATFORM_CHECKS.find(({ check }) => check())?.platform;\n\nconst getDependencies = (root: string): Record<string, string> => {\n try {\n const packageJsonPath = join(root, 'package.json');\n if (!existsSync(packageJsonPath)) return {};\n\n const { dependencies = {}, devDependencies = {} } = JSON.parse(\n readFileSync(packageJsonPath, 'utf-8')\n );\n return { ...dependencies, ...devDependencies };\n } catch {\n return {};\n }\n};\n\nexport const initSkills = async (\n projectRoot?: string,\n preselectedPlatform?: Platform\n) => {\n const root = findProjectRoot(\n projectRoot ? resolve(projectRoot) : process.cwd()\n );\n\n p.intro('Initializing Intlayer skills');\n\n let platform: Platform;\n\n if (preselectedPlatform) {\n platform = preselectedPlatform;\n } else {\n const detectedPlatform = getDetectedPlatform();\n\n try {\n const response = await enquirer.prompt<{ platforms: Platform }>({\n type: 'autocomplete',\n name: 'platforms',\n message: 'Which platforms are you using? (Type to search)',\n multiple: false,\n initial: detectedPlatform\n ? PLATFORMS.indexOf(detectedPlatform)\n : undefined,\n choices: PLATFORM_OPTIONS.map((opt) => ({\n name: opt.value,\n message: opt.label,\n hint: opt.hint,\n })),\n });\n platform = response.platforms;\n } catch {\n p.cancel('Operation cancelled.');\n return;\n }\n }\n\n if (!platform) {\n p.log.warn('No platform selected. Nothing to install.');\n return;\n }\n\n const dependencies = getDependencies(root);\n const initialValues = getInitialSkills(dependencies);\n\n const selectedSkills = await p.multiselect({\n message: 'Select the documentation skills to provide to your AI:',\n initialValues,\n options: SKILLS.map((skill) => ({\n value: skill,\n label: skill,\n hint: SKILLS_METADATA[skill],\n })),\n required: false,\n });\n\n if (\n p.isCancel(selectedSkills) ||\n !selectedSkills ||\n (selectedSkills as string[]).length === 0\n ) {\n p.cancel('Operation cancelled. No skills selected.');\n return;\n }\n\n const s = p.spinner();\n s.start('Installing skills...');\n\n try {\n const result = await installSkills(root, platform, selectedSkills);\n\n s.stop('Skills installed successfully');\n\n p.note(result, 'Success');\n } catch (error) {\n s.stop('Failed to install skills');\n p.log.error(error instanceof Error ? error.message : String(error));\n }\n\n p.outro('Intlayer skills initialization complete');\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,kBACJA,+BAAU,QAAQ,aAAaC,wCAAmB,SAAS,EAAE,KAAK,CAAC,CAAC,KACjE,cAAc;CACb,OAAOA,wCAAmB,SAAS,EAAE,gBAAgB;CACrD;AACF,EACF;AAEF,MAAa,mBAIRD,+BAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAOC,wCAAmB,SAAS,EAAE,SAAS;CAC9C,MAAM,IAAIA,wCAAmB,SAAS,EAAE,IAAI;AAC9C,EAAE;AAEF,MAAa,4BACX,gBAAgB,MAAM,EAAE,YAAY,MAAM,CAAC,CAAC,EAAE;AAEhD,MAAM,mBAAmB,SAAyC;CAChE,IAAI;EACF,MAAM,sCAAuB,MAAM,cAAc;EACjD,IAAI,yBAAY,eAAe,GAAG,OAAO,CAAC;EAE1C,MAAM,EAAE,eAAe,CAAC,GAAG,kBAAkB,CAAC,MAAM,KAAK,gCAC1C,iBAAiB,OAAO,CACvC;EACA,OAAO;GAAE,GAAG;GAAc,GAAG;EAAgB;CAC/C,QAAQ;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AACnD"}
@@ -1,16 +1,15 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
6
3
  let _intlayer_config_logger = require("@intlayer/config/logger");
7
4
  let _intlayer_config_node = require("@intlayer/config/node");
5
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
6
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
8
7
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
9
8
 
10
9
  //#region src/listContentDeclaration.ts
11
10
  const listContentDeclarationRows = async (options) => {
12
11
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
13
- await (0, _intlayer_chokidar_cli.prepareIntlayer)(config);
12
+ await (0, _intlayer_engine_cli.prepareIntlayer)(config);
14
13
  const unmergedDictionariesRecord = (0, _intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(config);
15
14
  return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
16
15
  key: dictionary.key ?? "",
@@ -30,7 +29,7 @@ const listContentDeclaration = async (options) => {
30
29
  maxSize: 60
31
30
  }),
32
31
  " - ",
33
- (0, _intlayer_chokidar_utils.formatPath)(row.path)
32
+ (0, _intlayer_engine_utils.formatPath)(row.path)
34
33
  ].join(""));
35
34
  appLogger(`Content declaration files:`);
36
35
  lines.forEach((line) => {
@@ -1 +1 @@
1
- {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { prepareIntlayer } from '@intlayer/chokidar/cli';\nimport { formatPath } from '@intlayer/chokidar/utils';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,cAAc;AAEvD,mDAAsB,OAAO;CAE7B,MAAM,gGAAqD,OAAO;AAUlE,QARa,OAAO,OAAO,2BAA2B,CACnD,MAAM,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,SAAS;EACrE,EACQ;;AAGb,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,QAAQ;AAEtD,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,KAAK,UAAU,KAAK,CAAC;AACjC;;CAIF,MAAM,kGAD0B,SAAS,cACJ,CAAC;CAEtC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,IAAI,IAAI;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,OAAO;GAC1C,SAAS;GACV,CAAC;EACF;2CACW,IAAI,KAAK;EACrB,CAAC,KAAK,GAAG,CACX;AAED,WAAU,6BAA6B;AAEvC,OAAM,SAAS,SAAS;AACtB,YAAU,MAAM,EACd,OAAO,QACR,CAAC;GACF;AAEF,WAAU,gFAAmD,KAAK,OAAO,GAAG"}
1
+ {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport {\n colon,\n colorizeKey,\n colorizeNumber,\n getAppLogger,\n} from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { prepareIntlayer } from '@intlayer/engine/cli';\nimport { formatPath } from '@intlayer/engine/utils';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\n\ntype ListContentDeclarationOptions = {\n configOptions?: GetConfigurationOptions;\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listContentDeclarationRows = async (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\n\n await prepareIntlayer(config);\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n const rows = Object.values(unmergedDictionariesRecord)\n .flat()\n .map((dictionary) => ({\n key: dictionary.key ?? '',\n path: options?.absolute\n ? (dictionary.filePath ?? 'Remote')\n : relative(config.system.baseDir, dictionary.filePath ?? 'Remote'),\n }));\n return rows;\n};\n\nexport const listContentDeclaration = async (\n options?: ListContentDeclarationOptions\n) => {\n const rows = await listContentDeclarationRows(options);\n\n if (options?.json) {\n console.log(JSON.stringify(rows));\n return;\n }\n\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n const lines = rows.map((row) =>\n [\n colon(` - ${colorizeKey(row.key)}`, {\n colSize: rows.map((row) => row.key.length),\n maxSize: 60,\n }),\n ' - ',\n formatPath(row.path),\n ].join('')\n );\n\n appLogger(`Content declaration files:`);\n\n lines.forEach((line) => {\n appLogger(line, {\n level: 'info',\n });\n });\n\n appLogger(`Total content declaration files: ${colorizeNumber(rows.length)}`);\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,6BAA6B,OACxC,YACG;CACH,MAAM,qDAA0B,SAAS,aAAa;CAEtD,gDAAsB,MAAM;CAE5B,MAAM,gGAAqD,MAAM;CAUjE,OARa,OAAO,OAAO,0BAA0B,CAAC,CACnD,KAAK,CAAC,CACN,KAAK,gBAAgB;EACpB,KAAK,WAAW,OAAO;EACvB,MAAM,SAAS,WACV,WAAW,YAAY,mCACf,OAAO,OAAO,SAAS,WAAW,YAAY,QAAQ;CACrE,EACQ;AACZ;AAEA,MAAa,yBAAyB,OACpC,YACG;CACH,MAAM,OAAO,MAAM,2BAA2B,OAAO;CAErD,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,KAAK,UAAU,IAAI,CAAC;EAChC;CACF;CAGA,MAAM,kGAD0B,SAAS,aACL,CAAC;CAErC,MAAM,QAAQ,KAAK,KAAK,QACtB;qCACQ,+CAAkB,IAAI,GAAG,KAAK;GAClC,SAAS,KAAK,KAAK,QAAQ,IAAI,IAAI,MAAM;GACzC,SAAS;EACX,CAAC;EACD;yCACW,IAAI,IAAI;CACrB,CAAC,CAAC,KAAK,EAAE,CACX;CAEA,UAAU,4BAA4B;CAEtC,MAAM,SAAS,SAAS;EACtB,UAAU,MAAM,EACd,OAAO,OACT,CAAC;CACH,CAAC;CAED,UAAU,gFAAmD,KAAK,MAAM,GAAG;AAC7E"}
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
2
  let node_path = require("node:path");
4
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
3
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
5
4
 
6
5
  //#region src/listProjects.ts
7
6
  const listProjectsCommand = async (options) => {
8
- const { searchDir, projectsPath } = await (0, _intlayer_chokidar_cli.listProjects)(options);
7
+ const { searchDir, projectsPath } = await (0, _intlayer_engine_cli.listProjects)(options);
9
8
  const projectsRelativePath = projectsPath.map((projectPath) => options?.absolute ? projectPath : (0, node_path.relative)(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
10
9
  if (options?.json) {
11
10
  console.dir(projectsRelativePath, {
@@ -1 +1 @@
1
- {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/chokidar/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,+CAAmB,QAAQ;CAE/D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,YAAY,CACnE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;AAEjE,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;GAAM,CAAC;AACpE;;AAGF,KAAI,aAAa,WAAW,GAAG;AAC7B,UAAQ,IAAI,8BAA8B;AAC1C;;AAGF,SAAQ,IAAI,SAAS,aAAa,OAAO,yBAAyB;AAClE,cAAa,SAAS,YAAY;AAChC,UAAQ,IAAI,OAAO,UAAU;GAC7B"}
1
+ {"version":3,"file":"listProjects.cjs","names":[],"sources":["../../src/listProjects.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { type ListProjectsOptions, listProjects } from '@intlayer/engine/cli';\n\nexport type ListProjectsCommandOptions = ListProjectsOptions & {\n json?: boolean;\n absolute?: boolean;\n};\n\nexport const listProjectsCommand = async (\n options?: ListProjectsCommandOptions\n) => {\n const { searchDir, projectsPath } = await listProjects(options);\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n options?.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n if (options?.json) {\n console.dir(projectsRelativePath, { depth: null, arrayLimit: null });\n return;\n }\n\n if (projectsPath.length === 0) {\n console.log('No Intlayer projects found.');\n return;\n }\n\n console.log(`Found ${projectsPath.length} Intlayer project(s):\\n`);\n projectsPath.forEach((project) => {\n console.log(` - ${project}`);\n });\n};\n"],"mappings":";;;;;AAQA,MAAa,sBAAsB,OACjC,YACG;CACH,MAAM,EAAE,WAAW,iBAAiB,6CAAmB,OAAO;CAE9D,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,SAAS,WAAW,sCAAuB,WAAW,WAAW,CACnE,CAAC,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,WAAY;CAEhE,IAAI,SAAS,MAAM;EACjB,QAAQ,IAAI,sBAAsB;GAAE,OAAO;GAAM,YAAY;EAAK,CAAC;EACnE;CACF;CAEA,IAAI,aAAa,WAAW,GAAG;EAC7B,QAAQ,IAAI,6BAA6B;EACzC;CACF;CAEA,QAAQ,IAAI,SAAS,aAAa,OAAO,wBAAwB;CACjE,aAAa,SAAS,YAAY;EAChC,QAAQ,IAAI,OAAO,SAAS;CAC9B,CAAC;AACH"}
@@ -1,12 +1,12 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_IntlayerEventListener = require('./IntlayerEventListener.cjs');
4
- let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
5
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
6
4
  let _intlayer_config_colors = require("@intlayer/config/colors");
7
5
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
8
6
  let _intlayer_config_logger = require("@intlayer/config/logger");
9
7
  let _intlayer_config_node = require("@intlayer/config/node");
8
+ let _intlayer_engine_build = require("@intlayer/engine/build");
9
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
10
10
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
11
11
  let node_http = require("node:http");
12
12
  let _intlayer_config_package_json = require("@intlayer/config/package.json");
@@ -17,7 +17,7 @@ let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
17
17
  //#region src/liveSync.ts
18
18
  const writeDictionary = async (dictionary, configuration) => {
19
19
  (0, _intlayer_config_logger.getAppLogger)(configuration)(`Writing dictionary ${dictionary.key}`);
20
- await (0, _intlayer_chokidar_build.buildDictionary)([dictionary], configuration);
20
+ await (0, _intlayer_engine_build.buildDictionary)([dictionary], configuration);
21
21
  };
22
22
  const liveSync = async (options) => {
23
23
  const configuration = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
@@ -26,7 +26,7 @@ const liveSync = async (options) => {
26
26
  let parallelProcess = null;
27
27
  let eventListener = null;
28
28
  if (options?.with) {
29
- parallelProcess = (0, _intlayer_chokidar_utils.runParallel)(options.with);
29
+ parallelProcess = (0, _intlayer_engine_utils.runParallel)(options.with);
30
30
  parallelProcess.result.catch(() => {});
31
31
  }
32
32
  if (configuration.editor.liveSync && configuration.editor.backendURL && configuration.editor.clientId && configuration.editor.clientSecret) {
@@ -1 +1 @@
1
- {"version":3,"file":"liveSync.cjs","names":["IntlayerEventListener","ANSIColors","packageJson"],"sources":["../../src/liveSync.ts"],"sourcesContent":["import { createServer } from 'node:http';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { buildDictionary } from '@intlayer/chokidar/build';\nimport { type ParallelHandle, runParallel } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { getLocalizedContent } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { IntlayerEventListener } from './IntlayerEventListener';\n\ntype LiveSyncOptions = {\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\nconst writeDictionary = async (\n dictionary: DictionaryAPI,\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n appLogger(`Writing dictionary ${dictionary.key}`);\n await buildDictionary([dictionary], configuration);\n};\n\nexport const liveSync = async (options?: LiveSyncOptions) => {\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const { liveSyncPort, liveSyncURL } = configuration.editor;\n\n let parallelProcess: ParallelHandle | null = null;\n let eventListener: IntlayerEventListener | null = null;\n let _isHotReloadConnected = false;\n let _connectionStatus = 'disconnected'; // 'connected', 'connecting', 'reconnecting', 'disconnected', 'error'\n\n // Start the parallel process if provided\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n // Initialize the event listener for hot reload if configured\n if (\n configuration.editor.liveSync &&\n configuration.editor.backendURL &&\n configuration.editor.clientId &&\n configuration.editor.clientSecret\n ) {\n eventListener = new IntlayerEventListener(configuration);\n _connectionStatus = 'connecting';\n\n // Set up connection callbacks\n eventListener.onConnectionOpen = () => {\n _connectionStatus = 'connected';\n _isHotReloadConnected = true;\n appLogger('Live sync connection established');\n };\n\n eventListener.onConnectionError = (error) => {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n const errorEvent = error as any;\n appLogger(\n `Live sync connection error: ${errorEvent.message ?? 'Unknown error'}`,\n {\n level: 'warn',\n }\n );\n\n // If this is a \"terminated: other side closed\" error, it's likely a server restart\n if (\n errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed')\n ) {\n appLogger(\n 'Server connection was terminated, automatic reconnection will be attempted...',\n {\n level: 'info',\n }\n );\n _connectionStatus = 'reconnecting';\n }\n };\n\n // Set up dictionary change callbacks\n eventListener.onDictionaryAdded = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryChange = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryDeleted = (dictionary) =>\n writeDictionary(dictionary, configuration);\n\n try {\n await eventListener.initialize();\n } catch (error) {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n appLogger('Failed to initialize IntlayerEventListener:', {\n level: 'error',\n });\n appLogger(\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n {\n level: 'error',\n }\n );\n }\n } else if (!configuration.editor.liveSync) {\n appLogger(\n `Hot reload is ${colorize('disabled', ANSIColors.RED)}. Please enable it in the configuration (editor.liveSync).`\n );\n } else if (\n !configuration.editor.clientId ||\n !configuration.editor.clientSecret\n ) {\n appLogger(\n 'Missing client credentials for hot reload. Please configure clientId and clientSecret'\n );\n }\n\n const server = createServer(async (req, res) => {\n // Handle CORS preflight requests\n if (req.method === 'OPTIONS') {\n res.writeHead(200, {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n\n res.end();\n return;\n }\n\n if (req.url?.startsWith('/dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const dictionaries = getDictionaries(configuration);\n\n const prefix = '/dictionaries/';\n if (req.url.startsWith(prefix)) {\n const [key, locale] = decodeURIComponent(req.url)\n .slice(prefix.length)\n .split('/');\n\n if (!key) {\n res.writeHead(404);\n res.end('Not Found');\n return;\n }\n\n const dictionary = dictionaries[key] ?? null;\n\n if (!dictionary) {\n res.writeHead(404);\n res.end('Not Found');\n return;\n }\n\n if (locale) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const sourceLocaleContent = getLocalizedContent(\n dictionary.content,\n locale,\n {\n dictionaryKey: key,\n keyPath: [],\n }\n );\n\n res.end(JSON.stringify(sourceLocaleContent));\n return;\n }\n\n res.end(JSON.stringify(dictionary));\n return;\n }\n\n res.end(JSON.stringify(dictionaries));\n return;\n }\n\n if (req.url?.startsWith('/unmerged_dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const prefix = '/unmerged_dictionaries/';\n if (req.url.startsWith(prefix)) {\n const key = decodeURIComponent(req.url.slice(prefix.length));\n const one = unmergedDictionaries[key] ?? null;\n\n res.end(JSON.stringify(one));\n return;\n }\n\n res.end(JSON.stringify(unmergedDictionaries));\n return;\n }\n\n if (req.url === '/configuration') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n res.end(JSON.stringify(configuration));\n return;\n }\n\n if (req.url === '/health') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n });\n res.end(JSON.stringify({ status: 'ok' }));\n return;\n }\n\n res.end('Not found');\n return;\n });\n\n const getLiveSyncParam = () => {\n if (!configuration.editor.liveSync) return '\\x1b[31m✗ Disabled\\x1b[0m';\n\n return '\\x1b[32m✓ Enabled\\x1b[0m';\n };\n server.listen(liveSyncPort, () => {\n console.log(`\n \\x1b[1;90mINTLAYER v${packageJson.version}\\x1b[0m\n \n Live server running at: \\x1b[90m${liveSyncURL}\\x1b[0m\n - Backend URL: \\x1b[90m${configuration.editor.backendURL ?? '-'}\\x1b[0m\n - Live sync: ${getLiveSyncParam()}\n - Parallel process: ${options?.with ? `\\x1b[90m${Array.isArray(options.with) ? options.with.join(' ') : options.with}\\x1b[0m` : '-'}\n - Access key: ${configuration.editor.clientId ?? '-'}\n `);\n });\n\n // Cleanup function to terminate child process and event listener when the main process exits\n const cleanup = () => {\n // Clean up event listener\n if (eventListener) {\n appLogger('Closing SSE connection...');\n eventListener.cleanup();\n }\n\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n server.close(() => {\n appLogger('Live sync server stopped');\n process.exit(0);\n });\n };\n\n // Handle process termination signals\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('exit', cleanup);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB,OACtB,YACA,kBACG;AAEH,2CAD+B,cACtB,CAAC,sBAAsB,WAAW,MAAM;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;AAGF,MAAI,IAAI,QAAQ,kBAAkB;AAChC,OAAI,UAAU,KAAK;IACjB,gBAAgB;IAChB,iBAAiB;IACjB,+BAA+B;IAC/B,gCAAgC;IAChC,gCAAgC;IACjC,CAAC;AACF,OAAI,IAAI,KAAK,UAAU,cAAc,CAAC;AACtC;;AAGF,MAAI,IAAI,QAAQ,WAAW;AACzB,OAAI,UAAU,KAAK,EACjB,gBAAgB,mCACjB,CAAC;AACF,OAAI,IAAI,KAAK,UAAU,EAAE,QAAQ,MAAM,CAAC,CAAC;AACzC;;AAGF,MAAI,IAAI,YAAY;GAEpB;CAEF,MAAM,yBAAyB;AAC7B,MAAI,CAAC,cAAc,OAAO,SAAU,QAAO;AAE3C,SAAO;;AAET,QAAO,OAAO,oBAAoB;AAChC,UAAQ,IAAI;4BACYC,sCAAY,QAAQ;;iDAEC,YAAY;iDACZ,cAAc,OAAO,cAAc,IAAI;yCAC/C,kBAAkB,CAAC;yCACnB,SAAS,OAAO,WAAW,MAAM,QAAQ,QAAQ,KAAK,GAAG,QAAQ,KAAK,KAAK,IAAI,GAAG,QAAQ,KAAK,WAAW,IAAI;yCAC9G,cAAc,OAAO,YAAY,IAAI;QACtE;GACJ;CAGF,MAAM,gBAAgB;AAEpB,MAAI,eAAe;AACjB,aAAU,4BAA4B;AACtC,iBAAc,SAAS;;AAGzB,MAAI,gBACF,iBAAgB,MAAM;AAGxB,SAAO,YAAY;AACjB,aAAU,2BAA2B;AACrC,WAAQ,KAAK,EAAE;IACf;;AAIJ,SAAQ,GAAG,UAAU,QAAQ;AAC7B,SAAQ,GAAG,WAAW,QAAQ;AAC9B,SAAQ,GAAG,QAAQ,QAAQ"}
1
+ {"version":3,"file":"liveSync.cjs","names":["IntlayerEventListener","ANSIColors","packageJson"],"sources":["../../src/liveSync.ts"],"sourcesContent":["import { createServer } from 'node:http';\n// @ts-ignore: @intlayer/backend is not built yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport packageJson from '@intlayer/config/package.json' with { type: 'json' };\nimport { getLocalizedContent } from '@intlayer/core/plugins';\nimport { getDictionaries } from '@intlayer/dictionaries-entry';\nimport { buildDictionary } from '@intlayer/engine/build';\nimport { type ParallelHandle, runParallel } from '@intlayer/engine/utils';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { IntlayerEventListener } from './IntlayerEventListener';\n\ntype LiveSyncOptions = {\n with?: string | string[];\n configOptions?: GetConfigurationOptions;\n};\n\nconst writeDictionary = async (\n dictionary: DictionaryAPI,\n configuration: IntlayerConfig\n) => {\n const appLogger = getAppLogger(configuration);\n appLogger(`Writing dictionary ${dictionary.key}`);\n await buildDictionary([dictionary], configuration);\n};\n\nexport const liveSync = async (options?: LiveSyncOptions) => {\n const configuration = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(configuration);\n\n const { liveSyncPort, liveSyncURL } = configuration.editor;\n\n let parallelProcess: ParallelHandle | null = null;\n let eventListener: IntlayerEventListener | null = null;\n let _isHotReloadConnected = false;\n let _connectionStatus = 'disconnected'; // 'connected', 'connecting', 'reconnecting', 'disconnected', 'error'\n\n // Start the parallel process if provided\n if (options?.with) {\n parallelProcess = runParallel(options.with);\n // Handle the promise to avoid unhandled rejection\n parallelProcess.result.catch(() => {\n // Parallel process failed or was terminated\n });\n }\n\n // Initialize the event listener for hot reload if configured\n if (\n configuration.editor.liveSync &&\n configuration.editor.backendURL &&\n configuration.editor.clientId &&\n configuration.editor.clientSecret\n ) {\n eventListener = new IntlayerEventListener(configuration);\n _connectionStatus = 'connecting';\n\n // Set up connection callbacks\n eventListener.onConnectionOpen = () => {\n _connectionStatus = 'connected';\n _isHotReloadConnected = true;\n appLogger('Live sync connection established');\n };\n\n eventListener.onConnectionError = (error) => {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n const errorEvent = error as any;\n appLogger(\n `Live sync connection error: ${errorEvent.message ?? 'Unknown error'}`,\n {\n level: 'warn',\n }\n );\n\n // If this is a \"terminated: other side closed\" error, it's likely a server restart\n if (\n errorEvent.message?.includes('terminated') ||\n errorEvent.message?.includes('closed')\n ) {\n appLogger(\n 'Server connection was terminated, automatic reconnection will be attempted...',\n {\n level: 'info',\n }\n );\n _connectionStatus = 'reconnecting';\n }\n };\n\n // Set up dictionary change callbacks\n eventListener.onDictionaryAdded = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryChange = (dictionary) =>\n writeDictionary(dictionary, configuration);\n eventListener.onDictionaryDeleted = (dictionary) =>\n writeDictionary(dictionary, configuration);\n\n try {\n await eventListener.initialize();\n } catch (error) {\n _connectionStatus = 'error';\n _isHotReloadConnected = false;\n appLogger('Failed to initialize IntlayerEventListener:', {\n level: 'error',\n });\n appLogger(\n `Error: ${error instanceof Error ? error.message : String(error)}`,\n {\n level: 'error',\n }\n );\n }\n } else if (!configuration.editor.liveSync) {\n appLogger(\n `Hot reload is ${colorize('disabled', ANSIColors.RED)}. Please enable it in the configuration (editor.liveSync).`\n );\n } else if (\n !configuration.editor.clientId ||\n !configuration.editor.clientSecret\n ) {\n appLogger(\n 'Missing client credentials for hot reload. Please configure clientId and clientSecret'\n );\n }\n\n const server = createServer(async (req, res) => {\n // Handle CORS preflight requests\n if (req.method === 'OPTIONS') {\n res.writeHead(200, {\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n\n res.end();\n return;\n }\n\n if (req.url?.startsWith('/dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const dictionaries = getDictionaries(configuration);\n\n const prefix = '/dictionaries/';\n if (req.url.startsWith(prefix)) {\n const [key, locale] = decodeURIComponent(req.url)\n .slice(prefix.length)\n .split('/');\n\n if (!key) {\n res.writeHead(404);\n res.end('Not Found');\n return;\n }\n\n const dictionary = dictionaries[key] ?? null;\n\n if (!dictionary) {\n res.writeHead(404);\n res.end('Not Found');\n return;\n }\n\n if (locale) {\n // @ts-ignore Type instantiation is excessively deep and possibly infinite\n const sourceLocaleContent = getLocalizedContent(\n dictionary.content,\n locale,\n {\n dictionaryKey: key,\n keyPath: [],\n }\n );\n\n res.end(JSON.stringify(sourceLocaleContent));\n return;\n }\n\n res.end(JSON.stringify(dictionary));\n return;\n }\n\n res.end(JSON.stringify(dictionaries));\n return;\n }\n\n if (req.url?.startsWith('/unmerged_dictionaries')) {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n const unmergedDictionaries = getUnmergedDictionaries(configuration);\n\n const prefix = '/unmerged_dictionaries/';\n if (req.url.startsWith(prefix)) {\n const key = decodeURIComponent(req.url.slice(prefix.length));\n const one = unmergedDictionaries[key] ?? null;\n\n res.end(JSON.stringify(one));\n return;\n }\n\n res.end(JSON.stringify(unmergedDictionaries));\n return;\n }\n\n if (req.url === '/configuration') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n 'Cache-Control': 'no-store',\n 'Access-Control-Allow-Origin': '*',\n 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, OPTIONS',\n 'Access-Control-Allow-Headers': 'Content-Type, Authorization',\n });\n res.end(JSON.stringify(configuration));\n return;\n }\n\n if (req.url === '/health') {\n res.writeHead(200, {\n 'Content-Type': 'application/json; charset=utf-8',\n });\n res.end(JSON.stringify({ status: 'ok' }));\n return;\n }\n\n res.end('Not found');\n return;\n });\n\n const getLiveSyncParam = () => {\n if (!configuration.editor.liveSync) return '\\x1b[31m✗ Disabled\\x1b[0m';\n\n return '\\x1b[32m✓ Enabled\\x1b[0m';\n };\n server.listen(liveSyncPort, () => {\n console.log(`\n \\x1b[1;90mINTLAYER v${packageJson.version}\\x1b[0m\n \n Live server running at: \\x1b[90m${liveSyncURL}\\x1b[0m\n - Backend URL: \\x1b[90m${configuration.editor.backendURL ?? '-'}\\x1b[0m\n - Live sync: ${getLiveSyncParam()}\n - Parallel process: ${options?.with ? `\\x1b[90m${Array.isArray(options.with) ? options.with.join(' ') : options.with}\\x1b[0m` : '-'}\n - Access key: ${configuration.editor.clientId ?? '-'}\n `);\n });\n\n // Cleanup function to terminate child process and event listener when the main process exits\n const cleanup = () => {\n // Clean up event listener\n if (eventListener) {\n appLogger('Closing SSE connection...');\n eventListener.cleanup();\n }\n\n if (parallelProcess) {\n parallelProcess.kill();\n }\n\n server.close(() => {\n appLogger('Live sync server stopped');\n process.exit(0);\n });\n };\n\n // Handle process termination signals\n process.on('SIGINT', cleanup);\n process.on('SIGTERM', cleanup);\n process.on('exit', cleanup);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB,OACtB,YACA,kBACG;CAEH,0CAD+B,aACvB,CAAC,CAAC,sBAAsB,WAAW,KAAK;CAChD,kDAAsB,CAAC,UAAU,GAAG,aAAa;AACnD;AAEA,MAAa,WAAW,OAAO,YAA8B;CAC3D,MAAM,4DAAiC,SAAS,aAAa;CAC7D,MAAM,sDAAyB,aAAa;CAE5C,MAAM,EAAE,cAAc,gBAAgB,cAAc;CAEpD,IAAI,kBAAyC;CAC7C,IAAI,gBAA8C;CAKlD,IAAI,SAAS,MAAM;EACjB,0DAA8B,QAAQ,IAAI;EAE1C,gBAAgB,OAAO,YAAY,CAEnC,CAAC;CACH;CAGA,IACE,cAAc,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ACjB,gBAAgB,kCAClB,CAAC;GACD,IAAI,IAAI,KAAK,UAAU,EAAE,QAAQ,KAAK,CAAC,CAAC;GACxC;EACF;EAEA,IAAI,IAAI,WAAW;CAErB,CAAC;CAED,MAAM,yBAAyB;EAC7B,IAAI,CAAC,cAAc,OAAO,UAAU,OAAO;EAE3C,OAAO;CACT;CACA,OAAO,OAAO,oBAAoB;EAChC,QAAQ,IAAI;4BACYC,sCAAY,QAAQ;;iDAEC,YAAY;iDACZ,cAAc,OAAO,cAAc,IAAI;yCAC/C,iBAAiB,EAAE;yCACnB,SAAS,OAAO,WAAW,MAAM,QAAQ,QAAQ,IAAI,IAAI,QAAQ,KAAK,KAAK,GAAG,IAAI,QAAQ,KAAK,WAAW,IAAI;yCAC9G,cAAc,OAAO,YAAY,IAAI;OACvE;CACL,CAAC;CAGD,MAAM,gBAAgB;EAEpB,IAAI,eAAe;GACjB,UAAU,2BAA2B;GACrC,cAAc,QAAQ;EACxB;EAEA,IAAI,iBACF,gBAAgB,KAAK;EAGvB,OAAO,YAAY;GACjB,UAAU,0BAA0B;GACpC,QAAQ,KAAK,CAAC;EAChB,CAAC;CACH;CAGA,QAAQ,GAAG,UAAU,OAAO;CAC5B,QAAQ,GAAG,WAAW,OAAO;CAC7B,QAAQ,GAAG,QAAQ,OAAO;AAC5B"}
package/dist/cjs/pull.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
3
  const require_utils_checkAccess = require('./utils/checkAccess.cjs');
4
- const require_push_pullLog = require('./push/pullLog.cjs');
5
4
  const require_utils_selectCmsEnvironment = require('./utils/selectCmsEnvironment.cjs');
5
+ const require_push_pullLog = require('./push/pullLog.cjs');
6
6
  let node_fs = require("node:fs");
7
7
  let node_path = require("node:path");
8
- let _intlayer_chokidar_build = require("@intlayer/chokidar/build");
9
- let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
10
- let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
11
8
  let _intlayer_config_colors = require("@intlayer/config/colors");
12
9
  _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
13
10
  let _intlayer_config_logger = require("@intlayer/config/logger");
14
11
  let _intlayer_config_node = require("@intlayer/config/node");
12
+ let _intlayer_engine_build = require("@intlayer/engine/build");
13
+ let _intlayer_engine_cli = require("@intlayer/engine/cli");
14
+ let _intlayer_engine_utils = require("@intlayer/engine/utils");
15
15
  let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
16
16
  let _intlayer_config_utils = require("@intlayer/config/utils");
17
17
 
@@ -24,7 +24,7 @@ const pull = async (options) => {
24
24
  const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
25
25
  const appLogger = (0, _intlayer_config_logger.getAppLogger)(config);
26
26
  try {
27
- (0, _intlayer_chokidar_cli.logConfigDetails)(options?.configOptions);
27
+ (0, _intlayer_engine_cli.logConfigDetails)(options?.configOptions);
28
28
  if (!await require_utils_checkAccess.checkCMSAuth(config)) return;
29
29
  const intlayerAPI = await require_utils_checkAccess.getAuthenticatedAPI(config);
30
30
  await require_utils_selectCmsEnvironment.selectCmsEnvironment(options?.configOptions?.env, intlayerAPI, config);
@@ -96,7 +96,7 @@ const pull = async (options) => {
96
96
  filePath: localAndRemoteDictionary.filePath,
97
97
  localId: localAndRemoteDictionary.localId
98
98
  };
99
- const { status } = await (0, _intlayer_chokidar_build.writeContentDeclaration)(sourceDictionary, config, options);
99
+ const { status } = await (0, _intlayer_engine_build.writeContentDeclaration)(sourceDictionary, config, options);
100
100
  statusObj.status = status;
101
101
  logger.update([{
102
102
  dictionaryKey: statusObj.dictionaryKey,
@@ -113,7 +113,7 @@ const pull = async (options) => {
113
113
  }]);
114
114
  }
115
115
  };
116
- await (0, _intlayer_chokidar_utils.parallelize)(dictionariesStatuses, processDictionary, 5);
116
+ await (0, _intlayer_engine_utils.parallelize)(dictionariesStatuses, processDictionary, 5);
117
117
  logger.finish();
118
118
  const iconFor = (status) => {
119
119
  switch (status) {
@@ -1 +1 @@
1
- {"version":3,"file":"pull.cjs","names":["checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","PullLogger","ANSIColors"],"sources":["../../src/pull.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n type DictionaryStatus,\n writeContentDeclaration,\n} from '@intlayer/chokidar/build';\nimport { logConfigDetails } from '@intlayer/chokidar/cli';\nimport { parallelize } from '@intlayer/chokidar/utils';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getProjectRequire } from '@intlayer/config/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PullLogger, type PullStatus } from './push/pullLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PullOptions = {\n dictionaries?: string[];\n newDictionariesPath?: string;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Fetch distant dictionaries and write them locally,\n * with progress indicators and concurrency control.\n */\nexport const pull = async (options?: PullOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n try {\n logConfigDetails(options?.configOptions);\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n // Get remote update timestamps map\n const getDictionariesUpdateTimestampResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesUpdateTimestampResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n let distantDictionariesUpdateTimeStamp: Record<string, any> =\n getDictionariesUpdateTimestampResult.data;\n\n // Optional filtering by requested dictionaries\n if (options?.dictionaries) {\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) =>\n options.dictionaries?.includes(key)\n )\n );\n }\n\n // Filter by location\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) => {\n const localDictionaries = unmergedDictionariesRecord[key];\n const location =\n localDictionaries?.[0]?.location ??\n config.dictionary?.location ??\n 'remote';\n\n return location === 'remote' || location === 'hybrid';\n })\n );\n\n // Load local cached remote dictionaries (if any)\n const remoteDictionariesPath = join(\n config.system.mainDir,\n 'remote_dictionaries.cjs'\n );\n const requireFunction = config.build?.require ?? getProjectRequire();\n const remoteDictionariesRecord: Record<string, any> = existsSync(\n remoteDictionariesPath\n )\n ? (requireFunction(remoteDictionariesPath) as any)\n : {};\n\n // Determine which keys need fetching by comparing updatedAt with local cache\n const entries = Object.entries(distantDictionariesUpdateTimeStamp);\n const keysToFetch = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n if (!remoteUpdatedAtValue) return true;\n\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n if (!local) return true;\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([key]) => key);\n\n const cachedKeys = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([key]) => key);\n\n // Check if dictionaries list is empty\n if (entries.length === 0) {\n appLogger('No dictionaries to fetch', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Fetching dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = [\n ...cachedKeys.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'imported' as DictionaryStatus,\n })),\n ...keysToFetch.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'pending' as const,\n })),\n ];\n\n // Initialize aggregated logger\n const logger = new PullLogger();\n logger.update(\n dictionariesStatuses.map<PullStatus>((s) => ({\n dictionaryKey: s.dictionaryKey,\n status: s.status,\n }))\n );\n\n const successfullyFetchedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n const isCached =\n statusObj.status === 'imported' || statusObj.status === 'up-to-date';\n\n if (!isCached) {\n statusObj.status = 'fetching';\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'fetching' },\n ]);\n }\n\n try {\n let sourceDictionary: Dictionary | undefined;\n\n if (isCached) {\n sourceDictionary = remoteDictionariesRecord[\n statusObj.dictionaryKey\n ] as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(statusObj.dictionaryKey);\n\n sourceDictionary = getDictionaryResult.data as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n throw new Error(\n `Dictionary ${statusObj.dictionaryKey} not found on remote`\n );\n }\n\n // Check if there is a local version of this dictionary that is hybrid\n const localDictionaries =\n unmergedDictionariesRecord[statusObj.dictionaryKey];\n const localAndRemoteDictionary = localDictionaries?.find(\n (d) => d.location === 'hybrid'\n );\n\n if (localAndRemoteDictionary) {\n // We want to preserve the local properties but use the remote content\n sourceDictionary = {\n ...sourceDictionary,\n location: 'hybrid',\n filePath: localAndRemoteDictionary.filePath,\n localId: localAndRemoteDictionary.localId,\n };\n }\n\n // Now, write the dictionary to local file\n const { status } = await writeContentDeclaration(\n sourceDictionary,\n config,\n options\n );\n\n statusObj.status = status;\n logger.update([{ dictionaryKey: statusObj.dictionaryKey, status }]);\n\n successfullyFetchedDictionaries.push(sourceDictionary);\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error fetching dictionary ${statusObj.dictionaryKey}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with concurrency limit\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Per-dictionary summary\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n case 'reimported in JSON':\n case 'new content file':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n return ANSIColors.GREEN;\n case 'reimported in JSON':\n case 'new content file':\n return ANSIColors.YELLOW;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionaryKey} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,qDAA0B,SAAS,cAAc;CACvD,MAAM,sDAAyB,OAAO;AAEtC,KAAI;AACF,+CAAiB,SAAS,cAAc;AAIxC,MAAI,CAAC,MAFoBA,uCAAa,OAAO,CAE5B;EAEjB,MAAM,cAAc,MAAMC,8CAAoB,OAAO;AAErD,QAAMC,wDACJ,SAAS,eAAe,KACxB,aACA,OACD;EAED,MAAM,gGAAqD,OAAO;EAGlE,MAAM,uCACJ,MAAM,YAAY,WAAW,gCAAgC;AAE/D,MAAI,CAAC,qCAAqC,KACxC,OAAM,IAAI,MAAM,gCAAgC;EAGlD,IAAI,qCACF,qCAAqC;AAGvC,MAAI,SAAS,aACX,sCAAqC,OAAO,YAC1C,OAAO,QAAQ,mCAAmC,CAAC,QAAQ,CAAC,SAC1D,QAAQ,cAAc,SAAS,IAAI,CACpC,CACF;AAIH,uCAAqC,OAAO,YAC1C,OAAO,QAAQ,mCAAmC,CAAC,QAAQ,CAAC,SAAS;GAEnE,MAAM,WADoB,2BAA2B,OAE/B,IAAI,YACxB,OAAO,YAAY,YACnB;AAEF,UAAO,aAAa,YAAY,aAAa;IAC7C,CACH;EAGD,MAAM,6CACJ,OAAO,OAAO,SACd,0BACD;EACD,MAAM,kBAAkB,OAAO,OAAO,0DAA8B;EACpE,MAAM,mDACJ,uBACD,GACI,gBAAgB,uBAAuB,GACxC,EAAE;EAGN,MAAM,UAAU,OAAO,QAAQ,mCAAmC;EA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AAW;;;AAIxB,OAAK,MAAM,KAAK,sBAAsB;GACpC,MAAM,OAAO,QAAQ,EAAE,OAAO;GAC9B,MAAM,QAAQ,SAAS,EAAE,OAAO;AAChC,aACE,MAAM,EAAE,cAAc,GAAGA,wBAAW,KAAK,GAAG,QAAQ,KAAK,GAAG,EAAE,SAASA,wBAAW,KAAK,GAAGA,wBAAW,QACtG;;AAIH,OAAK,MAAM,aAAa,qBACtB,KAAI,UAAU,aACZ,WAAU,UAAU,cAAc,EAChC,OAAO,SACR,CAAC;UAGC,OAAO;AACd,YAAU,OAAO,EACf,OAAO,SACR,CAAC"}
1
+ {"version":3,"file":"pull.cjs","names":["checkCMSAuth","getAuthenticatedAPI","selectCmsEnvironment","PullLogger","ANSIColors"],"sources":["../../src/pull.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport {\n type GetConfigurationOptions,\n getConfiguration,\n} from '@intlayer/config/node';\nimport { getProjectRequire } from '@intlayer/config/utils';\nimport {\n type DictionaryStatus,\n writeContentDeclaration,\n} from '@intlayer/engine/build';\nimport { logConfigDetails } from '@intlayer/engine/cli';\nimport { parallelize } from '@intlayer/engine/utils';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { getUnmergedDictionaries } from '@intlayer/unmerged-dictionaries-entry';\nimport { PullLogger, type PullStatus } from './push/pullLog';\nimport { checkCMSAuth, getAuthenticatedAPI } from './utils/checkAccess';\nimport { selectCmsEnvironment } from './utils/selectCmsEnvironment';\n\ntype PullOptions = {\n dictionaries?: string[];\n newDictionariesPath?: string;\n configOptions?: GetConfigurationOptions;\n};\n\ntype DictionariesStatus = {\n dictionaryKey: string;\n status: DictionaryStatus | 'pending' | 'fetching' | 'error';\n error?: Error;\n errorMessage?: string;\n};\n\n/**\n * Fetch distant dictionaries and write them locally,\n * with progress indicators and concurrency control.\n */\nexport const pull = async (options?: PullOptions): Promise<void> => {\n const config = getConfiguration(options?.configOptions);\n const appLogger = getAppLogger(config);\n\n try {\n logConfigDetails(options?.configOptions);\n\n const hasCMSAuth = await checkCMSAuth(config);\n\n if (!hasCMSAuth) return;\n\n const intlayerAPI = await getAuthenticatedAPI(config);\n\n await selectCmsEnvironment(\n options?.configOptions?.env,\n intlayerAPI,\n config\n );\n\n const unmergedDictionariesRecord = getUnmergedDictionaries(config);\n\n // Get remote update timestamps map\n const getDictionariesUpdateTimestampResult =\n await intlayerAPI.dictionary.getDictionariesUpdateTimestamp();\n\n if (!getDictionariesUpdateTimestampResult.data) {\n throw new Error('No distant dictionaries found');\n }\n\n let distantDictionariesUpdateTimeStamp: Record<string, any> =\n getDictionariesUpdateTimestampResult.data;\n\n // Optional filtering by requested dictionaries\n if (options?.dictionaries) {\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) =>\n options.dictionaries?.includes(key)\n )\n );\n }\n\n // Filter by location\n distantDictionariesUpdateTimeStamp = Object.fromEntries(\n Object.entries(distantDictionariesUpdateTimeStamp).filter(([key]) => {\n const localDictionaries = unmergedDictionariesRecord[key];\n const location =\n localDictionaries?.[0]?.location ??\n config.dictionary?.location ??\n 'remote';\n\n return location === 'remote' || location === 'hybrid';\n })\n );\n\n // Load local cached remote dictionaries (if any)\n const remoteDictionariesPath = join(\n config.system.mainDir,\n 'remote_dictionaries.cjs'\n );\n const requireFunction = config.build?.require ?? getProjectRequire();\n const remoteDictionariesRecord: Record<string, any> = existsSync(\n remoteDictionariesPath\n )\n ? (requireFunction(remoteDictionariesPath) as any)\n : {};\n\n // Determine which keys need fetching by comparing updatedAt with local cache\n const entries = Object.entries(distantDictionariesUpdateTimeStamp);\n const keysToFetch = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n if (!remoteUpdatedAtValue) return true;\n\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n if (!local) return true;\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n if (typeof localUpdatedAt !== 'number') return true;\n return remoteUpdatedAt > localUpdatedAt;\n })\n .map(([key]) => key);\n\n const cachedKeys = entries\n .filter(([key, remoteUpdatedAtValue]) => {\n const remoteUpdatedAt =\n typeof remoteUpdatedAtValue === 'object'\n ? (remoteUpdatedAtValue as any).updatedAt\n : remoteUpdatedAtValue;\n\n const local = (remoteDictionariesRecord as any)[key];\n const localUpdatedAtRaw = (local as any)?.updatedAt as\n | number\n | string\n | undefined;\n const localUpdatedAt =\n typeof localUpdatedAtRaw === 'number'\n ? localUpdatedAtRaw\n : localUpdatedAtRaw\n ? new Date(localUpdatedAtRaw).getTime()\n : undefined;\n return (\n typeof localUpdatedAt === 'number' &&\n typeof remoteUpdatedAt === 'number' &&\n localUpdatedAt >= remoteUpdatedAt\n );\n })\n .map(([key]) => key);\n\n // Check if dictionaries list is empty\n if (entries.length === 0) {\n appLogger('No dictionaries to fetch', {\n level: 'error',\n });\n return;\n }\n\n appLogger('Fetching dictionaries:');\n\n // Prepare dictionaries statuses\n const dictionariesStatuses: DictionariesStatus[] = [\n ...cachedKeys.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'imported' as DictionaryStatus,\n })),\n ...keysToFetch.map((dictionaryKey) => ({\n dictionaryKey,\n status: 'pending' as const,\n })),\n ];\n\n // Initialize aggregated logger\n const logger = new PullLogger();\n logger.update(\n dictionariesStatuses.map<PullStatus>((s) => ({\n dictionaryKey: s.dictionaryKey,\n status: s.status,\n }))\n );\n\n const successfullyFetchedDictionaries: Dictionary[] = [];\n\n const processDictionary = async (\n statusObj: DictionariesStatus\n ): Promise<void> => {\n const isCached =\n statusObj.status === 'imported' || statusObj.status === 'up-to-date';\n\n if (!isCached) {\n statusObj.status = 'fetching';\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'fetching' },\n ]);\n }\n\n try {\n let sourceDictionary: Dictionary | undefined;\n\n if (isCached) {\n sourceDictionary = remoteDictionariesRecord[\n statusObj.dictionaryKey\n ] as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(statusObj.dictionaryKey);\n\n sourceDictionary = getDictionaryResult.data as Dictionary | undefined;\n }\n\n if (!sourceDictionary) {\n throw new Error(\n `Dictionary ${statusObj.dictionaryKey} not found on remote`\n );\n }\n\n // Check if there is a local version of this dictionary that is hybrid\n const localDictionaries =\n unmergedDictionariesRecord[statusObj.dictionaryKey];\n const localAndRemoteDictionary = localDictionaries?.find(\n (d) => d.location === 'hybrid'\n );\n\n if (localAndRemoteDictionary) {\n // We want to preserve the local properties but use the remote content\n sourceDictionary = {\n ...sourceDictionary,\n location: 'hybrid',\n filePath: localAndRemoteDictionary.filePath,\n localId: localAndRemoteDictionary.localId,\n };\n }\n\n // Now, write the dictionary to local file\n const { status } = await writeContentDeclaration(\n sourceDictionary,\n config,\n options\n );\n\n statusObj.status = status;\n logger.update([{ dictionaryKey: statusObj.dictionaryKey, status }]);\n\n successfullyFetchedDictionaries.push(sourceDictionary);\n } catch (error) {\n statusObj.status = 'error';\n statusObj.error = error as Error;\n statusObj.errorMessage = `Error fetching dictionary ${statusObj.dictionaryKey}: ${error}`;\n logger.update([\n { dictionaryKey: statusObj.dictionaryKey, status: 'error' },\n ]);\n }\n };\n\n // Process dictionaries in parallel with concurrency limit\n await parallelize(dictionariesStatuses, processDictionary, 5);\n\n // Stop the logger and render final state\n logger.finish();\n\n // Per-dictionary summary\n const iconFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n case 'reimported in JSON':\n case 'new content file':\n return '✔';\n case 'error':\n return '✖';\n default:\n return '⏲';\n }\n };\n\n const colorFor = (status: DictionariesStatus['status']) => {\n switch (status) {\n case 'fetched':\n case 'imported':\n case 'updated':\n case 'up-to-date':\n return ANSIColors.GREEN;\n case 'reimported in JSON':\n case 'new content file':\n return ANSIColors.YELLOW;\n case 'error':\n return ANSIColors.RED;\n default:\n return ANSIColors.BLUE;\n }\n };\n\n for (const s of dictionariesStatuses) {\n const icon = iconFor(s.status);\n const color = colorFor(s.status);\n appLogger(\n ` - ${s.dictionaryKey} ${ANSIColors.GREY}[${color}${icon} ${s.status}${ANSIColors.GREY}]${ANSIColors.RESET}`\n );\n }\n\n // Output any error messages\n for (const statusObj of dictionariesStatuses) {\n if (statusObj.errorMessage) {\n appLogger(statusObj.errorMessage, {\n level: 'error',\n });\n }\n }\n } catch (error) {\n appLogger(error, {\n level: 'error',\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAa,OAAO,OAAO,YAAyC;CAClE,MAAM,qDAA0B,SAAS,aAAa;CACtD,MAAM,sDAAyB,MAAM;CAErC,IAAI;EACF,2CAAiB,SAAS,aAAa;EAIvC,IAAI,CAAC,MAFoBA,uCAAa,MAAM,GAE3B;EAEjB,MAAM,cAAc,MAAMC,8CAAoB,MAAM;EAEpD,MAAMC,wDACJ,SAAS,eAAe,KACxB,aACA,MACF;EAEA,MAAM,gGAAqD,MAAM;EAGjE,MAAM,uCACJ,MAAM,YAAY,WAAW,+BAA+B;EAE9D,IAAI,CAAC,qCAAqC,MACxC,MAAM,IAAI,MAAM,+BAA+B;EAGjD,IAAI,qCACF,qCAAqC;EAGvC,IAAI,SAAS,cACX,qCAAqC,OAAO,YAC1C,OAAO,QAAQ,kCAAkC,CAAC,CAAC,QAAQ,CAAC,SAC1D,QAAQ,cAAc,SAAS,GAAG,CACpC,CACF;EAIF,qCAAqC,OAAO,YAC1C,OAAO,QAAQ,kCAAkC,CAAC,CAAC,QAAQ,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mBAAmB,CAAC;EAG5D,OAAO,OAAO;EAGd,MAAM,WAAW,WAAyC;GACxD,QAAQ,QAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,oBACH,OAAO;IACT,KAAK,SACH,OAAO;IACT,SACE,OAAO;GACX;EACF;EAEA,MAAM,YAAY,WAAyC;GACzD,QAAQ,QAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK,cACH,OAAOC,wBAAW;IACpB,KAAK;IACL,KAAK,oBACH,OAAOA,wBAAW;IACpB,KAAK,SACH,OAAOA,wBAAW;IACpB,SACE,OAAOA,wBAAW;GACtB;EACF;EAEA,KAAK,MAAM,KAAK,sBAAsB;GACpC,MAAM,OAAO,QAAQ,EAAE,MAAM;GAC7B,MAAM,QAAQ,SAAS,EAAE,MAAM;GAC/B,UACE,MAAM,EAAE,cAAc,GAAGA,wBAAW,KAAK,GAAG,QAAQ,KAAK,GAAG,EAAE,SAASA,wBAAW,KAAK,GAAGA,wBAAW,OACvG;EACF;EAGA,KAAK,MAAM,aAAa,sBACtB,IAAI,UAAU,cACZ,UAAU,UAAU,cAAc,EAChC,OAAO,QACT,CAAC;CAGP,SAAS,OAAO;EACd,UAAU,OAAO,EACf,OAAO,QACT,CAAC;CACH;AACF"}
@@ -73,7 +73,7 @@ var PullLogger = class {
73
73
  }
74
74
  computeProgress() {
75
75
  const keys = new Set(this.statuses.map((s) => s.dictionaryKey));
76
- const doneSet = new Set([
76
+ const doneSet = /* @__PURE__ */ new Set([
77
77
  "fetched",
78
78
  "imported",
79
79
  "updated",
@@ -82,7 +82,7 @@ var PullLogger = class {
82
82
  "new content file",
83
83
  "error"
84
84
  ]);
85
- const successesSet = new Set([
85
+ const successesSet = /* @__PURE__ */ new Set([
86
86
  "fetched",
87
87
  "imported",
88
88
  "updated",