@intlayer/engine 9.0.0-canary.12

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 (833) hide show
  1. package/README.md +330 -0
  2. package/dist/assets/initConfig/templates/cjs.txt +140 -0
  3. package/dist/assets/initConfig/templates/json.txt +98 -0
  4. package/dist/assets/initConfig/templates/mjs.txt +140 -0
  5. package/dist/assets/initConfig/templates/ts.txt +139 -0
  6. package/dist/assets/installSkills/LICENCE.md +201 -0
  7. package/dist/assets/installSkills/skills/angular.md +159 -0
  8. package/dist/assets/installSkills/skills/astro.md +40 -0
  9. package/dist/assets/installSkills/skills/cli.md +68 -0
  10. package/dist/assets/installSkills/skills/compiler.md +32 -0
  11. package/dist/assets/installSkills/skills/config.md +63 -0
  12. package/dist/assets/installSkills/skills/content.md +377 -0
  13. package/dist/assets/installSkills/skills/next-js.md +130 -0
  14. package/dist/assets/installSkills/skills/preact.md +83 -0
  15. package/dist/assets/installSkills/skills/react.md +105 -0
  16. package/dist/assets/installSkills/skills/remote-content.md +31 -0
  17. package/dist/assets/installSkills/skills/solid.md +90 -0
  18. package/dist/assets/installSkills/skills/svelte.md +84 -0
  19. package/dist/assets/installSkills/skills/usage.md +44 -0
  20. package/dist/assets/installSkills/skills/vue.md +56 -0
  21. package/dist/cjs/_virtual/_rolldown/runtime.cjs +29 -0
  22. package/dist/cjs/_virtual/_utils_asset.cjs +98 -0
  23. package/dist/cjs/build.cjs +60 -0
  24. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs +80 -0
  25. package/dist/cjs/buildIntlayerDictionary/buildIntlayerDictionary.cjs.map +1 -0
  26. package/dist/cjs/buildIntlayerDictionary/index.cjs +6 -0
  27. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs +27 -0
  28. package/dist/cjs/buildIntlayerDictionary/processContentDeclaration.cjs.map +1 -0
  29. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +206 -0
  30. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs.map +1 -0
  31. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +59 -0
  32. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs.map +1 -0
  33. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +49 -0
  34. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs.map +1 -0
  35. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +51 -0
  36. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs.map +1 -0
  37. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +62 -0
  38. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs.map +1 -0
  39. package/dist/cjs/cleanOutputDir.cjs +31 -0
  40. package/dist/cjs/cleanOutputDir.cjs.map +1 -0
  41. package/dist/cjs/cleanRemovedContentDeclaration.cjs +97 -0
  42. package/dist/cjs/cleanRemovedContentDeclaration.cjs.map +1 -0
  43. package/dist/cjs/cli.cjs +48 -0
  44. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +71 -0
  45. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs.map +1 -0
  46. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs +43 -0
  47. package/dist/cjs/createDictionaryEntryPoint/generateDictionaryListContent.cjs.map +1 -0
  48. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +25 -0
  49. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs.map +1 -0
  50. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +26 -0
  51. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs.map +1 -0
  52. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +26 -0
  53. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs.map +1 -0
  54. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +25 -0
  55. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs.map +1 -0
  56. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +25 -0
  57. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs.map +1 -0
  58. package/dist/cjs/createDictionaryEntryPoint/index.cjs +16 -0
  59. package/dist/cjs/createType/createModuleAugmentation.cjs +126 -0
  60. package/dist/cjs/createType/createModuleAugmentation.cjs.map +1 -0
  61. package/dist/cjs/createType/createType.cjs +30 -0
  62. package/dist/cjs/createType/createType.cjs.map +1 -0
  63. package/dist/cjs/createType/index.cjs +8 -0
  64. package/dist/cjs/detectFormatCommand.cjs +33 -0
  65. package/dist/cjs/detectFormatCommand.cjs.map +1 -0
  66. package/dist/cjs/docReview/alignBlocks.cjs +79 -0
  67. package/dist/cjs/docReview/alignBlocks.cjs.map +1 -0
  68. package/dist/cjs/docReview/computeSimilarity.cjs +42 -0
  69. package/dist/cjs/docReview/computeSimilarity.cjs.map +1 -0
  70. package/dist/cjs/docReview/fingerprintBlock.cjs +35 -0
  71. package/dist/cjs/docReview/fingerprintBlock.cjs.map +1 -0
  72. package/dist/cjs/docReview/index.cjs +25 -0
  73. package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs +27 -0
  74. package/dist/cjs/docReview/mapChangedLinesToBlocks.cjs.map +1 -0
  75. package/dist/cjs/docReview/normalizeBlock.cjs +34 -0
  76. package/dist/cjs/docReview/normalizeBlock.cjs.map +1 -0
  77. package/dist/cjs/docReview/pipeline.cjs +144 -0
  78. package/dist/cjs/docReview/pipeline.cjs.map +1 -0
  79. package/dist/cjs/docReview/planActions.cjs +58 -0
  80. package/dist/cjs/docReview/planActions.cjs.map +1 -0
  81. package/dist/cjs/docReview/rebuildDocument.cjs +65 -0
  82. package/dist/cjs/docReview/rebuildDocument.cjs.map +1 -0
  83. package/dist/cjs/docReview/reviewReport.cjs +200 -0
  84. package/dist/cjs/docReview/reviewReport.cjs.map +1 -0
  85. package/dist/cjs/docReview/segmentDocument.cjs +134 -0
  86. package/dist/cjs/docReview/segmentDocument.cjs.map +1 -0
  87. package/dist/cjs/docReview/types.cjs +0 -0
  88. package/dist/cjs/fetchDistantDictionaries.cjs +53 -0
  89. package/dist/cjs/fetchDistantDictionaries.cjs.map +1 -0
  90. package/dist/cjs/filterInvalidDictionaries.cjs +57 -0
  91. package/dist/cjs/filterInvalidDictionaries.cjs.map +1 -0
  92. package/dist/cjs/formatDictionary.cjs +60 -0
  93. package/dist/cjs/formatDictionary.cjs.map +1 -0
  94. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs +83 -0
  95. package/dist/cjs/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.cjs.map +1 -0
  96. package/dist/cjs/getContentDeclarationFileTemplate/index.cjs +4 -0
  97. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs +35 -0
  98. package/dist/cjs/handleAdditionalContentDeclarationFile.cjs.map +1 -0
  99. package/dist/cjs/handleContentDeclarationFileChange.cjs +56 -0
  100. package/dist/cjs/handleContentDeclarationFileChange.cjs.map +1 -0
  101. package/dist/cjs/handleContentDeclarationFileMoved.cjs +25 -0
  102. package/dist/cjs/handleContentDeclarationFileMoved.cjs.map +1 -0
  103. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +38 -0
  104. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs.map +1 -0
  105. package/dist/cjs/init/cms.cjs +140 -0
  106. package/dist/cjs/init/cms.cjs.map +1 -0
  107. package/dist/cjs/init/frameworkSetup/index.cjs +27 -0
  108. package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -0
  109. package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs +56 -0
  110. package/dist/cjs/init/frameworkSetup/nextAppRouter/detect.cjs.map +1 -0
  111. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +107 -0
  112. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -0
  113. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +163 -0
  114. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs.map +1 -0
  115. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +122 -0
  116. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -0
  117. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs +196 -0
  118. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -0
  119. package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs +31 -0
  120. package/dist/cjs/init/frameworkSetup/tanstackStart/detect.cjs.map +1 -0
  121. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +76 -0
  122. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -0
  123. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +116 -0
  124. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs.map +1 -0
  125. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +106 -0
  126. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -0
  127. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +141 -0
  128. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -0
  129. package/dist/cjs/init/frameworkSetup/types.cjs +0 -0
  130. package/dist/cjs/init/index.cjs +521 -0
  131. package/dist/cjs/init/index.cjs.map +1 -0
  132. package/dist/cjs/init/utils/astImports.cjs +56 -0
  133. package/dist/cjs/init/utils/astImports.cjs.map +1 -0
  134. package/dist/cjs/init/utils/configManipulation.cjs +516 -0
  135. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -0
  136. package/dist/cjs/init/utils/fileSystem.cjs +231 -0
  137. package/dist/cjs/init/utils/fileSystem.cjs.map +1 -0
  138. package/dist/cjs/init/utils/githubActions.cjs +159 -0
  139. package/dist/cjs/init/utils/githubActions.cjs.map +1 -0
  140. package/dist/cjs/init/utils/index.cjs +51 -0
  141. package/dist/cjs/init/utils/jsonParser.cjs +43 -0
  142. package/dist/cjs/init/utils/jsonParser.cjs.map +1 -0
  143. package/dist/cjs/init/utils/nextCompilerBabel.cjs +119 -0
  144. package/dist/cjs/init/utils/nextCompilerBabel.cjs.map +1 -0
  145. package/dist/cjs/init/utils/packageManager.cjs +303 -0
  146. package/dist/cjs/init/utils/packageManager.cjs.map +1 -0
  147. package/dist/cjs/init/utils/tsConfig.cjs +19 -0
  148. package/dist/cjs/init/utils/tsConfig.cjs.map +1 -0
  149. package/dist/cjs/initConfig/index.cjs +49 -0
  150. package/dist/cjs/initConfig/index.cjs.map +1 -0
  151. package/dist/cjs/installLSP.cjs +58 -0
  152. package/dist/cjs/installLSP.cjs.map +1 -0
  153. package/dist/cjs/installMCP/installMCP.cjs +51 -0
  154. package/dist/cjs/installMCP/installMCP.cjs.map +1 -0
  155. package/dist/cjs/installSkills/index.cjs +307 -0
  156. package/dist/cjs/installSkills/index.cjs.map +1 -0
  157. package/dist/cjs/listDictionariesPath.cjs +43 -0
  158. package/dist/cjs/listDictionariesPath.cjs.map +1 -0
  159. package/dist/cjs/listGitFiles.cjs +105 -0
  160. package/dist/cjs/listGitFiles.cjs.map +1 -0
  161. package/dist/cjs/listProjects.cjs +48 -0
  162. package/dist/cjs/listProjects.cjs.map +1 -0
  163. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +56 -0
  164. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs.map +1 -0
  165. package/dist/cjs/loadDictionaries/index.cjs +14 -0
  166. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +133 -0
  167. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs.map +1 -0
  168. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +128 -0
  169. package/dist/cjs/loadDictionaries/loadDictionaries.cjs.map +1 -0
  170. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +28 -0
  171. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs.map +1 -0
  172. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +45 -0
  173. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs.map +1 -0
  174. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs +63 -0
  175. package/dist/cjs/loadDictionaries/loadRemoteDictionaries.cjs.map +1 -0
  176. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs +27 -0
  177. package/dist/cjs/loadDictionaries/loadYamlContentDeclaration.cjs.map +1 -0
  178. package/dist/cjs/loadDictionaries/log.cjs +138 -0
  179. package/dist/cjs/loadDictionaries/log.cjs.map +1 -0
  180. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +64 -0
  181. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -0
  182. package/dist/cjs/logConfigDetails.cjs +40 -0
  183. package/dist/cjs/logConfigDetails.cjs.map +1 -0
  184. package/dist/cjs/prepareIntlayer.cjs +104 -0
  185. package/dist/cjs/prepareIntlayer.cjs.map +1 -0
  186. package/dist/cjs/reduceDictionaryContent/applyMask.cjs +31 -0
  187. package/dist/cjs/reduceDictionaryContent/applyMask.cjs.map +1 -0
  188. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs +13 -0
  189. package/dist/cjs/reduceDictionaryContent/reduceDictionaryContent.cjs.map +1 -0
  190. package/dist/cjs/scan/analyzeBundleContent.cjs +182 -0
  191. package/dist/cjs/scan/analyzeBundleContent.cjs.map +1 -0
  192. package/dist/cjs/scan/calculateScore.cjs +65 -0
  193. package/dist/cjs/scan/calculateScore.cjs.map +1 -0
  194. package/dist/cjs/scan/checks.cjs +274 -0
  195. package/dist/cjs/scan/checks.cjs.map +1 -0
  196. package/dist/cjs/scan/index.cjs +31 -0
  197. package/dist/cjs/scan/parseHtml.cjs +127 -0
  198. package/dist/cjs/scan/parseHtml.cjs.map +1 -0
  199. package/dist/cjs/scan/scanWebsite.cjs +205 -0
  200. package/dist/cjs/scan/scanWebsite.cjs.map +1 -0
  201. package/dist/cjs/scan/types.cjs +0 -0
  202. package/dist/cjs/utils/autoDecorateContent.cjs +90 -0
  203. package/dist/cjs/utils/autoDecorateContent.cjs.map +1 -0
  204. package/dist/cjs/utils/buildComponentFilesList.cjs +94 -0
  205. package/dist/cjs/utils/buildComponentFilesList.cjs.map +1 -0
  206. package/dist/cjs/utils/buildFilesList.cjs +84 -0
  207. package/dist/cjs/utils/buildFilesList.cjs.map +1 -0
  208. package/dist/cjs/utils/chunkJSON.cjs +337 -0
  209. package/dist/cjs/utils/chunkJSON.cjs.map +1 -0
  210. package/dist/cjs/utils/formatter.cjs +18 -0
  211. package/dist/cjs/utils/formatter.cjs.map +1 -0
  212. package/dist/cjs/utils/getChunk.cjs +35 -0
  213. package/dist/cjs/utils/getChunk.cjs.map +1 -0
  214. package/dist/cjs/utils/getContentExtension.cjs +30 -0
  215. package/dist/cjs/utils/getContentExtension.cjs.map +1 -0
  216. package/dist/cjs/utils/getFormatFromExtension.cjs +41 -0
  217. package/dist/cjs/utils/getFormatFromExtension.cjs.map +1 -0
  218. package/dist/cjs/utils/getPathHash.cjs +22 -0
  219. package/dist/cjs/utils/getPathHash.cjs.map +1 -0
  220. package/dist/cjs/utils/index.cjs +50 -0
  221. package/dist/cjs/utils/mergeChunks.cjs +29 -0
  222. package/dist/cjs/utils/mergeChunks.cjs.map +1 -0
  223. package/dist/cjs/utils/pLimit.cjs +134 -0
  224. package/dist/cjs/utils/pLimit.cjs.map +1 -0
  225. package/dist/cjs/utils/parallelize.cjs +12 -0
  226. package/dist/cjs/utils/parallelize.cjs.map +1 -0
  227. package/dist/cjs/utils/parallelizeGlobal.cjs +30 -0
  228. package/dist/cjs/utils/parallelizeGlobal.cjs.map +1 -0
  229. package/dist/cjs/utils/readDictionariesFromDisk.cjs +25 -0
  230. package/dist/cjs/utils/readDictionariesFromDisk.cjs.map +1 -0
  231. package/dist/cjs/utils/reduceObjectFormat.cjs +70 -0
  232. package/dist/cjs/utils/reduceObjectFormat.cjs.map +1 -0
  233. package/dist/cjs/utils/resolveObjectPromises.cjs +22 -0
  234. package/dist/cjs/utils/resolveObjectPromises.cjs.map +1 -0
  235. package/dist/cjs/utils/resolveRelativePath.cjs +22 -0
  236. package/dist/cjs/utils/resolveRelativePath.cjs.map +1 -0
  237. package/dist/cjs/utils/runOnce.cjs +96 -0
  238. package/dist/cjs/utils/runOnce.cjs.map +1 -0
  239. package/dist/cjs/utils/runParallel/bin.cjs +55 -0
  240. package/dist/cjs/utils/runParallel/bin.cjs.map +1 -0
  241. package/dist/cjs/utils/runParallel/bootstrap.cjs +25 -0
  242. package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -0
  243. package/dist/cjs/utils/runParallel/index.cjs +102 -0
  244. package/dist/cjs/utils/runParallel/index.cjs.map +1 -0
  245. package/dist/cjs/utils/runParallel/pidTree.cjs +146 -0
  246. package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -0
  247. package/dist/cjs/utils/runParallel/ps.cjs +50 -0
  248. package/dist/cjs/utils/runParallel/ps.cjs.map +1 -0
  249. package/dist/cjs/utils/runParallel/runTask.cjs +155 -0
  250. package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -0
  251. package/dist/cjs/utils/runParallel/spawnPosix.cjs +49 -0
  252. package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -0
  253. package/dist/cjs/utils/runParallel/spawnWin32.cjs +44 -0
  254. package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -0
  255. package/dist/cjs/utils/runParallel/wmic.cjs +53 -0
  256. package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -0
  257. package/dist/cjs/utils/sortAlphabetically.cjs +8 -0
  258. package/dist/cjs/utils/sortAlphabetically.cjs.map +1 -0
  259. package/dist/cjs/utils/splitTextByLine.cjs +12 -0
  260. package/dist/cjs/utils/splitTextByLine.cjs.map +1 -0
  261. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs +66 -0
  262. package/dist/cjs/utils/verifyIdenticObjectFormat.cjs.map +1 -0
  263. package/dist/cjs/watcher.cjs +230 -0
  264. package/dist/cjs/watcher.cjs.map +1 -0
  265. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs +35 -0
  266. package/dist/cjs/writeConfiguration/generateConfigurationContent.cjs.map +1 -0
  267. package/dist/cjs/writeConfiguration/index.cjs +25 -0
  268. package/dist/cjs/writeConfiguration/index.cjs.map +1 -0
  269. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs +29 -0
  270. package/dist/cjs/writeContentDeclaration/detectExportedComponentName.cjs.map +1 -0
  271. package/dist/cjs/writeContentDeclaration/dictionaryStatus.cjs +0 -0
  272. package/dist/cjs/writeContentDeclaration/index.cjs +10 -0
  273. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +95 -0
  274. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs.map +1 -0
  275. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +417 -0
  276. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs.map +1 -0
  277. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs +128 -0
  278. package/dist/cjs/writeContentDeclaration/transformJSONFile.cjs.map +1 -0
  279. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +164 -0
  280. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs.map +1 -0
  281. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +93 -0
  282. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs.map +1 -0
  283. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +66 -0
  284. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs.map +1 -0
  285. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +44 -0
  286. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs.map +1 -0
  287. package/dist/cjs/writeFileIfChanged.cjs +51 -0
  288. package/dist/cjs/writeFileIfChanged.cjs.map +1 -0
  289. package/dist/cjs/writeJsonIfChanged.cjs +18 -0
  290. package/dist/cjs/writeJsonIfChanged.cjs.map +1 -0
  291. package/dist/esm/_virtual/_rolldown/runtime.mjs +8 -0
  292. package/dist/esm/_virtual/_utils_asset.mjs +97 -0
  293. package/dist/esm/build.mjs +26 -0
  294. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs +78 -0
  295. package/dist/esm/buildIntlayerDictionary/buildIntlayerDictionary.mjs.map +1 -0
  296. package/dist/esm/buildIntlayerDictionary/index.mjs +4 -0
  297. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs +25 -0
  298. package/dist/esm/buildIntlayerDictionary/processContentDeclaration.mjs.map +1 -0
  299. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +201 -0
  300. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs.map +1 -0
  301. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +56 -0
  302. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs.map +1 -0
  303. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +47 -0
  304. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs.map +1 -0
  305. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +49 -0
  306. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs.map +1 -0
  307. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +59 -0
  308. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs.map +1 -0
  309. package/dist/esm/cleanOutputDir.mjs +29 -0
  310. package/dist/esm/cleanOutputDir.mjs.map +1 -0
  311. package/dist/esm/cleanRemovedContentDeclaration.mjs +94 -0
  312. package/dist/esm/cleanRemovedContentDeclaration.mjs.map +1 -0
  313. package/dist/esm/cli.mjs +20 -0
  314. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +69 -0
  315. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs.map +1 -0
  316. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs +41 -0
  317. package/dist/esm/createDictionaryEntryPoint/generateDictionaryListContent.mjs.map +1 -0
  318. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +22 -0
  319. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs.map +1 -0
  320. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +23 -0
  321. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs.map +1 -0
  322. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +23 -0
  323. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs.map +1 -0
  324. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +22 -0
  325. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs.map +1 -0
  326. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +22 -0
  327. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs.map +1 -0
  328. package/dist/esm/createDictionaryEntryPoint/index.mjs +9 -0
  329. package/dist/esm/createType/createModuleAugmentation.mjs +122 -0
  330. package/dist/esm/createType/createModuleAugmentation.mjs.map +1 -0
  331. package/dist/esm/createType/createType.mjs +27 -0
  332. package/dist/esm/createType/createType.mjs.map +1 -0
  333. package/dist/esm/createType/index.mjs +4 -0
  334. package/dist/esm/detectFormatCommand.mjs +31 -0
  335. package/dist/esm/detectFormatCommand.mjs.map +1 -0
  336. package/dist/esm/docReview/alignBlocks.mjs +78 -0
  337. package/dist/esm/docReview/alignBlocks.mjs.map +1 -0
  338. package/dist/esm/docReview/computeSimilarity.mjs +39 -0
  339. package/dist/esm/docReview/computeSimilarity.mjs.map +1 -0
  340. package/dist/esm/docReview/fingerprintBlock.mjs +32 -0
  341. package/dist/esm/docReview/fingerprintBlock.mjs.map +1 -0
  342. package/dist/esm/docReview/index.mjs +12 -0
  343. package/dist/esm/docReview/mapChangedLinesToBlocks.mjs +25 -0
  344. package/dist/esm/docReview/mapChangedLinesToBlocks.mjs.map +1 -0
  345. package/dist/esm/docReview/normalizeBlock.mjs +32 -0
  346. package/dist/esm/docReview/normalizeBlock.mjs.map +1 -0
  347. package/dist/esm/docReview/pipeline.mjs +142 -0
  348. package/dist/esm/docReview/pipeline.mjs.map +1 -0
  349. package/dist/esm/docReview/planActions.mjs +56 -0
  350. package/dist/esm/docReview/planActions.mjs.map +1 -0
  351. package/dist/esm/docReview/rebuildDocument.mjs +62 -0
  352. package/dist/esm/docReview/rebuildDocument.mjs.map +1 -0
  353. package/dist/esm/docReview/reviewReport.mjs +196 -0
  354. package/dist/esm/docReview/reviewReport.mjs.map +1 -0
  355. package/dist/esm/docReview/segmentDocument.mjs +131 -0
  356. package/dist/esm/docReview/segmentDocument.mjs.map +1 -0
  357. package/dist/esm/docReview/types.mjs +0 -0
  358. package/dist/esm/fetchDistantDictionaries.mjs +51 -0
  359. package/dist/esm/fetchDistantDictionaries.mjs.map +1 -0
  360. package/dist/esm/filterInvalidDictionaries.mjs +53 -0
  361. package/dist/esm/filterInvalidDictionaries.mjs.map +1 -0
  362. package/dist/esm/formatDictionary.mjs +55 -0
  363. package/dist/esm/formatDictionary.mjs.map +1 -0
  364. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs +81 -0
  365. package/dist/esm/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.mjs.map +1 -0
  366. package/dist/esm/getContentDeclarationFileTemplate/index.mjs +3 -0
  367. package/dist/esm/handleAdditionalContentDeclarationFile.mjs +33 -0
  368. package/dist/esm/handleAdditionalContentDeclarationFile.mjs.map +1 -0
  369. package/dist/esm/handleContentDeclarationFileChange.mjs +54 -0
  370. package/dist/esm/handleContentDeclarationFileChange.mjs.map +1 -0
  371. package/dist/esm/handleContentDeclarationFileMoved.mjs +23 -0
  372. package/dist/esm/handleContentDeclarationFileMoved.mjs.map +1 -0
  373. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +36 -0
  374. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs.map +1 -0
  375. package/dist/esm/init/cms.mjs +131 -0
  376. package/dist/esm/init/cms.mjs.map +1 -0
  377. package/dist/esm/init/frameworkSetup/index.mjs +26 -0
  378. package/dist/esm/init/frameworkSetup/index.mjs.map +1 -0
  379. package/dist/esm/init/frameworkSetup/nextAppRouter/detect.mjs +52 -0
  380. package/dist/esm/init/frameworkSetup/nextAppRouter/detect.mjs.map +1 -0
  381. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +104 -0
  382. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -0
  383. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +157 -0
  384. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs.map +1 -0
  385. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs +113 -0
  386. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs.map +1 -0
  387. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs +193 -0
  388. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -0
  389. package/dist/esm/init/frameworkSetup/tanstackStart/detect.mjs +28 -0
  390. package/dist/esm/init/frameworkSetup/tanstackStart/detect.mjs.map +1 -0
  391. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +73 -0
  392. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -0
  393. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +108 -0
  394. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs.map +1 -0
  395. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +102 -0
  396. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -0
  397. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +139 -0
  398. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -0
  399. package/dist/esm/init/frameworkSetup/types.mjs +0 -0
  400. package/dist/esm/init/index.mjs +518 -0
  401. package/dist/esm/init/index.mjs.map +1 -0
  402. package/dist/esm/init/utils/astImports.mjs +51 -0
  403. package/dist/esm/init/utils/astImports.mjs.map +1 -0
  404. package/dist/esm/init/utils/configManipulation.mjs +499 -0
  405. package/dist/esm/init/utils/configManipulation.mjs.map +1 -0
  406. package/dist/esm/init/utils/fileSystem.mjs +222 -0
  407. package/dist/esm/init/utils/fileSystem.mjs.map +1 -0
  408. package/dist/esm/init/utils/githubActions.mjs +155 -0
  409. package/dist/esm/init/utils/githubActions.mjs.map +1 -0
  410. package/dist/esm/init/utils/index.mjs +10 -0
  411. package/dist/esm/init/utils/jsonParser.mjs +41 -0
  412. package/dist/esm/init/utils/jsonParser.mjs.map +1 -0
  413. package/dist/esm/init/utils/nextCompilerBabel.mjs +115 -0
  414. package/dist/esm/init/utils/nextCompilerBabel.mjs.map +1 -0
  415. package/dist/esm/init/utils/packageManager.mjs +294 -0
  416. package/dist/esm/init/utils/packageManager.mjs.map +1 -0
  417. package/dist/esm/init/utils/tsConfig.mjs +17 -0
  418. package/dist/esm/init/utils/tsConfig.mjs.map +1 -0
  419. package/dist/esm/initConfig/index.mjs +47 -0
  420. package/dist/esm/initConfig/index.mjs.map +1 -0
  421. package/dist/esm/installLSP.mjs +55 -0
  422. package/dist/esm/installLSP.mjs.map +1 -0
  423. package/dist/esm/installMCP/installMCP.mjs +47 -0
  424. package/dist/esm/installMCP/installMCP.mjs.map +1 -0
  425. package/dist/esm/installSkills/index.mjs +299 -0
  426. package/dist/esm/installSkills/index.mjs.map +1 -0
  427. package/dist/esm/listDictionariesPath.mjs +39 -0
  428. package/dist/esm/listDictionariesPath.mjs.map +1 -0
  429. package/dist/esm/listGitFiles.mjs +101 -0
  430. package/dist/esm/listGitFiles.mjs.map +1 -0
  431. package/dist/esm/listProjects.mjs +44 -0
  432. package/dist/esm/listProjects.mjs.map +1 -0
  433. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +54 -0
  434. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs.map +1 -0
  435. package/dist/esm/loadDictionaries/index.mjs +6 -0
  436. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +128 -0
  437. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs.map +1 -0
  438. package/dist/esm/loadDictionaries/loadDictionaries.mjs +125 -0
  439. package/dist/esm/loadDictionaries/loadDictionaries.mjs.map +1 -0
  440. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +26 -0
  441. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs.map +1 -0
  442. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs +43 -0
  443. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs.map +1 -0
  444. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs +60 -0
  445. package/dist/esm/loadDictionaries/loadRemoteDictionaries.mjs.map +1 -0
  446. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs +25 -0
  447. package/dist/esm/loadDictionaries/loadYamlContentDeclaration.mjs.map +1 -0
  448. package/dist/esm/loadDictionaries/log.mjs +135 -0
  449. package/dist/esm/loadDictionaries/log.mjs.map +1 -0
  450. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +62 -0
  451. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -0
  452. package/dist/esm/logConfigDetails.mjs +37 -0
  453. package/dist/esm/logConfigDetails.mjs.map +1 -0
  454. package/dist/esm/prepareIntlayer.mjs +100 -0
  455. package/dist/esm/prepareIntlayer.mjs.map +1 -0
  456. package/dist/esm/reduceDictionaryContent/applyMask.mjs +29 -0
  457. package/dist/esm/reduceDictionaryContent/applyMask.mjs.map +1 -0
  458. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs +11 -0
  459. package/dist/esm/reduceDictionaryContent/reduceDictionaryContent.mjs.map +1 -0
  460. package/dist/esm/scan/analyzeBundleContent.mjs +180 -0
  461. package/dist/esm/scan/analyzeBundleContent.mjs.map +1 -0
  462. package/dist/esm/scan/calculateScore.mjs +61 -0
  463. package/dist/esm/scan/calculateScore.mjs.map +1 -0
  464. package/dist/esm/scan/checks.mjs +265 -0
  465. package/dist/esm/scan/checks.mjs.map +1 -0
  466. package/dist/esm/scan/index.mjs +7 -0
  467. package/dist/esm/scan/parseHtml.mjs +115 -0
  468. package/dist/esm/scan/parseHtml.mjs.map +1 -0
  469. package/dist/esm/scan/scanWebsite.mjs +203 -0
  470. package/dist/esm/scan/scanWebsite.mjs.map +1 -0
  471. package/dist/esm/scan/types.mjs +0 -0
  472. package/dist/esm/utils/autoDecorateContent.mjs +87 -0
  473. package/dist/esm/utils/autoDecorateContent.mjs.map +1 -0
  474. package/dist/esm/utils/buildComponentFilesList.mjs +91 -0
  475. package/dist/esm/utils/buildComponentFilesList.mjs.map +1 -0
  476. package/dist/esm/utils/buildFilesList.mjs +80 -0
  477. package/dist/esm/utils/buildFilesList.mjs.map +1 -0
  478. package/dist/esm/utils/chunkJSON.mjs +334 -0
  479. package/dist/esm/utils/chunkJSON.mjs.map +1 -0
  480. package/dist/esm/utils/formatter.mjs +14 -0
  481. package/dist/esm/utils/formatter.mjs.map +1 -0
  482. package/dist/esm/utils/getChunk.mjs +34 -0
  483. package/dist/esm/utils/getChunk.mjs.map +1 -0
  484. package/dist/esm/utils/getContentExtension.mjs +28 -0
  485. package/dist/esm/utils/getContentExtension.mjs.map +1 -0
  486. package/dist/esm/utils/getFormatFromExtension.mjs +38 -0
  487. package/dist/esm/utils/getFormatFromExtension.mjs.map +1 -0
  488. package/dist/esm/utils/getPathHash.mjs +20 -0
  489. package/dist/esm/utils/getPathHash.mjs.map +1 -0
  490. package/dist/esm/utils/index.mjs +22 -0
  491. package/dist/esm/utils/mergeChunks.mjs +27 -0
  492. package/dist/esm/utils/mergeChunks.mjs.map +1 -0
  493. package/dist/esm/utils/pLimit.mjs +131 -0
  494. package/dist/esm/utils/pLimit.mjs.map +1 -0
  495. package/dist/esm/utils/parallelize.mjs +11 -0
  496. package/dist/esm/utils/parallelize.mjs.map +1 -0
  497. package/dist/esm/utils/parallelizeGlobal.mjs +27 -0
  498. package/dist/esm/utils/parallelizeGlobal.mjs.map +1 -0
  499. package/dist/esm/utils/readDictionariesFromDisk.mjs +23 -0
  500. package/dist/esm/utils/readDictionariesFromDisk.mjs.map +1 -0
  501. package/dist/esm/utils/reduceObjectFormat.mjs +67 -0
  502. package/dist/esm/utils/reduceObjectFormat.mjs.map +1 -0
  503. package/dist/esm/utils/resolveObjectPromises.mjs +20 -0
  504. package/dist/esm/utils/resolveObjectPromises.mjs.map +1 -0
  505. package/dist/esm/utils/resolveRelativePath.mjs +20 -0
  506. package/dist/esm/utils/resolveRelativePath.mjs.map +1 -0
  507. package/dist/esm/utils/runOnce.mjs +93 -0
  508. package/dist/esm/utils/runOnce.mjs.map +1 -0
  509. package/dist/esm/utils/runParallel/bin.mjs +53 -0
  510. package/dist/esm/utils/runParallel/bin.mjs.map +1 -0
  511. package/dist/esm/utils/runParallel/bootstrap.mjs +23 -0
  512. package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -0
  513. package/dist/esm/utils/runParallel/index.mjs +100 -0
  514. package/dist/esm/utils/runParallel/index.mjs.map +1 -0
  515. package/dist/esm/utils/runParallel/pidTree.mjs +143 -0
  516. package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -0
  517. package/dist/esm/utils/runParallel/ps.mjs +47 -0
  518. package/dist/esm/utils/runParallel/ps.mjs.map +1 -0
  519. package/dist/esm/utils/runParallel/runTask.mjs +153 -0
  520. package/dist/esm/utils/runParallel/runTask.mjs.map +1 -0
  521. package/dist/esm/utils/runParallel/spawnPosix.mjs +47 -0
  522. package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -0
  523. package/dist/esm/utils/runParallel/spawnWin32.mjs +42 -0
  524. package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -0
  525. package/dist/esm/utils/runParallel/wmic.mjs +50 -0
  526. package/dist/esm/utils/runParallel/wmic.mjs.map +1 -0
  527. package/dist/esm/utils/sortAlphabetically.mjs +6 -0
  528. package/dist/esm/utils/sortAlphabetically.mjs.map +1 -0
  529. package/dist/esm/utils/splitTextByLine.mjs +10 -0
  530. package/dist/esm/utils/splitTextByLine.mjs.map +1 -0
  531. package/dist/esm/utils/verifyIdenticObjectFormat.mjs +64 -0
  532. package/dist/esm/utils/verifyIdenticObjectFormat.mjs.map +1 -0
  533. package/dist/esm/watcher.mjs +226 -0
  534. package/dist/esm/watcher.mjs.map +1 -0
  535. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs +33 -0
  536. package/dist/esm/writeConfiguration/generateConfigurationContent.mjs.map +1 -0
  537. package/dist/esm/writeConfiguration/index.mjs +22 -0
  538. package/dist/esm/writeConfiguration/index.mjs.map +1 -0
  539. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs +27 -0
  540. package/dist/esm/writeContentDeclaration/detectExportedComponentName.mjs.map +1 -0
  541. package/dist/esm/writeContentDeclaration/dictionaryStatus.mjs +0 -0
  542. package/dist/esm/writeContentDeclaration/index.mjs +6 -0
  543. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +92 -0
  544. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs.map +1 -0
  545. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +412 -0
  546. package/dist/esm/writeContentDeclaration/transformJSFile.mjs.map +1 -0
  547. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs +125 -0
  548. package/dist/esm/writeContentDeclaration/transformJSONFile.mjs.map +1 -0
  549. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +162 -0
  550. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs.map +1 -0
  551. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +91 -0
  552. package/dist/esm/writeContentDeclaration/writeJSFile.mjs.map +1 -0
  553. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +64 -0
  554. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs.map +1 -0
  555. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +42 -0
  556. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs.map +1 -0
  557. package/dist/esm/writeFileIfChanged.mjs +49 -0
  558. package/dist/esm/writeFileIfChanged.mjs.map +1 -0
  559. package/dist/esm/writeJsonIfChanged.mjs +17 -0
  560. package/dist/esm/writeJsonIfChanged.mjs.map +1 -0
  561. package/dist/types/build.d.ts +26 -0
  562. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +25 -0
  563. package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts.map +1 -0
  564. package/dist/types/buildIntlayerDictionary/index.d.ts +3 -0
  565. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts +11 -0
  566. package/dist/types/buildIntlayerDictionary/processContentDeclaration.d.ts.map +1 -0
  567. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +77 -0
  568. package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts.map +1 -0
  569. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +25 -0
  570. package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts.map +1 -0
  571. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +40 -0
  572. package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts.map +1 -0
  573. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +29 -0
  574. package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts.map +1 -0
  575. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts +34 -0
  576. package/dist/types/buildIntlayerDictionary/writeUnmergedDictionary.d.ts.map +1 -0
  577. package/dist/types/cleanOutputDir.d.ts +7 -0
  578. package/dist/types/cleanOutputDir.d.ts.map +1 -0
  579. package/dist/types/cleanRemovedContentDeclaration.d.ts +11 -0
  580. package/dist/types/cleanRemovedContentDeclaration.d.ts.map +1 -0
  581. package/dist/types/cli.d.ts +21 -0
  582. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +14 -0
  583. package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts.map +1 -0
  584. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +10 -0
  585. package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts.map +1 -0
  586. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts +10 -0
  587. package/dist/types/createDictionaryEntryPoint/getBuiltDictionariesPath.d.ts.map +1 -0
  588. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts +10 -0
  589. package/dist/types/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.d.ts.map +1 -0
  590. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts +10 -0
  591. package/dist/types/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.d.ts.map +1 -0
  592. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts +10 -0
  593. package/dist/types/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.d.ts.map +1 -0
  594. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts +10 -0
  595. package/dist/types/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.d.ts.map +1 -0
  596. package/dist/types/createDictionaryEntryPoint/index.d.ts +8 -0
  597. package/dist/types/createType/createModuleAugmentation.d.ts +9 -0
  598. package/dist/types/createType/createModuleAugmentation.d.ts.map +1 -0
  599. package/dist/types/createType/createType.d.ts +12 -0
  600. package/dist/types/createType/createType.d.ts.map +1 -0
  601. package/dist/types/createType/index.d.ts +3 -0
  602. package/dist/types/detectFormatCommand.d.ts +7 -0
  603. package/dist/types/detectFormatCommand.d.ts.map +1 -0
  604. package/dist/types/docReview/alignBlocks.d.ts +18 -0
  605. package/dist/types/docReview/alignBlocks.d.ts.map +1 -0
  606. package/dist/types/docReview/computeSimilarity.d.ts +22 -0
  607. package/dist/types/docReview/computeSimilarity.d.ts.map +1 -0
  608. package/dist/types/docReview/fingerprintBlock.d.ts +18 -0
  609. package/dist/types/docReview/fingerprintBlock.d.ts.map +1 -0
  610. package/dist/types/docReview/index.d.ts +12 -0
  611. package/dist/types/docReview/mapChangedLinesToBlocks.d.ts +15 -0
  612. package/dist/types/docReview/mapChangedLinesToBlocks.d.ts.map +1 -0
  613. package/dist/types/docReview/normalizeBlock.d.ts +18 -0
  614. package/dist/types/docReview/normalizeBlock.d.ts.map +1 -0
  615. package/dist/types/docReview/pipeline.d.ts +46 -0
  616. package/dist/types/docReview/pipeline.d.ts.map +1 -0
  617. package/dist/types/docReview/planActions.d.ts +18 -0
  618. package/dist/types/docReview/planActions.d.ts.map +1 -0
  619. package/dist/types/docReview/rebuildDocument.d.ts +46 -0
  620. package/dist/types/docReview/rebuildDocument.d.ts.map +1 -0
  621. package/dist/types/docReview/reviewReport.d.ts +82 -0
  622. package/dist/types/docReview/reviewReport.d.ts.map +1 -0
  623. package/dist/types/docReview/segmentDocument.d.ts +40 -0
  624. package/dist/types/docReview/segmentDocument.d.ts.map +1 -0
  625. package/dist/types/docReview/types.d.ts +73 -0
  626. package/dist/types/docReview/types.d.ts.map +1 -0
  627. package/dist/types/fetchDistantDictionaries.d.ts +16 -0
  628. package/dist/types/fetchDistantDictionaries.d.ts.map +1 -0
  629. package/dist/types/filterInvalidDictionaries.d.ts +12 -0
  630. package/dist/types/filterInvalidDictionaries.d.ts.map +1 -0
  631. package/dist/types/formatDictionary.d.ts +62 -0
  632. package/dist/types/formatDictionary.d.ts.map +1 -0
  633. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts +7 -0
  634. package/dist/types/getContentDeclarationFileTemplate/getContentDeclarationFileTemplate.d.ts.map +1 -0
  635. package/dist/types/getContentDeclarationFileTemplate/index.d.ts +2 -0
  636. package/dist/types/handleAdditionalContentDeclarationFile.d.ts +7 -0
  637. package/dist/types/handleAdditionalContentDeclarationFile.d.ts.map +1 -0
  638. package/dist/types/handleContentDeclarationFileChange.d.ts +7 -0
  639. package/dist/types/handleContentDeclarationFileChange.d.ts.map +1 -0
  640. package/dist/types/handleContentDeclarationFileMoved.d.ts +7 -0
  641. package/dist/types/handleContentDeclarationFileMoved.d.ts.map +1 -0
  642. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts +7 -0
  643. package/dist/types/handleUnlinkedContentDeclarationFile.d.ts.map +1 -0
  644. package/dist/types/init/cms.d.ts +51 -0
  645. package/dist/types/init/cms.d.ts.map +1 -0
  646. package/dist/types/init/frameworkSetup/index.d.ts +13 -0
  647. package/dist/types/init/frameworkSetup/index.d.ts.map +1 -0
  648. package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts +25 -0
  649. package/dist/types/init/frameworkSetup/nextAppRouter/detect.d.ts.map +1 -0
  650. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +12 -0
  651. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -0
  652. package/dist/types/init/frameworkSetup/nextAppRouter/restructure.d.ts +56 -0
  653. package/dist/types/init/frameworkSetup/nextAppRouter/restructure.d.ts.map +1 -0
  654. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts +26 -0
  655. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -0
  656. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts +23 -0
  657. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -0
  658. package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts +19 -0
  659. package/dist/types/init/frameworkSetup/tanstackStart/detect.d.ts.map +1 -0
  660. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +13 -0
  661. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -0
  662. package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts +68 -0
  663. package/dist/types/init/frameworkSetup/tanstackStart/restructure.d.ts.map +1 -0
  664. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +22 -0
  665. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -0
  666. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +17 -0
  667. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -0
  668. package/dist/types/init/frameworkSetup/types.d.ts +43 -0
  669. package/dist/types/init/frameworkSetup/types.d.ts.map +1 -0
  670. package/dist/types/init/index.d.ts +46 -0
  671. package/dist/types/init/index.d.ts.map +1 -0
  672. package/dist/types/init/utils/astImports.d.ts +29 -0
  673. package/dist/types/init/utils/astImports.d.ts.map +1 -0
  674. package/dist/types/init/utils/configManipulation.d.ts +99 -0
  675. package/dist/types/init/utils/configManipulation.d.ts.map +1 -0
  676. package/dist/types/init/utils/fileSystem.d.ts +111 -0
  677. package/dist/types/init/utils/fileSystem.d.ts.map +1 -0
  678. package/dist/types/init/utils/githubActions.d.ts +19 -0
  679. package/dist/types/init/utils/githubActions.d.ts.map +1 -0
  680. package/dist/types/init/utils/index.d.ts +9 -0
  681. package/dist/types/init/utils/jsonParser.d.ts +8 -0
  682. package/dist/types/init/utils/jsonParser.d.ts.map +1 -0
  683. package/dist/types/init/utils/nextCompilerBabel.d.ts +53 -0
  684. package/dist/types/init/utils/nextCompilerBabel.d.ts.map +1 -0
  685. package/dist/types/init/utils/packageManager.d.ts +149 -0
  686. package/dist/types/init/utils/packageManager.d.ts.map +1 -0
  687. package/dist/types/init/utils/tsConfig.d.ts +8 -0
  688. package/dist/types/init/utils/tsConfig.d.ts.map +1 -0
  689. package/dist/types/initConfig/index.d.ts +10 -0
  690. package/dist/types/initConfig/index.d.ts.map +1 -0
  691. package/dist/types/installLSP.d.ts +12 -0
  692. package/dist/types/installLSP.d.ts.map +1 -0
  693. package/dist/types/installMCP/installMCP.d.ts +11 -0
  694. package/dist/types/installMCP/installMCP.d.ts.map +1 -0
  695. package/dist/types/installSkills/index.d.ts +42 -0
  696. package/dist/types/installSkills/index.d.ts.map +1 -0
  697. package/dist/types/listDictionariesPath.d.ts +17 -0
  698. package/dist/types/listDictionariesPath.d.ts.map +1 -0
  699. package/dist/types/listGitFiles.d.ts +27 -0
  700. package/dist/types/listGitFiles.d.ts.map +1 -0
  701. package/dist/types/listProjects.d.ts +26 -0
  702. package/dist/types/listProjects.d.ts.map +1 -0
  703. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts +7 -0
  704. package/dist/types/loadDictionaries/getIntlayerBundle.d.ts.map +1 -0
  705. package/dist/types/loadDictionaries/index.d.ts +5 -0
  706. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts +15 -0
  707. package/dist/types/loadDictionaries/loadContentDeclaration.d.ts.map +1 -0
  708. package/dist/types/loadDictionaries/loadDictionaries.d.ts +23 -0
  709. package/dist/types/loadDictionaries/loadDictionaries.d.ts.map +1 -0
  710. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts +8 -0
  711. package/dist/types/loadDictionaries/loadLocalDictionaries.d.ts.map +1 -0
  712. package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts +7 -0
  713. package/dist/types/loadDictionaries/loadMarkdownContentDeclaration.d.ts.map +1 -0
  714. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +15 -0
  715. package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts.map +1 -0
  716. package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts +7 -0
  717. package/dist/types/loadDictionaries/loadYamlContentDeclaration.d.ts.map +1 -0
  718. package/dist/types/loadDictionaries/log.d.ts +36 -0
  719. package/dist/types/loadDictionaries/log.d.ts.map +1 -0
  720. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +7 -0
  721. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -0
  722. package/dist/types/logConfigDetails.d.ts +7 -0
  723. package/dist/types/logConfigDetails.d.ts.map +1 -0
  724. package/dist/types/prepareIntlayer.d.ts +15 -0
  725. package/dist/types/prepareIntlayer.d.ts.map +1 -0
  726. package/dist/types/reduceDictionaryContent/applyMask.d.ts +7 -0
  727. package/dist/types/reduceDictionaryContent/applyMask.d.ts.map +1 -0
  728. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts +7 -0
  729. package/dist/types/reduceDictionaryContent/reduceDictionaryContent.d.ts.map +1 -0
  730. package/dist/types/scan/analyzeBundleContent.d.ts +16 -0
  731. package/dist/types/scan/analyzeBundleContent.d.ts.map +1 -0
  732. package/dist/types/scan/calculateScore.d.ts +65 -0
  733. package/dist/types/scan/calculateScore.d.ts.map +1 -0
  734. package/dist/types/scan/checks.d.ts +38 -0
  735. package/dist/types/scan/checks.d.ts.map +1 -0
  736. package/dist/types/scan/index.d.ts +7 -0
  737. package/dist/types/scan/parseHtml.d.ts +54 -0
  738. package/dist/types/scan/parseHtml.d.ts.map +1 -0
  739. package/dist/types/scan/scanWebsite.d.ts +18 -0
  740. package/dist/types/scan/scanWebsite.d.ts.map +1 -0
  741. package/dist/types/scan/types.d.ts +76 -0
  742. package/dist/types/scan/types.d.ts.map +1 -0
  743. package/dist/types/utils/autoDecorateContent.d.ts +13 -0
  744. package/dist/types/utils/autoDecorateContent.d.ts.map +1 -0
  745. package/dist/types/utils/buildComponentFilesList.d.ts +28 -0
  746. package/dist/types/utils/buildComponentFilesList.d.ts.map +1 -0
  747. package/dist/types/utils/buildFilesList.d.ts +62 -0
  748. package/dist/types/utils/buildFilesList.d.ts.map +1 -0
  749. package/dist/types/utils/chunkJSON.d.ts +56 -0
  750. package/dist/types/utils/chunkJSON.d.ts.map +1 -0
  751. package/dist/types/utils/formatter.d.ts +9 -0
  752. package/dist/types/utils/formatter.d.ts.map +1 -0
  753. package/dist/types/utils/getChunk.d.ts +11 -0
  754. package/dist/types/utils/getChunk.d.ts.map +1 -0
  755. package/dist/types/utils/getContentExtension.d.ts +15 -0
  756. package/dist/types/utils/getContentExtension.d.ts.map +1 -0
  757. package/dist/types/utils/getFormatFromExtension.d.ts +8 -0
  758. package/dist/types/utils/getFormatFromExtension.d.ts.map +1 -0
  759. package/dist/types/utils/getPathHash.d.ts +8 -0
  760. package/dist/types/utils/getPathHash.d.ts.map +1 -0
  761. package/dist/types/utils/index.d.ts +21 -0
  762. package/dist/types/utils/mergeChunks.d.ts +5 -0
  763. package/dist/types/utils/mergeChunks.d.ts.map +1 -0
  764. package/dist/types/utils/pLimit.d.ts +16 -0
  765. package/dist/types/utils/pLimit.d.ts.map +1 -0
  766. package/dist/types/utils/parallelize.d.ts +5 -0
  767. package/dist/types/utils/parallelize.d.ts.map +1 -0
  768. package/dist/types/utils/parallelizeGlobal.d.ts +20 -0
  769. package/dist/types/utils/parallelizeGlobal.d.ts.map +1 -0
  770. package/dist/types/utils/readDictionariesFromDisk.d.ts +9 -0
  771. package/dist/types/utils/readDictionariesFromDisk.d.ts.map +1 -0
  772. package/dist/types/utils/reduceObjectFormat.d.ts +30 -0
  773. package/dist/types/utils/reduceObjectFormat.d.ts.map +1 -0
  774. package/dist/types/utils/resolveObjectPromises.d.ts +9 -0
  775. package/dist/types/utils/resolveObjectPromises.d.ts.map +1 -0
  776. package/dist/types/utils/resolveRelativePath.d.ts +5 -0
  777. package/dist/types/utils/resolveRelativePath.d.ts.map +1 -0
  778. package/dist/types/utils/runOnce.d.ts +45 -0
  779. package/dist/types/utils/runOnce.d.ts.map +1 -0
  780. package/dist/types/utils/runParallel/bin.d.ts +15 -0
  781. package/dist/types/utils/runParallel/bin.d.ts.map +1 -0
  782. package/dist/types/utils/runParallel/bootstrap.d.ts +5 -0
  783. package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -0
  784. package/dist/types/utils/runParallel/index.d.ts +14 -0
  785. package/dist/types/utils/runParallel/index.d.ts.map +1 -0
  786. package/dist/types/utils/runParallel/pidTree.d.ts +24 -0
  787. package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -0
  788. package/dist/types/utils/runParallel/ps.d.ts +11 -0
  789. package/dist/types/utils/runParallel/ps.d.ts.map +1 -0
  790. package/dist/types/utils/runParallel/runTask.d.ts +26 -0
  791. package/dist/types/utils/runParallel/runTask.d.ts.map +1 -0
  792. package/dist/types/utils/runParallel/spawnPosix.d.ts +20 -0
  793. package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -0
  794. package/dist/types/utils/runParallel/spawnWin32.d.ts +20 -0
  795. package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -0
  796. package/dist/types/utils/runParallel/wmic.d.ts +11 -0
  797. package/dist/types/utils/runParallel/wmic.d.ts.map +1 -0
  798. package/dist/types/utils/sortAlphabetically.d.ts +5 -0
  799. package/dist/types/utils/sortAlphabetically.d.ts.map +1 -0
  800. package/dist/types/utils/splitTextByLine.d.ts +5 -0
  801. package/dist/types/utils/splitTextByLine.d.ts.map +1 -0
  802. package/dist/types/utils/verifyIdenticObjectFormat.d.ts +23 -0
  803. package/dist/types/utils/verifyIdenticObjectFormat.d.ts.map +1 -0
  804. package/dist/types/watcher.d.ts +17 -0
  805. package/dist/types/watcher.d.ts.map +1 -0
  806. package/dist/types/writeConfiguration/generateConfigurationContent.d.ts +7 -0
  807. package/dist/types/writeConfiguration/generateConfigurationContent.d.ts.map +1 -0
  808. package/dist/types/writeConfiguration/index.d.ts +8 -0
  809. package/dist/types/writeConfiguration/index.d.ts.map +1 -0
  810. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts +12 -0
  811. package/dist/types/writeContentDeclaration/detectExportedComponentName.d.ts.map +1 -0
  812. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts +5 -0
  813. package/dist/types/writeContentDeclaration/dictionaryStatus.d.ts.map +1 -0
  814. package/dist/types/writeContentDeclaration/index.d.ts +6 -0
  815. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts +14 -0
  816. package/dist/types/writeContentDeclaration/processContentDeclarationContent.d.ts.map +1 -0
  817. package/dist/types/writeContentDeclaration/transformJSFile.d.ts +11 -0
  818. package/dist/types/writeContentDeclaration/transformJSFile.d.ts.map +1 -0
  819. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts +7 -0
  820. package/dist/types/writeContentDeclaration/transformJSONFile.d.ts.map +1 -0
  821. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts +19 -0
  822. package/dist/types/writeContentDeclaration/writeContentDeclaration.d.ts.map +1 -0
  823. package/dist/types/writeContentDeclaration/writeJSFile.d.ts +14 -0
  824. package/dist/types/writeContentDeclaration/writeJSFile.d.ts.map +1 -0
  825. package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts +8 -0
  826. package/dist/types/writeContentDeclaration/writeMarkdownFile.d.ts.map +1 -0
  827. package/dist/types/writeContentDeclaration/writeYamlFile.d.ts +8 -0
  828. package/dist/types/writeContentDeclaration/writeYamlFile.d.ts.map +1 -0
  829. package/dist/types/writeFileIfChanged.d.ts +11 -0
  830. package/dist/types/writeFileIfChanged.d.ts.map +1 -0
  831. package/dist/types/writeJsonIfChanged.d.ts +9 -0
  832. package/dist/types/writeJsonIfChanged.d.ts.map +1 -0
  833. package/package.json +159 -0
