@intlayer/engine 9.5.9-canary.0 → 9.5.10

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 (248) hide show
  1. package/dist/cjs/_virtual/_utils_asset.cjs +1 -1
  2. package/dist/cjs/build.cjs +4 -4
  3. package/dist/cjs/buildIntlayerDictionary/writeDynamicDictionary.cjs +2 -2
  4. package/dist/cjs/buildIntlayerDictionary/writeFetchDictionary.cjs +3 -3
  5. package/dist/cjs/buildIntlayerDictionary/writeMergedDictionary.cjs +1 -1
  6. package/dist/cjs/buildIntlayerDictionary/writeNestedDictionary.cjs +3 -3
  7. package/dist/cjs/buildIntlayerDictionary/writeRemoteDictionary.cjs +2 -2
  8. package/dist/cjs/buildIntlayerDictionary/writeUnmergedDictionary.cjs +2 -2
  9. package/dist/cjs/cleanOutputDir.cjs +1 -1
  10. package/dist/cjs/cleanRemovedContentDeclaration.cjs +1 -1
  11. package/dist/cjs/cli.cjs +10 -3
  12. package/dist/cjs/createDictionaryEntryPoint/createDictionaryEntryPoint.cjs +1 -1
  13. package/dist/cjs/createDictionaryEntryPoint/getBuiltDictionariesPath.cjs +2 -2
  14. package/dist/cjs/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.cjs +2 -2
  15. package/dist/cjs/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.cjs +2 -2
  16. package/dist/cjs/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.cjs +2 -2
  17. package/dist/cjs/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.cjs +2 -2
  18. package/dist/cjs/createType/createModuleAugmentation.cjs +3 -3
  19. package/dist/cjs/createType/createType.cjs +1 -1
  20. package/dist/cjs/docReview/index.cjs +5 -5
  21. package/dist/cjs/docReview/pipeline.cjs +4 -4
  22. package/dist/cjs/docReview/reviewReport.cjs.map +1 -1
  23. package/dist/cjs/fetchDistantDictionaries.cjs +1 -1
  24. package/dist/cjs/handleContentDeclarationFileChange.cjs +2 -2
  25. package/dist/cjs/handleUnlinkedContentDeclarationFile.cjs +1 -1
  26. package/dist/cjs/init/cms.cjs +35 -0
  27. package/dist/cjs/init/cms.cjs.map +1 -1
  28. package/dist/cjs/init/documentationRouter.cjs +141 -0
  29. package/dist/cjs/init/documentationRouter.cjs.map +1 -0
  30. package/dist/cjs/init/frameworkSetup/backend/index.cjs +138 -0
  31. package/dist/cjs/init/frameworkSetup/backend/index.cjs.map +1 -0
  32. package/dist/cjs/init/frameworkSetup/backend/transforms.cjs +223 -0
  33. package/dist/cjs/init/frameworkSetup/backend/transforms.cjs.map +1 -0
  34. package/dist/cjs/init/frameworkSetup/index.cjs +9 -3
  35. package/dist/cjs/init/frameworkSetup/index.cjs.map +1 -1
  36. package/dist/cjs/init/frameworkSetup/localeRouting.cjs +13 -0
  37. package/dist/cjs/init/frameworkSetup/localeRouting.cjs.map +1 -0
  38. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs +34 -7
  39. package/dist/cjs/init/frameworkSetup/nextAppRouter/index.cjs.map +1 -1
  40. package/dist/cjs/init/frameworkSetup/nextAppRouter/restructure.cjs +1 -1
  41. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs +56 -0
  42. package/dist/cjs/init/frameworkSetup/nextAppRouter/templates.cjs.map +1 -1
  43. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs +2 -2
  44. package/dist/cjs/init/frameworkSetup/nextAppRouter/transforms.cjs.map +1 -1
  45. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs +32 -3
  46. package/dist/cjs/init/frameworkSetup/tanstackStart/index.cjs.map +1 -1
  47. package/dist/cjs/init/frameworkSetup/tanstackStart/restructure.cjs +1 -1
  48. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs +58 -0
  49. package/dist/cjs/init/frameworkSetup/tanstackStart/templates.cjs.map +1 -1
  50. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs +94 -14
  51. package/dist/cjs/init/frameworkSetup/tanstackStart/transforms.cjs.map +1 -1
  52. package/dist/cjs/init/index.cjs +46 -159
  53. package/dist/cjs/init/index.cjs.map +1 -1
  54. package/dist/cjs/init/utils/configManipulation.cjs +39 -0
  55. package/dist/cjs/init/utils/configManipulation.cjs.map +1 -1
  56. package/dist/cjs/init/utils/fileSystem.cjs +1 -1
  57. package/dist/cjs/init/utils/githubActions.cjs +1 -1
  58. package/dist/cjs/init/utils/index.cjs +10 -0
  59. package/dist/cjs/init/utils/intlayerDependencies.cjs +1 -1
  60. package/dist/cjs/init/utils/lintConfig.cjs +52 -0
  61. package/dist/cjs/init/utils/lintConfig.cjs.map +1 -0
  62. package/dist/cjs/init/utils/packageManager.cjs +63 -14
  63. package/dist/cjs/init/utils/packageManager.cjs.map +1 -1
  64. package/dist/cjs/init/utils/urlRoutingFramework.cjs +41 -0
  65. package/dist/cjs/init/utils/urlRoutingFramework.cjs.map +1 -0
  66. package/dist/cjs/initConfig/index.cjs +5 -2
  67. package/dist/cjs/initConfig/index.cjs.map +1 -1
  68. package/dist/cjs/installLSP.cjs +1 -1
  69. package/dist/cjs/installMCP/installMCP.cjs +1 -1
  70. package/dist/cjs/installSkills/index.cjs +1 -1
  71. package/dist/cjs/listDictionariesPath.cjs +1 -1
  72. package/dist/cjs/listGitFiles.cjs +1 -1
  73. package/dist/cjs/loadDictionaries/getIntlayerBundle.cjs +2 -2
  74. package/dist/cjs/loadDictionaries/index.cjs +1 -1
  75. package/dist/cjs/loadDictionaries/loadContentDeclaration.cjs +2 -2
  76. package/dist/cjs/loadDictionaries/loadDictionaries.cjs +1 -1
  77. package/dist/cjs/loadDictionaries/loadLocalDictionaries.cjs +1 -1
  78. package/dist/cjs/loadDictionaries/loadMarkdownContentDeclaration.cjs +1 -1
  79. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs +104 -43
  80. package/dist/cjs/loadDictionaries/logTypeScriptErrors.cjs.map +1 -1
  81. package/dist/cjs/logConfigDetails.cjs +1 -1
  82. package/dist/cjs/prepareIntlayer.cjs +4 -4
  83. package/dist/cjs/scan/index.cjs +1 -1
  84. package/dist/cjs/scan/scanWebsite.cjs +1 -1
  85. package/dist/cjs/syncPluginKit/createFileAdapter.cjs +1 -1
  86. package/dist/cjs/syncPluginKit/index.cjs +1 -1
  87. package/dist/cjs/utils/buildComponentFilesList.cjs +1 -1
  88. package/dist/cjs/utils/contentWatcherLock.cjs +2 -2
  89. package/dist/cjs/utils/index.cjs +4 -4
  90. package/dist/cjs/utils/readDictionariesFromDisk.cjs +1 -1
  91. package/dist/cjs/utils/runOnce.cjs +1 -1
  92. package/dist/cjs/utils/runParallel/pidTree.cjs +1 -1
  93. package/dist/cjs/utils/withFileLock.cjs +1 -1
  94. package/dist/cjs/watcher.cjs +6 -6
  95. package/dist/cjs/writeConfiguration/index.cjs +1 -1
  96. package/dist/cjs/writeContentDeclaration/processContentDeclarationContent.cjs +2 -2
  97. package/dist/cjs/writeContentDeclaration/transformJSFile.cjs +1 -1
  98. package/dist/cjs/writeContentDeclaration/writeContentDeclaration.cjs +4 -4
  99. package/dist/cjs/writeContentDeclaration/writeJSFile.cjs +3 -3
  100. package/dist/cjs/writeContentDeclaration/writeMarkdownFile.cjs +1 -1
  101. package/dist/cjs/writeContentDeclaration/writeYamlFile.cjs +1 -1
  102. package/dist/cjs/writeFileIfChanged.cjs +1 -1
  103. package/dist/esm/_virtual/_utils_asset.mjs +1 -1
  104. package/dist/esm/build.mjs +4 -4
  105. package/dist/esm/buildIntlayerDictionary/writeDynamicDictionary.mjs +2 -2
  106. package/dist/esm/buildIntlayerDictionary/writeFetchDictionary.mjs +3 -3
  107. package/dist/esm/buildIntlayerDictionary/writeMergedDictionary.mjs +1 -1
  108. package/dist/esm/buildIntlayerDictionary/writeNestedDictionary.mjs +3 -3
  109. package/dist/esm/buildIntlayerDictionary/writeRemoteDictionary.mjs +2 -2
  110. package/dist/esm/buildIntlayerDictionary/writeUnmergedDictionary.mjs +2 -2
  111. package/dist/esm/cleanOutputDir.mjs +1 -1
  112. package/dist/esm/cleanRemovedContentDeclaration.mjs +1 -1
  113. package/dist/esm/cli.mjs +8 -6
  114. package/dist/esm/createDictionaryEntryPoint/createDictionaryEntryPoint.mjs +1 -1
  115. package/dist/esm/createDictionaryEntryPoint/getBuiltDictionariesPath.mjs +2 -2
  116. package/dist/esm/createDictionaryEntryPoint/getBuiltDynamicDictionariesPath.mjs +2 -2
  117. package/dist/esm/createDictionaryEntryPoint/getBuiltFetchDictionariesPath.mjs +2 -2
  118. package/dist/esm/createDictionaryEntryPoint/getBuiltRemoteDictionariesPath.mjs +2 -2
  119. package/dist/esm/createDictionaryEntryPoint/getBuiltUnmergedDictionariesPath.mjs +2 -2
  120. package/dist/esm/createType/createModuleAugmentation.mjs +3 -3
  121. package/dist/esm/createType/createType.mjs +1 -1
  122. package/dist/esm/docReview/index.mjs +5 -5
  123. package/dist/esm/docReview/pipeline.mjs +4 -4
  124. package/dist/esm/docReview/reviewReport.mjs.map +1 -1
  125. package/dist/esm/fetchDistantDictionaries.mjs +1 -1
  126. package/dist/esm/handleContentDeclarationFileChange.mjs +2 -2
  127. package/dist/esm/handleUnlinkedContentDeclarationFile.mjs +1 -1
  128. package/dist/esm/init/cms.mjs +35 -2
  129. package/dist/esm/init/cms.mjs.map +1 -1
  130. package/dist/esm/init/documentationRouter.mjs +139 -0
  131. package/dist/esm/init/documentationRouter.mjs.map +1 -0
  132. package/dist/esm/init/frameworkSetup/backend/index.mjs +130 -0
  133. package/dist/esm/init/frameworkSetup/backend/index.mjs.map +1 -0
  134. package/dist/esm/init/frameworkSetup/backend/transforms.mjs +216 -0
  135. package/dist/esm/init/frameworkSetup/backend/transforms.mjs.map +1 -0
  136. package/dist/esm/init/frameworkSetup/index.mjs +9 -3
  137. package/dist/esm/init/frameworkSetup/index.mjs.map +1 -1
  138. package/dist/esm/init/frameworkSetup/localeRouting.mjs +12 -0
  139. package/dist/esm/init/frameworkSetup/localeRouting.mjs.map +1 -0
  140. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs +36 -9
  141. package/dist/esm/init/frameworkSetup/nextAppRouter/index.mjs.map +1 -1
  142. package/dist/esm/init/frameworkSetup/nextAppRouter/restructure.mjs +1 -1
  143. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs +54 -1
  144. package/dist/esm/init/frameworkSetup/nextAppRouter/templates.mjs.map +1 -1
  145. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs +2 -2
  146. package/dist/esm/init/frameworkSetup/nextAppRouter/transforms.mjs.map +1 -1
  147. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs +35 -6
  148. package/dist/esm/init/frameworkSetup/tanstackStart/index.mjs.map +1 -1
  149. package/dist/esm/init/frameworkSetup/tanstackStart/restructure.mjs +1 -1
  150. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs +56 -1
  151. package/dist/esm/init/frameworkSetup/tanstackStart/templates.mjs.map +1 -1
  152. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs +94 -15
  153. package/dist/esm/init/frameworkSetup/tanstackStart/transforms.mjs.map +1 -1
  154. package/dist/esm/init/index.mjs +42 -158
  155. package/dist/esm/init/index.mjs.map +1 -1
  156. package/dist/esm/init/utils/configManipulation.mjs +38 -1
  157. package/dist/esm/init/utils/configManipulation.mjs.map +1 -1
  158. package/dist/esm/init/utils/fileSystem.mjs +1 -1
  159. package/dist/esm/init/utils/githubActions.mjs +1 -1
  160. package/dist/esm/init/utils/index.mjs +5 -3
  161. package/dist/esm/init/utils/intlayerDependencies.mjs +1 -1
  162. package/dist/esm/init/utils/lintConfig.mjs +50 -0
  163. package/dist/esm/init/utils/lintConfig.mjs.map +1 -0
  164. package/dist/esm/init/utils/packageManager.mjs +61 -15
  165. package/dist/esm/init/utils/packageManager.mjs.map +1 -1
  166. package/dist/esm/init/utils/urlRoutingFramework.mjs +40 -0
  167. package/dist/esm/init/utils/urlRoutingFramework.mjs.map +1 -0
  168. package/dist/esm/initConfig/index.mjs +5 -2
  169. package/dist/esm/initConfig/index.mjs.map +1 -1
  170. package/dist/esm/installLSP.mjs +1 -1
  171. package/dist/esm/installMCP/installMCP.mjs +1 -1
  172. package/dist/esm/installSkills/index.mjs +1 -1
  173. package/dist/esm/listDictionariesPath.mjs +1 -1
  174. package/dist/esm/listGitFiles.mjs +1 -1
  175. package/dist/esm/loadDictionaries/getIntlayerBundle.mjs +2 -2
  176. package/dist/esm/loadDictionaries/index.mjs +1 -1
  177. package/dist/esm/loadDictionaries/loadContentDeclaration.mjs +2 -2
  178. package/dist/esm/loadDictionaries/loadDictionaries.mjs +1 -1
  179. package/dist/esm/loadDictionaries/loadLocalDictionaries.mjs +1 -1
  180. package/dist/esm/loadDictionaries/loadMarkdownContentDeclaration.mjs +1 -1
  181. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs +105 -44
  182. package/dist/esm/loadDictionaries/logTypeScriptErrors.mjs.map +1 -1
  183. package/dist/esm/logConfigDetails.mjs +1 -1
  184. package/dist/esm/prepareIntlayer.mjs +4 -4
  185. package/dist/esm/scan/index.mjs +1 -1
  186. package/dist/esm/scan/scanWebsite.mjs +1 -1
  187. package/dist/esm/syncPluginKit/createFileAdapter.mjs +1 -1
  188. package/dist/esm/syncPluginKit/index.mjs +1 -1
  189. package/dist/esm/utils/buildComponentFilesList.mjs +1 -1
  190. package/dist/esm/utils/contentWatcherLock.mjs +2 -2
  191. package/dist/esm/utils/index.mjs +4 -4
  192. package/dist/esm/utils/readDictionariesFromDisk.mjs +1 -1
  193. package/dist/esm/utils/runOnce.mjs +1 -1
  194. package/dist/esm/utils/runParallel/pidTree.mjs +1 -1
  195. package/dist/esm/utils/withFileLock.mjs +1 -1
  196. package/dist/esm/watcher.mjs +6 -6
  197. package/dist/esm/writeConfiguration/index.mjs +1 -1
  198. package/dist/esm/writeContentDeclaration/processContentDeclarationContent.mjs +2 -2
  199. package/dist/esm/writeContentDeclaration/transformJSFile.mjs +1 -1
  200. package/dist/esm/writeContentDeclaration/writeContentDeclaration.mjs +4 -4
  201. package/dist/esm/writeContentDeclaration/writeJSFile.mjs +3 -3
  202. package/dist/esm/writeContentDeclaration/writeMarkdownFile.mjs +1 -1
  203. package/dist/esm/writeContentDeclaration/writeYamlFile.mjs +1 -1
  204. package/dist/esm/writeFileIfChanged.mjs +1 -1
  205. package/dist/types/cli.d.ts +5 -3
  206. package/dist/types/docReview/reviewReport.d.ts.map +1 -1
  207. package/dist/types/formatDictionary.d.ts +2 -2
  208. package/dist/types/init/cms.d.ts +11 -0
  209. package/dist/types/init/cms.d.ts.map +1 -1
  210. package/dist/types/init/documentationRouter.d.ts +64 -0
  211. package/dist/types/init/documentationRouter.d.ts.map +1 -0
  212. package/dist/types/init/frameworkSetup/backend/index.d.ts +16 -0
  213. package/dist/types/init/frameworkSetup/backend/index.d.ts.map +1 -0
  214. package/dist/types/init/frameworkSetup/backend/transforms.d.ts +37 -0
  215. package/dist/types/init/frameworkSetup/backend/transforms.d.ts.map +1 -0
  216. package/dist/types/init/frameworkSetup/index.d.ts.map +1 -1
  217. package/dist/types/init/frameworkSetup/localeRouting.d.ts +11 -0
  218. package/dist/types/init/frameworkSetup/localeRouting.d.ts.map +1 -0
  219. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts +5 -5
  220. package/dist/types/init/frameworkSetup/nextAppRouter/index.d.ts.map +1 -1
  221. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts +12 -0
  222. package/dist/types/init/frameworkSetup/nextAppRouter/templates.d.ts.map +1 -1
  223. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts +10 -1
  224. package/dist/types/init/frameworkSetup/nextAppRouter/transforms.d.ts.map +1 -1
  225. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts +3 -2
  226. package/dist/types/init/frameworkSetup/tanstackStart/index.d.ts.map +1 -1
  227. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts +10 -0
  228. package/dist/types/init/frameworkSetup/tanstackStart/templates.d.ts.map +1 -1
  229. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts +12 -0
  230. package/dist/types/init/frameworkSetup/tanstackStart/transforms.d.ts.map +1 -1
  231. package/dist/types/init/frameworkSetup/types.d.ts +6 -0
  232. package/dist/types/init/frameworkSetup/types.d.ts.map +1 -1
  233. package/dist/types/init/index.d.ts +15 -1
  234. package/dist/types/init/index.d.ts.map +1 -1
  235. package/dist/types/init/utils/configManipulation.d.ts +14 -0
  236. package/dist/types/init/utils/configManipulation.d.ts.map +1 -1
  237. package/dist/types/init/utils/index.d.ts +5 -3
  238. package/dist/types/init/utils/lintConfig.d.ts +28 -0
  239. package/dist/types/init/utils/lintConfig.d.ts.map +1 -0
  240. package/dist/types/init/utils/packageManager.d.ts +29 -6
  241. package/dist/types/init/utils/packageManager.d.ts.map +1 -1
  242. package/dist/types/init/utils/urlRoutingFramework.d.ts +9 -0
  243. package/dist/types/init/utils/urlRoutingFramework.d.ts.map +1 -0
  244. package/dist/types/initConfig/index.d.ts +3 -1
  245. package/dist/types/initConfig/index.d.ts.map +1 -1
  246. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts +4 -0
  247. package/dist/types/loadDictionaries/logTypeScriptErrors.d.ts.map +1 -1
  248. package/package.json +8 -8
