@intlayer/chokidar 8.0.4 → 8.0.5

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 (231) hide show
  1. package/dist/assets/installSkills/skills/angular.md +40 -0
  2. package/dist/assets/installSkills/skills/astro.md +13 -0
  3. package/dist/assets/installSkills/skills/config.md +5 -0
  4. package/dist/assets/installSkills/skills/content.md +127 -0
  5. package/dist/assets/installSkills/skills/extra_action.md +6 -0
  6. package/dist/assets/installSkills/skills/next_js.md +35 -0
  7. package/dist/assets/installSkills/skills/react.md +18 -0
  8. package/dist/assets/installSkills/skills/remote_content.md +6 -0
  9. package/dist/assets/installSkills/skills/setup.md +25 -0
  10. package/dist/assets/installSkills/skills/svelte.md +17 -0
  11. package/dist/assets/installSkills/skills/usage.md +103 -0
  12. package/dist/assets/installSkills/skills/vue.md +27 -0
  13. package/dist/cjs/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
  14. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  15. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +2 -1
  16. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -1
  17. package/dist/cjs/buildIntlayerDictionary/index.cjs +1 -0
  18. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +2 -1
  19. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -1
  20. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +2 -1
  21. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -1
  22. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +2 -1
  23. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -1
  24. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +2 -1
  25. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -1
  26. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +2 -1
  27. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -1
  28. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +3 -2
  29. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -1
  30. package/dist/cjs/cleanOutputDir.cjs +2 -1
  31. package/dist/cjs/cleanOutputDir.cjs.map +1 -1
  32. package/dist/cjs/cleanRemovedContentDeclaration.cjs +3 -2
  33. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -1
  34. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +2 -1
  35. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -1
  36. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +2 -1
  37. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -1
  38. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +3 -2
  39. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -1
  40. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +3 -2
  41. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -1
  42. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +3 -2
  43. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -1
  44. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +3 -2
  45. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -1
  46. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +3 -2
  47. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -1
  48. package/dist/cjs/createDictionaryEntryPoint/index.cjs +1 -0
  49. package/dist/cjs/createType/createModuleAugmentation.cjs +3 -2
  50. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -1
  51. package/dist/cjs/createType/createType.cjs +2 -1
  52. package/dist/cjs/createType/createType.cjs.map +1 -1
  53. package/dist/cjs/createType/index.cjs +1 -0
  54. package/dist/cjs/fetchDistantDictionaries.cjs +2 -1
  55. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -1
  56. package/dist/cjs/filterInvalidDictionaries.cjs +2 -1
  57. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -1
  58. package/dist/cjs/formatDictionary.cjs +2 -1
  59. package/dist/cjs/formatDictionary.cjs.map +1 -1
  60. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +2 -1
  61. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -1
  62. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +2 -1
  63. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -1
  64. package/dist/cjs/handleContentDeclarationFileChange.cjs +2 -1
  65. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -1
  66. package/dist/cjs/handleContentDeclarationFileMoved.cjs +2 -1
  67. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -1
  68. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +2 -1
  69. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -1
  70. package/dist/cjs/index.cjs +5 -0
  71. package/dist/cjs/init/index.cjs +75 -9
  72. package/dist/cjs/init/index.cjs.map +1 -1
  73. package/dist/cjs/init/utils/configManipulation.cjs +165 -0
  74. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -0
  75. package/dist/cjs/init/utils/fileSystem.cjs +2 -1
  76. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -1
  77. package/dist/cjs/init/utils/index.cjs +4 -0
  78. package/dist/cjs/init/utils/jsonParser.cjs +1 -0
  79. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -1
  80. package/dist/cjs/init/utils/tsConfig.cjs +2 -1
  81. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -1
  82. package/dist/cjs/initConfig/index.cjs +2 -1
  83. package/dist/cjs/initConfig/index.cjs.map +1 -1
  84. package/dist/cjs/installSkills/index.cjs +65 -0
  85. package/dist/cjs/installSkills/index.cjs.map +1 -0
  86. package/dist/cjs/listDictionariesPath.cjs +3 -2
  87. package/dist/cjs/listDictionariesPath.cjs.map +1 -1
  88. package/dist/cjs/listGitFiles.cjs +4 -3
  89. package/dist/cjs/listGitFiles.cjs.map +1 -1
  90. package/dist/cjs/listProjects.cjs +4 -3
  91. package/dist/cjs/listProjects.cjs.map +1 -1
  92. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +2 -1
  93. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -1
  94. package/dist/cjs/loadDictionaries/index.cjs +1 -0
  95. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -1
  96. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -1
  97. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +2 -1
  98. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -1
  99. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +2 -1
  100. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -1
  101. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +2 -1
  102. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -1
  103. package/dist/cjs/loadDictionaries/log.cjs +3 -2
  104. package/dist/cjs/loadDictionaries/log.cjs.map +1 -1
  105. package/dist/cjs/prepareIntlayer.cjs +3 -2
  106. package/dist/cjs/prepareIntlayer.cjs.map +1 -1
  107. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +1 -0
  108. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -1
  109. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +2 -1
  110. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -1
  111. package/dist/cjs/transformFiles/extractDictionaryKey.cjs +2 -1
  112. package/dist/cjs/transformFiles/extractDictionaryKey.cjs.map +1 -1
  113. package/dist/cjs/transformFiles/index.cjs +1 -0
  114. package/dist/cjs/transformFiles/transformFiles.cjs +4 -3
  115. package/dist/cjs/transformFiles/transformFiles.cjs.map +1 -1
  116. package/dist/cjs/utils/autoDecorateContent.cjs +2 -1
  117. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -1
  118. package/dist/cjs/utils/buildFilesList.cjs +3 -2
  119. package/dist/cjs/utils/buildFilesList.cjs.map +1 -1
  120. package/dist/cjs/utils/chunkJSON.cjs +1 -0
  121. package/dist/cjs/utils/chunkJSON.cjs.map +1 -1
  122. package/dist/cjs/utils/formatter.cjs +3 -2
  123. package/dist/cjs/utils/formatter.cjs.map +1 -1
  124. package/dist/cjs/utils/getChunk.cjs +1 -0
  125. package/dist/cjs/utils/getChunk.cjs.map +1 -1
  126. package/dist/cjs/utils/getComponentTransformPattern.cjs +6 -6
  127. package/dist/cjs/utils/getComponentTransformPattern.cjs.map +1 -1
  128. package/dist/cjs/utils/getFileHash.cjs +3 -2
  129. package/dist/cjs/utils/getFileHash.cjs.map +1 -1
  130. package/dist/cjs/utils/getFormatFromExtension.cjs +1 -0
  131. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -1
  132. package/dist/cjs/utils/pLimit.cjs +1 -0
  133. package/dist/cjs/utils/pLimit.cjs.map +1 -1
  134. package/dist/cjs/utils/parallelize.cjs +1 -0
  135. package/dist/cjs/utils/parallelize.cjs.map +1 -1
  136. package/dist/cjs/utils/parallelizeGlobal.cjs +1 -0
  137. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -1
  138. package/dist/cjs/utils/reduceObjectFormat.cjs +1 -0
  139. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -1
  140. package/dist/cjs/utils/resolveObjectPromises.cjs +1 -0
  141. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -1
  142. package/dist/cjs/utils/runOnce.cjs +3 -2
  143. package/dist/cjs/utils/runOnce.cjs.map +1 -1
  144. package/dist/cjs/utils/runParallel/bin.cjs +2 -1
  145. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -1
  146. package/dist/cjs/utils/runParallel/bootstrap.cjs +1 -0
  147. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -1
  148. package/dist/cjs/utils/runParallel/index.cjs +2 -1
  149. package/dist/cjs/utils/runParallel/index.cjs.map +1 -1
  150. package/dist/cjs/utils/runParallel/pidTree.cjs +3 -2
  151. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -1
  152. package/dist/cjs/utils/runParallel/ps.cjs +3 -2
  153. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -1
  154. package/dist/cjs/utils/runParallel/runTask.cjs +2 -1
  155. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -1
  156. package/dist/cjs/utils/runParallel/spawnPosix.cjs +2 -1
  157. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -1
  158. package/dist/cjs/utils/runParallel/spawnWin32.cjs +2 -1
  159. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -1
  160. package/dist/cjs/utils/runParallel/wmic.cjs +3 -2
  161. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -1
  162. package/dist/cjs/utils/sortAlphabetically.cjs +1 -0
  163. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -1
  164. package/dist/cjs/utils/splitTextByLine.cjs +1 -0
  165. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -1
  166. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +1 -0
  167. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -1
  168. package/dist/cjs/watcher.cjs +2 -1
  169. package/dist/cjs/watcher.cjs.map +1 -1
  170. package/dist/cjs/writeConfiguration/index.cjs +2 -1
  171. package/dist/cjs/writeConfiguration/index.cjs.map +1 -1
  172. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +1 -0
  173. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -1
  174. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs +2 -1
  175. package/dist/cjs/writeContentDeclaration/detectFormatCommand.cjs.map +1 -1
  176. package/dist/cjs/writeContentDeclaration/index.cjs +1 -0
  177. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -1
  178. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -1
  179. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +2 -1
  180. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -1
  181. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +2 -1
  182. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -1
  183. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +2 -1
  184. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -1
  185. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +2 -1
  186. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -1
  187. package/dist/cjs/writeFileIfChanged.cjs +2 -1
  188. package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
  189. package/dist/cjs/writeJsonIfChanged.cjs +1 -0
  190. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -1
  191. package/dist/esm/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +1 -1
  192. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +1 -1
  193. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -1
  194. package/dist/esm/index.mjs +2 -1
  195. package/dist/esm/init/index.mjs +74 -9
  196. package/dist/esm/init/index.mjs.map +1 -1
  197. package/dist/esm/init/utils/configManipulation.mjs +162 -0
  198. package/dist/esm/init/utils/configManipulation.mjs.map +1 -0
  199. package/dist/esm/init/utils/index.mjs +2 -1
  200. package/dist/esm/installSkills/index.mjs +60 -0
  201. package/dist/esm/installSkills/index.mjs.map +1 -0
  202. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +1 -1
  203. package/dist/esm/transformFiles/transformFiles.mjs +1 -1
  204. package/dist/esm/utils/getComponentTransformPattern.mjs +4 -4
  205. package/dist/esm/utils/getComponentTransformPattern.mjs.map +1 -1
  206. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
  207. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -1
  208. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +3 -3
  209. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -1
  210. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
  211. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -1
  212. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -2
  213. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -1
  214. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +2 -2
  215. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -1
  216. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
  217. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -1
  218. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -2
  219. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -1
  220. package/dist/types/index.d.ts +2 -1
  221. package/dist/types/init/index.d.ts.map +1 -1
  222. package/dist/types/init/utils/configManipulation.d.ts +18 -0
  223. package/dist/types/init/utils/configManipulation.d.ts.map +1 -0
  224. package/dist/types/init/utils/index.d.ts +2 -1
  225. package/dist/types/installSkills/index.d.ts +21 -0
  226. package/dist/types/installSkills/index.d.ts.map +1 -0
  227. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -2
  228. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -1
  229. package/dist/types/watcher.d.ts +2 -2
  230. package/dist/types/watcher.d.ts.map +1 -1
  231. package/package.json +12 -12
