@intlayer/cli 8.4.4 → 8.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (305) hide show
  1. package/dist/cjs/IntlayerEventListener.cjs +186 -1
  2. package/dist/cjs/IntlayerEventListener.cjs.map +1 -1
  3. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  4. package/dist/cjs/_virtual/_utils_asset.cjs +98 -0
  5. package/dist/cjs/auth/login.cjs +90 -2
  6. package/dist/cjs/auth/login.cjs.map +1 -1
  7. package/dist/cjs/build.cjs +30 -1
  8. package/dist/cjs/build.cjs.map +1 -1
  9. package/dist/cjs/ci.cjs +76 -1
  10. package/dist/cjs/ci.cjs.map +1 -1
  11. package/dist/cjs/cli.cjs +485 -1
  12. package/dist/cjs/cli.cjs.map +1 -1
  13. package/dist/cjs/config.cjs +15 -1
  14. package/dist/cjs/config.cjs.map +1 -1
  15. package/dist/cjs/editor.cjs +50 -1
  16. package/dist/cjs/editor.cjs.map +1 -1
  17. package/dist/cjs/extract.cjs +108 -1
  18. package/dist/cjs/extract.cjs.map +1 -1
  19. package/dist/cjs/fill/deepMergeContent.cjs +27 -1
  20. package/dist/cjs/fill/deepMergeContent.cjs.map +1 -1
  21. package/dist/cjs/fill/fill.cjs +89 -1
  22. package/dist/cjs/fill/fill.cjs.map +1 -1
  23. package/dist/cjs/fill/formatAutoFilledFilePath.cjs +32 -1
  24. package/dist/cjs/fill/formatAutoFilledFilePath.cjs.map +1 -1
  25. package/dist/cjs/fill/formatFillData.cjs +91 -1
  26. package/dist/cjs/fill/formatFillData.cjs.map +1 -1
  27. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs +26 -1
  28. package/dist/cjs/fill/getAvailableLocalesInDictionary.cjs.map +1 -1
  29. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs +51 -1
  30. package/dist/cjs/fill/getFilterMissingContentPerLocale.cjs.map +1 -1
  31. package/dist/cjs/fill/index.cjs +6 -1
  32. package/dist/cjs/fill/listTranslationsTasks.cjs +72 -1
  33. package/dist/cjs/fill/listTranslationsTasks.cjs.map +1 -1
  34. package/dist/cjs/fill/translateDictionary.cjs +241 -1
  35. package/dist/cjs/fill/translateDictionary.cjs.map +1 -1
  36. package/dist/cjs/fill/writeFill.cjs +53 -1
  37. package/dist/cjs/fill/writeFill.cjs.map +1 -1
  38. package/dist/cjs/getTargetDictionary.cjs +36 -1
  39. package/dist/cjs/getTargetDictionary.cjs.map +1 -1
  40. package/dist/cjs/index.cjs +44 -1
  41. package/dist/cjs/init.cjs +22 -1
  42. package/dist/cjs/init.cjs.map +1 -1
  43. package/dist/cjs/initMCP.cjs +69 -1
  44. package/dist/cjs/initMCP.cjs.map +1 -1
  45. package/dist/cjs/initSkills.cjs +93 -1
  46. package/dist/cjs/initSkills.cjs.map +1 -1
  47. package/dist/cjs/listContentDeclaration.cjs +42 -1
  48. package/dist/cjs/listContentDeclaration.cjs.map +1 -1
  49. package/dist/cjs/listProjects.cjs +28 -1
  50. package/dist/cjs/listProjects.cjs.map +1 -1
  51. package/dist/cjs/liveSync.cjs +153 -8
  52. package/dist/cjs/liveSync.cjs.map +1 -1
  53. package/dist/cjs/pull.cjs +153 -1
  54. package/dist/cjs/pull.cjs.map +1 -1
  55. package/dist/cjs/push/pullLog.cjs +105 -3
  56. package/dist/cjs/push/pullLog.cjs.map +1 -1
  57. package/dist/cjs/push/push.cjs +212 -1
  58. package/dist/cjs/push/push.cjs.map +1 -1
  59. package/dist/cjs/pushConfig.cjs +22 -1
  60. package/dist/cjs/pushConfig.cjs.map +1 -1
  61. package/dist/cjs/pushLog.cjs +86 -3
  62. package/dist/cjs/pushLog.cjs.map +1 -1
  63. package/dist/cjs/reviewDoc/reviewDoc.cjs +73 -1
  64. package/dist/cjs/reviewDoc/reviewDoc.cjs.map +1 -1
  65. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs +98 -1
  66. package/dist/cjs/reviewDoc/reviewDocBlockAware.cjs.map +1 -1
  67. package/dist/cjs/searchDoc.cjs +41 -1
  68. package/dist/cjs/searchDoc.cjs.map +1 -1
  69. package/dist/cjs/test/index.cjs +7 -1
  70. package/dist/cjs/test/listMissingTranslations.cjs +66 -1
  71. package/dist/cjs/test/listMissingTranslations.cjs.map +1 -1
  72. package/dist/cjs/test/test.cjs +56 -1
  73. package/dist/cjs/test/test.cjs.map +1 -1
  74. package/dist/cjs/translateDoc/index.cjs +9 -1
  75. package/dist/cjs/translateDoc/translateDoc.cjs +79 -1
  76. package/dist/cjs/translateDoc/translateDoc.cjs.map +1 -1
  77. package/dist/cjs/translateDoc/translateFile.cjs +106 -2
  78. package/dist/cjs/translateDoc/translateFile.cjs.map +1 -1
  79. package/dist/cjs/translateDoc/validation.cjs +49 -5
  80. package/dist/cjs/translateDoc/validation.cjs.map +1 -1
  81. package/dist/cjs/translation-alignment/alignBlocks.cjs +67 -1
  82. package/dist/cjs/translation-alignment/alignBlocks.cjs.map +1 -1
  83. package/dist/cjs/translation-alignment/computeSimilarity.cjs +25 -1
  84. package/dist/cjs/translation-alignment/computeSimilarity.cjs.map +1 -1
  85. package/dist/cjs/translation-alignment/fingerprintBlock.cjs +23 -1
  86. package/dist/cjs/translation-alignment/fingerprintBlock.cjs.map +1 -1
  87. package/dist/cjs/translation-alignment/index.cjs +22 -1
  88. package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs +18 -1
  89. package/dist/cjs/translation-alignment/mapChangedLinesToBlocks.cjs.map +1 -1
  90. package/dist/cjs/translation-alignment/normalizeBlock.cjs +22 -1
  91. package/dist/cjs/translation-alignment/normalizeBlock.cjs.map +1 -1
  92. package/dist/cjs/translation-alignment/pipeline.cjs +37 -1
  93. package/dist/cjs/translation-alignment/pipeline.cjs.map +1 -1
  94. package/dist/cjs/translation-alignment/planActions.cjs +46 -1
  95. package/dist/cjs/translation-alignment/planActions.cjs.map +1 -1
  96. package/dist/cjs/translation-alignment/rebuildDocument.cjs +49 -2
  97. package/dist/cjs/translation-alignment/rebuildDocument.cjs.map +1 -1
  98. package/dist/cjs/translation-alignment/segmentDocument.cjs +66 -5
  99. package/dist/cjs/translation-alignment/segmentDocument.cjs.map +1 -1
  100. package/dist/cjs/utils/calculateChunks.cjs +89 -2
  101. package/dist/cjs/utils/calculateChunks.cjs.map +1 -1
  102. package/dist/cjs/utils/checkAccess.cjs +83 -1
  103. package/dist/cjs/utils/checkAccess.cjs.map +1 -1
  104. package/dist/cjs/utils/checkConfigConsistency.cjs +16 -1
  105. package/dist/cjs/utils/checkConfigConsistency.cjs.map +1 -1
  106. package/dist/cjs/utils/checkFileModifiedRange.cjs +81 -1
  107. package/dist/cjs/utils/checkFileModifiedRange.cjs.map +1 -1
  108. package/dist/cjs/utils/checkLastUpdateTime.cjs +19 -1
  109. package/dist/cjs/utils/checkLastUpdateTime.cjs.map +1 -1
  110. package/dist/cjs/utils/chunkInference.cjs +45 -1
  111. package/dist/cjs/utils/chunkInference.cjs.map +1 -1
  112. package/dist/cjs/utils/fixChunkStartEndChars.cjs +27 -3
  113. package/dist/cjs/utils/fixChunkStartEndChars.cjs.map +1 -1
  114. package/dist/cjs/utils/formatTimeDiff.cjs +20 -1
  115. package/dist/cjs/utils/formatTimeDiff.cjs.map +1 -1
  116. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs +16 -1
  117. package/dist/cjs/utils/getIsFileUpdatedRecently.cjs.map +1 -1
  118. package/dist/cjs/utils/getOutputFilePath.cjs +108 -1
  119. package/dist/cjs/utils/getOutputFilePath.cjs.map +1 -1
  120. package/dist/cjs/utils/getParentPackageJSON.cjs +20 -1
  121. package/dist/cjs/utils/getParentPackageJSON.cjs.map +1 -1
  122. package/dist/cjs/utils/listSpecialChars.cjs +54 -2
  123. package/dist/cjs/utils/listSpecialChars.cjs.map +1 -1
  124. package/dist/cjs/utils/mapChunksBetweenFiles.cjs +102 -1
  125. package/dist/cjs/utils/mapChunksBetweenFiles.cjs.map +1 -1
  126. package/dist/cjs/utils/openBrowser.cjs +19 -1
  127. package/dist/cjs/utils/openBrowser.cjs.map +1 -1
  128. package/dist/cjs/utils/reorderParagraphs.cjs +91 -3
  129. package/dist/cjs/utils/reorderParagraphs.cjs.map +1 -1
  130. package/dist/cjs/utils/setupAI.cjs +66 -1
  131. package/dist/cjs/utils/setupAI.cjs.map +1 -1
  132. package/dist/cjs/watch.cjs +47 -1
  133. package/dist/cjs/watch.cjs.map +1 -1
  134. package/dist/esm/IntlayerEventListener.mjs +183 -1
  135. package/dist/esm/IntlayerEventListener.mjs.map +1 -1
  136. package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
  137. package/dist/esm/_virtual/_utils_asset.mjs +97 -0
  138. package/dist/esm/auth/login.mjs +86 -2
  139. package/dist/esm/auth/login.mjs.map +1 -1
  140. package/dist/esm/build.mjs +28 -1
  141. package/dist/esm/build.mjs.map +1 -1
  142. package/dist/esm/ci.mjs +74 -1
  143. package/dist/esm/ci.mjs.map +1 -1
  144. package/dist/esm/cli.mjs +482 -1
  145. package/dist/esm/cli.mjs.map +1 -1
  146. package/dist/esm/config.mjs +13 -1
  147. package/dist/esm/config.mjs.map +1 -1
  148. package/dist/esm/editor.mjs +50 -1
  149. package/dist/esm/editor.mjs.map +1 -0
  150. package/dist/esm/extract.mjs +104 -1
  151. package/dist/esm/extract.mjs.map +1 -1
  152. package/dist/esm/fill/deepMergeContent.mjs +25 -1
  153. package/dist/esm/fill/deepMergeContent.mjs.map +1 -1
  154. package/dist/esm/fill/fill.mjs +86 -1
  155. package/dist/esm/fill/fill.mjs.map +1 -1
  156. package/dist/esm/fill/formatAutoFilledFilePath.mjs +30 -1
  157. package/dist/esm/fill/formatAutoFilledFilePath.mjs.map +1 -1
  158. package/dist/esm/fill/formatFillData.mjs +89 -1
  159. package/dist/esm/fill/formatFillData.mjs.map +1 -1
  160. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs +24 -1
  161. package/dist/esm/fill/getAvailableLocalesInDictionary.mjs.map +1 -1
  162. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs +49 -1
  163. package/dist/esm/fill/getFilterMissingContentPerLocale.mjs.map +1 -1
  164. package/dist/esm/fill/index.mjs +4 -1
  165. package/dist/esm/fill/listTranslationsTasks.mjs +69 -1
  166. package/dist/esm/fill/listTranslationsTasks.mjs.map +1 -1
  167. package/dist/esm/fill/translateDictionary.mjs +238 -1
  168. package/dist/esm/fill/translateDictionary.mjs.map +1 -1
  169. package/dist/esm/fill/writeFill.mjs +51 -1
  170. package/dist/esm/fill/writeFill.mjs.map +1 -1
  171. package/dist/esm/getTargetDictionary.mjs +33 -1
  172. package/dist/esm/getTargetDictionary.mjs.map +1 -1
  173. package/dist/esm/index.mjs +20 -1
  174. package/dist/esm/init.mjs +19 -1
  175. package/dist/esm/init.mjs.map +1 -1
  176. package/dist/esm/initMCP.mjs +65 -1
  177. package/dist/esm/initMCP.mjs.map +1 -1
  178. package/dist/esm/initSkills.mjs +87 -1
  179. package/dist/esm/initSkills.mjs.map +1 -1
  180. package/dist/esm/listContentDeclaration.mjs +39 -1
  181. package/dist/esm/listContentDeclaration.mjs.map +1 -1
  182. package/dist/esm/listProjects.mjs +26 -1
  183. package/dist/esm/listProjects.mjs.map +1 -1
  184. package/dist/esm/liveSync.mjs +150 -8
  185. package/dist/esm/liveSync.mjs.map +1 -1
  186. package/dist/esm/pull.mjs +150 -1
  187. package/dist/esm/pull.mjs.map +1 -1
  188. package/dist/esm/push/pullLog.mjs +102 -3
  189. package/dist/esm/push/pullLog.mjs.map +1 -1
  190. package/dist/esm/push/push.mjs +208 -1
  191. package/dist/esm/push/push.mjs.map +1 -1
  192. package/dist/esm/pushConfig.mjs +20 -1
  193. package/dist/esm/pushConfig.mjs.map +1 -1
  194. package/dist/esm/pushLog.mjs +83 -3
  195. package/dist/esm/pushLog.mjs.map +1 -1
  196. package/dist/esm/reviewDoc/reviewDoc.mjs +69 -1
  197. package/dist/esm/reviewDoc/reviewDoc.mjs.map +1 -1
  198. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs +95 -1
  199. package/dist/esm/reviewDoc/reviewDocBlockAware.mjs.map +1 -1
  200. package/dist/esm/searchDoc.mjs +39 -1
  201. package/dist/esm/searchDoc.mjs.map +1 -1
  202. package/dist/esm/test/index.mjs +4 -1
  203. package/dist/esm/test/listMissingTranslations.mjs +63 -1
  204. package/dist/esm/test/listMissingTranslations.mjs.map +1 -1
  205. package/dist/esm/test/test.mjs +53 -1
  206. package/dist/esm/test/test.mjs.map +1 -1
  207. package/dist/esm/translateDoc/index.mjs +5 -1
  208. package/dist/esm/translateDoc/translateDoc.mjs +75 -1
  209. package/dist/esm/translateDoc/translateDoc.mjs.map +1 -1
  210. package/dist/esm/translateDoc/translateFile.mjs +103 -2
  211. package/dist/esm/translateDoc/translateFile.mjs.map +1 -1
  212. package/dist/esm/translateDoc/validation.mjs +46 -5
  213. package/dist/esm/translateDoc/validation.mjs.map +1 -1
  214. package/dist/esm/translation-alignment/alignBlocks.mjs +66 -1
  215. package/dist/esm/translation-alignment/alignBlocks.mjs.map +1 -1
  216. package/dist/esm/translation-alignment/computeSimilarity.mjs +22 -1
  217. package/dist/esm/translation-alignment/computeSimilarity.mjs.map +1 -1
  218. package/dist/esm/translation-alignment/fingerprintBlock.mjs +20 -1
  219. package/dist/esm/translation-alignment/fingerprintBlock.mjs.map +1 -1
  220. package/dist/esm/translation-alignment/index.mjs +11 -1
  221. package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs +16 -1
  222. package/dist/esm/translation-alignment/mapChangedLinesToBlocks.mjs.map +1 -1
  223. package/dist/esm/translation-alignment/normalizeBlock.mjs +20 -1
  224. package/dist/esm/translation-alignment/normalizeBlock.mjs.map +1 -1
  225. package/dist/esm/translation-alignment/pipeline.mjs +35 -1
  226. package/dist/esm/translation-alignment/pipeline.mjs.map +1 -1
  227. package/dist/esm/translation-alignment/planActions.mjs +44 -1
  228. package/dist/esm/translation-alignment/planActions.mjs.map +1 -1
  229. package/dist/esm/translation-alignment/rebuildDocument.mjs +46 -2
  230. package/dist/esm/translation-alignment/rebuildDocument.mjs.map +1 -1
  231. package/dist/esm/translation-alignment/segmentDocument.mjs +64 -5
  232. package/dist/esm/translation-alignment/segmentDocument.mjs.map +1 -1
  233. package/dist/esm/utils/calculateChunks.mjs +87 -2
  234. package/dist/esm/utils/calculateChunks.mjs.map +1 -1
  235. package/dist/esm/utils/checkAccess.mjs +79 -1
  236. package/dist/esm/utils/checkAccess.mjs.map +1 -1
  237. package/dist/esm/utils/checkConfigConsistency.mjs +14 -1
  238. package/dist/esm/utils/checkConfigConsistency.mjs.map +1 -1
  239. package/dist/esm/utils/checkFileModifiedRange.mjs +80 -1
  240. package/dist/esm/utils/checkFileModifiedRange.mjs.map +1 -1
  241. package/dist/esm/utils/checkLastUpdateTime.mjs +17 -1
  242. package/dist/esm/utils/checkLastUpdateTime.mjs.map +1 -1
  243. package/dist/esm/utils/chunkInference.mjs +43 -1
  244. package/dist/esm/utils/chunkInference.mjs.map +1 -1
  245. package/dist/esm/utils/fixChunkStartEndChars.mjs +25 -3
  246. package/dist/esm/utils/fixChunkStartEndChars.mjs.map +1 -1
  247. package/dist/esm/utils/formatTimeDiff.mjs +18 -1
  248. package/dist/esm/utils/formatTimeDiff.mjs.map +1 -1
  249. package/dist/esm/utils/getIsFileUpdatedRecently.mjs +14 -1
  250. package/dist/esm/utils/getIsFileUpdatedRecently.mjs.map +1 -1
  251. package/dist/esm/utils/getOutputFilePath.mjs +104 -1
  252. package/dist/esm/utils/getOutputFilePath.mjs.map +1 -1
  253. package/dist/esm/utils/getParentPackageJSON.mjs +18 -1
  254. package/dist/esm/utils/getParentPackageJSON.mjs.map +1 -1
  255. package/dist/esm/utils/listSpecialChars.mjs +52 -2
  256. package/dist/esm/utils/listSpecialChars.mjs.map +1 -1
  257. package/dist/esm/utils/mapChunksBetweenFiles.mjs +100 -1
  258. package/dist/esm/utils/mapChunksBetweenFiles.mjs.map +1 -1
  259. package/dist/esm/utils/openBrowser.mjs +17 -1
  260. package/dist/esm/utils/openBrowser.mjs.map +1 -1
  261. package/dist/esm/utils/reorderParagraphs.mjs +90 -3
  262. package/dist/esm/utils/reorderParagraphs.mjs.map +1 -1
  263. package/dist/esm/utils/setupAI.mjs +63 -1
  264. package/dist/esm/utils/setupAI.mjs.map +1 -1
  265. package/dist/esm/watch.mjs +45 -1
  266. package/dist/esm/watch.mjs.map +1 -1
  267. package/dist/types/fill/fill.d.ts +1 -1
  268. package/dist/types/fill/fill.d.ts.map +1 -1
  269. package/dist/types/fill/formatFillData.d.ts.map +1 -1
  270. package/dist/types/fill/translateDictionary.d.ts +1 -1
  271. package/dist/types/getTargetDictionary.d.ts +19 -2
  272. package/dist/types/getTargetDictionary.d.ts.map +1 -0
  273. package/dist/types/index.d.ts +2 -2
  274. package/dist/types/reviewDoc/reviewDocBlockAware.d.ts +1 -1
  275. package/dist/types/test/index.d.ts +2 -2
  276. package/dist/types/test/listMissingTranslations.d.ts +28 -2
  277. package/dist/types/test/listMissingTranslations.d.ts.map +1 -0
  278. package/dist/types/test/test.d.ts +11 -2
  279. package/dist/types/test/test.d.ts.map +1 -0
  280. package/dist/types/translateDoc/index.d.ts +1 -1
  281. package/dist/types/translateDoc/translateDoc.d.ts +1 -1
  282. package/dist/types/translateDoc/translateFile.d.ts +1 -1
  283. package/dist/types/translateDoc/types.d.ts +48 -2
  284. package/dist/types/translateDoc/types.d.ts.map +1 -0
  285. package/dist/types/utils/chunkInference.d.ts +1 -1
  286. package/dist/types/utils/getOutputFilePath.d.ts +18 -1
  287. package/dist/types/utils/getOutputFilePath.d.ts.map +1 -1
  288. package/dist/types/utils/setupAI.d.ts +21 -2
  289. package/dist/types/utils/setupAI.d.ts.map +1 -0
  290. package/package.json +12 -12
  291. package/dist/cjs/_utils_asset-ghp_Cjwk.cjs +0 -2
  292. package/dist/cjs/chunk-Bmb41Sf3.cjs +0 -1
  293. package/dist/esm/_utils_asset-B187VPMw.mjs +0 -2
  294. package/dist/esm/editor-D8BGlLzF.mjs +0 -2
  295. package/dist/esm/editor-D8BGlLzF.mjs.map +0 -1
  296. package/dist/types/getTargetDictionary-RBSRtaQj.d.ts +0 -19
  297. package/dist/types/getTargetDictionary-RBSRtaQj.d.ts.map +0 -1
  298. package/dist/types/listMissingTranslations-DxKw7nqI.d.ts +0 -28
  299. package/dist/types/listMissingTranslations-DxKw7nqI.d.ts.map +0 -1
  300. package/dist/types/setupAI-Bosjx7ah.d.ts +0 -21
  301. package/dist/types/setupAI-Bosjx7ah.d.ts.map +0 -1
  302. package/dist/types/test-DUTiJR5_.d.ts +0 -11
  303. package/dist/types/test-DUTiJR5_.d.ts.map +0 -1
  304. package/dist/types/types-BKvc3FmV.d.ts +0 -48
  305. package/dist/types/types-BKvc3FmV.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"init.cjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\n"],"mappings":"uLAIA,MAAa,EAAmB,GAAqB,CACnD,IAAI,EAAa,EAEjB,KAAO,KAAA,EAAA,EAAA,SAAuB,EAAY,KAAK,EAAE,CAC/C,IAAA,EAAA,EAAA,aAAA,EAAA,EAAA,MAAoB,EAAY,eAAe,CAAC,CAC9C,OAAO,EAET,GAAA,EAAA,EAAA,SAAqB,EAAY,KAAK,CAKxC,OAAO,GAGI,EAAO,KAAO,IAAyB,CAKlD,MAAA,EAAA,EAAA,cAHI,EADS,GACT,EAAA,EAAA,SAAwB,EAAY,CACpB,QAAQ,KAAK,CAAC,CAEV"}
