@modern-js/app-tools 2.4.0 → 2.5.0

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 (302) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/{js/node → cjs}/analyze/constants.js +0 -0
  3. package/dist/cjs/analyze/generateCode.js +249 -0
  4. package/dist/{js/node → cjs}/analyze/getBundleEntry.js +6 -0
  5. package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutes.js +1 -18
  6. package/dist/{js/node → cjs}/analyze/getClientRoutes/getRoutesLegacy.js +1 -18
  7. package/dist/{js/node → cjs}/analyze/getClientRoutes/index.js +0 -0
  8. package/dist/{js/node → cjs}/analyze/getClientRoutes/utils.js +0 -0
  9. package/dist/{js/node → cjs}/analyze/getFileSystemEntry.js +0 -0
  10. package/dist/{js/node → cjs}/analyze/getHtmlTemplate.js +4 -24
  11. package/dist/{js/node → cjs}/analyze/getServerRoutes.js +22 -42
  12. package/dist/cjs/analyze/index.js +290 -0
  13. package/dist/{js/node → cjs}/analyze/isDefaultExportFunction.js +0 -0
  14. package/dist/{js/node → cjs}/analyze/makeLegalIdentifier.js +0 -0
  15. package/dist/{js/node → cjs}/analyze/nestedRoutes.js +16 -50
  16. package/dist/{js/node → cjs}/analyze/templates.js +16 -49
  17. package/dist/{js/node → cjs}/analyze/utils.js +9 -29
  18. package/dist/{js/node → cjs}/builder/builder-rspack/index.js +0 -0
  19. package/dist/{js/node → cjs}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
  20. package/dist/{js/node → cjs}/builder/builder-webpack/index.js +22 -62
  21. package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
  22. package/dist/{js/node → cjs}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  23. package/dist/{js/node → cjs}/builder/generator/createBuilderOptions.js +0 -0
  24. package/dist/{js/node → cjs}/builder/generator/createBuilderProviderConfig.js +14 -25
  25. package/dist/{js/node → cjs}/builder/generator/getBuilderTargets.js +4 -0
  26. package/dist/cjs/builder/generator/index.js +58 -0
  27. package/dist/{js/node → cjs}/builder/index.js +12 -34
  28. package/dist/{js/node → cjs}/builder/shared/builderPlugins/adapterModern.js +35 -34
  29. package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  30. package/dist/{js/node → cjs}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
  31. package/dist/{js/node → cjs}/builder/shared/createCopyPattern.js +0 -0
  32. package/dist/{js/node → cjs}/builder/shared/index.js +0 -0
  33. package/dist/{js/node → cjs}/builder/shared/loaders/serverModuleLoader.js +0 -0
  34. package/dist/{js/node → cjs}/builder/shared/types.js +0 -0
  35. package/dist/{js/node → cjs}/commands/build.js +9 -46
  36. package/dist/cjs/commands/deploy.js +31 -0
  37. package/dist/{js/node → cjs}/commands/dev.js +17 -52
  38. package/dist/{js/node → cjs}/commands/index.js +0 -0
  39. package/dist/{js/node → cjs}/commands/inspect.js +2 -22
  40. package/dist/{js/node → cjs}/commands/serve.js +8 -28
  41. package/dist/{js/node → cjs}/config/default.js +15 -26
  42. package/dist/{js/node → cjs}/config/index.js +0 -0
  43. package/dist/{js/node → cjs}/config/initialize/index.js +0 -0
  44. package/dist/{js/node → cjs}/config/initialize/inits.js +4 -20
  45. package/dist/{js/node → cjs}/config/legacy/createHtmlConfig.js +0 -0
  46. package/dist/{js/node → cjs}/config/legacy/createOutputConfig.js +0 -0
  47. package/dist/{js/node → cjs}/config/legacy/createSourceConfig.js +0 -0
  48. package/dist/{js/node → cjs}/config/legacy/createToolsConfig.js +0 -0
  49. package/dist/{js/node → cjs}/config/legacy/index.js +0 -0
  50. package/dist/cjs/defineConfig.js +33 -0
  51. package/dist/{js/node → cjs}/exports/server.js +0 -0
  52. package/dist/{js/node → cjs}/hooks.js +0 -0
  53. package/dist/cjs/index.js +198 -0
  54. package/dist/cjs/initialize/index.js +102 -0
  55. package/dist/{js/node → cjs}/locale/en.js +0 -0
  56. package/dist/{js/node → cjs}/locale/index.js +0 -0
  57. package/dist/{js/node → cjs}/locale/zh.js +0 -0
  58. package/dist/{js/node → cjs}/schema/Schema.js +0 -0
  59. package/dist/{js/node → cjs}/schema/index.js +0 -0
  60. package/dist/{js/node → cjs}/schema/legacy.js +0 -0
  61. package/dist/{js/node → cjs}/types/config/deploy.js +0 -0
  62. package/dist/{js/node → cjs}/types/config/dev.js +0 -0
  63. package/dist/{js/node → cjs}/types/config/experiments.js +0 -0
  64. package/dist/{js/node → cjs}/types/config/html.js +0 -0
  65. package/dist/{js/node → cjs}/types/config/index.js +0 -0
  66. package/dist/{js/node → cjs}/types/config/output.js +0 -0
  67. package/dist/{js/node → cjs}/types/config/performance.js +0 -0
  68. package/dist/{js/node → cjs}/types/config/security.js +0 -0
  69. package/dist/{js/node → cjs}/types/config/source.js +0 -0
  70. package/dist/{js/node → cjs}/types/config/tools.js +0 -0
  71. package/dist/{js/node → cjs}/types/hooks.js +0 -0
  72. package/dist/{js/node → cjs}/types/index.js +0 -0
  73. package/dist/{js/node → cjs}/types/legacyConfig/deploy.js +0 -0
  74. package/dist/{js/node → cjs}/types/legacyConfig/dev.js +0 -0
  75. package/dist/{js/node → cjs}/types/legacyConfig/index.js +0 -0
  76. package/dist/{js/node → cjs}/types/legacyConfig/output.js +0 -0
  77. package/dist/{js/node → cjs}/types/legacyConfig/source.js +0 -0
  78. package/dist/{js/node → cjs}/types/legacyConfig/tools.js +0 -0
  79. package/dist/{js/node → cjs}/types/utils.js +0 -0
  80. package/dist/{js/node → cjs}/utils/config.js +19 -57
  81. package/dist/{js/node → cjs}/utils/createServer.js +10 -46
  82. package/dist/{js/node → cjs}/utils/env.js +0 -0
  83. package/dist/{js/node → cjs}/utils/generateWatchFiles.js +16 -38
  84. package/dist/{js/node → cjs}/utils/getSelectedEntries.js +3 -23
  85. package/dist/cjs/utils/getServerInternalPlugins.js +41 -0
  86. package/dist/{js/node → cjs}/utils/language.js +0 -0
  87. package/dist/{js/node → cjs}/utils/printInstructions.js +3 -23
  88. package/dist/cjs/utils/restart.js +45 -0
  89. package/dist/{js/node → cjs}/utils/routes.js +3 -23
  90. package/dist/{js/node → cjs}/utils/types.js +0 -0
  91. package/dist/{js/treeshaking → esm}/analyze/constants.js +0 -0
  92. package/dist/{js/treeshaking → esm}/analyze/generateCode.js +14 -14
  93. package/dist/{js/treeshaking → esm}/analyze/getBundleEntry.js +4 -2
  94. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutes.js +1 -1
  95. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/getRoutesLegacy.js +1 -1
  96. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/index.js +0 -0
  97. package/dist/{js/treeshaking → esm}/analyze/getClientRoutes/utils.js +0 -0
  98. package/dist/{js/treeshaking → esm}/analyze/getFileSystemEntry.js +1 -1
  99. package/dist/{js/treeshaking → esm}/analyze/getHtmlTemplate.js +0 -0
  100. package/dist/{js/treeshaking → esm}/analyze/getServerRoutes.js +8 -6
  101. package/dist/{js/treeshaking → esm}/analyze/index.js +8 -8
  102. package/dist/{js/treeshaking → esm}/analyze/isDefaultExportFunction.js +0 -0
  103. package/dist/{js/treeshaking → esm}/analyze/makeLegalIdentifier.js +0 -0
  104. package/dist/{js/treeshaking → esm}/analyze/nestedRoutes.js +5 -5
  105. package/dist/{js/treeshaking → esm}/analyze/templates.js +8 -7
  106. package/dist/{js/treeshaking → esm}/analyze/utils.js +3 -3
  107. package/dist/{js/treeshaking → esm}/builder/builder-rspack/index.js +0 -0
  108. package/dist/{js/treeshaking → esm}/builder/builder-webpack/builderPlugins/compatModern.js +4 -4
  109. package/dist/{js/treeshaking → esm}/builder/builder-webpack/index.js +2 -2
  110. package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +5 -2
  111. package/dist/{js/treeshaking → esm}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  112. package/dist/{js/treeshaking → esm}/builder/generator/createBuilderOptions.js +2 -2
  113. package/dist/{js/treeshaking → esm}/builder/generator/createBuilderProviderConfig.js +0 -0
  114. package/dist/{js/treeshaking → esm}/builder/generator/getBuilderTargets.js +5 -1
  115. package/dist/{js/treeshaking → esm}/builder/generator/index.js +2 -2
  116. package/dist/{js/treeshaking → esm}/builder/index.js +0 -0
  117. package/dist/{js/treeshaking → esm}/builder/shared/builderPlugins/adapterModern.js +62 -13
  118. package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  119. package/dist/{js/treeshaking → esm}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +2 -2
  120. package/dist/{js/treeshaking → esm}/builder/shared/createCopyPattern.js +0 -0
  121. package/dist/{js/treeshaking → esm}/builder/shared/index.js +0 -0
  122. package/dist/{js/treeshaking → esm}/builder/shared/loaders/serverModuleLoader.js +0 -0
  123. package/dist/{js/treeshaking → esm}/builder/shared/types.js +0 -0
  124. package/dist/{js/treeshaking → esm}/commands/build.js +0 -0
  125. package/dist/{js/treeshaking → esm}/commands/deploy.js +0 -0
  126. package/dist/{js/treeshaking → esm}/commands/dev.js +2 -2
  127. package/dist/{js/treeshaking → esm}/commands/index.js +0 -0
  128. package/dist/{js/treeshaking → esm}/commands/inspect.js +0 -0
  129. package/dist/{js/treeshaking → esm}/commands/serve.js +2 -2
  130. package/dist/{js/treeshaking → esm}/config/default.js +0 -0
  131. package/dist/{js/treeshaking → esm}/config/index.js +0 -0
  132. package/dist/{js/treeshaking → esm}/config/initialize/index.js +0 -0
  133. package/dist/{js/treeshaking → esm}/config/initialize/inits.js +2 -2
  134. package/dist/esm/config/legacy/createHtmlConfig.js +19 -0
  135. package/dist/{js/treeshaking → esm}/config/legacy/createOutputConfig.js +1 -1
  136. package/dist/{js/treeshaking → esm}/config/legacy/createSourceConfig.js +1 -1
  137. package/dist/{js/treeshaking → esm}/config/legacy/createToolsConfig.js +1 -1
  138. package/dist/{js/treeshaking → esm}/config/legacy/index.js +0 -0
  139. package/dist/{js/treeshaking → esm}/defineConfig.js +0 -0
  140. package/dist/{js/treeshaking → esm}/exports/server.js +0 -0
  141. package/dist/{js/treeshaking → esm}/hooks.js +0 -0
  142. package/dist/{js/treeshaking → esm}/index.js +0 -0
  143. package/dist/{js/treeshaking → esm}/initialize/index.js +2 -2
  144. package/dist/{js/treeshaking → esm}/locale/en.js +0 -0
  145. package/dist/{js/treeshaking → esm}/locale/index.js +0 -0
  146. package/dist/{js/treeshaking → esm}/locale/zh.js +0 -0
  147. package/dist/{js/treeshaking → esm}/schema/Schema.js +0 -0
  148. package/dist/{js/treeshaking → esm}/schema/index.js +0 -0
  149. package/dist/{js/treeshaking → esm}/schema/legacy.js +0 -0
  150. package/dist/{js/treeshaking → esm}/types/config/deploy.js +0 -0
  151. package/dist/{js/treeshaking → esm}/types/config/dev.js +0 -0
  152. package/dist/{js/treeshaking → esm}/types/config/experiments.js +0 -0
  153. package/dist/{js/treeshaking → esm}/types/config/html.js +0 -0
  154. package/dist/{js/treeshaking → esm}/types/config/index.js +0 -0
  155. package/dist/{js/treeshaking → esm}/types/config/output.js +0 -0
  156. package/dist/{js/treeshaking → esm}/types/config/performance.js +0 -0
  157. package/dist/{js/treeshaking → esm}/types/config/security.js +0 -0
  158. package/dist/{js/treeshaking → esm}/types/config/source.js +0 -0
  159. package/dist/{js/treeshaking → esm}/types/config/tools.js +0 -0
  160. package/dist/{js/treeshaking → esm}/types/hooks.js +0 -0
  161. package/dist/{js/treeshaking → esm}/types/index.js +0 -0
  162. package/dist/{js/treeshaking → esm}/types/legacyConfig/deploy.js +0 -0
  163. package/dist/{js/treeshaking → esm}/types/legacyConfig/dev.js +0 -0
  164. package/dist/{js/treeshaking → esm}/types/legacyConfig/index.js +0 -0
  165. package/dist/{js/treeshaking → esm}/types/legacyConfig/output.js +0 -0
  166. package/dist/{js/treeshaking → esm}/types/legacyConfig/source.js +0 -0
  167. package/dist/{js/treeshaking → esm}/types/legacyConfig/tools.js +0 -0
  168. package/dist/{js/treeshaking → esm}/types/utils.js +0 -0
  169. package/dist/{js/treeshaking → esm}/utils/config.js +2 -2
  170. package/dist/{js/treeshaking → esm}/utils/createServer.js +0 -0
  171. package/dist/{js/treeshaking → esm}/utils/env.js +0 -0
  172. package/dist/{js/treeshaking → esm}/utils/generateWatchFiles.js +0 -0
  173. package/dist/{js/treeshaking → esm}/utils/getSelectedEntries.js +0 -0
  174. package/dist/{js/treeshaking → esm}/utils/getServerInternalPlugins.js +2 -2
  175. package/dist/{js/treeshaking → esm}/utils/language.js +0 -0
  176. package/dist/{js/treeshaking → esm}/utils/printInstructions.js +0 -0
  177. package/dist/{js/treeshaking → esm}/utils/restart.js +0 -0
  178. package/dist/{js/treeshaking → esm}/utils/routes.js +0 -0
  179. package/dist/{js/treeshaking → esm}/utils/types.js +0 -0
  180. package/dist/{js/modern → esm-node}/analyze/constants.js +0 -0
  181. package/dist/esm-node/analyze/generateCode.js +225 -0
  182. package/dist/{js/modern → esm-node}/analyze/getBundleEntry.js +6 -0
  183. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutes.js +1 -20
  184. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/getRoutesLegacy.js +1 -20
  185. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/index.js +0 -0
  186. package/dist/{js/modern → esm-node}/analyze/getClientRoutes/utils.js +0 -0
  187. package/dist/{js/modern → esm-node}/analyze/getFileSystemEntry.js +0 -0
  188. package/dist/{js/modern → esm-node}/analyze/getHtmlTemplate.js +4 -24
  189. package/dist/{js/modern → esm-node}/analyze/getServerRoutes.js +24 -45
  190. package/dist/esm-node/analyze/index.js +281 -0
  191. package/dist/{js/modern → esm-node}/analyze/isDefaultExportFunction.js +0 -0
  192. package/dist/{js/modern → esm-node}/analyze/makeLegalIdentifier.js +0 -0
  193. package/dist/{js/modern → esm-node}/analyze/nestedRoutes.js +16 -52
  194. package/dist/{js/modern → esm-node}/analyze/templates.js +16 -51
  195. package/dist/{js/modern → esm-node}/analyze/utils.js +9 -29
  196. package/dist/{js/modern → esm-node}/builder/builder-rspack/index.js +0 -0
  197. package/dist/{js/modern → esm-node}/builder/builder-webpack/builderPlugins/compatModern.js +0 -0
  198. package/dist/esm-node/builder/builder-webpack/index.js +51 -0
  199. package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/RouterPlugin.js +7 -24
  200. package/dist/{js/modern → esm-node}/builder/builder-webpack/webpackPlugins/index.js +0 -0
  201. package/dist/{js/modern → esm-node}/builder/generator/createBuilderOptions.js +0 -0
  202. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +26 -0
  203. package/dist/{js/modern → esm-node}/builder/generator/getBuilderTargets.js +10 -1
  204. package/dist/esm-node/builder/generator/index.js +29 -0
  205. package/dist/esm-node/builder/index.js +17 -0
  206. package/dist/{js/modern → esm-node}/builder/shared/builderPlugins/adapterModern.js +35 -36
  207. package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -0
  208. package/dist/{js/modern → esm-node}/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -0
  209. package/dist/{js/modern → esm-node}/builder/shared/createCopyPattern.js +0 -0
  210. package/dist/{js/modern → esm-node}/builder/shared/index.js +0 -0
  211. package/dist/{js/modern → esm-node}/builder/shared/loaders/serverModuleLoader.js +0 -0
  212. package/dist/{js/modern → esm-node}/builder/shared/types.js +0 -0
  213. package/dist/esm-node/commands/build.js +52 -0
  214. package/dist/esm-node/commands/deploy.js +8 -0
  215. package/dist/esm-node/commands/dev.js +72 -0
  216. package/dist/{js/modern → esm-node}/commands/index.js +0 -0
  217. package/dist/esm-node/commands/inspect.js +18 -0
  218. package/dist/{js/modern → esm-node}/commands/serve.js +8 -28
  219. package/dist/{js/modern → esm-node}/config/default.js +15 -28
  220. package/dist/{js/modern → esm-node}/config/index.js +0 -0
  221. package/dist/{js/modern → esm-node}/config/initialize/index.js +0 -0
  222. package/dist/{js/modern → esm-node}/config/initialize/inits.js +4 -22
  223. package/dist/{js/modern → esm-node}/config/legacy/createHtmlConfig.js +0 -0
  224. package/dist/{js/modern → esm-node}/config/legacy/createOutputConfig.js +0 -0
  225. package/dist/{js/modern → esm-node}/config/legacy/createSourceConfig.js +0 -0
  226. package/dist/{js/modern → esm-node}/config/legacy/createToolsConfig.js +0 -0
  227. package/dist/{js/modern → esm-node}/config/legacy/index.js +0 -0
  228. package/dist/esm-node/defineConfig.js +9 -0
  229. package/dist/{js/modern → esm-node}/exports/server.js +0 -0
  230. package/dist/{js/modern → esm-node}/hooks.js +0 -0
  231. package/dist/esm-node/index.js +172 -0
  232. package/dist/esm-node/initialize/index.js +91 -0
  233. package/dist/{js/modern → esm-node}/locale/en.js +0 -0
  234. package/dist/{js/modern → esm-node}/locale/index.js +0 -0
  235. package/dist/{js/modern → esm-node}/locale/zh.js +0 -0
  236. package/dist/{js/modern → esm-node}/schema/Schema.js +0 -0
  237. package/dist/{js/modern → esm-node}/schema/index.js +0 -0
  238. package/dist/{js/modern → esm-node}/schema/legacy.js +0 -0
  239. package/dist/{js/modern → esm-node}/types/config/deploy.js +0 -0
  240. package/dist/{js/modern → esm-node}/types/config/dev.js +0 -0
  241. package/dist/{js/modern → esm-node}/types/config/experiments.js +0 -0
  242. package/dist/{js/modern → esm-node}/types/config/html.js +0 -0
  243. package/dist/{js/modern → esm-node}/types/config/index.js +0 -0
  244. package/dist/{js/modern → esm-node}/types/config/output.js +0 -0
  245. package/dist/{js/modern → esm-node}/types/config/performance.js +0 -0
  246. package/dist/{js/modern → esm-node}/types/config/security.js +0 -0
  247. package/dist/{js/modern → esm-node}/types/config/source.js +0 -0
  248. package/dist/{js/modern → esm-node}/types/config/tools.js +0 -0
  249. package/dist/{js/modern → esm-node}/types/hooks.js +0 -0
  250. package/dist/{js/modern → esm-node}/types/index.js +0 -0
  251. package/dist/{js/modern → esm-node}/types/legacyConfig/deploy.js +0 -0
  252. package/dist/{js/modern → esm-node}/types/legacyConfig/dev.js +0 -0
  253. package/dist/{js/modern → esm-node}/types/legacyConfig/index.js +0 -0
  254. package/dist/{js/modern → esm-node}/types/legacyConfig/output.js +0 -0
  255. package/dist/{js/modern → esm-node}/types/legacyConfig/source.js +0 -0
  256. package/dist/{js/modern → esm-node}/types/legacyConfig/tools.js +0 -0
  257. package/dist/{js/modern → esm-node}/types/utils.js +0 -0
  258. package/dist/esm-node/utils/config.js +88 -0
  259. package/dist/esm-node/utils/createServer.js +37 -0
  260. package/dist/{js/modern → esm-node}/utils/env.js +0 -0
  261. package/dist/esm-node/utils/generateWatchFiles.js +33 -0
  262. package/dist/{js/modern → esm-node}/utils/getSelectedEntries.js +3 -23
  263. package/dist/esm-node/utils/getServerInternalPlugins.js +18 -0
  264. package/dist/{js/modern → esm-node}/utils/language.js +0 -0
  265. package/dist/esm-node/utils/printInstructions.js +11 -0
  266. package/dist/esm-node/utils/restart.js +22 -0
  267. package/dist/esm-node/utils/routes.js +10 -0
  268. package/dist/{js/modern → esm-node}/utils/types.js +0 -0
  269. package/dist/types/types/config/tools.d.ts +1 -1
  270. package/dist/types/types/hooks.d.ts +5 -4
  271. package/dist/types/types/index.d.ts +3 -1
  272. package/package.json +30 -31
  273. package/dist/js/modern/analyze/generateCode.js +0 -247
  274. package/dist/js/modern/analyze/index.js +0 -329
  275. package/dist/js/modern/builder/builder-webpack/index.js +0 -93
  276. package/dist/js/modern/builder/generator/createBuilderProviderConfig.js +0 -39
  277. package/dist/js/modern/builder/generator/index.js +0 -53
  278. package/dist/js/modern/builder/index.js +0 -39
  279. package/dist/js/modern/commands/build.js +0 -91
  280. package/dist/js/modern/commands/deploy.js +0 -28
  281. package/dist/js/modern/commands/dev.js +0 -109
  282. package/dist/js/modern/commands/inspect.js +0 -38
  283. package/dist/js/modern/defineConfig.js +0 -27
  284. package/dist/js/modern/index.js +0 -221
  285. package/dist/js/modern/initialize/index.js +0 -132
  286. package/dist/js/modern/utils/config.js +0 -128
  287. package/dist/js/modern/utils/createServer.js +0 -75
  288. package/dist/js/modern/utils/generateWatchFiles.js +0 -55
  289. package/dist/js/modern/utils/getServerInternalPlugins.js +0 -58
  290. package/dist/js/modern/utils/printInstructions.js +0 -31
  291. package/dist/js/modern/utils/restart.js +0 -44
  292. package/dist/js/modern/utils/routes.js +0 -30
  293. package/dist/js/node/analyze/generateCode.js +0 -271
  294. package/dist/js/node/analyze/index.js +0 -336
  295. package/dist/js/node/builder/generator/index.js +0 -82
  296. package/dist/js/node/commands/deploy.js +0 -51
  297. package/dist/js/node/defineConfig.js +0 -49
  298. package/dist/js/node/index.js +0 -245
  299. package/dist/js/node/initialize/index.js +0 -141
  300. package/dist/js/node/utils/getServerInternalPlugins.js +0 -79
  301. package/dist/js/node/utils/restart.js +0 -67
  302. package/dist/js/treeshaking/config/legacy/createHtmlConfig.js +0 -19
