@intlayer/chokidar 8.12.1 → 8.12.3

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 (308) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +1 -0
  2. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +1 -0
  3. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  4. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +1 -0
  5. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +1 -0
  7. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  8. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +1 -0
  9. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  10. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -0
  11. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  12. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +1 -0
  13. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  14. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +1 -0
  15. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  16. package/dist/cjs/cleanOutputDir.cjs +1 -0
  17. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  18. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  19. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -0
  20. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  21. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +1 -0
  22. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  23. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  24. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  25. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  26. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  27. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  28. package/dist/cjs/createType/createModuleAugmentation.cjs +5 -3
  29. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  30. package/dist/cjs/createType/createType.cjs +1 -0
  31. package/dist/cjs/createType/createType.cjs.map +1 -1
  32. package/dist/cjs/detectFormatCommand.cjs +1 -0
  33. package/dist/cjs/detectFormatCommand.cjs.map +1 -1
  34. package/dist/cjs/fetchDistantDictionaries.cjs +1 -0
  35. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  36. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  37. package/dist/cjs/formatDictionary.cjs +1 -0
  38. package/dist/cjs/formatDictionary.cjs.map +1 -1
  39. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +1 -0
  40. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  41. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +1 -0
  42. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  43. package/dist/cjs/handleContentDeclarationFileChange.cjs +1 -0
  44. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  45. package/dist/cjs/handleContentDeclarationFileMoved.cjs +1 -0
  46. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  47. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -0
  48. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  49. package/dist/cjs/init/index.cjs.map +1 -1
  50. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  51. package/dist/cjs/init/utils/fileSystem.cjs +1 -0
  52. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  53. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
  54. package/dist/cjs/init/utils/tsConfig.cjs +1 -0
  55. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  56. package/dist/cjs/initConfig/index.cjs +1 -0
  57. package/dist/cjs/initConfig/index.cjs.map +1 -1
  58. package/dist/cjs/installLSP.cjs.map +1 -1
  59. package/dist/cjs/installMCP/installMCP.cjs.map +1 -1
  60. package/dist/cjs/installSkills/index.cjs.map +1 -1
  61. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  62. package/dist/cjs/listGitFiles.cjs.map +1 -1
  63. package/dist/cjs/listProjects.cjs.map +1 -1
  64. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +1 -0
  65. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  66. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +1 -0
  67. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  68. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  69. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -0
  70. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  71. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +1 -0
  72. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -1
  73. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +1 -0
  74. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  75. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +1 -0
  76. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -1
  77. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  78. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +1 -0
  79. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  80. package/dist/cjs/logConfigDetails.cjs.map +1 -1
  81. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  82. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  83. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +1 -0
  84. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  85. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  86. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -1
  87. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  88. package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
  89. package/dist/cjs/utils/formatter.cjs.map +1 -1
  90. package/dist/cjs/utils/getChunk.cjs.map +1 -1
  91. package/dist/cjs/utils/getContentExtension.cjs.map +1 -1
  92. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  93. package/dist/cjs/utils/getPathHash.cjs.map +1 -1
  94. package/dist/cjs/utils/mergeChunks.cjs.map +1 -1
  95. package/dist/cjs/utils/pLimit.cjs.map +1 -1
  96. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  97. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
  98. package/dist/cjs/utils/readDictionariesFromDisk.cjs +1 -0
  99. package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -1
  100. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
  101. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  102. package/dist/cjs/utils/resolveRelativePath.cjs +1 -0
  103. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -1
  104. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  105. package/dist/cjs/utils/runParallel/bin.cjs +1 -0
  106. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  107. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
  108. package/dist/cjs/utils/runParallel/index.cjs +1 -0
  109. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  110. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
  111. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
  112. package/dist/cjs/utils/runParallel/runTask.cjs +1 -0
  113. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  114. package/dist/cjs/utils/runParallel/spawnPosix.cjs +1 -0
  115. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  116. package/dist/cjs/utils/runParallel/spawnWin32.cjs +1 -0
  117. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  118. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
  119. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  120. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
  121. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
  122. package/dist/cjs/watcher.cjs.map +1 -1
  123. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs.map +1 -1
  124. package/dist/cjs/writeConfiguration/index.cjs +1 -0
  125. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  126. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  127. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  128. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  129. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  130. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +1 -0
  131. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  132. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +1 -0
  133. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  134. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +1 -0
  135. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -1
  136. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +1 -0
  137. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -1
  138. package/dist/cjs/writeFileIfChanged.cjs +1 -0
  139. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  140. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  141. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -1
  142. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -1
  143. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -1
  144. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -1
  145. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -1
  146. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -1
  147. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  148. package/dist/esm/cleanOutputDir.mjs.map +1 -1
  149. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -1
  150. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -1
  151. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -1
  152. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -1
  153. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -1
  154. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -1
  155. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -1
  156. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -1
  157. package/dist/esm/createType/createModuleAugmentation.mjs +5 -3
  158. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -1
  159. package/dist/esm/createType/createType.mjs.map +1 -1
  160. package/dist/esm/detectFormatCommand.mjs.map +1 -1
  161. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -1
  162. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -1
  163. package/dist/esm/formatDictionary.mjs.map +1 -1
  164. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -1
  165. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -1
  166. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -1
  167. package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -1
  168. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -1
  169. package/dist/esm/init/index.mjs.map +1 -1
  170. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  171. package/dist/esm/init/utils/fileSystem.mjs.map +1 -1
  172. package/dist/esm/init/utils/jsonParser.mjs.map +1 -1
  173. package/dist/esm/init/utils/tsConfig.mjs.map +1 -1
  174. package/dist/esm/initConfig/index.mjs.map +1 -1
  175. package/dist/esm/installLSP.mjs.map +1 -1
  176. package/dist/esm/installMCP/installMCP.mjs.map +1 -1
  177. package/dist/esm/installSkills/index.mjs.map +1 -1
  178. package/dist/esm/listDictionariesPath.mjs.map +1 -1
  179. package/dist/esm/listGitFiles.mjs.map +1 -1
  180. package/dist/esm/listProjects.mjs.map +1 -1
  181. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -1
  182. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -1
  183. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -1
  184. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -1
  185. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs.map +1 -1
  186. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -1
  187. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs.map +1 -1
  188. package/dist/esm/loadDictionaries/log.mjs.map +1 -1
  189. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  190. package/dist/esm/logConfigDetails.mjs.map +1 -1
  191. package/dist/esm/prepareIntlayer.mjs.map +1 -1
  192. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -1
  193. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -1
  194. package/dist/esm/utils/autoDecorateContent.mjs.map +1 -1
  195. package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -1
  196. package/dist/esm/utils/buildFilesList.mjs.map +1 -1
  197. package/dist/esm/utils/chunkJSON.mjs.map +1 -1
  198. package/dist/esm/utils/formatter.mjs.map +1 -1
  199. package/dist/esm/utils/getChunk.mjs.map +1 -1
  200. package/dist/esm/utils/getContentExtension.mjs.map +1 -1
  201. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -1
  202. package/dist/esm/utils/getPathHash.mjs.map +1 -1
  203. package/dist/esm/utils/mergeChunks.mjs.map +1 -1
  204. package/dist/esm/utils/pLimit.mjs.map +1 -1
  205. package/dist/esm/utils/parallelize.mjs.map +1 -1
  206. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -1
  207. package/dist/esm/utils/readDictionariesFromDisk.mjs.map +1 -1
  208. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -1
  209. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -1
  210. package/dist/esm/utils/resolveRelativePath.mjs.map +1 -1
  211. package/dist/esm/utils/runOnce.mjs.map +1 -1
  212. package/dist/esm/utils/runParallel/bin.mjs.map +1 -1
  213. package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -1
  214. package/dist/esm/utils/runParallel/index.mjs.map +1 -1
  215. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -1
  216. package/dist/esm/utils/runParallel/ps.mjs.map +1 -1
  217. package/dist/esm/utils/runParallel/runTask.mjs.map +1 -1
  218. package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -1
  219. package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -1
  220. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -1
  221. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -1
  222. package/dist/esm/utils/splitTextByLine.mjs.map +1 -1
  223. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -1
  224. package/dist/esm/watcher.mjs.map +1 -1
  225. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs.map +1 -1
  226. package/dist/esm/writeConfiguration/index.mjs.map +1 -1
  227. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -1
  228. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
  229. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -1
  230. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -1
  231. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -1
  232. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -1
  233. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -1
  234. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -1
  235. package/dist/esm/writeFileIfChanged.mjs.map +1 -1
  236. package/dist/esm/writeJsonIfChanged.mjs.map +1 -1
  237. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -1
  238. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
  239. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  240. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
  241. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
  242. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -1
  243. package/dist/types/cleanRemovedContentDeclaration.d.ts.map +1 -1
  244. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +3 -1
  245. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
  246. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +3 -1
  247. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
  248. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -1
  249. package/dist/types/createType/createType.d.ts.map +1 -1
  250. package/dist/types/detectFormatCommand.d.ts.map +1 -1
  251. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -1
  252. package/dist/types/formatDictionary.d.ts +22 -21
  253. package/dist/types/formatDictionary.d.ts.map +1 -1
  254. package/dist/types/init/index.d.ts.map +1 -1
  255. package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
  256. package/dist/types/init/utils/fileSystem.d.ts.map +1 -1
  257. package/dist/types/init/utils/jsonParser.d.ts.map +1 -1
  258. package/dist/types/init/utils/tsConfig.d.ts.map +1 -1
  259. package/dist/types/installLSP.d.ts.map +1 -1
  260. package/dist/types/installSkills/index.d.ts.map +1 -1
  261. package/dist/types/listDictionariesPath.d.ts +2 -1
  262. package/dist/types/listDictionariesPath.d.ts.map +1 -1
  263. package/dist/types/listGitFiles.d.ts.map +1 -1
  264. package/dist/types/listProjects.d.ts.map +1 -1
  265. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -1
  266. package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts.map +1 -1
  267. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -1
  268. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  269. package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts.map +1 -1
  270. package/dist/types/logConfigDetails.d.ts.map +1 -1
  271. package/dist/types/prepareIntlayer.d.ts.map +1 -1
  272. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -1
  273. package/dist/types/utils/autoDecorateContent.d.ts.map +1 -1
  274. package/dist/types/utils/buildComponentFilesList.d.ts.map +1 -1
  275. package/dist/types/utils/buildFilesList.d.ts.map +1 -1
  276. package/dist/types/utils/chunkJSON.d.ts.map +1 -1
  277. package/dist/types/utils/formatter.d.ts.map +1 -1
  278. package/dist/types/utils/getChunk.d.ts.map +1 -1
  279. package/dist/types/utils/getContentExtension.d.ts.map +1 -1
  280. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -1
  281. package/dist/types/utils/getPathHash.d.ts.map +1 -1
  282. package/dist/types/utils/mergeChunks.d.ts.map +1 -1
  283. package/dist/types/utils/pLimit.d.ts.map +1 -1
  284. package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -1
  285. package/dist/types/utils/readDictionariesFromDisk.d.ts.map +1 -1
  286. package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -1
  287. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -1
  288. package/dist/types/utils/runOnce.d.ts.map +1 -1
  289. package/dist/types/utils/runParallel/bin.d.ts.map +1 -1
  290. package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -1
  291. package/dist/types/utils/runParallel/index.d.ts.map +1 -1
  292. package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -1
  293. package/dist/types/utils/runParallel/ps.d.ts.map +1 -1
  294. package/dist/types/utils/runParallel/runTask.d.ts.map +1 -1
  295. package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -1
  296. package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -1
  297. package/dist/types/utils/runParallel/wmic.d.ts.map +1 -1
  298. package/dist/types/utils/sortAlphabetically.d.ts.map +1 -1
  299. package/dist/types/utils/splitTextByLine.d.ts.map +1 -1
  300. package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -1
  301. package/dist/types/watcher.d.ts.map +1 -1
  302. package/dist/types/writeConfiguration/generateConfigurationContent.d.ts.map +1 -1
  303. package/dist/types/writeConfiguration/index.d.ts.map +1 -1
  304. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -1
  305. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -1
  306. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -1
  307. package/package.json +11 -11
  308. package/dist/types/intlayer/dist/types/index.d.ts +0 -4
