@modern-js/app-tools 2.58.1-alpha.6 → 2.58.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. package/dist/cjs/builder/builder-webpack/createCopyPattern.js +0 -1
  2. package/dist/cjs/builder/builder-webpack/index.js +1 -1
  3. package/dist/cjs/builder/generator/index.js +2 -2
  4. package/dist/cjs/builder/index.js +2 -2
  5. package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +13 -4
  6. package/dist/cjs/commands/build.js +19 -0
  7. package/dist/cjs/commands/dev.js +9 -0
  8. package/dist/cjs/commands/index.js +8 -8
  9. package/dist/cjs/commands/inspect.js +1 -1
  10. package/dist/cjs/config/initialize/inits.js +4 -4
  11. package/dist/cjs/esm/esbuild-loader.mjs +20 -0
  12. package/dist/cjs/esm/register-esm.mjs +67 -0
  13. package/dist/cjs/esm/ts-node-loader.mjs +21 -0
  14. package/dist/cjs/esm/utils.mjs +43 -0
  15. package/dist/cjs/index.js +1 -1
  16. package/dist/cjs/plugins/analyze/index.js +3 -3
  17. package/dist/cjs/plugins/deploy/dependencies/index.js +2 -15
  18. package/dist/cjs/plugins/deploy/dependencies/utils.js +13 -78
  19. package/dist/cjs/plugins/deploy/platforms/netlify-entry.js +3 -0
  20. package/dist/cjs/plugins/deploy/platforms/netlify-entry.mjs +1 -0
  21. package/dist/cjs/plugins/deploy/platforms/{netlifyEntry.js → netlify-handler.js} +6 -4
  22. package/dist/cjs/plugins/deploy/platforms/netlify.js +14 -5
  23. package/dist/cjs/plugins/deploy/platforms/node.js +13 -4
  24. package/dist/cjs/plugins/deploy/platforms/vercel-entry.js +3 -0
  25. package/dist/cjs/plugins/deploy/platforms/vercel-entry.mjs +3 -0
  26. package/dist/cjs/plugins/deploy/platforms/{vercelEntry.js → vercel-handler.js} +4 -1
  27. package/dist/cjs/plugins/deploy/platforms/vercel.js +14 -5
  28. package/dist/cjs/utils/config.js +1 -1
  29. package/dist/cjs/utils/loadPlugins.js +1 -1
  30. package/dist/cjs/utils/register.js +50 -23
  31. package/dist/types/builder/builder-rspack/adapterCopy.d.ts +2 -2
  32. package/dist/types/builder/builder-rspack/index.d.ts +1 -1
  33. package/dist/types/builder/builder-webpack/adapterModern.d.ts +2 -2
  34. package/dist/types/builder/builder-webpack/index.d.ts +1 -1
  35. package/dist/types/builder/generator/index.d.ts +2 -2
  36. package/dist/types/builder/index.d.ts +1 -1
  37. package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
  38. package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +1 -1
  39. package/dist/types/builder/shared/createCopyInfo.d.ts +1 -1
  40. package/dist/types/commands/build.d.ts +1 -1
  41. package/dist/types/commands/dev.d.ts +3 -3
  42. package/dist/types/commands/index.d.ts +3 -3
  43. package/dist/types/config/default.d.ts +1 -1
  44. package/dist/types/config/initialize/inits.d.ts +1 -1
  45. package/dist/types/config/legacy/createHtmlConfig.d.ts +1 -1
  46. package/dist/types/config/legacy/createOutputConfig.d.ts +1 -1
  47. package/dist/types/config/legacy/createSourceConfig.d.ts +1 -1
  48. package/dist/types/config/legacy/createToolsConfig.d.ts +1 -1
  49. package/dist/types/esm/esbuild-loader.d.mts +6 -0
  50. package/dist/types/esm/register-esm.d.mts +5 -0
  51. package/dist/types/esm/ts-node-loader.d.mts +6 -0
  52. package/dist/types/esm/utils.d.mts +6 -0
  53. package/dist/types/exports/server.d.ts +1 -1
  54. package/dist/types/hooks.d.ts +1 -1
  55. package/dist/types/index.d.ts +2 -2
  56. package/dist/types/plugins/analyze/getBundleEntry.d.ts +1 -1
  57. package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +1 -1
  58. package/dist/types/plugins/analyze/index.d.ts +1 -1
  59. package/dist/types/plugins/deploy/dependencies/index.d.ts +3 -5
  60. package/dist/types/plugins/deploy/dependencies/utils.d.ts +2 -9
  61. package/dist/types/plugins/deploy/index.d.ts +2 -2
  62. package/dist/types/plugins/deploy/platforms/netlify-entry.d.cts +1 -0
  63. package/dist/types/plugins/deploy/platforms/netlify-entry.d.mts +1 -0
  64. package/dist/types/plugins/deploy/platforms/netlify-handler.d.cts +1 -0
  65. package/dist/types/plugins/deploy/platforms/netlify.d.ts +1 -1
  66. package/dist/types/plugins/deploy/platforms/node.d.ts +1 -1
  67. package/dist/types/plugins/deploy/platforms/platform.d.ts +2 -2
  68. package/dist/types/plugins/deploy/platforms/vercel-entry.d.mts +2 -0
  69. package/dist/types/plugins/deploy/platforms/vercel-entry.d.ts +2 -0
  70. package/dist/types/plugins/deploy/platforms/vercel-handler.d.cts +1 -0
  71. package/dist/types/plugins/deploy/platforms/vercel.d.ts +1 -1
  72. package/dist/types/plugins/deploy/utils.d.ts +1 -1
  73. package/dist/types/plugins/serverBuild.d.ts +1 -1
  74. package/dist/types/types/hooks.d.ts +1 -1
  75. package/dist/types/types/index.d.ts +1 -1
  76. package/dist/types/utils/createServer.d.ts +1 -1
  77. package/dist/types/utils/generateWatchFiles.d.ts +1 -1
  78. package/dist/types/utils/getSelectedEntries.d.ts +1 -1
  79. package/dist/types/utils/loadPlugins.d.ts +3 -3
  80. package/dist/types/utils/register.d.ts +2 -2
  81. package/dist/types/utils/restart.d.ts +2 -2
  82. package/lib/types.d.ts +15 -0
  83. package/package.json +20 -21
  84. package/dist/esm/builder/builder-rspack/adapterCopy.js +0 -166
  85. package/dist/esm/builder/builder-rspack/index.js +0 -34
  86. package/dist/esm/builder/builder-webpack/adapterModern.js +0 -29
  87. package/dist/esm/builder/builder-webpack/createCopyPattern.js +0 -44
  88. package/dist/esm/builder/builder-webpack/index.js +0 -52
  89. package/dist/esm/builder/generator/createBuilderProviderConfig.js +0 -37
  90. package/dist/esm/builder/generator/getBuilderEnvironments.js +0 -81
  91. package/dist/esm/builder/generator/index.js +0 -94
  92. package/dist/esm/builder/index.js +0 -45
  93. package/dist/esm/builder/shared/builderPlugins/adapterBasic.js +0 -85
  94. package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +0 -126
  95. package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +0 -270
  96. package/dist/esm/builder/shared/builderPlugins/adapterWorker.js +0 -43
  97. package/dist/esm/builder/shared/builderPlugins/index.js +0 -4
  98. package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -51
  99. package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -37
  100. package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +0 -288
  101. package/dist/esm/builder/shared/bundlerPlugins/index.js +0 -3
  102. package/dist/esm/builder/shared/createCopyInfo.js +0 -14
  103. package/dist/esm/builder/shared/index.js +0 -3
  104. package/dist/esm/builder/shared/loaders/serverModuleLoader.js +0 -7
  105. package/dist/esm/builder/shared/types.js +0 -0
  106. package/dist/esm/commands/build.js +0 -117
  107. package/dist/esm/commands/deploy.js +0 -48
  108. package/dist/esm/commands/dev.js +0 -169
  109. package/dist/esm/commands/index.js +0 -411
  110. package/dist/esm/commands/inspect.js +0 -28
  111. package/dist/esm/commands/serve.js +0 -93
  112. package/dist/esm/config/default.js +0 -190
  113. package/dist/esm/config/index.js +0 -3
  114. package/dist/esm/config/initialize/index.js +0 -9
  115. package/dist/esm/config/initialize/inits.js +0 -85
  116. package/dist/esm/config/legacy/createHtmlConfig.js +0 -21
  117. package/dist/esm/config/legacy/createOutputConfig.js +0 -45
  118. package/dist/esm/config/legacy/createSourceConfig.js +0 -46
  119. package/dist/esm/config/legacy/createToolsConfig.js +0 -28
  120. package/dist/esm/config/legacy/index.js +0 -43
  121. package/dist/esm/defineConfig.js +0 -16
  122. package/dist/esm/exports/server.js +0 -4
  123. package/dist/esm/hooks.js +0 -34
  124. package/dist/esm/index.js +0 -239
  125. package/dist/esm/locale/en.js +0 -43
  126. package/dist/esm/locale/index.js +0 -12
  127. package/dist/esm/locale/zh.js +0 -43
  128. package/dist/esm/plugins/analyze/constants.js +0 -14
  129. package/dist/esm/plugins/analyze/getBundleEntry.js +0 -102
  130. package/dist/esm/plugins/analyze/getFileSystemEntry.js +0 -238
  131. package/dist/esm/plugins/analyze/getHtmlTemplate.js +0 -178
  132. package/dist/esm/plugins/analyze/getServerRoutes.js +0 -132
  133. package/dist/esm/plugins/analyze/index.js +0 -380
  134. package/dist/esm/plugins/analyze/isDefaultExportFunction.js +0 -49
  135. package/dist/esm/plugins/analyze/templates.js +0 -6
  136. package/dist/esm/plugins/analyze/utils.js +0 -101
  137. package/dist/esm/plugins/deploy/dependencies/index.js +0 -629
  138. package/dist/esm/plugins/deploy/dependencies/utils.js +0 -643
  139. package/dist/esm/plugins/deploy/exports.js +0 -4
  140. package/dist/esm/plugins/deploy/index.js +0 -135
  141. package/dist/esm/plugins/deploy/platforms/netlify.js +0 -299
  142. package/dist/esm/plugins/deploy/platforms/netlifyEntry.js +0 -203
  143. package/dist/esm/plugins/deploy/platforms/node.js +0 -133
  144. package/dist/esm/plugins/deploy/platforms/nodeEntry.js +0 -108
  145. package/dist/esm/plugins/deploy/platforms/platform.js +0 -0
  146. package/dist/esm/plugins/deploy/platforms/vercel.js +0 -233
  147. package/dist/esm/plugins/deploy/platforms/vercelEntry.js +0 -203
  148. package/dist/esm/plugins/deploy/utils.js +0 -47
  149. package/dist/esm/plugins/initialize/index.js +0 -119
  150. package/dist/esm/plugins/serverBuild.js +0 -87
  151. package/dist/esm/types/config/deploy.js +0 -0
  152. package/dist/esm/types/config/dev.js +0 -0
  153. package/dist/esm/types/config/experiments.js +0 -0
  154. package/dist/esm/types/config/html.js +0 -0
  155. package/dist/esm/types/config/index.js +0 -1
  156. package/dist/esm/types/config/output.js +0 -0
  157. package/dist/esm/types/config/performance.js +0 -0
  158. package/dist/esm/types/config/security.js +0 -0
  159. package/dist/esm/types/config/source.js +0 -0
  160. package/dist/esm/types/config/testing.js +0 -0
  161. package/dist/esm/types/config/tools.js +0 -0
  162. package/dist/esm/types/hooks.js +0 -0
  163. package/dist/esm/types/index.js +0 -3
  164. package/dist/esm/types/legacyConfig/deploy.js +0 -0
  165. package/dist/esm/types/legacyConfig/dev.js +0 -0
  166. package/dist/esm/types/legacyConfig/index.js +0 -0
  167. package/dist/esm/types/legacyConfig/output.js +0 -0
  168. package/dist/esm/types/legacyConfig/source.js +0 -0
  169. package/dist/esm/types/legacyConfig/testing.js +0 -0
  170. package/dist/esm/types/legacyConfig/tools.js +0 -0
  171. package/dist/esm/types/utils.js +0 -0
  172. package/dist/esm/utils/config.js +0 -122
  173. package/dist/esm/utils/createServer.js +0 -58
  174. package/dist/esm/utils/env.js +0 -16
  175. package/dist/esm/utils/generateWatchFiles.js +0 -71
  176. package/dist/esm/utils/getSelectedEntries.js +0 -67
  177. package/dist/esm/utils/loadPlugins.js +0 -69
  178. package/dist/esm/utils/printInstructions.js +0 -32
  179. package/dist/esm/utils/register.js +0 -129
  180. package/dist/esm/utils/restart.js +0 -67
  181. package/dist/esm/utils/routes.js +0 -42
  182. package/dist/esm/utils/types.js +0 -0
  183. package/dist/esm-node/builder/builder-rspack/adapterCopy.js +0 -67
  184. package/dist/esm-node/builder/builder-rspack/index.js +0 -12
  185. package/dist/esm-node/builder/builder-webpack/adapterModern.js +0 -26
  186. package/dist/esm-node/builder/builder-webpack/createCopyPattern.js +0 -42
  187. package/dist/esm-node/builder/builder-webpack/index.js +0 -20
  188. package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +0 -44
  189. package/dist/esm-node/builder/generator/getBuilderEnvironments.js +0 -60
  190. package/dist/esm-node/builder/generator/index.js +0 -37
  191. package/dist/esm-node/builder/index.js +0 -11
  192. package/dist/esm-node/builder/shared/builderPlugins/adapterBasic.js +0 -48
  193. package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.js +0 -60
  194. package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +0 -156
  195. package/dist/esm-node/builder/shared/builderPlugins/adapterWorker.js +0 -27
  196. package/dist/esm-node/builder/shared/builderPlugins/index.js +0 -4
  197. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +0 -30
  198. package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +0 -31
  199. package/dist/esm-node/builder/shared/bundlerPlugins/RouterPlugin.js +0 -219
  200. package/dist/esm-node/builder/shared/bundlerPlugins/index.js +0 -3
  201. package/dist/esm-node/builder/shared/createCopyInfo.js +0 -14
  202. package/dist/esm-node/builder/shared/index.js +0 -3
  203. package/dist/esm-node/builder/shared/loaders/serverModuleLoader.js +0 -7
  204. package/dist/esm-node/builder/shared/types.js +0 -0
  205. package/dist/esm-node/commands/build.js +0 -55
  206. package/dist/esm-node/commands/deploy.js +0 -12
  207. package/dist/esm-node/commands/dev.js +0 -95
  208. package/dist/esm-node/commands/index.js +0 -92
  209. package/dist/esm-node/commands/inspect.js +0 -15
  210. package/dist/esm-node/commands/serve.js +0 -51
  211. package/dist/esm-node/config/default.js +0 -197
  212. package/dist/esm-node/config/index.js +0 -3
  213. package/dist/esm-node/config/initialize/index.js +0 -9
  214. package/dist/esm-node/config/initialize/inits.js +0 -79
  215. package/dist/esm-node/config/legacy/createHtmlConfig.js +0 -21
  216. package/dist/esm-node/config/legacy/createOutputConfig.js +0 -45
  217. package/dist/esm-node/config/legacy/createSourceConfig.js +0 -29
  218. package/dist/esm-node/config/legacy/createToolsConfig.js +0 -28
  219. package/dist/esm-node/config/legacy/index.js +0 -43
  220. package/dist/esm-node/defineConfig.js +0 -13
  221. package/dist/esm-node/exports/server.js +0 -4
  222. package/dist/esm-node/hooks.js +0 -34
  223. package/dist/esm-node/index.js +0 -124
  224. package/dist/esm-node/locale/en.js +0 -43
  225. package/dist/esm-node/locale/index.js +0 -12
  226. package/dist/esm-node/locale/zh.js +0 -43
  227. package/dist/esm-node/plugins/analyze/constants.js +0 -14
  228. package/dist/esm-node/plugins/analyze/getBundleEntry.js +0 -61
  229. package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +0 -100
  230. package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +0 -74
  231. package/dist/esm-node/plugins/analyze/getServerRoutes.js +0 -132
  232. package/dist/esm-node/plugins/analyze/index.js +0 -166
  233. package/dist/esm-node/plugins/analyze/isDefaultExportFunction.js +0 -47
  234. package/dist/esm-node/plugins/analyze/templates.js +0 -24
  235. package/dist/esm-node/plugins/analyze/utils.js +0 -68
  236. package/dist/esm-node/plugins/deploy/dependencies/index.js +0 -215
  237. package/dist/esm-node/plugins/deploy/dependencies/utils.js +0 -202
  238. package/dist/esm-node/plugins/deploy/exports.js +0 -4
  239. package/dist/esm-node/plugins/deploy/index.js +0 -44
  240. package/dist/esm-node/plugins/deploy/platforms/netlify.js +0 -108
  241. package/dist/esm-node/plugins/deploy/platforms/netlifyEntry.js +0 -69
  242. package/dist/esm-node/plugins/deploy/platforms/node.js +0 -63
  243. package/dist/esm-node/plugins/deploy/platforms/nodeEntry.js +0 -44
  244. package/dist/esm-node/plugins/deploy/platforms/platform.js +0 -0
  245. package/dist/esm-node/plugins/deploy/platforms/vercel.js +0 -120
  246. package/dist/esm-node/plugins/deploy/platforms/vercelEntry.js +0 -69
  247. package/dist/esm-node/plugins/deploy/utils.js +0 -44
  248. package/dist/esm-node/plugins/initialize/index.js +0 -84
  249. package/dist/esm-node/plugins/serverBuild.js +0 -58
  250. package/dist/esm-node/types/config/deploy.js +0 -0
  251. package/dist/esm-node/types/config/dev.js +0 -0
  252. package/dist/esm-node/types/config/experiments.js +0 -0
  253. package/dist/esm-node/types/config/html.js +0 -0
  254. package/dist/esm-node/types/config/index.js +0 -1
  255. package/dist/esm-node/types/config/output.js +0 -0
  256. package/dist/esm-node/types/config/performance.js +0 -0
  257. package/dist/esm-node/types/config/security.js +0 -0
  258. package/dist/esm-node/types/config/source.js +0 -0
  259. package/dist/esm-node/types/config/testing.js +0 -0
  260. package/dist/esm-node/types/config/tools.js +0 -0
  261. package/dist/esm-node/types/hooks.js +0 -0
  262. package/dist/esm-node/types/index.js +0 -3
  263. package/dist/esm-node/types/legacyConfig/deploy.js +0 -0
  264. package/dist/esm-node/types/legacyConfig/dev.js +0 -0
  265. package/dist/esm-node/types/legacyConfig/index.js +0 -0
  266. package/dist/esm-node/types/legacyConfig/output.js +0 -0
  267. package/dist/esm-node/types/legacyConfig/source.js +0 -0
  268. package/dist/esm-node/types/legacyConfig/testing.js +0 -0
  269. package/dist/esm-node/types/legacyConfig/tools.js +0 -0
  270. package/dist/esm-node/types/utils.js +0 -0
  271. package/dist/esm-node/utils/config.js +0 -49
  272. package/dist/esm-node/utils/createServer.js +0 -26
  273. package/dist/esm-node/utils/env.js +0 -16
  274. package/dist/esm-node/utils/generateWatchFiles.js +0 -30
  275. package/dist/esm-node/utils/getSelectedEntries.js +0 -34
  276. package/dist/esm-node/utils/loadPlugins.js +0 -22
  277. package/dist/esm-node/utils/printInstructions.js +0 -11
  278. package/dist/esm-node/utils/register.js +0 -69
  279. package/dist/esm-node/utils/restart.js +0 -22
  280. package/dist/esm-node/utils/routes.js +0 -21
  281. package/dist/esm-node/utils/types.js +0 -0
  282. package/dist/types/plugins/deploy/platforms/netlifyEntry.d.ts +0 -2
  283. package/dist/types/plugins/deploy/platforms/vercelEntry.d.ts +0 -2
  284. /package/dist/cjs/plugins/deploy/platforms/{nodeEntry.js → node-entry.js} +0 -0
  285. /package/dist/types/plugins/deploy/platforms/{nodeEntry.d.ts → node-entry.d.ts} +0 -0
