@modern-js/app-tools 2.0.0-beta.3 → 2.0.0-beta.4

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 (230) hide show
  1. package/CHANGELOG.md +305 -0
  2. package/bin/modern.js +1 -0
  3. package/dist/js/modern/analyze/Builder.js +39 -0
  4. package/dist/js/modern/analyze/constants.js +38 -18
  5. package/dist/js/modern/analyze/generateCode.js +262 -221
  6. package/dist/js/modern/analyze/getBundleEntry.js +34 -32
  7. package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +93 -49
  8. package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +89 -47
  9. package/dist/js/modern/analyze/getClientRoutes/index.js +6 -2
  10. package/dist/js/modern/analyze/getClientRoutes/utils.js +23 -10
  11. package/dist/js/modern/analyze/getFileSystemEntry.js +43 -22
  12. package/dist/js/modern/analyze/getHtmlTemplate.js +89 -49
  13. package/dist/js/modern/analyze/getServerRoutes.js +122 -126
  14. package/dist/js/modern/analyze/index.js +201 -160
  15. package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -16
  16. package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -11
  17. package/dist/js/modern/analyze/nestedRoutes.js +106 -60
  18. package/dist/js/modern/analyze/templates.js +163 -81
  19. package/dist/js/modern/analyze/utils.js +87 -66
  20. package/dist/js/modern/builder/builderPlugins/compatModern.js +122 -109
  21. package/dist/js/modern/builder/index.js +123 -86
  22. package/dist/js/modern/builder/loaders/routerLoader.js +9 -12
  23. package/dist/js/modern/builder/loaders/serverModuleLoader.js +4 -1
  24. package/dist/js/modern/builder/share.js +23 -21
  25. package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +23 -22
  26. package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +31 -27
  27. package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +100 -84
  28. package/dist/js/modern/commands/build.js +67 -42
  29. package/dist/js/modern/commands/deploy.js +27 -4
  30. package/dist/js/modern/commands/dev.js +77 -27
  31. package/dist/js/modern/commands/index.js +1 -1
  32. package/dist/js/modern/commands/inspect.js +30 -5
  33. package/dist/js/modern/commands/start.js +37 -15
  34. package/dist/js/modern/config/default.js +103 -113
  35. package/dist/js/modern/config/index.js +8 -2
  36. package/dist/js/modern/config/initial/createHtmlConfig.js +5 -2
  37. package/dist/js/modern/config/initial/createOutputConfig.js +9 -10
  38. package/dist/js/modern/config/initial/createSourceConfig.js +5 -2
  39. package/dist/js/modern/config/initial/createToolsConfig.js +7 -6
  40. package/dist/js/modern/config/initial/index.js +9 -4
  41. package/dist/js/modern/config/initial/inits.js +109 -73
  42. package/dist/js/modern/config/initial/transformNormalizedConfig.js +6 -3
  43. package/dist/js/modern/defineConfig.js +26 -11
  44. package/dist/js/modern/exports/server.js +4 -1
  45. package/dist/js/modern/hooks.js +15 -4
  46. package/dist/js/modern/index.js +178 -90
  47. package/dist/js/modern/initialize/index.js +98 -51
  48. package/dist/js/modern/locale/en.js +20 -21
  49. package/dist/js/modern/locale/index.js +6 -6
  50. package/dist/js/modern/locale/zh.js +21 -22
  51. package/dist/js/modern/schema/Schema.js +6 -5
  52. package/dist/js/modern/schema/index.js +51 -100
  53. package/dist/js/modern/schema/legacy.js +96 -231
  54. package/dist/js/modern/types/config/index.js +0 -1
  55. package/dist/js/modern/types/index.js +0 -1
  56. package/dist/js/modern/types/legacyConfig/output.js +0 -1
  57. package/dist/js/modern/utils/commands.js +5 -2
  58. package/dist/js/modern/utils/config.js +102 -41
  59. package/dist/js/modern/utils/createFileWatcher.js +84 -51
  60. package/dist/js/modern/utils/createServer.js +63 -17
  61. package/dist/js/modern/utils/getSpecifiedEntries.js +46 -19
  62. package/dist/js/modern/utils/language.js +6 -3
  63. package/dist/js/modern/utils/printInstructions.js +27 -8
  64. package/dist/js/modern/utils/restart.js +43 -16
  65. package/dist/js/modern/utils/routes.js +29 -12
  66. package/dist/js/node/analyze/Builder.js +58 -0
  67. package/dist/js/node/analyze/constants.js +54 -39
  68. package/dist/js/node/analyze/generateCode.js +282 -239
  69. package/dist/js/node/analyze/getBundleEntry.js +58 -44
  70. package/dist/js/node/analyze/getClientRoutes/getRoutes.js +132 -76
  71. package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +128 -74
  72. package/dist/js/node/analyze/getClientRoutes/index.js +23 -17
  73. package/dist/js/node/analyze/getClientRoutes/utils.js +44 -21
  74. package/dist/js/node/analyze/getFileSystemEntry.js +70 -39
  75. package/dist/js/node/analyze/getHtmlTemplate.js +116 -61
  76. package/dist/js/node/analyze/getServerRoutes.js +143 -137
  77. package/dist/js/node/analyze/index.js +247 -174
  78. package/dist/js/node/analyze/isDefaultExportFunction.js +55 -26
  79. package/dist/js/node/analyze/makeLegalIdentifier.js +27 -15
  80. package/dist/js/node/analyze/nestedRoutes.js +137 -75
  81. package/dist/js/node/analyze/templates.js +185 -90
  82. package/dist/js/node/analyze/utils.js +114 -81
  83. package/dist/js/node/builder/builderPlugins/compatModern.js +150 -122
  84. package/dist/js/node/builder/index.js +151 -95
  85. package/dist/js/node/builder/loaders/routerLoader.js +27 -18
  86. package/dist/js/node/builder/loaders/serverModuleLoader.js +22 -7
  87. package/dist/js/node/builder/share.js +46 -26
  88. package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +39 -26
  89. package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +47 -31
  90. package/dist/js/node/builder/webpackPlugins/routerPlugin.js +118 -90
  91. package/dist/js/node/commands/build.js +89 -52
  92. package/dist/js/node/commands/deploy.js +45 -10
  93. package/dist/js/node/commands/dev.js +99 -41
  94. package/dist/js/node/commands/index.js +19 -38
  95. package/dist/js/node/commands/inspect.js +48 -11
  96. package/dist/js/node/commands/start.js +65 -26
  97. package/dist/js/node/config/default.js +119 -117
  98. package/dist/js/node/config/index.js +25 -29
  99. package/dist/js/node/config/initial/createHtmlConfig.js +22 -6
  100. package/dist/js/node/config/initial/createOutputConfig.js +26 -14
  101. package/dist/js/node/config/initial/createSourceConfig.js +22 -6
  102. package/dist/js/node/config/initial/createToolsConfig.js +24 -10
  103. package/dist/js/node/config/initial/index.js +28 -17
  104. package/dist/js/node/config/initial/inits.js +126 -81
  105. package/dist/js/node/config/initial/transformNormalizedConfig.js +31 -15
  106. package/dist/js/node/defineConfig.js +43 -17
  107. package/dist/js/node/exports/server.js +21 -10
  108. package/dist/js/node/hooks.js +48 -29
  109. package/dist/js/node/index.js +225 -128
  110. package/dist/js/node/initialize/index.js +116 -61
  111. package/dist/js/node/locale/en.js +36 -25
  112. package/dist/js/node/locale/index.js +27 -15
  113. package/dist/js/node/locale/zh.js +37 -26
  114. package/dist/js/node/schema/Schema.js +23 -10
  115. package/dist/js/node/schema/index.js +77 -114
  116. package/dist/js/node/schema/legacy.js +117 -240
  117. package/dist/js/node/types/config/index.js +17 -16
  118. package/dist/js/node/types/index.js +19 -38
  119. package/dist/js/node/types/legacyConfig/output.js +0 -5
  120. package/dist/js/node/utils/commands.js +21 -6
  121. package/dist/js/node/utils/config.js +120 -51
  122. package/dist/js/node/utils/createFileWatcher.js +104 -61
  123. package/dist/js/node/utils/createServer.js +86 -25
  124. package/dist/js/node/utils/getSpecifiedEntries.js +64 -25
  125. package/dist/js/node/utils/language.js +24 -8
  126. package/dist/js/node/utils/printInstructions.js +47 -16
  127. package/dist/js/node/utils/restart.js +61 -21
  128. package/dist/js/node/utils/routes.js +53 -18
  129. package/dist/js/treeshaking/analyze/Builder.js +199 -0
  130. package/dist/js/treeshaking/analyze/constants.js +28 -18
  131. package/dist/js/treeshaking/analyze/generateCode.js +600 -406
  132. package/dist/js/treeshaking/analyze/getBundleEntry.js +55 -63
  133. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +214 -168
  134. package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +215 -169
  135. package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -2
  136. package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +19 -20
  137. package/dist/js/treeshaking/analyze/getFileSystemEntry.js +89 -86
  138. package/dist/js/treeshaking/analyze/getHtmlTemplate.js +298 -125
  139. package/dist/js/treeshaking/analyze/getServerRoutes.js +210 -147
  140. package/dist/js/treeshaking/analyze/index.js +571 -304
  141. package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +45 -26
  142. package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -16
  143. package/dist/js/treeshaking/analyze/nestedRoutes.js +411 -200
  144. package/dist/js/treeshaking/analyze/templates.js +433 -236
  145. package/dist/js/treeshaking/analyze/utils.js +358 -153
  146. package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +282 -200
  147. package/dist/js/treeshaking/builder/index.js +371 -165
  148. package/dist/js/treeshaking/builder/loaders/routerLoader.js +11 -12
  149. package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +3 -2
  150. package/dist/js/treeshaking/builder/share.js +38 -44
  151. package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +108 -44
  152. package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +70 -39
  153. package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +334 -112
  154. package/dist/js/treeshaking/commands/build.js +286 -88
  155. package/dist/js/treeshaking/commands/deploy.js +153 -25
  156. package/dist/js/treeshaking/commands/dev.js +318 -131
  157. package/dist/js/treeshaking/commands/index.js +1 -1
  158. package/dist/js/treeshaking/commands/inspect.js +147 -32
  159. package/dist/js/treeshaking/commands/start.js +190 -67
  160. package/dist/js/treeshaking/config/default.js +210 -198
  161. package/dist/js/treeshaking/config/index.js +3 -2
  162. package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -31
  163. package/dist/js/treeshaking/config/initial/createOutputConfig.js +43 -70
  164. package/dist/js/treeshaking/config/initial/createSourceConfig.js +37 -40
  165. package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -38
  166. package/dist/js/treeshaking/config/initial/index.js +10 -9
  167. package/dist/js/treeshaking/config/initial/inits.js +205 -106
  168. package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +27 -34
  169. package/dist/js/treeshaking/defineConfig.js +60 -13
  170. package/dist/js/treeshaking/exports/server.js +2 -1
  171. package/dist/js/treeshaking/hooks.js +30 -25
  172. package/dist/js/treeshaking/index.js +681 -256
  173. package/dist/js/treeshaking/initialize/index.js +290 -112
  174. package/dist/js/treeshaking/locale/en.js +34 -33
  175. package/dist/js/treeshaking/locale/index.js +5 -5
  176. package/dist/js/treeshaking/locale/zh.js +34 -33
  177. package/dist/js/treeshaking/schema/Schema.js +267 -69
  178. package/dist/js/treeshaking/schema/index.js +165 -121
  179. package/dist/js/treeshaking/schema/legacy.js +323 -256
  180. package/dist/js/treeshaking/types/config/deploy.js +1 -0
  181. package/dist/js/treeshaking/types/config/dev.js +1 -0
  182. package/dist/js/treeshaking/types/config/experiments.js +1 -0
  183. package/dist/js/treeshaking/types/config/html.js +1 -0
  184. package/dist/js/treeshaking/types/config/index.js +0 -1
  185. package/dist/js/treeshaking/types/config/output.js +1 -0
  186. package/dist/js/treeshaking/types/config/performance.js +1 -0
  187. package/dist/js/treeshaking/types/config/security.js +1 -0
  188. package/dist/js/treeshaking/types/config/source.js +1 -0
  189. package/dist/js/treeshaking/types/config/tools.js +1 -0
  190. package/dist/js/treeshaking/types/hooks.js +1 -0
  191. package/dist/js/treeshaking/types/index.js +0 -1
  192. package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
  193. package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
  194. package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
  195. package/dist/js/treeshaking/types/legacyConfig/output.js +1 -1
  196. package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
  197. package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
  198. package/dist/js/treeshaking/utils/commands.js +6 -5
  199. package/dist/js/treeshaking/utils/config.js +295 -117
  200. package/dist/js/treeshaking/utils/createFileWatcher.js +278 -118
  201. package/dist/js/treeshaking/utils/createServer.js +252 -67
  202. package/dist/js/treeshaking/utils/getSpecifiedEntries.js +182 -55
  203. package/dist/js/treeshaking/utils/language.js +6 -5
  204. package/dist/js/treeshaking/utils/printInstructions.js +151 -29
  205. package/dist/js/treeshaking/utils/restart.js +184 -42
  206. package/dist/js/treeshaking/utils/routes.js +151 -27
  207. package/dist/js/treeshaking/utils/types.js +1 -0
  208. package/dist/types/analyze/Builder.d.ts +8 -0
  209. package/dist/types/analyze/index.d.ts +2 -0
  210. package/dist/types/analyze/templates.d.ts +3 -1
  211. package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -1
  212. package/dist/types/builder/index.d.ts +3 -3
  213. package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +1 -7
  214. package/dist/types/defineConfig.d.ts +1 -0
  215. package/dist/types/index.d.ts +6 -1
  216. package/dist/types/initialize/index.d.ts +2 -0
  217. package/dist/types/types/config/dev.d.ts +2 -2
  218. package/dist/types/types/config/index.d.ts +1 -0
  219. package/dist/types/types/config/output.d.ts +0 -1
  220. package/dist/types/types/config/source.d.ts +1 -0
  221. package/dist/types/types/config/tools.d.ts +2 -0
  222. package/dist/types/types/hooks.d.ts +5 -0
  223. package/dist/types/types/legacyConfig/dev.d.ts +1 -0
  224. package/dist/types/types/legacyConfig/output.d.ts +1 -1
  225. package/dist/types/types/legacyConfig/source.d.ts +1 -0
  226. package/dist/types/types/legacyConfig/tools.d.ts +1 -0
  227. package/dist/types/utils/config.d.ts +1 -0
  228. package/dist/types/utils/createServer.d.ts +1 -0
  229. package/dist/types/utils/restart.d.ts +1 -1
  230. package/package.json +23 -22
