@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
@@ -95,8 +95,8 @@ var builderPluginAdapterModern = function(options) {
95
95
  name: "builder-plugin-adapter-modern",
96
96
  setup: function setup(api) {
97
97
  var isHtmlEnabled = function isHtmlEnabled(config, target) {
98
- var ref;
99
- return ((ref = config.tools) === null || ref === void 0 ? void 0 : ref.htmlPlugin) !== false && target !== "node" && target !== "web-worker";
98
+ var _config_tools;
99
+ return ((_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : _config_tools.htmlPlugin) !== false && target !== "node" && target !== "service-worker" && target !== "web-worker";
100
100
  };
101
101
  var normalizedConfig = options.normalizedConfig, appContext = options.appContext;
102
102
  api.modifyBuilderConfig(function(config) {
@@ -114,13 +114,17 @@ var builderPluginAdapterModern = function(options) {
114
114
  var builderConfig = api.getNormalizedConfig();
115
115
  if (target === "node") {
116
116
  chain.name("server");
117
+ } else if (target === "service-worker") {
118
+ chain.name("service-worker");
119
+ } else if (target === "web-worker") {
120
+ chain.name("worker");
117
121
  } else if (target === "modern-web") {
118
122
  chain.name("modern");
119
123
  } else {
120
124
  chain.name("client");
121
125
  }
122
- if (target === "node") {
123
- applyNodeCompat(chain, normalizedConfig, isProd);
126
+ if (target === "node" || target === "service-worker") {
127
+ applyNodeCompat(target, chain, normalizedConfig, isProd);
124
128
  }
125
129
  if (isHtmlEnabled(builderConfig, target)) {
126
130
  applyBottomHtmlPlugin({
@@ -136,7 +140,7 @@ var builderPluginAdapterModern = function(options) {
136
140
  CHAIN_ID: CHAIN_ID
137
141
  });
138
142
  }
139
- if (target !== "node") {
143
+ if (target !== "node" && target !== "web-worker" && target !== "service-worker") {
140
144
  var bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
141
145
  chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
142
146
  chain.module.rule("bare-server-module").test(bareServerModuleReg).use("server-module-loader").loader(require.resolve("../loaders/serverModuleLoader"));
@@ -203,11 +207,11 @@ function applyAsyncChunkHtmlPlugin(param) {
203
207
  ]);
204
208
  }
205
209
  }
206
- function applyNodeCompat(chain, modernConfig, isProd) {
210
+ function applyNodeCompat(target, chain, modernConfig, isProd) {
207
211
  var filterEntriesBySSRConfig = function filterEntriesBySSRConfig(isProd2, chain2, serverConfig, outputConfig) {
208
- var ref;
212
+ var _outputConfig_ssg;
209
213
  var entries = chain2.entryPoints.entries();
210
- if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (ref = outputConfig.ssg) === null || ref === void 0 ? void 0 : ref[0]) === "function")) {
214
+ if (isProd2 && ((outputConfig === null || outputConfig === void 0 ? void 0 : outputConfig.ssg) === true || typeof (outputConfig === null || outputConfig === void 0 ? void 0 : (_outputConfig_ssg = outputConfig.ssg) === null || _outputConfig_ssg === void 0 ? void 0 : _outputConfig_ssg[0]) === "function")) {
211
215
  return;
212
216
  }
213
217
  if (typeof entries === "undefined") {
@@ -226,14 +230,14 @@ function applyNodeCompat(chain, modernConfig, isProd) {
226
230
  }
227
231
  });
228
232
  }
229
- var ref1 = serverConfig || {}, ssr = ref1.ssr, ssrByEntries = ref1.ssrByEntries;
233
+ var _ref = serverConfig || {}, ssr = _ref.ssr, ssrByEntries = _ref.ssrByEntries;
230
234
  entryNames.forEach(function(name) {
231
235
  if (!ssgEntries.includes(name) && (ssr && (ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]) === false || !ssr && !(ssrByEntries === null || ssrByEntries === void 0 ? void 0 : ssrByEntries[name]))) {
232
236
  chain2.entryPoints.delete(name);
233
237
  }
234
238
  });
235
239
  };
236
- for(var _i = 0, _iter = [
240
+ var nodeExts = [
237
241
  ".node.js",
238
242
  ".node.jsx",
239
243
  ".node.ts",
@@ -242,9 +246,54 @@ function applyNodeCompat(chain, modernConfig, isProd) {
242
246
  ".server.ts",
243
247
  ".server.ts",
244
248
  ".server.tsx"
245
- ]; _i < _iter.length; _i++){
246
- var ext = _iter[_i];
247
- chain.resolve.extensions.prepend(ext);
249
+ ];
250
+ var webWorkerExts = [
251
+ ".worker.js",
252
+ ".worker.jsx",
253
+ ".worker.ts",
254
+ ".worker.tsx"
255
+ ];
256
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
257
+ try {
258
+ for(var _iterator = nodeExts[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
259
+ var ext = _step.value;
260
+ chain.resolve.extensions.prepend(ext);
261
+ }
262
+ } catch (err) {
263
+ _didIteratorError = true;
264
+ _iteratorError = err;
265
+ } finally{
266
+ try {
267
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
268
+ _iterator.return();
269
+ }
270
+ } finally{
271
+ if (_didIteratorError) {
272
+ throw _iteratorError;
273
+ }
274
+ }
275
+ }
276
+ if (target === "service-worker") {
277
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
278
+ try {
279
+ for(var _iterator1 = webWorkerExts[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
280
+ var ext1 = _step1.value;
281
+ chain.resolve.extensions.prepend(ext1);
282
+ }
283
+ } catch (err) {
284
+ _didIteratorError1 = true;
285
+ _iteratorError1 = err;
286
+ } finally{
287
+ try {
288
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
289
+ _iterator1.return();
290
+ }
291
+ } finally{
292
+ if (_didIteratorError1) {
293
+ throw _iteratorError1;
294
+ }
295
+ }
296
+ }
248
297
  }
249
298
  filterEntriesBySSRConfig(isProd, chain, modernConfig.server, modernConfig.output);
250
299
  }
@@ -48,8 +48,8 @@ var BottomTemplatePlugin = /*#__PURE__*/ function() {
48
48
  var _this = this;
49
49
  compiler.hooks.compilation.tap(this.name, function(compilation) {
50
50
  _this.htmlWebpackPlugin.getHooks(compilation).beforeEmit.tap(_this.name, function(data) {
51
- var ref;
52
- if (!((ref = data.plugin.options) === null || ref === void 0 ? void 0 : ref.__internal__)) {
51
+ var _data_plugin_options;
52
+ if (!((_data_plugin_options = data.plugin.options) === null || _data_plugin_options === void 0 ? void 0 : _data_plugin_options.__internal__)) {
53
53
  return data;
54
54
  }
55
55
  if (_this.bottomTemplateReg.test(data.html)) {
File without changes
File without changes
@@ -182,7 +182,7 @@ import { buildServerConfig } from "../utils/config";
182
182
  import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
183
183
  var dev = function() {
184
184
  var _ref = _asyncToGenerator(function(api, options) {
185
- var ref, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, serverConfigFile, serverInternalPlugins, serverOptions, app, server;
185
+ var _normalizedConfig_tools, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, serverConfigFile, serverInternalPlugins, serverOptions, app, server;
186
186
  return __generator(this, function(_state) {
187
187
  switch(_state.label){
188
188
  case 0:
@@ -237,7 +237,7 @@ var dev = function() {
237
237
  dev: _objectSpread({
238
238
  port: port,
239
239
  https: normalizedConfig.dev.https
240
- }, (ref = normalizedConfig.tools) === null || ref === void 0 ? void 0 : ref.devServer),
240
+ }, (_normalizedConfig_tools = normalizedConfig.tools) === null || _normalizedConfig_tools === void 0 ? void 0 : _normalizedConfig_tools.devServer),
241
241
  pwd: appDirectory,
242
242
  config: normalizedConfig,
243
243
  serverConfigFile: serverConfigFile,
File without changes
File without changes
@@ -129,7 +129,7 @@ import { injectDataLoaderPlugin } from "../utils/createServer";
129
129
  import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
130
130
  var start = function() {
131
131
  var _ref = _asyncToGenerator(function(api) {
132
- var ref, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, serverInternalPlugins, app;
132
+ var _userConfig_source, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, serverInternalPlugins, app;
133
133
  return __generator(this, function(_state) {
134
134
  switch(_state.label){
135
135
  case 0:
@@ -140,7 +140,7 @@ var start = function() {
140
140
  logger.log(chalk.cyan("Starting the modern server..."));
141
141
  return [
142
142
  4,
143
- isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (ref = userConfig.source) === null || ref === void 0 ? void 0 : ref.entriesDir)
143
+ isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir)
144
144
  ];
145
145
  case 1:
146
146
  apiOnly = _state.sent();
File without changes
File without changes
@@ -107,7 +107,7 @@ function initHtmlConfig(config, appContext) {
107
107
  }
108
108
  function initSourceConfig(config, appContext, bundler) {
109
109
  var createBuilderGlobalVars = function createBuilderGlobalVars(config2, appContext2) {
110
- var _source = config2.source, _globalVars = _source.globalVars, globalVars = _globalVars === void 0 ? {} : _globalVars;
110
+ var _config2_source = config2.source, _config2_source_globalVars = _config2_source.globalVars, globalVars = _config2_source_globalVars === void 0 ? {} : _config2_source_globalVars;
111
111
  var publicEnv = getAutoInjectEnv(appContext2);
112
112
  return _objectSpread({}, globalVars, publicEnv);
113
113
  };
@@ -199,7 +199,7 @@ function initToolsConfig(config) {
199
199
  ]
200
200
  }
201
201
  };
202
- var _tools = config.tools, tsChecker = _tools.tsChecker, tsLoader = _tools.tsLoader;
202
+ var _config_tools = config.tools, tsChecker = _config_tools.tsChecker, tsLoader = _config_tools.tsLoader;
203
203
  config.tools.tsChecker = applyOptionsChain(defaultTsChecker, tsChecker);
204
204
  tsLoader && (config.tools.tsLoader = function(tsLoaderConfig, utils) {
205
205
  applyOptionsChain(_objectSpreadProps(_objectSpread({}, tsLoaderConfig), {
@@ -0,0 +1,19 @@
1
+ function createHtmlConfig(config) {
2
+ var _config_output = config.output, disableHtmlFolder = _config_output.disableHtmlFolder, favicon = _config_output.favicon, faviconByEntries = _config_output.faviconByEntries, inject = _config_output.inject, injectByEntries = _config_output.injectByEntries, meta = _config_output.meta, metaByEntries = _config_output.metaByEntries, mountId = _config_output.mountId, title = _config_output.title, titleByEntries = _config_output.titleByEntries, templateParameters = _config_output.templateParameters, templateParametersByEntries = _config_output.templateParametersByEntries, crossorigin = _config_output.crossorigin;
3
+ return {
4
+ disableHtmlFolder: disableHtmlFolder,
5
+ favicon: favicon,
6
+ faviconByEntries: faviconByEntries,
7
+ inject: inject,
8
+ injectByEntries: injectByEntries,
9
+ meta: meta,
10
+ metaByEntries: metaByEntries,
11
+ mountId: mountId,
12
+ title: title,
13
+ titleByEntries: titleByEntries,
14
+ crossorigin: crossorigin,
15
+ templateParameters: templateParameters,
16
+ templateParametersByEntries: templateParametersByEntries
17
+ };
18
+ }
19
+ export { createHtmlConfig };
@@ -1,5 +1,5 @@
1
1
  function createOutputConfig(config) {
2
- var _output = config.output, assetPrefix = _output.assetPrefix, copy = _output.copy, cssModuleLocalIdentName = _output.cssModuleLocalIdentName, cssPath = _output.cssPath, jsPath = _output.jsPath, htmlPath = _output.htmlPath, mediaPath = _output.mediaPath, enableTsLoader = _output.enableTsLoader, path = _output.path, disableInlineRuntimeChunk = _output.disableInlineRuntimeChunk, disableCssExtract = _output.disableCssExtract, disableMinimize = _output.disableMinimize, disableSourceMap = _output.disableSourceMap, disableTsChecker = _output.disableTsChecker, enableCssModuleTSDeclaration = _output.enableCssModuleTSDeclaration, enableInlineScripts = _output.enableInlineScripts, enableInlineStyles = _output.enableInlineStyles, polyfill = _output.polyfill, dataUriLimit = _output.dataUriLimit, disableAssetsCache = _output.disableAssetsCache, enableLatestDecorators = _output.enableLatestDecorators, disableCssModuleExtension = _output.disableCssModuleExtension, ssg = _output.ssg, disableNodePolyfill = _output.disableNodePolyfill;
2
+ var _config_output = config.output, assetPrefix = _config_output.assetPrefix, copy = _config_output.copy, cssModuleLocalIdentName = _config_output.cssModuleLocalIdentName, cssPath = _config_output.cssPath, jsPath = _config_output.jsPath, htmlPath = _config_output.htmlPath, mediaPath = _config_output.mediaPath, enableTsLoader = _config_output.enableTsLoader, path = _config_output.path, disableInlineRuntimeChunk = _config_output.disableInlineRuntimeChunk, disableCssExtract = _config_output.disableCssExtract, disableMinimize = _config_output.disableMinimize, disableSourceMap = _config_output.disableSourceMap, disableTsChecker = _config_output.disableTsChecker, enableCssModuleTSDeclaration = _config_output.enableCssModuleTSDeclaration, enableInlineScripts = _config_output.enableInlineScripts, enableInlineStyles = _config_output.enableInlineStyles, polyfill = _config_output.polyfill, dataUriLimit = _config_output.dataUriLimit, disableAssetsCache = _config_output.disableAssetsCache, enableLatestDecorators = _config_output.enableLatestDecorators, disableCssModuleExtension = _config_output.disableCssModuleExtension, ssg = _config_output.ssg, disableNodePolyfill = _config_output.disableNodePolyfill;
3
3
  return {
4
4
  assetPrefix: assetPrefix,
5
5
  copy: copy,
@@ -1,5 +1,5 @@
1
1
  function createSourceConfig(config) {
2
- var _source = config.source, alias = _source.alias, envVars = _source.envVars, globalVars = _source.globalVars, include = _source.include, moduleScopes = _source.moduleScopes, preEntry = _source.preEntry, entries = _source.entries, enableAsyncEntry = _source.enableAsyncEntry, disableDefaultEntries = _source.disableDefaultEntries, entriesDir = _source.entriesDir, configDir = _source.configDir;
2
+ var _config_source = config.source, alias = _config_source.alias, envVars = _config_source.envVars, globalVars = _config_source.globalVars, include = _config_source.include, moduleScopes = _config_source.moduleScopes, preEntry = _config_source.preEntry, entries = _config_source.entries, enableAsyncEntry = _config_source.enableAsyncEntry, disableDefaultEntries = _config_source.disableDefaultEntries, entriesDir = _config_source.entriesDir, configDir = _config_source.configDir;
3
3
  var builderGlobalVars = globalVars || {};
4
4
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
5
5
  try {
@@ -1,5 +1,5 @@
1
1
  function createToolsConfig(config) {
2
- var _tools = config.tools, autoprefixer = _tools.autoprefixer, babel = _tools.babel, minifyCss = _tools.minifyCss, terser = _tools.terser, webpack = _tools.webpack, webpackChain = _tools.webpackChain, tsLoader = _tools.tsLoader, styledComponents = _tools.styledComponents, sass = _tools.sass, postcss = _tools.postcss, less = _tools.less, htmlPlugin = _tools.htmlPlugin, devServer = _tools.devServer, tailwindcss = _tools.tailwindcss, jest = _tools.jest, esbuild = _tools.esbuild;
2
+ var _config_tools = config.tools, autoprefixer = _config_tools.autoprefixer, babel = _config_tools.babel, minifyCss = _config_tools.minifyCss, terser = _config_tools.terser, webpack = _config_tools.webpack, webpackChain = _config_tools.webpackChain, tsLoader = _config_tools.tsLoader, styledComponents = _config_tools.styledComponents, sass = _config_tools.sass, postcss = _config_tools.postcss, less = _config_tools.less, htmlPlugin = _config_tools.htmlPlugin, devServer = _config_tools.devServer, tailwindcss = _config_tools.tailwindcss, jest = _config_tools.jest, esbuild = _config_tools.esbuild;
3
3
  var enableTsLoader = config.output.enableTsLoader;
4
4
  return {
5
5
  tsLoader: enableTsLoader ? tsLoader : void 0,
File without changes
File without changes
File without changes
File without changes
@@ -198,7 +198,7 @@ var initialize_default = function(param) {
198
198
  resolvedConfig: function resolvedConfig(param) {
199
199
  var resolved = param.resolved;
200
200
  return _asyncToGenerator(function() {
201
- var ref, appContext, userConfig, port, normalizedConfig;
201
+ var _resolved_output_distPath, appContext, userConfig, port, normalizedConfig;
202
202
  return __generator(this, function(_state) {
203
203
  switch(_state.label){
204
204
  case 0:
@@ -212,7 +212,7 @@ var initialize_default = function(param) {
212
212
  port = _state.sent();
213
213
  appContext = _objectSpreadProps(_objectSpread({}, appContext), {
214
214
  port: port,
215
- distDirectory: ensureAbsolutePath(appContext.distDirectory, ((ref = resolved.output.distPath) === null || ref === void 0 ? void 0 : ref.root) || "dist")
215
+ distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
216
216
  });
217
217
  api.setAppContext(appContext);
218
218
  normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -275,11 +275,11 @@ var safeReplacer = function() {
275
275
  };
276
276
  var emitResolvedConfig = function() {
277
277
  var _ref = _asyncToGenerator(function(appDirectory, resolvedConfig) {
278
- var ref, outputPath;
278
+ var _resolvedConfig_output_distPath, outputPath;
279
279
  return __generator(this, function(_state) {
280
280
  switch(_state.label){
281
281
  case 0:
282
- outputPath = path.join(appDirectory, ((ref = resolvedConfig.output.distPath) === null || ref === void 0 ? void 0 : ref.root) || "./dist", OUTPUT_CONFIG_FILE);
282
+ outputPath = path.join(appDirectory, ((_resolvedConfig_output_distPath = resolvedConfig.output.distPath) === null || _resolvedConfig_output_distPath === void 0 ? void 0 : _resolvedConfig_output_distPath.root) || "./dist", OUTPUT_CONFIG_FILE);
283
283
  return [
284
284
  4,
285
285
  fs.writeJSON(outputPath, resolvedConfig, {
File without changes
@@ -179,7 +179,7 @@ function getServerInternalPlugins(api) {
179
179
  }
180
180
  function _getServerInternalPlugins() {
181
181
  _getServerInternalPlugins = _asyncToGenerator(function(api) {
182
- var hookRunners, ref, serverPlugins, serverInternalPlugins;
182
+ var hookRunners, _ref, serverPlugins, serverInternalPlugins;
183
183
  return __generator(this, function(_state) {
184
184
  switch(_state.label){
185
185
  case 0:
@@ -191,7 +191,7 @@ function _getServerInternalPlugins() {
191
191
  })
192
192
  ];
193
193
  case 1:
194
- ref = _state.sent(), serverPlugins = ref.plugins;
194
+ _ref = _state.sent(), serverPlugins = _ref.plugins;
195
195
  serverInternalPlugins = serverPlugins.reduce(function(result, plugin) {
196
196
  return Object.assign(result, plugin);
197
197
  }, {});
File without changes
File without changes
File without changes
File without changes