@@ -1,411 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- import { newAction, upgradeAction } from "@modern-js/utils";
6
- import { castArray } from "@modern-js/uni-builder";
7
- import { i18n, localeKeys } from "../locale";
8
- var devCommand = function() {
9
- var _ref = _async_to_generator(function(program, api) {
10
- var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, meta, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, subCmd;
11
- return _ts_generator(this, function(_state) {
12
- switch (_state.label) {
13
- case 0:
14
- runner = api.useHookRunners();
15
- return [
16
- 4,
17
- runner.registerDev()
18
- ];
19
- case 1:
20
- devToolMetas = _state.sent();
21
- devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(function() {
22
- var _ref2 = _async_to_generator(function(options) {
23
- var dev;
24
- return _ts_generator(this, function(_state2) {
25
- switch (_state2.label) {
26
- case 0:
27
- return [
28
- 4,
29
- import("./dev")
30
- ];
31
- case 1:
32
- dev = _state2.sent().dev;
33
- return [
34
- 4,
35
- dev(api, options)
36
- ];
37
- case 2:
38
- _state2.sent();
39
- return [
40
- 2
41
- ];
42
- }
43
- });
44
- });
45
- return function(options) {
46
- return _ref2.apply(this, arguments);
47
- };
48
- }());
49
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
50
- try {
51
- for (_iterator = devToolMetas[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
52
- meta = _step.value;
53
- if (!meta.subCommands) {
54
- continue;
55
- }
56
- _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
57
- try {
58
- for (_iterator1 = meta.subCommands[Symbol.iterator](); !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
59
- subCmd = _step1.value;
60
- devProgram.command(subCmd).action(/* @__PURE__ */ _async_to_generator(function() {
61
- var options, appDirectory, isTypescript;
62
- var _arguments = arguments;
63
- return _ts_generator(this, function(_state2) {
64
- switch (_state2.label) {
65
- case 0:
66
- options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
67
- appDirectory = api.useAppContext().appDirectory;
68
- return [
69
- 4,
70
- import("@modern-js/utils")
71
- ];
72
- case 1:
73
- isTypescript = _state2.sent().isTypescript;
74
- return [
75
- 4,
76
- runner.beforeDevTask(meta)
77
- ];
78
- case 2:
79
- _state2.sent();
80
- return [
81
- 4,
82
- meta.action(options, {
83
- isTsProject: isTypescript(appDirectory)
84
- })
85
- ];
86
- case 3:
87
- _state2.sent();
88
- return [
89
- 2
90
- ];
91
- }
92
- });
93
- }));
94
- }
95
- } catch (err) {
96
- _didIteratorError1 = true;
97
- _iteratorError1 = err;
98
- } finally {
99
- try {
100
- if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
101
- _iterator1.return();
102
- }
103
- } finally {
104
- if (_didIteratorError1) {
105
- throw _iteratorError1;
106
- }
107
- }
108
- }
109
- }
110
- } catch (err) {
111
- _didIteratorError = true;
112
- _iteratorError = err;
113
- } finally {
114
- try {
115
- if (!_iteratorNormalCompletion && _iterator.return != null) {
116
- _iterator.return();
117
- }
118
- } finally {
119
- if (_didIteratorError) {
120
- throw _iteratorError;
121
- }
122
- }
123
- }
124
- return [
125
- 2
126
- ];
127
- }
128
- });
129
- });
130
- return function devCommand2(program, api) {
131
- return _ref.apply(this, arguments);
132
- };
133
- }();
134
- var buildCommand = function() {
135
- var _ref = _async_to_generator(function(program, api) {
136
- var runner, platformBuilders, buildProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
137
- return _ts_generator(this, function(_state) {
138
- switch (_state.label) {
139
- case 0:
140
- runner = api.useHookRunners();
141
- return [
142
- 4,
143
- runner.registerBuildPlatform()
144
- ];
145
- case 1:
146
- platformBuilders = _state.sent();
147
- buildProgram = program.command("build").usage("[options]").description(i18n.t(localeKeys.command.build.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).action(function() {
148
- var _ref2 = _async_to_generator(function(options) {
149
- var build;
150
- return _ts_generator(this, function(_state2) {
151
- switch (_state2.label) {
152
- case 0:
153
- return [
154
- 4,
155
- import("./build")
156
- ];
157
- case 1:
158
- build = _state2.sent().build;
159
- return [
160
- 4,
161
- build(api, options)
162
- ];
163
- case 2:
164
- _state2.sent();
165
- return [
166
- 2
167
- ];
168
- }
169
- });
170
- });
171
- return function(options) {
172
- return _ref2.apply(this, arguments);
173
- };
174
- }());
175
- _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
176
- try {
177
- _loop = function() {
178
- var platformBuilder = _step.value;
179
- var platforms = castArray(platformBuilder.platform);
180
- var _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;
181
- try {
182
- var _loop2 = function() {
183
- var platform = _step1.value;
184
- buildProgram.command(platform).action(/* @__PURE__ */ _async_to_generator(function() {
185
- var appDirectory, isTypescript;
186
- return _ts_generator(this, function(_state2) {
187
- switch (_state2.label) {
188
- case 0:
189
- appDirectory = api.useAppContext().appDirectory;
190
- return [
191
- 4,
192
- import("@modern-js/utils")
193
- ];
194
- case 1:
195
- isTypescript = _state2.sent().isTypescript;
196
- return [
197
- 4,
198
- runner.beforeBuildPlatform(platformBuilders)
199
- ];
200
- case 2:
201
- _state2.sent();
202
- return [
203
- 4,
204
- platformBuilder.build(platform, {
205
- isTsProject: isTypescript(appDirectory)
206
- })
207
- ];
208
- case 3:
209
- _state2.sent();
210
- return [
211
- 2
212
- ];
213
- }
214
- });
215
- }));
216
- };
217
- for (var _iterator2 = platforms[Symbol.iterator](), _step1; !(_iteratorNormalCompletion2 = (_step1 = _iterator2.next()).done); _iteratorNormalCompletion2 = true)
218
- _loop2();
219
- } catch (err) {
220
- _didIteratorError2 = true;
221
- _iteratorError2 = err;
222
- } finally {
223
- try {
224
- if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
225
- _iterator2.return();
226
- }
227
- } finally {
228
- if (_didIteratorError2) {
229
- throw _iteratorError2;
230
- }
231
- }
232
- }
233
- };
234
- for (_iterator = platformBuilders[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true)
235
- _loop();
236
- } catch (err) {
237
- _didIteratorError = true;
238
- _iteratorError = err;
239
- } finally {
240
- try {
241
- if (!_iteratorNormalCompletion && _iterator.return != null) {
242
- _iterator.return();
243
- }
244
- } finally {
245
- if (_didIteratorError) {
246
- throw _iteratorError;
247
- }
248
- }
249
- }
250
- return [
251
- 2
252
- ];
253
- }
254
- });
255
- });
256
- return function buildCommand2(program, api) {
257
- return _ref.apply(this, arguments);
258
- };
259
- }();
260
- var serverCommand = function(program, api) {
261
- program.command("serve").usage("[options]").description(i18n.t(localeKeys.command.serve.describe)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(/* @__PURE__ */ _async_to_generator(function() {
262
- var start;
263
- return _ts_generator(this, function(_state) {
264
- switch (_state.label) {
265
- case 0:
266
- return [
267
- 4,
268
- import("./serve")
269
- ];
270
- case 1:
271
- start = _state.sent().start;
272
- return [
273
- 4,
274
- start(api)
275
- ];
276
- case 2:
277
- _state.sent();
278
- return [
279
- 2
280
- ];
281
- }
282
- });
283
- }));
284
- };
285
- var deployCommand = function(program, api) {
286
- program.command("deploy").usage("[options]").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-s --skip-build", i18n.t(localeKeys.command.shared.skipBuild)).description(i18n.t(localeKeys.command.deploy.describe)).action(function() {
287
- var _ref = _async_to_generator(function(options) {
288
- var build, deploy;
289
- return _ts_generator(this, function(_state) {
290
- switch (_state.label) {
291
- case 0:
292
- if (!!options.skipBuild)
293
- return [
294
- 3,
295
- 3
296
- ];
297
- return [
298
- 4,
299
- import("./build")
300
- ];
301
- case 1:
302
- build = _state.sent().build;
303
- return [
304
- 4,
305
- build(api)
306
- ];
307
- case 2:
308
- _state.sent();
309
- _state.label = 3;
310
- case 3:
311
- return [
312
- 4,
313
- import("./deploy")
314
- ];
315
- case 4:
316
- deploy = _state.sent().deploy;
317
- return [
318
- 4,
319
- deploy(api, options)
320
- ];
321
- case 5:
322
- _state.sent();
323
- process.exit(0);
324
- return [
325
- 2
326
- ];
327
- }
328
- });
329
- });
330
- return function(options) {
331
- return _ref.apply(this, arguments);
332
- };
333
- }());
334
- };
335
- var newCommand = function(program, locale) {
336
- program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--config-file <configFile>", i18n.t(localeKeys.command.shared.config)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).option("--no-need-install", i18n.t(localeKeys.command.shared.noNeedInstall)).action(function() {
337
- var _ref = _async_to_generator(function(options) {
338
- return _ts_generator(this, function(_state) {
339
- switch (_state.label) {
340
- case 0:
341
- return [
342
- 4,
343
- newAction(_object_spread_props(_object_spread({}, options), {
344
- locale: options.lang || locale
345
- }), "mwa")
346
- ];
347
- case 1:
348
- _state.sent();
349
- return [
350
- 2
351
- ];
352
- }
353
- });
354
- });
355
- return function(options) {
356
- return _ref.apply(this, arguments);
357
- };
358
- }());
359
- };
360
- var inspectCommand = function(program, api) {
361
- program.command("inspect").description("inspect the internal configs").option("--env <env>", i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "./").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(function() {
362
- var _ref = _async_to_generator(function(options) {
363
- var inspect;
364
- return _ts_generator(this, function(_state) {
365
- switch (_state.label) {
366
- case 0:
367
- return [
368
- 4,
369
- import("./inspect")
370
- ];
371
- case 1:
372
- inspect = _state.sent().inspect;
373
- inspect(api, options);
374
- return [
375
- 2
376
- ];
377
- }
378
- });
379
- });
380
- return function(options) {
381
- return _ref.apply(this, arguments);
382
- };
383
- }());
384
- };
385
- var upgradeCommand = function(program) {
386
- program.command("upgrade").allowUnknownOption().option("-h --help", "Show help").action(/* @__PURE__ */ _async_to_generator(function() {
387
- return _ts_generator(this, function(_state) {
388
- switch (_state.label) {
389
- case 0:
390
- return [
391
- 4,
392
- upgradeAction()
393
- ];
394
- case 1:
395
- _state.sent();
396
- return [
397
- 2
398
- ];
399
- }
400
- });
401
- }));
402
- };
403
- export {
404
- buildCommand,
405
- deployCommand,
406
- devCommand,
407
- inspectCommand,
408
- newCommand,
409
- serverCommand,
410
- upgradeCommand
411
- };
@@ -1,28 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
3
- var inspect = function() {
4
- var _ref = _async_to_generator(function(api, options) {
5
- var appContext;
6
- return _ts_generator(this, function(_state) {
7
- appContext = api.useAppContext();
8
- if (!appContext.builder) {
9
- throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
10
- }
11
- return [
12
- 2,
13
- appContext.builder.inspectConfig({
14
- env: options.env,
15
- verbose: options.verbose,
16
- outputPath: options.output,
17
- writeToDisk: true
18
- })
19
- ];
20
- });
21
- });
22
- return function inspect2(api, options) {
23
- return _ref.apply(this, arguments);
24
- };
25
- }();
26
- export {
27
- inspect
28
- };
@@ -1,93 +0,0 @@
1
- import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
- import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
- import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
- import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
5
- import path from "path";
6
- import { logger, isApiOnly, getTargetDir, getMeta, SERVER_DIR } from "@modern-js/utils";
7
- import { createProdServer } from "@modern-js/prod-server";
8
- import { printInstructions } from "../utils/printInstructions";
9
- import { loadServerPlugins } from "../utils/loadPlugins";
10
- var start = function() {
11
- var _ref = _async_to_generator(function(api) {
12
- var _userConfig_source, _userConfig_output_distPath, appContext, userConfig, hookRunners, distDirectory, appDirectory, port, metaName, serverRoutes, serverConfigFile, apiOnly, runMode, meta, serverConfigPath, pluginInstances, app;
13
- return _ts_generator(this, function(_state) {
14
- switch (_state.label) {
15
- case 0:
16
- appContext = api.useAppContext();
17
- userConfig = api.useResolvedConfigContext();
18
- hookRunners = api.useHookRunners();
19
- distDirectory = appContext.distDirectory, appDirectory = appContext.appDirectory, port = appContext.port, metaName = appContext.metaName, serverRoutes = appContext.serverRoutes, serverConfigFile = appContext.serverConfigFile;
20
- logger.info("Starting production server...");
21
- return [
22
- 4,
23
- isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig_source = userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory)
24
- ];
25
- case 1:
26
- apiOnly = _state.sent();
27
- if (apiOnly) {
28
- runMode = "apiOnly";
29
- }
30
- meta = getMeta(metaName);
31
- serverConfigPath = path.resolve(distDirectory, SERVER_DIR, "".concat(meta, ".server"));
32
- return [
33
- 4,
34
- loadServerPlugins(api, appDirectory, metaName)
35
- ];
36
- case 2:
37
- pluginInstances = _state.sent();
38
- return [
39
- 4,
40
- createProdServer({
41
- metaName,
42
- pwd: distDirectory,
43
- config: _object_spread_props(_object_spread({}, userConfig), {
44
- dev: userConfig.dev,
45
- // server-core can't get RegExp & Function output.enableInlineScripts by JSON.stringy;
46
- output: _object_spread({
47
- path: (_userConfig_output_distPath = userConfig.output.distPath) === null || _userConfig_output_distPath === void 0 ? void 0 : _userConfig_output_distPath.root
48
- }, userConfig.output || {})
49
- }),
50
- routes: serverRoutes,
51
- plugins: pluginInstances,
52
- serverConfigFile,
53
- serverConfigPath,
54
- appContext: {
55
- appDirectory,
56
- sharedDirectory: getTargetDir(appContext.sharedDirectory, appContext.appDirectory, appContext.distDirectory),
57
- apiDirectory: getTargetDir(appContext.apiDirectory, appContext.appDirectory, appContext.distDirectory),
58
- lambdaDirectory: getTargetDir(appContext.lambdaDirectory, appContext.appDirectory, appContext.distDirectory)
59
- },
60
- runMode
61
- })
62
- ];
63
- case 3:
64
- app = _state.sent();
65
- app.listen(port, /* @__PURE__ */ _async_to_generator(function() {
66
- return _ts_generator(this, function(_state2) {
67
- switch (_state2.label) {
68
- case 0:
69
- return [
70
- 4,
71
- printInstructions(hookRunners, appContext, userConfig)
72
- ];
73
- case 1:
74
- _state2.sent();
75
- return [
76
- 2
77
- ];
78
- }
79
- });
80
- }));
81
- return [
82
- 2
83
- ];
84
- }
85
- });
86
- });
87
- return function start2(api) {
88
- return _ref.apply(this, arguments);
89
- };
90
- }();
91
- export {
92
- start
93
- };