@@ -0,0 +1,113 @@
1
+ //#region src/init/frameworkSetup/nextAppRouter/templates.ts
2
+ /**
3
+ * File templates for a fresh Next.js App Router integration. These are only
4
+ * written when the target file does not exist (or, for the locale layout/page,
5
+ * when the app is effectively empty) — they never overwrite user code.
6
+ */
7
+ /** Next.js >= 16 locale-detection proxy (`src/proxy.ts`). */
8
+ const PROXY_TEMPLATE = `export { intlayerProxy as proxy } from "next-intlayer/proxy";
9
+
10
+ export const config = {
11
+ matcher:
12
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\\\..*|_next).*)",
13
+ };
14
+ `;
15
+ /** Next.js < 16 locale-detection middleware (`src/middleware.ts`). */
16
+ const MIDDLEWARE_TEMPLATE = `export { intlayerMiddleware as middleware } from "next-intlayer/middleware";
17
+
18
+ export const config = {
19
+ matcher:
20
+ "/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\\\..*|_next).*)",
21
+ };
22
+ `;
23
+ /** Minimal pass-through root layout (`app/layout.tsx`), lets `[locale]/layout` own `<html>`. */
24
+ const ROOT_LAYOUT_TEMPLATE_TS = `import type { PropsWithChildren, FC } from "react";
25
+
26
+ const RootLayout: FC<PropsWithChildren> = ({ children }) => <>{children}</>;
27
+
28
+ export default RootLayout;
29
+ `;
30
+ const ROOT_LAYOUT_TEMPLATE_JS = `const RootLayout = ({ children }) => <>{children}</>;
31
+
32
+ export default RootLayout;
33
+ `;
34
+ /** Locale layout (`app/[locale]/layout.tsx`) providing `<html>` + client provider. */
35
+ const LOCALE_LAYOUT_TEMPLATE_TS = `import { type NextLayoutIntlayer, IntlayerClientProvider } from "next-intlayer";
36
+ import { getHTMLTextDir } from "intlayer";
37
+
38
+ export { generateStaticParams } from "next-intlayer";
39
+
40
+ const LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {
41
+ const { locale } = await params;
42
+
43
+ return (
44
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
45
+ <body>
46
+ <IntlayerClientProvider locale={locale}>
47
+ {children}
48
+ </IntlayerClientProvider>
49
+ </body>
50
+ </html>
51
+ );
52
+ };
53
+
54
+ export default LocaleLayout;
55
+ `;
56
+ const LOCALE_LAYOUT_TEMPLATE_JS = `import { IntlayerClientProvider } from "next-intlayer";
57
+ import { getHTMLTextDir } from "intlayer";
58
+
59
+ export { generateStaticParams } from "next-intlayer";
60
+
61
+ const LocaleLayout = async ({ children, params }) => {
62
+ const { locale } = await params;
63
+
64
+ return (
65
+ <html lang={locale} dir={getHTMLTextDir(locale)}>
66
+ <body>
67
+ <IntlayerClientProvider locale={locale}>
68
+ {children}
69
+ </IntlayerClientProvider>
70
+ </body>
71
+ </html>
72
+ );
73
+ };
74
+
75
+ export default LocaleLayout;
76
+ `;
77
+ /**
78
+ * Locale home page (`app/[locale]/page.tsx`). Self-contained starter that does
79
+ * not depend on an example content declaration — add Intlayer content (a
80
+ * `*.content.ts` file consumed via `useIntlayer`) as the next step.
81
+ */
82
+ const LOCALE_PAGE_TEMPLATE_TS = `import { type NextPageIntlayer } from "next-intlayer";
83
+
84
+ const Page: NextPageIntlayer = async ({ params }) => {
85
+ const { locale } = await params;
86
+
87
+ return (
88
+ <main>
89
+ <h1>{locale}</h1>
90
+ <p>Get started by editing this page.</p>
91
+ </main>
92
+ );
93
+ };
94
+
95
+ export default Page;
96
+ `;
97
+ const LOCALE_PAGE_TEMPLATE_JS = `const Page = async ({ params }) => {
98
+ const { locale } = await params;
99
+
100
+ return (
101
+ <main>
102
+ <h1>{locale}</h1>
103
+ <p>Get started by editing this page.</p>
104
+ </main>
105
+ );
106
+ };
107
+
108
+ export default Page;
109
+ `;
110
+
111
+ //#endregion
112
+ export { LOCALE_LAYOUT_TEMPLATE_JS, LOCALE_LAYOUT_TEMPLATE_TS, LOCALE_PAGE_TEMPLATE_JS, LOCALE_PAGE_TEMPLATE_TS, MIDDLEWARE_TEMPLATE, PROXY_TEMPLATE, ROOT_LAYOUT_TEMPLATE_JS, ROOT_LAYOUT_TEMPLATE_TS };
113
+ //# sourceMappingURL=templates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/nextAppRouter/templates.ts"],"sourcesContent":["/**\n * File templates for a fresh Next.js App Router integration. These are only\n * written when the target file does not exist (or, for the locale layout/page,\n * when the app is effectively empty) — they never overwrite user code.\n */\n\n/** Next.js >= 16 locale-detection proxy (`src/proxy.ts`). */\nexport const PROXY_TEMPLATE = `export { intlayerProxy as proxy } from \"next-intlayer/proxy\";\n\nexport const config = {\n matcher:\n \"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\\\\\\\..*|_next).*)\",\n};\n`;\n\n/** Next.js < 16 locale-detection middleware (`src/middleware.ts`). */\nexport const MIDDLEWARE_TEMPLATE = `export { intlayerMiddleware as middleware } from \"next-intlayer/middleware\";\n\nexport const config = {\n matcher:\n \"/((?!api|static|assets|robots|sitemap|sw|service-worker|manifest|.*\\\\\\\\..*|_next).*)\",\n};\n`;\n\n/** Minimal pass-through root layout (`app/layout.tsx`), lets `[locale]/layout` own `<html>`. */\nexport const ROOT_LAYOUT_TEMPLATE_TS = `import type { PropsWithChildren, FC } from \"react\";\n\nconst RootLayout: FC<PropsWithChildren> = ({ children }) => <>{children}</>;\n\nexport default RootLayout;\n`;\n\nexport const ROOT_LAYOUT_TEMPLATE_JS = `const RootLayout = ({ children }) => <>{children}</>;\n\nexport default RootLayout;\n`;\n\n/** Locale layout (`app/[locale]/layout.tsx`) providing `<html>` + client provider. */\nexport const LOCALE_LAYOUT_TEMPLATE_TS = `import { type NextLayoutIntlayer, IntlayerClientProvider } from \"next-intlayer\";\nimport { getHTMLTextDir } from \"intlayer\";\n\nexport { generateStaticParams } from \"next-intlayer\";\n\nconst LocaleLayout: NextLayoutIntlayer = async ({ children, params }) => {\n const { locale } = await params;\n\n return (\n <html lang={locale} dir={getHTMLTextDir(locale)}>\n <body>\n <IntlayerClientProvider locale={locale}>\n {children}\n </IntlayerClientProvider>\n </body>\n </html>\n );\n};\n\nexport default LocaleLayout;\n`;\n\nexport const LOCALE_LAYOUT_TEMPLATE_JS = `import { IntlayerClientProvider } from \"next-intlayer\";\nimport { getHTMLTextDir } from \"intlayer\";\n\nexport { generateStaticParams } from \"next-intlayer\";\n\nconst LocaleLayout = async ({ children, params }) => {\n const { locale } = await params;\n\n return (\n <html lang={locale} dir={getHTMLTextDir(locale)}>\n <body>\n <IntlayerClientProvider locale={locale}>\n {children}\n </IntlayerClientProvider>\n </body>\n </html>\n );\n};\n\nexport default LocaleLayout;\n`;\n\n/**\n * Locale home page (`app/[locale]/page.tsx`). Self-contained starter that does\n * not depend on an example content declaration — add Intlayer content (a\n * `*.content.ts` file consumed via `useIntlayer`) as the next step.\n */\nexport const LOCALE_PAGE_TEMPLATE_TS = `import { type NextPageIntlayer } from \"next-intlayer\";\n\nconst Page: NextPageIntlayer = async ({ params }) => {\n const { locale } = await params;\n\n return (\n <main>\n <h1>{locale}</h1>\n <p>Get started by editing this page.</p>\n </main>\n );\n};\n\nexport default Page;\n`;\n\nexport const LOCALE_PAGE_TEMPLATE_JS = `const Page = async ({ params }) => {\n const { locale } = await params;\n\n return (\n <main>\n <h1>{locale}</h1>\n <p>Get started by editing this page.</p>\n </main>\n );\n};\n\nexport default Page;\n`;\n"],"mappings":";;;;;;;AAOA,MAAa,iBAAiB;;;;;;;;AAS9B,MAAa,sBAAsB;;;;;;;;AASnC,MAAa,0BAA0B;;;;;;AAOvC,MAAa,0BAA0B;;;;;AAMvC,MAAa,4BAA4B;;;;;;;;;;;;;;;;;;;;;AAsBzC,MAAa,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BzC,MAAa,0BAA0B;;;;;;;;;;;;;;;AAgBvC,MAAa,0BAA0B"}
@@ -0,0 +1,193 @@
1
+ import { __require } from "../../../_virtual/_rolldown/runtime.mjs";
2
+ import { ensureNamedImport, firstInsertIndex } from "../../utils/astImports.mjs";
3
+ import * as recast from "recast";
4
+
5
+ //#region src/init/frameworkSetup/nextAppRouter/transforms.ts
6
+ const { builders: b } = recast.types;
7
+ /** babel-ts parser handles TypeScript *and* JSX (the `typescript` parser does not). */
8
+ const parseTsx = (code) => recast.parse(code, { parser: __require("recast/parsers/babel-ts") });
9
+ /** Detects a top-level `'use client'` directive (client components can't be async server providers). */
10
+ const isClientComponent = (ast) => {
11
+ if ((ast.program.directives ?? []).some((directive) => directive.value?.value === "use client")) return true;
12
+ return ast.program.body.some((stmt) => stmt.type === "ExpressionStatement" && stmt.expression?.type === "StringLiteral" && stmt.expression.value === "use client");
13
+ };
14
+ /** Finds the function node behind `export default`, following an identifier reference if needed. */
15
+ const findDefaultExportFunction = (ast) => {
16
+ const body = ast.program.body;
17
+ const asFunction = (node) => node && (node.type === "ArrowFunctionExpression" || node.type === "FunctionExpression" || node.type === "FunctionDeclaration") ? node : null;
18
+ for (const stmt of body) {
19
+ if (stmt.type !== "ExportDefaultDeclaration") continue;
20
+ const direct = asFunction(stmt.declaration);
21
+ if (direct) return direct;
22
+ if (stmt.declaration?.type === "Identifier") {
23
+ const name = stmt.declaration.name;
24
+ for (const candidate of body) {
25
+ if (candidate.type === "VariableDeclaration") {
26
+ for (const declarator of candidate.declarations) if (declarator.id?.type === "Identifier" && declarator.id.name === name) {
27
+ const fn = asFunction(declarator.init);
28
+ if (fn) return fn;
29
+ }
30
+ }
31
+ if (candidate.type === "FunctionDeclaration" && candidate.id?.name === name) return candidate;
32
+ }
33
+ }
34
+ }
35
+ return null;
36
+ };
37
+ /** Ensures `export { exportedName } from source`, skipping when already declared/re-exported. */
38
+ const ensureExportFrom = (ast, exportedName, source) => {
39
+ if (ast.program.body.some((stmt) => {
40
+ if (stmt.type === "ExportNamedDeclaration" && stmt.source?.value === source) return stmt.specifiers.some((spec) => spec.exported?.name === exportedName);
41
+ if (stmt.type === "ExportNamedDeclaration" && stmt.declaration) {
42
+ const decl = stmt.declaration;
43
+ if (decl.type === "FunctionDeclaration" && decl.id?.name === exportedName) return true;
44
+ if (decl.type === "VariableDeclaration") return decl.declarations.some((d) => d.id?.type === "Identifier" && d.id.name === exportedName);
45
+ }
46
+ return false;
47
+ })) return;
48
+ const exportNode = parseTsx(`export { ${exportedName} } from "${source}";`).program.body[0];
49
+ ast.program.body.splice(firstInsertIndex(ast), 0, exportNode);
50
+ };
51
+ /** Makes the function async and inserts `const locale = await getLocale();` once, at the top of its body. */
52
+ const ensureAwaitedLocale = (funcNode) => {
53
+ funcNode.async = true;
54
+ if (funcNode.body.type !== "BlockStatement") funcNode.body = b.blockStatement([b.returnStatement(funcNode.body)]);
55
+ if (!funcNode.body.body.some((stmt) => stmt.type === "VariableDeclaration" && stmt.declarations.some((d) => d.id?.type === "Identifier" && d.id.name === "locale" || d.id?.type === "ObjectPattern" && d.id.properties?.some((prop) => prop.value?.type === "Identifier" && prop.value?.name === "locale")))) {
56
+ const localeStatement = parseTsx("const locale = await getLocale();").program.body[0];
57
+ funcNode.body.body.unshift(localeStatement);
58
+ }
59
+ };
60
+ /** Builds `<providerName locale={locale}>{child}</providerName>` around an existing JSX child node. */
61
+ const buildProviderElement = (providerName, childNode) => {
62
+ const providerElement = parseTsx(`const __wrap = <${providerName} locale={locale}>{__child__}</${providerName}>;`).program.body[0].declarations[0].init;
63
+ providerElement.children = [childNode];
64
+ return providerElement;
65
+ };
66
+ /** Sets `lang={locale}` on the first `<html>` element, if present. */
67
+ const setHtmlLang = (ast) => {
68
+ recast.visit(ast, { visitJSXOpeningElement(path) {
69
+ const node = path.node;
70
+ if (node.name?.type === "JSXIdentifier" && node.name.name === "html") {
71
+ const langAttr = node.attributes?.find((attr) => attr.type === "JSXAttribute" && attr.name?.name === "lang");
72
+ const localeExpression = b.jsxExpressionContainer(b.identifier("locale"));
73
+ if (langAttr) langAttr.value = localeExpression;
74
+ else node.attributes.push(b.jsxAttribute(b.jsxIdentifier("lang"), localeExpression));
75
+ return false;
76
+ }
77
+ this.traverse(path);
78
+ } });
79
+ };
80
+ /**
81
+ * Wraps the `{children}` of a Next.js App Router **layout** with
82
+ * `IntlayerClientProvider`, deriving the locale via `getLocale()`. Safe and
83
+ * idempotent: bails (returns the original code) for client components, when no
84
+ * `{children}` placeholder is found, or when there is no default export.
85
+ */
86
+ const wrapLayoutWithProvider = (code) => {
87
+ const ast = parseTsx(code);
88
+ if (isClientComponent(ast)) return {
89
+ code,
90
+ status: "skipped-client"
91
+ };
92
+ if (code.includes("IntlayerClientProvider")) return {
93
+ code,
94
+ status: "already"
95
+ };
96
+ const funcNode = findDefaultExportFunction(ast);
97
+ if (!funcNode) return {
98
+ code,
99
+ status: "skipped"
100
+ };
101
+ let wrapped = false;
102
+ recast.visit(funcNode, { visitJSXExpressionContainer(path) {
103
+ if (wrapped) return false;
104
+ const expression = path.node.expression;
105
+ if (expression?.type === "Identifier" && expression.name === "children") {
106
+ path.replace(buildProviderElement("IntlayerClientProvider", path.node));
107
+ wrapped = true;
108
+ return false;
109
+ }
110
+ this.traverse(path);
111
+ } });
112
+ if (!wrapped) return {
113
+ code,
114
+ status: "skipped"
115
+ };
116
+ ensureNamedImport(ast, "IntlayerClientProvider", "next-intlayer");
117
+ ensureNamedImport(ast, "getLocale", "next-intlayer/server");
118
+ ensureExportFrom(ast, "generateStaticParams", "next-intlayer");
119
+ ensureAwaitedLocale(funcNode);
120
+ setHtmlLang(ast);
121
+ return {
122
+ code: recast.print(ast).code,
123
+ status: "wrapped"
124
+ };
125
+ };
126
+ /** Returns the single top-level JSX return of a function, or the JSX of an expression-bodied arrow. */
127
+ const findSingleJsxReturn = (funcNode) => {
128
+ if (funcNode.type === "ArrowFunctionExpression" && funcNode.body.type !== "BlockStatement") return (funcNode.body.type === "JSXElement" || funcNode.body.type === "JSXFragment" ? funcNode.body : null) ? {
129
+ kind: "arrow",
130
+ node: funcNode
131
+ } : null;
132
+ if (funcNode.body.type !== "BlockStatement") return null;
133
+ const jsxReturns = [];
134
+ let functionDepth = 0;
135
+ recast.visit(funcNode, {
136
+ visitFunction(path) {
137
+ functionDepth++;
138
+ if (functionDepth === 1) this.traverse(path);
139
+ functionDepth--;
140
+ return false;
141
+ },
142
+ visitReturnStatement(path) {
143
+ const argument = path.node.argument;
144
+ if (argument?.type === "JSXElement" || argument?.type === "JSXFragment") jsxReturns.push(path.node);
145
+ this.traverse(path);
146
+ }
147
+ });
148
+ if (jsxReturns.length !== 1) return null;
149
+ return {
150
+ kind: "return",
151
+ node: jsxReturns[0]
152
+ };
153
+ };
154
+ /**
155
+ * Wraps the returned JSX of a Next.js App Router **page** with
156
+ * `IntlayerServerProvider`, deriving the locale via `getLocale()`. Safe and
157
+ * idempotent: bails for client components, when the page has no single
158
+ * top-level JSX return, or when there is no default export.
159
+ */
160
+ const wrapPageWithProvider = (code) => {
161
+ const ast = parseTsx(code);
162
+ if (isClientComponent(ast)) return {
163
+ code,
164
+ status: "skipped-client"
165
+ };
166
+ if (code.includes("IntlayerServerProvider")) return {
167
+ code,
168
+ status: "already"
169
+ };
170
+ const funcNode = findDefaultExportFunction(ast);
171
+ if (!funcNode) return {
172
+ code,
173
+ status: "skipped"
174
+ };
175
+ const jsxReturn = findSingleJsxReturn(funcNode);
176
+ if (!jsxReturn) return {
177
+ code,
178
+ status: "skipped"
179
+ };
180
+ if (jsxReturn.kind === "return") jsxReturn.node.argument = buildProviderElement("IntlayerServerProvider", jsxReturn.node.argument);
181
+ else jsxReturn.node.body = buildProviderElement("IntlayerServerProvider", jsxReturn.node.body);
182
+ ensureNamedImport(ast, "IntlayerServerProvider", "next-intlayer/server");
183
+ ensureNamedImport(ast, "getLocale", "next-intlayer/server");
184
+ ensureAwaitedLocale(funcNode);
185
+ return {
186
+ code: recast.print(ast).code,
187
+ status: "wrapped"
188
+ };
189
+ };
190
+
191
+ //#endregion
192
+ export { wrapLayoutWithProvider, wrapPageWithProvider };
193
+ //# sourceMappingURL=transforms.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/nextAppRouter/transforms.ts"],"sourcesContent":["import * as recast from 'recast';\nimport { ensureNamedImport, firstInsertIndex } from '../../utils/astImports';\n\nconst { builders: b } = recast.types;\n\n/** babel-ts parser handles TypeScript *and* JSX (the `typescript` parser does not). */\nconst parseTsx = (code: string): any =>\n recast.parse(code, { parser: require('recast/parsers/babel-ts') });\n\n/** Result of a source transform. `code` is unchanged for any non-`wrapped` status. */\nexport type TransformResult = {\n code: string;\n status: 'wrapped' | 'already' | 'skipped-client' | 'skipped';\n};\n\n/** Detects a top-level `'use client'` directive (client components can't be async server providers). */\nconst isClientComponent = (ast: any): boolean => {\n const directives = ast.program.directives ?? [];\n if (\n directives.some((directive: any) => directive.value?.value === 'use client')\n ) {\n return true;\n }\n return ast.program.body.some(\n (stmt: any) =>\n stmt.type === 'ExpressionStatement' &&\n stmt.expression?.type === 'StringLiteral' &&\n stmt.expression.value === 'use client'\n );\n};\n\n/** Finds the function node behind `export default`, following an identifier reference if needed. */\nconst findDefaultExportFunction = (ast: any): any => {\n const body = ast.program.body;\n\n const asFunction = (node: any): any =>\n node &&\n (node.type === 'ArrowFunctionExpression' ||\n node.type === 'FunctionExpression' ||\n node.type === 'FunctionDeclaration')\n ? node\n : null;\n\n for (const stmt of body) {\n if (stmt.type !== 'ExportDefaultDeclaration') continue;\n\n const direct = asFunction(stmt.declaration);\n if (direct) return direct;\n\n if (stmt.declaration?.type === 'Identifier') {\n const name = stmt.declaration.name;\n for (const candidate of body) {\n if (candidate.type === 'VariableDeclaration') {\n for (const declarator of candidate.declarations) {\n if (\n declarator.id?.type === 'Identifier' &&\n declarator.id.name === name\n ) {\n const fn = asFunction(declarator.init);\n if (fn) return fn;\n }\n }\n }\n if (\n candidate.type === 'FunctionDeclaration' &&\n candidate.id?.name === name\n ) {\n return candidate;\n }\n }\n }\n }\n\n return null;\n};\n\n/** Ensures `export { exportedName } from source`, skipping when already declared/re-exported. */\nconst ensureExportFrom = (\n ast: any,\n exportedName: string,\n source: string\n): void => {\n const body = ast.program.body;\n\n const alreadyPresent = body.some((stmt: any) => {\n if (\n stmt.type === 'ExportNamedDeclaration' &&\n stmt.source?.value === source\n ) {\n return stmt.specifiers.some(\n (spec: any) => spec.exported?.name === exportedName\n );\n }\n // Locally declared `export const/function generateStaticParams`\n if (stmt.type === 'ExportNamedDeclaration' && stmt.declaration) {\n const decl = stmt.declaration;\n if (decl.type === 'FunctionDeclaration' && decl.id?.name === exportedName)\n return true;\n if (decl.type === 'VariableDeclaration') {\n return decl.declarations.some(\n (d: any) => d.id?.type === 'Identifier' && d.id.name === exportedName\n );\n }\n }\n return false;\n });\n\n if (alreadyPresent) return;\n\n const exportNode = parseTsx(`export { ${exportedName} } from \"${source}\";`)\n .program.body[0];\n ast.program.body.splice(firstInsertIndex(ast), 0, exportNode);\n};\n\n/** Makes the function async and inserts `const locale = await getLocale();` once, at the top of its body. */\nconst ensureAwaitedLocale = (funcNode: any): void => {\n funcNode.async = true;\n\n if (funcNode.body.type !== 'BlockStatement') {\n funcNode.body = b.blockStatement([b.returnStatement(funcNode.body)]);\n }\n\n const hasLocale = funcNode.body.body.some(\n (stmt: any) =>\n stmt.type === 'VariableDeclaration' &&\n stmt.declarations.some(\n (d: any) =>\n // const locale = ...\n (d.id?.type === 'Identifier' && d.id.name === 'locale') ||\n // const { locale } = ... or const { locale: locale } = ...\n (d.id?.type === 'ObjectPattern' &&\n d.id.properties?.some(\n (prop: any) =>\n prop.value?.type === 'Identifier' &&\n prop.value?.name === 'locale'\n ))\n )\n );\n\n if (!hasLocale) {\n const localeStatement = parseTsx('const locale = await getLocale();')\n .program.body[0];\n funcNode.body.body.unshift(localeStatement);\n }\n};\n\n/** Builds `<providerName locale={locale}>{child}</providerName>` around an existing JSX child node. */\nconst buildProviderElement = (providerName: string, childNode: any): any => {\n const template = parseTsx(\n `const __wrap = <${providerName} locale={locale}>{__child__}</${providerName}>;`\n );\n const providerElement = template.program.body[0].declarations[0].init;\n providerElement.children = [childNode];\n return providerElement;\n};\n\n/** Sets `lang={locale}` on the first `<html>` element, if present. */\nconst setHtmlLang = (ast: any): void => {\n recast.visit(ast, {\n visitJSXOpeningElement(path) {\n const node = path.node;\n if (node.name?.type === 'JSXIdentifier' && node.name.name === 'html') {\n const langAttr = node.attributes?.find(\n (attr: any) =>\n attr.type === 'JSXAttribute' && attr.name?.name === 'lang'\n ) as any;\n const localeExpression = b.jsxExpressionContainer(\n b.identifier('locale')\n );\n if (langAttr) {\n langAttr.value = localeExpression;\n } else {\n node.attributes.push(\n b.jsxAttribute(b.jsxIdentifier('lang'), localeExpression)\n );\n }\n return false;\n }\n this.traverse(path);\n },\n });\n};\n\n/**\n * Wraps the `{children}` of a Next.js App Router **layout** with\n * `IntlayerClientProvider`, deriving the locale via `getLocale()`. Safe and\n * idempotent: bails (returns the original code) for client components, when no\n * `{children}` placeholder is found, or when there is no default export.\n */\nexport const wrapLayoutWithProvider = (code: string): TransformResult => {\n const ast = parseTsx(code);\n\n if (isClientComponent(ast)) return { code, status: 'skipped-client' };\n if (code.includes('IntlayerClientProvider'))\n return { code, status: 'already' };\n\n const funcNode = findDefaultExportFunction(ast);\n if (!funcNode) return { code, status: 'skipped' };\n\n let wrapped = false;\n recast.visit(funcNode, {\n visitJSXExpressionContainer(path) {\n if (wrapped) return false;\n const expression = path.node.expression;\n if (expression?.type === 'Identifier' && expression.name === 'children') {\n path.replace(buildProviderElement('IntlayerClientProvider', path.node));\n wrapped = true;\n return false;\n }\n this.traverse(path);\n },\n });\n\n if (!wrapped) return { code, status: 'skipped' };\n\n ensureNamedImport(ast, 'IntlayerClientProvider', 'next-intlayer');\n ensureNamedImport(ast, 'getLocale', 'next-intlayer/server');\n ensureExportFrom(ast, 'generateStaticParams', 'next-intlayer');\n ensureAwaitedLocale(funcNode);\n setHtmlLang(ast);\n\n return { code: recast.print(ast).code, status: 'wrapped' };\n};\n\n/** Returns the single top-level JSX return of a function, or the JSX of an expression-bodied arrow. */\nconst findSingleJsxReturn = (\n funcNode: any\n): { kind: 'return'; node: any } | { kind: 'arrow'; node: any } | null => {\n if (\n funcNode.type === 'ArrowFunctionExpression' &&\n funcNode.body.type !== 'BlockStatement'\n ) {\n const body =\n funcNode.body.type === 'JSXElement' ||\n funcNode.body.type === 'JSXFragment'\n ? funcNode.body\n : null;\n return body ? { kind: 'arrow', node: funcNode } : null;\n }\n\n if (funcNode.body.type !== 'BlockStatement') return null;\n\n // Collect every JSX-returning `return` inside this function, but do not\n // descend into nested function scopes (e.g. an inner component defined in the\n // same file). More than one top-level JSX return is ambiguous — bail.\n const jsxReturns: any[] = [];\n let functionDepth = 0;\n recast.visit(funcNode, {\n visitFunction(path) {\n functionDepth++;\n if (functionDepth === 1) {\n this.traverse(path);\n }\n functionDepth--;\n return false;\n },\n visitReturnStatement(path) {\n const argument = path.node.argument;\n if (argument?.type === 'JSXElement' || argument?.type === 'JSXFragment') {\n jsxReturns.push(path.node);\n }\n this.traverse(path);\n },\n });\n\n if (jsxReturns.length !== 1) return null;\n return { kind: 'return', node: jsxReturns[0] };\n};\n\n/**\n * Wraps the returned JSX of a Next.js App Router **page** with\n * `IntlayerServerProvider`, deriving the locale via `getLocale()`. Safe and\n * idempotent: bails for client components, when the page has no single\n * top-level JSX return, or when there is no default export.\n */\nexport const wrapPageWithProvider = (code: string): TransformResult => {\n const ast = parseTsx(code);\n\n if (isClientComponent(ast)) return { code, status: 'skipped-client' };\n if (code.includes('IntlayerServerProvider'))\n return { code, status: 'already' };\n\n const funcNode = findDefaultExportFunction(ast);\n if (!funcNode) return { code, status: 'skipped' };\n\n const jsxReturn = findSingleJsxReturn(funcNode);\n if (!jsxReturn) return { code, status: 'skipped' };\n\n if (jsxReturn.kind === 'return') {\n jsxReturn.node.argument = buildProviderElement(\n 'IntlayerServerProvider',\n jsxReturn.node.argument\n );\n } else {\n jsxReturn.node.body = buildProviderElement(\n 'IntlayerServerProvider',\n jsxReturn.node.body\n );\n }\n\n ensureNamedImport(ast, 'IntlayerServerProvider', 'next-intlayer/server');\n ensureNamedImport(ast, 'getLocale', 'next-intlayer/server');\n ensureAwaitedLocale(funcNode);\n\n return { code: recast.print(ast).code, status: 'wrapped' };\n};\n"],"mappings":";;;;;AAGA,MAAM,EAAE,UAAU,MAAM,OAAO;;AAG/B,MAAM,YAAY,SAChB,OAAO,MAAM,MAAM,EAAE,kBAAgB,0BAA0B,EAAE,CAAC;;AASpE,MAAM,qBAAqB,QAAsB;AAE/C,MADmB,IAAI,QAAQ,cAAc,EAAE,EAElC,MAAM,cAAmB,UAAU,OAAO,UAAU,aAAa,CAE5E,QAAO;AAET,QAAO,IAAI,QAAQ,KAAK,MACrB,SACC,KAAK,SAAS,yBACd,KAAK,YAAY,SAAS,mBAC1B,KAAK,WAAW,UAAU,aAC7B;;;AAIH,MAAM,6BAA6B,QAAkB;CACnD,MAAM,OAAO,IAAI,QAAQ;CAEzB,MAAM,cAAc,SAClB,SACC,KAAK,SAAS,6BACb,KAAK,SAAS,wBACd,KAAK,SAAS,yBACZ,OACA;AAEN,MAAK,MAAM,QAAQ,MAAM;AACvB,MAAI,KAAK,SAAS,2BAA4B;EAE9C,MAAM,SAAS,WAAW,KAAK,YAAY;AAC3C,MAAI,OAAQ,QAAO;AAEnB,MAAI,KAAK,aAAa,SAAS,cAAc;GAC3C,MAAM,OAAO,KAAK,YAAY;AAC9B,QAAK,MAAM,aAAa,MAAM;AAC5B,QAAI,UAAU,SAAS,uBACrB;UAAK,MAAM,cAAc,UAAU,aACjC,KACE,WAAW,IAAI,SAAS,gBACxB,WAAW,GAAG,SAAS,MACvB;MACA,MAAM,KAAK,WAAW,WAAW,KAAK;AACtC,UAAI,GAAI,QAAO;;;AAIrB,QACE,UAAU,SAAS,yBACnB,UAAU,IAAI,SAAS,KAEvB,QAAO;;;;AAMf,QAAO;;;AAIT,MAAM,oBACJ,KACA,cACA,WACS;AA0BT,KAzBa,IAAI,QAAQ,KAEG,MAAM,SAAc;AAC9C,MACE,KAAK,SAAS,4BACd,KAAK,QAAQ,UAAU,OAEvB,QAAO,KAAK,WAAW,MACpB,SAAc,KAAK,UAAU,SAAS,aACxC;AAGH,MAAI,KAAK,SAAS,4BAA4B,KAAK,aAAa;GAC9D,MAAM,OAAO,KAAK;AAClB,OAAI,KAAK,SAAS,yBAAyB,KAAK,IAAI,SAAS,aAC3D,QAAO;AACT,OAAI,KAAK,SAAS,sBAChB,QAAO,KAAK,aAAa,MACtB,MAAW,EAAE,IAAI,SAAS,gBAAgB,EAAE,GAAG,SAAS,aAC1D;;AAGL,SAAO;GAGS,CAAE;CAEpB,MAAM,aAAa,SAAS,YAAY,aAAa,WAAW,OAAO,IAAI,CACxE,QAAQ,KAAK;AAChB,KAAI,QAAQ,KAAK,OAAO,iBAAiB,IAAI,EAAE,GAAG,WAAW;;;AAI/D,MAAM,uBAAuB,aAAwB;AACnD,UAAS,QAAQ;AAEjB,KAAI,SAAS,KAAK,SAAS,iBACzB,UAAS,OAAO,EAAE,eAAe,CAAC,EAAE,gBAAgB,SAAS,KAAK,CAAC,CAAC;AAoBtE,KAAI,CAjBc,SAAS,KAAK,KAAK,MAClC,SACC,KAAK,SAAS,yBACd,KAAK,aAAa,MACf,MAEE,EAAE,IAAI,SAAS,gBAAgB,EAAE,GAAG,SAAS,YAE7C,EAAE,IAAI,SAAS,mBACd,EAAE,GAAG,YAAY,MACd,SACC,KAAK,OAAO,SAAS,gBACrB,KAAK,OAAO,SAAS,SACxB,CACN,CAGS,EAAE;EACd,MAAM,kBAAkB,SAAS,oCAAoC,CAClE,QAAQ,KAAK;AAChB,WAAS,KAAK,KAAK,QAAQ,gBAAgB;;;;AAK/C,MAAM,wBAAwB,cAAsB,cAAwB;CAI1E,MAAM,kBAHW,SACf,mBAAmB,aAAa,gCAAgC,aAAa,IAE/C,CAAC,QAAQ,KAAK,GAAG,aAAa,GAAG;AACjE,iBAAgB,WAAW,CAAC,UAAU;AACtC,QAAO;;;AAIT,MAAM,eAAe,QAAmB;AACtC,QAAO,MAAM,KAAK,EAChB,uBAAuB,MAAM;EAC3B,MAAM,OAAO,KAAK;AAClB,MAAI,KAAK,MAAM,SAAS,mBAAmB,KAAK,KAAK,SAAS,QAAQ;GACpE,MAAM,WAAW,KAAK,YAAY,MAC/B,SACC,KAAK,SAAS,kBAAkB,KAAK,MAAM,SAAS,OACvD;GACD,MAAM,mBAAmB,EAAE,uBACzB,EAAE,WAAW,SAAS,CACvB;AACD,OAAI,SACF,UAAS,QAAQ;OAEjB,MAAK,WAAW,KACd,EAAE,aAAa,EAAE,cAAc,OAAO,EAAE,iBAAiB,CAC1D;AAEH,UAAO;;AAET,OAAK,SAAS,KAAK;IAEtB,CAAC;;;;;;;;AASJ,MAAa,0BAA0B,SAAkC;CACvE,MAAM,MAAM,SAAS,KAAK;AAE1B,KAAI,kBAAkB,IAAI,CAAE,QAAO;EAAE;EAAM,QAAQ;EAAkB;AACrE,KAAI,KAAK,SAAS,yBAAyB,CACzC,QAAO;EAAE;EAAM,QAAQ;EAAW;CAEpC,MAAM,WAAW,0BAA0B,IAAI;AAC/C,KAAI,CAAC,SAAU,QAAO;EAAE;EAAM,QAAQ;EAAW;CAEjD,IAAI,UAAU;AACd,QAAO,MAAM,UAAU,EACrB,4BAA4B,MAAM;AAChC,MAAI,QAAS,QAAO;EACpB,MAAM,aAAa,KAAK,KAAK;AAC7B,MAAI,YAAY,SAAS,gBAAgB,WAAW,SAAS,YAAY;AACvE,QAAK,QAAQ,qBAAqB,0BAA0B,KAAK,KAAK,CAAC;AACvE,aAAU;AACV,UAAO;;AAET,OAAK,SAAS,KAAK;IAEtB,CAAC;AAEF,KAAI,CAAC,QAAS,QAAO;EAAE;EAAM,QAAQ;EAAW;AAEhD,mBAAkB,KAAK,0BAA0B,gBAAgB;AACjE,mBAAkB,KAAK,aAAa,uBAAuB;AAC3D,kBAAiB,KAAK,wBAAwB,gBAAgB;AAC9D,qBAAoB,SAAS;AAC7B,aAAY,IAAI;AAEhB,QAAO;EAAE,MAAM,OAAO,MAAM,IAAI,CAAC;EAAM,QAAQ;EAAW;;;AAI5D,MAAM,uBACJ,aACwE;AACxE,KACE,SAAS,SAAS,6BAClB,SAAS,KAAK,SAAS,iBAOvB,SAJE,SAAS,KAAK,SAAS,gBACvB,SAAS,KAAK,SAAS,gBACnB,SAAS,OACT,QACQ;EAAE,MAAM;EAAS,MAAM;EAAU,GAAG;AAGpD,KAAI,SAAS,KAAK,SAAS,iBAAkB,QAAO;CAKpD,MAAM,aAAoB,EAAE;CAC5B,IAAI,gBAAgB;AACpB,QAAO,MAAM,UAAU;EACrB,cAAc,MAAM;AAClB;AACA,OAAI,kBAAkB,EACpB,MAAK,SAAS,KAAK;AAErB;AACA,UAAO;;EAET,qBAAqB,MAAM;GACzB,MAAM,WAAW,KAAK,KAAK;AAC3B,OAAI,UAAU,SAAS,gBAAgB,UAAU,SAAS,cACxD,YAAW,KAAK,KAAK,KAAK;AAE5B,QAAK,SAAS,KAAK;;EAEtB,CAAC;AAEF,KAAI,WAAW,WAAW,EAAG,QAAO;AACpC,QAAO;EAAE,MAAM;EAAU,MAAM,WAAW;EAAI;;;;;;;;AAShD,MAAa,wBAAwB,SAAkC;CACrE,MAAM,MAAM,SAAS,KAAK;AAE1B,KAAI,kBAAkB,IAAI,CAAE,QAAO;EAAE;EAAM,QAAQ;EAAkB;AACrE,KAAI,KAAK,SAAS,yBAAyB,CACzC,QAAO;EAAE;EAAM,QAAQ;EAAW;CAEpC,MAAM,WAAW,0BAA0B,IAAI;AAC/C,KAAI,CAAC,SAAU,QAAO;EAAE;EAAM,QAAQ;EAAW;CAEjD,MAAM,YAAY,oBAAoB,SAAS;AAC/C,KAAI,CAAC,UAAW,QAAO;EAAE;EAAM,QAAQ;EAAW;AAElD,KAAI,UAAU,SAAS,SACrB,WAAU,KAAK,WAAW,qBACxB,0BACA,UAAU,KAAK,SAChB;KAED,WAAU,KAAK,OAAO,qBACpB,0BACA,UAAU,KAAK,KAChB;AAGH,mBAAkB,KAAK,0BAA0B,uBAAuB;AACxE,mBAAkB,KAAK,aAAa,uBAAuB;AAC3D,qBAAoB,SAAS;AAE7B,QAAO;EAAE,MAAM,OAAO,MAAM,IAAI,CAAC;EAAM,QAAQ;EAAW"}
@@ -0,0 +1,28 @@
1
+ import { exists } from "../../utils/fileSystem.mjs";
2
+ import { join } from "node:path";
3
+
4
+ //#region src/init/frameworkSetup/tanstackStart/detect.ts
5
+ /**
6
+ * Detects the TanStack Router routes directory, preferring `src/routes` over
7
+ * `routes`. Returns `null` when neither exists.
8
+ */
9
+ const detectTanStackRoutesDir = async (rootDir) => {
10
+ if (await exists(rootDir, join("src", "routes"))) return {
11
+ routesDir: join("src", "routes"),
12
+ srcDir: "src"
13
+ };
14
+ if (await exists(rootDir, "routes")) return {
15
+ routesDir: "routes",
16
+ srcDir: ""
17
+ };
18
+ return null;
19
+ };
20
+ /**
21
+ * Returns true when the project depends on TanStack Start (`@tanstack/react-start`)
22
+ * or, failing that, on `@tanstack/react-router` (file-based routing).
23
+ */
24
+ const hasTanStackStartDeps = (allDeps) => Boolean(allDeps["@tanstack/react-start"] || allDeps["@tanstack/react-router"]);
25
+
26
+ //#endregion
27
+ export { detectTanStackRoutesDir, hasTanStackStartDeps };
28
+ //# sourceMappingURL=detect.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/tanstackStart/detect.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { exists } from '../../utils/fileSystem';\n\n/** Location of the TanStack Router file-based routes directory. */\nexport type TanStackRoutesInfo = {\n /** Routes directory relative to the root, e.g. `src/routes` or `routes`. */\n routesDir: string;\n /** `src` when the project uses a `src/` directory, otherwise `''`. */\n srcDir: string;\n};\n\n/**\n * Detects the TanStack Router routes directory, preferring `src/routes` over\n * `routes`. Returns `null` when neither exists.\n */\nexport const detectTanStackRoutesDir = async (\n rootDir: string\n): Promise<TanStackRoutesInfo | null> => {\n if (await exists(rootDir, join('src', 'routes'))) {\n return { routesDir: join('src', 'routes'), srcDir: 'src' };\n }\n if (await exists(rootDir, 'routes')) {\n return { routesDir: 'routes', srcDir: '' };\n }\n return null;\n};\n\n/**\n * Returns true when the project depends on TanStack Start (`@tanstack/react-start`)\n * or, failing that, on `@tanstack/react-router` (file-based routing).\n */\nexport const hasTanStackStartDeps = (\n allDeps: Record<string, string>\n): boolean =>\n Boolean(\n allDeps['@tanstack/react-start'] || allDeps['@tanstack/react-router']\n );\n"],"mappings":";;;;;;;;AAeA,MAAa,0BAA0B,OACrC,YACuC;AACvC,KAAI,MAAM,OAAO,SAAS,KAAK,OAAO,SAAS,CAAC,CAC9C,QAAO;EAAE,WAAW,KAAK,OAAO,SAAS;EAAE,QAAQ;EAAO;AAE5D,KAAI,MAAM,OAAO,SAAS,SAAS,CACjC,QAAO;EAAE,WAAW;EAAU,QAAQ;EAAI;AAE5C,QAAO;;;;;;AAOT,MAAa,wBACX,YAEA,QACE,QAAQ,4BAA4B,QAAQ,0BAC7C"}
@@ -0,0 +1,73 @@
1
+ import { ensureDirectory, exists, readFileFromRoot, writeFileToRoot } from "../../utils/fileSystem.mjs";
2
+ import { findAppFile } from "../nextAppRouter/detect.mjs";
3
+ import { detectTanStackRoutesDir, hasTanStackStartDeps } from "./detect.mjs";
4
+ import { getLocaleSegment, restructureRoutesIntoLocale } from "./restructure.mjs";
5
+ import { ROOT_TEMPLATE_JS, ROOT_TEMPLATE_TS, buildLocaleRouteTemplate } from "./templates.mjs";
6
+ import { wrapRootWithProvider } from "./transforms.mjs";
7
+ import { join } from "node:path";
8
+ import { colorize, colorizePath, logger, v, x } from "@intlayer/config/logger";
9
+ import * as ANSIColors from "@intlayer/config/colors";
10
+
11
+ //#region src/init/frameworkSetup/tanstackStart/index.ts
12
+ /** Logs the outcome of the root-document provider-wrap transform. */
13
+ const logTransformOutcome = (filePath, result) => {
14
+ switch (result.status) {
15
+ case "wrapped":
16
+ logger(`${v} Added Intlayer provider to ${colorizePath(filePath)}`);
17
+ break;
18
+ case "already":
19
+ logger(`${v} ${colorizePath(filePath)} already wraps the Intlayer provider`);
20
+ break;
21
+ case "skipped":
22
+ logger(`${x} Could not safely add the Intlayer provider to ${colorizePath(filePath)} — please wrap the document's {children} with <IntlayerProvider locale={locale}> manually.`, { level: "warn" });
23
+ break;
24
+ }
25
+ };
26
+ /** Transforms an existing file in place, writing it back only when changed. */
27
+ const transformExistingFile = async (rootDir, filePath, transform) => {
28
+ const result = transform(await readFileFromRoot(rootDir, filePath));
29
+ if (result.status === "wrapped") await writeFileToRoot(rootDir, filePath, result.code);
30
+ logTransformOutcome(filePath, result);
31
+ };
32
+ /** Creates a file from a template only when it does not already exist. */
33
+ const createIfMissing = async (rootDir, filePath, content, description) => {
34
+ if (await exists(rootDir, filePath)) return false;
35
+ await writeFileToRoot(rootDir, filePath, content);
36
+ logger(`${v} Created ${description} ${colorizePath(filePath)}`);
37
+ return true;
38
+ };
39
+ /**
40
+ * TanStack Start adapter. Restructures the file-based routes under a `{-$locale}`
41
+ * segment, scaffolds the locale segment route, and wraps the root document with
42
+ * the Intlayer provider — all idempotently and without overwriting user code it
43
+ * cannot confidently transform.
44
+ */
45
+ const tanStackStartAdapter = {
46
+ name: "TanStack Start",
47
+ detect: async ({ rootDir, allDeps }) => {
48
+ if (!hasTanStackStartDeps(allDeps)) return false;
49
+ return await detectTanStackRoutesDir(rootDir) !== null;
50
+ },
51
+ setup: async ({ rootDir, useTypeScript, routingMode }) => {
52
+ const routesInfo = await detectTanStackRoutesDir(rootDir);
53
+ if (!routesInfo) return;
54
+ const { routesDir } = routesInfo;
55
+ const scriptExtension = useTypeScript ? "tsx" : "jsx";
56
+ const targetLocaleSegment = getLocaleSegment(routingMode);
57
+ logger(colorize("Setting up TanStack Start integration...", ANSIColors.CYAN));
58
+ const restructureResult = await restructureRoutesIntoLocale(rootDir, routesDir, targetLocaleSegment);
59
+ if (restructureResult.status === "moved") logger(`${v} Restructured routes under ${colorizePath(join(routesDir, targetLocaleSegment))}: ${restructureResult.movedEntries.map((entry) => colorize(entry, ANSIColors.MAGENTA)).join(", ")}`);
60
+ else if (restructureResult.status === "already-structured") logger(`${v} ${colorizePath(join(routesDir, restructureResult.localeSegment))} already exists, skipping restructure`);
61
+ const activeLocaleSegment = restructureResult.status === "already-structured" ? restructureResult.localeSegment : targetLocaleSegment;
62
+ const localeDir = join(routesDir, activeLocaleSegment);
63
+ await ensureDirectory(rootDir, localeDir);
64
+ await createIfMissing(rootDir, join(localeDir, `route.${scriptExtension}`), buildLocaleRouteTemplate(activeLocaleSegment), "locale route");
65
+ const existingRoot = await findAppFile(rootDir, routesDir, "__root");
66
+ if (existingRoot) await transformExistingFile(rootDir, existingRoot, wrapRootWithProvider);
67
+ else await createIfMissing(rootDir, join(routesDir, `__root.${scriptExtension}`), useTypeScript ? ROOT_TEMPLATE_TS : ROOT_TEMPLATE_JS, "root document");
68
+ }
69
+ };
70
+
71
+ //#endregion
72
+ export { tanStackStartAdapter };
73
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/tanstackStart/index.ts"],"sourcesContent":["import { join } from 'node:path';\nimport * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport {\n ensureDirectory,\n exists,\n readFileFromRoot,\n writeFileToRoot,\n} from '../../utils/fileSystem';\nimport { findAppFile } from '../nextAppRouter/detect';\nimport type { FrameworkAdapter, FrameworkSetupContext } from '../types';\nimport { detectTanStackRoutesDir, hasTanStackStartDeps } from './detect';\nimport { getLocaleSegment, restructureRoutesIntoLocale } from './restructure';\nimport {\n buildLocaleRouteTemplate,\n ROOT_TEMPLATE_JS,\n ROOT_TEMPLATE_TS,\n} from './templates';\nimport { type TransformResult, wrapRootWithProvider } from './transforms';\n\n/** Logs the outcome of the root-document provider-wrap transform. */\nconst logTransformOutcome = (\n filePath: string,\n result: TransformResult\n): void => {\n switch (result.status) {\n case 'wrapped':\n logger(`${v} Added Intlayer provider to ${colorizePath(filePath)}`);\n break;\n case 'already':\n logger(\n `${v} ${colorizePath(filePath)} already wraps the Intlayer provider`\n );\n break;\n case 'skipped':\n logger(\n `${x} Could not safely add the Intlayer provider to ${colorizePath(filePath)} — please wrap the document's {children} with <IntlayerProvider locale={locale}> manually.`,\n { level: 'warn' }\n );\n break;\n }\n};\n\n/** Transforms an existing file in place, writing it back only when changed. */\nconst transformExistingFile = async (\n rootDir: string,\n filePath: string,\n transform: (code: string) => TransformResult\n): Promise<void> => {\n const code = await readFileFromRoot(rootDir, filePath);\n const result = transform(code);\n if (result.status === 'wrapped') {\n await writeFileToRoot(rootDir, filePath, result.code);\n }\n logTransformOutcome(filePath, result);\n};\n\n/** Creates a file from a template only when it does not already exist. */\nconst createIfMissing = async (\n rootDir: string,\n filePath: string,\n content: string,\n description: string\n): Promise<boolean> => {\n if (await exists(rootDir, filePath)) return false;\n await writeFileToRoot(rootDir, filePath, content);\n logger(`${v} Created ${description} ${colorizePath(filePath)}`);\n return true;\n};\n\n/**\n * TanStack Start adapter. Restructures the file-based routes under a `{-$locale}`\n * segment, scaffolds the locale segment route, and wraps the root document with\n * the Intlayer provider — all idempotently and without overwriting user code it\n * cannot confidently transform.\n */\nexport const tanStackStartAdapter: FrameworkAdapter = {\n name: 'TanStack Start',\n\n detect: async ({ rootDir, allDeps }) => {\n if (!hasTanStackStartDeps(allDeps)) return false;\n return (await detectTanStackRoutesDir(rootDir)) !== null;\n },\n\n setup: async ({\n rootDir,\n useTypeScript,\n routingMode,\n }: FrameworkSetupContext) => {\n const routesInfo = await detectTanStackRoutesDir(rootDir);\n if (!routesInfo) return;\n\n const { routesDir } = routesInfo;\n const scriptExtension = useTypeScript ? 'tsx' : 'jsx';\n\n // `prefix-all` needs the required `$locale` segment; every other mode uses\n // the optional `{-$locale}` segment so the default locale stays prefix-free.\n const targetLocaleSegment = getLocaleSegment(routingMode);\n\n logger(\n colorize('Setting up TanStack Start integration...', ANSIColors.CYAN)\n );\n\n // 1. Move routable route entries under the locale segment (idempotent).\n const restructureResult = await restructureRoutesIntoLocale(\n rootDir,\n routesDir,\n targetLocaleSegment\n );\n if (restructureResult.status === 'moved') {\n logger(\n `${v} Restructured routes under ${colorizePath(join(routesDir, targetLocaleSegment))}: ${restructureResult.movedEntries\n .map((entry) => colorize(entry, ANSIColors.MAGENTA))\n .join(', ')}`\n );\n } else if (restructureResult.status === 'already-structured') {\n logger(\n `${v} ${colorizePath(join(routesDir, restructureResult.localeSegment))} already exists, skipping restructure`\n );\n }\n\n // Scaffold the locale route for the segment actually in use: a pre-existing\n // segment (e.g. a prefix-all `$locale` the user already set up) wins over the\n // target, so we never create a second, conflicting locale segment.\n const activeLocaleSegment =\n restructureResult.status === 'already-structured'\n ? restructureResult.localeSegment\n : targetLocaleSegment;\n\n const localeDir = join(routesDir, activeLocaleSegment);\n await ensureDirectory(rootDir, localeDir);\n\n // 2. Locale segment route (`<segment>/route.tsx`) — create when absent.\n await createIfMissing(\n rootDir,\n join(localeDir, `route.${scriptExtension}`),\n buildLocaleRouteTemplate(activeLocaleSegment),\n 'locale route'\n );\n\n // 3. Root document — transform an existing `__root`, else scaffold one.\n const existingRoot = await findAppFile(rootDir, routesDir, '__root');\n if (existingRoot) {\n await transformExistingFile(rootDir, existingRoot, wrapRootWithProvider);\n } else {\n await createIfMissing(\n rootDir,\n join(routesDir, `__root.${scriptExtension}`),\n useTypeScript ? ROOT_TEMPLATE_TS : ROOT_TEMPLATE_JS,\n 'root document'\n );\n }\n },\n};\n"],"mappings":";;;;;;;;;;;;AAqBA,MAAM,uBACJ,UACA,WACS;AACT,SAAQ,OAAO,QAAf;EACE,KAAK;AACH,UAAO,GAAG,EAAE,8BAA8B,aAAa,SAAS,GAAG;AACnE;EACF,KAAK;AACH,UACE,GAAG,EAAE,GAAG,aAAa,SAAS,CAAC,sCAChC;AACD;EACF,KAAK;AACH,UACE,GAAG,EAAE,iDAAiD,aAAa,SAAS,CAAC,6FAC7E,EAAE,OAAO,QAAQ,CAClB;AACD;;;;AAKN,MAAM,wBAAwB,OAC5B,SACA,UACA,cACkB;CAElB,MAAM,SAAS,UAAU,MADN,iBAAiB,SAAS,SAAS,CACxB;AAC9B,KAAI,OAAO,WAAW,UACpB,OAAM,gBAAgB,SAAS,UAAU,OAAO,KAAK;AAEvD,qBAAoB,UAAU,OAAO;;;AAIvC,MAAM,kBAAkB,OACtB,SACA,UACA,SACA,gBACqB;AACrB,KAAI,MAAM,OAAO,SAAS,SAAS,CAAE,QAAO;AAC5C,OAAM,gBAAgB,SAAS,UAAU,QAAQ;AACjD,QAAO,GAAG,EAAE,WAAW,YAAY,GAAG,aAAa,SAAS,GAAG;AAC/D,QAAO;;;;;;;;AAST,MAAa,uBAAyC;CACpD,MAAM;CAEN,QAAQ,OAAO,EAAE,SAAS,cAAc;AACtC,MAAI,CAAC,qBAAqB,QAAQ,CAAE,QAAO;AAC3C,SAAQ,MAAM,wBAAwB,QAAQ,KAAM;;CAGtD,OAAO,OAAO,EACZ,SACA,eACA,kBAC2B;EAC3B,MAAM,aAAa,MAAM,wBAAwB,QAAQ;AACzD,MAAI,CAAC,WAAY;EAEjB,MAAM,EAAE,cAAc;EACtB,MAAM,kBAAkB,gBAAgB,QAAQ;EAIhD,MAAM,sBAAsB,iBAAiB,YAAY;AAEzD,SACE,SAAS,4CAA4C,WAAW,KAAK,CACtE;EAGD,MAAM,oBAAoB,MAAM,4BAC9B,SACA,WACA,oBACD;AACD,MAAI,kBAAkB,WAAW,QAC/B,QACE,GAAG,EAAE,6BAA6B,aAAa,KAAK,WAAW,oBAAoB,CAAC,CAAC,IAAI,kBAAkB,aACxG,KAAK,UAAU,SAAS,OAAO,WAAW,QAAQ,CAAC,CACnD,KAAK,KAAK,GACd;WACQ,kBAAkB,WAAW,qBACtC,QACE,GAAG,EAAE,GAAG,aAAa,KAAK,WAAW,kBAAkB,cAAc,CAAC,CAAC,uCACxE;EAMH,MAAM,sBACJ,kBAAkB,WAAW,uBACzB,kBAAkB,gBAClB;EAEN,MAAM,YAAY,KAAK,WAAW,oBAAoB;AACtD,QAAM,gBAAgB,SAAS,UAAU;AAGzC,QAAM,gBACJ,SACA,KAAK,WAAW,SAAS,kBAAkB,EAC3C,yBAAyB,oBAAoB,EAC7C,eACD;EAGD,MAAM,eAAe,MAAM,YAAY,SAAS,WAAW,SAAS;AACpE,MAAI,aACF,OAAM,sBAAsB,SAAS,cAAc,qBAAqB;MAExE,OAAM,gBACJ,SACA,KAAK,WAAW,UAAU,kBAAkB,EAC5C,gBAAgB,mBAAmB,kBACnC,gBACD;;CAGN"}
@@ -0,0 +1,108 @@
1
+ import { rewriteRelativeImports } from "../nextAppRouter/restructure.mjs";
2
+ import { mkdir, readFile, readdir, rename, writeFile } from "node:fs/promises";
3
+ import { join, relative } from "node:path";
4
+ import fg from "fast-glob";
5
+
6
+ //#region src/init/frameworkSetup/tanstackStart/restructure.ts
7
+ /** Source file extensions whose relative imports must be rewritten after a move. */
8
+ const SCRIPT_GLOB = "**/*.{ts,tsx,js,jsx,mjs,cjs}";
9
+ /**
10
+ * The optional TanStack Router locale segment directory (`{-$locale}` param),
11
+ * used by every routing mode except `prefix-all` so the default locale stays
12
+ * prefix-free.
13
+ */
14
+ const LOCALE_SEGMENT = "{-$locale}";
15
+ /**
16
+ * The required TanStack Router locale segment directory (`$locale` param), used
17
+ * by `prefix-all` routing where every URL — including the default locale — is
18
+ * prefixed.
19
+ */
20
+ const PREFIX_ALL_LOCALE_SEGMENT = "$locale";
21
+ /**
22
+ * Picks the locale segment directory for the project's routing mode. `prefix-all`
23
+ * requires the mandatory `$locale` param so the default locale is also prefixed;
24
+ * all other modes use the optional `{-$locale}` param so the default locale stays
25
+ * prefix-free.
26
+ */
27
+ const getLocaleSegment = (routingMode) => routingMode === "prefix-all" ? PREFIX_ALL_LOCALE_SEGMENT : LOCALE_SEGMENT;
28
+ /**
29
+ * Detects whether a top-level route entry is already a locale segment, in any of
30
+ * the TanStack Router param forms:
31
+ * - `{-$locale}` — optional param (prefix every locale except the default),
32
+ * - `$locale` / `{$locale}` — required param (prefix **all** locales).
33
+ *
34
+ * Used to skip the restructure when the project is already locale-aware, so an
35
+ * existing prefix-all `$locale` directory is never nested under a freshly created
36
+ * `{-$locale}` (which would produce `{-$locale}/$locale`).
37
+ */
38
+ const isLocaleSegment = (entryName) => /^(\{-?\$locale\}|\$locale)$/.test(entryName);
39
+ /** Strips a known script extension from a file name, e.g. `index.tsx` -> `index`. */
40
+ const stripScriptExtension = (fileName) => fileName.replace(/\.(tsx|ts|jsx|js|mjs|cjs)$/, "");
41
+ /**
42
+ * Routes-directory entries that must stay at the root and never be moved under
43
+ * `{-$locale}`:
44
+ * - `__root` (the root route document),
45
+ * - `routeTree.gen` (generated route tree),
46
+ * - `api` (server / API routes — these are not locale-prefixed),
47
+ * - TanStack-ignored entries prefixed with `-` (e.g. `-components`, `-utils`),
48
+ * - stylesheets.
49
+ *
50
+ * Everything else (route files and nested route folders) is moved so it becomes
51
+ * locale-aware.
52
+ */
53
+ const shouldKeepRouteAtRoot = (entryName) => {
54
+ if (entryName.startsWith("-")) return true;
55
+ if (entryName.toLowerCase().endsWith(".css")) return true;
56
+ const base = stripScriptExtension(entryName);
57
+ return new Set([
58
+ "__root",
59
+ "routeTree.gen",
60
+ "api"
61
+ ]).has(base);
62
+ };
63
+ /**
64
+ * Moves the routable entries of `routesDir` under a new `localeSegment` directory
65
+ * (the optional `{-$locale}` by default, or the required `$locale` for
66
+ * `prefix-all`) and rewrites relative imports in the moved files. Idempotent: a
67
+ * no-op when the routes are already locale-aware in any prefix mode (see
68
+ * {@link isLocaleSegment}), which is reported via `localeSegment`. Root-only
69
+ * files (see {@link shouldKeepRouteAtRoot}) are left in place.
70
+ */
71
+ const restructureRoutesIntoLocale = async (rootDir, routesDir, localeSegment = LOCALE_SEGMENT) => {
72
+ const routesDirAbs = join(rootDir, routesDir);
73
+ const localeDirAbs = join(routesDirAbs, localeSegment);
74
+ const entries = await readdir(routesDirAbs, { withFileTypes: true });
75
+ const existingLocaleSegment = entries.find((entry) => isLocaleSegment(entry.name));
76
+ if (existingLocaleSegment) return {
77
+ status: "already-structured",
78
+ localeSegment: existingLocaleSegment.name
79
+ };
80
+ const movedTopLevelNames = entries.map((entry) => entry.name).filter((name) => !shouldKeepRouteAtRoot(name));
81
+ if (movedTopLevelNames.length === 0) return { status: "nothing-to-move" };
82
+ await mkdir(localeDirAbs, { recursive: true });
83
+ for (const name of movedTopLevelNames) await rename(join(routesDirAbs, name), join(localeDirAbs, name));
84
+ const movedFiles = await fg(SCRIPT_GLOB, {
85
+ cwd: localeDirAbs,
86
+ absolute: true,
87
+ onlyFiles: true
88
+ });
89
+ const rewriteContext = {
90
+ appDirAbs: routesDirAbs,
91
+ localeDirAbs,
92
+ movedTopLevelNames
93
+ };
94
+ for (const newAbs of movedFiles) {
95
+ const oldAbs = join(routesDirAbs, relative(localeDirAbs, newAbs));
96
+ const code = await readFile(newAbs, "utf8");
97
+ const rewritten = rewriteRelativeImports(code, oldAbs, newAbs, rewriteContext);
98
+ if (rewritten !== code) await writeFile(newAbs, rewritten, "utf8");
99
+ }
100
+ return {
101
+ status: "moved",
102
+ movedEntries: movedTopLevelNames
103
+ };
104
+ };
105
+
106
+ //#endregion
107
+ export { LOCALE_SEGMENT, PREFIX_ALL_LOCALE_SEGMENT, getLocaleSegment, isLocaleSegment, restructureRoutesIntoLocale, shouldKeepRouteAtRoot };
108
+ //# sourceMappingURL=restructure.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restructure.mjs","names":[],"sources":["../../../../../src/init/frameworkSetup/tanstackStart/restructure.ts"],"sourcesContent":["import { mkdir, readdir, readFile, rename, writeFile } from 'node:fs/promises';\nimport { join, relative } from 'node:path';\nimport fg from 'fast-glob';\nimport type { RoutingMode } from '../../utils/configManipulation';\nimport { rewriteRelativeImports } from '../nextAppRouter/restructure';\n\n/** Source file extensions whose relative imports must be rewritten after a move. */\nconst SCRIPT_GLOB = '**/*.{ts,tsx,js,jsx,mjs,cjs}';\n\n/**\n * The optional TanStack Router locale segment directory (`{-$locale}` param),\n * used by every routing mode except `prefix-all` so the default locale stays\n * prefix-free.\n */\nexport const LOCALE_SEGMENT = '{-$locale}';\n\n/**\n * The required TanStack Router locale segment directory (`$locale` param), used\n * by `prefix-all` routing where every URL — including the default locale — is\n * prefixed.\n */\nexport const PREFIX_ALL_LOCALE_SEGMENT = '$locale';\n\n/**\n * Picks the locale segment directory for the project's routing mode. `prefix-all`\n * requires the mandatory `$locale` param so the default locale is also prefixed;\n * all other modes use the optional `{-$locale}` param so the default locale stays\n * prefix-free.\n */\nexport const getLocaleSegment = (routingMode: RoutingMode): string =>\n routingMode === 'prefix-all' ? PREFIX_ALL_LOCALE_SEGMENT : LOCALE_SEGMENT;\n\n/**\n * Detects whether a top-level route entry is already a locale segment, in any of\n * the TanStack Router param forms:\n * - `{-$locale}` — optional param (prefix every locale except the default),\n * - `$locale` / `{$locale}` — required param (prefix **all** locales).\n *\n * Used to skip the restructure when the project is already locale-aware, so an\n * existing prefix-all `$locale` directory is never nested under a freshly created\n * `{-$locale}` (which would produce `{-$locale}/$locale`).\n */\nexport const isLocaleSegment = (entryName: string): boolean =>\n /^(\\{-?\\$locale\\}|\\$locale)$/.test(entryName);\n\n/** Strips a known script extension from a file name, e.g. `index.tsx` -> `index`. */\nconst stripScriptExtension = (fileName: string): string =>\n fileName.replace(/\\.(tsx|ts|jsx|js|mjs|cjs)$/, '');\n\n/**\n * Routes-directory entries that must stay at the root and never be moved under\n * `{-$locale}`:\n * - `__root` (the root route document),\n * - `routeTree.gen` (generated route tree),\n * - `api` (server / API routes — these are not locale-prefixed),\n * - TanStack-ignored entries prefixed with `-` (e.g. `-components`, `-utils`),\n * - stylesheets.\n *\n * Everything else (route files and nested route folders) is moved so it becomes\n * locale-aware.\n */\nexport const shouldKeepRouteAtRoot = (entryName: string): boolean => {\n if (entryName.startsWith('-')) return true;\n if (entryName.toLowerCase().endsWith('.css')) return true;\n\n const base = stripScriptExtension(entryName);\n const keepExactBases = new Set(['__root', 'routeTree.gen', 'api']);\n return keepExactBases.has(base);\n};\n\n/** Outcome of an attempted `{-$locale}` restructure. */\nexport type RestructureResult =\n | { status: 'already-structured'; localeSegment: string }\n | { status: 'nothing-to-move' }\n | { status: 'moved'; movedEntries: string[] };\n\n/**\n * Moves the routable entries of `routesDir` under a new `localeSegment` directory\n * (the optional `{-$locale}` by default, or the required `$locale` for\n * `prefix-all`) and rewrites relative imports in the moved files. Idempotent: a\n * no-op when the routes are already locale-aware in any prefix mode (see\n * {@link isLocaleSegment}), which is reported via `localeSegment`. Root-only\n * files (see {@link shouldKeepRouteAtRoot}) are left in place.\n */\nexport const restructureRoutesIntoLocale = async (\n rootDir: string,\n routesDir: string,\n localeSegment: string = LOCALE_SEGMENT\n): Promise<RestructureResult> => {\n const routesDirAbs = join(rootDir, routesDir);\n const localeDirAbs = join(routesDirAbs, localeSegment);\n\n const entries = await readdir(routesDirAbs, { withFileTypes: true });\n\n // Skip when the routes are already locale-aware in any prefix mode — a fresh\n // `{-$locale}`, or an existing `$locale` / `{$locale}` (prefix-all) segment.\n const existingLocaleSegment = entries.find((entry) =>\n isLocaleSegment(entry.name)\n );\n if (existingLocaleSegment) {\n return {\n status: 'already-structured',\n localeSegment: existingLocaleSegment.name,\n };\n }\n\n const movedTopLevelNames = entries\n .map((entry) => entry.name)\n .filter((name) => !shouldKeepRouteAtRoot(name));\n\n if (movedTopLevelNames.length === 0) {\n return { status: 'nothing-to-move' };\n }\n\n await mkdir(localeDirAbs, { recursive: true });\n\n for (const name of movedTopLevelNames) {\n await rename(join(routesDirAbs, name), join(localeDirAbs, name));\n }\n\n const movedFiles = await fg(SCRIPT_GLOB, {\n cwd: localeDirAbs,\n absolute: true,\n onlyFiles: true,\n });\n\n const rewriteContext = {\n appDirAbs: routesDirAbs,\n localeDirAbs,\n movedTopLevelNames,\n };\n\n for (const newAbs of movedFiles) {\n const relFromLocale = relative(localeDirAbs, newAbs);\n const oldAbs = join(routesDirAbs, relFromLocale);\n const code = await readFile(newAbs, 'utf8');\n const rewritten = rewriteRelativeImports(\n code,\n oldAbs,\n newAbs,\n rewriteContext\n );\n if (rewritten !== code) {\n await writeFile(newAbs, rewritten, 'utf8');\n }\n }\n\n return { status: 'moved', movedEntries: movedTopLevelNames };\n};\n"],"mappings":";;;;;;;AAOA,MAAM,cAAc;;;;;;AAOpB,MAAa,iBAAiB;;;;;;AAO9B,MAAa,4BAA4B;;;;;;;AAQzC,MAAa,oBAAoB,gBAC/B,gBAAgB,eAAe,4BAA4B;;;;;;;;;;;AAY7D,MAAa,mBAAmB,cAC9B,8BAA8B,KAAK,UAAU;;AAG/C,MAAM,wBAAwB,aAC5B,SAAS,QAAQ,8BAA8B,GAAG;;;;;;;;;;;;;AAcpD,MAAa,yBAAyB,cAA+B;AACnE,KAAI,UAAU,WAAW,IAAI,CAAE,QAAO;AACtC,KAAI,UAAU,aAAa,CAAC,SAAS,OAAO,CAAE,QAAO;CAErD,MAAM,OAAO,qBAAqB,UAAU;AAE5C,QAAO,IADoB,IAAI;EAAC;EAAU;EAAiB;EAAM,CAC5C,CAAC,IAAI,KAAK;;;;;;;;;;AAiBjC,MAAa,8BAA8B,OACzC,SACA,WACA,gBAAwB,mBACO;CAC/B,MAAM,eAAe,KAAK,SAAS,UAAU;CAC7C,MAAM,eAAe,KAAK,cAAc,cAAc;CAEtD,MAAM,UAAU,MAAM,QAAQ,cAAc,EAAE,eAAe,MAAM,CAAC;CAIpE,MAAM,wBAAwB,QAAQ,MAAM,UAC1C,gBAAgB,MAAM,KAAK,CAC5B;AACD,KAAI,sBACF,QAAO;EACL,QAAQ;EACR,eAAe,sBAAsB;EACtC;CAGH,MAAM,qBAAqB,QACxB,KAAK,UAAU,MAAM,KAAK,CAC1B,QAAQ,SAAS,CAAC,sBAAsB,KAAK,CAAC;AAEjD,KAAI,mBAAmB,WAAW,EAChC,QAAO,EAAE,QAAQ,mBAAmB;AAGtC,OAAM,MAAM,cAAc,EAAE,WAAW,MAAM,CAAC;AAE9C,MAAK,MAAM,QAAQ,mBACjB,OAAM,OAAO,KAAK,cAAc,KAAK,EAAE,KAAK,cAAc,KAAK,CAAC;CAGlE,MAAM,aAAa,MAAM,GAAG,aAAa;EACvC,KAAK;EACL,UAAU;EACV,WAAW;EACZ,CAAC;CAEF,MAAM,iBAAiB;EACrB,WAAW;EACX;EACA;EACD;AAED,MAAK,MAAM,UAAU,YAAY;EAE/B,MAAM,SAAS,KAAK,cADE,SAAS,cAAc,OACE,CAAC;EAChD,MAAM,OAAO,MAAM,SAAS,QAAQ,OAAO;EAC3C,MAAM,YAAY,uBAChB,MACA,QACA,QACA,eACD;AACD,MAAI,cAAc,KAChB,OAAM,UAAU,QAAQ,WAAW,OAAO;;AAI9C,QAAO;EAAE,QAAQ;EAAS,cAAc;EAAoB"}