@@ -0,0 +1,141 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ //#region src/init/documentationRouter.ts
3
+ /**
4
+ * Documentation URL Constants
5
+ */
6
+ const DocumentationRouter = {
7
+ NextJS: "https://intlayer.org/doc/environment/nextjs",
8
+ NextJS_16: "https://intlayer.org/doc/environment/nextjs",
9
+ NextJS_15: "https://intlayer.org/doc/environment/nextjs/15",
10
+ NextJS_14: "https://intlayer.org/doc/environment/nextjs/14",
11
+ NextJS_PageRouter: "https://intlayer.org/doc/environment/nextjs/next-with-page-router",
12
+ CRA: "https://intlayer.org/doc/environment/create-react-app",
13
+ Astro: "https://intlayer.org/doc/environment/astro",
14
+ Astro_Lit: "https://intlayer.org/doc/environment/astro/lit",
15
+ Astro_Preact: "https://intlayer.org/doc/environment/astro/preact",
16
+ Astro_React: "https://intlayer.org/doc/environment/astro/react",
17
+ Astro_Solid: "https://intlayer.org/doc/environment/astro/solid",
18
+ Astro_Svelte: "https://intlayer.org/doc/environment/astro/svelte",
19
+ Astro_Vue: "https://intlayer.org/doc/environment/astro/vue",
20
+ ViteAndReact: "https://intlayer.org/doc/environment/vite-and-react",
21
+ ViteAndReact_ReactRouterV7: "https://intlayer.org/doc/environment/vite-and-react/react-router-v7",
22
+ ViteAndVue: "https://intlayer.org/doc/environment/vite-and-vue",
23
+ ViteAndSolid: "https://intlayer.org/doc/environment/vite-and-solid",
24
+ ViteAndSvelte: "https://intlayer.org/doc/environment/vite-and-svelte",
25
+ ViteAndPreact: "https://intlayer.org/doc/environment/vite-and-preact",
26
+ ViteAndLit: "https://intlayer.org/doc/environment/vite-and-lit",
27
+ ViteAndVanilla: "https://intlayer.org/doc/environment/vite-and-vanilla",
28
+ Vanilla: "https://intlayer.org/doc/environment/vanilla",
29
+ TanStackRouter: "https://intlayer.org/doc/environment/tanstack-start",
30
+ TanStackRouterAndSolid: "https://intlayer.org/doc/environment/tanstack-start/solid",
31
+ SolidStart: "https://intlayer.org/doc/environment/solid-start",
32
+ Analog: "https://intlayer.org/doc/environment/analog",
33
+ Remix: "https://intlayer.org/doc/environment/remix-3",
34
+ NuxtAndVue: "https://intlayer.org/doc/environment/nuxt-and-vue",
35
+ Angular: "https://intlayer.org/doc/environment/angular",
36
+ Angular_19: "https://intlayer.org/doc/environment/angular/19",
37
+ SvelteKit: "https://intlayer.org/doc/environment/sveltekit",
38
+ ReactNativeAndExpo: "https://intlayer.org/doc/environment/react-native-and-expo",
39
+ Lynx: "https://intlayer.org/doc/environment/lynx-and-react",
40
+ HTMX: "https://intlayer.org/doc/environment/htmx",
41
+ Storybook: "https://intlayer.org/doc/storybook",
42
+ Express: "https://intlayer.org/doc/environment/express",
43
+ NestJS: "https://intlayer.org/doc/environment/nest",
44
+ Fastify: "https://intlayer.org/doc/environment/fastify",
45
+ Hono: "https://intlayer.org/doc/environment/hono",
46
+ AdonisJS: "https://intlayer.org/doc/environment/adonisjs",
47
+ Elysia: "https://intlayer.org/doc/environment/elysia",
48
+ Default: "https://intlayer.org/doc/get-started",
49
+ LSP: "https://intlayer.org/doc/lsp",
50
+ ESLint: "https://intlayer.org/doc/eslint",
51
+ NextIntl: "https://intlayer.org/doc/next-intl",
52
+ NextI18Next: "https://intlayer.org/doc/next-i18next",
53
+ ReactI18Next: "https://intlayer.org/doc/compatibility/react-i18next",
54
+ ReactIntl: "https://intlayer.org/doc/compatibility/react-intl",
55
+ VueI18n: "https://intlayer.org/doc/compatibility/vue-i18n",
56
+ NuxtI18n: "https://intlayer.org/doc/compatibility/nuxtjs-i18n",
57
+ I18next: "https://intlayer.org/doc/compatibility/i18next"
58
+ };
59
+ /**
60
+ * Helper: Detects the environment and returns the doc URL
61
+ */
62
+ const getDocumentationUrl = (packageJson) => {
63
+ const deps = {
64
+ ...packageJson?.dependencies,
65
+ ...packageJson?.devDependencies
66
+ };
67
+ /**
68
+ * Helper to check if a version string matches a specific major version
69
+ * Matches: "15", "^15.0.0", "~15.2", "15.0.0-beta"
70
+ */
71
+ const isVersion = (versionString, major) => {
72
+ if (!versionString || typeof versionString !== "string") return false;
73
+ return new RegExp(`^[\\^~]?${major}(?:\\.|$)`).test(versionString);
74
+ };
75
+ if (deps["@lynx-js/react"] || deps["@lynx-js/core"]) return DocumentationRouter.Lynx;
76
+ if (deps["react-native"] || deps.expo) return DocumentationRouter.ReactNativeAndExpo;
77
+ if (deps.next) {
78
+ const version = deps.next;
79
+ if (isVersion(version, 14)) return DocumentationRouter.NextJS_14;
80
+ if (isVersion(version, 15)) return DocumentationRouter.NextJS_15;
81
+ return DocumentationRouter.NextJS;
82
+ }
83
+ if (deps.nuxt) return DocumentationRouter.NuxtAndVue;
84
+ if (deps.astro) {
85
+ if (deps["@astrojs/react"] || deps.react) return DocumentationRouter.Astro_React;
86
+ if (deps["@astrojs/vue"] || deps.vue) return DocumentationRouter.Astro_Vue;
87
+ if (deps["@astrojs/svelte"] || deps.svelte) return DocumentationRouter.Astro_Svelte;
88
+ if (deps["@astrojs/solid-js"] || deps["solid-js"]) return DocumentationRouter.Astro_Solid;
89
+ if (deps["@astrojs/preact"] || deps.preact) return DocumentationRouter.Astro_Preact;
90
+ if (deps["@astrojs/lit"] || deps.lit) return DocumentationRouter.Astro_Lit;
91
+ return DocumentationRouter.Astro;
92
+ }
93
+ if (deps["@sveltejs/kit"]) return DocumentationRouter.SvelteKit;
94
+ if (deps["@analogjs/platform"]) return DocumentationRouter.Analog;
95
+ if (deps["@solidjs/start"]) return DocumentationRouter.SolidStart;
96
+ if (deps.remix || deps["remix-intlayer"]) return DocumentationRouter.Remix;
97
+ if (deps["@tanstack/react-router"]) return DocumentationRouter.TanStackRouter;
98
+ if (deps["@tanstack/solid-router"]) return DocumentationRouter.TanStackRouterAndSolid;
99
+ if (deps["@tanstack/start"]) {
100
+ if (deps["solid-js"] || deps["@tanstack/solid-router"]) return DocumentationRouter.TanStackRouterAndSolid;
101
+ return DocumentationRouter.TanStackRouter;
102
+ }
103
+ const reactRouterVersion = deps["react-router"];
104
+ if (typeof reactRouterVersion === "string" && (deps["@react-router/fs-routes"] || isVersion(reactRouterVersion, 7))) return DocumentationRouter.ViteAndReact_ReactRouterV7;
105
+ if (deps.vite) {
106
+ if (deps.vue) return DocumentationRouter.ViteAndVue;
107
+ if (deps["solid-js"]) return DocumentationRouter.ViteAndSolid;
108
+ if (deps.svelte) return DocumentationRouter.ViteAndSvelte;
109
+ if (deps.preact) return DocumentationRouter.ViteAndPreact;
110
+ if (deps.lit) return DocumentationRouter.ViteAndLit;
111
+ if (deps["vanilla-intlayer"]) return DocumentationRouter.ViteAndVanilla;
112
+ return DocumentationRouter.ViteAndReact;
113
+ }
114
+ if (deps["react-scripts"]) return DocumentationRouter.CRA;
115
+ if (deps["@angular/core"]) {
116
+ const version = deps["@angular/core"];
117
+ if (isVersion(version, 19)) return DocumentationRouter.Angular_19;
118
+ return DocumentationRouter.Angular;
119
+ }
120
+ if (deps.lit) return DocumentationRouter.ViteAndLit;
121
+ if (deps["vanilla-intlayer"]) return DocumentationRouter.Vanilla;
122
+ if (deps.htmx || deps["htmx.org"]) return DocumentationRouter.HTMX;
123
+ if (deps.storybook || deps["@storybook/react"] || deps["@storybook/vue3"]) return DocumentationRouter.Storybook;
124
+ if (deps["@nestjs/core"]) return DocumentationRouter.NestJS;
125
+ if (deps["@adonisjs/core"]) return DocumentationRouter.AdonisJS;
126
+ if (deps.elysia) return DocumentationRouter.Elysia;
127
+ if (deps.hono) return DocumentationRouter.Hono;
128
+ if (deps.express) return DocumentationRouter.Express;
129
+ if (deps.fastify) return DocumentationRouter.Fastify;
130
+ if (deps["next-intl"]) return DocumentationRouter.NextIntl;
131
+ if (deps["react-i18next"] || deps.i18next) return DocumentationRouter.ReactI18Next;
132
+ if (deps["react-intl"]) return DocumentationRouter.ReactIntl;
133
+ if (deps["next-i18next"]) return DocumentationRouter.NextI18Next;
134
+ if (deps["vue-i18n"]) return DocumentationRouter.VueI18n;
135
+ return DocumentationRouter.Default;
136
+ };
137
+
138
+ //#endregion
139
+ exports.DocumentationRouter = DocumentationRouter;
140
+ exports.getDocumentationUrl = getDocumentationUrl;
141
+ //# sourceMappingURL=documentationRouter.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documentationRouter.cjs","names":[],"sources":["../../../src/init/documentationRouter.ts"],"sourcesContent":["/**\n * Documentation URL Constants\n */\nexport const DocumentationRouter = {\n NextJS: 'https://intlayer.org/doc/environment/nextjs',\n NextJS_16: 'https://intlayer.org/doc/environment/nextjs',\n NextJS_15: 'https://intlayer.org/doc/environment/nextjs/15',\n NextJS_14: 'https://intlayer.org/doc/environment/nextjs/14',\n NextJS_PageRouter:\n 'https://intlayer.org/doc/environment/nextjs/next-with-page-router',\n CRA: 'https://intlayer.org/doc/environment/create-react-app',\n Astro: 'https://intlayer.org/doc/environment/astro',\n Astro_Lit: 'https://intlayer.org/doc/environment/astro/lit',\n Astro_Preact: 'https://intlayer.org/doc/environment/astro/preact',\n Astro_React: 'https://intlayer.org/doc/environment/astro/react',\n Astro_Solid: 'https://intlayer.org/doc/environment/astro/solid',\n Astro_Svelte: 'https://intlayer.org/doc/environment/astro/svelte',\n Astro_Vue: 'https://intlayer.org/doc/environment/astro/vue',\n ViteAndReact: 'https://intlayer.org/doc/environment/vite-and-react',\n ViteAndReact_ReactRouterV7:\n 'https://intlayer.org/doc/environment/vite-and-react/react-router-v7',\n ViteAndVue: 'https://intlayer.org/doc/environment/vite-and-vue',\n ViteAndSolid: 'https://intlayer.org/doc/environment/vite-and-solid',\n ViteAndSvelte: 'https://intlayer.org/doc/environment/vite-and-svelte',\n ViteAndPreact: 'https://intlayer.org/doc/environment/vite-and-preact',\n ViteAndLit: 'https://intlayer.org/doc/environment/vite-and-lit',\n ViteAndVanilla: 'https://intlayer.org/doc/environment/vite-and-vanilla',\n Vanilla: 'https://intlayer.org/doc/environment/vanilla',\n TanStackRouter: 'https://intlayer.org/doc/environment/tanstack-start',\n TanStackRouterAndSolid:\n 'https://intlayer.org/doc/environment/tanstack-start/solid',\n SolidStart: 'https://intlayer.org/doc/environment/solid-start',\n Analog: 'https://intlayer.org/doc/environment/analog',\n Remix: 'https://intlayer.org/doc/environment/remix-3',\n NuxtAndVue: 'https://intlayer.org/doc/environment/nuxt-and-vue',\n Angular: 'https://intlayer.org/doc/environment/angular',\n Angular_19: 'https://intlayer.org/doc/environment/angular/19',\n SvelteKit: 'https://intlayer.org/doc/environment/sveltekit',\n ReactNativeAndExpo:\n 'https://intlayer.org/doc/environment/react-native-and-expo',\n Lynx: 'https://intlayer.org/doc/environment/lynx-and-react',\n HTMX: 'https://intlayer.org/doc/environment/htmx',\n Storybook: 'https://intlayer.org/doc/storybook',\n Express: 'https://intlayer.org/doc/environment/express',\n NestJS: 'https://intlayer.org/doc/environment/nest',\n Fastify: 'https://intlayer.org/doc/environment/fastify',\n Hono: 'https://intlayer.org/doc/environment/hono',\n AdonisJS: 'https://intlayer.org/doc/environment/adonisjs',\n Elysia: 'https://intlayer.org/doc/environment/elysia',\n Default: 'https://intlayer.org/doc/get-started',\n\n // Intlayer Language Server (Go-to-Definition from getter keys to .content files)\n LSP: 'https://intlayer.org/doc/lsp',\n\n // Lint rules for hardcoded text and non-optimizable dynamic calls\n ESLint: 'https://intlayer.org/doc/eslint',\n\n // Competitor / Compat libs\n NextIntl: 'https://intlayer.org/doc/next-intl',\n NextI18Next: 'https://intlayer.org/doc/next-i18next',\n ReactI18Next: 'https://intlayer.org/doc/compatibility/react-i18next',\n ReactIntl: 'https://intlayer.org/doc/compatibility/react-intl',\n VueI18n: 'https://intlayer.org/doc/compatibility/vue-i18n',\n NuxtI18n: 'https://intlayer.org/doc/compatibility/nuxtjs-i18n',\n I18next: 'https://intlayer.org/doc/compatibility/i18next',\n};\n\nexport type DocumentationRouterType = typeof DocumentationRouter;\n\n/**\n * Helper: Detects the environment and returns the doc URL\n */\nexport const getDocumentationUrl = (packageJson: any): string => {\n const deps = {\n ...packageJson?.dependencies,\n ...packageJson?.devDependencies,\n };\n\n /**\n * Helper to check if a version string matches a specific major version\n * Matches: \"15\", \"^15.0.0\", \"~15.2\", \"15.0.0-beta\"\n */\n const isVersion = (versionString: string, major: number): boolean => {\n if (!versionString || typeof versionString !== 'string') return false;\n const regex = new RegExp(`^[\\\\^~]?${major}(?:\\\\.|$)`);\n return regex.test(versionString);\n };\n\n // Mobile / Cross-platform\n if (deps['@lynx-js/react'] || deps['@lynx-js/core']) {\n return DocumentationRouter.Lynx;\n }\n if (deps['react-native'] || deps.expo) {\n return DocumentationRouter.ReactNativeAndExpo;\n }\n\n // Meta-frameworks (Next, Nuxt, Astro, SvelteKit)\n if (deps.next) {\n const version = deps.next;\n\n if (isVersion(version, 14)) {\n return DocumentationRouter.NextJS_14;\n }\n\n if (isVersion(version, 15)) {\n return DocumentationRouter.NextJS_15;\n }\n\n return DocumentationRouter.NextJS;\n }\n\n if (deps.nuxt) return DocumentationRouter.NuxtAndVue;\n\n if (deps.astro) {\n if (deps['@astrojs/react'] || deps.react)\n return DocumentationRouter.Astro_React;\n if (deps['@astrojs/vue'] || deps.vue) return DocumentationRouter.Astro_Vue;\n if (deps['@astrojs/svelte'] || deps.svelte)\n return DocumentationRouter.Astro_Svelte;\n if (deps['@astrojs/solid-js'] || deps['solid-js'])\n return DocumentationRouter.Astro_Solid;\n if (deps['@astrojs/preact'] || deps.preact)\n return DocumentationRouter.Astro_Preact;\n if (deps['@astrojs/lit'] || deps.lit) return DocumentationRouter.Astro_Lit;\n\n return DocumentationRouter.Astro;\n }\n\n if (deps['@sveltejs/kit']) return DocumentationRouter.SvelteKit;\n if (deps['@analogjs/platform']) return DocumentationRouter.Analog;\n if (deps['@solidjs/start']) return DocumentationRouter.SolidStart;\n if (deps.remix || deps['remix-intlayer']) return DocumentationRouter.Remix;\n\n // Routers (TanStack & React Router v7)\n if (deps['@tanstack/react-router']) {\n return DocumentationRouter.TanStackRouter;\n }\n if (deps['@tanstack/solid-router']) {\n return DocumentationRouter.TanStackRouterAndSolid;\n }\n if (deps['@tanstack/start']) {\n if (deps['solid-js'] || deps['@tanstack/solid-router']) {\n return DocumentationRouter.TanStackRouterAndSolid;\n }\n return DocumentationRouter.TanStackRouter;\n }\n\n // Check for React Router v7 (the guide covers both config and FS routes)\n const reactRouterVersion = deps['react-router'];\n if (\n typeof reactRouterVersion === 'string' &&\n (deps['@react-router/fs-routes'] || isVersion(reactRouterVersion, 7))\n ) {\n return DocumentationRouter.ViteAndReact_ReactRouterV7;\n }\n\n // Vite Ecosystem (General)\n if (deps.vite) {\n if (deps.vue) return DocumentationRouter.ViteAndVue;\n if (deps['solid-js']) return DocumentationRouter.ViteAndSolid;\n if (deps.svelte) return DocumentationRouter.ViteAndSvelte;\n if (deps.preact) return DocumentationRouter.ViteAndPreact;\n if (deps.lit) return DocumentationRouter.ViteAndLit;\n if (deps['vanilla-intlayer']) return DocumentationRouter.ViteAndVanilla;\n\n // Default to React if Vite is present but specific other frameworks aren't found\n return DocumentationRouter.ViteAndReact;\n }\n\n // Other Web Frameworks\n if (deps['react-scripts']) return DocumentationRouter.CRA;\n if (deps['@angular/core']) {\n const version = deps['@angular/core'];\n if (isVersion(version, 19)) {\n return DocumentationRouter.Angular_19;\n }\n return DocumentationRouter.Angular;\n }\n if (deps.lit) return DocumentationRouter.ViteAndLit;\n if (deps['vanilla-intlayer']) return DocumentationRouter.Vanilla;\n if (deps.htmx || deps['htmx.org']) return DocumentationRouter.HTMX;\n if (deps.storybook || deps['@storybook/react'] || deps['@storybook/vue3'])\n return DocumentationRouter.Storybook;\n\n // Backend\n // NestJS first: it runs on top of Express (or Fastify), so both dependencies\n // are present and the more specific one has to win.\n if (deps['@nestjs/core']) return DocumentationRouter.NestJS;\n if (deps['@adonisjs/core']) return DocumentationRouter.AdonisJS;\n if (deps.elysia) return DocumentationRouter.Elysia;\n if (deps.hono) return DocumentationRouter.Hono;\n if (deps.express) return DocumentationRouter.Express;\n if (deps.fastify) return DocumentationRouter.Fastify;\n\n // Competitor Libs (Migration Guides)\n // We check these last as specific environment setup is usually higher priority,\n // but if no specific framework logic matched (or as a fallback), we guide to migration.\n if (deps['next-intl']) return DocumentationRouter.NextIntl;\n if (deps['react-i18next'] || deps.i18next)\n return DocumentationRouter.ReactI18Next;\n if (deps['react-intl']) return DocumentationRouter.ReactIntl;\n if (deps['next-i18next']) return DocumentationRouter.NextI18Next;\n if (deps['vue-i18n']) return DocumentationRouter.VueI18n;\n\n return DocumentationRouter.Default;\n};\n"],"mappings":";;;;;AAGA,MAAa,sBAAsB;CACjC,QAAQ;CACR,WAAW;CACX,WAAW;CACX,WAAW;CACX,mBACE;CACF,KAAK;CACL,OAAO;CACP,WAAW;CACX,cAAc;CACd,aAAa;CACb,aAAa;CACb,cAAc;CACd,WAAW;CACX,cAAc;CACd,4BACE;CACF,Y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AAa,KAAK,uBAAuB,KAAK,oBACrD,OAAO,oBAAoB;CAK7B,IAAI,KAAK,iBAAiB,OAAO,oBAAoB;CACrD,IAAI,KAAK,mBAAmB,OAAO,oBAAoB;CACvD,IAAI,KAAK,QAAQ,OAAO,oBAAoB;CAC5C,IAAI,KAAK,MAAM,OAAO,oBAAoB;CAC1C,IAAI,KAAK,SAAS,OAAO,oBAAoB;CAC7C,IAAI,KAAK,SAAS,OAAO,oBAAoB;CAK7C,IAAI,KAAK,cAAc,OAAO,oBAAoB;CAClD,IAAI,KAAK,oBAAoB,KAAK,SAChC,OAAO,oBAAoB;CAC7B,IAAI,KAAK,eAAe,OAAO,oBAAoB;CACnD,IAAI,KAAK,iBAAiB,OAAO,oBAAoB;CACrD,IAAI,KAAK,aAAa,OAAO,oBAAoB;CAEjD,OAAO,oBAAoB;AAC7B"}
@@ -0,0 +1,138 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
+ const require_init_utils_fileSystem = require('../../utils/fileSystem.cjs');
4
+ const require_init_frameworkSetup_backend_transforms = require('./transforms.cjs');
5
+ let _intlayer_config_colors = require("@intlayer/config/colors");
6
+ _intlayer_config_colors = require_runtime.__toESM(_intlayer_config_colors);
7
+ let _intlayer_config_logger = require("@intlayer/config/logger");
8
+
9
+ //#region src/init/frameworkSetup/backend/index.ts
10
+ /** Script extensions probed for a server entry file. */
11
+ const ENTRY_EXTENSIONS = [
12
+ "ts",
13
+ "mts",
14
+ "js",
15
+ "mjs",
16
+ "cjs"
17
+ ];
18
+ /** Conventional server entry file names, most likely first. */
19
+ const DEFAULT_ENTRY_BASE_NAMES = [
20
+ "src/index",
21
+ "src/server",
22
+ "src/app",
23
+ "src/main",
24
+ "index",
25
+ "server",
26
+ "app",
27
+ "main"
28
+ ];
29
+ /**
30
+ * Lists the candidate server entry files: the `package.json` `main` field when
31
+ * it points at source (not a build output), then the conventional names.
32
+ */
33
+ const getEntryCandidates = async (rootDir, entryBaseNames) => {
34
+ const candidates = [];
35
+ try {
36
+ const { main } = JSON.parse(await require_init_utils_fileSystem.readFileFromRoot(rootDir, "package.json"));
37
+ if (typeof main === "string" && !/^(\.\/)?(dist|build|out)\//.test(main)) candidates.push(main.replace(/^\.\//, ""));
38
+ } catch {}
39
+ for (const baseName of entryBaseNames) for (const extension of ENTRY_EXTENSIONS) candidates.push(`${baseName}.${extension}`);
40
+ return [...new Set(candidates)];
41
+ };
42
+ /**
43
+ * Registers the middleware in the first candidate entry file the transform
44
+ * recognizes. Files the transform cannot confidently edit are left untouched;
45
+ * when none matches, guidance is logged instead.
46
+ */
47
+ const registerBackendMiddleware = async (rootDir, integration) => {
48
+ (0, _intlayer_config_logger.logger)((0, _intlayer_config_logger.colorize)(`Setting up ${integration.name} integration...`, _intlayer_config_colors.CYAN));
49
+ const candidates = await getEntryCandidates(rootDir, integration.entryBaseNames);
50
+ for (const candidate of candidates) {
51
+ if (!await require_init_utils_fileSystem.exists(rootDir, candidate)) continue;
52
+ const code = await require_init_utils_fileSystem.readFileFromRoot(rootDir, candidate);
53
+ let result;
54
+ try {
55
+ result = integration.transform(code);
56
+ } catch {
57
+ continue;
58
+ }
59
+ if (result.status === "already") {
60
+ (0, _intlayer_config_logger.logger)(`${_intlayer_config_logger.v} ${(0, _intlayer_config_logger.colorizePath)(candidate)} already registers the Intlayer middleware`);
61
+ return;
62
+ }
63
+ if (result.status === "registered") {
64
+ await require_init_utils_fileSystem.writeFileToRoot(rootDir, candidate, result.code);
65
+ (0, _intlayer_config_logger.logger)(`${_intlayer_config_logger.v} Registered ${(0, _intlayer_config_logger.colorize)(integration.registrationHint, _intlayer_config_colors.MAGENTA)} in ${(0, _intlayer_config_logger.colorizePath)(candidate)}`);
66
+ return;
67
+ }
68
+ }
69
+ (0, _intlayer_config_logger.logger)(`${_intlayer_config_logger.x} Could not find where your ${integration.name} app is created — add ${(0, _intlayer_config_logger.colorize)(integration.registrationHint, _intlayer_config_colors.MAGENTA)} manually: ${(0, _intlayer_config_logger.colorizePath)(integration.documentationUrl)}`, { level: "warn" });
70
+ };
71
+ /** Wraps a backend integration into a framework adapter. */
72
+ const createBackendAdapter = (integration) => ({
73
+ name: integration.name,
74
+ detect: ({ allDeps }) => integration.detect(allDeps),
75
+ setup: ({ rootDir }) => registerBackendMiddleware(rootDir, integration)
76
+ });
77
+ /**
78
+ * NestJS on the Express platform. Checked before Express: a Nest app is
79
+ * created by `NestFactory`, not `express()`. Nest on Fastify is left to the
80
+ * guide (its adapter is registered through the Fastify instance).
81
+ */
82
+ const nestJsAdapter = createBackendAdapter({
83
+ name: "NestJS",
84
+ detect: (allDeps) => Boolean(allDeps["@nestjs/core"]) && !allDeps["@nestjs/platform-fastify"],
85
+ entryBaseNames: ["src/main", "main"],
86
+ transform: require_init_frameworkSetup_backend_transforms.registerNestJsMiddleware,
87
+ registrationHint: "app.use(intlayer())",
88
+ documentationUrl: "https://intlayer.org/doc/environment/nest.md"
89
+ });
90
+ const expressAdapter = createBackendAdapter({
91
+ name: "Express",
92
+ detect: (allDeps) => Boolean(allDeps.express),
93
+ entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,
94
+ transform: require_init_frameworkSetup_backend_transforms.registerExpressMiddleware,
95
+ registrationHint: "app.use(intlayer())",
96
+ documentationUrl: "https://intlayer.org/doc/environment/express.md"
97
+ });
98
+ const fastifyAdapter = createBackendAdapter({
99
+ name: "Fastify",
100
+ detect: (allDeps) => Boolean(allDeps.fastify),
101
+ entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,
102
+ transform: require_init_frameworkSetup_backend_transforms.registerFastifyPlugin,
103
+ registrationHint: "fastify.register(intlayer)",
104
+ documentationUrl: "https://intlayer.org/doc/environment/fastify.md"
105
+ });
106
+ const honoAdapter = createBackendAdapter({
107
+ name: "Hono",
108
+ detect: (allDeps) => Boolean(allDeps.hono),
109
+ entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,
110
+ transform: require_init_frameworkSetup_backend_transforms.registerHonoMiddleware,
111
+ registrationHint: "app.use(\"*\", intlayer())",
112
+ documentationUrl: "https://intlayer.org/doc/environment/hono.md"
113
+ });
114
+ const elysiaAdapter = createBackendAdapter({
115
+ name: "Elysia",
116
+ detect: (allDeps) => Boolean(allDeps.elysia),
117
+ entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,
118
+ transform: require_init_frameworkSetup_backend_transforms.registerElysiaPlugin,
119
+ registrationHint: "new Elysia().use(intlayer())",
120
+ documentationUrl: "https://intlayer.org/doc/environment/elysia.md"
121
+ });
122
+ /** Backend adapters, in detection order. */
123
+ const backendAdapters = [
124
+ nestJsAdapter,
125
+ expressAdapter,
126
+ fastifyAdapter,
127
+ honoAdapter,
128
+ elysiaAdapter
129
+ ];
130
+
131
+ //#endregion
132
+ exports.backendAdapters = backendAdapters;
133
+ exports.elysiaAdapter = elysiaAdapter;
134
+ exports.expressAdapter = expressAdapter;
135
+ exports.fastifyAdapter = fastifyAdapter;
136
+ exports.honoAdapter = honoAdapter;
137
+ exports.nestJsAdapter = nestJsAdapter;
138
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["readFileFromRoot","colorize","ANSIColors","exists","v","colorizePath","writeFileToRoot","x","registerNestJsMiddleware","registerExpressMiddleware","registerFastifyPlugin","registerHonoMiddleware","registerElysiaPlugin"],"sources":["../../../../../src/init/frameworkSetup/backend/index.ts"],"sourcesContent":["import * as ANSIColors from '@intlayer/config/colors';\nimport { colorize, colorizePath, logger, v, x } from '@intlayer/config/logger';\nimport {\n exists,\n readFileFromRoot,\n writeFileToRoot,\n} from '../../utils/fileSystem';\nimport type { FrameworkAdapter } from '../types';\nimport {\n type BackendTransformResult,\n registerElysiaPlugin,\n registerExpressMiddleware,\n registerFastifyPlugin,\n registerHonoMiddleware,\n registerNestJsMiddleware,\n} from './transforms';\n\n/** Script extensions probed for a server entry file. */\nconst ENTRY_EXTENSIONS = ['ts', 'mts', 'js', 'mjs', 'cjs'] as const;\n\n/** Conventional server entry file names, most likely first. */\nconst DEFAULT_ENTRY_BASE_NAMES = [\n 'src/index',\n 'src/server',\n 'src/app',\n 'src/main',\n 'index',\n 'server',\n 'app',\n 'main',\n] as const;\n\n/**\n * Lists the candidate server entry files: the `package.json` `main` field when\n * it points at source (not a build output), then the conventional names.\n */\nconst getEntryCandidates = async (\n rootDir: string,\n entryBaseNames: readonly string[]\n): Promise<string[]> => {\n const candidates: string[] = [];\n\n try {\n const { main } = JSON.parse(\n await readFileFromRoot(rootDir, 'package.json')\n );\n const isSourceEntry =\n typeof main === 'string' && !/^(\\.\\/)?(dist|build|out)\\//.test(main);\n if (isSourceEntry) candidates.push(main.replace(/^\\.\\//, ''));\n } catch {\n // No readable package.json — rely on the conventional names.\n }\n\n for (const baseName of entryBaseNames) {\n for (const extension of ENTRY_EXTENSIONS) {\n candidates.push(`${baseName}.${extension}`);\n }\n }\n\n return [...new Set(candidates)];\n};\n\n/** A server framework whose Intlayer middleware can be registered by init. */\ntype BackendIntegration = {\n /** Human-readable framework name, used in logs. */\n name: string;\n /** Returns true when the project uses this framework. */\n detect: (allDeps: Record<string, string>) => boolean;\n /** Entry file base names to probe, in order. */\n entryBaseNames: readonly string[];\n /** Registers the middleware in an entry file's source. */\n transform: (code: string) => BackendTransformResult;\n /** How the registration reads, shown in logs and manual-setup guidance. */\n registrationHint: string;\n /** Guide for a manual setup. */\n documentationUrl: string;\n};\n\n/**\n * Registers the middleware in the first candidate entry file the transform\n * recognizes. Files the transform cannot confidently edit are left untouched;\n * when none matches, guidance is logged instead.\n */\nconst registerBackendMiddleware = async (\n rootDir: string,\n integration: BackendIntegration\n): Promise<void> => {\n logger(\n colorize(`Setting up ${integration.name} integration...`, ANSIColors.CYAN)\n );\n\n const candidates = await getEntryCandidates(\n rootDir,\n integration.entryBaseNames\n );\n\n for (const candidate of candidates) {\n if (!(await exists(rootDir, candidate))) continue;\n\n const code = await readFileFromRoot(rootDir, candidate);\n\n let result: BackendTransformResult;\n try {\n result = integration.transform(code);\n } catch {\n // Unparsable file — try the next candidate.\n continue;\n }\n\n if (result.status === 'already') {\n logger(\n `${v} ${colorizePath(candidate)} already registers the Intlayer middleware`\n );\n return;\n }\n\n if (result.status === 'registered') {\n await writeFileToRoot(rootDir, candidate, result.code);\n logger(\n `${v} Registered ${colorize(integration.registrationHint, ANSIColors.MAGENTA)} in ${colorizePath(candidate)}`\n );\n return;\n }\n }\n\n logger(\n `${x} Could not find where your ${integration.name} app is created — add ${colorize(integration.registrationHint, ANSIColors.MAGENTA)} manually: ${colorizePath(integration.documentationUrl)}`,\n { level: 'warn' }\n );\n};\n\n/** Wraps a backend integration into a framework adapter. */\nconst createBackendAdapter = (\n integration: BackendIntegration\n): FrameworkAdapter => ({\n name: integration.name,\n detect: ({ allDeps }) => integration.detect(allDeps),\n setup: ({ rootDir }) => registerBackendMiddleware(rootDir, integration),\n});\n\n/**\n * NestJS on the Express platform. Checked before Express: a Nest app is\n * created by `NestFactory`, not `express()`. Nest on Fastify is left to the\n * guide (its adapter is registered through the Fastify instance).\n */\nexport const nestJsAdapter = createBackendAdapter({\n name: 'NestJS',\n detect: (allDeps) =>\n Boolean(allDeps['@nestjs/core']) && !allDeps['@nestjs/platform-fastify'],\n entryBaseNames: ['src/main', 'main'],\n transform: registerNestJsMiddleware,\n registrationHint: 'app.use(intlayer())',\n documentationUrl: 'https://intlayer.org/doc/environment/nest.md',\n});\n\nexport const expressAdapter = createBackendAdapter({\n name: 'Express',\n detect: (allDeps) => Boolean(allDeps.express),\n entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,\n transform: registerExpressMiddleware,\n registrationHint: 'app.use(intlayer())',\n documentationUrl: 'https://intlayer.org/doc/environment/express.md',\n});\n\nexport const fastifyAdapter = createBackendAdapter({\n name: 'Fastify',\n detect: (allDeps) => Boolean(allDeps.fastify),\n entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,\n transform: registerFastifyPlugin,\n registrationHint: 'fastify.register(intlayer)',\n documentationUrl: 'https://intlayer.org/doc/environment/fastify.md',\n});\n\nexport const honoAdapter = createBackendAdapter({\n name: 'Hono',\n detect: (allDeps) => Boolean(allDeps.hono),\n entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,\n transform: registerHonoMiddleware,\n registrationHint: 'app.use(\"*\", intlayer())',\n documentationUrl: 'https://intlayer.org/doc/environment/hono.md',\n});\n\nexport const elysiaAdapter = createBackendAdapter({\n name: 'Elysia',\n detect: (allDeps) => Boolean(allDeps.elysia),\n entryBaseNames: DEFAULT_ENTRY_BASE_NAMES,\n transform: registerElysiaPlugin,\n registrationHint: 'new Elysia().use(intlayer())',\n documentationUrl: 'https://intlayer.org/doc/environment/elysia.md',\n});\n\n/** Backend adapters, in detection order. */\nexport const backendAdapters: FrameworkAdapter[] = [\n nestJsAdapter,\n expressAdapter,\n fastifyAdapter,\n honoAdapter,\n elysiaAdapter,\n];\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,mBAAmB;CAAC;CAAM;CAAO;CAAM;CAAO;AAAK;;AAGzD,MAAM,2BAA2B;CAC/B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;;;;;AAMA,MAAM,qBAAqB,OACzB,SACA,mBACsB;CACtB,MAAM,aAAuB,CAAC;CAE9B,IAAI;EACF,MAAM,EAAE,SAAS,KAAK,MACpB,MAAMA,+CAAiB,SAAS,cAAc,CAChD;EAGA,IADE,OAAO,SAAS,YAAY,CAAC,6BAA6B,KAAK,IAAI,GAClD,WAAW,KAAK,KAAK,QAAQ,SAAS,EAAE,CAAC;CAC9D,QAAQ,CAER;CAEA,KAAK,MAAM,YAAY,gBACrB,KAAK,MAAM,aAAa,kBACtB,WAAW,KAAK,GAAG,SAAS,GAAG,WAAW;CAI9C,OAAO,CAAC,GAAG,IAAI,IAAI,UAAU,CAAC;AAChC;;;;;;AAuBA,MAAM,4BAA4B,OAChC,SACA,gBACkB;CAClB,wCACEC,kCAAS,cAAc,YAAY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Aa,iBAAiB,qBAAqB;CACjD,MAAM;CACN,SAAS,YAAY,QAAQ,QAAQ,OAAO;CAC5C,gBAAgB;CAChB,WAAWC;CACX,kBAAkB;CAClB,kBAAkB;AACpB,CAAC;AAED,MAAa,cAAc,qBAAqB;CAC9C,MAAM;CACN,SAAS,YAAY,QAAQ,QAAQ,IAAI;CACzC,gBAAgB;CAChB,WAAWC;CACX,kBAAkB;CAClB,kBAAkB;AACpB,CAAC;AAED,MAAa,gBAAgB,qBAAqB;CAChD,MAAM;CACN,SAAS,YAAY,QAAQ,QAAQ,MAAM;CAC3C,gBAAgB;CAChB,WAAWC;CACX,kBAAkB;CAClB,kBAAkB;AACpB,CAAC;;AAGD,MAAa,kBAAsC;CACjD;CACA;CACA;CACA;CACA;AACF"}
@@ -0,0 +1,223 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../../../_virtual/_rolldown/runtime.cjs');
3
+ const require_utils_babelParser = require('../../../utils/babelParser.cjs');
4
+ const require_init_utils_astImports = require('../../utils/astImports.cjs');
5
+ let recast = require("recast");
6
+ recast = require_runtime.__toESM(recast);
7
+
8
+ //#region src/init/frameworkSetup/backend/transforms.ts
9
+ const { namedTypes: n } = recast.types;
10
+ /** Local name the injected middleware / plugin factory is bound to. */
11
+ const MIDDLEWARE_IDENTIFIER = "intlayer";
12
+ /** babel-ts parser handles TypeScript *and* plain JavaScript. */
13
+ const parseCode = (code) => recast.parse(code, { parser: require_utils_babelParser.babelTsParser });
14
+ /** Parses a single statement. */
15
+ const parseStatement = (code) => parseCode(code).program.body[0];
16
+ /** Whether `node` is a `require("<source>")` call. */
17
+ const isRequireOf = (node, source) => node?.type === "CallExpression" && node.callee?.type === "Identifier" && node.callee.name === "require" && node.arguments[0]?.value === source;
18
+ /**
19
+ * Resolves the local names a factory is bound to at module scope, from ESM
20
+ * imports (`import express from "express"`, `import { Hono } from "hono"`) or
21
+ * CommonJS requires (`const express = require("express")`,
22
+ * `const { Hono } = require("hono")`).
23
+ */
24
+ const findFactoryLocalNames = (ast, factory) => {
25
+ const localNames = [];
26
+ const acceptsNamed = (name) => factory.named?.includes(name) ?? false;
27
+ for (const statement of ast.program.body) {
28
+ if (statement.type === "ImportDeclaration" && statement.source.value === factory.source) for (const specifier of statement.specifiers) {
29
+ const isAcceptedDefault = specifier.type === "ImportDefaultSpecifier" && factory.default;
30
+ const isAcceptedNamed = specifier.type === "ImportSpecifier" && acceptsNamed(specifier.imported.name);
31
+ if (isAcceptedDefault || isAcceptedNamed) localNames.push(specifier.local.name);
32
+ }
33
+ if (statement.type !== "VariableDeclaration") continue;
34
+ for (const declarator of statement.declarations) {
35
+ if (!isRequireOf(declarator.init, factory.source)) continue;
36
+ if (declarator.id.type === "Identifier" && factory.default) localNames.push(declarator.id.name);
37
+ if (declarator.id.type === "ObjectPattern") {
38
+ for (const property of declarator.id.properties) if (property.key?.type === "Identifier" && property.value?.type === "Identifier" && acceptsNamed(property.key.name)) localNames.push(property.value.name);
39
+ }
40
+ }
41
+ }
42
+ return localNames;
43
+ };
44
+ /** Whether the module uses CommonJS (`require`) rather than ESM imports. */
45
+ const isCommonJsModule = (ast) => !ast.program.body.some((statement) => statement.type === "ImportDeclaration" || statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration") && ast.program.body.some((statement) => statement.type === "VariableDeclaration" && statement.declarations.some((declarator) => declarator.init?.type === "CallExpression" && declarator.init.callee?.name === "require"));
46
+ /**
47
+ * Binds `intlayer` from `source`: an ESM named import, or — in a CommonJS
48
+ * module — `const { intlayer } = require("<source>");` placed after the last
49
+ * top-level `require`.
50
+ */
51
+ const ensureMiddlewareBinding = (ast, source) => {
52
+ if (!isCommonJsModule(ast)) {
53
+ require_init_utils_astImports.ensureNamedImport(ast, MIDDLEWARE_IDENTIFIER, source);
54
+ return;
55
+ }
56
+ const body = ast.program.body;
57
+ let insertIndex = 0;
58
+ body.forEach((statement, index) => {
59
+ if (statement.type === "VariableDeclaration" && statement.declarations.some((declarator) => declarator.init?.callee?.name === "require")) insertIndex = index + 1;
60
+ });
61
+ body.splice(insertIndex, 0, parseStatement(`const { ${MIDDLEWARE_IDENTIFIER} } = require("${source}");`));
62
+ };
63
+ /**
64
+ * Finds the first `const <app> = <init>` whose initializer matches, returning
65
+ * the app identifier and the statement path to insert after. `export const`
66
+ * declarations resolve to the export statement.
67
+ */
68
+ const findAppDeclaration = (ast, matchesInit) => {
69
+ let found = null;
70
+ recast.visit(ast, { visitVariableDeclarator(path) {
71
+ const { id, init } = path.node;
72
+ if (!found && id.type === "Identifier" && init && matchesInit(init)) {
73
+ let statementPath = path.parent;
74
+ if (statementPath.parent?.node.type === "ExportNamedDeclaration") statementPath = statementPath.parent;
75
+ found = {
76
+ appName: id.name,
77
+ statementPath
78
+ };
79
+ return false;
80
+ }
81
+ this.traverse(path);
82
+ } });
83
+ return found;
84
+ };
85
+ /** Whether `node` calls one of `calleeNames` directly (`express()`, `new Hono()`). */
86
+ const isFactoryCall = (node, calleeNames, type) => node?.type === type && node.callee?.type === "Identifier" && calleeNames.includes(node.callee.name);
87
+ /**
88
+ * Shared flow of the "declare the app, then register the middleware on the
89
+ * next line" frameworks (Express, Fastify, Hono, NestJS).
90
+ */
91
+ const registerAfterAppDeclaration = (code, { middlewareSource, findDeclaration, buildRegistration }) => {
92
+ if (code.includes(middlewareSource)) return {
93
+ code,
94
+ status: "already"
95
+ };
96
+ const ast = parseCode(code);
97
+ if (require_init_utils_astImports.isModuleScopeBinding(ast, MIDDLEWARE_IDENTIFIER)) return {
98
+ code,
99
+ status: "skipped"
100
+ };
101
+ const declaration = findDeclaration(ast);
102
+ if (!declaration) return {
103
+ code,
104
+ status: "skipped"
105
+ };
106
+ declaration.statementPath.insertAfter(parseStatement(buildRegistration(declaration.appName)));
107
+ ensureMiddlewareBinding(ast, middlewareSource);
108
+ return {
109
+ code: recast.print(ast).code,
110
+ status: "registered"
111
+ };
112
+ };
113
+ /**
114
+ * Registers `express-intlayer` right after `const app = express()`:
115
+ * `app.use(intlayer());`.
116
+ */
117
+ const registerExpressMiddleware = (code) => registerAfterAppDeclaration(code, {
118
+ middlewareSource: "express-intlayer",
119
+ findDeclaration: (ast) => {
120
+ const factoryNames = findFactoryLocalNames(ast, {
121
+ source: "express",
122
+ default: true
123
+ });
124
+ return findAppDeclaration(ast, (init) => isFactoryCall(init, factoryNames, "CallExpression"));
125
+ },
126
+ buildRegistration: (appName) => `${appName}.use(intlayer());`
127
+ });
128
+ /**
129
+ * Registers `fastify-intlayer` right after `const app = Fastify()`:
130
+ * `app.register(intlayer);`. Not awaited, so it also works in CommonJS and
131
+ * non-async scopes — Fastify queues plugins until `ready`/`listen`.
132
+ */
133
+ const registerFastifyPlugin = (code) => registerAfterAppDeclaration(code, {
134
+ middlewareSource: "fastify-intlayer",
135
+ findDeclaration: (ast) => {
136
+ const factoryNames = findFactoryLocalNames(ast, {
137
+ source: "fastify",
138
+ default: true,
139
+ named: ["fastify", "Fastify"]
140
+ });
141
+ return findAppDeclaration(ast, (init) => isFactoryCall(init, factoryNames, "CallExpression"));
142
+ },
143
+ buildRegistration: (appName) => `${appName}.register(intlayer);`
144
+ });
145
+ /**
146
+ * Registers `hono-intlayer` right after `const app = new Hono()`:
147
+ * `app.use("*", intlayer());`. A chained declaration
148
+ * (`new Hono().get(…)`) is skipped: its routes would be registered before the
149
+ * middleware, which Hono runs in registration order.
150
+ */
151
+ const registerHonoMiddleware = (code) => registerAfterAppDeclaration(code, {
152
+ middlewareSource: "hono-intlayer",
153
+ findDeclaration: (ast) => {
154
+ const factoryNames = findFactoryLocalNames(ast, {
155
+ source: "hono",
156
+ named: ["Hono"]
157
+ });
158
+ return findAppDeclaration(ast, (init) => isFactoryCall(init, factoryNames, "NewExpression"));
159
+ },
160
+ buildRegistration: (appName) => `${appName}.use("*", intlayer());`
161
+ });
162
+ /**
163
+ * Registers `express-intlayer` on a NestJS (Express platform) app right after
164
+ * `const app = await NestFactory.create(…)`: `app.use(intlayer());`.
165
+ */
166
+ const registerNestJsMiddleware = (code) => registerAfterAppDeclaration(code, {
167
+ middlewareSource: "express-intlayer",
168
+ findDeclaration: (ast) => findAppDeclaration(ast, (init) => {
169
+ const call = init.type === "AwaitExpression" ? init.argument : init;
170
+ return n.CallExpression.check(call) && n.MemberExpression.check(call.callee) && call.callee.object.name === "NestFactory" && call.callee.property.name === "create";
171
+ }),
172
+ buildRegistration: (appName) => `${appName}.use(intlayer());`
173
+ });
174
+ /**
175
+ * Registers `elysia-intlayer` directly on the app constructor:
176
+ * `new Elysia()` → `new Elysia().use(intlayer())`. Works for chained
177
+ * declarations too, and keeps the plugin ahead of every route.
178
+ */
179
+ const registerElysiaPlugin = (code) => {
180
+ const middlewareSource = "elysia-intlayer";
181
+ if (code.includes(middlewareSource)) return {
182
+ code,
183
+ status: "already"
184
+ };
185
+ const ast = parseCode(code);
186
+ if (require_init_utils_astImports.isModuleScopeBinding(ast, MIDDLEWARE_IDENTIFIER)) return {
187
+ code,
188
+ status: "skipped"
189
+ };
190
+ const factoryNames = findFactoryLocalNames(ast, {
191
+ source: "elysia",
192
+ named: ["Elysia"]
193
+ });
194
+ let registered = false;
195
+ recast.visit(ast, { visitNewExpression(path) {
196
+ if (registered) return false;
197
+ if (isFactoryCall(path.node, factoryNames, "NewExpression")) {
198
+ const withPlugin = parseStatement("__app__.use(intlayer());").expression;
199
+ withPlugin.callee.object = path.node;
200
+ path.replace(withPlugin);
201
+ registered = true;
202
+ return false;
203
+ }
204
+ this.traverse(path);
205
+ } });
206
+ if (!registered) return {
207
+ code,
208
+ status: "skipped"
209
+ };
210
+ ensureMiddlewareBinding(ast, middlewareSource);
211
+ return {
212
+ code: recast.print(ast).code,
213
+ status: "registered"
214
+ };
215
+ };
216
+
217
+ //#endregion
218
+ exports.registerElysiaPlugin = registerElysiaPlugin;
219
+ exports.registerExpressMiddleware = registerExpressMiddleware;
220
+ exports.registerFastifyPlugin = registerFastifyPlugin;
221
+ exports.registerHonoMiddleware = registerHonoMiddleware;
222
+ exports.registerNestJsMiddleware = registerNestJsMiddleware;
223
+ //# sourceMappingURL=transforms.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transforms.cjs","names":["babelTsParser","isModuleScopeBinding"],"sources":["../../../../../src/init/frameworkSetup/backend/transforms.ts"],"sourcesContent":["import * as recast from 'recast';\nimport { babelTsParser } from '../../../utils/babelParser';\nimport {\n ensureNamedImport,\n isModuleScopeBinding,\n} from '../../utils/astImports';\n\nconst { namedTypes: n } = recast.types;\n\n/** Local name the injected middleware / plugin factory is bound to. */\nconst MIDDLEWARE_IDENTIFIER = 'intlayer';\n\n/** babel-ts parser handles TypeScript *and* plain JavaScript. */\nconst parseCode = (code: string): any =>\n recast.parse(code, { parser: babelTsParser });\n\n/** Parses a single statement. */\nconst parseStatement = (code: string): any => parseCode(code).program.body[0];\n\n/** Result of a backend transform. `code` is unchanged for any non-`registered` status. */\nexport type BackendTransformResult = {\n code: string;\n status: 'registered' | 'already' | 'skipped';\n};\n\n/** How a server framework exposes its app factory. */\ntype FactoryImport = {\n /** Module the factory is imported from, e.g. `express`. */\n source: string;\n /** Accepted forms: the default export, and/or these named exports. */\n default?: boolean;\n named?: string[];\n};\n\n/** Whether `node` is a `require(\"<source>\")` call. */\nconst isRequireOf = (node: any, source: string): boolean =>\n node?.type === 'CallExpression' &&\n node.callee?.type === 'Identifier' &&\n node.callee.name === 'require' &&\n node.arguments[0]?.value === source;\n\n/**\n * Resolves the local names a factory is bound to at module scope, from ESM\n * imports (`import express from \"express\"`, `import { Hono } from \"hono\"`) or\n * CommonJS requires (`const express = require(\"express\")`,\n * `const { Hono } = require(\"hono\")`).\n */\nconst findFactoryLocalNames = (ast: any, factory: FactoryImport): string[] => {\n const localNames: string[] = [];\n const acceptsNamed = (name: string): boolean =>\n factory.named?.includes(name) ?? false;\n\n for (const statement of ast.program.body) {\n if (\n statement.type === 'ImportDeclaration' &&\n statement.source.value === factory.source\n ) {\n for (const specifier of statement.specifiers) {\n const isAcceptedDefault =\n specifier.type === 'ImportDefaultSpecifier' && factory.default;\n const isAcceptedNamed =\n specifier.type === 'ImportSpecifier' &&\n acceptsNamed(specifier.imported.name);\n if (isAcceptedDefault || isAcceptedNamed) {\n localNames.push(specifier.local.name);\n }\n }\n }\n\n if (statement.type !== 'VariableDeclaration') continue;\n\n for (const declarator of statement.declarations) {\n if (!isRequireOf(declarator.init, factory.source)) continue;\n\n if (declarator.id.type === 'Identifier' && factory.default) {\n localNames.push(declarator.id.name);\n }\n if (declarator.id.type === 'ObjectPattern') {\n for (const property of declarator.id.properties) {\n if (\n property.key?.type === 'Identifier' &&\n property.value?.type === 'Identifier' &&\n acceptsNamed(property.key.name)\n ) {\n localNames.push(property.value.name);\n }\n }\n }\n }\n }\n\n return localNames;\n};\n\n/** Whether the module uses CommonJS (`require`) rather than ESM imports. */\nconst isCommonJsModule = (ast: any): boolean =>\n !ast.program.body.some(\n (statement: any) =>\n statement.type === 'ImportDeclaration' ||\n statement.type === 'ExportNamedDeclaration' ||\n statement.type === 'ExportDefaultDeclaration'\n ) &&\n ast.program.body.some(\n (statement: any) =>\n statement.type === 'VariableDeclaration' &&\n statement.declarations.some(\n (declarator: any) =>\n declarator.init?.type === 'CallExpression' &&\n declarator.init.callee?.name === 'require'\n )\n );\n\n/**\n * Binds `intlayer` from `source`: an ESM named import, or — in a CommonJS\n * module — `const { intlayer } = require(\"<source>\");` placed after the last\n * top-level `require`.\n */\nconst ensureMiddlewareBinding = (ast: any, source: string): void => {\n if (!isCommonJsModule(ast)) {\n ensureNamedImport(ast, MIDDLEWARE_IDENTIFIER, source);\n return;\n }\n\n const body = ast.program.body;\n let insertIndex = 0;\n body.forEach((statement: any, index: number) => {\n const isRequireDeclaration =\n statement.type === 'VariableDeclaration' &&\n statement.declarations.some(\n (declarator: any) => declarator.init?.callee?.name === 'require'\n );\n if (isRequireDeclaration) insertIndex = index + 1;\n });\n\n body.splice(\n insertIndex,\n 0,\n parseStatement(`const { ${MIDDLEWARE_IDENTIFIER} } = require(\"${source}\");`)\n );\n};\n\n/**\n * Finds the first `const <app> = <init>` whose initializer matches, returning\n * the app identifier and the statement path to insert after. `export const`\n * declarations resolve to the export statement.\n */\nconst findAppDeclaration = (\n ast: any,\n matchesInit: (init: any) => boolean\n): { appName: string; statementPath: any } | null => {\n let found: { appName: string; statementPath: any } | null = null;\n\n recast.visit(ast, {\n visitVariableDeclarator(path) {\n const { id, init } = path.node as any;\n if (!found && id.type === 'Identifier' && init && matchesInit(init)) {\n let statementPath = path.parent;\n if (statementPath.parent?.node.type === 'ExportNamedDeclaration') {\n statementPath = statementPath.parent;\n }\n found = { appName: id.name, statementPath };\n return false;\n }\n this.traverse(path);\n },\n });\n\n return found;\n};\n\n/** Whether `node` calls one of `calleeNames` directly (`express()`, `new Hono()`). */\nconst isFactoryCall = (\n node: any,\n calleeNames: string[],\n type: 'CallExpression' | 'NewExpression'\n): boolean =>\n node?.type === type &&\n node.callee?.type === 'Identifier' &&\n calleeNames.includes(node.callee.name);\n\n/**\n * Shared flow of the \"declare the app, then register the middleware on the\n * next line\" frameworks (Express, Fastify, Hono, NestJS).\n */\nconst registerAfterAppDeclaration = (\n code: string,\n {\n middlewareSource,\n findDeclaration,\n buildRegistration,\n }: {\n middlewareSource: string;\n findDeclaration: (ast: any) => ReturnType<typeof findAppDeclaration>;\n buildRegistration: (appName: string) => string;\n }\n): BackendTransformResult => {\n if (code.includes(middlewareSource)) return { code, status: 'already' };\n\n const ast = parseCode(code);\n if (isModuleScopeBinding(ast, MIDDLEWARE_IDENTIFIER)) {\n return { code, status: 'skipped' };\n }\n\n const declaration = findDeclaration(ast);\n if (!declaration) return { code, status: 'skipped' };\n\n declaration.statementPath.insertAfter(\n parseStatement(buildRegistration(declaration.appName))\n );\n ensureMiddlewareBinding(ast, middlewareSource);\n\n return { code: recast.print(ast).code, status: 'registered' };\n};\n\n/**\n * Registers `express-intlayer` right after `const app = express()`:\n * `app.use(intlayer());`.\n */\nexport const registerExpressMiddleware = (\n code: string\n): BackendTransformResult =>\n registerAfterAppDeclaration(code, {\n middlewareSource: 'express-intlayer',\n findDeclaration: (ast) => {\n const factoryNames = findFactoryLocalNames(ast, {\n source: 'express',\n default: true,\n });\n return findAppDeclaration(ast, (init) =>\n isFactoryCall(init, factoryNames, 'CallExpression')\n );\n },\n buildRegistration: (appName) => `${appName}.use(intlayer());`,\n });\n\n/**\n * Registers `fastify-intlayer` right after `const app = Fastify()`:\n * `app.register(intlayer);`. Not awaited, so it also works in CommonJS and\n * non-async scopes — Fastify queues plugins until `ready`/`listen`.\n */\nexport const registerFastifyPlugin = (code: string): BackendTransformResult =>\n registerAfterAppDeclaration(code, {\n middlewareSource: 'fastify-intlayer',\n findDeclaration: (ast) => {\n const factoryNames = findFactoryLocalNames(ast, {\n source: 'fastify',\n default: true,\n named: ['fastify', 'Fastify'],\n });\n return findAppDeclaration(ast, (init) =>\n isFactoryCall(init, factoryNames, 'CallExpression')\n );\n },\n buildRegistration: (appName) => `${appName}.register(intlayer);`,\n });\n\n/**\n * Registers `hono-intlayer` right after `const app = new Hono()`:\n * `app.use(\"*\", intlayer());`. A chained declaration\n * (`new Hono().get(…)`) is skipped: its routes would be registered before the\n * middleware, which Hono runs in registration order.\n */\nexport const registerHonoMiddleware = (code: string): BackendTransformResult =>\n registerAfterAppDeclaration(code, {\n middlewareSource: 'hono-intlayer',\n findDeclaration: (ast) => {\n const factoryNames = findFactoryLocalNames(ast, {\n source: 'hono',\n named: ['Hono'],\n });\n return findAppDeclaration(ast, (init) =>\n isFactoryCall(init, factoryNames, 'NewExpression')\n );\n },\n buildRegistration: (appName) => `${appName}.use(\"*\", intlayer());`,\n });\n\n/**\n * Registers `express-intlayer` on a NestJS (Express platform) app right after\n * `const app = await NestFactory.create(…)`: `app.use(intlayer());`.\n */\nexport const registerNestJsMiddleware = (\n code: string\n): BackendTransformResult =>\n registerAfterAppDeclaration(code, {\n middlewareSource: 'express-intlayer',\n findDeclaration: (ast) =>\n findAppDeclaration(ast, (init) => {\n const call = init.type === 'AwaitExpression' ? init.argument : init;\n return (\n n.CallExpression.check(call) &&\n n.MemberExpression.check(call.callee) &&\n (call.callee.object as any).name === 'NestFactory' &&\n (call.callee.property as any).name === 'create'\n );\n }),\n buildRegistration: (appName) => `${appName}.use(intlayer());`,\n });\n\n/**\n * Registers `elysia-intlayer` directly on the app constructor:\n * `new Elysia()` → `new Elysia().use(intlayer())`. Works for chained\n * declarations too, and keeps the plugin ahead of every route.\n */\nexport const registerElysiaPlugin = (code: string): BackendTransformResult => {\n const middlewareSource = 'elysia-intlayer';\n if (code.includes(middlewareSource)) return { code, status: 'already' };\n\n const ast = parseCode(code);\n if (isModuleScopeBinding(ast, MIDDLEWARE_IDENTIFIER)) {\n return { code, status: 'skipped' };\n }\n\n const factoryNames = findFactoryLocalNames(ast, {\n source: 'elysia',\n named: ['Elysia'],\n });\n\n let registered = false;\n recast.visit(ast, {\n visitNewExpression(path) {\n if (registered) return false;\n if (isFactoryCall(path.node, factoryNames, 'NewExpression')) {\n const withPlugin = parseStatement(\n '__app__.use(intlayer());'\n ).expression;\n withPlugin.callee.object = path.node;\n path.replace(withPlugin);\n registered = true;\n return false;\n }\n this.traverse(path);\n },\n });\n\n if (!registered) return { code, status: 'skipped' };\n\n ensureMiddlewareBinding(ast, middlewareSource);\n\n return { code: recast.print(ast).code, status: 'registered' };\n};\n"],"mappings":";;;;;;;;AAOA,MAAM,EAAE,YAAY,MAAM,OAAO;;AAGjC,MAAM,wBAAwB;;AAG9B,MAAM,aAAa,SACjB,OAAO,MAAM,MAAM,EAAE,QAAQA,wCAAc,CAAC;;AAG9C,MAAM,kBAAkB,SAAsB,UAAU,IAAI,CAAC,CAAC,QAAQ,KAAK;;AAkB3E,MAAM,eAAe,MAAW,WAC9B,MAAM,SAAS,oBACf,KAAK,QAAQ,SAAS,gBACtB,KAAK,OAAO,SAAS,aACrB,KAAK,UAAU,EAAE,EAAE,UAAU;;;;;;;AAQ/B,MAAM,yBAAyB,KAAU,YAA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AC7C,CAAC;;;;;;AAOH,MAAa,wBAAwB,SAAyC;CAC5E,MAAM,mBAAmB;CACzB,IAAI,KAAK,SAAS,gBAAgB,GAAG,OAAO;EAAE;EAAM,QAAQ;CAAU;CAEtE,MAAM,MAAM,UAAU,IAAI;CAC1B,IAAIA,mDAAqB,KAAK,qBAAqB,GACjD,OAAO;EAAE;EAAM,QAAQ;CAAU;CAGnC,MAAM,eAAe,sBAAsB,KAAK;EAC9C,QAAQ;EACR,OAAO,CAAC,QAAQ;CAClB,CAAC;CAED,IAAI,aAAa;CACjB,OAAO,MAAM,KAAK,EAChB,mBAAmB,MAAM;EACvB,IAAI,YAAY,OAAO;EACvB,IAAI,cAAc,KAAK,MAAM,cAAc,eAAe,GAAG;GAC3D,MAAM,aAAa,eACjB,0BACF,CAAC,CAAC;GACF,WAAW,OAAO,SAAS,KAAK;GAChC,KAAK,QAAQ,UAAU;GACvB,aAAa;GACb,OAAO;EACT;EACA,KAAK,SAAS,IAAI;CACpB,EACF,CAAC;CAED,IAAI,CAAC,YAAY,OAAO;EAAE;EAAM,QAAQ;CAAU;CAElD,wBAAwB,KAAK,gBAAgB;CAE7C,OAAO;EAAE,MAAM,OAAO,MAAM,GAAG,CAAC,CAAC;EAAM,QAAQ;CAAa;AAC9D"}
@@ -1,14 +1,20 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_init_frameworkSetup_backend_index = require('./backend/index.cjs');
2
3
  const require_init_frameworkSetup_nextAppRouter_index = require('./nextAppRouter/index.cjs');
3
4
  const require_init_frameworkSetup_tanstackStart_index = require('./tanstackStart/index.cjs');
4
5
 
5
6
  //#region src/init/frameworkSetup/index.ts
6
7
  /**
7
8
  * Registered framework adapters, tried in order. The first one whose `detect`
8
- * returns true handles the project. Add new adapters (Nuxt, Vite + React, …)
9
- * here as they are implemented.
9
+ * returns true handles the project. Frontend adapters come first, so an app
10
+ * with its own server keeps its frontend scaffolding. Add new adapters (Nuxt,
11
+ * Vite + React, …) here as they are implemented.
10
12
  */
11
- const adapters = [require_init_frameworkSetup_nextAppRouter_index.nextAppRouterAdapter, require_init_frameworkSetup_tanstackStart_index.tanStackStartAdapter];
13
+ const adapters = [
14
+ require_init_frameworkSetup_nextAppRouter_index.nextAppRouterAdapter,
15
+ require_init_frameworkSetup_tanstackStart_index.tanStackStartAdapter,
16
+ ...require_init_frameworkSetup_backend_index.backendAdapters
17
+ ];
12
18
  /**
13
19
  * Runs framework-specific scaffolding (middleware/proxy, providers in
14
20
  * layout/page, example content) for the first adapter that matches the project.
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["nextAppRouterAdapter","tanStackStartAdapter"],"sources":["../../../../src/init/frameworkSetup/index.ts"],"sourcesContent":["import { nextAppRouterAdapter } from './nextAppRouter';\nimport { tanStackStartAdapter } from './tanstackStart';\nimport type { FrameworkAdapter, FrameworkSetupContext } from './types';\n\nexport type { FrameworkAdapter, FrameworkSetupContext } from './types';\n\n/**\n * Registered framework adapters, tried in order. The first one whose `detect`\n * returns true handles the project. Add new adapters (Nuxt, Vite + React, …)\n * here as they are implemented.\n */\nconst adapters: FrameworkAdapter[] = [\n nextAppRouterAdapter,\n tanStackStartAdapter,\n];\n\n/**\n * Runs framework-specific scaffolding (middleware/proxy, providers in\n * layout/page, example content) for the first adapter that matches the project.\n * No-ops when no adapter recognizes the project. Each adapter is idempotent and\n * non-destructive, so this is safe to run on existing applications.\n */\nexport const setupFramework = async (\n context: FrameworkSetupContext\n): Promise<void> => {\n for (const adapter of adapters) {\n if (await adapter.detect(context)) {\n await adapter.setup(context);\n return;\n }\n }\n};\n"],"mappings":";;;;;;;;;;AAWA,MAAM,WAA+B,CACnCA,sEACAC,oEACF;;;;;;;AAQA,MAAa,iBAAiB,OAC5B,YACkB;CAClB,KAAK,MAAM,WAAW,UACpB,IAAI,MAAM,QAAQ,OAAO,OAAO,GAAG;EACjC,MAAM,QAAQ,MAAM,OAAO;EAC3B;CACF;AAEJ"}
1
+ {"version":3,"file":"index.cjs","names":["nextAppRouterAdapter","tanStackStartAdapter","backendAdapters"],"sources":["../../../../src/init/frameworkSetup/index.ts"],"sourcesContent":["import { backendAdapters } from './backend';\nimport { nextAppRouterAdapter } from './nextAppRouter';\nimport { tanStackStartAdapter } from './tanstackStart';\nimport type { FrameworkAdapter, FrameworkSetupContext } from './types';\n\nexport type { FrameworkAdapter, FrameworkSetupContext } from './types';\n\n/**\n * Registered framework adapters, tried in order. The first one whose `detect`\n * returns true handles the project. Frontend adapters come first, so an app\n * with its own server keeps its frontend scaffolding. Add new adapters (Nuxt,\n * Vite + React, …) here as they are implemented.\n */\nconst adapters: FrameworkAdapter[] = [\n nextAppRouterAdapter,\n tanStackStartAdapter,\n ...backendAdapters,\n];\n\n/**\n * Runs framework-specific scaffolding (middleware/proxy, providers in\n * layout/page, example content) for the first adapter that matches the project.\n * No-ops when no adapter recognizes the project. Each adapter is idempotent and\n * non-destructive, so this is safe to run on existing applications.\n */\nexport const setupFramework = async (\n context: FrameworkSetupContext\n): Promise<void> => {\n for (const adapter of adapters) {\n if (await adapter.detect(context)) {\n await adapter.setup(context);\n return;\n }\n }\n};\n"],"mappings":";;;;;;;;;;;;AAaA,MAAM,WAA+B;CACnCA;CACAC;CACA,GAAGC;AACL;;;;;;;AAQA,MAAa,iBAAiB,OAC5B,YACkB;CAClB,KAAK,MAAM,WAAW,UACpB,IAAI,MAAM,QAAQ,OAAO,OAAO,GAAG;EACjC,MAAM,QAAQ,MAAM,OAAO;EAC3B;CACF;AAEJ"}