1
+ {"version":3,"file":"init.cjs","names":[],"sources":["../../src/init.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join, resolve } from 'node:path';\nimport { initIntlayer } from '@intlayer/chokidar/cli';\n\nexport const findProjectRoot = (startDir: string) => {\n let currentDir = startDir;\n\n while (currentDir !== resolve(currentDir, '..')) {\n if (existsSync(join(currentDir, 'package.json'))) {\n return currentDir;\n }\n currentDir = resolve(currentDir, '..');\n }\n\n // If no package.json is found, return the start directory.\n // The initIntlayer function will handle the missing package.json error.\n return startDir;\n};\n\nexport const init = async (projectRoot?: string) => {\n const root = projectRoot\n ? findProjectRoot(resolve(projectRoot))\n : findProjectRoot(process.cwd());\n\n await initIntlayer(root);\n};\n"],"mappings":";;;;;;;AAIA,MAAa,mBAAmB,aAAqB;CACnD,IAAI,aAAa;AAEjB,QAAO,sCAAuB,YAAY,KAAK,EAAE;AAC/C,kDAAoB,YAAY,eAAe,CAAC,CAC9C,QAAO;AAET,sCAAqB,YAAY,KAAK;;AAKxC,QAAO;;AAGT,MAAa,OAAO,OAAO,gBAAyB;AAKlD,gDAJa,cACT,uCAAwB,YAAY,CAAC,GACrC,gBAAgB,QAAQ,KAAK,CAAC,CAEV"}
@@ -1,2 +1,70 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./init.cjs`),n=require(`./initSkills.cjs`);let r=require(`node:path`),i=require(`@intlayer/chokidar/cli`),a=require(`enquirer`);a=e.t(a);let o=require(`@clack/prompts`);o=e.t(o);const s=async e=>{let s=t.findProjectRoot(e?(0,r.resolve)(e):process.cwd());o.intro(`Initializing Intlayer MCP Server`);let c=n.getDetectedPlatform(),l;try{l=(await a.default.prompt({type:`autocomplete`,name:`platforms`,message:`Which platform are you using? (Type to search)`,multiple:!1,initial:c?i.PLATFORMS.indexOf(c):void 0,choices:n.PLATFORM_OPTIONS.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{o.cancel(`Operation cancelled.`);return}if(!l){o.cancel(`Operation cancelled. No platform selected.`);return}let u=await o.select({message:`Which transport method do you want to use?`,options:[{value:`stdio`,label:`Local server (stdio)`,hint:`Recommended. Integrates all features including CLI tools.`},{value:`sse`,label:`Remote server (SSE)`,hint:`Hosted by Intlayer. Documentation only.`}]});if(o.isCancel(u)||!u){o.cancel(`Operation cancelled.`);return}let d=o.spinner();d.start(`Configuring MCP Server...`);try{let e=await(0,i.installMCP)(s,l,u);d.stop(`MCP Server configured successfully`),o.note(e,`Success`)}catch(e){d.stop(`Failed to configure MCP Server`),o.log.error(e instanceof Error?e.message:String(e))}o.outro(`Intlayer MCP Server initialization complete`)};exports.initMCP=s;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_init = require('./init.cjs');
4
+ const require_initSkills = require('./initSkills.cjs');
5
+ let node_path = require("node:path");
6
+ let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
7
+ let enquirer = require("enquirer");
8
+ enquirer = require_runtime.__toESM(enquirer);
9
+ let _clack_prompts = require("@clack/prompts");
10
+ _clack_prompts = require_runtime.__toESM(_clack_prompts);
11
+
12
+ //#region src/initMCP.ts
13
+ const initMCP = async (projectRoot) => {
14
+ const root = require_init.findProjectRoot(projectRoot ? (0, node_path.resolve)(projectRoot) : process.cwd());
15
+ _clack_prompts.intro("Initializing Intlayer MCP Server");
16
+ const detectedPlatform = require_initSkills.getDetectedPlatform();
17
+ 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;
34
+ }
35
+ if (!platform) {
36
+ _clack_prompts.cancel("Operation cancelled. No platform selected.");
37
+ return;
38
+ }
39
+ const transport = await _clack_prompts.select({
40
+ message: "Which transport method do you want to use?",
41
+ options: [{
42
+ value: "stdio",
43
+ label: "Local server (stdio)",
44
+ hint: "Recommended. Integrates all features including CLI tools."
45
+ }, {
46
+ value: "sse",
47
+ label: "Remote server (SSE)",
48
+ hint: "Hosted by Intlayer. Documentation only."
49
+ }]
50
+ });
51
+ if (_clack_prompts.isCancel(transport) || !transport) {
52
+ _clack_prompts.cancel("Operation cancelled.");
53
+ return;
54
+ }
55
+ const s = _clack_prompts.spinner();
56
+ s.start("Configuring MCP Server...");
57
+ try {
58
+ const result = await (0, _intlayer_chokidar_cli.installMCP)(root, platform, transport);
59
+ s.stop("MCP Server configured successfully");
60
+ _clack_prompts.note(result, "Success");
61
+ } catch (error) {
62
+ s.stop("Failed to configure MCP Server");
63
+ _clack_prompts.log.error(error instanceof Error ? error.message : String(error));
64
+ }
65
+ _clack_prompts.outro("Intlayer MCP Server initialization complete");
66
+ };
67
+
68
+ //#endregion
69
+ exports.initMCP = initMCP;
2
70
  //# sourceMappingURL=initMCP.cjs.map
@@ -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":"wSAWA,MAAa,EAAU,KAAO,IAAyB,CACrD,IAAM,EAAOA,EAAAA,gBACX,GAAA,EAAA,EAAA,SAAsB,EAAY,CAAG,QAAQ,KAAK,CACnD,CAED,EAAE,MAAM,mCAAmC,CAE3C,IAAM,EAAmBC,EAAAA,qBAAqB,CAE1C,EACJ,GAAI,CAeF,GAdiB,MAAM,EAAA,QAAS,OAA2B,CACzD,KAAM,eACN,KAAM,YACN,QAAS,iDACT,SAAU,GACV,QAAS,EACLC,EAAAA,UAAU,QAAQ,EAAiB,CACnC,IAAA,GACJ,QAASC,EAAAA,iBAAiB,IAAK,IAAS,CACtC,KAAM,EAAI,MACV,QAAS,EAAI,MACb,KAAM,EAAI,KACX,EAAE,CACJ,CAAC,EACkB,eACd,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,EAAU,CACb,EAAE,OAAO,6CAA6C,CACtD,OAGF,IAAM,EAAa,MAAMC,EAAE,OAAO,CAChC,QAAS,6CACT,QAAS,CACP,CACE,MAAO,QACP,MAAO,uBACP,KAAM,4DACP,CACD,CACE,MAAO,MACP,MAAO,sBACP,KAAM,0CACP,CACF,CACF,CAAC,CAEF,GAAIA,EAAE,SAAS,EAAU,EAAI,CAAC,EAAW,CACvC,EAAE,OAAO,uBAAuB,CAChC,OAGF,IAAM,EAAIA,EAAE,SAAS,CACrB,EAAE,MAAM,4BAA4B,CAEpC,GAAI,CACF,IAAM,EAAS,MAAA,EAAA,EAAA,YAAiB,EAAM,EAAU,EAAU,CAE1D,EAAE,KAAK,qCAAqC,CAE5C,EAAE,KAAK,EAAQ,UAAU,OAClB,EAAO,CACd,EAAE,KAAK,iCAAiC,CACxC,EAAE,IAAI,MAAM,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CAAC,CAGrE,EAAE,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} 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,cAdiB,MAAM,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,2 +1,94 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./init.cjs`);let n=require(`node:fs`),r=require(`node:path`),i=require(`@intlayer/chokidar/cli`),a=require(`enquirer`);a=e.t(a);let o=require(`@clack/prompts`);o=e.t(o);const s=i.PLATFORMS.filter(e=>i.PLATFORMS_METADATA[e].check).map(e=>({check:i.PLATFORMS_METADATA[e].check??(()=>!1),platform:e})),c=i.PLATFORMS.map(e=>({value:e,label:i.PLATFORMS_METADATA[e].label,hint:`(${i.PLATFORMS_METADATA[e].dir})`})),l=()=>s.find(({check:e})=>e())?.platform,u=e=>{try{let t=(0,r.join)(e,`package.json`);if(!(0,n.existsSync)(t))return{};let{dependencies:i={},devDependencies:a={}}=JSON.parse((0,n.readFileSync)(t,`utf-8`));return{...i,...a}}catch{return{}}},d=async e=>{let n=t.findProjectRoot(e?(0,r.resolve)(e):process.cwd());o.intro(`Initializing Intlayer skills`);let s=l(),d;try{d=(await a.default.prompt({type:`autocomplete`,name:`platforms`,message:`Which platforms are you using? (Type to search)`,multiple:!1,initial:s?i.PLATFORMS.indexOf(s):void 0,choices:c.map(e=>({name:e.value,message:e.label,hint:e.hint}))})).platforms}catch{o.cancel(`Operation cancelled.`);return}if(!d){o.log.warn(`No platform selected. Nothing to install.`);return}let f=(0,i.getInitialSkills)(u(n)),p=await o.multiselect({message:`Select the documentation skills to provide to your AI:`,initialValues:f,options:i.SKILLS.map(e=>({value:e,label:e,hint:i.SKILLS_METADATA[e]})),required:!1});if(o.isCancel(p)||!p||p.length===0){o.cancel(`Operation cancelled. No skills selected.`);return}let m=o.spinner();m.start(`Installing skills...`);try{let e=await(0,i.installSkills)(n,d,p);m.stop(`Skills installed successfully`),o.note(e,`Success`)}catch(e){m.stop(`Failed to install skills`),o.log.error(e instanceof Error?e.message:String(e))}o.outro(`Intlayer skills initialization complete`)};exports.PLATFORM_OPTIONS=c,exports.getDetectedPlatform=l,exports.initSkills=d;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ const require_init = require('./init.cjs');
4
+ let node_fs = require("node:fs");
5
+ let node_path = require("node:path");
6
+ let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
7
+ let enquirer = require("enquirer");
8
+ enquirer = require_runtime.__toESM(enquirer);
9
+ let _clack_prompts = require("@clack/prompts");
10
+ _clack_prompts = require_runtime.__toESM(_clack_prompts);
11
+
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),
15
+ platform
16
+ }));
17
+ const PLATFORM_OPTIONS = _intlayer_chokidar_cli.PLATFORMS.map((platform) => ({
18
+ value: platform,
19
+ label: _intlayer_chokidar_cli.PLATFORMS_METADATA[platform].label,
20
+ hint: `(${_intlayer_chokidar_cli.PLATFORMS_METADATA[platform].dir})`
21
+ }));
22
+ const getDetectedPlatform = () => PLATFORM_CHECKS.find(({ check }) => check())?.platform;
23
+ const getDependencies = (root) => {
24
+ try {
25
+ const packageJsonPath = (0, node_path.join)(root, "package.json");
26
+ if (!(0, node_fs.existsSync)(packageJsonPath)) return {};
27
+ const { dependencies = {}, devDependencies = {} } = JSON.parse((0, node_fs.readFileSync)(packageJsonPath, "utf-8"));
28
+ return {
29
+ ...dependencies,
30
+ ...devDependencies
31
+ };
32
+ } catch {
33
+ return {};
34
+ }
35
+ };
36
+ const initSkills = async (projectRoot) => {
37
+ const root = require_init.findProjectRoot(projectRoot ? (0, node_path.resolve)(projectRoot) : process.cwd());
38
+ _clack_prompts.intro("Initializing Intlayer skills");
39
+ const detectedPlatform = getDetectedPlatform();
40
+ 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;
57
+ }
58
+ if (!platform) {
59
+ _clack_prompts.log.warn("No platform selected. Nothing to install.");
60
+ return;
61
+ }
62
+ const initialValues = (0, _intlayer_chokidar_cli.getInitialSkills)(getDependencies(root));
63
+ const selectedSkills = await _clack_prompts.multiselect({
64
+ message: "Select the documentation skills to provide to your AI:",
65
+ initialValues,
66
+ options: _intlayer_chokidar_cli.SKILLS.map((skill) => ({
67
+ value: skill,
68
+ label: skill,
69
+ hint: _intlayer_chokidar_cli.SKILLS_METADATA[skill]
70
+ })),
71
+ required: false
72
+ });
73
+ if (_clack_prompts.isCancel(selectedSkills) || !selectedSkills || selectedSkills.length === 0) {
74
+ _clack_prompts.cancel("Operation cancelled. No skills selected.");
75
+ return;
76
+ }
77
+ const s = _clack_prompts.spinner();
78
+ s.start("Installing skills...");
79
+ try {
80
+ const result = await (0, _intlayer_chokidar_cli.installSkills)(root, platform, selectedSkills);
81
+ s.stop("Skills installed successfully");
82
+ _clack_prompts.note(result, "Success");
83
+ } catch (error) {
84
+ s.stop("Failed to install skills");
85
+ _clack_prompts.log.error(error instanceof Error ? error.message : String(error));
86
+ }
87
+ _clack_prompts.outro("Intlayer skills initialization complete");
88
+ };
89
+
90
+ //#endregion
91
+ exports.PLATFORM_OPTIONS = PLATFORM_OPTIONS;
92
+ exports.getDetectedPlatform = getDetectedPlatform;
93
+ exports.initSkills = initSkills;
2
94
  //# sourceMappingURL=initSkills.cjs.map