@@ -1,145 +1,242 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+ var stdin_exports = {};
26
+ __export(stdin_exports, {
27
+ buildCommand: () => buildCommand,
28
+ default: () => src_default,
29
+ devCommand: () => devCommand
5
30
  });
6
- var _exportNames = {};
7
- exports.default = void 0;
8
- var _path = _interopRequireDefault(require("path"));
9
- var _pluginLint = _interopRequireDefault(require("@modern-js/plugin-lint"));
10
- var _utils = require("@modern-js/utils");
11
- var _analyze = _interopRequireDefault(require("./analyze"));
12
- var _initialize = _interopRequireDefault(require("./initialize"));
13
- var _hooks = require("./hooks");
14
- var _locale = require("./locale");
15
- var _language = require("./utils/language");
16
- var _commands = require("./utils/commands");
17
- var _restart = require("./utils/restart");
18
- var _defineConfig = require("./defineConfig");
19
- Object.keys(_defineConfig).forEach(function (key) {
20
- if (key === "default" || key === "__esModule") return;
21
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
22
- if (key in exports && exports[key] === _defineConfig[key]) return;
23
- Object.defineProperty(exports, key, {
24
- enumerable: true,
25
- get: function () {
26
- return _defineConfig[key];
31
+ module.exports = __toCommonJS(stdin_exports);
32
+ var import_path = __toESM(require("path"));
33
+ var import_plugin_lint = __toESM(require("@modern-js/plugin-lint"));
34
+ var import_utils = require("@modern-js/utils");
35
+ var import_lodash = require("@modern-js/utils/lodash");
36
+ var import_analyze = __toESM(require("./analyze"));
37
+ var import_initialize = __toESM(require("./initialize"));
38
+ var import_hooks = require("./hooks");
39
+ var import_locale = require("./locale");
40
+ var import_language = require("./utils/language");
41
+ var import_commands = require("./utils/commands");
42
+ var import_restart = require("./utils/restart");
43
+ __reExport(stdin_exports, require("./defineConfig"), module.exports);
44
+ __reExport(stdin_exports, require("./types"), module.exports);
45
+ var __create2 = Object.create;
46
+ var __defProp2 = Object.defineProperty;
47
+ var __defProps = Object.defineProperties;
48
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
49
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
50
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
51
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
52
+ var __getProtoOf2 = Object.getPrototypeOf;
53
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
54
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
55
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
56
+ var __spreadValues = (a, b) => {
57
+ for (var prop in b || (b = {}))
58
+ if (__hasOwnProp2.call(b, prop))
59
+ __defNormalProp(a, prop, b[prop]);
60
+ if (__getOwnPropSymbols)
61
+ for (var prop of __getOwnPropSymbols(b)) {
62
+ if (__propIsEnum.call(b, prop))
63
+ __defNormalProp(a, prop, b[prop]);
27
64
  }
65
+ return a;
66
+ };
67
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
68
+ var __copyProps2 = (to, from, except, desc) => {
69
+ if (from && typeof from === "object" || typeof from === "function") {
70
+ for (let key of __getOwnPropNames2(from))
71
+ if (!__hasOwnProp2.call(to, key) && key !== except)
72
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
73
+ }
74
+ return to;
75
+ };
76
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
77
+ isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
78
+ mod
79
+ ));
80
+ var __async = (__this, __arguments, generator) => {
81
+ return new Promise((resolve, reject) => {
82
+ var fulfilled = (value) => {
83
+ try {
84
+ step(generator.next(value));
85
+ } catch (e) {
86
+ reject(e);
87
+ }
88
+ };
89
+ var rejected = (value) => {
90
+ try {
91
+ step(generator.throw(value));
92
+ } catch (e) {
93
+ reject(e);
94
+ }
95
+ };
96
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
97
+ step((generator = generator.apply(__this, __arguments)).next());
28
98
  });
99
+ };
100
+ const upgradeModel = import_utils.Import.lazy(
101
+ "@modern-js/upgrade",
102
+ require
103
+ );
104
+ const devCommand = (program, api) => __async(void 0, null, function* () {
105
+ const runner = api.useHookRunners();
106
+ const devToolMetas = yield runner.registerDev();
107
+ const devProgram = program.command("dev").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.dev.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("-e --entry [entry...]", import_locale.i18n.t(import_locale.localeKeys.command.dev.entry)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).action((options) => __async(void 0, null, function* () {
108
+ const { dev } = yield Promise.resolve().then(() => __toESM2(require("./commands/dev")));
109
+ yield dev(api, options);
110
+ }));
111
+ for (const meta of devToolMetas) {
112
+ if (!meta.subCommands) {
113
+ continue;
114
+ }
115
+ for (const subCmd of meta.subCommands) {
116
+ devProgram.command(subCmd).action((..._0) => __async(void 0, [..._0], function* (options = {}) {
117
+ const { appDirectory } = api.useAppContext();
118
+ const { isTypescript } = yield Promise.resolve().then(() => __toESM2(require("@modern-js/utils")));
119
+ yield runner.beforeDevTask(meta);
120
+ yield meta.action(options, {
121
+ isTsProject: isTypescript(appDirectory)
122
+ });
123
+ }));
124
+ }
125
+ }
29
126
  });
30
- var _types = require("./types");
31
- Object.keys(_types).forEach(function (key) {
32
- if (key === "default" || key === "__esModule") return;
33
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
34
- if (key in exports && exports[key] === _types[key]) return;
35
- Object.defineProperty(exports, key, {
36
- enumerable: true,
37
- get: function () {
38
- return _types[key];
127
+ const buildCommand = (program, api) => __async(void 0, null, function* () {
128
+ const runner = api.useHookRunners();
129
+ const platformBuilders = yield runner.registerBuildPlatform();
130
+ const buildProgram = program.command("build").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.build.describe)).option("-c --config <config>", import_locale.i18n.t(import_locale.localeKeys.command.shared.config)).option("--analyze", import_locale.i18n.t(import_locale.localeKeys.command.shared.analyze)).action((options) => __async(void 0, null, function* () {
131
+ const { build } = yield Promise.resolve().then(() => __toESM2(require("./commands/build")));
132
+ yield build(api, options);
133
+ process.exit(0);
134
+ }));
135
+ for (const platformBuilder of platformBuilders) {
136
+ const platforms = (0, import_lodash.castArray)(platformBuilder.platform);
137
+ for (const platform of platforms) {
138
+ buildProgram.command(platform).action(() => __async(void 0, null, function* () {
139
+ const { appDirectory } = api.useAppContext();
140
+ const { isTypescript } = yield Promise.resolve().then(() => __toESM2(require("@modern-js/utils")));
141
+ yield runner.beforeBuildPlatform(platformBuilders);
142
+ yield platformBuilder.build(platform, {
143
+ isTsProject: isTypescript(appDirectory)
144
+ });
145
+ }));
39
146
  }
40
- });
147
+ }
41
148
  });
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
43
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
44
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
46
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
47
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
48
- const upgradeModel = _utils.Import.lazy('@modern-js/upgrade', require);
49
- var _default = () => ({
50
- name: '@modern-js/app-tools',
51
- post: ['@modern-js/plugin-initialize', '@modern-js/plugin-analyze', '@modern-js/plugin-ssr', '@modern-js/plugin-document', '@modern-js/plugin-state', '@modern-js/plugin-router', '@modern-js/plugin-router-legacy', '@modern-js/plugin-polyfill'],
52
- registerHook: _hooks.hooks,
53
- usePlugins: [(0, _initialize.default)(), (0, _analyze.default)(), (0, _pluginLint.default)()],
54
- setup: api => {
55
- const locale = (0, _language.getLocaleLanguage)();
56
- _locale.i18n.changeLanguage({
57
- locale
58
- });
149
+ var src_default = () => ({
150
+ name: "@modern-js/app-tools",
151
+ post: [
152
+ "@modern-js/plugin-initialize",
153
+ "@modern-js/plugin-analyze",
154
+ "@modern-js/plugin-ssr",
155
+ "@modern-js/plugin-document",
156
+ "@modern-js/plugin-state",
157
+ "@modern-js/plugin-router",
158
+ "@modern-js/plugin-router-legacy",
159
+ "@modern-js/plugin-polyfill"
160
+ ],
161
+ registerHook: import_hooks.hooks,
162
+ usePlugins: [(0, import_initialize.default)(), (0, import_analyze.default)(), (0, import_plugin_lint.default)()],
163
+ setup: (api) => {
164
+ const locale = (0, import_language.getLocaleLanguage)();
165
+ import_locale.i18n.changeLanguage({ locale });
59
166
  return {
60
- commands({
61
- program
62
- }) {
63
- program.command('dev').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.dev.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('-e --entry [entry...]', _locale.i18n.t(_locale.localeKeys.command.dev.entry)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).action(async options => {
64
- const {
65
- dev
66
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/dev")));
67
- await dev(api, options);
68
- });
69
- program.command('build').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.build.describe)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).option('--analyze', _locale.i18n.t(_locale.localeKeys.command.shared.analyze)).action(async options => {
70
- const {
71
- build
72
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
73
- await build(api, options);
74
- // force exit after build.
75
- // eslint-disable-next-line no-process-exit
76
- process.exit(0);
77
- });
78
- program.command('start').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.start.describe)).option('--api-only', _locale.i18n.t(_locale.localeKeys.command.dev.apiOnly)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async () => {
79
- const {
80
- start
81
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/start")));
82
- await start(api);
83
- });
84
- program.command('deploy').usage('[options]').option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).description(_locale.i18n.t(_locale.localeKeys.command.deploy.describe)).action(async options => {
85
- const {
86
- build
87
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/build")));
88
- await build(api);
89
- const {
90
- deploy
91
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/deploy")));
92
- await deploy(api, options);
93
- // eslint-disable-next-line no-process-exit
94
- process.exit(0);
95
- });
96
- program.command('new').usage('[options]').description(_locale.i18n.t(_locale.localeKeys.command.new.describe)).option('-d, --debug', _locale.i18n.t(_locale.localeKeys.command.new.debug), false).option('-c, --config <config>', _locale.i18n.t(_locale.localeKeys.command.new.config)).option('--dist-tag <tag>', _locale.i18n.t(_locale.localeKeys.command.new.distTag)).option('--registry', _locale.i18n.t(_locale.localeKeys.command.new.registry)).action(async options => {
97
- const {
98
- MWANewAction
99
- } = await Promise.resolve().then(() => _interopRequireWildcard(require('@modern-js/new-action')));
100
- await MWANewAction(_objectSpread(_objectSpread({}, options), {}, {
101
- locale
167
+ commands(_0) {
168
+ return __async(this, arguments, function* ({ program }) {
169
+ yield devCommand(program, api);
170
+ yield buildCommand(program, api);
171
+ program.command("start").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.start.describe)).option("--api-only", import_locale.i18n.t(import_locale.localeKeys.command.dev.apiOnly)).option(
172
+ "-c --config <config>",
173
+ import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
174
+ ).action(() => __async(this, null, function* () {
175
+ const { start } = yield Promise.resolve().then(() => __toESM2(require("./commands/start")));
176
+ yield start(api);
177
+ }));
178
+ program.command("deploy").usage("[options]").option(
179
+ "-c --config <config>",
180
+ import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
181
+ ).description(import_locale.i18n.t(import_locale.localeKeys.command.deploy.describe)).action((options) => __async(this, null, function* () {
182
+ const { build } = yield Promise.resolve().then(() => __toESM2(require("./commands/build")));
183
+ yield build(api);
184
+ const { deploy } = yield Promise.resolve().then(() => __toESM2(require("./commands/deploy")));
185
+ yield deploy(api, options);
186
+ process.exit(0);
102
187
  }));
188
+ program.command("new").usage("[options]").description(import_locale.i18n.t(import_locale.localeKeys.command.new.describe)).option("-d, --debug", import_locale.i18n.t(import_locale.localeKeys.command.new.debug), false).option(
189
+ "-c, --config <config>",
190
+ import_locale.i18n.t(import_locale.localeKeys.command.new.config)
191
+ ).option("--dist-tag <tag>", import_locale.i18n.t(import_locale.localeKeys.command.new.distTag)).option("--registry", import_locale.i18n.t(import_locale.localeKeys.command.new.registry)).action((options) => __async(this, null, function* () {
192
+ const { MWANewAction } = yield Promise.resolve().then(() => __toESM2(require("@modern-js/new-action")));
193
+ yield MWANewAction(__spreadProps(__spreadValues({}, options), { locale }));
194
+ }));
195
+ program.command("inspect").description("inspect internal webpack config").option(
196
+ `--env <env>`,
197
+ import_locale.i18n.t(import_locale.localeKeys.command.inspect.env),
198
+ "development"
199
+ ).option(
200
+ "--output <output>",
201
+ import_locale.i18n.t(import_locale.localeKeys.command.inspect.output),
202
+ "/"
203
+ ).option("--verbose", import_locale.i18n.t(import_locale.localeKeys.command.inspect.verbose)).option(
204
+ "-c --config <config>",
205
+ import_locale.i18n.t(import_locale.localeKeys.command.shared.config)
206
+ ).action((options) => __async(this, null, function* () {
207
+ const { inspect } = yield Promise.resolve().then(() => __toESM2(require("./commands/inspect")));
208
+ inspect(api, options);
209
+ }));
210
+ upgradeModel.defineCommand(program.command("upgrade"));
103
211
  });
104
- program.command('inspect').description('inspect internal webpack config').option(`--env <env>`, _locale.i18n.t(_locale.localeKeys.command.inspect.env), 'development').option('--output <output>', _locale.i18n.t(_locale.localeKeys.command.inspect.output), '/').option('--verbose', _locale.i18n.t(_locale.localeKeys.command.inspect.verbose)).option('-c --config <config>', _locale.i18n.t(_locale.localeKeys.command.shared.config)).action(async options => {
105
- const {
106
- inspect
107
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./commands/inspect")));
108
- inspect(api, options);
212
+ },
213
+ prepare() {
214
+ return __async(this, null, function* () {
215
+ const command = (0, import_commands.getCommand)();
216
+ if (command === "dev" || command === "build") {
217
+ const appContext = api.useAppContext();
218
+ yield (0, import_utils.emptyDir)(appContext.distDirectory);
219
+ }
109
220
  });
110
- upgradeModel.defineCommand(program.command('upgrade'));
111
221
  },
112
- async prepare() {
113
- const command = (0, _commands.getCommand)();
114
- if (command === 'dev' || command === 'build') {
222
+ fileChange(e) {
223
+ return __async(this, null, function* () {
224
+ const { filename, eventType } = e;
115
225
  const appContext = api.useAppContext();
116
- await (0, _utils.emptyDir)(appContext.distDirectory);
117
- }
118
- },
119
- // 这里会被 core/initWatcher 监听的文件变动触发,如果是 src 目录下的文件变动,则不做 restart
120
- async fileChange(e) {
121
- const {
122
- filename,
123
- eventType
124
- } = e;
125
- const appContext = api.useAppContext();
126
- const {
127
- appDirectory,
128
- srcDirectory
129
- } = appContext;
130
- const absolutePath = _path.default.resolve(appDirectory, filename);
131
- if (!absolutePath.includes(srcDirectory) && (eventType === 'change' || eventType === 'unlink')) {
132
- const {
133
- closeServer
134
- } = await Promise.resolve().then(() => _interopRequireWildcard(require("./utils/createServer")));
135
- await closeServer();
136
- await (0, _restart.restart)(api.useHookRunners());
137
- }
226
+ const { appDirectory, srcDirectory } = appContext;
227
+ const absolutePath = import_path.default.resolve(appDirectory, filename);
228
+ if (!absolutePath.includes(srcDirectory) && (eventType === "change" || eventType === "unlink")) {
229
+ const { closeServer } = yield Promise.resolve().then(() => __toESM2(require("./utils/createServer")));
230
+ yield closeServer();
231
+ yield (0, import_restart.restart)(api.useHookRunners(), filename);
232
+ }
233
+ });
138
234
  },
139
- async beforeRestart() {
140
- (0, _utils.cleanRequireCache)([require.resolve("./analyze")]);
235
+ beforeRestart() {
236
+ return __async(this, null, function* () {
237
+ (0, import_utils.cleanRequireCache)([require.resolve("./analyze")]);
238
+ });
141
239
  }
142
240
  };
143
241
  }
144
242
  });
145
- exports.default = _default;
@@ -1,79 +1,134 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var stdin_exports = {};
19
+ __export(stdin_exports, {
20
+ default: () => initialize_default
5
21
  });
6
- exports.default = void 0;
7
- var _utils = require("@modern-js/utils");
8
- var _schema = require("../schema");
9
- var _commands = require("../utils/commands");
10
- var _transformNormalizedConfig = require("../config/initial/transformNormalizedConfig");
11
- var _config = require("../config");
12
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
13
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
14
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
- var _default = () => ({
16
- name: '@modern-js/plugin-initialize',
22
+ module.exports = __toCommonJS(stdin_exports);
23
+ var import_utils = require("@modern-js/utils");
24
+ var import_schema = require("../schema");
25
+ var import_commands = require("../utils/commands");
26
+ var import_transformNormalizedConfig = require("../config/initial/transformNormalizedConfig");
27
+ var import_config = require("../config");
28
+ var __defProp2 = Object.defineProperty;
29
+ var __defProps = Object.defineProperties;
30
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
31
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
32
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
33
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
34
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
35
+ var __spreadValues = (a, b) => {
36
+ for (var prop in b || (b = {}))
37
+ if (__hasOwnProp2.call(b, prop))
38
+ __defNormalProp(a, prop, b[prop]);
39
+ if (__getOwnPropSymbols)
40
+ for (var prop of __getOwnPropSymbols(b)) {
41
+ if (__propIsEnum.call(b, prop))
42
+ __defNormalProp(a, prop, b[prop]);
43
+ }
44
+ return a;
45
+ };
46
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
47
+ var __async = (__this, __arguments, generator) => {
48
+ return new Promise((resolve, reject) => {
49
+ var fulfilled = (value) => {
50
+ try {
51
+ step(generator.next(value));
52
+ } catch (e) {
53
+ reject(e);
54
+ }
55
+ };
56
+ var rejected = (value) => {
57
+ try {
58
+ step(generator.throw(value));
59
+ } catch (e) {
60
+ reject(e);
61
+ }
62
+ };
63
+ var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
64
+ step((generator = generator.apply(__this, __arguments)).next());
65
+ });
66
+ };
67
+ var initialize_default = () => ({
68
+ name: "@modern-js/plugin-initialize",
17
69
  setup(api) {
18
70
  const config = () => {
19
71
  const appContext = api.useAppContext();
20
72
  const userConfig = api.useConfigContext();
21
- return (0, _config.checkIsLegacyConfig)(userConfig) ? (0, _config.createLegacyDefaultConfig)(appContext) : (0, _config.createDefaultConfig)(appContext);
73
+ return (0, import_config.checkIsLegacyConfig)(userConfig) ? (0, import_config.createLegacyDefaultConfig)(appContext) : (0, import_config.createDefaultConfig)(appContext);
22
74
  };
23
75
  const validateSchema = () => {
24
76
  const userConfig = api.useConfigContext();
25
- const schemas = (0, _config.checkIsLegacyConfig)(userConfig) ? _schema.legacySchema : _schema.schema;
77
+ const schemas = (0, import_config.checkIsLegacyConfig)(userConfig) ? import_schema.legacySchema : import_schema.schema;
26
78
  return schemas.generate();
27
79
  };
28
80
  return {
29
81
  config,
30
82
  validateSchema,
31
- async resolvedConfig({
32
- resolved
33
- }) {
34
- var _resolved$output$dist, _normalizedConfig$ser;
35
- let appContext = api.useAppContext();
36
- const userConfig = api.useConfigContext();
37
- const port = await getDevServerPort(appContext, resolved);
38
- appContext = _objectSpread(_objectSpread({}, appContext), {}, {
39
- port,
40
- distDirectory: (0, _utils.ensureAbsolutePath)(appContext.distDirectory, ((_resolved$output$dist = resolved.output.distPath) === null || _resolved$output$dist === void 0 ? void 0 : _resolved$output$dist.root) || 'dist')
83
+ resolvedConfig(_0) {
84
+ return __async(this, arguments, function* ({ resolved }) {
85
+ var _a2, _b;
86
+ let appContext = api.useAppContext();
87
+ const userConfig = api.useConfigContext();
88
+ const port = yield getDevServerPort(appContext, resolved);
89
+ appContext = __spreadProps(__spreadValues({}, appContext), {
90
+ port,
91
+ distDirectory: (0, import_utils.ensureAbsolutePath)(
92
+ appContext.distDirectory,
93
+ ((_a2 = resolved.output.distPath) == null ? void 0 : _a2.root) || "dist"
94
+ )
95
+ });
96
+ api.setAppContext(appContext);
97
+ const normalizedConfig = (0, import_config.checkIsLegacyConfig)(resolved) ? (0, import_transformNormalizedConfig.transformNormalizedConfig)(resolved) : resolved;
98
+ return {
99
+ resolved: {
100
+ _raw: userConfig,
101
+ source: normalizedConfig.source || {},
102
+ server: __spreadProps(__spreadValues({}, normalizedConfig.server || {}), {
103
+ port: port || ((_b = normalizedConfig.server) == null ? void 0 : _b.port)
104
+ }),
105
+ bff: normalizedConfig.bff || {},
106
+ dev: normalizedConfig.dev || {},
107
+ html: normalizedConfig.html || {},
108
+ output: normalizedConfig.output || {},
109
+ security: normalizedConfig.security || {},
110
+ tools: normalizedConfig.tools || {},
111
+ testing: normalizedConfig.testing || {},
112
+ plugins: normalizedConfig.plugins || [],
113
+ runtime: normalizedConfig.runtime || {},
114
+ runtimeByEntries: normalizedConfig.runtimeByEntries || {},
115
+ deploy: normalizedConfig.deploy || {},
116
+ performance: normalizedConfig.performance || {},
117
+ experiments: normalizedConfig.experiments || {}
118
+ }
119
+ };
41
120
  });
42
- api.setAppContext(appContext);
43
- const normalizedConfig = (0, _config.checkIsLegacyConfig)(resolved) ? (0, _transformNormalizedConfig.transformNormalizedConfig)(resolved) : resolved;
44
- return {
45
- resolved: {
46
- // FIXME: the userConfig mayby legacy userConfig
47
- _raw: userConfig,
48
- source: normalizedConfig.source || {},
49
- server: _objectSpread(_objectSpread({}, normalizedConfig.server || {}), {}, {
50
- port: port || ((_normalizedConfig$ser = normalizedConfig.server) === null || _normalizedConfig$ser === void 0 ? void 0 : _normalizedConfig$ser.port)
51
- }),
52
- bff: normalizedConfig.bff || {},
53
- dev: normalizedConfig.dev || {},
54
- html: normalizedConfig.html || {},
55
- output: normalizedConfig.output || {},
56
- security: normalizedConfig.security || {},
57
- tools: normalizedConfig.tools || {},
58
- testing: normalizedConfig.testing || {},
59
- plugins: normalizedConfig.plugins || [],
60
- runtime: normalizedConfig.runtime || {},
61
- runtimeByEntries: normalizedConfig.runtimeByEntries || {},
62
- deploy: normalizedConfig.deploy || {},
63
- performance: normalizedConfig.performance || {},
64
- experiments: normalizedConfig.experiments || {}
65
- }
66
- };
67
121
  }
68
122
  };
69
123
  }
70
124
  });
71
- exports.default = _default;
72
- async function getDevServerPort(appContext, resolved) {
73
- const command = (0, _commands.getCommand)();
74
- if ((0, _utils.isDev)() && command === 'dev') {
75
- var _appContext$port;
76
- return ((_appContext$port = appContext.port) !== null && _appContext$port !== void 0 ? _appContext$port : 0) > 0 ? appContext.port : await (0, _utils.getPort)(resolved.server.port || 8080);
77
- }
78
- return resolved.server.port;
79
- }
125
+ function getDevServerPort(appContext, resolved) {
126
+ return __async(this, null, function* () {
127
+ var _a;
128
+ const command = (0, import_commands.getCommand)();
129
+ if ((0, import_utils.isDev)() && command === "dev") {
130
+ return ((_a = appContext.port) != null ? _a : 0) > 0 ? appContext.port : yield (0, import_utils.getPort)(resolved.server.port || 8080);
131
+ }
132
+ return resolved.server.port;
133
+ });
134
+ }