@@ -1,93 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
40
- import {
41
- builderWebpackProvider
42
- } from "@modern-js/builder-webpack-provider";
43
- import { applyOptionsChain } from "@modern-js/utils";
44
- import { createCopyPattern } from "../shared";
45
- import { generateBuilder } from "../generator";
46
- import { PluginCompatModern } from "./builderPlugins/compatModern";
47
- function createWebpackBuilderForModern(options) {
48
- return generateBuilder(options, builderWebpackProvider, {
49
- modifyBuilderConfig(config) {
50
- modifyOutputConfig(config, options.appContext);
51
- },
52
- modifyBuilderInstance(builder) {
53
- return __async(this, null, function* () {
54
- yield applyBuilderPlugins(builder, options);
55
- });
56
- }
57
- });
58
- }
59
- function modifyOutputConfig(config, appContext) {
60
- config.output = createOutputConfig(config, appContext);
61
- function createOutputConfig(config2, appContext2) {
62
- const defaultCopyPattern = createCopyPattern(appContext2, config2, "upload");
63
- const { copy } = config2.output;
64
- const copyOptions = Array.isArray(copy) ? copy : copy == null ? void 0 : copy.patterns;
65
- const builderCopy = [...copyOptions || [], defaultCopyPattern];
66
- return __spreadProps(__spreadValues({}, config2.output), {
67
- copy: builderCopy
68
- });
69
- }
70
- }
71
- function applyBuilderPlugins(builder, options) {
72
- return __async(this, null, function* () {
73
- const { normalizedConfig } = options;
74
- if (!normalizedConfig.output.disableNodePolyfill) {
75
- const { PluginNodePolyfill } = yield import("@modern-js/builder-plugin-node-polyfill");
76
- builder.addPlugins([PluginNodePolyfill()]);
77
- }
78
- if (normalizedConfig.tools.esbuild) {
79
- const { esbuild: esbuildOptions } = normalizedConfig.tools;
80
- const { PluginEsbuild } = yield import("@modern-js/builder-plugin-esbuild");
81
- builder.addPlugins([
82
- PluginEsbuild({
83
- loader: false,
84
- minimize: applyOptionsChain({}, esbuildOptions)
85
- })
86
- ]);
87
- }
88
- builder.addPlugins([PluginCompatModern(options)]);
89
- });
90
- }
91
- export {
92
- createWebpackBuilderForModern
93
- };
@@ -1,39 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- function createBuilderProviderConfig(resolveConfig, appContext, modifyBuilderConfig) {
21
- const htmlConfig = __spreadValues({}, resolveConfig.html);
22
- if (!htmlConfig.template) {
23
- htmlConfig.templateByEntries = __spreadValues(__spreadValues({}, htmlConfig.templateByEntries), appContext.htmlTemplates);
24
- }
25
- const config = __spreadProps(__spreadValues({}, resolveConfig), {
26
- dev: __spreadProps(__spreadValues({}, resolveConfig.dev), {
27
- port: appContext.port
28
- }),
29
- html: htmlConfig,
30
- output: __spreadProps(__spreadValues({}, resolveConfig.output), {
31
- cleanDistPath: false
32
- })
33
- });
34
- modifyBuilderConfig == null ? void 0 : modifyBuilderConfig(config);
35
- return config;
36
- }
37
- export {
38
- createBuilderProviderConfig
39
- };
@@ -1,53 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { createBuilder } from "@modern-js/builder";
22
- import { createBuilderProviderConfig } from "./createBuilderProviderConfig";
23
- import { getBuilderTargets } from "./getBuilderTargets";
24
- import { createBuilderOptions } from "./createBuilderOptions";
25
- function generateBuilder(options, generateProvider, utils) {
26
- return __async(this, null, function* () {
27
- const { normalizedConfig, appContext } = options;
28
- const { modifyBuilderConfig, modifyBuilderInstance } = utils || {};
29
- const builderConfig = createBuilderProviderConfig(
30
- normalizedConfig,
31
- appContext,
32
- modifyBuilderConfig
33
- );
34
- const provider = generateProvider({
35
- builderConfig
36
- });
37
- const target = getBuilderTargets(normalizedConfig);
38
- const builderOptions = createBuilderOptions(target, appContext);
39
- const builder = yield createBuilder(provider, builderOptions);
40
- yield applyBuilderPlugins(builder, options);
41
- yield modifyBuilderInstance == null ? void 0 : modifyBuilderInstance(builder);
42
- return builder;
43
- });
44
- }
45
- function applyBuilderPlugins(builder, options) {
46
- return __async(this, null, function* () {
47
- const { builderPluginAdapterModern } = yield import("../shared/builderPlugins/adapterModern");
48
- builder.addPlugins([builderPluginAdapterModern(options)]);
49
- });
50
- }
51
- export {
52
- generateBuilder
53
- };
@@ -1,39 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- function createBuilderGenerator(bundler) {
22
- return __async(this, null, function* () {
23
- if (bundler === "rspack") {
24
- try {
25
- const { createRspackBuilderForModern } = yield import("./builder-rspack");
26
- return createRspackBuilderForModern;
27
- } catch (_) {
28
- throw new Error(
29
- "Failed to use rspack, please check if you have `@modern-js/builder-rspack-provider` installed"
30
- );
31
- }
32
- }
33
- const { createWebpackBuilderForModern } = yield import("./builder-webpack");
34
- return createWebpackBuilderForModern;
35
- });
36
- }
37
- export {
38
- createBuilderGenerator
39
- };
@@ -1,91 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
40
- import { ResolvedConfigContext } from "@modern-js/core";
41
- import { logger, printBuildError } from "@modern-js/utils";
42
- import { generateRoutes } from "../utils/routes";
43
- import { buildServerConfig } from "../utils/config";
44
- const build = (api, options) => __async(void 0, null, function* () {
45
- if (options == null ? void 0 : options.analyze) {
46
- process.env.BUNDLE_ANALYZE = "true";
47
- }
48
- let resolvedConfig = api.useResolvedConfigContext();
49
- const appContext = api.useAppContext();
50
- const hookRunners = api.useHookRunners();
51
- const { apiOnly } = appContext;
52
- if (apiOnly) {
53
- const { appDirectory: appDirectory2, distDirectory: distDirectory2, serverConfigFile: serverConfigFile2 } = appContext;
54
- yield hookRunners.beforeBuild({
55
- bundlerConfigs: void 0
56
- });
57
- yield buildServerConfig({
58
- appDirectory: appDirectory2,
59
- distDirectory: distDirectory2,
60
- configFile: serverConfigFile2
61
- });
62
- yield generateRoutes(appContext);
63
- yield hookRunners.afterBuild({
64
- stats: void 0
65
- });
66
- return;
67
- }
68
- resolvedConfig = __spreadProps(__spreadValues({}, resolvedConfig), { cliOptions: options });
69
- ResolvedConfigContext.set(resolvedConfig);
70
- const { distDirectory, appDirectory, serverConfigFile } = appContext;
71
- yield buildServerConfig({
72
- appDirectory,
73
- distDirectory,
74
- configFile: serverConfigFile
75
- });
76
- try {
77
- logger.info("Create a production build...\n");
78
- if (!appContext.builder) {
79
- throw new Error(
80
- "Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
81
- );
82
- }
83
- yield appContext.builder.build();
84
- } catch (error) {
85
- printBuildError(error);
86
- process.exit(1);
87
- }
88
- });
89
- export {
90
- build
91
- };
@@ -1,28 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- const deploy = (api, options) => __async(void 0, null, function* () {
22
- const hookRunners = api.useHookRunners();
23
- yield hookRunners.beforeDeploy(options);
24
- yield hookRunners.afterDeploy(options);
25
- });
26
- export {
27
- deploy
28
- };
@@ -1,109 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __async = (__this, __arguments, generator) => {
21
- return new Promise((resolve, reject) => {
22
- var fulfilled = (value) => {
23
- try {
24
- step(generator.next(value));
25
- } catch (e) {
26
- reject(e);
27
- }
28
- };
29
- var rejected = (value) => {
30
- try {
31
- step(generator.throw(value));
32
- } catch (e) {
33
- reject(e);
34
- }
35
- };
36
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
37
- step((generator = generator.apply(__this, __arguments)).next());
38
- });
39
- };
40
- import { ResolvedConfigContext } from "@modern-js/core";
41
- import { printInstructions } from "../utils/printInstructions";
42
- import {
43
- setServer,
44
- createServer,
45
- injectDataLoaderPlugin
46
- } from "../utils/createServer";
47
- import { generateRoutes } from "../utils/routes";
48
- import { buildServerConfig } from "../utils/config";
49
- import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
50
- const dev = (api, options) => __async(void 0, null, function* () {
51
- var _a;
52
- if (options.analyze) {
53
- process.env.BUNDLE_ANALYZE = "true";
54
- }
55
- let normalizedConfig = api.useResolvedConfigContext();
56
- const appContext = api.useAppContext();
57
- const hookRunners = api.useHookRunners();
58
- normalizedConfig = __spreadProps(__spreadValues({}, normalizedConfig), { cliOptions: options });
59
- ResolvedConfigContext.set(normalizedConfig);
60
- const { appDirectory, distDirectory, port, apiOnly, serverConfigFile } = appContext;
61
- yield buildServerConfig({
62
- appDirectory,
63
- distDirectory,
64
- configFile: serverConfigFile,
65
- options: {
66
- esbuildOptions: {
67
- watch: true
68
- }
69
- }
70
- });
71
- yield hookRunners.beforeDev();
72
- if (!appContext.builder && !apiOnly) {
73
- throw new Error(
74
- "Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
75
- );
76
- }
77
- yield generateRoutes(appContext);
78
- const serverInternalPlugins = yield getServerInternalPlugins(api);
79
- const serverOptions = {
80
- dev: __spreadValues({
81
- port,
82
- https: normalizedConfig.dev.https
83
- }, (_a = normalizedConfig.tools) == null ? void 0 : _a.devServer),
84
- pwd: appDirectory,
85
- config: normalizedConfig,
86
- serverConfigFile,
87
- internalPlugins: injectDataLoaderPlugin(serverInternalPlugins)
88
- };
89
- if (apiOnly) {
90
- const app = yield createServer(__spreadProps(__spreadValues({}, serverOptions), {
91
- compiler: null
92
- }));
93
- app.listen(port, (err) => __async(void 0, null, function* () {
94
- if (err) {
95
- throw err;
96
- }
97
- printInstructions(hookRunners, appContext, normalizedConfig);
98
- }));
99
- } else {
100
- const { server } = yield appContext.builder.startDevServer({
101
- printURLs: false,
102
- serverOptions
103
- });
104
- setServer(server);
105
- }
106
- });
107
- export {
108
- dev
109
- };
@@ -1,38 +0,0 @@
1
- var __async = (__this, __arguments, generator) => {
2
- return new Promise((resolve, reject) => {
3
- var fulfilled = (value) => {
4
- try {
5
- step(generator.next(value));
6
- } catch (e) {
7
- reject(e);
8
- }
9
- };
10
- var rejected = (value) => {
11
- try {
12
- step(generator.throw(value));
13
- } catch (e) {
14
- reject(e);
15
- }
16
- };
17
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
18
- step((generator = generator.apply(__this, __arguments)).next());
19
- });
20
- };
21
- import { join } from "path";
22
- const inspect = (api, options) => __async(void 0, null, function* () {
23
- const appContext = api.useAppContext();
24
- if (!appContext.builder) {
25
- throw new Error(
26
- "Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
27
- );
28
- }
29
- return appContext.builder.inspectConfig({
30
- env: options.env,
31
- verbose: options.verbose,
32
- outputPath: join(appContext == null ? void 0 : appContext.builder.context.distPath, options.output),
33
- writeToDisk: true
34
- });
35
- });
36
- export {
37
- inspect
38
- };
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- const defineConfig = (config) => config;
21
- const defineLegacyConfig = (config) => __spreadProps(__spreadValues({}, config), {
22
- legacy: true
23
- });
24
- export {
25
- defineConfig,
26
- defineLegacyConfig
27
- };