@@ -1 +1 @@
1
- {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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 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,+CAAyB,OAAO;AAGtC,WAAU,6BAA6BA,mCAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAMC,0CAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,OAAMC,yFAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,sEAAyB,OAAO;AAEhC,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
+ {"version":3,"file":"handleAdditionalContentDeclarationFile.cjs","names":["formatPath","buildDictionary","loadLocalDictionaries","createTypes","createDictionaryEntryPoint"],"sources":["../../src/handleAdditionalContentDeclarationFile.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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 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,+CAAyB,OAAO;AAGtC,WAAU,6BAA6BA,mCAAW,SAAS,IAAI,EAC7D,WAAW,MACZ,CAAC;CAIF,MAAM,qBAAqB,MAAMC,wEAFN,MAAMC,qEAAsB,UAAU,OAAO,EAEH,OAAO;AAM5E,OAAMC,0CAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,OAAMC,yFAA2B,OAAO;AAExC,WAAU,sBAAsB,EAC9B,WAAW,MACZ,CAAC;AAEF,sEAAyB,OAAO;AAEhC,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,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_createDictionaryEntryPoint_getBuiltDictionariesPath = require('./createDictionaryEntryPoint/getBuiltDictionariesPath.cjs');
3
4
  const require_createDictionaryEntryPoint_createDictionaryEntryPoint = require('./createDictionaryEntryPoint/createDictionaryEntryPoint.cjs');
4
5
  const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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 Entry Point & Module Augmentation\n // These only need to be updated if 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 // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\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 if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of 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,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,+CAAyB,OAAO;AAGtC,WAAU,oBAAoBA,mCAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAEF,MAAM,uBAAiC,MAAMC,qFAAyB,OAAO;CAE7E,MAAM,qBAAqB,MAAMC,qEAAsB,UAAU,OAAO;CAExE,MAAM,qBAAqB,MAAMC,wEAAgB,oBAAoB,OAAO;CAC5E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C;CACD,MAAM,2BAA2B,oBAAoB,KAClD,eAAe,WAAW,eAC5B;CAED,MAAM,EAAE,aAAa,eAAe,MAAMC,sEACxC,UACA,mBAAmB,KAAK,eAAe,WAAW,IAAI,EACtD,OACD;CAED,MAAM,qBAAqB,yBAAyB,MACjD,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD;AAID,KAAI,cAAc,oBAIhB;MAAI,CAAC,YAAY;AACf,SAAMC,yFAA2B,QAAQ,EAAE,aAAa,CAAC;AACzD,aAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;;AAWN,OAAMC,0CAJsB,oBAAoB,KAC7C,eAAe,WAAW,WAC5B,EAEsC,OAAO;AAC9C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAEF,KAAI,oBAAoB;AACtB,QAAMC,qEAAyB,OAAO;AACtC,YAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;;AAKJ,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
+ {"version":3,"file":"handleContentDeclarationFileChange.cjs","names":["formatPath","getBuiltDictionariesPath","loadLocalDictionaries","buildDictionary","cleanRemovedContentDeclaration","createDictionaryEntryPoint","createTypes","createModuleAugmentation"],"sources":["../../src/handleContentDeclarationFileChange.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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 Entry Point & Module Augmentation\n // These only need to be updated if 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 // Rebuild Types\n // Always regenerate types when a file changes, as the content structure (interface) might have changed\n // even if the key is the same.\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 if (hasNewDictionaries) {\n await createModuleAugmentation(config);\n appLogger('Module augmentation built', {\n isVerbose: true,\n });\n }\n\n // Plugin transformation\n // Allow plugins to post-process the final build output (e.g., write back ICU JSON)\n for await (const plugin of 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,qCAAqC,OAChD,UACA,WACG;CACH,MAAM,+CAAyB,OAAO;AAGtC,WAAU,oBAAoBA,mCAAW,SAAS,IAAI,EACpD,WAAW,MACZ,CAAC;CAEF,MAAM,uBAAiC,MAAMC,qFAAyB,OAAO;CAE7E,MAAM,qBAAqB,MAAMC,qEAAsB,UAAU,OAAO;CAExE,MAAM,qBAAqB,MAAMC,wEAAgB,oBAAoB,OAAO;CAC5E,MAAM,sBAAsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C;CACD,MAAM,2BAA2B,oBAAoB,KAClD,eAAe,WAAW,eAC5B;CAED,MAAM,EAAE,aAAa,eAAe,MAAMC,sEACxC,UACA,mBAAmB,KAAK,eAAe,WAAW,IAAI,EACtD,OACD;CAED,MAAM,qBAAqB,yBAAyB,MACjD,0BACC,CAAC,qBAAqB,SAAS,sBAAsB,CACxD;AAID,KAAI,cAAc,oBAIhB;MAAI,CAAC,YAAY;AACf,SAAMC,yFAA2B,QAAQ,EAAE,aAAa,CAAC;AACzD,aAAU,yBAAyB,EACjC,WAAW,MACZ,CAAC;;;AAWN,OAAMC,0CAJsB,oBAAoB,KAC7C,eAAe,WAAW,WAC5B,EAEsC,OAAO;AAC9C,WAAU,0BAA0B,EAClC,WAAW,MACZ,CAAC;AAEF,KAAI,oBAAoB;AACtB,QAAMC,qEAAyB,OAAO;AACtC,YAAU,6BAA6B,EACrC,WAAW,MACZ,CAAC;;AAKJ,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,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
3
4
  const require_utils_formatter = require('./utils/formatter.cjs');
4
5
  const require_loadDictionaries_loadLocalDictionaries = require('./loadDictionaries/loadLocalDictionaries.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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,+CAAyB,OAAO;AAEtC,WACE,mBAAmBA,mCAAW,YAAY,CAAC,MAAMA,mCAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;CAED,IAAI,aAAuB,EAAE;AAE7B,KAAI;AAQF,gBAJ8B,MAAMC,qEAClC,aACA,OACD,EACkC,KAAK,MAAM,EAAE,IAAI;SAC9C;AACN,YACE,iDAAiDD,mCAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;;AASH,OAAME,sEAA+B,aAAa,YAAY,OAAO;AAKrE,OAAMC,8EAAmC,aAAa,OAAO"}
1
+ {"version":3,"file":"handleContentDeclarationFileMoved.cjs","names":["formatPath","loadLocalDictionaries","cleanRemovedContentDeclaration","handleContentDeclarationFileChange"],"sources":["../../src/handleContentDeclarationFileMoved.ts"],"sourcesContent":["import { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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,+CAAyB,OAAO;AAEtC,WACE,mBAAmBA,mCAAW,YAAY,CAAC,MAAMA,mCAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;CAED,IAAI,aAAuB,EAAE;AAE7B,KAAI;AAQF,gBAJ8B,MAAMC,qEAClC,aACA,OACD,EACkC,KAAK,MAAM,EAAE,IAAI;SAC9C;AACN,YACE,iDAAiDD,mCAAW,YAAY,IACxE,EACE,WAAW,MACZ,CACF;;AASH,OAAME,sEAA+B,aAAa,YAAY,OAAO;AAKrE,OAAMC,8EAAmC,aAAa,OAAO"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
2
3
  const require_cleanRemovedContentDeclaration = require('./cleanRemovedContentDeclaration.cjs');
3
4
  const require_utils_formatter = require('./utils/formatter.cjs');
4
5
  const require_buildIntlayerDictionary_buildIntlayerDictionary = require('./buildIntlayerDictionary/buildIntlayerDictionary.cjs');
@@ -1 +1 @@
1
- {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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,+CAAyB,OAAO;AAGtC,WAAU,sBAAsBA,mCAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAQF,MAAM,qBAAqB,MAAMC,sEANT,MAAMC,8CAAiB,OAAO,EAE1B,QACzB,kCAAmB,KAAK,8BAAe,SAAS,CAClD,EAEqE,OAAO;AAE7E,OAAMC,sEAA+B,UAAU,EAAE,EAAE,OAAO;CAE1D,MAAM,qBAAqB,MAAMC,wEAAgB,oBAAoB,OAAO;AAM5E,OAAMC,0CAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAMC,qEAAyB,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
+ {"version":3,"file":"handleUnlinkedContentDeclarationFile.cjs","names":["formatPath","loadLocalDictionaries","listDictionaries","cleanRemovedContentDeclaration","buildDictionary","createTypes","createModuleAugmentation"],"sources":["../../src/handleUnlinkedContentDeclarationFile.ts"],"sourcesContent":["import { normalize } from 'node:path';\nimport { getAppLogger } from '@intlayer/config';\nimport type { IntlayerConfig } from '@intlayer/types';\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,+CAAyB,OAAO;AAGtC,WAAU,sBAAsBA,mCAAW,SAAS,IAAI,EACtD,WAAW,MACZ,CAAC;CAQF,MAAM,qBAAqB,MAAMC,sEANT,MAAMC,8CAAiB,OAAO,EAE1B,QACzB,kCAAmB,KAAK,8BAAe,SAAS,CAClD,EAEqE,OAAO;AAE7E,OAAMC,sEAA+B,UAAU,EAAE,EAAE,OAAO;CAE1D,MAAM,qBAAqB,MAAMC,wEAAgB,oBAAoB,OAAO;AAM5E,OAAMC,0CAJsB,OAAO,OACjC,oBAAoB,sBAAsB,EAAE,CAC7C,CAAC,KAAK,eAAe,WAAW,WAAW,EAEL,OAAO;AAE9C,WAAU,wBAAwB,EAChC,WAAW,MACZ,CAAC;AAEF,OAAMC,qEAAyB,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,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
  const require_cleanOutputDir = require('./cleanOutputDir.cjs');
2
3
  const require_utils_pLimit = require('./utils/pLimit.cjs');
3
4
  const require_utils_parallelize = require('./utils/parallelize.cjs');
@@ -26,6 +27,7 @@ const require_listDictionariesPath = require('./listDictionariesPath.cjs');
26
27
  const require_handleUnlinkedContentDeclarationFile = require('./handleUnlinkedContentDeclarationFile.cjs');
27
28
  const require_getContentDeclarationFileTemplate_getContentDeclarationFileTemplate = require('./getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs');
28
29
  const require_init_index = require('./init/index.cjs');
30
+ const require_installSkills_index = require('./installSkills/index.cjs');
29
31
  const require_listGitFiles = require('./listGitFiles.cjs');
30
32
  const require_listProjects = require('./listProjects.cjs');
31
33
  const require_utils_sortAlphabetically = require('./utils/sortAlphabetically.cjs');
@@ -54,6 +56,8 @@ const require_utils_verifyIdenticObjectFormat = require('./utils/verifyIdenticOb
54
56
  const require_watcher = require('./watcher.cjs');
55
57
 
56
58
  exports.ATTRIBUTES_TO_EXTRACT = require_transformFiles_transformFiles.ATTRIBUTES_TO_EXTRACT;
59
+ exports.SKILLS = require_installSkills_index.SKILLS;
60
+ exports.SKILLS_METADATA = require_installSkills_index.SKILLS_METADATA;
57
61
  exports.assembleJSON = require_utils_chunkJSON.assembleJSON;
58
62
  exports.autoDecorateContent = require_utils_autoDecorateContent.autoDecorateContent;
59
63
  exports.buildAndWatchIntlayer = require_watcher.buildAndWatchIntlayer;
@@ -95,6 +99,7 @@ exports.handleAdditionalContentDeclarationFile = require_handleAdditionalContent
95
99
  exports.handleContentDeclarationFileChange = require_handleContentDeclarationFileChange.handleContentDeclarationFileChange;
96
100
  exports.handleUnlinkedContentDeclarationFile = require_handleUnlinkedContentDeclarationFile.handleUnlinkedContentDeclarationFile;
97
101
  exports.initIntlayer = require_init_index.initIntlayer;
102
+ exports.installSkills = require_installSkills_index.installSkills;
98
103
  exports.isInvalidDictionary = require_filterInvalidDictionaries.isInvalidDictionary;
99
104
  exports.listDictionaries = require_listDictionariesPath.listDictionaries;
100
105
  exports.listDictionariesWithStats = require_listDictionariesPath.listDictionariesWithStats;
@@ -1,5 +1,7 @@
1
- const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
3
  const require_initConfig_index = require('../initConfig/index.cjs');
4
+ const require_init_utils_configManipulation = require('./utils/configManipulation.cjs');
3
5
  const require_init_utils_fileSystem = require('./utils/fileSystem.cjs');
4
6
  const require_init_utils_jsonParser = require('./utils/jsonParser.cjs');
5
7
  const require_init_utils_tsConfig = require('./utils/tsConfig.cjs');
@@ -138,16 +140,17 @@ const initIntlayer = async (rootDir) => {
138
140
  }
139
141
  }
140
142
  await require_initConfig_index.initConfig(hasTsConfig ? "intlayer.config.ts" : "intlayer.config.mjs", rootDir);
143
+ let hasAliasConfiguration = false;
141
144
  for (const file of [
142
145
  "vite.config.ts",
143
146
  "vite.config.js",
144
147
  "vite.config.mjs"
145
148
  ]) if (await require_init_utils_fileSystem.exists(rootDir, file)) {
146
- let content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, file);
149
+ hasAliasConfiguration = true;
150
+ const content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, file);
147
151
  if (!content.includes("vite-intlayer")) {
148
- content = `import { intlayer } from 'vite-intlayer'; // Add the plugin to the Vite plugin list\n${content}`;
149
- await require_init_utils_fileSystem.writeFileToRoot(rootDir, file, content);
150
- (0, _intlayer_config.logger)(`${_intlayer_config.v} Injected import into ${(0, _intlayer_config.colorizePath)(file)}`);
152
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, file, require_init_utils_configManipulation.updateViteConfig(content, file.split(".").pop()));
153
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Updated ${(0, _intlayer_config.colorizePath)(file)} to include Intlayer plugin`);
151
154
  }
152
155
  break;
153
156
  }
@@ -156,14 +159,77 @@ const initIntlayer = async (rootDir) => {
156
159
  "next.config.mjs",
157
160
  "next.config.ts"
158
161
  ]) if (await require_init_utils_fileSystem.exists(rootDir, file)) {
159
- let content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, file);
162
+ hasAliasConfiguration = true;
163
+ const content = await require_init_utils_fileSystem.readFileFromRoot(rootDir, file);
160
164
  if (!content.includes("next-intlayer")) {
161
- content = `import { withIntlayer } from 'next-intlayer/server'; // Add the plugin to the Next.js configuration\n${content}`;
162
- await require_init_utils_fileSystem.writeFileToRoot(rootDir, file, content);
163
- (0, _intlayer_config.logger)(`${_intlayer_config.v} Injected import into ${(0, _intlayer_config.colorizePath)(file)}`);
165
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, file, require_init_utils_configManipulation.updateNextConfig(content, file.split(".").pop()));
166
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Updated ${(0, _intlayer_config.colorizePath)(file)} to include Intlayer plugin`);
164
167
  }
165
168
  break;
166
169
  }
170
+ for (const file of [
171
+ "webpack.config.js",
172
+ "webpack.config.ts",
173
+ "webpack.config.mjs",
174
+ "webpack.config.cjs"
175
+ ]) if (await require_init_utils_fileSystem.exists(rootDir, file)) {
176
+ hasAliasConfiguration = true;
177
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Found ${(0, _intlayer_config.colorizePath)(file)}. Make sure to configure aliases manually or use the Intlayer Webpack plugin.`);
178
+ break;
179
+ }
180
+ if (!hasAliasConfiguration) {
181
+ const aliases = (0, _intlayer_config.getAlias)({ configuration: (0, _intlayer_config.getConfiguration)({ baseDir: rootDir }) });
182
+ if (hasTsConfig && tsConfigFiles.length > 0) {
183
+ const tsConfigPath = tsConfigFiles.find((f) => f === "tsconfig.json") || tsConfigFiles[0];
184
+ const config = require_init_utils_jsonParser.parseJSONWithComments(await require_init_utils_fileSystem.readFileFromRoot(rootDir, tsConfigPath));
185
+ config.compilerOptions ??= {};
186
+ config.compilerOptions.paths ??= {};
187
+ let updated = false;
188
+ Object.entries(aliases).forEach(([alias, path]) => {
189
+ if (!config.compilerOptions.paths[alias]) {
190
+ config.compilerOptions.paths[alias] = [path];
191
+ updated = true;
192
+ }
193
+ });
194
+ if (updated) {
195
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, tsConfigPath, JSON.stringify(config, null, 2));
196
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Updated ${(0, _intlayer_config.colorizePath)(tsConfigPath)} to include Intlayer aliases`);
197
+ }
198
+ } else {
199
+ const jsConfigPath = "jsconfig.json";
200
+ if (await require_init_utils_fileSystem.exists(rootDir, jsConfigPath)) {
201
+ const config = require_init_utils_jsonParser.parseJSONWithComments(await require_init_utils_fileSystem.readFileFromRoot(rootDir, jsConfigPath));
202
+ config.compilerOptions ??= {};
203
+ config.compilerOptions.paths ??= {};
204
+ let updated = false;
205
+ Object.entries(aliases).forEach(([alias, path]) => {
206
+ if (!config.compilerOptions.paths[alias]) {
207
+ config.compilerOptions.paths[alias] = [path];
208
+ updated = true;
209
+ }
210
+ });
211
+ if (updated) {
212
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, jsConfigPath, JSON.stringify(config, null, 2));
213
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Updated ${(0, _intlayer_config.colorizePath)(jsConfigPath)} to include Intlayer aliases`);
214
+ }
215
+ } else {
216
+ packageJson.imports ??= {};
217
+ let updated = false;
218
+ Object.entries(aliases).forEach(([alias, path]) => {
219
+ const importAlias = alias.replace("@", "#");
220
+ const importPath = path.startsWith(".") ? path : `./${path}`;
221
+ if (!packageJson.imports[importAlias]) {
222
+ packageJson.imports[importAlias] = importPath;
223
+ updated = true;
224
+ }
225
+ });
226
+ if (updated) {
227
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, packageJsonPath, JSON.stringify(packageJson, null, 2));
228
+ (0, _intlayer_config.logger)(`${_intlayer_config.v} Updated ${(0, _intlayer_config.colorizePath)(packageJsonPath)} to include Intlayer imports`);
229
+ }
230
+ }
231
+ }
232
+ }
167
233
  (0, _intlayer_config.logger)(`${_intlayer_config.v} ${(0, _intlayer_config.colorize)("Intlayer init setup complete.", _intlayer_config.ANSIColors.GREEN)}`);
168
234
  (0, _intlayer_config.logger)([
169
235
  (0, _intlayer_config.colorize)("Next →", _intlayer_config.ANSIColors.MAGENTA),
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["ANSIColors","exists","x","readFileFromRoot","writeFileToRoot","v","findTsConfigFiles","parseJSONWithComments","initConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizePath,\n logger,\n v,\n x,\n} from '@intlayer/config';\nimport { initConfig } from '../initConfig';\nimport {\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\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 // 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 * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\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 // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (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 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 // CHECK VITE CONFIG\n const viteConfigs = ['vite.config.ts', 'vite.config.js', 'vite.config.mjs'];\n for (const file of viteConfigs) {\n if (await exists(rootDir, file)) {\n let content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('vite-intlayer')) {\n const viteImport =\n \"import { intlayer } from 'vite-intlayer'; // Add the plugin to the Vite plugin list\";\n\n content = `${viteImport}\\n${content}`;\n await writeFileToRoot(rootDir, file, content);\n logger(`${v} Injected import into ${colorizePath(file)}`);\n }\n break;\n }\n }\n\n // CHECK NEXT CONFIG\n const nextConfigs = ['next.config.js', 'next.config.mjs', 'next.config.ts'];\n for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\n let content = await readFileFromRoot(rootDir, file);\n\n if (!content.includes('next-intlayer')) {\n const nextImport =\n \"import { withIntlayer } from 'next-intlayer/server'; // Add the plugin to the Next.js configuration\";\n\n content = `${nextImport}\\n${content}`;\n await writeFileToRoot(rootDir, file, content);\n logger(`${v} Injected import into ${colorizePath(file)}`);\n }\n break;\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"],"mappings":";;;;;;;;;;;AAoBA,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,UAAU;CACV,cAAc;CACd,WAAW;CACX,aAAa;CACb,SAAS;CACV;;;;AAKD,MAAM,uBAAuB,gBAA6B;CACxD,MAAM,OAAO;EACX,GAAG,YAAY;EACf,GAAG,YAAY;EAChB;;;;;CAMD,MAAM,aAAa,eAAuB,UAA2B;AACnE,MAAI,CAAC,iBAAiB,OAAO,kBAAkB,SAAU,QAAO;AAEhE,SADc,IAAI,OAAO,WAAW,MAAM,WAAW,CACxC,KAAK,cAAc;;AAIlC,KAAI,KAAK,qBAAqB,KAAK,iBACjC,QAAO,oBAAoB;AAE7B,KAAI,KAAK,mBAAmB,KAAK,QAC/B,QAAO,oBAAoB;AAI7B,KAAI,KAAK,SAAS;EAChB,MAAM,UAAU,KAAK;AAErB,MAAI,UAAU,SAAS,GAAG,CACxB,QAAO,oBAAoB;AAG7B,MAAI,UAAU,SAAS,GAAG,C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ACE,GAAGC,mBAAE,8CAAwB,SAAS,CAAC,4BACxC;;UAEG;AACN,gCACE,GAAGH,mBAAE,gEAA0C,SAAS,CAAC,2DAAqC,0BAA0B,CAAC,aACzH,EAAE,OAAO,QAAQ,CAClB;;;AAOP,OAAMM,oCADS,cAAc,uBAAuB,uBAC3B,QAAQ;AAIjC,MAAK,MAAM,QADS;EAAC;EAAkB;EAAkB;EAAkB,CAEzE,KAAI,MAAMP,qCAAO,SAAS,KAAK,EAAE;EAC/B,IAAI,UAAU,MAAME,+CAAiB,SAAS,KAAK;AAEnD,MAAI,CAAC,QAAQ,SAAS,gBAAgB,EAAE;AAItC,aAAU,wFAAkB;AAC5B,SAAMC,8CAAgB,SAAS,MAAM,QAAQ;AAC7C,gCAAO,GAAGC,mBAAE,2DAAqC,KAAK,GAAG;;AAE3D;;AAMJ,MAAK,MAAM,QADS;EAAC;EAAkB;EAAmB;EAAiB,CAEzE,KAAI,MAAMJ,qCAAO,SAAS,KAAK,EAAE;EAC/B,IAAI,UAAU,MAAME,+CAAiB,SAAS,KAAK;AAEnD,MAAI,CAAC,QAAQ,SAAS,gBAAgB,EAAE;AAItC,aAAU,wGAAkB;AAC5B,SAAMC,8CAAgB,SAAS,MAAM,QAAQ;AAC7C,gCAAO,GAAGC,mBAAE,2DAAqC,KAAK,GAAG;;AAE3D;;AAKJ,8BAAO,GAAGA,mBAAE,kCAAY,iCAAiCL,4BAAW,MAAM,GAAG;AAC7E,8BAAO;iCACI,UAAUA,4BAAW,QAAQ;iCAEpC,uEACAA,4BAAW,WACZ;qCACY,SAAS;EACvB,CAAC"}
1
+ {"version":3,"file":"index.cjs","names":["ANSIColors","exists","x","readFileFromRoot","writeFileToRoot","v","findTsConfigFiles","parseJSONWithComments","initConfig","updateViteConfig","updateNextConfig"],"sources":["../../../src/init/index.ts"],"sourcesContent":["import {\n ANSIColors,\n colorize,\n colorizePath,\n getAlias,\n getConfiguration,\n logger,\n v,\n x,\n} from '@intlayer/config';\nimport { initConfig } from '../initConfig';\nimport {\n exists,\n findTsConfigFiles,\n parseJSONWithComments,\n readFileFromRoot,\n updateNextConfig,\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 // 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 * MAIN LOGIC\n */\nexport const initIntlayer = async (rootDir: string) => {\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 // 2. CHECK .GITIGNORE\n const gitignorePath = '.gitignore';\n if (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 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 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 for (const file of nextConfigs) {\n if (await exists(rootDir, file)) {\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 WEBPACK CONFIG\n const webpackConfigs = [\n 'webpack.config.js',\n 'webpack.config.ts',\n 'webpack.config.mjs',\n 'webpack.config.cjs',\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 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((f) => f === 'tsconfig.json') || 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 logger(\n `${v} Updated ${colorizePath(\n tsConfigPath\n )} to include Intlayer aliases`\n );\n }\n } else {\n const jsConfigPath = 'jsconfig.json';\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"],"mappings":";;;;;;;;;;;;;AAwBA,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;C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,CAChB;AAErD,WAAO,oBAAoB,EAAE;AAC7B,WAAO,gBAAgB,UAAU,EAAE;IAEnC,IAAI,UAAU;AAEd,WAAO,QAAQ,QAAQ,CAAC,SAAS,CAAC,OAAO,UAAU;AACjD,SAAI,CAAC,OAAO,gBAAgB,MAAM,QAAQ;AACxC,aAAO,gBAAgB,MAAM,SAAS,CAAC,KAAK;AAC5C,gBAAU;;MAEZ;AAEF,QAAI,SAAS;AACX,WAAMC,8CACJ,SACA,cACA,KAAK,UAAU,QAAQ,MAAM,EAAE,CAChC;AACD,kCACE,GAAGC,mBAAE,8CACH,aACD,CAAC,8BACH;;UAEE;AACL,gBAAY,YAAY,EAAE;IAE1B,IAAI,UAAU;AAEd,WAAO,QAAQ,QAAQ,CAAC,SAAS,CAAC,OAAO,UAAU;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,WAAMD,8CACJ,SACA,iBACA,KAAK,UAAU,aAAa,MAAM,EAAE,CACrC;AACD,kCACE,GAAGC,mBAAE,8CACH,gBACD,CAAC,8BACH;;;;;AAOT,8BAAO,GAAGA,mBAAE,kCAAY,iCAAiCL,4BAAW,MAAM,GAAG;AAC7E,8BAAO;iCACI,UAAUA,4BAAW,QAAQ;iCAEpC,uEACAA,4BAAW,WACZ;qCACY,SAAS;EACvB,CAAC"}
@@ -0,0 +1,165 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
3
+ let ts_morph = require("ts-morph");
4
+
5
+ //#region src/init/utils/configManipulation.ts
6
+ /**
7
+ * Checks if a module is already imported or required in the source file.
8
+ */
9
+ const isModuleImported = (sourceFile, moduleName) => {
10
+ const hasImport = sourceFile.getImportDeclarations().some((i) => i.getModuleSpecifierValue() === moduleName);
11
+ const hasRequire = sourceFile.getDescendantsOfKind(ts_morph.SyntaxKind.CallExpression).some((c) => {
12
+ return c.getExpression().getText() === "require" && c.getArguments()[0]?.asKind(ts_morph.SyntaxKind.StringLiteral)?.getLiteralValue() === moduleName;
13
+ });
14
+ return hasImport || hasRequire;
15
+ };
16
+ /**
17
+ * Checks if the file should be treated as CommonJS.
18
+ */
19
+ const isCJS = (content, extension) => {
20
+ if (extension === "cjs") return true;
21
+ if (["mjs", "ts"].includes(extension)) return false;
22
+ return content.includes("module.exports") && !content.includes("import ") && !content.includes("export ");
23
+ };
24
+ /**
25
+ * Updates a Vite configuration file to include the Intlayer plugin.
26
+ * @param content The content of the vite.config file
27
+ * @param extension The file extension (ts, js, mjs, cjs)
28
+ * @returns The updated content
29
+ */
30
+ const updateViteConfig = (content, extension) => {
31
+ const sourceFile = new ts_morph.Project({ useInMemoryFileSystem: true }).createSourceFile(`vite.config.${extension}`, content);
32
+ const isCJSFile = isCJS(content, extension);
33
+ if (!isModuleImported(sourceFile, "vite-intlayer")) if (isCJSFile) sourceFile.insertVariableStatement(0, {
34
+ declarationKind: "const",
35
+ declarations: [{
36
+ name: "{ intlayer }",
37
+ initializer: "require(\"vite-intlayer\")"
38
+ }]
39
+ });
40
+ else sourceFile.addImportDeclaration({
41
+ moduleSpecifier: "vite-intlayer",
42
+ namedImports: ["intlayer"]
43
+ });
44
+ let configObject;
45
+ const exportDefault = sourceFile.getExportAssignment((e) => !e.isExportEquals());
46
+ if (exportDefault) {
47
+ const expression = exportDefault.getExpression();
48
+ if (expression.getKind() === ts_morph.SyntaxKind.CallExpression) {
49
+ const call = expression.asKind(ts_morph.SyntaxKind.CallExpression);
50
+ if (call?.getExpression().getText() === "defineConfig") {
51
+ const arg = call.getArguments()[0];
52
+ if (arg?.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = arg.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
53
+ }
54
+ } else if (expression.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = expression.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
55
+ else if (expression.getKind() === ts_morph.SyntaxKind.Identifier) {
56
+ const definitions = expression.asKind(ts_morph.SyntaxKind.Identifier)?.getDefinitions();
57
+ if (definitions && definitions.length > 0) {
58
+ const node = definitions[0].getDeclarationNode();
59
+ if (node?.getKind() === ts_morph.SyntaxKind.VariableDeclaration) {
60
+ const init = node.asKind(ts_morph.SyntaxKind.VariableDeclaration)?.getInitializer();
61
+ if (init?.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = init.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
62
+ }
63
+ }
64
+ }
65
+ }
66
+ if (!configObject) {
67
+ const expressionStatements = sourceFile.getStatements();
68
+ for (const statement of expressionStatements) if (statement.getKind() === ts_morph.SyntaxKind.ExpressionStatement) {
69
+ const expr = statement.asKind(ts_morph.SyntaxKind.ExpressionStatement)?.getExpression();
70
+ if (expr?.getKind() === ts_morph.SyntaxKind.BinaryExpression) {
71
+ const binary = expr.asKind(ts_morph.SyntaxKind.BinaryExpression);
72
+ if (binary?.getLeft().getText() === "module.exports" && binary.getOperatorToken().getKind() === ts_morph.SyntaxKind.EqualsToken) {
73
+ const right = binary.getRight();
74
+ if (right.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = right.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
75
+ else if (right.getKind() === ts_morph.SyntaxKind.CallExpression) {
76
+ const call = right.asKind(ts_morph.SyntaxKind.CallExpression);
77
+ if (call?.getExpression().getText() === "defineConfig") {
78
+ const arg = call.getArguments()[0];
79
+ if (arg?.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = arg.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
80
+ }
81
+ } else if (right.getKind() === ts_morph.SyntaxKind.Identifier) {
82
+ const definitions = right.asKind(ts_morph.SyntaxKind.Identifier)?.getDefinitions();
83
+ if (definitions && definitions.length > 0) {
84
+ const node = definitions[0].getDeclarationNode();
85
+ if (node?.getKind() === ts_morph.SyntaxKind.VariableDeclaration) {
86
+ const init = node.asKind(ts_morph.SyntaxKind.VariableDeclaration)?.getInitializer();
87
+ if (init?.getKind() === ts_morph.SyntaxKind.ObjectLiteralExpression) configObject = init.asKind(ts_morph.SyntaxKind.ObjectLiteralExpression);
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ if (configObject) {
96
+ let pluginsProp = configObject.getProperty("plugins");
97
+ if (!pluginsProp) {
98
+ configObject.addPropertyAssignment({
99
+ name: "plugins",
100
+ initializer: "[]"
101
+ });
102
+ pluginsProp = configObject.getProperty("plugins");
103
+ }
104
+ if (pluginsProp?.getKind() === ts_morph.SyntaxKind.PropertyAssignment) {
105
+ const initializer = pluginsProp.asKind(ts_morph.SyntaxKind.PropertyAssignment)?.getInitializer();
106
+ if (initializer?.getKind() === ts_morph.SyntaxKind.ArrayLiteralExpression) {
107
+ const array = initializer.asKind(ts_morph.SyntaxKind.ArrayLiteralExpression);
108
+ if (!array?.getElements().some((el) => el.getText().includes("intlayer("))) array?.addElement("intlayer()");
109
+ }
110
+ }
111
+ }
112
+ return sourceFile.getFullText();
113
+ };
114
+ /**
115
+ * Updates a Next.js configuration file to wrap the export with withIntlayer.
116
+ * @param content The content of the next.config file
117
+ * @param extension The file extension (ts, js, mjs, cjs)
118
+ * @returns The updated content
119
+ */
120
+ const updateNextConfig = (content, extension) => {
121
+ const sourceFile = new ts_morph.Project({ useInMemoryFileSystem: true }).createSourceFile(`next.config.${extension}`, content);
122
+ const isCJSFile = isCJS(content, extension);
123
+ if (!isModuleImported(sourceFile, "next-intlayer/server")) if (isCJSFile) sourceFile.insertVariableStatement(0, {
124
+ declarationKind: "const",
125
+ declarations: [{
126
+ name: "{ withIntlayer }",
127
+ initializer: "require(\"next-intlayer/server\")"
128
+ }]
129
+ });
130
+ else sourceFile.addImportDeclaration({
131
+ moduleSpecifier: "next-intlayer/server",
132
+ namedImports: ["withIntlayer"]
133
+ });
134
+ let updated = false;
135
+ const exportDefault = sourceFile.getExportAssignment((e) => !e.isExportEquals());
136
+ if (exportDefault) {
137
+ const expression = exportDefault.getExpression();
138
+ if (!expression.getText().includes("withIntlayer")) {
139
+ exportDefault.setExpression(`withIntlayer(${expression.getText()})`);
140
+ updated = true;
141
+ }
142
+ }
143
+ if (!updated) {
144
+ const expressionStatements = sourceFile.getStatements();
145
+ for (const statement of expressionStatements) if (statement.getKind() === ts_morph.SyntaxKind.ExpressionStatement) {
146
+ const expr = statement.asKind(ts_morph.SyntaxKind.ExpressionStatement)?.getExpression();
147
+ if (expr?.getKind() === ts_morph.SyntaxKind.BinaryExpression) {
148
+ const binary = expr.asKind(ts_morph.SyntaxKind.BinaryExpression);
149
+ if (binary?.getLeft().getText() === "module.exports" && binary.getOperatorToken().getKind() === ts_morph.SyntaxKind.EqualsToken) {
150
+ const right = binary.getRight();
151
+ if (!right.getText().includes("withIntlayer")) {
152
+ right.replaceWithText(`withIntlayer(${right.getText()})`);
153
+ updated = true;
154
+ }
155
+ }
156
+ }
157
+ }
158
+ }
159
+ return sourceFile.getFullText();
160
+ };
161
+
162
+ //#endregion
163
+ exports.updateNextConfig = updateNextConfig;
164
+ exports.updateViteConfig = updateViteConfig;
165
+ //# sourceMappingURL=configManipulation.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configManipulation.cjs","names":["SyntaxKind","Project"],"sources":["../../../../src/init/utils/configManipulation.ts"],"sourcesContent":["import {\n type ObjectLiteralExpression,\n Project,\n type SourceFile,\n SyntaxKind,\n} from 'ts-morph';\n\n/**\n * Checks if a module is already imported or required in the source file.\n */\nconst isModuleImported = (\n sourceFile: SourceFile,\n moduleName: string\n): boolean => {\n const hasImport = sourceFile\n .getImportDeclarations()\n .some((i) => i.getModuleSpecifierValue() === moduleName);\n\n const hasRequire = sourceFile\n .getDescendantsOfKind(SyntaxKind.CallExpression)\n .some((c) => {\n const expression = c.getExpression();\n return (\n expression.getText() === 'require' &&\n c\n .getArguments()[0]\n ?.asKind(SyntaxKind.StringLiteral)\n ?.getLiteralValue() === moduleName\n );\n });\n\n return hasImport || hasRequire;\n};\n\n/**\n * Checks if the file should be treated as CommonJS.\n */\nconst isCJS = (content: string, extension: string): boolean => {\n if (extension === 'cjs') return true;\n if (['mjs', 'ts'].includes(extension)) return false;\n\n return (\n content.includes('module.exports') &&\n !content.includes('import ') &&\n !content.includes('export ')\n );\n};\n\n/**\n * Updates a Vite configuration file to include the Intlayer plugin.\n * @param content The content of the vite.config file\n * @param extension The file extension (ts, js, mjs, cjs)\n * @returns The updated content\n */\nexport const updateViteConfig = (\n content: string,\n extension: string\n): string => {\n const project = new Project({ useInMemoryFileSystem: true });\n const sourceFile = project.createSourceFile(\n `vite.config.${extension}`,\n content\n );\n\n const isCJSFile = isCJS(content, extension);\n\n // Add import if missing\n const hasIntlayerImport = isModuleImported(sourceFile, 'vite-intlayer');\n\n if (!hasIntlayerImport) {\n if (isCJSFile) {\n sourceFile.insertVariableStatement(0, {\n declarationKind: 'const' as any,\n declarations: [\n {\n name: '{ intlayer }',\n initializer: 'require(\"vite-intlayer\")',\n },\n ],\n });\n } else {\n sourceFile.addImportDeclaration({\n moduleSpecifier: 'vite-intlayer',\n namedImports: ['intlayer'],\n });\n }\n }\n\n // Find the configuration object\n let configObject: ObjectLiteralExpression | undefined;\n\n // Case: export default defineConfig({...})\n const exportDefault = sourceFile.getExportAssignment(\n (e) => !e.isExportEquals()\n );\n if (exportDefault) {\n const expression = exportDefault.getExpression();\n\n if (expression.getKind() === SyntaxKind.CallExpression) {\n const call = expression.asKind(SyntaxKind.CallExpression);\n\n if (call?.getExpression().getText() === 'defineConfig') {\n const arg = call.getArguments()[0];\n\n if (arg?.getKind() === SyntaxKind.ObjectLiteralExpression) {\n configObject = arg.asKind(SyntaxKind.ObjectLiteralExpression);\n }\n }\n } else if (expression.getKind() === SyntaxKind.ObjectLiteralExpression) {\n // Case: export default {...}\n configObject = expression.asKind(SyntaxKind.ObjectLiteralExpression);\n } else if (expression.getKind() === SyntaxKind.Identifier) {\n // Case: const config = {...}; export default config;\n const identifier = expression.asKind(SyntaxKind.Identifier);\n const definitions = identifier?.getDefinitions();\n\n if (definitions && definitions.length > 0) {\n const node = definitions[0].getDeclarationNode();\n\n if (node?.getKind() === SyntaxKind.VariableDeclaration) {\n const init = node\n .asKind(SyntaxKind.VariableDeclaration)\n ?.getInitializer();\n\n if (init?.getKind() === SyntaxKind.ObjectLiteralExpression) {\n configObject = init.asKind(SyntaxKind.ObjectLiteralExpression);\n }\n }\n }\n }\n }\n\n // Case: module.exports = {...}\n if (!configObject) {\n const expressionStatements = sourceFile.getStatements();\n for (const statement of expressionStatements) {\n if (statement.getKind() === SyntaxKind.ExpressionStatement) {\n const expr = statement\n .asKind(SyntaxKind.ExpressionStatement)\n ?.getExpression();\n\n if (expr?.getKind() === SyntaxKind.BinaryExpression) {\n const binary = expr.asKind(SyntaxKind.BinaryExpression);\n\n if (\n binary?.getLeft().getText() === 'module.exports' &&\n binary.getOperatorToken().getKind() === SyntaxKind.EqualsToken\n ) {\n const right = binary.getRight();\n\n if (right.getKind() === SyntaxKind.ObjectLiteralExpression) {\n configObject = right.asKind(SyntaxKind.ObjectLiteralExpression);\n } else if (right.getKind() === SyntaxKind.CallExpression) {\n // Case: module.exports = defineConfig({...})\n const call = right.asKind(SyntaxKind.CallExpression);\n\n if (call?.getExpression().getText() === 'defineConfig') {\n const arg = call.getArguments()[0];\n\n if (arg?.getKind() === SyntaxKind.ObjectLiteralExpression) {\n configObject = arg.asKind(SyntaxKind.ObjectLiteralExpression);\n }\n }\n } else if (right.getKind() === SyntaxKind.Identifier) {\n // Case: const config = {...}; module.exports = config;\n const identifier = right.asKind(SyntaxKind.Identifier);\n const definitions = identifier?.getDefinitions();\n\n if (definitions && definitions.length > 0) {\n const node = definitions[0].getDeclarationNode();\n\n if (node?.getKind() === SyntaxKind.VariableDeclaration) {\n const init = node\n .asKind(SyntaxKind.VariableDeclaration)\n ?.getInitializer();\n\n if (init?.getKind() === SyntaxKind.ObjectLiteralExpression) {\n configObject = init.asKind(\n SyntaxKind.ObjectLiteralExpression\n );\n }\n }\n }\n }\n }\n }\n }\n }\n }\n\n // 3. Update plugins array\n if (configObject) {\n let pluginsProp = configObject.getProperty('plugins');\n\n if (!pluginsProp) {\n configObject.addPropertyAssignment({\n name: 'plugins',\n initializer: '[]',\n });\n pluginsProp = configObject.getProperty('plugins');\n }\n\n if (pluginsProp?.getKind() === SyntaxKind.PropertyAssignment) {\n const initializer = pluginsProp\n .asKind(SyntaxKind.PropertyAssignment)\n ?.getInitializer();\n\n if (initializer?.getKind() === SyntaxKind.ArrayLiteralExpression) {\n const array = initializer.asKind(SyntaxKind.ArrayLiteralExpression);\n const hasIntlayer = array\n ?.getElements()\n .some((el) => el.getText().includes('intlayer('));\n\n if (!hasIntlayer) {\n array?.addElement('intlayer()');\n }\n }\n }\n }\n\n return sourceFile.getFullText();\n};\n\n/**\n * Updates a Next.js configuration file to wrap the export with withIntlayer.\n * @param content The content of the next.config file\n * @param extension The file extension (ts, js, mjs, cjs)\n * @returns The updated content\n */\nexport const updateNextConfig = (\n content: string,\n extension: string\n): string => {\n const project = new Project({ useInMemoryFileSystem: true });\n const sourceFile = project.createSourceFile(\n `next.config.${extension}`,\n content\n );\n\n const isCJSFile = isCJS(content, extension);\n\n // 1. Add import if missing\n const hasIntlayerImport = isModuleImported(\n sourceFile,\n 'next-intlayer/server'\n );\n\n if (!hasIntlayerImport) {\n if (isCJSFile) {\n sourceFile.insertVariableStatement(0, {\n declarationKind: 'const' as any,\n declarations: [\n {\n name: '{ withIntlayer }',\n initializer: 'require(\"next-intlayer/server\")',\n },\n ],\n });\n } else {\n sourceFile.addImportDeclaration({\n moduleSpecifier: 'next-intlayer/server',\n namedImports: ['withIntlayer'],\n });\n }\n }\n\n // 2. Wrap export\n let updated = false;\n\n // Case: export default ...\n const exportDefault = sourceFile.getExportAssignment(\n (e) => !e.isExportEquals()\n );\n if (exportDefault) {\n const expression = exportDefault.getExpression();\n\n if (!expression.getText().includes('withIntlayer')) {\n exportDefault.setExpression(`withIntlayer(${expression.getText()})`);\n updated = true;\n }\n }\n\n // Case: module.exports = ...\n if (!updated) {\n const expressionStatements = sourceFile.getStatements();\n for (const statement of expressionStatements) {\n if (statement.getKind() === SyntaxKind.ExpressionStatement) {\n const expr = statement\n .asKind(SyntaxKind.ExpressionStatement)\n ?.getExpression();\n\n if (expr?.getKind() === SyntaxKind.BinaryExpression) {\n const binary = expr.asKind(SyntaxKind.BinaryExpression);\n\n if (\n binary?.getLeft().getText() === 'module.exports' &&\n binary.getOperatorToken().getKind() === SyntaxKind.EqualsToken\n ) {\n const right = binary.getRight();\n\n if (!right.getText().includes('withIntlayer')) {\n right.replaceWithText(`withIntlayer(${right.getText()})`);\n updated = true;\n }\n }\n }\n }\n }\n }\n\n return sourceFile.getFullText();\n};\n"],"mappings":";;;;;;;;AAUA,MAAM,oBACJ,YACA,eACY;CACZ,MAAM,YAAY,WACf,uBAAuB,CACvB,MAAM,MAAM,EAAE,yBAAyB,KAAK,WAAW;CAE1D,MAAM,aAAa,WAChB,qBAAqBA,oBAAW,eAAe,CAC/C,MAAM,MAAM;AAEX,SADmB,EAAE,eAAe,CAEvB,SAAS,KAAK,aACzB,EACG,cAAc,CAAC,IACd,OAAOA,oBAAW,cAAc,EAChC,iBAAiB,KAAK;GAE5B;AAEJ,QAAO,aAAa;;;;;AAMtB,MAAM,SAAS,SAAiB,cAA+B;AAC7D,KAAI,cAAc,MAAO,QAAO;AAChC,KAAI,CAAC,OAAO,KAAK,CAAC,SAAS,UAAU,CAAE,QAAO;AAE9C,QACE,QAAQ,SAAS,iBAAiB,IAClC,CAAC,QAAQ,SAAS,UAAU,IAC5B,CAAC,QAAQ,SAAS,UAAU;;;;;;;;AAUhC,MAAa,oBACX,SACA,cACW;CAEX,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AAkB;IACnD,MAAM,SAAS,KAAK,OAAOA,oBAAW,iBAAiB;AAEvD,QACE,QAAQ,SAAS,CAAC,SAAS,KAAK,oBAChC,OAAO,kBAAkB,CAAC,SAAS,KAAKA,oBAAW,aACnD;KACA,MAAM,QAAQ,OAAO,UAAU;AAE/B,SAAI,CAAC,MAAM,SAAS,CAAC,SAAS,eAAe,EAAE;AAC7C,YAAM,gBAAgB,gBAAgB,MAAM,SAAS,CAAC,GAAG;AACzD,gBAAU;;;;;;AAQtB,QAAO,WAAW,aAAa"}
@@ -1,4 +1,5 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
3
  let node_fs_promises = require("node:fs/promises");
3
4
  let node_path = require("node:path");
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, 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"],"mappings":";;;;;;;;AAMA,MAAa,SAAS,OAAO,SAAiB,aAAqB;AACjE,KAAI;AACF,yDAAkB,SAAS,SAAS,CAAC;AACrC,SAAO;SACD;AACN,SAAO;;;;;;AAOX,MAAa,mBAAmB,OAAO,SAAiB,aACtD,yDAAoB,SAAS,SAAS,EAAE,OAAO;;;;AAKjD,MAAa,kBAAkB,OAC7B,SACA,UACA,YACG,0DAAqB,SAAS,SAAS,EAAE,SAAS,OAAO"}
1
+ {"version":3,"file":"fileSystem.cjs","names":[],"sources":["../../../../src/init/utils/fileSystem.ts"],"sourcesContent":["import { access, 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"],"mappings":";;;;;;;;;AAMA,MAAa,SAAS,OAAO,SAAiB,aAAqB;AACjE,KAAI;AACF,yDAAkB,SAAS,SAAS,CAAC;AACrC,SAAO;SACD;AACN,SAAO;;;;;;AAOX,MAAa,mBAAmB,OAAO,SAAiB,aACtD,yDAAoB,SAAS,SAAS,EAAE,OAAO;;;;AAKjD,MAAa,kBAAkB,OAC7B,SACA,UACA,YACG,0DAAqB,SAAS,SAAS,EAAE,SAAS,OAAO"}
@@ -1,3 +1,5 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_init_utils_configManipulation = require('./configManipulation.cjs');
1
3
  const require_init_utils_fileSystem = require('./fileSystem.cjs');
2
4
  const require_init_utils_jsonParser = require('./jsonParser.cjs');
3
5
  const require_init_utils_tsConfig = require('./tsConfig.cjs');
@@ -6,4 +8,6 @@ exports.exists = require_init_utils_fileSystem.exists;
6
8
  exports.findTsConfigFiles = require_init_utils_tsConfig.findTsConfigFiles;
7
9
  exports.parseJSONWithComments = require_init_utils_jsonParser.parseJSONWithComments;
8
10
  exports.readFileFromRoot = require_init_utils_fileSystem.readFileFromRoot;
11
+ exports.updateNextConfig = require_init_utils_configManipulation.updateNextConfig;
12
+ exports.updateViteConfig = require_init_utils_configManipulation.updateViteConfig;
9
13
  exports.writeFileToRoot = require_init_utils_fileSystem.writeFileToRoot;
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region src/init/utils/jsonParser.ts
3
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"jsonParser.cjs","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,KAAK,CACT,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
+ {"version":3,"file":"jsonParser.cjs","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,KAAK,CACT,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,4 +1,5 @@
1
- const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
2
3
  let node_fs_promises = require("node:fs/promises");
3
4
 
4
5
  //#region src/init/utils/tsConfig.ts
@@ -1 +1 @@
1
- {"version":3,"file":"tsConfig.cjs","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,UAFc,oCAAc,QAAQ,EAEvB,QACV,SAAS,SAAS,mBAAmB,uBAAuB,KAAK,KAAK,CACxE;SACK;AACN,SAAO,EAAE"}
1
+ {"version":3,"file":"tsConfig.cjs","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,UAFc,oCAAc,QAAQ,EAEvB,QACV,SAAS,SAAS,mBAAmB,uBAAuB,KAAK,KAAK,CACxE;SACK;AACN,SAAO,EAAE"}