@@ -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":"+RAeA,MAAM,EACJA,EAAAA,UAAU,OAAQ,GAAaC,EAAAA,mBAAmB,GAAU,MAAM,CAAC,IAChE,IAAc,CACb,MAAOA,EAAAA,mBAAmB,GAAU,YAAgB,IACpD,WACD,EACF,CAEU,EAIRD,EAAAA,UAAU,IAAK,IAAc,CAChC,MAAO,EACP,MAAOC,EAAAA,mBAAmB,GAAU,MACpC,KAAM,IAAIA,EAAAA,mBAAmB,GAAU,IAAI,GAC5C,EAAE,CAEU,MACX,EAAgB,MAAM,CAAE,WAAY,GAAO,CAAC,EAAE,SAE1C,EAAmB,GAAyC,CAChE,GAAI,CACF,IAAM,GAAA,EAAA,EAAA,MAAuB,EAAM,eAAe,CAClD,GAAI,EAAA,EAAA,EAAA,YAAY,EAAgB,CAAE,MAAO,EAAE,CAE3C,GAAM,CAAE,eAAe,EAAE,CAAE,kBAAkB,EAAE,EAAK,KAAK,OAAA,EAAA,EAAA,cAC1C,EAAiB,QAAQ,CACvC,CACD,MAAO,CAAE,GAAG,EAAc,GAAG,EAAiB,MACxC,CACN,MAAO,EAAE,GAIA,EAAa,KAAO,IAAyB,CACxD,IAAM,EAAOC,EAAAA,gBACX,GAAA,EAAA,EAAA,SAAsB,EAAY,CAAG,QAAQ,KAAK,CACnD,CAED,EAAE,MAAM,+BAA+B,CAEvC,IAAM,EAAmB,GAAqB,CAE1C,EACJ,GAAI,CAeF,GAdiB,MAAM,EAAA,QAAS,OAAgC,CAC9D,KAAM,eACN,KAAM,YACN,QAAS,kDACT,SAAU,GACV,QAAS,EACLF,EAAAA,UAAU,QAAQ,EAAiB,CACnC,IAAA,GACJ,QAAS,EAAiB,IAAK,IAAS,CACtC,KAAM,EAAI,MACV,QAAS,EAAI,MACb,KAAM,EAAI,KACX,EAAE,CACJ,CAAC,EACkB,eACd,CACN,EAAE,OAAO,uBAAuB,CAChC,OAGF,GAAI,CAAC,EAAU,CACb,EAAE,IAAI,KAAK,4CAA4C,CACvD,OAIF,IAAM,GAAA,EAAA,EAAA,kBADe,EAAgB,EAAK,CACU,CAE9C,EAAiB,MAAMG,EAAE,YAAY,CACzC,QAAS,yDACT,gBACA,QAASC,EAAAA,OAAO,IAAK,IAAW,CAC9B,MAAO,EACP,MAAO,EACP,KAAMC,EAAAA,gBAAgB,GACvB,EAAE,CACH,SAAU,GACX,CAAC,CAEF,GACEF,EAAE,SAAS,EAAe,EAC1B,CAAC,GACA,EAA4B,SAAW,EACxC,CACA,EAAE,OAAO,2CAA2C,CACpD,OAGF,IAAM,EAAIA,EAAE,SAAS,CACrB,EAAE,MAAM,uBAAuB,CAE/B,GAAI,CACF,IAAM,EAAS,MAAA,EAAA,EAAA,eAAoB,EAAM,EAAU,EAAe,CAElE,EAAE,KAAK,gCAAgC,CAEvC,EAAE,KAAK,EAAQ,UAAU,OAClB,EAAO,CACd,EAAE,KAAK,2BAA2B,CAClC,EAAE,IAAI,MAAM,aAAiB,MAAQ,EAAM,QAAU,OAAO,EAAM,CAAC,CAGrE,EAAE,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/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,UAAU,MAAM,CAAC,KAChE,cAAc;CACb,OAAOA,0CAAmB,UAAU,gBAAgB;CACpD;CACD,EACF;AAEH,MAAa,mBAIRD,iCAAU,KAAK,cAAc;CAChC,OAAO;CACP,OAAOC,0CAAmB,UAAU;CACpC,MAAM,IAAIA,0CAAmB,UAAU,IAAI;CAC5C,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,cAdiB,MAAM,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,KAAK,CACU;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,2 +1,43 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);let e=require(`node:path`),t=require(`@intlayer/chokidar/utils`),n=require(`@intlayer/config/logger`),r=require(`@intlayer/config/node`),i=require(`@intlayer/unmerged-dictionaries-entry`);const a=t=>{let n=(0,r.getConfiguration)(t?.configOptions),a=(0,i.getUnmergedDictionaries)(n);return Object.values(a).flat().map(r=>({key:r.key??``,path:t?.absolute?r.filePath??`Remote`:(0,e.relative)(n.system.baseDir,r.filePath??`Remote`)}))},o=e=>{let i=a(e);if(e?.json){console.log(JSON.stringify(i));return}let o=(0,n.getAppLogger)((0,r.getConfiguration)(e?.configOptions)),s=i.map(e=>[(0,n.colon)(` - ${(0,n.colorizeKey)(e.key)}`,{colSize:i.map(e=>e.key.length),maxSize:60}),` - `,(0,t.formatPath)(e.path)].join(``));o(`Content declaration files:`),s.forEach(e=>{o(e,{level:`info`})}),o(`Total content declaration files: ${(0,n.colorizeNumber)(i.length)}`)};exports.listContentDeclaration=o,exports.listContentDeclarationRows=a;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let node_path = require("node:path");
4
+ let _intlayer_chokidar_utils = require("@intlayer/chokidar/utils");
5
+ let _intlayer_config_logger = require("@intlayer/config/logger");
6
+ let _intlayer_config_node = require("@intlayer/config/node");
7
+ let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
8
+
9
+ //#region src/listContentDeclaration.ts
10
+ const listContentDeclarationRows = (options) => {
11
+ const config = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
12
+ const unmergedDictionariesRecord = (0, _intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(config);
13
+ return Object.values(unmergedDictionariesRecord).flat().map((dictionary) => ({
14
+ key: dictionary.key ?? "",
15
+ path: options?.absolute ? dictionary.filePath ?? "Remote" : (0, node_path.relative)(config.system.baseDir, dictionary.filePath ?? "Remote")
16
+ }));
17
+ };
18
+ const listContentDeclaration = (options) => {
19
+ const rows = listContentDeclarationRows(options);
20
+ if (options?.json) {
21
+ console.log(JSON.stringify(rows));
22
+ return;
23
+ }
24
+ const appLogger = (0, _intlayer_config_logger.getAppLogger)((0, _intlayer_config_node.getConfiguration)(options?.configOptions));
25
+ const lines = rows.map((row) => [
26
+ (0, _intlayer_config_logger.colon)(` - ${(0, _intlayer_config_logger.colorizeKey)(row.key)}`, {
27
+ colSize: rows.map((row) => row.key.length),
28
+ maxSize: 60
29
+ }),
30
+ " - ",
31
+ (0, _intlayer_chokidar_utils.formatPath)(row.path)
32
+ ].join(""));
33
+ appLogger(`Content declaration files:`);
34
+ lines.forEach((line) => {
35
+ appLogger(line, { level: "info" });
36
+ });
37
+ appLogger(`Total content declaration files: ${(0, _intlayer_config_logger.colorizeNumber)(rows.length)}`);
38
+ };
39
+
40
+ //#endregion
41
+ exports.listContentDeclaration = listContentDeclaration;
42
+ exports.listContentDeclarationRows = listContentDeclarationRows;
2
43
  //# sourceMappingURL=listContentDeclaration.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\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 = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\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 = (\n options?: ListContentDeclarationOptions\n) => {\n const rows = 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":"+RAoBA,MAAa,EACX,GACG,CACH,IAAM,GAAA,EAAA,EAAA,kBAA0B,GAAS,cAAc,CAEjD,GAAA,EAAA,EAAA,yBAAqD,EAAO,CAUlE,OARa,OAAO,OAAO,EAA2B,CACnD,MAAM,CACN,IAAK,IAAgB,CACpB,IAAK,EAAW,KAAO,GACvB,KAAM,GAAS,SACV,EAAW,UAAY,UAAA,EAAA,EAAA,UACf,EAAO,OAAO,QAAS,EAAW,UAAY,SAAS,CACrE,EAAE,EAIM,EACX,GACG,CACH,IAAM,EAAO,EAA2B,EAAQ,CAEhD,GAAI,GAAS,KAAM,CACjB,QAAQ,IAAI,KAAK,UAAU,EAAK,CAAC,CACjC,OAIF,IAAM,GAAA,EAAA,EAAA,eAAA,EAAA,EAAA,kBAD0B,GAAS,cAAc,CACjB,CAEhC,EAAQ,EAAK,IAAK,GACtB,aACQ,OAAA,EAAA,EAAA,aAAkB,EAAI,IAAI,GAAI,CAClC,QAAS,EAAK,IAAK,GAAQ,EAAI,IAAI,OAAO,CAC1C,QAAS,GACV,CAAC,CACF,uBACW,EAAI,KAAK,CACrB,CAAC,KAAK,GAAG,CACX,CAED,EAAU,6BAA6B,CAEvC,EAAM,QAAS,GAAS,CACtB,EAAU,EAAM,CACd,MAAO,OACR,CAAC,EACF,CAEF,EAAU,qCAAA,EAAA,EAAA,gBAAmD,EAAK,OAAO,GAAG"}
1
+ {"version":3,"file":"listContentDeclaration.cjs","names":[],"sources":["../../src/listContentDeclaration.ts"],"sourcesContent":["import { relative } from 'node:path';\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 = (\n options?: ListContentDeclarationOptions\n) => {\n const config = getConfiguration(options?.configOptions);\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 = (\n options?: ListContentDeclarationOptions\n) => {\n const rows = 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":";;;;;;;;;AAoBA,MAAa,8BACX,YACG;CACH,MAAM,qDAA0B,SAAS,cAAc;CAEvD,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,EAAE;;AAIP,MAAa,0BACX,YACG;CACH,MAAM,OAAO,2BAA2B,QAAQ;AAEhD,KAAI,SAAS,MAAM;AACjB,UAAQ,IAAI,KAAK,UAAU,KAAK,CAAC;AACjC;;CAIF,MAAM,kGAD0B,SAAS,cAAc,CACjB;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,2 +1,29 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`./chunk-Bmb41Sf3.cjs`);let e=require(`node:path`),t=require(`@intlayer/chokidar/cli`);const n=async n=>{let{searchDir:r,projectsPath:i}=await(0,t.listProjects)(n),a=i.map(t=>n?.absolute?t:(0,e.relative)(r,t)).map(e=>e===``?`.`:e);if(n?.json){console.dir(a,{depth:null,arrayLimit:null});return}if(i.length===0){console.log(`No Intlayer projects found.`);return}console.log(`Found ${i.length} Intlayer project(s):\n`),i.forEach(e=>{console.log(` - ${e}`)})};exports.listProjectsCommand=n;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
+ let node_path = require("node:path");
4
+ let _intlayer_chokidar_cli = require("@intlayer/chokidar/cli");
5
+
6
+ //#region src/listProjects.ts
7
+ const listProjectsCommand = async (options) => {
8
+ const { searchDir, projectsPath } = await (0, _intlayer_chokidar_cli.listProjects)(options);
9
+ const projectsRelativePath = projectsPath.map((projectPath) => options?.absolute ? projectPath : (0, node_path.relative)(searchDir, projectPath)).map((projectPath) => projectPath === "" ? "." : projectPath);
10
+ if (options?.json) {
11
+ console.dir(projectsRelativePath, {
12
+ depth: null,
13
+ arrayLimit: null
14
+ });
15
+ return;
16
+ }
17
+ if (projectsPath.length === 0) {
18
+ console.log("No Intlayer projects found.");
19
+ return;
20
+ }
21
+ console.log(`Found ${projectsPath.length} Intlayer project(s):\n`);
22
+ projectsPath.forEach((project) => {
23
+ console.log(` - ${project}`);
24
+ });
25
+ };
26
+
27
+ //#endregion
28
+ exports.listProjectsCommand = listProjectsCommand;
2
29
  //# sourceMappingURL=listProjects.cjs.map
@@ -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":"kKAQA,MAAa,EAAsB,KACjC,IACG,CACH,GAAM,CAAE,YAAW,gBAAiB,MAAA,EAAA,EAAA,cAAmB,EAAQ,CAEzD,EAAuB,EAC1B,IAAK,GACJ,GAAS,SAAW,GAAA,EAAA,EAAA,UAAuB,EAAW,EAAY,CACnE,CACA,IAAK,GAAiB,IAAgB,GAAK,IAAM,EAAa,CAEjE,GAAI,GAAS,KAAM,CACjB,QAAQ,IAAI,EAAsB,CAAE,MAAO,KAAM,WAAY,KAAM,CAAC,CACpE,OAGF,GAAI,EAAa,SAAW,EAAG,CAC7B,QAAQ,IAAI,8BAA8B,CAC1C,OAGF,QAAQ,IAAI,SAAS,EAAa,OAAO,yBAAyB,CAClE,EAAa,QAAS,GAAY,CAChC,QAAQ,IAAI,OAAO,IAAU,EAC7B"}
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,10 +1,155 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./IntlayerEventListener.cjs`);let n=require(`@intlayer/chokidar/build`),r=require(`@intlayer/chokidar/utils`),i=require(`@intlayer/config/logger`),a=require(`@intlayer/config/node`),o=require(`@intlayer/unmerged-dictionaries-entry`),s=require(`node:http`),c=require(`@intlayer/config/package.json`);c=e.t(c);let l=require(`@intlayer/core/plugins`),u=require(`@intlayer/dictionaries-entry`);const d=async(e,t)=>{(0,i.getAppLogger)(t)(`Writing dictionary ${e.key}`),await(0,n.buildDictionary)([e],t)},f=async e=>{let n=(0,a.getConfiguration)(e?.configOptions),f=(0,i.getAppLogger)(n),{liveSyncPort:p,liveSyncURL:m}=n.editor,h=null,g=null;if(e?.with&&(h=(0,r.runParallel)(e.with),h.result.catch(()=>{})),n.editor.liveSync&&n.editor.backendURL&&n.editor.clientId&&n.editor.clientSecret){g=new t.IntlayerEventListener(n),g.onConnectionOpen=()=>{f(`Live sync connection established`)},g.onConnectionError=e=>{let t=e;f(`Live sync connection error: ${t.message??`Unknown error`}`,{level:`warn`}),(t.message?.includes(`terminated`)||t.message?.includes(`closed`))&&f(`Server connection was terminated, automatic reconnection will be attempted...`,{level:`info`})},g.onDictionaryAdded=e=>d(e,n),g.onDictionaryChange=e=>d(e,n),g.onDictionaryDeleted=e=>d(e,n);try{await g.initialize()}catch(e){f(`Failed to initialize IntlayerEventListener:`,{level:`error`}),f(`Error: ${e instanceof Error?e.message:String(e)}`,{level:`error`})}}else n.editor.liveSync?(!n.editor.clientId||!n.editor.clientSecret)&&f(`Missing client credentials for hot reload. Please configure clientId and clientSecret`):f(`Hot reload is disabled. Please enable it in the configuration (editor.liveSync).`);let _=(0,s.createServer)(async(e,t)=>{if(e.method===`OPTIONS`){t.writeHead(200,{"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`}),t.end();return}if(e.url?.startsWith(`/dictionaries`)){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`});let r=(0,u.getDictionaries)(n);if(e.url.startsWith(`/dictionaries/`)){let[n,i]=decodeURIComponent(e.url).slice(14).split(`/`),a=r[n]??null;if(i){let e=(0,l.getLocalizedContent)(a.content,i,{dictionaryKey:n,keyPath:[]});t.end(JSON.stringify(e));return}t.end(JSON.stringify(a));return}t.end(JSON.stringify(r));return}if(e.url?.startsWith(`/unmerged_dictionaries`)){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`});let r=(0,o.getUnmergedDictionaries)(n);if(e.url.startsWith(`/unmerged_dictionaries/`)){let n=r[decodeURIComponent(e.url.slice(23))]??null;t.end(JSON.stringify(n));return}t.end(JSON.stringify(r));return}if(e.url===`/configuration`){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`,"Cache-Control":`no-store`,"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`GET, POST, PUT, DELETE, OPTIONS`,"Access-Control-Allow-Headers":`Content-Type, Authorization`}),t.end(JSON.stringify(n));return}if(e.url===`/health`){t.writeHead(200,{"Content-Type":`application/json; charset=utf-8`}),t.end(JSON.stringify({status:`ok`}));return}t.end(`Not found`)}),v=()=>n.editor.liveSync?`\x1B[32m✓ Enabled\x1B[0m`:`\x1B[31m✗ Disabled\x1B[0m`;_.listen(p,()=>{console.log(`
2
- \x1b[1;90mINTLAYER v${c.default.version}\x1b[0m
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
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
+ let _intlayer_config_logger = require("@intlayer/config/logger");
7
+ let _intlayer_config_node = require("@intlayer/config/node");
8
+ let _intlayer_unmerged_dictionaries_entry = require("@intlayer/unmerged-dictionaries-entry");
9
+ let node_http = require("node:http");
10
+ let _intlayer_config_package_json = require("@intlayer/config/package.json");
11
+ _intlayer_config_package_json = require_runtime.__toESM(_intlayer_config_package_json);
12
+ let _intlayer_core_plugins = require("@intlayer/core/plugins");
13
+ let _intlayer_dictionaries_entry = require("@intlayer/dictionaries-entry");
14
+
15
+ //#region src/liveSync.ts
16
+ const writeDictionary = async (dictionary, configuration) => {
17
+ (0, _intlayer_config_logger.getAppLogger)(configuration)(`Writing dictionary ${dictionary.key}`);
18
+ await (0, _intlayer_chokidar_build.buildDictionary)([dictionary], configuration);
19
+ };
20
+ const liveSync = async (options) => {
21
+ const configuration = (0, _intlayer_config_node.getConfiguration)(options?.configOptions);
22
+ const appLogger = (0, _intlayer_config_logger.getAppLogger)(configuration);
23
+ const { liveSyncPort, liveSyncURL } = configuration.editor;
24
+ let parallelProcess = null;
25
+ let eventListener = null;
26
+ if (options?.with) {
27
+ parallelProcess = (0, _intlayer_chokidar_utils.runParallel)(options.with);
28
+ parallelProcess.result.catch(() => {});
29
+ }
30
+ if (configuration.editor.liveSync && configuration.editor.backendURL && configuration.editor.clientId && configuration.editor.clientSecret) {
31
+ eventListener = new require_IntlayerEventListener.IntlayerEventListener(configuration);
32
+ eventListener.onConnectionOpen = () => {
33
+ appLogger("Live sync connection established");
34
+ };
35
+ eventListener.onConnectionError = (error) => {
36
+ const errorEvent = error;
37
+ appLogger(`Live sync connection error: ${errorEvent.message ?? "Unknown error"}`, { level: "warn" });
38
+ if (errorEvent.message?.includes("terminated") || errorEvent.message?.includes("closed")) appLogger("Server connection was terminated, automatic reconnection will be attempted...", { level: "info" });
39
+ };
40
+ eventListener.onDictionaryAdded = (dictionary) => writeDictionary(dictionary, configuration);
41
+ eventListener.onDictionaryChange = (dictionary) => writeDictionary(dictionary, configuration);
42
+ eventListener.onDictionaryDeleted = (dictionary) => writeDictionary(dictionary, configuration);
43
+ try {
44
+ await eventListener.initialize();
45
+ } catch (error) {
46
+ appLogger("Failed to initialize IntlayerEventListener:", { level: "error" });
47
+ appLogger(`Error: ${error instanceof Error ? error.message : String(error)}`, { level: "error" });
48
+ }
49
+ } else if (!configuration.editor.liveSync) appLogger("Hot reload is disabled. Please enable it in the configuration (editor.liveSync).");
50
+ else if (!configuration.editor.clientId || !configuration.editor.clientSecret) appLogger("Missing client credentials for hot reload. Please configure clientId and clientSecret");
51
+ const server = (0, node_http.createServer)(async (req, res) => {
52
+ if (req.method === "OPTIONS") {
53
+ res.writeHead(200, {
54
+ "Access-Control-Allow-Origin": "*",
55
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
56
+ "Access-Control-Allow-Headers": "Content-Type, Authorization"
57
+ });
58
+ res.end();
59
+ return;
60
+ }
61
+ if (req.url?.startsWith("/dictionaries")) {
62
+ res.writeHead(200, {
63
+ "Content-Type": "application/json; charset=utf-8",
64
+ "Cache-Control": "no-store",
65
+ "Access-Control-Allow-Origin": "*",
66
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
67
+ "Access-Control-Allow-Headers": "Content-Type, Authorization"
68
+ });
69
+ const dictionaries = (0, _intlayer_dictionaries_entry.getDictionaries)(configuration);
70
+ if (req.url.startsWith("/dictionaries/")) {
71
+ const [key, locale] = decodeURIComponent(req.url).slice(14).split("/");
72
+ const dictionary = dictionaries[key] ?? null;
73
+ if (locale) {
74
+ const sourceLocaleContent = (0, _intlayer_core_plugins.getLocalizedContent)(dictionary.content, locale, {
75
+ dictionaryKey: key,
76
+ keyPath: []
77
+ });
78
+ res.end(JSON.stringify(sourceLocaleContent));
79
+ return;
80
+ }
81
+ res.end(JSON.stringify(dictionary));
82
+ return;
83
+ }
84
+ res.end(JSON.stringify(dictionaries));
85
+ return;
86
+ }
87
+ if (req.url?.startsWith("/unmerged_dictionaries")) {
88
+ res.writeHead(200, {
89
+ "Content-Type": "application/json; charset=utf-8",
90
+ "Cache-Control": "no-store",
91
+ "Access-Control-Allow-Origin": "*",
92
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
93
+ "Access-Control-Allow-Headers": "Content-Type, Authorization"
94
+ });
95
+ const unmergedDictionaries = (0, _intlayer_unmerged_dictionaries_entry.getUnmergedDictionaries)(configuration);
96
+ if (req.url.startsWith("/unmerged_dictionaries/")) {
97
+ const one = unmergedDictionaries[decodeURIComponent(req.url.slice(23))] ?? null;
98
+ res.end(JSON.stringify(one));
99
+ return;
100
+ }
101
+ res.end(JSON.stringify(unmergedDictionaries));
102
+ return;
103
+ }
104
+ if (req.url === "/configuration") {
105
+ res.writeHead(200, {
106
+ "Content-Type": "application/json; charset=utf-8",
107
+ "Cache-Control": "no-store",
108
+ "Access-Control-Allow-Origin": "*",
109
+ "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, OPTIONS",
110
+ "Access-Control-Allow-Headers": "Content-Type, Authorization"
111
+ });
112
+ res.end(JSON.stringify(configuration));
113
+ return;
114
+ }
115
+ if (req.url === "/health") {
116
+ res.writeHead(200, { "Content-Type": "application/json; charset=utf-8" });
117
+ res.end(JSON.stringify({ status: "ok" }));
118
+ return;
119
+ }
120
+ res.end("Not found");
121
+ });
122
+ const getLiveSyncParam = () => {
123
+ if (!configuration.editor.liveSync) return "\x1B[31m✗ Disabled\x1B[0m";
124
+ return "\x1B[32m✓ Enabled\x1B[0m";
125
+ };
126
+ server.listen(liveSyncPort, () => {
127
+ console.log(`
128
+ \x1b[1;90mINTLAYER v${_intlayer_config_package_json.default.version}\x1b[0m
3
129
 
4
- Live server running at: \x1b[90m${m}\x1b[0m
5
- - Backend URL: \x1b[90m${n.editor.backendURL??`-`}\x1b[0m
6
- - Live sync: ${v()}
7
- - Parallel process: ${e?.with?`\x1b[90m${Array.isArray(e.with)?e.with.join(` `):e.with}\x1b[0m`:`-`}
8
- - Access key: ${n.editor.clientId??`-`}
9
- `)});let y=()=>{g&&(f(`Closing SSE connection...`),g.cleanup()),h&&h.kill(),_.close(()=>{f(`Live sync server stopped`),process.exit(0)})};process.on(`SIGINT`,y),process.on(`SIGTERM`,y),process.on(`exit`,y)};exports.liveSync=f;
130
+ Live server running at: \x1b[90m${liveSyncURL}\x1b[0m
131
+ - Backend URL: \x1b[90m${configuration.editor.backendURL ?? "-"}\x1b[0m
132
+ - Live sync: ${getLiveSyncParam()}
133
+ - Parallel process: ${options?.with ? `\x1b[90m${Array.isArray(options.with) ? options.with.join(" ") : options.with}\x1b[0m` : "-"}
134
+ - Access key: ${configuration.editor.clientId ?? "-"}
135
+ `);
136
+ });
137
+ const cleanup = () => {
138
+ if (eventListener) {
139
+ appLogger("Closing SSE connection...");
140
+ eventListener.cleanup();
141
+ }
142
+ if (parallelProcess) parallelProcess.kill();
143
+ server.close(() => {
144
+ appLogger("Live sync server stopped");
145
+ process.exit(0);
146
+ });
147
+ };
148
+ process.on("SIGINT", cleanup);
149
+ process.on("SIGTERM", cleanup);
150
+ process.on("exit", cleanup);
151
+ };
152
+
153
+ //#endregion
154
+ exports.liveSync = liveSync;
10
155
  //# sourceMappingURL=liveSync.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"liveSync.cjs","names":["IntlayerEventListener","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 { 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 disabled. 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 const dictionary = dictionaries[key] ?? null;\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":"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"}
1
+ {"version":3,"file":"liveSync.cjs","names":["IntlayerEventListener","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 { 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 disabled. 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 const dictionary = dictionaries[key] ?? null;\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":"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"}