@modern-js/app-tools 1.22.2 → 2.0.0-alpha.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.
- package/CHANGELOG.md +1383 -104
- package/bin/modern.js +13 -1
- package/dist/js/modern/analyze/Builder.js +39 -0
- package/dist/js/modern/analyze/constants.js +48 -15
- package/dist/js/modern/analyze/generateCode.js +286 -133
- package/dist/js/modern/analyze/getBundleEntry.js +39 -41
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +220 -0
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +216 -0
- package/dist/js/modern/analyze/getClientRoutes/index.js +6 -0
- package/dist/js/modern/analyze/getClientRoutes/utils.js +31 -0
- package/dist/js/modern/analyze/getFileSystemEntry.js +74 -39
- package/dist/js/modern/analyze/getHtmlTemplate.js +90 -57
- package/dist/js/modern/analyze/getServerRoutes.js +123 -140
- package/dist/js/modern/analyze/index.js +220 -133
- package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -20
- package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -13
- package/dist/js/modern/analyze/nestedRoutes.js +166 -0
- package/dist/js/modern/analyze/templates.js +289 -29
- package/dist/js/modern/analyze/utils.js +128 -58
- package/dist/js/modern/builder/builderPlugins/compatModern.js +233 -0
- package/dist/js/modern/builder/index.js +154 -0
- package/dist/js/modern/builder/loaders/routerLoader.js +17 -0
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +7 -0
- package/dist/js/modern/builder/share.js +46 -0
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +30 -0
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +37 -0
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +113 -0
- package/dist/js/modern/commands/build.js +75 -138
- package/dist/js/modern/commands/deploy.js +27 -4
- package/dist/js/modern/commands/dev.js +102 -66
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/inspect.js +33 -64
- package/dist/js/modern/commands/serve.js +54 -0
- package/dist/js/modern/config/default.js +173 -0
- package/dist/js/modern/config/index.js +8 -0
- package/dist/js/modern/config/initial/createHtmlConfig.js +35 -0
- package/dist/js/modern/config/initial/createOutputConfig.js +68 -0
- package/dist/js/modern/config/initial/createSourceConfig.js +39 -0
- package/dist/js/modern/config/initial/createToolsConfig.js +42 -0
- package/dist/js/modern/config/initial/index.js +16 -0
- package/dist/js/modern/config/initial/inits.js +153 -0
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +47 -0
- package/dist/js/modern/defineConfig.js +27 -0
- package/dist/js/modern/exports/server.js +4 -1
- package/dist/js/modern/hooks.js +37 -21
- package/dist/js/modern/index.js +185 -94
- package/dist/js/modern/initialize/index.js +120 -0
- package/dist/js/modern/locale/en.js +20 -22
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +21 -23
- package/dist/js/modern/schema/Schema.js +40 -0
- package/dist/js/modern/schema/index.js +88 -0
- package/dist/js/modern/schema/legacy.js +148 -0
- package/dist/js/modern/types/config/deploy.js +0 -0
- package/dist/js/modern/types/config/dev.js +0 -0
- package/dist/js/modern/types/config/experiments.js +0 -0
- package/dist/js/modern/types/config/html.js +0 -0
- package/dist/js/modern/types/config/index.js +1 -0
- package/dist/js/modern/types/config/output.js +0 -0
- package/dist/js/modern/types/config/performance.js +0 -0
- package/dist/js/modern/types/config/security.js +0 -0
- package/dist/js/modern/types/config/source.js +0 -0
- package/dist/js/modern/types/config/tools.js +0 -0
- package/dist/js/modern/types/hooks.js +0 -0
- package/dist/js/modern/types/index.js +3 -0
- package/dist/js/modern/types/legacyConfig/deploy.js +0 -0
- package/dist/js/modern/types/legacyConfig/dev.js +0 -0
- package/dist/js/modern/types/legacyConfig/index.js +0 -0
- package/dist/js/modern/types/legacyConfig/output.js +0 -0
- package/dist/js/modern/types/legacyConfig/source.js +0 -0
- package/dist/js/modern/types/legacyConfig/tools.js +0 -0
- package/dist/js/modern/utils/commands.js +13 -0
- package/dist/js/modern/utils/config.js +102 -52
- package/dist/js/modern/utils/createFileWatcher.js +115 -0
- package/dist/js/modern/utils/createServer.js +67 -10
- package/dist/js/modern/utils/getServerInternalPlugins.js +58 -0
- package/dist/js/modern/utils/getSpecifiedEntries.js +46 -25
- package/dist/js/modern/utils/language.js +6 -3
- package/dist/js/modern/utils/printInstructions.js +29 -9
- package/dist/js/modern/utils/restart.js +44 -0
- package/dist/js/modern/utils/routes.js +29 -14
- package/dist/js/node/analyze/Builder.js +64 -0
- package/dist/js/node/analyze/constants.js +86 -33
- package/dist/js/node/analyze/generateCode.js +305 -163
- package/dist/js/node/analyze/getBundleEntry.js +66 -58
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +242 -0
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +238 -0
- package/dist/js/node/analyze/getClientRoutes/index.js +30 -0
- package/dist/js/node/analyze/getClientRoutes/utils.js +58 -0
- package/dist/js/node/analyze/getFileSystemEntry.js +99 -58
- package/dist/js/node/analyze/getHtmlTemplate.js +121 -83
- package/dist/js/node/analyze/getServerRoutes.js +146 -160
- package/dist/js/node/analyze/index.js +243 -161
- package/dist/js/node/analyze/isDefaultExportFunction.js +59 -38
- package/dist/js/node/analyze/makeLegalIdentifier.js +31 -19
- package/dist/js/node/analyze/nestedRoutes.js +193 -0
- package/dist/js/node/analyze/templates.js +316 -43
- package/dist/js/node/analyze/utils.js +158 -78
- package/dist/js/node/builder/builderPlugins/compatModern.js +258 -0
- package/dist/js/node/builder/index.js +177 -0
- package/dist/js/node/builder/loaders/routerLoader.js +38 -0
- package/dist/js/node/builder/loaders/serverModuleLoader.js +28 -0
- package/dist/js/node/builder/share.js +75 -0
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +53 -0
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +60 -0
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +135 -0
- package/dist/js/node/commands/build.js +97 -159
- package/dist/js/node/commands/deploy.js +49 -12
- package/dist/js/node/commands/dev.js +121 -93
- package/dist/js/node/commands/index.js +19 -44
- package/dist/js/node/commands/inspect.js +56 -93
- package/dist/js/node/commands/serve.js +83 -0
- package/dist/js/node/config/default.js +195 -0
- package/dist/js/node/config/index.js +34 -0
- package/dist/js/node/config/initial/createHtmlConfig.js +58 -0
- package/dist/js/node/config/initial/createOutputConfig.js +91 -0
- package/dist/js/node/config/initial/createSourceConfig.js +62 -0
- package/dist/js/node/config/initial/createToolsConfig.js +65 -0
- package/dist/js/node/config/initial/index.js +41 -0
- package/dist/js/node/config/initial/inits.js +176 -0
- package/dist/js/node/config/initial/transformNormalizedConfig.js +70 -0
- package/dist/js/node/defineConfig.js +49 -0
- package/dist/js/node/exports/server.js +25 -11
- package/dist/js/node/hooks.js +53 -36
- package/dist/js/node/index.js +216 -128
- package/dist/js/node/initialize/index.js +135 -0
- package/dist/js/node/locale/en.js +40 -26
- package/dist/js/node/locale/index.js +31 -18
- package/dist/js/node/locale/zh.js +41 -27
- package/dist/js/node/schema/Schema.js +63 -0
- package/dist/js/node/schema/index.js +118 -0
- package/dist/js/node/schema/legacy.js +169 -0
- package/dist/js/node/types/config/deploy.js +15 -0
- package/dist/js/node/types/config/dev.js +15 -0
- package/dist/js/node/types/config/experiments.js +15 -0
- package/dist/js/node/types/config/html.js +15 -0
- package/dist/js/node/types/config/index.js +17 -0
- package/dist/js/node/types/config/output.js +15 -0
- package/dist/js/node/types/config/performance.js +15 -0
- package/dist/js/node/types/config/security.js +15 -0
- package/dist/js/node/types/config/source.js +15 -0
- package/dist/js/node/types/config/tools.js +15 -0
- package/dist/js/node/types/hooks.js +15 -0
- package/dist/js/node/types/index.js +19 -0
- package/dist/js/node/types/legacyConfig/deploy.js +15 -0
- package/dist/js/node/types/legacyConfig/dev.js +15 -0
- package/dist/js/node/types/legacyConfig/index.js +15 -0
- package/dist/js/node/types/legacyConfig/output.js +15 -0
- package/dist/js/node/types/legacyConfig/source.js +15 -0
- package/dist/js/node/types/legacyConfig/tools.js +15 -0
- package/dist/js/node/utils/commands.js +37 -0
- package/dist/js/node/utils/config.js +125 -75
- package/dist/js/node/utils/createFileWatcher.js +139 -0
- package/dist/js/node/utils/createServer.js +96 -25
- package/dist/js/node/utils/getServerInternalPlugins.js +79 -0
- package/dist/js/node/utils/getSpecifiedEntries.js +68 -34
- package/dist/js/node/utils/language.js +28 -10
- package/dist/js/node/utils/printInstructions.js +51 -19
- package/dist/js/node/utils/restart.js +67 -0
- package/dist/js/node/utils/routes.js +58 -24
- package/dist/js/node/utils/types.js +15 -0
- package/dist/js/treeshaking/analyze/Builder.js +199 -0
- package/dist/js/treeshaking/analyze/constants.js +37 -0
- package/dist/js/treeshaking/analyze/generateCode.js +615 -0
- package/dist/js/treeshaking/analyze/getBundleEntry.js +64 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +233 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +231 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -0
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +23 -0
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +107 -0
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +302 -0
- package/dist/js/treeshaking/analyze/getServerRoutes.js +222 -0
- package/dist/js/treeshaking/analyze/index.js +589 -0
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +47 -0
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -0
- package/dist/js/treeshaking/analyze/nestedRoutes.js +426 -0
- package/dist/js/treeshaking/analyze/templates.js +446 -0
- package/dist/js/treeshaking/analyze/utils.js +390 -0
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +304 -0
- package/dist/js/treeshaking/builder/index.js +374 -0
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +13 -0
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +5 -0
- package/dist/js/treeshaking/builder/share.js +40 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +110 -0
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +72 -0
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +343 -0
- package/dist/js/treeshaking/commands/build.js +291 -0
- package/dist/js/treeshaking/commands/deploy.js +154 -0
- package/dist/js/treeshaking/commands/dev.js +319 -0
- package/dist/js/treeshaking/commands/index.js +3 -0
- package/dist/js/treeshaking/commands/inspect.js +149 -0
- package/dist/js/treeshaking/commands/serve.js +199 -0
- package/dist/js/treeshaking/config/default.js +208 -0
- package/dist/js/treeshaking/config/index.js +3 -0
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -0
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +41 -0
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +42 -0
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -0
- package/dist/js/treeshaking/config/initial/index.js +12 -0
- package/dist/js/treeshaking/config/initial/inits.js +213 -0
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +35 -0
- package/dist/js/treeshaking/defineConfig.js +61 -0
- package/dist/js/treeshaking/exports/server.js +2 -0
- package/dist/js/treeshaking/hooks.js +31 -0
- package/dist/js/treeshaking/index.js +694 -0
- package/dist/js/treeshaking/initialize/index.js +300 -0
- package/dist/js/treeshaking/locale/en.js +35 -0
- package/dist/js/treeshaking/locale/index.js +9 -0
- package/dist/js/treeshaking/locale/zh.js +35 -0
- package/dist/js/treeshaking/schema/Schema.js +273 -0
- package/dist/js/treeshaking/schema/index.js +181 -0
- package/dist/js/treeshaking/schema/legacy.js +337 -0
- package/dist/js/treeshaking/types/config/deploy.js +1 -0
- package/dist/js/treeshaking/types/config/dev.js +1 -0
- package/dist/js/treeshaking/types/config/experiments.js +1 -0
- package/dist/js/treeshaking/types/config/html.js +1 -0
- package/dist/js/treeshaking/types/config/index.js +1 -0
- package/dist/js/treeshaking/types/config/output.js +1 -0
- package/dist/js/treeshaking/types/config/performance.js +1 -0
- package/dist/js/treeshaking/types/config/security.js +1 -0
- package/dist/js/treeshaking/types/config/source.js +1 -0
- package/dist/js/treeshaking/types/config/tools.js +1 -0
- package/dist/js/treeshaking/types/hooks.js +1 -0
- package/dist/js/treeshaking/types/index.js +3 -0
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
- package/dist/js/treeshaking/utils/commands.js +10 -0
- package/dist/js/treeshaking/utils/config.js +302 -0
- package/dist/js/treeshaking/utils/createFileWatcher.js +283 -0
- package/dist/js/treeshaking/utils/createServer.js +258 -0
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +210 -0
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +185 -0
- package/dist/js/treeshaking/utils/language.js +6 -0
- package/dist/js/treeshaking/utils/printInstructions.js +152 -0
- package/dist/js/treeshaking/utils/restart.js +187 -0
- package/dist/js/treeshaking/utils/routes.js +153 -0
- package/dist/js/treeshaking/utils/types.js +1 -0
- package/dist/types/analyze/Builder.d.ts +8 -0
- package/dist/types/analyze/constants.d.ts +13 -1
- package/dist/types/analyze/generateCode.d.ts +3 -2
- package/dist/types/analyze/getBundleEntry.d.ts +2 -2
- package/dist/types/analyze/{getClientRoutes.d.ts → getClientRoutes/getRoutes.d.ts} +2 -7
- package/dist/types/analyze/getClientRoutes/getRoutesLegacy.d.ts +15 -0
- package/dist/types/analyze/getClientRoutes/index.d.ts +2 -0
- package/dist/types/analyze/getClientRoutes/utils.d.ts +5 -0
- package/dist/types/analyze/getFileSystemEntry.d.ts +2 -2
- package/dist/types/analyze/getHtmlTemplate.d.ts +3 -3
- package/dist/types/analyze/getServerRoutes.d.ts +3 -2
- package/dist/types/analyze/index.d.ts +3 -40
- package/dist/types/analyze/nestedRoutes.d.ts +5 -0
- package/dist/types/analyze/templates.d.ts +24 -5
- package/dist/types/analyze/utils.d.ts +12 -2
- package/dist/types/builder/builderPlugins/compatModern.d.ts +14 -0
- package/dist/types/builder/index.d.ts +18 -0
- package/dist/types/builder/loaders/routerLoader.d.ts +3 -0
- package/dist/types/builder/loaders/serverModuleLoader.d.ts +3 -0
- package/dist/types/builder/share.d.ts +26 -0
- package/dist/types/builder/webpackPlugins/htmlAsyncChunkPlugin.d.ts +8 -0
- package/dist/types/builder/webpackPlugins/htmlBottomTemplate.d.ts +10 -0
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +4 -0
- package/dist/types/commands/build.d.ts +2 -1
- package/dist/types/commands/deploy.d.ts +2 -1
- package/dist/types/commands/dev.d.ts +2 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/inspect.d.ts +10 -6
- package/dist/types/commands/serve.d.ts +3 -0
- package/dist/types/config/default.d.ts +3 -0
- package/dist/types/config/index.d.ts +2 -0
- package/dist/types/config/initial/createHtmlConfig.d.ts +2 -0
- package/dist/types/config/initial/createOutputConfig.d.ts +2 -0
- package/dist/types/config/initial/createSourceConfig.d.ts +2 -0
- package/dist/types/config/initial/createToolsConfig.d.ts +2 -0
- package/dist/types/config/initial/index.d.ts +4 -0
- package/dist/types/config/initial/inits.d.ts +4 -0
- package/dist/types/config/initial/transformNormalizedConfig.d.ts +2 -0
- package/dist/types/defineConfig.d.ts +8 -0
- package/dist/types/hooks.d.ts +2 -37
- package/dist/types/index.d.ts +9 -3
- package/dist/types/initialize/index.d.ts +5 -0
- package/dist/types/locale/en.d.ts +1 -2
- package/dist/types/locale/index.d.ts +2 -4
- package/dist/types/locale/zh.d.ts +1 -2
- package/dist/types/schema/Schema.d.ts +14 -0
- package/dist/types/schema/index.d.ts +4 -0
- package/dist/types/schema/legacy.d.ts +3 -0
- package/dist/types/types/config/deploy.d.ts +9 -0
- package/dist/types/types/config/dev.d.ts +13 -0
- package/dist/types/types/config/experiments.d.ts +4 -0
- package/dist/types/types/config/html.d.ts +4 -0
- package/dist/types/types/config/index.d.ts +66 -0
- package/dist/types/types/config/output.d.ts +22 -0
- package/dist/types/types/config/performance.d.ts +4 -0
- package/dist/types/types/config/security.d.ts +4 -0
- package/dist/types/types/config/source.d.ts +24 -0
- package/dist/types/types/config/tools.d.ts +24 -0
- package/dist/types/types/hooks.d.ts +89 -0
- package/dist/types/types/index.d.ts +23 -0
- package/dist/types/types/legacyConfig/deploy.d.ts +8 -0
- package/dist/types/types/legacyConfig/dev.d.ts +13 -0
- package/dist/types/types/legacyConfig/index.d.ts +33 -0
- package/dist/types/types/legacyConfig/output.d.ts +51 -0
- package/dist/types/types/legacyConfig/source.d.ts +25 -0
- package/dist/types/types/legacyConfig/tools.d.ts +17 -0
- package/dist/types/utils/commands.d.ts +2 -0
- package/dist/types/utils/config.d.ts +2 -2
- package/dist/types/utils/createFileWatcher.d.ts +4 -0
- package/dist/types/utils/createServer.d.ts +9 -1
- package/dist/types/utils/getServerInternalPlugins.d.ts +2 -0
- package/dist/types/utils/printInstructions.d.ts +3 -2
- package/dist/types/utils/restart.d.ts +3 -0
- package/dist/types/utils/types.d.ts +2 -3
- package/lib/types.d.ts +1 -1
- package/package.json +37 -46
- package/dist/js/modern/analyze/getClientRoutes.js +0 -219
- package/dist/js/modern/commands/start.js +0 -31
- package/dist/js/modern/utils/createCompiler.js +0 -61
- package/dist/js/node/analyze/getClientRoutes.js +0 -241
- package/dist/js/node/commands/start.js +0 -47
- package/dist/js/node/utils/createCompiler.js +0 -81
- package/dist/types/commands/start.d.ts +0 -2
- package/dist/types/utils/createCompiler.d.ts +0 -13
|
@@ -1,174 +1,112 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var __async = (__this, __arguments, generator) => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
var fulfilled = (value) => {
|
|
38
|
+
try {
|
|
39
|
+
step(generator.next(value));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
reject(e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var rejected = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
step(generator.throw(value));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
reject(e);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
52
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var build_exports = {};
|
|
56
|
+
__export(build_exports, {
|
|
57
|
+
build: () => build
|
|
5
58
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _config = require("../utils/config");
|
|
17
|
-
|
|
18
|
-
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; }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
// These sizes are pretty large. We'll warn for bundles exceeding them.
|
|
25
|
-
const WARN_AFTER_BUNDLE_GZIP_SIZE = 512 * 1024;
|
|
26
|
-
const WARN_AFTER_CHUNK_GZIP_SIZE = 1024 * 1024;
|
|
27
|
-
|
|
28
|
-
const build = async (api, options) => {
|
|
59
|
+
module.exports = __toCommonJS(build_exports);
|
|
60
|
+
var import_core = require("@modern-js/core");
|
|
61
|
+
var import_utils = require("@modern-js/utils");
|
|
62
|
+
var import_routes = require("../utils/routes");
|
|
63
|
+
var import_config = require("../utils/config");
|
|
64
|
+
const build = (api, options) => __async(void 0, null, function* () {
|
|
65
|
+
if (options == null ? void 0 : options.analyze) {
|
|
66
|
+
process.env.BUNDLE_ANALYZE = "true";
|
|
67
|
+
}
|
|
29
68
|
let resolvedConfig = api.useResolvedConfigContext();
|
|
30
69
|
const appContext = api.useAppContext();
|
|
31
70
|
const hookRunners = api.useHookRunners();
|
|
32
|
-
const {
|
|
33
|
-
apiOnly
|
|
34
|
-
} = appContext;
|
|
35
|
-
|
|
71
|
+
const { apiOnly } = appContext;
|
|
36
72
|
if (apiOnly) {
|
|
37
|
-
const {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
serverConfigFile
|
|
41
|
-
} = appContext;
|
|
42
|
-
await (0, _utils.emptyDir)(distDirectory);
|
|
43
|
-
await hookRunners.beforeBuild({
|
|
44
|
-
webpackConfigs: []
|
|
73
|
+
const { appDirectory: appDirectory2, distDirectory: distDirectory2, serverConfigFile: serverConfigFile2 } = appContext;
|
|
74
|
+
yield hookRunners.beforeBuild({
|
|
75
|
+
bundlerConfigs: void 0
|
|
45
76
|
});
|
|
46
|
-
|
|
47
|
-
appDirectory,
|
|
48
|
-
distDirectory,
|
|
49
|
-
configFile:
|
|
77
|
+
yield (0, import_config.buildServerConfig)({
|
|
78
|
+
appDirectory: appDirectory2,
|
|
79
|
+
distDirectory: distDirectory2,
|
|
80
|
+
configFile: serverConfigFile2
|
|
81
|
+
});
|
|
82
|
+
yield (0, import_routes.generateRoutes)(appContext);
|
|
83
|
+
yield hookRunners.afterBuild({
|
|
84
|
+
stats: void 0
|
|
50
85
|
});
|
|
51
|
-
await (0, _routes.generateRoutes)(appContext);
|
|
52
|
-
await hookRunners.afterBuild();
|
|
53
86
|
return;
|
|
54
87
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
let label = process.env.NODE_ENV || '';
|
|
60
|
-
|
|
61
|
-
if (type && type !== 'legacy') {
|
|
62
|
-
label += ` ${type}`;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
_utils.logger.info(`Creating a ${label} build...`);
|
|
66
|
-
|
|
67
|
-
compiler.run((err, stats) => {
|
|
68
|
-
let messages;
|
|
69
|
-
|
|
70
|
-
if (!err) {
|
|
71
|
-
messages = (0, _utils.formatWebpackMessages)(stats.toJson({
|
|
72
|
-
all: false,
|
|
73
|
-
warnings: true,
|
|
74
|
-
errors: true
|
|
75
|
-
}));
|
|
76
|
-
|
|
77
|
-
if (messages.errors.length === 0) {
|
|
78
|
-
_utils.logger.info(`File sizes after ${label} build:\n`);
|
|
79
|
-
|
|
80
|
-
(0, _utils.printFileSizesAfterBuild)(stats, previousFileSizes, distDirectory, WARN_AFTER_BUNDLE_GZIP_SIZE, WARN_AFTER_CHUNK_GZIP_SIZE);
|
|
81
|
-
|
|
82
|
-
_utils.logger.log();
|
|
83
|
-
}
|
|
84
|
-
} // When using run or watch, call close and wait for it to finish before calling run or watch again.
|
|
85
|
-
// Concurrent compilations will corrupt the output files.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
compiler.close(closeErr => {
|
|
89
|
-
if (closeErr) {
|
|
90
|
-
_utils.logger.error(closeErr);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (err) {
|
|
94
|
-
reject(err);
|
|
95
|
-
} else {
|
|
96
|
-
if (messages.errors.length) {
|
|
97
|
-
reject(new Error(messages.errors.join('\n\n')));
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
resolve({
|
|
102
|
-
warnings: messages.warnings
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
|
|
111
|
-
cliOptions: options
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
_core.ResolvedConfigContext.set(resolvedConfig);
|
|
115
|
-
|
|
116
|
-
const {
|
|
117
|
-
distDirectory,
|
|
118
|
-
appDirectory,
|
|
119
|
-
serverConfigFile
|
|
120
|
-
} = appContext;
|
|
121
|
-
const previousFileSizes = await (0, _utils.measureFileSizesBeforeBuild)(distDirectory);
|
|
122
|
-
await (0, _utils.emptyDir)(distDirectory);
|
|
123
|
-
await (0, _config.buildServerConfig)({
|
|
88
|
+
resolvedConfig = __spreadProps(__spreadValues({}, resolvedConfig), { cliOptions: options });
|
|
89
|
+
import_core.ResolvedConfigContext.set(resolvedConfig);
|
|
90
|
+
const { distDirectory, appDirectory, serverConfigFile } = appContext;
|
|
91
|
+
yield (0, import_config.buildServerConfig)({
|
|
124
92
|
appDirectory,
|
|
125
93
|
distDirectory,
|
|
126
94
|
configFile: serverConfigFile
|
|
127
95
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (resolvedConfig.output.enableModernMode) {
|
|
135
|
-
buildConfigs.push({
|
|
136
|
-
type: 'modern',
|
|
137
|
-
config: (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.MODERN, appContext, resolvedConfig)
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if ((0, _utils.isUseSSRBundle)(resolvedConfig)) {
|
|
142
|
-
buildConfigs.push({
|
|
143
|
-
type: 'ssr',
|
|
144
|
-
config: (0, _webpack.getWebpackConfig)(_webpack.WebpackConfigTarget.NODE, appContext, resolvedConfig)
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
await hookRunners.beforeBuild({
|
|
149
|
-
webpackConfigs: buildConfigs.map(({
|
|
150
|
-
config
|
|
151
|
-
}) => config)
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
for (const buildConfig of buildConfigs) {
|
|
155
|
-
const {
|
|
156
|
-
type: buildType,
|
|
157
|
-
config
|
|
158
|
-
} = buildConfig;
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
await webpackBuild(config, buildType);
|
|
162
|
-
} catch (error) {
|
|
163
|
-
(0, _utils.printBuildError)(error); // eslint-disable-next-line no-process-exit
|
|
164
|
-
|
|
165
|
-
process.exit(1);
|
|
96
|
+
try {
|
|
97
|
+
import_utils.logger.info("Create a production build...\n");
|
|
98
|
+
if (!appContext.builder) {
|
|
99
|
+
throw new Error(
|
|
100
|
+
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
101
|
+
);
|
|
166
102
|
}
|
|
103
|
+
yield appContext.builder.build();
|
|
104
|
+
} catch (error) {
|
|
105
|
+
(0, import_utils.printBuildError)(error);
|
|
106
|
+
process.exit(1);
|
|
167
107
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
exports.build = build;
|
|
108
|
+
});
|
|
109
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
110
|
+
0 && (module.exports = {
|
|
111
|
+
build
|
|
112
|
+
});
|
|
@@ -1,14 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
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 __async = (__this, __arguments, generator) => {
|
|
19
|
+
return new Promise((resolve, reject) => {
|
|
20
|
+
var fulfilled = (value) => {
|
|
21
|
+
try {
|
|
22
|
+
step(generator.next(value));
|
|
23
|
+
} catch (e) {
|
|
24
|
+
reject(e);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
var rejected = (value) => {
|
|
28
|
+
try {
|
|
29
|
+
step(generator.throw(value));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
reject(e);
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
35
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
var deploy_exports = {};
|
|
39
|
+
__export(deploy_exports, {
|
|
40
|
+
deploy: () => deploy
|
|
5
41
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
const deploy = async (api, options) => {
|
|
42
|
+
module.exports = __toCommonJS(deploy_exports);
|
|
43
|
+
const deploy = (api, options) => __async(void 0, null, function* () {
|
|
9
44
|
const hookRunners = api.useHookRunners();
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
exports
|
|
45
|
+
yield hookRunners.beforeDeploy(options);
|
|
46
|
+
yield hookRunners.afterDeploy(options);
|
|
47
|
+
});
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
deploy
|
|
51
|
+
});
|
|
@@ -1,46 +1,80 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
var __async = (__this, __arguments, generator) => {
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
var fulfilled = (value) => {
|
|
38
|
+
try {
|
|
39
|
+
step(generator.next(value));
|
|
40
|
+
} catch (e) {
|
|
41
|
+
reject(e);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var rejected = (value) => {
|
|
45
|
+
try {
|
|
46
|
+
step(generator.throw(value));
|
|
47
|
+
} catch (e) {
|
|
48
|
+
reject(e);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
52
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var dev_exports = {};
|
|
56
|
+
__export(dev_exports, {
|
|
57
|
+
dev: () => dev
|
|
5
58
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var _config = require("../utils/config");
|
|
23
|
-
|
|
24
|
-
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); }
|
|
25
|
-
|
|
26
|
-
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; }
|
|
27
|
-
|
|
28
|
-
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; }
|
|
29
|
-
|
|
30
|
-
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; }
|
|
31
|
-
|
|
32
|
-
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; }
|
|
33
|
-
|
|
34
|
-
const dev = async (api, options) => {
|
|
35
|
-
let userConfig = api.useResolvedConfigContext();
|
|
59
|
+
module.exports = __toCommonJS(dev_exports);
|
|
60
|
+
var import_core = require("@modern-js/core");
|
|
61
|
+
var import_createFileWatcher = require("../utils/createFileWatcher");
|
|
62
|
+
var import_printInstructions = require("../utils/printInstructions");
|
|
63
|
+
var import_createServer = require("../utils/createServer");
|
|
64
|
+
var import_routes = require("../utils/routes");
|
|
65
|
+
var import_getSpecifiedEntries = require("../utils/getSpecifiedEntries");
|
|
66
|
+
var import_config = require("../utils/config");
|
|
67
|
+
var import_getServerInternalPlugins = require("../utils/getServerInternalPlugins");
|
|
68
|
+
const dev = (api, options) => __async(void 0, null, function* () {
|
|
69
|
+
var _a;
|
|
70
|
+
if (options.analyze) {
|
|
71
|
+
process.env.BUNDLE_ANALYZE = "true";
|
|
72
|
+
}
|
|
73
|
+
let normalizedConfig = api.useResolvedConfigContext();
|
|
36
74
|
const appContext = api.useAppContext();
|
|
37
75
|
const hookRunners = api.useHookRunners();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
_core.ResolvedConfigContext.set(userConfig);
|
|
43
|
-
|
|
76
|
+
normalizedConfig = __spreadProps(__spreadValues({}, normalizedConfig), { cliOptions: options });
|
|
77
|
+
import_core.ResolvedConfigContext.set(normalizedConfig);
|
|
44
78
|
const {
|
|
45
79
|
appDirectory,
|
|
46
80
|
distDirectory,
|
|
@@ -49,15 +83,15 @@ const dev = async (api, options) => {
|
|
|
49
83
|
entrypoints,
|
|
50
84
|
serverConfigFile
|
|
51
85
|
} = appContext;
|
|
52
|
-
const checkedEntries =
|
|
53
|
-
|
|
86
|
+
const checkedEntries = yield (0, import_getSpecifiedEntries.getSpecifiedEntries)(
|
|
87
|
+
options.entry || false,
|
|
88
|
+
entrypoints
|
|
89
|
+
);
|
|
90
|
+
api.setAppContext(__spreadProps(__spreadValues({}, appContext), {
|
|
54
91
|
checkedEntries
|
|
55
92
|
}));
|
|
56
93
|
appContext.checkedEntries = checkedEntries;
|
|
57
|
-
|
|
58
|
-
_utils.fs.emptyDirSync(distDirectory);
|
|
59
|
-
|
|
60
|
-
await (0, _config.buildServerConfig)({
|
|
94
|
+
yield (0, import_config.buildServerConfig)({
|
|
61
95
|
appDirectory,
|
|
62
96
|
distDirectory,
|
|
63
97
|
configFile: serverConfigFile,
|
|
@@ -67,54 +101,48 @@ const dev = async (api, options) => {
|
|
|
67
101
|
}
|
|
68
102
|
}
|
|
69
103
|
});
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
getWebpackConfig,
|
|
76
|
-
WebpackConfigTarget
|
|
77
|
-
} = await Promise.resolve().then(() => _interopRequireWildcard(require('@modern-js/webpack')));
|
|
78
|
-
const webpackConfigs = [(0, _utils.isSSR)(userConfig) && getWebpackConfig(WebpackConfigTarget.NODE, appContext, userConfig), getWebpackConfig(WebpackConfigTarget.CLIENT, appContext, userConfig)].filter(Boolean);
|
|
79
|
-
compiler = await (0, _createCompiler.createCompiler)({
|
|
80
|
-
api,
|
|
81
|
-
webpackConfigs,
|
|
82
|
-
userConfig,
|
|
83
|
-
appContext
|
|
84
|
-
});
|
|
104
|
+
yield hookRunners.beforeDev();
|
|
105
|
+
if (!appContext.builder && !apiOnly) {
|
|
106
|
+
throw new Error(
|
|
107
|
+
"Expect the Builder to have been initialized, But the appContext.builder received `undefined`"
|
|
108
|
+
);
|
|
85
109
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
dev:
|
|
90
|
-
client: {
|
|
91
|
-
port: port.toString()
|
|
92
|
-
},
|
|
93
|
-
devMiddleware: {
|
|
94
|
-
writeToDisk: file => !file.includes('.hot-update.')
|
|
95
|
-
},
|
|
96
|
-
hot: true,
|
|
97
|
-
liveReload: true,
|
|
110
|
+
yield (0, import_routes.generateRoutes)(appContext);
|
|
111
|
+
const serverInternalPlugins = yield (0, import_getServerInternalPlugins.getServerInternalPlugins)(api);
|
|
112
|
+
const serverOptions = {
|
|
113
|
+
dev: __spreadValues({
|
|
98
114
|
port,
|
|
99
|
-
https:
|
|
100
|
-
}
|
|
101
|
-
compiler,
|
|
115
|
+
https: normalizedConfig.dev.https
|
|
116
|
+
}, (_a = normalizedConfig.tools) == null ? void 0 : _a.devServer),
|
|
102
117
|
pwd: appDirectory,
|
|
103
|
-
config:
|
|
118
|
+
config: normalizedConfig,
|
|
104
119
|
serverConfigFile,
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
internalPlugins: (0, import_createServer.injectDataLoaderPlugin)(serverInternalPlugins)
|
|
121
|
+
};
|
|
122
|
+
if (apiOnly) {
|
|
123
|
+
const app = yield (0, import_createServer.createServer)(__spreadProps(__spreadValues({}, serverOptions), {
|
|
124
|
+
compiler: null
|
|
125
|
+
}));
|
|
126
|
+
app.listen(port, (err) => __async(void 0, null, function* () {
|
|
127
|
+
if (err) {
|
|
128
|
+
throw err;
|
|
129
|
+
}
|
|
130
|
+
(0, import_printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
131
|
+
}));
|
|
132
|
+
} else {
|
|
133
|
+
const { server } = yield appContext.builder.startDevServer({
|
|
134
|
+
printURLs: false,
|
|
135
|
+
serverOptions
|
|
136
|
+
});
|
|
137
|
+
(0, import_createServer.setServer)(server);
|
|
138
|
+
}
|
|
139
|
+
yield (0, import_createFileWatcher.createFileWatcher)(
|
|
140
|
+
appContext,
|
|
141
|
+
normalizedConfig.source.configDir,
|
|
142
|
+
hookRunners
|
|
143
|
+
);
|
|
144
|
+
});
|
|
145
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
146
|
+
0 && (module.exports = {
|
|
147
|
+
dev
|
|
148
|
+
});
|
|
@@ -1,44 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var _build = require("./build");
|
|
21
|
-
|
|
22
|
-
Object.keys(_build).forEach(function (key) {
|
|
23
|
-
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] === _build[key]) return;
|
|
25
|
-
Object.defineProperty(exports, key, {
|
|
26
|
-
enumerable: true,
|
|
27
|
-
get: function () {
|
|
28
|
-
return _build[key];
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
var _start = require("./start");
|
|
34
|
-
|
|
35
|
-
Object.keys(_start).forEach(function (key) {
|
|
36
|
-
if (key === "default" || key === "__esModule") return;
|
|
37
|
-
if (key in exports && exports[key] === _start[key]) return;
|
|
38
|
-
Object.defineProperty(exports, key, {
|
|
39
|
-
enumerable: true,
|
|
40
|
-
get: function () {
|
|
41
|
-
return _start[key];
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
});
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var commands_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(commands_exports);
|
|
17
|
+
__reExport(commands_exports, require("./dev"), module.exports);
|
|
18
|
+
__reExport(commands_exports, require("./build"), module.exports);
|
|
19
|
+
__reExport(commands_exports, require("./serve"), module.exports);
|