@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
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
|
21
|
+
function createDefaultConfig(appContext) {
|
|
22
|
+
const defaultBuilderConfig = createDefaultBuilderConfig();
|
|
23
|
+
const dev = __spreadValues({}, defaultBuilderConfig.dev);
|
|
24
|
+
const tools = __spreadValues({}, defaultBuilderConfig.tools);
|
|
25
|
+
const output = __spreadProps(__spreadValues({}, defaultBuilderConfig.output), {
|
|
26
|
+
disableNodePolyfill: true
|
|
27
|
+
});
|
|
28
|
+
const source = __spreadProps(__spreadValues({}, defaultBuilderConfig.source), {
|
|
29
|
+
entries: void 0,
|
|
30
|
+
enableAsyncEntry: false,
|
|
31
|
+
disableDefaultEntries: false,
|
|
32
|
+
entriesDir: "./src",
|
|
33
|
+
configDir: "./config",
|
|
34
|
+
alias: {
|
|
35
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
36
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
37
|
+
"@": appContext.srcDirectory,
|
|
38
|
+
"@shared": appContext.sharedDirectory
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
const html = __spreadProps(__spreadValues({}, defaultBuilderConfig.html), {
|
|
42
|
+
title: "",
|
|
43
|
+
meta: {
|
|
44
|
+
charset: { charset: "utf-8" },
|
|
45
|
+
viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
|
|
46
|
+
"http-equiv": { "http-equiv": "x-ua-compatible", content: "ie=edge" },
|
|
47
|
+
renderer: "webkit",
|
|
48
|
+
layoutmode: "standard",
|
|
49
|
+
imagemode: "force",
|
|
50
|
+
"wap-font-scale": "no",
|
|
51
|
+
"format-detection": "telephone=no"
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
const server = {
|
|
55
|
+
routes: void 0,
|
|
56
|
+
publicRoutes: void 0,
|
|
57
|
+
ssr: void 0,
|
|
58
|
+
ssrByEntries: void 0,
|
|
59
|
+
baseUrl: "/",
|
|
60
|
+
port: 8080
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
source,
|
|
64
|
+
output,
|
|
65
|
+
server,
|
|
66
|
+
dev,
|
|
67
|
+
html,
|
|
68
|
+
tools,
|
|
69
|
+
plugins: [],
|
|
70
|
+
builderPlugins: [],
|
|
71
|
+
runtime: {},
|
|
72
|
+
runtimeByEntries: {}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function createLegacyDefaultConfig(appContext) {
|
|
76
|
+
const defaultAlias = appContext ? {
|
|
77
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
78
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
79
|
+
"@": appContext.srcDirectory,
|
|
80
|
+
"@shared": appContext.sharedDirectory
|
|
81
|
+
} : {};
|
|
82
|
+
const sourceDefaults = {
|
|
83
|
+
entries: void 0,
|
|
84
|
+
enableAsyncEntry: false,
|
|
85
|
+
disableDefaultEntries: false,
|
|
86
|
+
entriesDir: "./src",
|
|
87
|
+
configDir: "./config",
|
|
88
|
+
apiDir: "./api",
|
|
89
|
+
envVars: [],
|
|
90
|
+
globalVars: void 0,
|
|
91
|
+
alias: defaultAlias,
|
|
92
|
+
moduleScopes: void 0,
|
|
93
|
+
include: []
|
|
94
|
+
};
|
|
95
|
+
const outputDefaults = {
|
|
96
|
+
assetPrefix: "/",
|
|
97
|
+
htmlPath: "html",
|
|
98
|
+
jsPath: "static/js",
|
|
99
|
+
cssPath: "static/css",
|
|
100
|
+
mediaPath: "static/media",
|
|
101
|
+
path: "dist",
|
|
102
|
+
title: "",
|
|
103
|
+
titleByEntries: void 0,
|
|
104
|
+
meta: {
|
|
105
|
+
charset: { charset: "utf-8" },
|
|
106
|
+
viewport: "width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no",
|
|
107
|
+
"http-equiv": { "http-equiv": "x-ua-compatible", content: "ie=edge" },
|
|
108
|
+
renderer: "webkit",
|
|
109
|
+
layoutmode: "standard",
|
|
110
|
+
imagemode: "force",
|
|
111
|
+
"wap-font-scale": "no",
|
|
112
|
+
"format-detection": "telephone=no"
|
|
113
|
+
},
|
|
114
|
+
metaByEntries: void 0,
|
|
115
|
+
inject: "head",
|
|
116
|
+
injectByEntries: void 0,
|
|
117
|
+
mountId: "root",
|
|
118
|
+
favicon: "",
|
|
119
|
+
faviconByEntries: void 0,
|
|
120
|
+
copy: void 0,
|
|
121
|
+
disableHtmlFolder: false,
|
|
122
|
+
disableCssModuleExtension: false,
|
|
123
|
+
disableCssExtract: false,
|
|
124
|
+
enableCssModuleTSDeclaration: false,
|
|
125
|
+
disableMinimize: false,
|
|
126
|
+
enableInlineStyles: false,
|
|
127
|
+
enableInlineScripts: false,
|
|
128
|
+
disableSourceMap: false,
|
|
129
|
+
disableInlineRuntimeChunk: false,
|
|
130
|
+
disableAssetsCache: false,
|
|
131
|
+
enableLatestDecorators: false,
|
|
132
|
+
polyfill: "entry",
|
|
133
|
+
dataUriLimit: 1e4,
|
|
134
|
+
templateParameters: {},
|
|
135
|
+
templateParametersByEntries: void 0,
|
|
136
|
+
cssModuleLocalIdentName: void 0,
|
|
137
|
+
disableNodePolyfill: false,
|
|
138
|
+
enableTsLoader: false
|
|
139
|
+
};
|
|
140
|
+
const serverDefaults = {
|
|
141
|
+
routes: void 0,
|
|
142
|
+
publicRoutes: void 0,
|
|
143
|
+
ssr: void 0,
|
|
144
|
+
ssrByEntries: void 0,
|
|
145
|
+
baseUrl: "/",
|
|
146
|
+
port: 8080
|
|
147
|
+
};
|
|
148
|
+
const devDefaults = { assetPrefix: false, https: false };
|
|
149
|
+
const toolsDefaults = {
|
|
150
|
+
webpack: void 0,
|
|
151
|
+
babel: void 0,
|
|
152
|
+
postcss: void 0,
|
|
153
|
+
autoprefixer: void 0,
|
|
154
|
+
lodash: void 0,
|
|
155
|
+
devServer: void 0,
|
|
156
|
+
tsLoader: void 0,
|
|
157
|
+
terser: void 0,
|
|
158
|
+
minifyCss: void 0
|
|
159
|
+
};
|
|
160
|
+
return {
|
|
161
|
+
source: sourceDefaults,
|
|
162
|
+
output: outputDefaults,
|
|
163
|
+
server: serverDefaults,
|
|
164
|
+
dev: devDefaults,
|
|
165
|
+
tools: toolsDefaults,
|
|
166
|
+
runtime: {},
|
|
167
|
+
runtimeByEntries: {}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
export {
|
|
171
|
+
createDefaultConfig,
|
|
172
|
+
createLegacyDefaultConfig
|
|
173
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createDefaultConfig, createLegacyDefaultConfig } from "./default";
|
|
2
|
+
import { initialNormalizedConfig, checkIsLegacyConfig } from "./initial";
|
|
3
|
+
export {
|
|
4
|
+
checkIsLegacyConfig,
|
|
5
|
+
createDefaultConfig,
|
|
6
|
+
createLegacyDefaultConfig,
|
|
7
|
+
initialNormalizedConfig
|
|
8
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function createHtmlConfig(config) {
|
|
2
|
+
const {
|
|
3
|
+
disableHtmlFolder,
|
|
4
|
+
favicon,
|
|
5
|
+
faviconByEntries,
|
|
6
|
+
inject,
|
|
7
|
+
injectByEntries,
|
|
8
|
+
meta,
|
|
9
|
+
metaByEntries,
|
|
10
|
+
mountId,
|
|
11
|
+
title,
|
|
12
|
+
titleByEntries,
|
|
13
|
+
templateParameters,
|
|
14
|
+
templateParametersByEntries,
|
|
15
|
+
crossorigin
|
|
16
|
+
} = config.output;
|
|
17
|
+
return {
|
|
18
|
+
disableHtmlFolder,
|
|
19
|
+
favicon,
|
|
20
|
+
faviconByEntries,
|
|
21
|
+
inject,
|
|
22
|
+
injectByEntries,
|
|
23
|
+
meta,
|
|
24
|
+
metaByEntries,
|
|
25
|
+
mountId,
|
|
26
|
+
title,
|
|
27
|
+
titleByEntries,
|
|
28
|
+
crossorigin,
|
|
29
|
+
templateParameters,
|
|
30
|
+
templateParametersByEntries
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
createHtmlConfig
|
|
35
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
function createOutputConfig(config) {
|
|
2
|
+
const {
|
|
3
|
+
assetPrefix,
|
|
4
|
+
copy,
|
|
5
|
+
cssModuleLocalIdentName,
|
|
6
|
+
cssPath,
|
|
7
|
+
jsPath,
|
|
8
|
+
htmlPath,
|
|
9
|
+
mediaPath,
|
|
10
|
+
enableTsLoader,
|
|
11
|
+
path,
|
|
12
|
+
disableInlineRuntimeChunk,
|
|
13
|
+
disableCssExtract,
|
|
14
|
+
disableMinimize,
|
|
15
|
+
disableSourceMap,
|
|
16
|
+
disableTsChecker,
|
|
17
|
+
enableCssModuleTSDeclaration,
|
|
18
|
+
enableInlineScripts,
|
|
19
|
+
enableInlineStyles,
|
|
20
|
+
polyfill,
|
|
21
|
+
dataUriLimit,
|
|
22
|
+
disableAssetsCache,
|
|
23
|
+
enableLatestDecorators,
|
|
24
|
+
disableCssModuleExtension,
|
|
25
|
+
ssg,
|
|
26
|
+
disableNodePolyfill
|
|
27
|
+
} = config.output;
|
|
28
|
+
return {
|
|
29
|
+
assetPrefix,
|
|
30
|
+
copy,
|
|
31
|
+
distPath: {
|
|
32
|
+
root: path,
|
|
33
|
+
css: cssPath,
|
|
34
|
+
js: jsPath,
|
|
35
|
+
html: htmlPath,
|
|
36
|
+
svg: mediaPath || "media",
|
|
37
|
+
image: mediaPath || "media",
|
|
38
|
+
font: mediaPath || "media",
|
|
39
|
+
media: mediaPath || "media"
|
|
40
|
+
},
|
|
41
|
+
dataUriLimit: {
|
|
42
|
+
svg: dataUriLimit,
|
|
43
|
+
image: dataUriLimit,
|
|
44
|
+
font: dataUriLimit,
|
|
45
|
+
media: dataUriLimit
|
|
46
|
+
},
|
|
47
|
+
cssModuleLocalIdentName,
|
|
48
|
+
disableCssExtract,
|
|
49
|
+
disableCssModuleExtension,
|
|
50
|
+
disableInlineRuntimeChunk,
|
|
51
|
+
disableMinimize,
|
|
52
|
+
disableSourceMap,
|
|
53
|
+
disableTsChecker: disableTsChecker || enableTsLoader,
|
|
54
|
+
enableCssModuleTSDeclaration,
|
|
55
|
+
enableInlineScripts,
|
|
56
|
+
enableInlineStyles,
|
|
57
|
+
polyfill,
|
|
58
|
+
disableFilenameHash: disableAssetsCache,
|
|
59
|
+
enableLatestDecorators,
|
|
60
|
+
ssg,
|
|
61
|
+
enableAssetFallback: true,
|
|
62
|
+
enableAssetManifest: true,
|
|
63
|
+
disableNodePolyfill
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export {
|
|
67
|
+
createOutputConfig
|
|
68
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
function createSourceConfig(config) {
|
|
2
|
+
const {
|
|
3
|
+
alias,
|
|
4
|
+
envVars,
|
|
5
|
+
globalVars,
|
|
6
|
+
include,
|
|
7
|
+
moduleScopes,
|
|
8
|
+
preEntry,
|
|
9
|
+
entries,
|
|
10
|
+
enableAsyncEntry,
|
|
11
|
+
disableDefaultEntries,
|
|
12
|
+
entriesDir,
|
|
13
|
+
configDir
|
|
14
|
+
} = config.source;
|
|
15
|
+
const builderGlobalVars = globalVars || {};
|
|
16
|
+
for (const envVar of envVars || []) {
|
|
17
|
+
const envVarValue = process.env[envVar];
|
|
18
|
+
envVarValue && (builderGlobalVars[`process.env.${envVar}`] = envVarValue);
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
alias,
|
|
22
|
+
moduleScopes,
|
|
23
|
+
globalVars: builderGlobalVars,
|
|
24
|
+
include,
|
|
25
|
+
preEntry,
|
|
26
|
+
entries,
|
|
27
|
+
enableAsyncEntry,
|
|
28
|
+
disableDefaultEntries,
|
|
29
|
+
entriesDir,
|
|
30
|
+
configDir,
|
|
31
|
+
resolveExtensionPrefix: {
|
|
32
|
+
web: ".web",
|
|
33
|
+
node: ".node"
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
createSourceConfig
|
|
39
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function createToolsConfig(config) {
|
|
2
|
+
const {
|
|
3
|
+
autoprefixer,
|
|
4
|
+
babel,
|
|
5
|
+
minifyCss,
|
|
6
|
+
terser,
|
|
7
|
+
webpack,
|
|
8
|
+
webpackChain,
|
|
9
|
+
tsLoader,
|
|
10
|
+
styledComponents,
|
|
11
|
+
sass,
|
|
12
|
+
postcss,
|
|
13
|
+
less,
|
|
14
|
+
htmlPlugin,
|
|
15
|
+
devServer,
|
|
16
|
+
tailwindcss,
|
|
17
|
+
jest,
|
|
18
|
+
esbuild
|
|
19
|
+
} = config.tools;
|
|
20
|
+
const { enableTsLoader } = config.output;
|
|
21
|
+
return {
|
|
22
|
+
tsLoader: enableTsLoader ? tsLoader : void 0,
|
|
23
|
+
autoprefixer,
|
|
24
|
+
babel,
|
|
25
|
+
minifyCss,
|
|
26
|
+
terser,
|
|
27
|
+
webpack,
|
|
28
|
+
webpackChain,
|
|
29
|
+
styledComponents,
|
|
30
|
+
sass,
|
|
31
|
+
postcss,
|
|
32
|
+
less,
|
|
33
|
+
htmlPlugin,
|
|
34
|
+
devServer,
|
|
35
|
+
tailwindcss,
|
|
36
|
+
jest,
|
|
37
|
+
esbuild
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export {
|
|
41
|
+
createToolsConfig
|
|
42
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { initHtmlConfig, initSourceConfig, initToolsConfig } from "./inits";
|
|
2
|
+
import { transformNormalizedConfig } from "./transformNormalizedConfig";
|
|
3
|
+
function checkIsLegacyConfig(config) {
|
|
4
|
+
return Boolean(config.legacy);
|
|
5
|
+
}
|
|
6
|
+
function initialNormalizedConfig(config, appContext) {
|
|
7
|
+
initHtmlConfig(config, appContext);
|
|
8
|
+
initSourceConfig(config, appContext);
|
|
9
|
+
initToolsConfig(config);
|
|
10
|
+
return config;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
checkIsLegacyConfig,
|
|
14
|
+
initialNormalizedConfig,
|
|
15
|
+
transformNormalizedConfig
|
|
16
|
+
};
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import path, { dirname, isAbsolute, posix, sep } from "path";
|
|
21
|
+
import {
|
|
22
|
+
applyOptionsChain,
|
|
23
|
+
findExists,
|
|
24
|
+
findMonorepoRoot,
|
|
25
|
+
globby,
|
|
26
|
+
isModernjsMonorepo
|
|
27
|
+
} from "@modern-js/utils";
|
|
28
|
+
function initHtmlConfig(config, appContext) {
|
|
29
|
+
const ICON_EXTENSIONS = ["png", "jpg", "jpeg", "svg", "ico"];
|
|
30
|
+
config.html.appIcon = createBuilderAppIcon(config, appContext);
|
|
31
|
+
config.html.favicon = createBuilderFavicon(config, appContext);
|
|
32
|
+
return config.html;
|
|
33
|
+
function createBuilderAppIcon(config2, appContext2) {
|
|
34
|
+
const { configDir } = config2.source;
|
|
35
|
+
const appIcon = findExists(
|
|
36
|
+
ICON_EXTENSIONS.map(
|
|
37
|
+
(ext) => path.resolve(
|
|
38
|
+
appContext2.appDirectory,
|
|
39
|
+
configDir || "./config",
|
|
40
|
+
`icon.${ext}`
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
);
|
|
44
|
+
return typeof appIcon === "string" ? appIcon : void 0;
|
|
45
|
+
}
|
|
46
|
+
function createBuilderFavicon(config2, appContext2) {
|
|
47
|
+
const { configDir } = config2.source;
|
|
48
|
+
const { favicon } = config2.html;
|
|
49
|
+
const defaultFavicon = findExists(
|
|
50
|
+
ICON_EXTENSIONS.map(
|
|
51
|
+
(ext) => path.resolve(
|
|
52
|
+
appContext2.appDirectory,
|
|
53
|
+
configDir || "./config",
|
|
54
|
+
`favicon.${ext}`
|
|
55
|
+
)
|
|
56
|
+
)
|
|
57
|
+
);
|
|
58
|
+
return favicon || defaultFavicon || void 0;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function initSourceConfig(config, appContext) {
|
|
62
|
+
config.source.include = createBuilderInclude(config, appContext);
|
|
63
|
+
config.source.moduleScopes = createBuilderModuleScope(config);
|
|
64
|
+
function createBuilderInclude(config2, appContext2) {
|
|
65
|
+
const { include } = config2.source;
|
|
66
|
+
const defaultInclude = [appContext2.internalDirectory];
|
|
67
|
+
const transformInclude = (include || []).map((include2) => {
|
|
68
|
+
if (typeof include2 === "string") {
|
|
69
|
+
if (isAbsolute(include2)) {
|
|
70
|
+
return include2;
|
|
71
|
+
}
|
|
72
|
+
return new RegExp(include2);
|
|
73
|
+
}
|
|
74
|
+
return include2;
|
|
75
|
+
}).concat(defaultInclude);
|
|
76
|
+
const root = findMonorepoRoot(appContext2.appDirectory);
|
|
77
|
+
if (!root) {
|
|
78
|
+
return transformInclude;
|
|
79
|
+
}
|
|
80
|
+
const modernjsMonorepo = isModernjsMonorepo(root);
|
|
81
|
+
if (modernjsMonorepo) {
|
|
82
|
+
const paths = globby.sync(posix.join(root, "features", "**", "package.json"), {
|
|
83
|
+
ignore: ["**/node_modules/**/*"]
|
|
84
|
+
}).map((pathname) => dirname(pathname) + sep);
|
|
85
|
+
return [...paths, ...transformInclude];
|
|
86
|
+
}
|
|
87
|
+
return transformInclude;
|
|
88
|
+
}
|
|
89
|
+
function createBuilderModuleScope(config2) {
|
|
90
|
+
const { moduleScopes } = config2.source;
|
|
91
|
+
if (moduleScopes) {
|
|
92
|
+
let builderModuleScope = [];
|
|
93
|
+
const DEFAULT_SCOPES = [
|
|
94
|
+
"./src",
|
|
95
|
+
"./shared",
|
|
96
|
+
/node_modules/
|
|
97
|
+
];
|
|
98
|
+
if (Array.isArray(moduleScopes)) {
|
|
99
|
+
if (isPrimitiveScope(moduleScopes)) {
|
|
100
|
+
builderModuleScope = DEFAULT_SCOPES.concat(moduleScopes);
|
|
101
|
+
} else {
|
|
102
|
+
builderModuleScope = [DEFAULT_SCOPES, ...moduleScopes];
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
builderModuleScope = [DEFAULT_SCOPES, moduleScopes];
|
|
106
|
+
}
|
|
107
|
+
return builderModuleScope;
|
|
108
|
+
} else {
|
|
109
|
+
return void 0;
|
|
110
|
+
}
|
|
111
|
+
function isPrimitiveScope(items) {
|
|
112
|
+
return items.every(
|
|
113
|
+
(item) => typeof item === "string" || Object.prototype.toString.call(item) === "[object RegExp]"
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function initToolsConfig(config) {
|
|
119
|
+
const defaultTsChecker = {
|
|
120
|
+
issue: {
|
|
121
|
+
include: [{ file: "**/src/**/*" }],
|
|
122
|
+
exclude: [
|
|
123
|
+
{ file: "**/*.(spec|test).ts" },
|
|
124
|
+
{ file: "**/node_modules/**/*" }
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
const { tsChecker, tsLoader, htmlPlugin } = config.tools;
|
|
129
|
+
config.tools.tsChecker = applyOptionsChain(defaultTsChecker, tsChecker);
|
|
130
|
+
tsLoader && (config.tools.tsLoader = (tsLoaderConfig, utils) => {
|
|
131
|
+
applyOptionsChain(
|
|
132
|
+
__spreadProps(__spreadValues({}, tsLoaderConfig), {
|
|
133
|
+
transpileOnly: false,
|
|
134
|
+
allowTsInNodeModules: true
|
|
135
|
+
}),
|
|
136
|
+
tsLoader || {},
|
|
137
|
+
utils
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
config.tools.htmlPlugin = [
|
|
141
|
+
(config2) => __spreadProps(__spreadValues({}, config2), {
|
|
142
|
+
minify: typeof config2.minify === "object" ? __spreadProps(__spreadValues({}, config2.minify), {
|
|
143
|
+
removeComments: false
|
|
144
|
+
}) : config2.minify
|
|
145
|
+
}),
|
|
146
|
+
...Array.isArray(htmlPlugin) ? htmlPlugin : htmlPlugin ? [htmlPlugin] : []
|
|
147
|
+
];
|
|
148
|
+
}
|
|
149
|
+
export {
|
|
150
|
+
initHtmlConfig,
|
|
151
|
+
initSourceConfig,
|
|
152
|
+
initToolsConfig
|
|
153
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createToolsConfig } from "./createToolsConfig";
|
|
2
|
+
import { createSourceConfig } from "./createSourceConfig";
|
|
3
|
+
import { createOutputConfig } from "./createOutputConfig";
|
|
4
|
+
import { createHtmlConfig } from "./createHtmlConfig";
|
|
5
|
+
function transformNormalizedConfig(config) {
|
|
6
|
+
const html = createHtmlConfig(config);
|
|
7
|
+
const output = createOutputConfig(config);
|
|
8
|
+
const source = createSourceConfig(config);
|
|
9
|
+
const tools = createToolsConfig(config);
|
|
10
|
+
const {
|
|
11
|
+
bff,
|
|
12
|
+
dev,
|
|
13
|
+
deploy,
|
|
14
|
+
runtime,
|
|
15
|
+
runtimeByEntries,
|
|
16
|
+
server,
|
|
17
|
+
cliOptions,
|
|
18
|
+
plugins,
|
|
19
|
+
testing
|
|
20
|
+
} = config;
|
|
21
|
+
return {
|
|
22
|
+
source,
|
|
23
|
+
html,
|
|
24
|
+
output,
|
|
25
|
+
tools,
|
|
26
|
+
bff,
|
|
27
|
+
dev,
|
|
28
|
+
deploy,
|
|
29
|
+
runtime,
|
|
30
|
+
runtimeByEntries,
|
|
31
|
+
server,
|
|
32
|
+
cliOptions,
|
|
33
|
+
testing,
|
|
34
|
+
builderPlugins: [],
|
|
35
|
+
plugins,
|
|
36
|
+
security: {},
|
|
37
|
+
_raw: {},
|
|
38
|
+
experiments: {},
|
|
39
|
+
autoLoadPlugins: true,
|
|
40
|
+
performance: {
|
|
41
|
+
removeMomentLocale: true
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {
|
|
46
|
+
transformNormalizedConfig
|
|
47
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
const defineConfig = (config) => config;
|
|
21
|
+
const defineLegacyConfig = (config) => __spreadProps(__spreadValues({}, config), {
|
|
22
|
+
legacy: true
|
|
23
|
+
});
|
|
24
|
+
export {
|
|
25
|
+
defineConfig,
|
|
26
|
+
defineLegacyConfig
|
|
27
|
+
};
|
package/dist/js/modern/hooks.js
CHANGED
|
@@ -1,21 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import {
|
|
2
|
+
createAsyncWaterfall,
|
|
3
|
+
createAsyncWorkflow,
|
|
4
|
+
createParallelWorkflow
|
|
5
|
+
} from "@modern-js/plugin";
|
|
6
|
+
const hooks = {
|
|
7
|
+
modifyEntryExport: createAsyncWaterfall(),
|
|
8
|
+
modifyEntryImports: createAsyncWaterfall(),
|
|
9
|
+
modifyEntryRuntimePlugins: createAsyncWaterfall(),
|
|
10
|
+
modifyEntryRenderFunction: createAsyncWaterfall(),
|
|
11
|
+
modifyAsyncEntry: createAsyncWaterfall(),
|
|
12
|
+
modifyFileSystemRoutes: createAsyncWaterfall(),
|
|
13
|
+
modifyServerRoutes: createAsyncWaterfall(),
|
|
14
|
+
htmlPartials: createAsyncWaterfall(),
|
|
15
|
+
beforeGenerateRoutes: createAsyncWaterfall(),
|
|
16
|
+
addDefineTypes: createAsyncWaterfall(),
|
|
17
|
+
collectServerPlugins: createAsyncWaterfall(),
|
|
18
|
+
beforeDev: createAsyncWorkflow(),
|
|
19
|
+
afterDev: createAsyncWorkflow(),
|
|
20
|
+
beforeCreateCompiler: createAsyncWorkflow(),
|
|
21
|
+
afterCreateCompiler: createAsyncWorkflow(),
|
|
22
|
+
beforePrintInstructions: createAsyncWaterfall(),
|
|
23
|
+
beforeBuild: createAsyncWorkflow(),
|
|
24
|
+
afterBuild: createAsyncWorkflow(),
|
|
25
|
+
beforeDeploy: createAsyncWorkflow(),
|
|
26
|
+
afterDeploy: createAsyncWorkflow(),
|
|
27
|
+
watchFiles: createParallelWorkflow(),
|
|
28
|
+
fileChange: createAsyncWorkflow(),
|
|
29
|
+
beforeRestart: createAsyncWorkflow(),
|
|
30
|
+
registerDev: createParallelWorkflow(),
|
|
31
|
+
beforeDevTask: createParallelWorkflow(),
|
|
32
|
+
registerBuildPlatform: createParallelWorkflow(),
|
|
33
|
+
beforeBuildPlatform: createParallelWorkflow()
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
hooks
|
|
37
|
+
};
|