@@ -1 +1 @@
1
- {"version":3,"file":"fetchDistantDictionaries.mjs","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,2BAA2B,OACtC,SACA,mBAC6B;CAC7B,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,aAAa,MAAM;CACrC,IAAI;EACF,MAAM,cAAc,oBAAoB,QAAW,MAAM;EAEzD,MAAM,0BAA0B,QAAQ;EAExC,MAAM,oBAAoB,OACxB,kBACuC;GACvC,iBAAiB,CACf;IACE;IACA,MAAM;IACN,QAAQ;GACV,CACF,CAAC;GAED,IAAI;IAKF,MAAM,qBAAoB,MAFlB,YAAY,WAAW,cAAc,aAAa,GAEZ;IAE9C,IAAI,CAAC,mBACH,MAAM,IAAI,MAAM,cAAc,cAAc,qBAAqB;IAGnE,iBAAiB,CACf;KAAE;KAAe,MAAM;KAAU,QAAQ;IAAU,CACrD,CAAC;IAED,OAAO;GACT,SAAS,OAAO;IACd,iBAAiB,CACf;KACE;KACA,MAAM;KACN,QAAQ;KACR,OAAO,6BAA6B,cAAc,IAAI;IACxD,CACF,CAAC;IACD;GACF;EACF;EAaA,QALuB,MANF,YACnB,yBACA,OAAO,kBAAkB,MAAM,kBAAkB,aAAa,CAChE,GAG8B,QAC3B,SACC,SAAS,MAGO;CACtB,SAAS,QAAQ;EACf,UAAU,GAAG,EAAE,wCAAwC,EAAE,OAAO,QAAQ,CAAC;EACzE,OAAO,CAAC;CACV;AACF"}
1
+ {"version":3,"file":"fetchDistantDictionaries.mjs","names":[],"sources":["../../src/fetchDistantDictionaries.ts"],"sourcesContent":["import { getIntlayerAPIProxy } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport type { DictionaryAPI } from '@intlayer/backend';\nimport { getAppLogger, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\nimport type { DictionariesStatus } from './loadDictionaries';\nimport { parallelize } from './utils/parallelize';\n\ntype FetchDistantDictionariesOptions = {\n dictionaryKeys: string[];\n newDictionariesPath?: string;\n logPrefix?: string;\n};\n\n/**\n * Fetch distant dictionaries and update the logger with their statuses.\n */\nexport const fetchDistantDictionaries = async (\n options: FetchDistantDictionariesOptions,\n onStatusUpdate?: (status: DictionariesStatus[]) => void\n): Promise<DictionaryAPI[]> => {\n const config = getConfiguration();\n const appLogger = getAppLogger(config);\n try {\n const intlayerAPI = getIntlayerAPIProxy(undefined, config);\n\n const distantDictionariesKeys = options.dictionaryKeys;\n // Process dictionaries in parallel with a concurrency limit\n const processDictionary = async (\n dictionaryKey: string\n ): Promise<DictionaryAPI | undefined> => {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'fetching',\n },\n ]);\n\n try {\n // Fetch the dictionary\n const getDictionaryResult =\n await intlayerAPI.dictionary.getDictionary(dictionaryKey);\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n onStatusUpdate?.([\n { dictionaryKey, type: 'remote', status: 'fetched' },\n ]);\n\n return distantDictionary;\n } catch (error) {\n onStatusUpdate?.([\n {\n dictionaryKey,\n type: 'remote',\n status: 'error',\n error: `Error fetching dictionary ${dictionaryKey}: ${error}`,\n },\n ]);\n return undefined;\n }\n };\n\n const result = await parallelize(\n distantDictionariesKeys,\n async (dictionaryKey) => await processDictionary(dictionaryKey)\n );\n\n // Remove undefined values\n const filteredResult = result.filter(\n (dict: DictionaryAPI | undefined): dict is DictionaryAPI =>\n dict !== undefined\n );\n\n return filteredResult;\n } catch (_error) {\n appLogger(`${x} Failed to fetch distant dictionaries`, { level: 'error' });\n return [];\n }\n};\n"],"mappings":";;;;;;;;;AAiBA,MAAa,2BAA2B,OACtC,SACA,mBAC6B;CAC7B,MAAM,SAAS,kBAAkB;CACjC,MAAM,YAAY,aAAa,OAAO;AACtC,KAAI;EACF,MAAM,cAAc,oBAAoB,QAAW,OAAO;EAE1D,MAAM,0BAA0B,QAAQ;EAExC,MAAM,oBAAoB,OACxB,kBACuC;AACvC,oBAAiB,CACf;IACE;IACA,MAAM;IACN,QAAQ;IACT,CACF,CAAC;AAEF,OAAI;IAKF,MAAM,qBAAoB,MAFlB,YAAY,WAAW,cAAc,cAAc,EAEb;AAE9C,QAAI,CAAC,kBACH,OAAM,IAAI,MAAM,cAAc,cAAc,sBAAsB;AAGpE,qBAAiB,CACf;KAAE;KAAe,MAAM;KAAU,QAAQ;KAAW,CACrD,CAAC;AAEF,WAAO;YACA,OAAO;AACd,qBAAiB,CACf;KACE;KACA,MAAM;KACN,QAAQ;KACR,OAAO,6BAA6B,cAAc,IAAI;KACvD,CACF,CAAC;AACF;;;AAeJ,UALuB,MANF,YACnB,yBACA,OAAO,kBAAkB,MAAM,kBAAkB,cAAc,CAChE,EAG6B,QAC3B,SACC,SAAS,OAGQ;UACd,QAAQ;AACf,YAAU,GAAG,EAAE,wCAAwC,EAAE,OAAO,SAAS,CAAC;AAC1E,SAAO,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n // Reject keys that contain path-unsafe characters.\n // A key is used as a filename component ({key}.json), so slashes, backslashes,\n // null bytes, or pure dot-segments can escape the output directory or break\n // dictionary resolution.\n // Allows alphanumeric characters, dashes, and underscores.\n // Allows dots, but not as the first or last character, and no consecutive dots.\n // Allows chinese or russian characters e.g. 你好\n const isInsecureKey = !/^[\\p{L}\\p{N}]+([._-][\\p{L}\\p{N}]+)*$/u.test(\n dictionary.key\n );\n\n if (isInsecureKey) {\n appLogger(\n `Insecure key ${colorizeKey(dictionary.key)} at ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')} - dictionary filtered out`,\n { level: 'error' }\n );\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":";;;;;;AAeA,MAAa,uBACX,YACA,eACA,YACY;CACZ,MAAM,YAAY,aAAa,aAAa;CAE5C,IAAI,CAAC,YAAY,OAAO;CAKxB,MAAM,WAHU,QACd,WAAW,aAAa,WAAW,OAAO,WAAW,aAAa,QAE7C,IAAI,UAAU;CACrC,MAAM,SAAS,QAAQ,WAAW,GAAG;CACrC,MAAM,aAAa,QAAQ,WAAW,OAAO;CAE7C,IAAI,CAAC,QAAQ;EACX,UAAU,GAAG,SAAS,yBAAyB,EAC7C,OAAO,QACT,CAAC;EAED,OAAO;CACT;CAaA,IAAI,CAJmB,wCAAwC,KAC7D,WAAW,GACb,GAEmB;EACjB,UACE,gBAAgB,YAAY,WAAW,GAAG,EAAE,MAAM,WAAW,WAAW,WAAW,WAAW,QAAQ,IAAI,aAAa,QAAQ,EAAE,6BACjI,EAAE,OAAO,QAAQ,CACnB;E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;EAEJ;;CAGF,OAAO;AACT;AAEA,MAAa,6BACX,cACA,eACA,aAEC,gBAAgB,CAAC,IAAI,QAAQ,eAC5B,oBAAoB,YAAY,eAAe,OAAO,CACxD"}
1
+ {"version":3,"file":"filterInvalidDictionaries.mjs","names":[],"sources":["../../src/filterInvalidDictionaries.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport {\n colorize,\n colorizeKey,\n colorizePath,\n getAppLogger,\n x,\n} from '@intlayer/config/logger';\nimport { getBasePlugins, getContent } from '@intlayer/core/interpreter';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport type { Dictionary } from '@intlayer/types/dictionary';\nimport { formatLocale, formatPath } from './utils/formatter';\n\ntype IsInvalidDictionaryOptions = { checkSchema: boolean };\n\nexport const isInvalidDictionary = (\n dictionary: Dictionary | undefined,\n configuration?: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): boolean => {\n const appLogger = getAppLogger(configuration);\n\n if (!dictionary) return false;\n\n const isLocal = Boolean(\n dictionary.location === 'local' || typeof dictionary.filePath === 'string'\n );\n const location = isLocal ? 'Local' : 'Remote';\n const hasKey = Boolean(dictionary.key);\n const hasContent = Boolean(dictionary.content);\n\n if (!hasKey) {\n appLogger(`${location} dictionary has no key`, {\n level: 'error',\n });\n\n return false;\n }\n\n // Reject keys that contain path-unsafe characters.\n // A key is used as a filename component ({key}.json), so slashes, backslashes,\n // null bytes, or pure dot-segments can escape the output directory or break\n // dictionary resolution.\n // Allows alphanumeric characters, dashes, and underscores.\n // Allows dots, but not as the first or last character, and no consecutive dots.\n // Allows chinese or russian characters e.g. 你好\n const isInsecureKey = !/^[\\p{L}\\p{N}]+([._-][\\p{L}\\p{N}]+)*$/u.test(\n dictionary.key\n );\n\n if (isInsecureKey) {\n appLogger(\n `Insecure key ${colorizeKey(dictionary.key)} at ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')} - dictionary filtered out`,\n { level: 'error' }\n );\n return false;\n }\n\n if (!hasContent) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has no content - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n return false;\n }\n\n if (dictionary.schema && options?.checkSchema) {\n const isAsync =\n typeof dictionary.content === 'function' ||\n (typeof dictionary.content === 'object' &&\n dictionary.content !== null &&\n typeof (dictionary.content as any).then === 'function');\n\n if (!isAsync) {\n const locales = configuration?.internationalization?.locales ?? [];\n const isStrict =\n configuration?.internationalization.strictMode === 'strict';\n\n const schema =\n typeof dictionary.schema === 'string'\n ? configuration?.schemas?.[dictionary.schema]\n : undefined;\n\n if (schema && typeof schema.safeParse === 'function') {\n for (const locale of locales) {\n const resolvedContent = getContent(\n dictionary.content,\n {\n dictionaryKey: dictionary.key,\n keyPath: [],\n locale,\n },\n getBasePlugins(locale, !isStrict)\n );\n const result = (schema as any).safeParse(resolvedContent);\n\n if (!result.success) {\n appLogger(\n `${location} dictionary ${colorizeKey(dictionary.key)} has invalid content according to schema ${colorize(dictionary.schema as string, ANSIColors.ORANGE)} for locale ${formatLocale(locale)} - ${dictionary.filePath ? formatPath(dictionary.filePath) : colorizePath('Remote')}`,\n {\n level: 'error',\n }\n );\n\n result.error.issues.forEach((issue: any) => {\n appLogger(\n `${x} Error: ${colorizeKey(dictionary.key)} - ${formatLocale(locale)} - ${colorize(`${issue.path.join('.')}:`, ANSIColors.BLUE)} ${colorize(issue.message, ANSIColors.GREY)}`,\n {\n level: 'error',\n }\n );\n });\n\n return false;\n }\n }\n }\n }\n }\n\n return true;\n};\n\nexport const filterInvalidDictionaries = (\n dictionaries: (Dictionary | undefined)[] | undefined,\n configuration: IntlayerConfig,\n options?: IsInvalidDictionaryOptions\n): Dictionary[] =>\n (dictionaries ?? [])?.filter((dictionary) =>\n isInvalidDictionary(dictionary, configuration, options)\n ) as Dictionary[];\n"],"mappings":";;;;;;AAeA,MAAa,uBACX,YACA,eACA,YACY;CACZ,MAAM,YAAY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GAAG,SAAS,cAAc,YAAY,WAAW,IAAI,CAAC,2CAA2C,SAAS,WAAW,QAAkB,WAAW,OAAO,CAAC,cAAc,aAAa,OAAO,CAAC,KAAK,WAAW,WAAW,WAAW,WAAW,SAAS,GAAG,aAAa,SAAS,IAChR,EACE,OAAO,SACR,CACF;AAED,YAAO,MAAM,OAAO,SAAS,UAAe;AAC1C,gBACE,GAAG,EAAE,UAAU,YAAY,WAAW,IAAI,CAAC,KAAK,aAAa,OAAO,CAAC,KAAK,SAAS,GAAG,MAAM,KAAK,KAAK,IAAI,CAAC,IAAI,WAAW,KAAK,CAAC,GAAG,SAAS,MAAM,SAAS,WAAW,KAAK,IAC3K,EACE,OAAO,SACR,CACF;OACD;AAEF,YAAO;;;;;AAOjB,QAAO;;AAGT,MAAa,6BACX,cACA,eACA,aAEC,gBAAgB,EAAE,GAAG,QAAQ,eAC5B,oBAAoB,YAAY,eAAe,QAAQ,CACxD"}
@@ -1 +1 @@
1
- {"version":3,"file":"formatDictionary.mjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToPortableObjectFormatter,\n intlayerToVueI18nFormatter,\n portableObjectToIntlayerFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'po') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: portableObjectToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = async (\n dictionaries: Dictionary[]\n): Promise<Dictionary[]> => Promise.all(dictionaries.map(formatDictionary));\n\nexport const formatDictionaryOutput = (\n dictionary: Dictionary,\n format: Dictionary['format']\n) => {\n if (format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'po') {\n return {\n ...dictionary,\n format: 'po',\n content: intlayerToPortableObjectFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (\n dictionaries: Dictionary[],\n format: Dictionary['format']\n) =>\n dictionaries.map((dictionary) => formatDictionaryOutput(dictionary, format));\n"],"mappings":";;;AAYA,MAAa,oBAAoB,eAAuC;CACtE,IAAI,WAAW,WAAW,OACxB,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,OAAO;CACpD;CAGF,IAAI,WAAW,WAAW,WACxB,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,OAAO;CACxD;CAGF,IAAI,WAAW,WAAW,YACxB,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,OAAO;CACxD;CAGF,IAAI,WAAW,WAAW,MACxB,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,kCAAkC,WAAW,OAAO;CAC/D;CAGF,OAAO;AACT;AAEA,MAAa,qBAAqB,OAChC,iBAC0B,QAAQ,IAAI,aAAa,IAAI,gBAAgB,CAAC;AAE1E,MAAa,0BACX,YACA,WACG;CACH,IAAI,WAAW,OACb,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,OAAO;CACpD;CAGF,IAAI,WAAW,WACb,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,OAAO;CACxD;CAGF,IAAI,WAAW,YACb,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,OAAO;CACxD;CAGF,IAAI,WAAW,WAAW,MACxB,OAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,kCAAkC,WAAW,OAAO;CAC/D;CAGF,OAAO;AACT;AAEA,MAAa,4BACX,cACA,WAEA,aAAa,KAAK,eAAe,uBAAuB,YAAY,MAAM,CAAC"}
1
+ {"version":3,"file":"formatDictionary.mjs","names":[],"sources":["../../src/formatDictionary.ts"],"sourcesContent":["import {\n i18nextToIntlayerFormatter,\n icuToIntlayerFormatter,\n intlayerToI18nextFormatter,\n intlayerToICUFormatter,\n intlayerToPortableObjectFormatter,\n intlayerToVueI18nFormatter,\n portableObjectToIntlayerFormatter,\n vueI18nToIntlayerFormatter,\n} from '@intlayer/core/messageFormat';\nimport type { Dictionary } from '@intlayer/types/dictionary';\n\nexport const formatDictionary = (dictionary: Dictionary): Dictionary => {\n if (dictionary.format === 'icu') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: icuToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'i18next') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: i18nextToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: vueI18nToIntlayerFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'po') {\n return {\n ...dictionary,\n format: 'intlayer',\n content: portableObjectToIntlayerFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionaries = async (\n dictionaries: Dictionary[]\n): Promise<Dictionary[]> => Promise.all(dictionaries.map(formatDictionary));\n\nexport const formatDictionaryOutput = (\n dictionary: Dictionary,\n format: Dictionary['format']\n) => {\n if (format === 'icu') {\n return {\n ...dictionary,\n format: 'icu',\n content: intlayerToICUFormatter(dictionary.content),\n };\n }\n\n if (format === 'i18next') {\n return {\n ...dictionary,\n format: 'i18next',\n content: intlayerToI18nextFormatter(dictionary.content),\n };\n }\n\n if (format === 'vue-i18n') {\n return {\n ...dictionary,\n format: 'vue-i18n',\n content: intlayerToVueI18nFormatter(dictionary.content),\n };\n }\n\n if (dictionary.format === 'po') {\n return {\n ...dictionary,\n format: 'po',\n content: intlayerToPortableObjectFormatter(dictionary.content),\n };\n }\n\n return dictionary;\n};\n\nexport const formatDictionariesOutput = (\n dictionaries: Dictionary[],\n format: Dictionary['format']\n) =>\n dictionaries.map((dictionary) => formatDictionaryOutput(dictionary, format));\n"],"mappings":";;;AAYA,MAAa,oBAAoB,eAAuC;AACtE,KAAI,WAAW,WAAW,MACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,WAAW,UACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,WACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,KACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,kCAAkC,WAAW,QAAQ;EAC/D;AAGH,QAAO;;AAGT,MAAa,qBAAqB,OAChC,iBAC0B,QAAQ,IAAI,aAAa,IAAI,iBAAiB,CAAC;AAE3E,MAAa,0BACX,YACA,WACG;AACH,KAAI,WAAW,MACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,uBAAuB,WAAW,QAAQ;EACpD;AAGH,KAAI,WAAW,UACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WACb,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,2BAA2B,WAAW,QAAQ;EACxD;AAGH,KAAI,WAAW,WAAW,KACxB,QAAO;EACL,GAAG;EACH,QAAQ;EACR,SAAS,kCAAkC,WAAW,QAAQ;EAC/D;AAGH,QAAO;;AAGT,MAAa,4BACX,cACA,WAEA,aAAa,KAAK,eAAe,uBAAuB,YAAY,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getContentDeclarationFileTemplate.mjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'yaml': {\n const yamlLines = [\n `key: ${key}`,\n ...(fileParams.locale ? [`locale: ${fileParams.locale}`] : []),\n ...(fileParams.title\n ? [`title: ${JSON.stringify(fileParams.title)}`]\n : []),\n ...(fileParams.description\n ? [`description: ${JSON.stringify(fileParams.description)}`]\n : []),\n ...(fileParams.tags?.length\n ? [\n 'tags:',\n ...(fileParams.tags as string[]).map(\n (tag) => ` - ${JSON.stringify(tag)}`\n ),\n ]\n : []),\n 'content: {}',\n ];\n return `${yamlLines.join('\\n')}\\n`;\n }\n\n case 'md': {\n const mdFrontmatterLines = [\n `key: ${key}`,\n ...(fileParams.locale ? [`locale: ${fileParams.locale}`] : []),\n ...(fileParams.title\n ? [`title: ${JSON.stringify(fileParams.title)}`]\n : []),\n ...(fileParams.description\n ? [`description: ${JSON.stringify(fileParams.description)}`]\n : []),\n ...(fileParams.tags?.length\n ? [\n 'tags:',\n ...(fileParams.tags as string[]).map(\n (t) => ` - ${JSON.stringify(t)}`\n ),\n ]\n : []),\n ];\n return ['---', ...mdFrontmatterLines, '---', '', ''].join('\\n');\n }\n\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":";;;AAGA,MAAa,oCAAoC,OAC/C,KACA,QACA,aAAkC,CAAC,GACnC,eACG;CACH,MAAM,eAAe,qBAAqB,GAAG;CAC7C,MAAM,OAAO,aAAa,OAAO,CAAC,E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C,UAAU,KAAK,UAAU,WAAW,KAAK,GAAG,IAC7C,CAAC;IACL,GAAI,WAAW,cACX,CAAC,gBAAgB,KAAK,UAAU,WAAW,WAAW,GAAG,IACzD,CAAC;IACL,GAAI,WAAW,MAAM,SACjB,CACE,SACA,GAAI,WAAW,KAAkB,KAC9B,MAAM,OAAO,KAAK,UAAU,CAAC,GAChC,CACF,IACA,CAAC;GAE4B;GAAG;GAAO;GAAI;EAAE,EAAE,KAAK,IAAI;EAGhE,KAAK,MACH,OAAO;GACL;GACA;GACA,SAAS,KAAK,YAAY,QAAQ,aAAa,cAAc;GAC7D;GACA,kBAAkB,KAAK;GACvB;EACF,EAAE,KAAK,IAAI;EAEb,KAAK,OACH,OAAO;GACL;GACA,SAAS,KAAK,YAAY,QAAQ;GAClC;GACA,oBAAoB,KAAK;GACzB;EACF,EAAE,KAAK,IAAI;EAEb,KAAK;EACL,KAAK;EACL,KAAK,SACH,OAAO,CAAC,SAAS,EAAE,EAAE,KAAK,IAAI;EAEhC,SACE,OAAO;GACL;GACA,SAAS,KAAK,YAAY,QAAQ;GAClC;GACA,kBAAkB,KAAK;GACvB;EACF,EAAE,KAAK,IAAI;CACf;AACF"}
1
+ {"version":3,"file":"getContentDeclarationFileTemplate.mjs","names":[],"sources":["../../../src/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.ts"],"sourcesContent":["import { kebabCaseToCamelCase } from '@intlayer/config/utils';\nimport type { Format } from '../utils/getFormatFromExtension';\n\nexport const getContentDeclarationFileTemplate = async (\n key: string,\n format: Format,\n fileParams: Record<string, any> = {},\n noMetadata?: boolean\n) => {\n const camelCaseKey = kebabCaseToCamelCase(key);\n const name = camelCaseKey.charAt(0).toLowerCase() + camelCaseKey.slice(1);\n\n const fileParamsString = Object.entries(fileParams)\n .filter(([, value]) => value !== undefined)\n .map(([paramKey, value]) => {\n const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(paramKey)\n ? paramKey\n : JSON.stringify(paramKey);\n\n const formattedValue =\n typeof value === 'object' || typeof value === 'string'\n ? JSON.stringify(value)\n : value;\n\n return `\\n ${formattedKey}: ${formattedValue},`;\n })\n .join('');\n\n let content: string;\n\n if (noMetadata) {\n content = '{}';\n } else if (format === 'json' || format === 'jsonc' || format === 'json5') {\n content = [\n '{',\n ' \"$schema\": \"https://intlayer.org/schema.json\",',\n ` \"key\": \"${key}\",${fileParamsString}`,\n ' \"content\": {',\n ' }',\n '}',\n ].join('\\n');\n } else {\n content = [\n '{',\n ` key: '${key}',${fileParamsString}`,\n ' content: {',\n ' },',\n '}',\n ].join('\\n');\n }\n\n const jsdoc = `/** @type {import('intlayer').Dictionary${noMetadata ? \"['content']\" : ''}} **/`;\n const satisfiesType = noMetadata ? \"Dictionary['content']\" : 'Dictionary';\n\n switch (format) {\n case 'yaml': {\n const yamlLines = [\n `key: ${key}`,\n ...(fileParams.locale ? [`locale: ${fileParams.locale}`] : []),\n ...(fileParams.title\n ? [`title: ${JSON.stringify(fileParams.title)}`]\n : []),\n ...(fileParams.description\n ? [`description: ${JSON.stringify(fileParams.description)}`]\n : []),\n ...(fileParams.tags?.length\n ? [\n 'tags:',\n ...(fileParams.tags as string[]).map(\n (tag) => ` - ${JSON.stringify(tag)}`\n ),\n ]\n : []),\n 'content: {}',\n ];\n return `${yamlLines.join('\\n')}\\n`;\n }\n\n case 'md': {\n const mdFrontmatterLines = [\n `key: ${key}`,\n ...(fileParams.locale ? [`locale: ${fileParams.locale}`] : []),\n ...(fileParams.title\n ? [`title: ${JSON.stringify(fileParams.title)}`]\n : []),\n ...(fileParams.description\n ? [`description: ${JSON.stringify(fileParams.description)}`]\n : []),\n ...(fileParams.tags?.length\n ? [\n 'tags:',\n ...(fileParams.tags as string[]).map(\n (t) => ` - ${JSON.stringify(t)}`\n ),\n ]\n : []),\n ];\n return ['---', ...mdFrontmatterLines, '---', '', ''].join('\\n');\n }\n\n case 'ts':\n return [\n \"import { type Dictionary } from 'intlayer';\",\n '',\n `const ${name}Content = ${content} satisfies ${satisfiesType};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'cjs':\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `module.exports = ${name}Content;`,\n '',\n ].join('\\n');\n\n case 'json':\n case 'jsonc':\n case 'json5':\n return [content, ''].join('\\n');\n\n default: // esm\n return [\n jsdoc,\n `const ${name}Content = ${content};`,\n '',\n `export default ${name}Content;`,\n '',\n ].join('\\n');\n }\n};\n"],"mappings":";;;AAGA,MAAa,oCAAoC,OAC/C,KACA,QACA,aAAkC,EAAE,EACpC,eACG;CACH,MAAM,eAAe,qBAAqB,IAAI;CAC9C,MAAM,OAAO,aAAa,OAAO,EAAE,CAAC,aAAa,GAAG,aAAa,MAAM,EAAE;CAEzE,MAAM,mBAAmB,OAAO,QAAQ,WAAW,CAChD,QAAQ,GAAG,WAAW,UAAU,OAAU,CAC1C,KAAK,CAAC,UAAU,WAAW;AAU1B,SAAO,OATc,6BAA6B,KAAK,SAAS,GAC5D,WACA,KAAK,UAAU,SAAS,CAOD,IAJzB,OAAO,UAAU,YAAY,OAAO,UAAU,WAC1C,KAAK,UAAU,MAAM,GACrB,MAEwC;GAC9C,CACD,KAAK,GAAG;CAEX,IAAI;AAEJ,KAAI,WACF,WAAU;UACD,WAAW,UAAU,WAAW,WAAW,WAAW,QAC/D,WAAU;EACR;EACA;EACA,aAAa,IAAI,IAAI;EACrB;EACA;EACA;EACD,CAAC,KAAK,KAAK;KAEZ,WAAU;EACR;EACA,WAAW,IAAI,IAAI;EACnB;EACA;EACA;EACD,CAAC,KAAK,KAAK;CAGd,MAAM,QAAQ,2CAA2C,aAAa,gBAAgB,GAAG;CACzF,MAAM,gBAAgB,aAAa,0BAA0B;AAE7D,SAAQ,QAAR;EACE,KAAK,OAoBH,QAAO,GAAG;GAlBR,QAAQ;GACR,GAAI,WAAW,SAAS,CAAC,WAAW,WAAW,SAAS,GAAG,EAAE;GAC7D,GAAI,WAAW,QACX,CAAC,UA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dditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,YAAY,aAAa,MAAM;CAGrC,UAAU,6BAA6B,WAAW,QAAQ,KAAK,EAC7D,WAAW,KACb,CAAC;CAID,MAAM,qBAAqB,MAAM,gBAAgB,MAFhB,sBAAsB,UAAU,MAAM,GAEF,MAAM;CAM3E,MAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,CAAC,CAC7C,EAAE,KAAK,eAAe,WAAW,UAEG,GAAG,MAAM;CAE7C,MAAM,2BAA2B,MAAM;CAEvC,UAAU,sBAAsB,EAC9B,WAAW,KACb,CAAC;CAED,MAAM,yBAAyB,MAAM;CAErC,UAAU,6BAA6B,EACrC,WAAW,KACb,CAAC;CAID,WAAW,MAAM,UAAU,OAAO,WAAW,CAAC,GAAG;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;EAErD,MAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;GACF;GACA,eAAe;EACjB,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"handleAdditionalContentDeclarationFile.mjs","names":[],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { createModuleAugmentation, createTypes } from './createType/index';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleAdditionalContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Additional file detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n await createDictionaryEntryPoint(config);\n\n appLogger('Dictionaries built', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;AAQA,MAAa,yCAAyC,OACpD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,6BAA6B,WAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAM,gBAAgB,MAFhB,sBAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAEI,EAAE,OAAO;AAE9C,OAAM,2BAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,OAAM,yBAAyB,OAAO;AAEtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileChange.mjs","names":[],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Types first — types must be ready before anything triggers a bundler rebuild.\n // esbuild (used by Angular, Vite, etc.) only watches files in its JS bundle graph; it does\n // NOT watch .intlayer/types/*.ts (TypeScript-only files). Generating types here, before\n // updating the entry point, guarantees that when the entry point write below fires esbuild's\n // file watcher the types are already up-to-date.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n // Always regenerate the module augmentation so that structural changes to existing\n // dictionaries (new content keys, type changes) are reflected in intlayer.d.ts.\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Rebuild Entry Point\n // Only needed when the *list* of dictionaries changed (Add/Remove/Rename).\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Force-write the entry point files so esbuild detects a change and triggers a fresh rebuild\n // now that all types are ready. Without this, the only rebuild esbuild sees is the one\n // triggered by buildDictionary's JSON writes above — which races against type generation\n // and often runs before the new .intlayer/types/*.ts files are on disk.\n const { mainDir } = config.system;\n\n for (const extension of config.build.outputFormat) {\n const entryPointPath = join(mainDir, `dictionaries.${extension}`);\n\n if (existsSync(entryPointPath)) {\n const content = await readFile(entryPointPath, 'utf-8');\n await writeFile(entryPointPath, content);\n }\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,YAAY,aAAa,MAAM;CAGrC,UAAU,oBAAoB,WAAW,QAAQ,KAAK,EACpD,WAAW,KACb,CAAC;CAED,MAAM,uBAAiC,MAAM,yBAAyB,MAAM;CAE5E,MAAM,qBAAqB,MAAM,sBAAsB,UAAU,MAAM;CAEvE,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;CAC3E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,CAAC,CAC7C;CACA,MAAM,2BAA2B,oBAAoB,KAClD,eAAe,WAAW,cAC7B;CAEA,MAAM,EAAE,aAAa,eAAe,MAAM,+BACxC,UACA,mBAAmB,KAAK,eAAe,WAAW,GAAG,GACrD,MACF;CAEA,MAAM,qBAAqB,yBAAyB,MACjD,0BACC,CAAC,qBAAqB,SAAS,qBAAqB,CACxD;CAWA,MAAM,YAJsB,oBAAoB,KAC7C,eAAe,WAAW,UAGO,GAAG,MAAM;CAC7C,UAAU,0BAA0B,EAClC,WAAW,KACb,CAAC;CAID,MAAM,yBAAyB,MAAM;CACrC,UAAU,6BAA6B,EACrC,WAAW,KACb,CAAC;CAID,IAAI,cAAc,oBAIhB;MAAI,CAAC,YAAY;GACf,MAAM,2BAA2B,QAAQ,EAAE,YAAY,CAAC;GACxD,UAAU,yBAAyB,EACjC,WAAW,KACb,CAAC;EACH;;CAOF,MAAM,EAAE,YAAY,OAAO;CAE3B,KAAK,MAAM,aAAa,OAAO,MAAM,cAAc;EACjD,MAAM,iBAAiB,KAAK,SAAS,gBAAgB,WAAW;EAEhE,IAAI,WAAW,cAAc,GAE3B,MAAM,UAAU,gBAAgB,MADV,SAAS,gBAAgB,OAAO,CACf;CAE3C;CAIA,WAAW,MAAM,UAAU,OAAO,WAAW,CAAC,GAAG;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;EAErD,MAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;GACF;GACA,eAAe;EACjB,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"handleContentDeclarationFileChange.mjs","names":[],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createDictionaryEntryPoint } from './createDictionaryEntryPoint/createDictionaryEntryPoint';\nimport { getBuiltDictionariesPath } from './createDictionaryEntryPoint/getBuiltDictionariesPath';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileChange = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Change detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const allDictionariesPaths: string[] = await getBuiltDictionariesPath(config);\n\n const localeDictionaries = await loadLocalDictionaries(filePath, config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n const updatedDictionaries = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n );\n const updatedDictionariesPaths = updatedDictionaries.map(\n (dictionary) => dictionary.dictionaryPath\n );\n\n const { excludeKeys, hasRebuilt } = await cleanRemovedContentDeclaration(\n filePath,\n localeDictionaries.map((dictionary) => dictionary.key),\n config\n );\n\n const hasNewDictionaries = updatedDictionariesPaths.some(\n (updatedDictionaryPath) =>\n !allDictionariesPaths.includes(updatedDictionaryPath)\n );\n\n // Rebuild Types first — types must be ready before anything triggers a bundler rebuild.\n // esbuild (used by Angular, Vite, etc.) only watches files in its JS bundle graph; it does\n // NOT watch .intlayer/types/*.ts (TypeScript-only files). Generating types here, before\n // updating the entry point, guarantees that when the entry point write below fires esbuild's\n // file watcher the types are already up-to-date.\n const dictionariesToBuild = updatedDictionaries.map(\n (dictionary) => dictionary.dictionary\n );\n\n await createTypes(dictionariesToBuild, config);\n appLogger('TypeScript types built', {\n isVerbose: true,\n });\n\n // Always regenerate the module augmentation so that structural changes to existing\n // dictionaries (new content keys, type changes) are reflected in intlayer.d.ts.\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Rebuild Entry Point\n // Only needed when the *list* of dictionaries changed (Add/Remove/Rename).\n if (hasRebuilt || hasNewDictionaries) {\n // If hasRebuilt is true, cleanRemovedContentDeclaration has already updated the entry point\n // to remove the old keys (and it likely included the new ones if they were already on disk).\n // If NOT hasRebuilt, we explicitly need to update the entry point to include the new dictionaries.\n if (!hasRebuilt) {\n await createDictionaryEntryPoint(config, { excludeKeys });\n appLogger('Dictionary list built', {\n isVerbose: true,\n });\n }\n }\n\n // Force-write the entry point files so esbuild detects a change and triggers a fresh rebuild\n // now that all types are ready. Without this, the only rebuild esbuild sees is the one\n // triggered by buildDictionary's JSON writes above — which races against type generation\n // and often runs before the new .intlayer/types/*.ts files are on disk.\n const { mainDir } = config.system;\n\n for (const extension of config.build.outputFormat) {\n const entryPointPath = join(mainDir, `dictionaries.${extension}`);\n\n if (existsSync(entryPointPath)) {\n const content = await readFile(entryPointPath, 'utf-8');\n await writeFile(entryPointPath, content);\n }\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;;;;AAcA,MAAa,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,oBAAoB,WAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAEF,MAAM,uBAAiC,MAAM,yBAAyB,OAAO;CAE7E,MAAM,qBAAqB,MAAM,sBAAsB,UAAU,OAAO;CAExE,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,OAAO;CAC5E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C;CACD,MAAM,2BAA2B,oBAAoB,KAClD,eAAe,WAAW,eAC5B;CAED,MAAM,EAAE,aAAa,eAAe,MAAM,+BACxC,UACA,mBAAmB,KAAK,eAAe,WAAW,IAAI,EACtD,OACD;CAED,MAAM,qBAAqB,yBAAyB,MACjD,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD;AAWD,OAAM,YAJsB,oBAAoB,KAC7C,eAAe,WAAW,WAGQ,EAAE,OAAO;AAC9C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAIF,OAAM,yBAAyB,OAAO;AACtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,KAAI,cAAc,oBAIhB;MAAI,CAAC,YAAY;AACf,SAAM,2BAA2B,QAAQ,EAAE,aAAa,CAAC;AACzD,aAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;;CAQN,MAAM,EAAE,YAAY,OAAO;AAE3B,MAAK,MAAM,aAAa,OAAO,MAAM,cAAc;EACjD,MAAM,iBAAiB,KAAK,SAAS,gBAAgB,YAAY;AAEjE,MAAI,WAAW,eAAe,CAE5B,OAAM,UAAU,gBAAgB,MADV,SAAS,gBAAgB,QAAQ,CACf;;AAM5C,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileMoved.mjs","names":[],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":";;;;;;;AAOA,MAAa,oCAAoC,OAC/C,aACA,aACA,WACG;CACH,MAAM,YAAY,aAAa,MAAM;CAErC,UACE,mBAAmB,WAAW,WAAW,EAAE,MAAM,WAAW,WAAW,KACvE,EACE,WAAW,KACb,CACF;CAEA,IAAI,aAAuB,CAAC;CAE5B,IAAI;EAQF,cAAa,MAJuB,sBAClC,aACA,MACF,GACmC,KAAK,MAAM,EAAE,GAAG;CACrD,QAAQ;EACN,UACE,iDAAiD,WAAW,WAAW,KACvE,EACE,WAAW,KACb,CACF;CAGF;CAMA,MAAM,+BAA+B,aAAa,YAAY,MAAM;CAKpE,MAAM,mCAAmC,aAAa,MAAM;AAC9D"}
1
+ {"version":3,"file":"handleContentDeclarationFileMoved.mjs","names":[],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { handleContentDeclarationFileChange } from './handleContentDeclarationFileChange';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleContentDeclarationFileMoved = async (\n oldFilePath: string,\n newFilePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n appLogger(\n `File moved from ${formatPath(oldFilePath)} to ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n\n let keysToKeep: string[] = [];\n\n try {\n // Pre-load the new file to identify the keys inside it.\n // We need to pass these keys to the cleaner so it knows NOT to completely delete\n // the dictionary artifacts (types/json) if the key has simply moved to a new file.\n const newLocaleDictionaries = await loadLocalDictionaries(\n newFilePath,\n config\n );\n keysToKeep = newLocaleDictionaries.map((d) => d.key);\n } catch {\n appLogger(\n `Error parsing new file during move operation: ${formatPath(newFilePath)}`,\n {\n isVerbose: true,\n }\n );\n // Proceed with empty keysToKeep; this will result in the old dictionary being cleaned up\n // entirely, and the new one being re-created in the next step.\n }\n\n // Clean up the artifacts associated with the old file path.\n // By passing 'keysToKeep', we instruct the cleaner to remove the specific file association\n // (filePath reference) from the dictionaries, but preserve the dictionary Entry Point and Types\n // if the key is still present in the new file.\n await cleanRemovedContentDeclaration(oldFilePath, keysToKeep, config);\n\n // Process the new file.\n // This will add the new file association, rebuild the dictionary JSONs with the new path,\n // and ensure types and module augmentation are up to date.\n await handleContentDeclarationFileChange(newFilePath, config);\n};\n"],"mappings":";;;;;;;AAOA,MAAa,oCAAoC,OAC/C,aACA,aACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAEtC,WACE,mBAAmB,WAAW,YAAY,CAAC,MAAM,WAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;CAED,IAAI,aAAuB,EAAE;AAE7B,KAAI;AAQF,gBAAa,MAJuB,sBAClC,aACA,OACD,EACkC,KAAK,MAAM,EAAE,IAAI;SAC9C;AACN,YACE,iDAAiD,WAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;;AASH,OAAM,+BAA+B,aAAa,YAAY,OAAO;AAKrE,OAAM,mCAAmC,aAAa,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"handleUnlinkedContentDeclarationFile.mjs","names":[],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,uCAAuC,OAClD,UACA,WACG;CACH,MAAM,YAAY,aAAa,MAAM;CAGrC,UAAU,sBAAsB,WAAW,QAAQ,KAAK,EACtD,WAAW,KACb,CAAC;CAQD,MAAM,qBAAqB,MAAM,uBAJX,MAFQ,iBAAiB,MAAM,GAEzB,QACzB,SAAS,UAAU,IAAI,MAAM,UAAU,QAAQ,CAGiB,GAAG,MAAM;CAE5E,MAAM,+BAA+B,UAAU,CAAC,GAAG,MAAM;CAEzD,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,MAAM;CAM3E,MAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,CAAC,CAC7C,EAAE,KAAK,eAAe,WAAW,UAEG,GAAG,MAAM;CAE7C,UAAU,wBAAwB,EAChC,WAAW,KACb,CAAC;CAED,MAAM,yBAAyB,MAAM;CAErC,UAAU,6BAA6B,EACrC,WAAW,KACb,CAAC;CAID,WAAW,MAAM,UAAU,OAAO,WAAW,CAAC,GAAG;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;EAErD,MAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;GACF;GACA,eAAe;EACjB,CAAC;CACH;AACF"}
1
+ {"version":3,"file":"handleUnlinkedContentDeclarationFile.mjs","names":[],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config/logger';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { buildDictionary } from './buildIntlayerDictionary/buildIntlayerDictionary';\nimport { cleanRemovedContentDeclaration } from './cleanRemovedContentDeclaration';\nimport { createTypes } from './createType';\nimport { createModuleAugmentation } from './createType/createModuleAugmentation';\nimport { listDictionaries } from './listDictionariesPath';\nimport { loadLocalDictionaries } from './loadDictionaries/loadLocalDictionaries';\nimport { formatPath } from './utils/formatter';\n\nexport const handleUnlinkedContentDeclarationFile = async (\n filePath: string,\n config: IntlayerConfig\n) => {\n const appLogger = getAppLogger(config);\n\n // Process the file with the functionToRun\n appLogger(`Unlinked detected: ${formatPath(filePath)}`, {\n isVerbose: true,\n });\n\n const files: string[] = await listDictionaries(config);\n\n const existingFiles = files.filter(\n (file) => normalize(file) !== normalize(filePath)\n );\n\n const localeDictionaries = await loadLocalDictionaries(existingFiles, config);\n\n await cleanRemovedContentDeclaration(filePath, [], config);\n\n const dictionariesOutput = await buildDictionary(localeDictionaries, config);\n\n const dictionariesToBuild = Object.values(\n dictionariesOutput?.mergedDictionaries ?? {}\n ).map((dictionary) => dictionary.dictionary);\n\n await createTypes(dictionariesToBuild, config);\n\n appLogger('Dictionaries rebuilt', {\n isVerbose: true,\n });\n\n await createModuleAugmentation(config);\n\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of config.plugins ?? []) {\n const { unmergedDictionaries, mergedDictionaries } = dictionariesOutput;\n\n await plugin.afterBuild?.({\n dictionaries: {\n unmergedDictionaries,\n mergedDictionaries,\n },\n configuration: config,\n });\n }\n};\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,uCAAuC,OAClD,UACA,WACG;CACH,MAAM,YAAY,aAAa,OAAO;AAGtC,WAAU,sBAAsB,WAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAQF,MAAM,qBAAqB,MAAM,uBAJX,MAFQ,iBAAiB,OAAO,EAE1B,QACzB,SAAS,UAAU,KAAK,KAAK,UAAU,SAAS,CAGiB,EAAE,OAAO;AAE7E,OAAM,+BAA+B,UAAU,EAAE,EAAE,OAAO;CAE1D,MAAM,qBAAqB,MAAM,gBAAgB,oBAAoB,OAAO;AAM5E,OAAM,YAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAEI,EAAE,OAAO;AAE9C,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAM,yBAAyB,OAAO;AAEtC,WAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;AAIF,YAAW,MAAM,UAAU,OAAO,WAAW,EAAE,EAAE;EAC/C,MAAM,EAAE,sBAAsB,uBAAuB;AAErD,QAAM,OAAO,aAAa;GACxB,cAAc;IACZ;IACA;IACD;GACD,eAAe;GAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateAstroConfig,\n updateNextConfig,\n updateNuxtConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Intlayer Language Server (Go-to-Definition from getter keys to .content files)\n LSP: 'https://intlayer.org/doc/lsp.md',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * OPTIONS\n */\nexport type InitOptions = {\n noGitignore?: boolean;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string, options?: InitOptions) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (!options?.noGitignore && (await exists(rootDir, gitignorePath))) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK VS CODE LSP SETTINGS\n const settingsJsonPath = join(vscodeDir, 'settings.json');\n\n try {\n let settingsConfig: Record<string, unknown> = {};\n\n if (await exists(rootDir, settingsJsonPath)) {\n const content = await readFileFromRoot(rootDir, settingsJsonPath);\n settingsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n let settingsUpdated = false;\n\n if (!settingsConfig['intlayer.languageServer.command']) {\n settingsConfig['intlayer.languageServer.command'] = 'npx';\n settingsUpdated = true;\n }\n\n if (!settingsConfig['intlayer.languageServer.args']) {\n settingsConfig['intlayer.languageServer.args'] = ['@intlayer/lsp'];\n settingsUpdated = true;\n }\n\n if (settingsUpdated) {\n await writeFileToRoot(\n rootDir,\n settingsJsonPath,\n JSON.stringify(settingsConfig, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(settingsJsonPath)} with LSP configuration`\n );\n } else {\n logger(\n `${v} ${colorizePath(settingsJsonPath)} already includes LSP configuration`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(settingsJsonPath)}. You may need to add the LSP settings manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK OTHER FRAMEWORKS CONFIG\n const astroConfigs = [\n 'astro.config.mjs',\n 'astro.config.js',\n 'astro.config.ts',\n 'astro.config.cjs',\n ];\n\n for (const file of astroConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n\n if (file.startsWith('astro.config.')) {\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('astro-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateAstroConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(\n `${v} Updated ${colorizePath(file)} to include Intlayer integration`\n );\n }\n }\n break;\n }\n }\n\n const nuxtConfigs = ['nuxt.config.js', 'nuxt.config.ts'];\n for (const file of nuxtConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('nuxt-intlayer')) {\n const updatedContent = updateNuxtConfig(content);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer module`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT\n // Next.js >= 16 uses a bun-specific wrapper; backend frameworks wrap whatever\n // the existing dev script is. Both use `intlayer watch --with`.\n const allDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n if (!match) return false;\n return parseInt(match[1], 10) >= major;\n };\n\n const backendIntlayerPackages = [\n 'express-intlayer',\n 'fastify-intlayer',\n 'adonis-intlayer',\n 'hono-intlayer',\n ];\n\n const devScript = packageJson.scripts?.dev;\n\n let newDevScript: string | undefined;\n\n if (\n ((isNextJsProject && isVersionGreaterOrEqual(allDeps.next, 16)) ||\n backendIntlayerPackages.some((pkg) => allDeps[pkg])) &&\n !devScript.includes('intlayer watch')\n ) {\n newDevScript = `intlayer watch --with '${devScript}'`;\n }\n\n if (newDevScript) {\n packageJson.scripts.dev = newDevScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script to run intlayer watch`\n );\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n const backendConfigPackages = [\n 'express',\n 'fastify',\n '@adonisjs/core',\n 'hono',\n ...backendIntlayerPackages,\n ];\n\n if (backendConfigPackages.some((pkg) => allDeps[pkg])) {\n hasAliasConfiguration = true;\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((file) => file === 'tsconfig.json') ||\n tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n\n // INTLAYER LSP — instruction for the AI agent running `intlayer init`.\n // The Intlayer Language Server (`@intlayer/lsp`) provides Go-to-Definition\n // from `useIntlayer` / `getIntlayer` keys to their `.content` files, for both\n // IDEs and AI agents. Setup is editor-specific (VS Code, Cursor, Windsurf,\n // Zed, Neovim, Claude Code, …), so we don't scaffold anything here — instead\n // we point to the doc and ask the agent to confirm the target platform.\n logger([\n colorize('Intlayer LSP →', ANSIColors.MAGENTA),\n colorize(\n 'The Intlayer Language Server is available via the `@intlayer/lsp` package. It lets IDEs and AI agents jump from `useIntlayer`/`getIntlayer` keys to their `.content` files.',\n ANSIColors.GREY_LIGHT\n ),\n colorize(\n 'Ask the user which platform/editor they want to enable it on (VS Code, Cursor, Windsurf, Zed, Neovim, Claude Code, …), then follow the matching setup instructions:',\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(DocumentationRouter.LSP),\n ]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAM,sBAAsB;CAC1B,QAAQ;CACR,WAAW;CACX,WAAW;CACX,KAAK;CACL,OAAO;CACP,cAAc;CACd,4BACE;CACF,qCACE;CACF,YAAY;CACZ,cAAc;CACd,eAAe;CACf,eAAe;CACf,gBAAgB;CAChB,YAAY;CACZ,SAAS;CACT,WAAW;CACX,oBACE;CACF,MAAM;CACN,SAAS;CACT,QAAQ;CACR,SAAS;CACT,SAAS;CAGT,KAAK;CAGL,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACb,SAAS;AACX;;;;AAKA,MAAM,uBAAuB,gBAA6B;CACxD,MAAM,OAAO;EACX,GAAG,YAAY;EACf,GAAG,YAAY;CACjB;;;;;CAMA,MAAM,aAAa,eAAuB,UAA2B;EACnE,IAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAAU,OAAO;EAEhE,OAAO,IADW,OAAO,WAAW,MAAM,UAC/B,EAAE,KAAK,aAAa;CACjC;CAGA,IAAI,KAAK,qBAAqB,KAAK,kBACjC,OAAO,oBAAoB;CAE7B,IAAI,KAAK,mBAAmB,KAAK,MAC/B,OAAO,oBAAoB;CAI7B,IAAI,KAAK,MAAM;EACb,MAAM,UAAU,KAAK;EAErB,IAAI,UAAU,SAAS,EAAE,GACvB,OAAO,oBAAoB;EAG7B,IAAI,UAAU,SAAS,EAAE,GACvB,OAAO,oBAAoB;EAG7B,OAAO,oBAAoB;CAC7B;CAEA,IAAI,KAAK,MAAM,OAAO,oBAAoB;CAC1C,IAAI,KAAK,OAAO,OAAO,oBAAoB;CAC3C,IAAI,KAAK,kBAAkB,OAAO,oBAAoB;CAGtD,IAAI,KAAK,2BACP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C,IAAI,UAAU;IAEd,OAAO,QAAQ,OAAO,EAAE,SAAS,CAAC,OAAO,UAAU;KACjD,IAAI,CAAC,OAAO,gBAAgB,MAAM,QAAQ;MACxC,OAAO,gBAAgB,MAAM,SAAS,CAAC,IAAI;MAC3C,UAAU;KACZ;IACF,CAAC;IAED,IAAI,SAAS;KACX,MAAM,gBACJ,SACA,cACA,KAAK,UAAU,QAAQ,MAAM,CAAC,CAChC;KACA,OACE,GAAG,EAAE,WAAW,aACd,YACF,EAAE,6BACJ;IACF;GACF,OAAO;IACL,YAAY,YAAY,CAAC;IAEzB,IAAI,UAAU;IAEd,OAAO,QAAQ,OAAO,EAAE,SAAS,CAAC,OAAO,UAAU;KACjD,MAAM,cAAc,MAAM,QAAQ,KAAK,GAAG;KAC1C,MAAM,aAAa,KAAK,WAAW,GAAG,IAAI,OAAO,KAAK;KAEtD,IAAI,CAAC,YAAY,QAAQ,cAAc;MACrC,YAAY,QAAQ,eAAe;MACnC,UAAU;KACZ;IACF,CAAC;IAED,IAAI,SAAS;KACX,MAAM,gBACJ,SACA,iBACA,KAAK,UAAU,aAAa,MAAM,CAAC,CACrC;KACA,OACE,GAAG,EAAE,WAAW,aACd,eACF,EAAE,6BACJ;IACF;GACF;EACF;CACF;CAGA,OAAO,GAAG,EAAE,GAAG,SAAS,iCAAiC,WAAW,KAAK,GAAG;CAC5E,OAAO;EACL,SAAS,UAAU,WAAW,OAAO;EACrC,SACE,uEACA,WAAW,UACb;EACA,aAAa,QAAQ;CACvB,CAAC;CAQD,OAAO;EACL,SAAS,kBAAkB,WAAW,OAAO;EAC7C,SACE,+KACA,WAAW,UACb;EACA,SACE,uKACA,WAAW,UACb;EACA,aAAa,oBAAoB,GAAG;CACtC,CAAC;AACH"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/init/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport { getConfiguration } from '@intlayer/config/node';\n\nimport { getAlias } from '@intlayer/config/utils';\nimport { initConfig } from '../initConfig';\nimport {\n ensureDirectory,\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateAstroConfig,\n updateNextConfig,\n updateNuxtConfig,\n updateViteConfig,\n writeFileToRoot,\n} from './utils';\n\n/**\n * Documentation URL Constants\n */\nconst DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs.md',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15.md',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14.md',\n CRA: 'https://intlayer.org/doc/environment/create-react-app.md',\n Astro: 'https://intlayer.org/doc/environment/astro.md',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react.md',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7.md',\n ViteAndReact_ReactRouterV7_FSRoutes:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7-fs-routes.md',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue.md',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid.md',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte.md',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact.md',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack.md',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue.md',\n Angular: 'https://intlayer.org/doc/environment/angular.md',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit.md',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo.md',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react.md',\n Express: 'https://intlayer.org/doc/environment/express.md',\n NestJS: 'https://intlayer.org/doc/environment/nestjs.md',\n Fastify: 'https://intlayer.org/doc/environment/fastify.md',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Intlayer Language Server (Go-to-Definition from getter keys to .content files)\n LSP: 'https://intlayer.org/doc/lsp.md',\n\n // Check for competitors libs\n NextIntl: 'https://intlayer.org/blog/intlayer-with-next-intl.md',\n ReactI18Next: 'https://intlayer.org/blog/intlayer-with-react-i18next.md',\n ReactIntl: 'https://intlayer.org/blog/intlayer-with-react-intl.md',\n NextI18Next: 'https://intlayer.org/blog/intlayer-with-next-i18next.md',\n VueI18n: 'https://intlayer.org/blog/intlayer-with-vue-i18n.md',\n};\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nconst getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n if (deps.astro) return DocumentationRouter.Astro;\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7\n const reactRouterVersion = deps['react-router'];\n if (reactRouterVersion && typeof reactRouterVersion === 'string') {\n // Distinguish between standard v7 and v7 with FS routes\n if (deps['@react-router/fs-routes']) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7_FSRoutes;\n }\n\n // Use Regex to ensure it is v7\n if (isVersion(reactRouterVersion, 7)) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) return DocumentationRouter.Angular;\n\n // Backend\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n\n/**\n * OPTIONS\n */\nexport type InitOptions = {\n noGitignore?: boolean;\n};\n\n/**\n * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string, options?: InitOptions) => {\n logger(colorize('Checking Intlayer configuration...', ANSIColors.CYAN));\n\n // READ PACKAGE.JSON\n const packageJsonPath = 'package.json';\n if (!(await exists(rootDir, packageJsonPath))) {\n logger(\n `${x} No ${colorizePath('package.json')} found. Please run this script from the project root.`,\n { level: 'error' }\n );\n process.exit(1);\n }\n\n const packageJsonContent = await readFileFromRoot(rootDir, packageJsonPath);\n let packageJson: Record<string, any>;\n try {\n packageJson = JSON.parse(packageJsonContent);\n } catch {\n logger(`${x} Could not parse ${colorizePath('package.json')}.`, {\n level: 'error',\n });\n process.exit(1);\n }\n\n // Determine the correct documentation URL based on dependencies\n const guideUrl = getDocumentationUrl(packageJson);\n\n // CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (!options?.noGitignore && (await exists(rootDir, gitignorePath))) {\n const gitignoreContent = await readFileFromRoot(rootDir, gitignorePath);\n\n if (!gitignoreContent.includes('intlayer')) {\n const newContent = `${gitignoreContent}\\n# Intlayer\\n.intlayer\\n`;\n await writeFileToRoot(rootDir, gitignorePath, newContent);\n logger(\n `${v} Added ${colorizePath('.intlayer')} to ${colorizePath(gitignorePath)}`\n );\n } else {\n logger(`${v} ${colorizePath(gitignorePath)} already includes .intlayer`);\n }\n }\n\n // CHECK VS CODE EXTENSION RECOMMENDATIONS\n const vscodeDir = '.vscode';\n const extensionsJsonPath = join(vscodeDir, 'extensions.json');\n const extensionId = 'intlayer.intlayer-vs-code-extension';\n\n try {\n let extensionsConfig: { recommendations: string[] } = {\n recommendations: [],\n };\n\n if (await exists(rootDir, extensionsJsonPath)) {\n const content = await readFileFromRoot(rootDir, extensionsJsonPath);\n extensionsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n if (!extensionsConfig.recommendations) {\n extensionsConfig.recommendations = [];\n }\n\n if (!extensionsConfig.recommendations.includes(extensionId)) {\n extensionsConfig.recommendations.push(extensionId);\n await writeFileToRoot(\n rootDir,\n extensionsJsonPath,\n JSON.stringify(extensionsConfig, null, 2)\n );\n logger(\n `${v} Added ${colorize(extensionId, ANSIColors.MAGENTA)} to ${colorizePath(extensionsJsonPath)}`\n );\n } else {\n logger(\n `${v} ${colorizePath(extensionsJsonPath)} already includes ${colorize(extensionId, ANSIColors.MAGENTA)}`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(extensionsJsonPath)}. You may need to add ${colorize(extensionId, ANSIColors.MAGENTA)} manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK VS CODE LSP SETTINGS\n const settingsJsonPath = join(vscodeDir, 'settings.json');\n\n try {\n let settingsConfig: Record<string, unknown> = {};\n\n if (await exists(rootDir, settingsJsonPath)) {\n const content = await readFileFromRoot(rootDir, settingsJsonPath);\n settingsConfig = parseJSONWithComments(content);\n } else {\n await ensureDirectory(rootDir, vscodeDir);\n }\n\n let settingsUpdated = false;\n\n if (!settingsConfig['intlayer.languageServer.command']) {\n settingsConfig['intlayer.languageServer.command'] = 'npx';\n settingsUpdated = true;\n }\n\n if (!settingsConfig['intlayer.languageServer.args']) {\n settingsConfig['intlayer.languageServer.args'] = ['@intlayer/lsp'];\n settingsUpdated = true;\n }\n\n if (settingsUpdated) {\n await writeFileToRoot(\n rootDir,\n settingsJsonPath,\n JSON.stringify(settingsConfig, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(settingsJsonPath)} with LSP configuration`\n );\n } else {\n logger(\n `${v} ${colorizePath(settingsJsonPath)} already includes LSP configuration`\n );\n }\n } catch {\n logger(\n `${x} Could not update ${colorizePath(settingsJsonPath)}. You may need to add the LSP settings manually.`,\n { level: 'warn' }\n );\n }\n\n // CHECK TSCONFIGS\n const tsConfigFiles = await findTsConfigFiles(rootDir);\n let hasTsConfig = false;\n\n for (const fileName of tsConfigFiles) {\n if (await exists(rootDir, fileName)) {\n hasTsConfig = true;\n try {\n const fileContent = await readFileFromRoot(rootDir, fileName);\n const config = parseJSONWithComments(fileContent);\n const typeDefinition = '.intlayer/**/*.ts';\n\n let updated = false;\n\n if (!config.include) {\n // Skip if no include array (solution-style)\n } else if (\n Array.isArray(config.include) &&\n !(config.include as string[]).some((pattern: string) =>\n pattern.includes('.intlayer')\n )\n ) {\n config.include.push(typeDefinition);\n updated = true;\n } else if (config.include.includes(typeDefinition)) {\n logger(\n `${v} ${colorizePath(fileName)} already includes intlayer types`\n );\n }\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n fileName,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(fileName)} to include intlayer types`\n );\n }\n } catch {\n logger(\n `${x} Could not parse or update ${colorizePath(fileName)}. You may need to add ${colorizePath('.intlayer/types/**/*.ts')} manually.`,\n { level: 'warn' }\n );\n }\n }\n }\n\n // INITIALIZE CONFIG FILE\n const format = hasTsConfig ? 'intlayer.config.ts' : 'intlayer.config.mjs';\n await initConfig(format, rootDir);\n\n let hasAliasConfiguration = false;\n\n // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateViteConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n let isNextJsProject = false;\n\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n isNextJsProject = true;\n hasAliasConfiguration = true;\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateNextConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer plugin`);\n }\n break;\n }\n }\n\n // CHECK OTHER FRAMEWORKS CONFIG\n const astroConfigs = [\n 'astro.config.mjs',\n 'astro.config.js',\n 'astro.config.ts',\n 'astro.config.cjs',\n ];\n\n for (const file of astroConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n\n if (file.startsWith('astro.config.')) {\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('astro-intlayer')) {\n const extension = file.split('.').pop()!;\n const updatedContent = updateAstroConfig(content, extension);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(\n `${v} Updated ${colorizePath(file)} to include Intlayer integration`\n );\n }\n }\n break;\n }\n }\n\n const nuxtConfigs = ['nuxt.config.js', 'nuxt.config.ts'];\n for (const file of nuxtConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n\n const content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('nuxt-intlayer')) {\n const updatedContent = updateNuxtConfig(content);\n await writeFileToRoot(rootDir, file, updatedContent);\n logger(`${v} Updated ${colorizePath(file)} to include Intlayer module`);\n }\n break;\n }\n }\n\n // UPDATE PACKAGE.JSON DEV SCRIPT\n // Next.js >= 16 uses a bun-specific wrapper; backend frameworks wrap whatever\n // the existing dev script is. Both use `intlayer watch --with`.\n const allDeps = {\n ...packageJson.dependencies,\n ...packageJson.devDependencies,\n };\n\n const isVersionGreaterOrEqual = (\n versionString: string,\n major: number\n ): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const match = versionString.match(/^[^\\d]*(\\d+)/);\n if (!match) return false;\n return parseInt(match[1], 10) >= major;\n };\n\n const backendIntlayerPackages = [\n 'express-intlayer',\n 'fastify-intlayer',\n 'adonis-intlayer',\n 'hono-intlayer',\n ];\n\n const devScript = packageJson.scripts?.dev;\n\n let newDevScript: string | undefined;\n\n if (\n ((isNextJsProject && isVersionGreaterOrEqual(allDeps.next, 16)) ||\n backendIntlayerPackages.some((pkg) => allDeps[pkg])) &&\n !devScript.includes('intlayer watch')\n ) {\n newDevScript = `intlayer watch --with '${devScript}'`;\n }\n\n if (newDevScript) {\n packageJson.scripts.dev = newDevScript;\n\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath('package.json')} dev script to run intlayer watch`\n );\n }\n\n // CHECK WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\n ];\n\n for (const file of webpackConfigs) {\n if (await exists(rootDir, file)) {\n hasAliasConfiguration = true;\n logger(\n `${v} Found ${colorizePath(\n file\n )}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`\n );\n break;\n }\n }\n\n const backendConfigPackages = [\n 'express',\n 'fastify',\n '@adonisjs/core',\n 'hono',\n ...backendIntlayerPackages,\n ];\n\n if (backendConfigPackages.some((pkg) => allDeps[pkg])) {\n hasAliasConfiguration = true;\n }\n\n if (!hasAliasConfiguration) {\n const configuration = getConfiguration({ baseDir: rootDir });\n const aliases = getAlias({ configuration });\n\n if (hasTsConfig && tsConfigFiles.length > 0) {\n const tsConfigPath =\n tsConfigFiles.find((file) => file === 'tsconfig.json') ||\n tsConfigFiles[0];\n const tsConfigContent = await readFileFromRoot(rootDir, tsConfigPath);\n const config = parseJSONWithComments(tsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n tsConfigPath,\n JSON.stringify(config, null, 2)\n );\n\n logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\n\n if (await exists(rootDir, jsConfigPath)) {\n const jsConfigContent = await readFileFromRoot(rootDir, jsConfigPath);\n const config = parseJSONWithComments(jsConfigContent);\n\n config.compilerOptions ??= {};\n config.compilerOptions.paths ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n if (!config.compilerOptions.paths[alias]) {\n config.compilerOptions.paths[alias] = [path];\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n jsConfigPath,\n JSON.stringify(config, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n jsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n packageJson.imports ??= {};\n\n let updated = false;\n\n Object.entries(aliases).forEach(([alias, path]) => {\n const importAlias = alias.replace('@', '#');\n const importPath = path.startsWith('.') ? path : `./${path}`;\n\n if (!packageJson.imports[importAlias]) {\n packageJson.imports[importAlias] = importPath;\n updated = true;\n }\n });\n\n if (updated) {\n await writeFileToRoot(\n rootDir,\n packageJsonPath,\n JSON.stringify(packageJson, null, 2)\n );\n logger(\n `${v} Updated ${colorizePath(\n packageJsonPath\n )} to include Intlayer imports`\n );\n }\n }\n }\n }\n\n // FINAL SUCCESS MESSAGE\n logger(`${v} ${colorize('Intlayer init setup complete.', ANSIColors.GREEN)}`);\n logger([\n colorize('Next →', ANSIColors.MAGENTA),\n colorize(\n `Follow the instructions in the documentation to complete the setup:`,\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(guideUrl),\n ]);\n\n // INTLAYER LSP — instruction for the AI agent running `intlayer init`.\n // The Intlayer Language Server (`@intlayer/lsp`) provides Go-to-Definition\n // from `useIntlayer` / `getIntlayer` keys to their `.content` files, for both\n // IDEs and AI agents. Setup is editor-specific (VS Code, Cursor, Windsurf,\n // Zed, Neovim, Claude Code, …), so we don't scaffold anything here — instead\n // we point to the doc and ask the agent to confirm the target platform.\n logger([\n colorize('Intlayer LSP →', ANSIColors.MAGENTA),\n colorize(\n 'The Intlayer Language Server is available via the `@intlayer/lsp` package. It lets IDEs and AI agents jump from `useIntlayer`/`getIntlayer` keys to their `.content` files.',\n ANSIColors.GREY_LIGHT\n ),\n colorize(\n 'Ask the user which platform/editor they want to enable it on (VS Code, Cursor, Windsurf, Zed, Neovim, Claude Code, …), then follow the matching setup instructions:',\n ANSIColors.GREY_LIGHT\n ),\n colorizePath(DocumentationRouter.LSP),\n ]);\n};\n"],"mappings":";;;;;;;;;;;;;;;AAuBA,MAAM,sBAAsB;CAC1B,QAAQ;CACR,WAAW;CACX,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AAU;KACjD,MAAM,cAAc,MAAM,QAAQ,KAAK,IAAI;KAC3C,MAAM,aAAa,KAAK,WAAW,IAAI,GAAG,OAAO,KAAK;AAEtD,SAAI,CAAC,YAAY,QAAQ,cAAc;AACrC,kBAAY,QAAQ,eAAe;AACnC,gBAAU;;MAEZ;AAEF,QAAI,SAAS;AACX,WAAM,gBACJ,SACA,iBACA,KAAK,UAAU,aAAa,MAAM,EAAE,CACrC;AACD,YACE,GAAG,EAAE,WAAW,aACd,gBACD,CAAC,8BACH;;;;;AAOT,QAAO,GAAG,EAAE,GAAG,SAAS,iCAAiC,WAAW,MAAM,GAAG;AAC7E,QAAO;EACL,SAAS,UAAU,WAAW,QAAQ;EACtC,SACE,uEACA,WAAW,WACZ;EACD,aAAa,SAAS;EACvB,CAAC;AAQF,QAAO;EACL,SAAS,kBAAkB,WAAW,QAAQ;EAC9C,SACE,+KACA,WAAW,WACZ;EACD,SACE,uKACA,WAAW,WACZ;EACD,aAAa,oBAAoB,IAAI;EACtC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"configManipulation.mjs","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"sourcesContent":["import * as recast from 'recast';\n\nconst { builders: b, namedTypes: n } = recast.types;\n\nconst injectImport = (\n ast: any,\n isCJS: boolean,\n importName: string,\n source: string\n) => {\n const body = ast.program.body;\n const hasImport = body.some((stmt: any) => {\n if (isCJS) {\n return (\n n.VariableDeclaration.check(stmt) &&\n stmt.declarations.some(\n (decl: any) =>\n n.VariableDeclarator.check(decl) &&\n n.CallExpression.check(decl.init) &&\n n.Identifier.check(decl.init.callee) &&\n decl.init.callee.name === 'require' &&\n n.StringLiteral.check(decl.init.arguments[0]) &&\n decl.init.arguments[0].value === source\n )\n );\n }\n return (\n n.ImportDeclaration.check(stmt) &&\n (stmt.source.value === source ||\n stmt.specifiers.some(\n (spec: any) =>\n (n.ImportSpecifier.check(spec) &&\n spec.imported.name === importName) ||\n (n.ImportDefaultSpecifier.check(spec) &&\n spec.local?.name === importName)\n ))\n );\n });\n\n if (hasImport) return;\n\n const declaration = isCJS\n ? b.variableDeclaration('const', [\n b.variableDeclarator(\n b.identifier(`{ ${importName} }`),\n b.callExpression(b.identifier('require'), [b.stringLiteral(source)])\n ),\n ])\n : b.importDeclaration(\n [b.importSpecifier(b.identifier(importName))],\n b.stringLiteral(source)\n );\n\n ast.program.body.unshift(declaration);\n};\n\nconst updatePluginArray = (\n objExpr: any,\n propertyName: string,\n pluginName: string\n) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' && !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let prop = objExpr.properties.find((p: any) => {\n if (!p?.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === propertyName;\n }) as any;\n\n if (!prop) {\n prop = b.property(\n 'init',\n b.identifier(propertyName),\n b.arrayExpression([])\n );\n objExpr.properties.push(prop);\n }\n\n const arrayValue = prop.value;\n\n if (\n arrayValue &&\n (arrayValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(arrayValue))\n ) {\n const hasPlugin = arrayValue.elements.some((el: any) => {\n const callee = el?.callee;\n if (!callee) return false;\n const name = callee.name || callee.id?.name;\n return name === pluginName || name === 'il';\n });\n\n if (!hasPlugin) {\n arrayValue.elements.push(b.callExpression(b.identifier(pluginName), []));\n }\n }\n};\n\nconst genericRecastVisit = (\n ast: any,\n updateConfigObject: (obj: any) => void,\n callNames: string[] = ['defineConfig']\n) => {\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const decl = path.node.declaration;\n\n if (n.ObjectExpression.check(decl)) {\n updateConfigObject(decl);\n } else if (\n n.CallExpression.check(decl) &&\n n.Identifier.check(decl.callee) &&\n callNames.includes(decl.callee.name)\n ) {\n if (n.ObjectExpression.check(decl.arguments[0])) {\n updateConfigObject(decl.arguments[0]);\n }\n } else if (n.Identifier.check(decl)) {\n const name = decl.name;\n ast.program.body.forEach((stmt: any) => {\n if (n.VariableDeclaration.check(stmt)) {\n stmt.declarations.forEach((vdecl: any) => {\n if (\n n.VariableDeclarator.check(vdecl) &&\n n.Identifier.check(vdecl.id) &&\n vdecl.id.name === name &&\n n.ObjectExpression.check(vdecl.init)\n ) {\n updateConfigObject(vdecl.init);\n }\n });\n }\n });\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports'\n ) {\n if (n.ObjectExpression.check(right)) {\n updateConfigObject(right);\n } else if (\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n callNames.includes(right.callee.name)\n ) {\n if (n.ObjectExpression.check(right.arguments[0])) {\n updateConfigObject(right.arguments[0]);\n }\n }\n }\n return false;\n },\n });\n};\n\nexport const updateViteConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'vite-intlayer');\n\n genericRecastVisit(ast, (obj) =>\n updatePluginArray(obj, 'plugins', 'intlayer')\n );\n\n return recast.print(ast).code;\n};\n\nexport const updateAstroConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'astro-intlayer');\n\n genericRecastVisit(ast, (obj) =>\n updatePluginArray(obj, 'integrations', 'intlayer')\n );\n\n return recast.print(ast).code;\n};\n\nexport const updateNextConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile = extension === 'cjs' || content.includes('module.exports');\n\n injectImport(ast, isCJSFile, 'withIntlayer', 'next-intlayer/server');\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const declaration = path.node.declaration;\n if (\n n.Expression.check(declaration) &&\n !(\n n.CallExpression.check(declaration) &&\n n.Identifier.check(declaration.callee) &&\n declaration.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('declaration')\n .replace(\n b.callExpression(b.identifier('withIntlayer'), [declaration as any])\n );\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports' &&\n !(\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('right')\n .replace(b.callExpression(b.identifier('withIntlayer'), [right]));\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n\nexport const updateNuxtConfig = (content: string): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const updateConfigObject = (objExpr: any) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' &&\n !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let modulesProp = objExpr.properties.find((p: any) => {\n if (!p?.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === 'modules';\n }) as any;\n\n if (!modulesProp) {\n modulesProp = b.property(\n 'init',\n b.identifier('modules'),\n b.arrayExpression([])\n );\n objExpr.properties.push(modulesProp);\n }\n\n const modulesValue = modulesProp.value;\n\n if (\n modulesValue &&\n (modulesValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(modulesValue))\n ) {\n const hasModule = modulesValue.elements.some((el: any) => {\n if (\n n.StringLiteral.check(el) ||\n el.type === 'StringLiteral' ||\n el.type === 'Literal'\n ) {\n return (el.value || el.extra?.rawValue) === 'nuxt-intlayer';\n }\n return false;\n });\n\n if (!hasModule) {\n modulesValue.elements.push(b.stringLiteral('nuxt-intlayer'));\n }\n }\n };\n\n genericRecastVisit(ast, updateConfigObject, ['defineNuxtConfig']);\n\n return recast.print(ast).code;\n};\n"],"mappings":";;;;AAEA,MAAM,EAAE,UAAU,GAAG,YAAY,MA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AEA,MAAM,eAAe,YAAY;EAEjC,IACE,iBACC,aAAa,SAAS,qBACrB,EAAE,gBAAgB,MAAM,YAAY,IAatC;OAAI,CAXc,aAAa,SAAS,MAAM,OAAY;IACxD,IACE,EAAE,cAAc,MAAM,EAAE,KACxB,GAAG,SAAS,mBACZ,GAAG,SAAS,WAEZ,QAAQ,GAAG,SAAS,GAAG,OAAO,cAAc;IAE9C,OAAO;GACT,CAEa,GACX,aAAa,SAAS,KAAK,EAAE,cAAc,eAAe,CAAC;EAC7D;CAEJ;CAEA,mBAAmB,KAAK,oBAAoB,CAAC,kBAAkB,CAAC;CAEhE,OAAO,OAAO,MAAM,GAAG,EAAE;AAC3B"}
1
+ {"version":3,"file":"configManipulation.mjs","names":[],"sources":["../../../../src/init/utils/configManipulation.ts"],"sourcesContent":["import * as recast from 'recast';\n\nconst { builders: b, namedTypes: n } = recast.types;\n\nconst injectImport = (\n ast: any,\n isCJS: boolean,\n importName: string,\n source: string\n) => {\n const body = ast.program.body;\n const hasImport = body.some((stmt: any) => {\n if (isCJS) {\n return (\n n.VariableDeclaration.check(stmt) &&\n stmt.declarations.some(\n (decl: any) =>\n n.VariableDeclarator.check(decl) &&\n n.CallExpression.check(decl.init) &&\n n.Identifier.check(decl.init.callee) &&\n decl.init.callee.name === 'require' &&\n n.StringLiteral.check(decl.init.arguments[0]) &&\n decl.init.arguments[0].value === source\n )\n );\n }\n return (\n n.ImportDeclaration.check(stmt) &&\n (stmt.source.value === source ||\n stmt.specifiers.some(\n (spec: any) =>\n (n.ImportSpecifier.check(spec) &&\n spec.imported.name === importName) ||\n (n.ImportDefaultSpecifier.check(spec) &&\n spec.local?.name === importName)\n ))\n );\n });\n\n if (hasImport) return;\n\n const declaration = isCJS\n ? b.variableDeclaration('const', [\n b.variableDeclarator(\n b.identifier(`{ ${importName} }`),\n b.callExpression(b.identifier('require'), [b.stringLiteral(source)])\n ),\n ])\n : b.importDeclaration(\n [b.importSpecifier(b.identifier(importName))],\n b.stringLiteral(source)\n );\n\n ast.program.body.unshift(declaration);\n};\n\nconst updatePluginArray = (\n objExpr: any,\n propertyName: string,\n pluginName: string\n) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' && !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let prop = objExpr.properties.find((p: any) => {\n if (!p?.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === propertyName;\n }) as any;\n\n if (!prop) {\n prop = b.property(\n 'init',\n b.identifier(propertyName),\n b.arrayExpression([])\n );\n objExpr.properties.push(prop);\n }\n\n const arrayValue = prop.value;\n\n if (\n arrayValue &&\n (arrayValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(arrayValue))\n ) {\n const hasPlugin = arrayValue.elements.some((el: any) => {\n const callee = el?.callee;\n if (!callee) return false;\n const name = callee.name || callee.id?.name;\n return name === pluginName || name === 'il';\n });\n\n if (!hasPlugin) {\n arrayValue.elements.push(b.callExpression(b.identifier(pluginName), []));\n }\n }\n};\n\nconst genericRecastVisit = (\n ast: any,\n updateConfigObject: (obj: any) => void,\n callNames: string[] = ['defineConfig']\n) => {\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const decl = path.node.declaration;\n\n if (n.ObjectExpression.check(decl)) {\n updateConfigObject(decl);\n } else if (\n n.CallExpression.check(decl) &&\n n.Identifier.check(decl.callee) &&\n callNames.includes(decl.callee.name)\n ) {\n if (n.ObjectExpression.check(decl.arguments[0])) {\n updateConfigObject(decl.arguments[0]);\n }\n } else if (n.Identifier.check(decl)) {\n const name = decl.name;\n ast.program.body.forEach((stmt: any) => {\n if (n.VariableDeclaration.check(stmt)) {\n stmt.declarations.forEach((vdecl: any) => {\n if (\n n.VariableDeclarator.check(vdecl) &&\n n.Identifier.check(vdecl.id) &&\n vdecl.id.name === name &&\n n.ObjectExpression.check(vdecl.init)\n ) {\n updateConfigObject(vdecl.init);\n }\n });\n }\n });\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports'\n ) {\n if (n.ObjectExpression.check(right)) {\n updateConfigObject(right);\n } else if (\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n callNames.includes(right.callee.name)\n ) {\n if (n.ObjectExpression.check(right.arguments[0])) {\n updateConfigObject(right.arguments[0]);\n }\n }\n }\n return false;\n },\n });\n};\n\nexport const updateViteConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'vite-intlayer');\n\n genericRecastVisit(ast, (obj) =>\n updatePluginArray(obj, 'plugins', 'intlayer')\n );\n\n return recast.print(ast).code;\n};\n\nexport const updateAstroConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile =\n extension === 'cjs' ||\n (content.includes('module.exports') && !content.includes('import '));\n\n injectImport(ast, isCJSFile, 'intlayer', 'astro-intlayer');\n\n genericRecastVisit(ast, (obj) =>\n updatePluginArray(obj, 'integrations', 'intlayer')\n );\n\n return recast.print(ast).code;\n};\n\nexport const updateNextConfig = (\n content: string,\n extension: string\n): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const isCJSFile = extension === 'cjs' || content.includes('module.exports');\n\n injectImport(ast, isCJSFile, 'withIntlayer', 'next-intlayer/server');\n\n recast.visit(ast, {\n visitExportDefaultDeclaration(path) {\n const declaration = path.node.declaration;\n if (\n n.Expression.check(declaration) &&\n !(\n n.CallExpression.check(declaration) &&\n n.Identifier.check(declaration.callee) &&\n declaration.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('declaration')\n .replace(\n b.callExpression(b.identifier('withIntlayer'), [declaration as any])\n );\n }\n return false;\n },\n visitAssignmentExpression(path) {\n const { left, right } = path.node;\n\n if (\n n.MemberExpression.check(left) &&\n recast.print(left).code === 'module.exports' &&\n !(\n n.CallExpression.check(right) &&\n n.Identifier.check(right.callee) &&\n right.callee.name === 'withIntlayer'\n )\n ) {\n path\n .get('right')\n .replace(b.callExpression(b.identifier('withIntlayer'), [right]));\n }\n return false;\n },\n });\n\n return recast.print(ast).code;\n};\n\nexport const updateNuxtConfig = (content: string): string => {\n const ast = recast.parse(content, {\n parser: require('recast/parsers/typescript'),\n });\n\n const updateConfigObject = (objExpr: any) => {\n if (\n !objExpr ||\n (objExpr.type !== 'ObjectExpression' &&\n !n.ObjectExpression.check(objExpr))\n )\n return;\n\n let modulesProp = objExpr.properties.find((p: any) => {\n if (!p?.key) return false;\n const keyName = p.key.name || p.key.value;\n return keyName === 'modules';\n }) as any;\n\n if (!modulesProp) {\n modulesProp = b.property(\n 'init',\n b.identifier('modules'),\n b.arrayExpression([])\n );\n objExpr.properties.push(modulesProp);\n }\n\n const modulesValue = modulesProp.value;\n\n if (\n modulesValue &&\n (modulesValue.type === 'ArrayExpression' ||\n n.ArrayExpression.check(modulesValue))\n ) {\n const hasModule = modulesValue.elements.some((el: any) => {\n if (\n n.StringLiteral.check(el) ||\n el.type === 'StringLiteral' ||\n el.type === 'Literal'\n ) {\n return (el.value || el.extra?.rawValue) === 'nuxt-intlayer';\n }\n return false;\n });\n\n if (!hasModule) {\n modulesValue.elements.push(b.stringLiteral('nuxt-intlayer'));\n }\n }\n };\n\n genericRecastVisit(ast, updateConfigObject, ['defineNuxtConfig']);\n\n return recast.print(ast).code;\n};\n"],"mappings":";;;;AAEA,MAAM,EAAE,UAAU,GAAG,YAAY,MAAM,OAAO;AAE9C,MAAM,gBACJ,KACA,OACA,YACA,WACG;AA8BH,KA7Ba,IAAI,QAAQ,KACF,MAAM,SAAc;AACzC,MAAI,MACF,QACE,EAAE,oBAAoB,MAAM,KAAK,IACjC,KAAK,aAAa,MACf,SACC,EAAE,mBAAmB,MAAM,KAAK,IAChC,EAAE,eAAe,MAAM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AmB,KAAK,oBAAoB,CAAC,mBAAmB,CAAC;AAEjE,QAAO,OAAO,MAAM,IAAI,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"fileSystem.mjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n\n/**\n * Helper to ensure a directory exists\n */\nexport const ensureDirectory = async (rootDir: string, dirPath: string) => {\n try {\n await mkdir(join(rootDir, dirPath), { recursive: true });\n } catch {\n // Directory already exists or could not be created\n }\n};\n"],"mappings":";;;;;;;AAMA,MAAa,SAAS,OAAO,SAAiB,aAAqB;CACjE,IAAI;EACF,MAAM,OAAO,KAAK,SAAS,QAAQ,CAAC;EACpC,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF;;;;AAKA,MAAa,mBAAmB,OAAO,SAAiB,aACtD,MAAM,SAAS,KAAK,SAAS,QAAQ,GAAG,MAAM;;;;AAKhD,MAAa,kBAAkB,OAC7B,SACA,UACA,YACG,MAAM,UAAU,KAAK,SAAS,QAAQ,GAAG,SAAS,MAAM;;;;AAK7D,MAAa,kBAAkB,OAAO,SAAiB,YAAoB;CACzE,IAAI;EACF,MAAM,MAAM,KAAK,SAAS,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;CACzD,QAAQ,CAER;AACF"}
1
+ {"version":3,"file":"fileSystem.mjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n/**\n * Helper to check if a file exists\n */\nexport const exists = async (rootDir: string, filePath: string) => {\n try {\n await access(join(rootDir, filePath));\n return true;\n } catch {\n return false;\n }\n};\n\n/**\n * Helper to read a file\n */\nexport const readFileFromRoot = async (rootDir: string, filePath: string) =>\n await readFile(join(rootDir, filePath), 'utf8');\n\n/**\n * Helper to write a file\n */\nexport const writeFileToRoot = async (\n rootDir: string,\n filePath: string,\n content: string\n) => await writeFile(join(rootDir, filePath), content, 'utf8');\n\n/**\n * Helper to ensure a directory exists\n */\nexport const ensureDirectory = async (rootDir: string, dirPath: string) => {\n try {\n await mkdir(join(rootDir, dirPath), { recursive: true });\n } catch {\n // Directory already exists or could not be created\n }\n};\n"],"mappings":";;;;;;;AAMA,MAAa,SAAS,OAAO,SAAiB,aAAqB;AACjE,KAAI;AACF,QAAM,OAAO,KAAK,SAAS,SAAS,CAAC;AACrC,SAAO;SACD;AACN,SAAO;;;;;;AAOX,MAAa,mBAAmB,OAAO,SAAiB,aACtD,MAAM,SAAS,KAAK,SAAS,SAAS,EAAE,OAAO;;;;AAKjD,MAAa,kBAAkB,OAC7B,SACA,UACA,YACG,MAAM,UAAU,KAAK,SAAS,SAAS,EAAE,SAAS,OAAO;;;;AAK9D,MAAa,kBAAkB,OAAO,SAAiB,YAAoB;AACzE,KAAI;AACF,QAAM,MAAM,KAAK,SAAS,QAAQ,EAAE,EAAE,WAAW,MAAM,CAAC;SAClD"}
@@ -1 +1 @@
1
- {"version":3,"file":"jsonParser.mjs","names":[],"sources":["../../../../src/init/utils/jsonParser.ts"],"sourcesContent":["/**\n * Helper to parse JSON that may contain comments (tsconfig allows comments)\n */\nexport const parseJSONWithComments = (jsonString: string) => {\n // First, try parsing as-is (most tsconfig files don't have comments)\n try {\n return JSON.parse(jsonString);\n } catch {\n // If that fails, try stripping comments\n // Note: This simple approach removes comments line by line to avoid\n // matching glob patterns like /* and */ that appear in paths\n }\n\n // Process line by line to safely remove comments\n const lines = jsonString.split('\\n');\n const cleanedLines = lines.map((line) => {\n // Track if we're inside a string\n let inString = false;\n let result = '';\n\n for (let i = 0; i < line.length; i++) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n // Handle string boundaries (accounting for escaped quotes)\n if (char === '\"' && (i === 0 || line[i - 1] !== '\\\\')) {\n inString = !inString;\n result += char;\n continue;\n }\n\n // If we're inside a string, keep the character\n if (inString) {\n result += char;\n continue;\n }\n\n // Check for single-line comment outside of strings\n if (char === '/' && nextChar === '/') {\n // Rest of line is a comment, stop here\n break;\n }\n\n // Check for multi-line comment start (/* ... */)\n // For simplicity, we only handle single-line /* */ comments here\n if (char === '/' && nextChar === '*') {\n const endIndex = line.indexOf('*/', i + 2);\n if (endIndex !== -1) {\n // Skip the comment\n i = endIndex + 1;\n continue;\n }\n }\n\n result += char;\n }\n\n return result;\n });\n\n return JSON.parse(cleanedLines.join('\\n'));\n};\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,eAAuB;CAE3D,IAAI;EACF,OAAO,KAAK,MAAM,UAAU;CAC9B,QAAQ,CAIR;CAIA,MAAM,eADQ,WAAW,MAAM,IACN,EAAE,KAAK,SAAS;EAEvC,IAAI,WAAW;EACf,IAAI,SAAS;EAEb,KAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,OAAO,KAAK;GAClB,MAAM,WAAW,KAAK,IAAI;GAG1B,IAAI,SAAS,SAAQ,MAAM,KAAK,KAAK,IAAI,OAAO,OAAO;IACrD,WAAW,CAAC;IACZ,UAAU;IACV;GACF;GAGA,IAAI,UAAU;IACZ,UAAU;IACV;GACF;GAGA,IAAI,SAAS,OAAO,aAAa,KAE/B;GAKF,IAAI,SAAS,OAAO,aAAa,KAAK;IACpC,MAAM,WAAW,KAAK,QAAQ,MAAM,IAAI,CAAC;IACzC,IAAI,aAAa,IAAI;KAEnB,IAAI,WAAW;KACf;IACF;GACF;GAEA,UAAU;EACZ;EAEA,OAAO;CACT,CAAC;CAED,OAAO,KAAK,MAAM,aAAa,KAAK,IAAI,CAAC;AAC3C"}
1
+ {"version":3,"file":"jsonParser.mjs","names":[],"sources":["../../../../src/init/utils/jsonParser.ts"],"sourcesContent":["/**\n * Helper to parse JSON that may contain comments (tsconfig allows comments)\n */\nexport const parseJSONWithComments = (jsonString: string) => {\n // First, try parsing as-is (most tsconfig files don't have comments)\n try {\n return JSON.parse(jsonString);\n } catch {\n // If that fails, try stripping comments\n // Note: This simple approach removes comments line by line to avoid\n // matching glob patterns like /* and */ that appear in paths\n }\n\n // Process line by line to safely remove comments\n const lines = jsonString.split('\\n');\n const cleanedLines = lines.map((line) => {\n // Track if we're inside a string\n let inString = false;\n let result = '';\n\n for (let i = 0; i < line.length; i++) {\n const char = line[i];\n const nextChar = line[i + 1];\n\n // Handle string boundaries (accounting for escaped quotes)\n if (char === '\"' && (i === 0 || line[i - 1] !== '\\\\')) {\n inString = !inString;\n result += char;\n continue;\n }\n\n // If we're inside a string, keep the character\n if (inString) {\n result += char;\n continue;\n }\n\n // Check for single-line comment outside of strings\n if (char === '/' && nextChar === '/') {\n // Rest of line is a comment, stop here\n break;\n }\n\n // Check for multi-line comment start (/* ... */)\n // For simplicity, we only handle single-line /* */ comments here\n if (char === '/' && nextChar === '*') {\n const endIndex = line.indexOf('*/', i + 2);\n if (endIndex !== -1) {\n // Skip the comment\n i = endIndex + 1;\n continue;\n }\n }\n\n result += char;\n }\n\n return result;\n });\n\n return JSON.parse(cleanedLines.join('\\n'));\n};\n"],"mappings":";;;;AAGA,MAAa,yBAAyB,eAAuB;AAE3D,KAAI;AACF,SAAO,KAAK,MAAM,WAAW;SACvB;CAQR,MAAM,eADQ,WAAW,MAAM,KACL,CAAC,KAAK,SAAS;EAEvC,IAAI,WAAW;EACf,IAAI,SAAS;AAEb,OAAK,IAAI,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;GACpC,MAAM,OAAO,KAAK;GAClB,MAAM,WAAW,KAAK,IAAI;AAG1B,OAAI,SAAS,SAAQ,MAAM,KAAK,KAAK,IAAI,OAAO,OAAO;AACrD,eAAW,CAAC;AACZ,cAAU;AACV;;AAIF,OAAI,UAAU;AACZ,cAAU;AACV;;AAIF,OAAI,SAAS,OAAO,aAAa,IAE/B;AAKF,OAAI,SAAS,OAAO,aAAa,KAAK;IACpC,MAAM,WAAW,KAAK,QAAQ,MAAM,IAAI,EAAE;AAC1C,QAAI,aAAa,IAAI;AAEnB,SAAI,WAAW;AACf;;;AAIJ,aAAU;;AAGZ,SAAO;GACP;AAEF,QAAO,KAAK,MAAM,aAAa,KAAK,KAAK,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"tsConfig.mjs","names":[],"sources":["../../../../src/init/utils/tsConfig.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises';\n\n/**\n * Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)\n */\nexport const findTsConfigFiles = async (rootDir: string): Promise<string[]> => {\n try {\n const files = await readdir(rootDir);\n\n return files.filter(\n (file) => file === 'tsconfig.json' || /^tsconfig\\..+\\.json$/.test(file)\n );\n } catch {\n return [];\n }\n};\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,OAAO,YAAuC;CAC7E,IAAI;EAGF,QAAO,MAFa,QAAQ,OAAO,GAEtB,QACV,SAAS,SAAS,mBAAmB,uBAAuB,KAAK,IAAI,CACxE;CACF,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
1
+ {"version":3,"file":"tsConfig.mjs","names":[],"sources":["../../../../src/init/utils/tsConfig.ts"],"sourcesContent":["import { readdir } from 'node:fs/promises';\n\n/**\n * Helper to find all tsconfig files (tsconfig.json, tsconfig.*.json)\n */\nexport const findTsConfigFiles = async (rootDir: string): Promise<string[]> => {\n try {\n const files = await readdir(rootDir);\n\n return files.filter(\n (file) => file === 'tsconfig.json' || /^tsconfig\\..+\\.json$/.test(file)\n );\n } catch {\n return [];\n }\n};\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,OAAO,YAAuC;AAC7E,KAAI;AAGF,UAAO,MAFa,QAAQ,QAAQ,EAEvB,QACV,SAAS,SAAS,mBAAmB,uBAAuB,KAAK,KAAK,CACxE;SACK;AACN,SAAO,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/initConfig/index.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { colorizePath, logger, v } from '@intlayer/config/logger';\nimport {\n type configurationFilesCandidates,\n searchConfigurationFile,\n} from '@intlayer/config/node';\n\n/**\n * UTILITIES\n */\nconst rootDir = process.cwd();\n\n// Helper to write a file\nconst writeFileToRoot = async (filePath: string, content: string) =>\n await writeFile(join(rootDir, filePath), content, 'utf8');\n\ntype ConfigFormat = 'ts' | 'cjs' | 'mjs' | 'js' | 'json';\n\nconst getTemplatePath = (format: ConfigFormat) => {\n switch (format) {\n case 'ts':\n return './templates/ts.txt';\n case 'cjs':\n return './templates/cjs.txt';\n case 'mjs':\n return './templates/mjs.txt';\n case 'js':\n return './templates/mjs.txt';\n case 'json':\n return './templates/json.txt';\n default:\n return './templates/ts.txt';\n }\n};\n\n/**\n * Initialize the Intlayer configuration file\n */\nexport const initConfig = async (\n format: (typeof configurationFilesCandidates)[number],\n baseDir: string\n) => {\n // Search for configuration file\n const { configurationFilePath } = searchConfigurationFile(baseDir);\n\n // return if the configuration file is found\n if (configurationFilePath) {\n const relativePath = relative(baseDir, configurationFilePath);\n logger(`${v} ${colorizePath(relativePath)} already exists`);\n return;\n }\n\n // Extract the format from the filename (e.g. 'intlayer.config.ts' -> 'ts')\n const extension = format.split('.').pop() as ConfigFormat;\n\n const templatePath = getTemplatePath(extension);\n const configContent = readAsset(templatePath);\n\n await writeFileToRoot(format, configContent);\n logger(`${v} Created ${colorizePath(format)}`);\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,UAAU,QAAQ,IAAI;AAG5B,MAAM,kBAAkB,OAAO,UAAkB,YAC/C,MAAM,UAAU,KAAK,SAAS,QAAQ,GAAG,SAAS,MAAM;AAI1D,MAAM,mBAAmB,WAAyB;CAChD,QAAQ,QAAR;EACE,KAAK,MACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,KAAK,OACH,OAAO;EACT,KAAK,MACH,OAAO;EACT,KAAK,QACH,OAAO;EACT,SACE,OAAO;CACX;AACF;;;;AAKA,MAAa,aAAa,OACxB,QACA,YACG;CAEH,MAAM,EAAE,0BAA0B,wBAAwB,OAAO;CAGjE,IAAI,uBAAuB;EAEzB,OAAO,GAAG,EAAE,GAAG,aADM,SAAS,SAAS,qBACA,CAAC,EAAE,gBAAgB;EAC1D;CACF;CAQA,MAAM,gBAAgB,QAFA,UADD,gBAFH,OAAO,MAAM,GAAG,EAAE,IAES,CACF,CAED,CAAC;CAC3C,OAAO,GAAG,EAAE,WAAW,aAAa,MAAM,GAAG;AAC/C"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../src/initConfig/index.ts"],"sourcesContent":["import { writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport { readAsset } from 'utils:asset';\nimport { colorizePath, logger, v } from '@intlayer/config/logger';\nimport {\n type configurationFilesCandidates,\n searchConfigurationFile,\n} from '@intlayer/config/node';\n\n/**\n * UTILITIES\n */\nconst rootDir = process.cwd();\n\n// Helper to write a file\nconst writeFileToRoot = async (filePath: string, content: string) =>\n await writeFile(join(rootDir, filePath), content, 'utf8');\n\ntype ConfigFormat = 'ts' | 'cjs' | 'mjs' | 'js' | 'json';\n\nconst getTemplatePath = (format: ConfigFormat) => {\n switch (format) {\n case 'ts':\n return './templates/ts.txt';\n case 'cjs':\n return './templates/cjs.txt';\n case 'mjs':\n return './templates/mjs.txt';\n case 'js':\n return './templates/mjs.txt';\n case 'json':\n return './templates/json.txt';\n default:\n return './templates/ts.txt';\n }\n};\n\n/**\n * Initialize the Intlayer configuration file\n */\nexport const initConfig = async (\n format: (typeof configurationFilesCandidates)[number],\n baseDir: string\n) => {\n // Search for configuration file\n const { configurationFilePath } = searchConfigurationFile(baseDir);\n\n // return if the configuration file is found\n if (configurationFilePath) {\n const relativePath = relative(baseDir, configurationFilePath);\n logger(`${v} ${colorizePath(relativePath)} already exists`);\n return;\n }\n\n // Extract the format from the filename (e.g. 'intlayer.config.ts' -> 'ts')\n const extension = format.split('.').pop() as ConfigFormat;\n\n const templatePath = getTemplatePath(extension);\n const configContent = readAsset(templatePath);\n\n await writeFileToRoot(format, configContent);\n logger(`${v} Created ${colorizePath(format)}`);\n};\n"],"mappings":";;;;;;;;;;AAYA,MAAM,UAAU,QAAQ,KAAK;AAG7B,MAAM,kBAAkB,OAAO,UAAkB,YAC/C,MAAM,UAAU,KAAK,SAAS,SAAS,EAAE,SAAS,OAAO;AAI3D,MAAM,mBAAmB,WAAyB;AAChD,SAAQ,QAAR;EACE,KAAK,KACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,KACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,QACE,QAAO;;;;;;AAOb,MAAa,aAAa,OACxB,QACA,YACG;CAEH,MAAM,EAAE,0BAA0B,wBAAwB,QAAQ;AAGlE,KAAI,uBAAuB;AAEzB,SAAO,GAAG,EAAE,GAAG,aADM,SAAS,SAAS,sBACC,CAAC,CAAC,iBAAiB;AAC3D;;AASF,OAAM,gBAAgB,QAFA,UADD,gBAFH,OAAO,MAAM,IAAI,CAAC,KAEU,CACF,CAED,CAAC;AAC5C,QAAO,GAAG,EAAE,WAAW,aAAa,OAAO,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"installLSP.mjs","names":["fs"],"sources":["../../src/installLSP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\n\nconst VSCODE_DIR = '.vscode';\nconst SETTINGS_FILENAME = 'settings.json';\n\nconst LSP_COMMAND_KEY = 'intlayer.languageServer.command';\nconst LSP_ARGS_KEY = 'intlayer.languageServer.args';\nconst LSP_COMMAND_VALUE = 'npx';\nconst LSP_ARGS_VALUE = ['@intlayer/lsp'];\n\n/**\n * Writes the Intlayer LSP configuration to `.vscode/settings.json`.\n * Creates the file (and the `.vscode/` directory) if they don't exist.\n * Does not overwrite keys that are already present.\n *\n * Returns a human-readable summary of what was done plus next-step instructions.\n */\nexport const installLSP = async (projectRoot: string): Promise<string> => {\n const settingsPath = path.join(projectRoot, VSCODE_DIR, SETTINGS_FILENAME);\n\n await fs.mkdir(path.dirname(settingsPath), { recursive: true });\n\n let settings: Record<string, unknown> = {};\n try {\n const raw = await fs.readFile(settingsPath, 'utf-8');\n settings = JSON.parse(raw);\n } catch {\n // File does not exist or is invalid JSON — start from an empty object.\n }\n\n const updated: string[] = [];\n\n if (!settings[LSP_COMMAND_KEY]) {\n settings[LSP_COMMAND_KEY] = LSP_COMMAND_VALUE;\n updated.push(LSP_COMMAND_KEY);\n }\n\n if (!settings[LSP_ARGS_KEY]) {\n settings[LSP_ARGS_KEY] = LSP_ARGS_VALUE;\n updated.push(LSP_ARGS_KEY);\n }\n\n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');\n\n const configSummary =\n updated.length > 0\n ? `Added to ${settingsPath}:\\n${updated.map((k) => ` \"${k}\"`).join('\\n')}`\n : `${settingsPath} already contains the LSP configuration — no changes made.`;\n\n return [\n configSummary,\n '',\n 'Next steps:',\n '',\n '1. Install the language server binary (required once):',\n ' npm install -g @intlayer/lsp',\n '',\n '2. (Optional) Register the Intlayer Claude Code plugin and enable Go-to-Definition inside Claude Code:',\n ' claude plugin marketplace add intlayer@github:aymericzip/intlayer',\n ' claude plugin install intlayer-lsp@intlayer',\n ' claude plugin enable intlayer-lsp@intlayer',\n '',\n '3. Reload your editor window so the new settings take effect.',\n ].join('\\n');\n};\n"],"mappings":";;;;AAGA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAE1B,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB,CAAC,eAAe;;;;;;;;AASvC,MAAa,aAAa,OAAO,gBAAyC;CACxE,MAAM,eAAe,KAAK,KAAK,aAAa,YAAY,iBAAiB;CAEzE,MAAMA,SAAG,MAAM,KAAK,QAAQ,YAAY,GAAG,EAAE,WAAW,KAAK,CAAC;CAE9D,IAAI,WAAoC,CAAC;CACzC,IAAI;EACF,MAAM,MAAM,MAAMA,SAAG,SAAS,cAAc,OAAO;EACnD,WAAW,KAAK,MAAM,GAAG;CAC3B,QAAQ,CAER;CAEA,MAAM,UAAoB,CAAC;CAE3B,IAAI,CAAC,SAAS,kBAAkB;EAC9B,SAAS,mBAAmB;EAC5B,QAAQ,KAAK,eAAe;CAC9B;CAEA,IAAI,CAAC,SAAS,eAAe;EAC3B,SAAS,gBAAgB;EACzB,QAAQ,KAAK,YAAY;CAC3B;CAEA,MAAMA,SAAG,UAAU,cAAc,KAAK,UAAU,UAAU,MAAM,CAAC,GAAG,OAAO;CAO3E,OAAO;EAJL,QAAQ,SAAS,IACb,YAAY,aAAa,KAAK,QAAQ,KAAK,MAAM,MAAM,EAAE,EAAE,EAAE,KAAK,IAAI,MACtE,GAAG,aAAa;EAIpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,EAAE,KAAK,IAAI;AACb"}
1
+ {"version":3,"file":"installLSP.mjs","names":["fs"],"sources":["../../src/installLSP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport path from 'node:path';\n\nconst VSCODE_DIR = '.vscode';\nconst SETTINGS_FILENAME = 'settings.json';\n\nconst LSP_COMMAND_KEY = 'intlayer.languageServer.command';\nconst LSP_ARGS_KEY = 'intlayer.languageServer.args';\nconst LSP_COMMAND_VALUE = 'npx';\nconst LSP_ARGS_VALUE = ['@intlayer/lsp'];\n\n/**\n * Writes the Intlayer LSP configuration to `.vscode/settings.json`.\n * Creates the file (and the `.vscode/` directory) if they don't exist.\n * Does not overwrite keys that are already present.\n *\n * Returns a human-readable summary of what was done plus next-step instructions.\n */\nexport const installLSP = async (projectRoot: string): Promise<string> => {\n const settingsPath = path.join(projectRoot, VSCODE_DIR, SETTINGS_FILENAME);\n\n await fs.mkdir(path.dirname(settingsPath), { recursive: true });\n\n let settings: Record<string, unknown> = {};\n try {\n const raw = await fs.readFile(settingsPath, 'utf-8');\n settings = JSON.parse(raw);\n } catch {\n // File does not exist or is invalid JSON — start from an empty object.\n }\n\n const updated: string[] = [];\n\n if (!settings[LSP_COMMAND_KEY]) {\n settings[LSP_COMMAND_KEY] = LSP_COMMAND_VALUE;\n updated.push(LSP_COMMAND_KEY);\n }\n\n if (!settings[LSP_ARGS_KEY]) {\n settings[LSP_ARGS_KEY] = LSP_ARGS_VALUE;\n updated.push(LSP_ARGS_KEY);\n }\n\n await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');\n\n const configSummary =\n updated.length > 0\n ? `Added to ${settingsPath}:\\n${updated.map((k) => ` \"${k}\"`).join('\\n')}`\n : `${settingsPath} already contains the LSP configuration — no changes made.`;\n\n return [\n configSummary,\n '',\n 'Next steps:',\n '',\n '1. Install the language server binary (required once):',\n ' npm install -g @intlayer/lsp',\n '',\n '2. (Optional) Register the Intlayer Claude Code plugin and enable Go-to-Definition inside Claude Code:',\n ' claude plugin marketplace add intlayer@github:aymericzip/intlayer',\n ' claude plugin install intlayer-lsp@intlayer',\n ' claude plugin enable intlayer-lsp@intlayer',\n '',\n '3. Reload your editor window so the new settings take effect.',\n ].join('\\n');\n};\n"],"mappings":";;;;AAGA,MAAM,aAAa;AACnB,MAAM,oBAAoB;AAE1B,MAAM,kBAAkB;AACxB,MAAM,eAAe;AACrB,MAAM,oBAAoB;AAC1B,MAAM,iBAAiB,CAAC,gBAAgB;;;;;;;;AASxC,MAAa,aAAa,OAAO,gBAAyC;CACxE,MAAM,eAAe,KAAK,KAAK,aAAa,YAAY,kBAAkB;AAE1E,OAAMA,SAAG,MAAM,KAAK,QAAQ,aAAa,EAAE,EAAE,WAAW,MAAM,CAAC;CAE/D,IAAI,WAAoC,EAAE;AAC1C,KAAI;EACF,MAAM,MAAM,MAAMA,SAAG,SAAS,cAAc,QAAQ;AACpD,aAAW,KAAK,MAAM,IAAI;SACpB;CAIR,MAAM,UAAoB,EAAE;AAE5B,KAAI,CAAC,SAAS,kBAAkB;AAC9B,WAAS,mBAAmB;AAC5B,UAAQ,KAAK,gBAAgB;;AAG/B,KAAI,CAAC,SAAS,eAAe;AAC3B,WAAS,gBAAgB;AACzB,UAAQ,KAAK,aAAa;;AAG5B,OAAMA,SAAG,UAAU,cAAc,KAAK,UAAU,UAAU,MAAM,EAAE,EAAE,QAAQ;AAO5E,QAAO;EAJL,QAAQ,SAAS,IACb,YAAY,aAAa,KAAK,QAAQ,KAAK,MAAM,MAAM,EAAE,GAAG,CAAC,KAAK,KAAK,KACvE,GAAG,aAAa;EAIpB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"installMCP.mjs","names":["fs"],"sources":["../../../src/installMCP/installMCP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { PLATFORMS_METADATA, type Platform } from '../installSkills';\n\nexport type MCPTransport = 'stdio' | 'sse';\n\nconst MCP_CONFIG_FILENAME = 'mcp.json';\n\nconst CLAUDE_DESKTOP_CONFIG_PATH =\n process.platform === 'win32'\n ? path.join(\n process.env.APPDATA || '',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : path.join(\n os.homedir(),\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n );\n\n/**\n * Installs the Intlayer MCP server configuration for a specific platform.\n */\nexport const installMCP = async (\n projectRoot: string,\n platform: Platform,\n transport: MCPTransport\n): Promise<string> => {\n let configPath: string;\n let configKey = 'mcpServers';\n\n if (platform === 'Claude') {\n configPath = CLAUDE_DESKTOP_CONFIG_PATH;\n } else {\n const relativeDir = path.dirname(PLATFORMS_METADATA[platform].dir); // e.g. .cursor or .vscode\n configPath = path.join(projectRoot, relativeDir, MCP_CONFIG_FILENAME);\n\n if (platform === 'VSCode') {\n configKey = 'servers';\n }\n }\n\n // Ensure the configuration directory exists\n await fs.mkdir(path.dirname(configPath), { recursive: true });\n\n let config: any = {};\n try {\n const content = await fs.readFile(configPath, 'utf-8');\n config = JSON.parse(content);\n } catch {\n // File doesn't exist or is invalid JSON, start fresh\n }\n\n if (!config[configKey]) {\n config[configKey] = {};\n }\n\n if (transport === 'stdio') {\n const mcpConfig: any = {\n command: 'npx',\n args: ['-y', '@intlayer/mcp'],\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'stdio';\n }\n\n config[configKey].intlayer = mcpConfig;\n } else {\n const mcpConfig: any = {\n url: 'https://mcp.intlayer.org',\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'sse';\n } else {\n mcpConfig.transport = 'sse';\n }\n\n config[configKey].intlayer = mcpConfig;\n }\n\n await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');\n\n return `MCP server configuration updated in ${configPath}`;\n};\n"],"mappings":";;;;;;AAOA,MAAM,sBAAsB;AAE5B,MAAM,6BACJ,QAAQ,aAAa,UACjB,KAAK,KACH,QAAQ,IAAI,WAAW,IACvB,UACA,4BACF,IACA,KAAK,KACH,GAAG,QAAQ,GACX,WACA,uBACA,UACA,4BACF;;;;AAKN,MAAa,aAAa,OACxB,aACA,UACA,cACoB;CACpB,IAAI;CACJ,IAAI,YAAY;CAEhB,IAAI,aAAa,UACf,aAAa;MACR;EACL,MAAM,cAAc,KAAK,QAAQ,mBAAmB,UAAU,GAAG;EACjE,aAAa,KAAK,KAAK,aAAa,aAAa,mBAAmB;EAEpE,IAAI,aAAa,UACf,YAAY;CAEhB;CAGA,MAAMA,SAAG,MAAM,KAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;CAE5D,IAAI,SAAc,CAAC;CACnB,IAAI;EACF,MAAM,UAAU,MAAMA,SAAG,SAAS,YAAY,OAAO;EACrD,SAAS,KAAK,MAAM,OAAO;CAC7B,QAAQ,CAER;CAEA,IAAI,CAAC,OAAO,YACV,OAAO,aAAa,CAAC;CAGvB,IAAI,cAAc,SAAS;EACzB,MAAM,YAAiB;GACrB,SAAS;GACT,MAAM,CAAC,MAAM,eAAe;EAC9B;EAEA,IAAI,aAAa,UACf,UAAU,OAAO;EAGnB,OAAO,WAAW,WAAW;CAC/B,OAAO;EACL,MAAM,YAAiB,EACrB,KAAK,2BACP;EAEA,IAAI,aAAa,UACf,UAAU,OAAO;OAEjB,UAAU,YAAY;EAGxB,OAAO,WAAW,WAAW;CAC/B;CAEA,MAAMA,SAAG,UAAU,YAAY,KAAK,UAAU,QAAQ,MAAM,CAAC,GAAG,OAAO;CAEvE,OAAO,uCAAuC;AAChD"}
1
+ {"version":3,"file":"installMCP.mjs","names":["fs"],"sources":["../../../src/installMCP/installMCP.ts"],"sourcesContent":["import { promises as fs } from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { PLATFORMS_METADATA, type Platform } from '../installSkills';\n\nexport type MCPTransport = 'stdio' | 'sse';\n\nconst MCP_CONFIG_FILENAME = 'mcp.json';\n\nconst CLAUDE_DESKTOP_CONFIG_PATH =\n process.platform === 'win32'\n ? path.join(\n process.env.APPDATA || '',\n 'Claude',\n 'claude_desktop_config.json'\n )\n : path.join(\n os.homedir(),\n 'Library',\n 'Application Support',\n 'Claude',\n 'claude_desktop_config.json'\n );\n\n/**\n * Installs the Intlayer MCP server configuration for a specific platform.\n */\nexport const installMCP = async (\n projectRoot: string,\n platform: Platform,\n transport: MCPTransport\n): Promise<string> => {\n let configPath: string;\n let configKey = 'mcpServers';\n\n if (platform === 'Claude') {\n configPath = CLAUDE_DESKTOP_CONFIG_PATH;\n } else {\n const relativeDir = path.dirname(PLATFORMS_METADATA[platform].dir); // e.g. .cursor or .vscode\n configPath = path.join(projectRoot, relativeDir, MCP_CONFIG_FILENAME);\n\n if (platform === 'VSCode') {\n configKey = 'servers';\n }\n }\n\n // Ensure the configuration directory exists\n await fs.mkdir(path.dirname(configPath), { recursive: true });\n\n let config: any = {};\n try {\n const content = await fs.readFile(configPath, 'utf-8');\n config = JSON.parse(content);\n } catch {\n // File doesn't exist or is invalid JSON, start fresh\n }\n\n if (!config[configKey]) {\n config[configKey] = {};\n }\n\n if (transport === 'stdio') {\n const mcpConfig: any = {\n command: 'npx',\n args: ['-y', '@intlayer/mcp'],\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'stdio';\n }\n\n config[configKey].intlayer = mcpConfig;\n } else {\n const mcpConfig: any = {\n url: 'https://mcp.intlayer.org',\n };\n\n if (platform === 'VSCode') {\n mcpConfig.type = 'sse';\n } else {\n mcpConfig.transport = 'sse';\n }\n\n config[configKey].intlayer = mcpConfig;\n }\n\n await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');\n\n return `MCP server configuration updated in ${configPath}`;\n};\n"],"mappings":";;;;;;AAOA,MAAM,sBAAsB;AAE5B,MAAM,6BACJ,QAAQ,aAAa,UACjB,KAAK,KACH,QAAQ,IAAI,WAAW,IACvB,UACA,6BACD,GACD,KAAK,KACH,GAAG,SAAS,EACZ,WACA,uBACA,UACA,6BACD;;;;AAKP,MAAa,aAAa,OACxB,aACA,UACA,cACoB;CACpB,IAAI;CACJ,IAAI,YAAY;AAEhB,KAAI,aAAa,SACf,cAAa;MACR;EACL,MAAM,cAAc,KAAK,QAAQ,mBAAmB,UAAU,IAAI;AAClE,eAAa,KAAK,KAAK,aAAa,aAAa,oBAAoB;AAErE,MAAI,aAAa,SACf,aAAY;;AAKhB,OAAMA,SAAG,MAAM,KAAK,QAAQ,WAAW,EAAE,EAAE,WAAW,MAAM,CAAC;CAE7D,IAAI,SAAc,EAAE;AACpB,KAAI;EACF,MAAM,UAAU,MAAMA,SAAG,SAAS,YAAY,QAAQ;AACtD,WAAS,KAAK,MAAM,QAAQ;SACtB;AAIR,KAAI,CAAC,OAAO,WACV,QAAO,aAAa,EAAE;AAGxB,KAAI,cAAc,SAAS;EACzB,MAAM,YAAiB;GACrB,SAAS;GACT,MAAM,CAAC,MAAM,gBAAgB;GAC9B;AAED,MAAI,aAAa,SACf,WAAU,OAAO;AAGnB,SAAO,WAAW,WAAW;QACxB;EACL,MAAM,YAAiB,EACrB,KAAK,4BACN;AAED,MAAI,aAAa,SACf,WAAU,OAAO;MAEjB,WAAU,YAAY;AAGxB,SAAO,WAAW,WAAW;;AAG/B,OAAMA,SAAG,UAAU,YAAY,KAAK,UAAU,QAAQ,MAAM,EAAE,EAAE,QAAQ;AAExE,QAAO,uCAAuC"}