@modern-js/app-tools 2.0.0-beta.0 → 2.0.0-beta.2
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 +375 -0
- package/dist/js/modern/analyze/generateCode.js +30 -38
- package/dist/js/modern/analyze/getBundleEntry.js +5 -13
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +5 -30
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +5 -30
- package/dist/js/modern/analyze/getClientRoutes/utils.js +0 -3
- package/dist/js/modern/analyze/getFileSystemEntry.js +5 -18
- package/dist/js/modern/analyze/getHtmlTemplate.js +3 -10
- package/dist/js/modern/analyze/getServerRoutes.js +25 -38
- package/dist/js/modern/analyze/index.js +90 -48
- package/dist/js/modern/analyze/isDefaultExportFunction.js +0 -4
- package/dist/js/modern/analyze/makeLegalIdentifier.js +0 -2
- package/dist/js/modern/analyze/nestedRoutes.js +8 -33
- package/dist/js/modern/analyze/templates.js +22 -37
- package/dist/js/modern/analyze/utils.js +0 -7
- package/dist/js/modern/builder/builderPlugins/compatModern.js +41 -58
- package/dist/js/modern/builder/index.js +56 -37
- package/dist/js/modern/builder/share.js +1 -5
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -8
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +2 -13
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +97 -0
- package/dist/js/modern/commands/build.js +12 -46
- package/dist/js/modern/commands/dev.js +20 -23
- package/dist/js/modern/commands/inspect.js +4 -19
- package/dist/js/modern/commands/start.js +1 -2
- package/dist/js/modern/config/default.js +207 -0
- package/dist/js/modern/config/index.js +2 -0
- package/dist/js/modern/config/initial/createHtmlConfig.js +32 -0
- package/dist/js/modern/{builder → config/initial}/createOutputConfig.js +19 -18
- package/dist/js/modern/config/initial/createSourceConfig.js +32 -0
- package/dist/js/modern/config/initial/createToolsConfig.js +41 -0
- package/dist/js/modern/config/initial/index.js +11 -0
- package/dist/js/modern/config/initial/inits.js +117 -0
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +40 -0
- package/dist/js/modern/defineConfig.js +12 -0
- package/dist/js/modern/hooks.js +23 -19
- package/dist/js/modern/index.js +12 -19
- package/dist/js/modern/initialize/index.js +72 -0
- package/dist/js/modern/schema/Schema.js +39 -0
- package/dist/js/modern/schema/index.js +139 -0
- package/dist/js/modern/schema/legacy.js +284 -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 +2 -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 +4 -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 +1 -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/config.js +2 -13
- package/dist/js/modern/utils/createFileWatcher.js +82 -0
- package/dist/js/modern/utils/createServer.js +0 -5
- package/dist/js/modern/utils/getSpecifiedEntries.js +0 -6
- package/dist/js/modern/utils/printInstructions.js +2 -1
- package/dist/js/modern/utils/restart.js +17 -0
- package/dist/js/modern/utils/routes.js +0 -2
- package/dist/js/node/analyze/generateCode.js +30 -61
- package/dist/js/node/analyze/getBundleEntry.js +5 -19
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +5 -45
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +5 -45
- package/dist/js/node/analyze/getClientRoutes/index.js +0 -2
- package/dist/js/node/analyze/getClientRoutes/utils.js +0 -14
- package/dist/js/node/analyze/getFileSystemEntry.js +5 -26
- package/dist/js/node/analyze/getHtmlTemplate.js +3 -24
- package/dist/js/node/analyze/getServerRoutes.js +24 -46
- package/dist/js/node/analyze/index.js +91 -70
- package/dist/js/node/analyze/isDefaultExportFunction.js +0 -12
- package/dist/js/node/analyze/makeLegalIdentifier.js +0 -4
- package/dist/js/node/analyze/nestedRoutes.js +8 -41
- package/dist/js/node/analyze/templates.js +22 -47
- package/dist/js/node/analyze/utils.js +0 -20
- package/dist/js/node/builder/builderPlugins/compatModern.js +41 -69
- package/dist/js/node/builder/index.js +57 -51
- package/dist/js/node/builder/share.js +1 -13
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +0 -10
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +2 -15
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +105 -0
- package/dist/js/node/commands/build.js +10 -57
- package/dist/js/node/commands/deploy.js +0 -2
- package/dist/js/node/commands/dev.js +19 -34
- package/dist/js/node/commands/index.js +0 -6
- package/dist/js/node/commands/inspect.js +4 -26
- package/dist/js/node/commands/start.js +1 -11
- package/dist/js/node/config/default.js +214 -0
- package/dist/js/node/config/index.js +31 -0
- package/dist/js/node/config/initial/createHtmlConfig.js +38 -0
- package/dist/js/node/{builder → config/initial}/createOutputConfig.js +19 -20
- package/dist/js/node/config/initial/createSourceConfig.js +38 -0
- package/dist/js/node/config/initial/createToolsConfig.js +47 -0
- package/dist/js/node/config/initial/index.js +24 -0
- package/dist/js/node/config/initial/inits.js +127 -0
- package/dist/js/node/config/initial/transformNormalizedConfig.js +46 -0
- package/dist/js/node/defineConfig.js +20 -0
- package/dist/js/node/exports/server.js +0 -1
- package/dist/js/node/hooks.js +23 -30
- package/dist/js/node/index.js +35 -48
- package/dist/js/node/initialize/index.js +79 -0
- package/dist/js/node/locale/index.js +0 -4
- package/dist/js/node/schema/Schema.js +46 -0
- package/dist/js/node/schema/index.js +152 -0
- package/dist/js/node/schema/legacy.js +291 -0
- package/dist/js/node/types/config/deploy.js +0 -0
- package/dist/js/node/types/config/dev.js +0 -0
- package/dist/js/node/types/config/experiments.js +0 -0
- package/dist/js/node/types/config/html.js +0 -0
- package/dist/js/node/types/config/index.js +16 -0
- package/dist/js/node/types/config/output.js +0 -0
- package/dist/js/node/types/config/performance.js +0 -0
- package/dist/js/node/types/config/security.js +0 -0
- package/dist/js/node/types/config/source.js +0 -0
- package/dist/js/node/types/config/tools.js +0 -0
- package/dist/js/node/types/hooks.js +0 -0
- package/dist/js/node/types/index.js +38 -0
- package/dist/js/node/types/legacyConfig/deploy.js +0 -0
- package/dist/js/node/types/legacyConfig/dev.js +0 -0
- package/dist/js/node/types/legacyConfig/index.js +0 -0
- package/dist/js/node/types/legacyConfig/output.js +5 -0
- package/dist/js/node/types/legacyConfig/source.js +0 -0
- package/dist/js/node/types/legacyConfig/tools.js +0 -0
- package/dist/js/node/utils/commands.js +0 -2
- package/dist/js/node/utils/config.js +2 -26
- package/dist/js/node/utils/createFileWatcher.js +90 -0
- package/dist/js/node/utils/createServer.js +0 -15
- package/dist/js/node/utils/getSpecifiedEntries.js +0 -9
- package/dist/js/node/utils/language.js +0 -2
- package/dist/js/node/utils/printInstructions.js +2 -5
- package/dist/js/node/utils/restart.js +23 -0
- package/dist/js/node/utils/routes.js +0 -5
- package/dist/js/treeshaking/analyze/generateCode.js +58 -101
- package/dist/js/treeshaking/analyze/getBundleEntry.js +12 -20
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +16 -42
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +16 -42
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +0 -3
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +5 -18
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +3 -27
- package/dist/js/treeshaking/analyze/getServerRoutes.js +29 -41
- package/dist/js/treeshaking/analyze/index.js +195 -91
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +0 -4
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +0 -2
- package/dist/js/treeshaking/analyze/nestedRoutes.js +9 -51
- package/dist/js/treeshaking/analyze/templates.js +31 -50
- package/dist/js/treeshaking/analyze/utils.js +7 -14
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +50 -68
- package/dist/js/treeshaking/builder/index.js +69 -65
- package/dist/js/treeshaking/builder/share.js +1 -5
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +1 -13
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +2 -14
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +121 -0
- package/dist/js/treeshaking/commands/build.js +41 -116
- package/dist/js/treeshaking/commands/deploy.js +0 -3
- package/dist/js/treeshaking/commands/dev.js +38 -46
- package/dist/js/treeshaking/commands/inspect.js +9 -27
- package/dist/js/treeshaking/commands/start.js +1 -9
- package/dist/js/treeshaking/config/default.js +200 -0
- package/dist/js/treeshaking/config/index.js +2 -0
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +31 -0
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +67 -0
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -0
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +38 -0
- package/dist/js/treeshaking/config/initial/index.js +11 -0
- package/dist/js/treeshaking/config/initial/inits.js +114 -0
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +38 -0
- package/dist/js/treeshaking/defineConfig.js +14 -0
- package/dist/js/treeshaking/hooks.js +23 -19
- package/dist/js/treeshaking/index.js +8 -43
- package/dist/js/treeshaking/initialize/index.js +121 -0
- package/dist/js/treeshaking/schema/Schema.js +75 -0
- package/dist/js/treeshaking/schema/index.js +138 -0
- package/dist/js/treeshaking/schema/legacy.js +273 -0
- package/dist/js/treeshaking/types/config/deploy.js +0 -0
- package/dist/js/treeshaking/types/config/dev.js +0 -0
- package/dist/js/treeshaking/types/config/experiments.js +0 -0
- package/dist/js/treeshaking/types/config/html.js +0 -0
- package/dist/js/treeshaking/types/config/index.js +2 -0
- package/dist/js/treeshaking/types/config/output.js +0 -0
- package/dist/js/treeshaking/types/config/performance.js +0 -0
- package/dist/js/treeshaking/types/config/security.js +0 -0
- package/dist/js/treeshaking/types/config/source.js +0 -0
- package/dist/js/treeshaking/types/config/tools.js +0 -0
- package/dist/js/treeshaking/types/hooks.js +0 -0
- package/dist/js/treeshaking/types/index.js +4 -0
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/source.js +0 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +0 -0
- package/dist/js/treeshaking/utils/config.js +2 -18
- package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
- package/dist/js/treeshaking/utils/createServer.js +0 -10
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +0 -10
- package/dist/js/treeshaking/utils/printInstructions.js +0 -5
- package/dist/js/treeshaking/utils/restart.js +45 -0
- package/dist/js/treeshaking/utils/routes.js +0 -4
- package/dist/types/analyze/generateCode.d.ts +3 -2
- package/dist/types/analyze/getBundleEntry.d.ts +2 -2
- 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 -42
- package/dist/types/analyze/nestedRoutes.d.ts +1 -1
- package/dist/types/analyze/templates.d.ts +4 -2
- package/dist/types/analyze/utils.d.ts +1 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -3
- package/dist/types/builder/index.d.ts +7 -8
- package/dist/types/builder/share.d.ts +2 -2
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +10 -0
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/deploy.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +2 -2
- package/dist/types/commands/inspect.d.ts +6 -1
- package/dist/types/commands/start.d.ts +2 -2
- 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 +7 -0
- package/dist/types/hooks.d.ts +2 -42
- package/dist/types/index.d.ts +5 -7
- package/dist/types/initialize/index.d.ts +3 -0
- 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 +62 -0
- package/dist/types/types/config/output.d.ts +23 -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 +22 -0
- package/dist/types/types/config/tools.d.ts +15 -0
- package/dist/types/types/hooks.d.ts +80 -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 +12 -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 +16 -0
- package/dist/types/utils/config.d.ts +2 -3
- package/dist/types/utils/createFileWatcher.d.ts +3 -0
- package/dist/types/utils/printInstructions.d.ts +3 -3
- package/dist/types/utils/restart.d.ts +3 -0
- package/package.json +26 -25
- package/dist/js/modern/builder/createHtmlConfig.js +0 -58
- package/dist/js/modern/builder/createSourceConfig.js +0 -85
- package/dist/js/modern/builder/createToolsConfig.js +0 -94
- package/dist/js/modern/utils/createCompiler.js +0 -58
- package/dist/js/node/builder/createHtmlConfig.js +0 -76
- package/dist/js/node/builder/createSourceConfig.js +0 -99
- package/dist/js/node/builder/createToolsConfig.js +0 -103
- package/dist/js/node/utils/createCompiler.js +0 -75
- package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
- package/dist/js/treeshaking/builder/createOutputConfig.js +0 -67
- package/dist/js/treeshaking/builder/createSourceConfig.js +0 -100
- package/dist/js/treeshaking/builder/createToolsConfig.js +0 -90
- package/dist/js/treeshaking/utils/createCompiler.js +0 -117
- package/dist/types/builder/createHtmlConfig.d.ts +0 -6
- package/dist/types/builder/createOutputConfig.d.ts +0 -3
- package/dist/types/builder/createSourceConfig.d.ts +0 -5
- package/dist/types/builder/createToolsConfig.d.ts +0 -13
- package/dist/types/utils/createCompiler.d.ts +0 -12
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
var _utils = require("@modern-js/utils");
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
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; }
|
|
11
|
+
const PLUGIN_NAME = 'ModernjsRoutePlugin';
|
|
12
|
+
class RouterPlugin {
|
|
13
|
+
constructor(options) {
|
|
14
|
+
_defineProperty(this, "existNestedRoutes", void 0);
|
|
15
|
+
this.existNestedRoutes = options.existNestedRoutes;
|
|
16
|
+
}
|
|
17
|
+
apply(compiler) {
|
|
18
|
+
const {
|
|
19
|
+
existNestedRoutes
|
|
20
|
+
} = this;
|
|
21
|
+
const {
|
|
22
|
+
target
|
|
23
|
+
} = compiler.options;
|
|
24
|
+
if (target === 'node' || Array.isArray(target) && target.includes('node')) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!existNestedRoutes) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const {
|
|
31
|
+
webpack
|
|
32
|
+
} = compiler;
|
|
33
|
+
const {
|
|
34
|
+
Compilation,
|
|
35
|
+
sources
|
|
36
|
+
} = webpack;
|
|
37
|
+
const {
|
|
38
|
+
RawSource
|
|
39
|
+
} = sources;
|
|
40
|
+
const {
|
|
41
|
+
PROCESS_ASSETS_STAGE_REPORT
|
|
42
|
+
} = Compilation;
|
|
43
|
+
const outputPath = compiler.options.output.path;
|
|
44
|
+
const newAssetsMap = new Map();
|
|
45
|
+
const normalizePath = path => {
|
|
46
|
+
if (!path.endsWith('/')) {
|
|
47
|
+
return `${path}/`;
|
|
48
|
+
}
|
|
49
|
+
return path;
|
|
50
|
+
};
|
|
51
|
+
compiler.hooks.thisCompilation.tap(PLUGIN_NAME, compilation => {
|
|
52
|
+
compilation.hooks.processAssets.tapPromise({
|
|
53
|
+
name: PLUGIN_NAME,
|
|
54
|
+
stage: PROCESS_ASSETS_STAGE_REPORT
|
|
55
|
+
}, async () => {
|
|
56
|
+
const stats = compilation.getStats().toJson({
|
|
57
|
+
chunkGroups: true,
|
|
58
|
+
chunks: true
|
|
59
|
+
});
|
|
60
|
+
const {
|
|
61
|
+
publicPath
|
|
62
|
+
} = stats;
|
|
63
|
+
const routeAssets = {};
|
|
64
|
+
const {
|
|
65
|
+
namedChunkGroups,
|
|
66
|
+
assetsByChunkName
|
|
67
|
+
} = stats;
|
|
68
|
+
if (!namedChunkGroups || !assetsByChunkName) {
|
|
69
|
+
_utils.logger.warn('Route manifest does not exist, performance will be affected');
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
for (const [name, chunkGroup] of Object.entries(namedChunkGroups)) {
|
|
73
|
+
routeAssets[name] = {
|
|
74
|
+
chunkIds: chunkGroup.chunks,
|
|
75
|
+
assets: assetsByChunkName[name].map(item => publicPath ? normalizePath(publicPath) + item : item)
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
const manifest = {
|
|
79
|
+
routeAssets
|
|
80
|
+
};
|
|
81
|
+
const injectedContent = `
|
|
82
|
+
;(function(){
|
|
83
|
+
window.${_utils.ROUTE_MANIFEST} = ${JSON.stringify(manifest)};
|
|
84
|
+
})();
|
|
85
|
+
`;
|
|
86
|
+
const entrypointsArray = Array.from(compilation.entrypoints.entries());
|
|
87
|
+
const entryChunkIds = entrypointsArray.map(entrypoint => entrypoint[0]);
|
|
88
|
+
const entryChunks = [...compilation.chunks].filter(chunk => {
|
|
89
|
+
return entryChunkIds.includes(chunk.name);
|
|
90
|
+
});
|
|
91
|
+
const entryChunkFiles = entryChunks.map(chunk => [...chunk.files][0]);
|
|
92
|
+
for (const file of entryChunkFiles) {
|
|
93
|
+
const asset = compilation.assets[file];
|
|
94
|
+
const newContent = `${injectedContent}${asset.source().toString()}`;
|
|
95
|
+
newAssetsMap.set(_path.default.join(outputPath, file), newContent);
|
|
96
|
+
compilation.updateAsset(file, new RawSource(newContent));
|
|
97
|
+
}
|
|
98
|
+
const filename = _path.default.join(outputPath, _utils.ROUTE_MINIFEST_FILE);
|
|
99
|
+
await _utils.fs.ensureFile(filename);
|
|
100
|
+
await _utils.fs.writeFile(filename, JSON.stringify(manifest, null, 2));
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.default = RouterPlugin;
|
|
@@ -4,33 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.build = void 0;
|
|
7
|
-
|
|
8
7
|
var _core = require("@modern-js/core");
|
|
9
|
-
|
|
10
8
|
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
9
|
var _routes = require("../utils/routes");
|
|
13
|
-
|
|
14
10
|
var _config = require("../utils/config");
|
|
15
|
-
|
|
16
|
-
var _builder = _interopRequireDefault(require("../builder"));
|
|
17
|
-
|
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
|
-
|
|
20
11
|
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; }
|
|
21
|
-
|
|
22
12
|
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; }
|
|
23
|
-
|
|
24
13
|
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; }
|
|
25
|
-
|
|
26
14
|
const build = async (api, options) => {
|
|
15
|
+
if (options !== null && options !== void 0 && options.analyze) {
|
|
16
|
+
// Builder will read this env var to enable bundle analyzer
|
|
17
|
+
process.env.BUNDLE_ANALYZE = 'true';
|
|
18
|
+
}
|
|
27
19
|
let resolvedConfig = api.useResolvedConfigContext();
|
|
28
20
|
const appContext = api.useAppContext();
|
|
29
21
|
const hookRunners = api.useHookRunners();
|
|
30
22
|
const {
|
|
31
23
|
apiOnly
|
|
32
24
|
} = appContext;
|
|
33
|
-
|
|
34
25
|
if (apiOnly) {
|
|
35
26
|
const {
|
|
36
27
|
appDirectory,
|
|
@@ -53,13 +44,10 @@ const build = async (api, options) => {
|
|
|
53
44
|
});
|
|
54
45
|
return;
|
|
55
46
|
}
|
|
56
|
-
|
|
57
47
|
resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
|
|
58
48
|
cliOptions: options
|
|
59
49
|
});
|
|
60
|
-
|
|
61
50
|
_core.ResolvedConfigContext.set(resolvedConfig);
|
|
62
|
-
|
|
63
51
|
const {
|
|
64
52
|
distDirectory,
|
|
65
53
|
appDirectory,
|
|
@@ -70,51 +58,16 @@ const build = async (api, options) => {
|
|
|
70
58
|
distDirectory,
|
|
71
59
|
configFile: serverConfigFile
|
|
72
60
|
});
|
|
73
|
-
const targets = ['web'];
|
|
74
|
-
|
|
75
|
-
if (resolvedConfig.output.enableModernMode) {
|
|
76
|
-
targets.push('modern-web');
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if ((0, _utils.isUseSSRBundle)(resolvedConfig)) {
|
|
80
|
-
targets.push('node');
|
|
81
|
-
}
|
|
82
|
-
|
|
83
61
|
try {
|
|
84
|
-
const builder = await (0, _builder.default)({
|
|
85
|
-
target: targets,
|
|
86
|
-
appContext,
|
|
87
|
-
normalizedConfig: resolvedConfig,
|
|
88
|
-
compatPluginConfig: {
|
|
89
|
-
async onBeforeBuild({
|
|
90
|
-
bundlerConfigs
|
|
91
|
-
}) {
|
|
92
|
-
await (0, _routes.generateRoutes)(appContext);
|
|
93
|
-
await hookRunners.beforeBuild({
|
|
94
|
-
bundlerConfigs
|
|
95
|
-
});
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
async onAfterBuild({
|
|
99
|
-
stats
|
|
100
|
-
}) {
|
|
101
|
-
await hookRunners.afterBuild({
|
|
102
|
-
stats
|
|
103
|
-
});
|
|
104
|
-
await (0, _config.emitResolvedConfig)(appDirectory, resolvedConfig);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
|
|
110
62
|
_utils.logger.info('Create a production build...\n');
|
|
111
|
-
|
|
112
|
-
|
|
63
|
+
if (!appContext.builder) {
|
|
64
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
65
|
+
}
|
|
66
|
+
await appContext.builder.build();
|
|
113
67
|
} catch (error) {
|
|
114
|
-
(0, _utils.printBuildError)(error);
|
|
115
|
-
|
|
68
|
+
(0, _utils.printBuildError)(error);
|
|
69
|
+
// eslint-disable-next-line no-process-exit
|
|
116
70
|
process.exit(1);
|
|
117
71
|
}
|
|
118
72
|
};
|
|
119
|
-
|
|
120
73
|
exports.build = build;
|
|
@@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.deploy = void 0;
|
|
7
|
-
|
|
8
7
|
const deploy = async (api, options) => {
|
|
9
8
|
const hookRunners = api.useHookRunners();
|
|
10
9
|
await hookRunners.beforeDeploy(options);
|
|
11
10
|
await hookRunners.afterDeploy(options);
|
|
12
11
|
};
|
|
13
|
-
|
|
14
12
|
exports.deploy = deploy;
|
|
@@ -4,39 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dev = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("@modern-js/utils");
|
|
9
|
-
|
|
10
8
|
var _core = require("@modern-js/core");
|
|
11
|
-
|
|
9
|
+
var _createFileWatcher = require("../utils/createFileWatcher");
|
|
12
10
|
var _printInstructions = require("../utils/printInstructions");
|
|
13
|
-
|
|
14
|
-
var _createCompiler = require("../utils/createCompiler");
|
|
15
|
-
|
|
16
11
|
var _createServer = require("../utils/createServer");
|
|
17
|
-
|
|
18
12
|
var _routes = require("../utils/routes");
|
|
19
|
-
|
|
20
13
|
var _getSpecifiedEntries = require("../utils/getSpecifiedEntries");
|
|
21
|
-
|
|
22
14
|
var _config = require("../utils/config");
|
|
23
|
-
|
|
24
15
|
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; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
const dev = async (api, options) => {
|
|
31
|
-
|
|
19
|
+
var _normalizedConfig$too;
|
|
20
|
+
if (options.analyze) {
|
|
21
|
+
// Builder will read this env var to enable bundle analyzer
|
|
22
|
+
process.env.BUNDLE_ANALYZE = 'true';
|
|
23
|
+
}
|
|
24
|
+
let normalizedConfig = api.useResolvedConfigContext();
|
|
32
25
|
const appContext = api.useAppContext();
|
|
33
26
|
const hookRunners = api.useHookRunners();
|
|
34
|
-
|
|
27
|
+
normalizedConfig = _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
35
28
|
cliOptions: options
|
|
36
29
|
});
|
|
37
|
-
|
|
38
|
-
_core.ResolvedConfigContext.set(userConfig);
|
|
39
|
-
|
|
30
|
+
_core.ResolvedConfigContext.set(normalizedConfig);
|
|
40
31
|
const {
|
|
41
32
|
appDirectory,
|
|
42
33
|
distDirectory,
|
|
@@ -63,17 +54,12 @@ const dev = async (api, options) => {
|
|
|
63
54
|
});
|
|
64
55
|
await hookRunners.beforeDev();
|
|
65
56
|
let compiler = null;
|
|
66
|
-
|
|
67
57
|
if (!apiOnly) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
normalizedConfig: userConfig,
|
|
73
|
-
appContext
|
|
74
|
-
});
|
|
58
|
+
if (!appContext.builder) {
|
|
59
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
60
|
+
}
|
|
61
|
+
compiler = await appContext.builder.createCompiler();
|
|
75
62
|
}
|
|
76
|
-
|
|
77
63
|
await (0, _routes.generateRoutes)(appContext);
|
|
78
64
|
const app = await (0, _createServer.createServer)({
|
|
79
65
|
dev: _objectSpread(_objectSpread({}, {
|
|
@@ -86,11 +72,11 @@ const dev = async (api, options) => {
|
|
|
86
72
|
hot: true,
|
|
87
73
|
liveReload: true,
|
|
88
74
|
port,
|
|
89
|
-
https:
|
|
90
|
-
}),
|
|
75
|
+
https: normalizedConfig.dev.https
|
|
76
|
+
}), (_normalizedConfig$too = normalizedConfig.tools) === null || _normalizedConfig$too === void 0 ? void 0 : _normalizedConfig$too.devServer),
|
|
91
77
|
compiler,
|
|
92
78
|
pwd: appDirectory,
|
|
93
|
-
config:
|
|
79
|
+
config: normalizedConfig,
|
|
94
80
|
serverConfigFile,
|
|
95
81
|
internalPlugins: (0, _createServer.injectDataLoaderPlugin)(serverInternalPlugins)
|
|
96
82
|
});
|
|
@@ -98,13 +84,12 @@ const dev = async (api, options) => {
|
|
|
98
84
|
if (err) {
|
|
99
85
|
throw err;
|
|
100
86
|
}
|
|
101
|
-
|
|
102
87
|
if (!apiOnly) {
|
|
103
|
-
_utils.logger.info(`Starting dev server
|
|
88
|
+
_utils.logger.info(`Starting dev server...\n`);
|
|
104
89
|
} else {
|
|
105
|
-
(0, _printInstructions.printInstructions)(hookRunners, appContext,
|
|
90
|
+
(0, _printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
106
91
|
}
|
|
107
92
|
});
|
|
93
|
+
await (0, _createFileWatcher.createFileWatcher)(appContext, normalizedConfig.source.configDir, hookRunners);
|
|
108
94
|
};
|
|
109
|
-
|
|
110
95
|
exports.dev = dev;
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _dev = require("./dev");
|
|
8
|
-
|
|
9
7
|
Object.keys(_dev).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _dev[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_dev).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _build = require("./build");
|
|
21
|
-
|
|
22
18
|
Object.keys(_build).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _build[key]) return;
|
|
@@ -29,9 +25,7 @@ Object.keys(_build).forEach(function (key) {
|
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
27
|
});
|
|
32
|
-
|
|
33
28
|
var _start = require("./start");
|
|
34
|
-
|
|
35
29
|
Object.keys(_start).forEach(function (key) {
|
|
36
30
|
if (key === "default" || key === "__esModule") return;
|
|
37
31
|
if (key in exports && exports[key] === _start[key]) return;
|
|
@@ -4,39 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.inspect = void 0;
|
|
7
|
-
|
|
8
7
|
var _path = require("path");
|
|
9
|
-
|
|
10
|
-
var _utils = require("@modern-js/utils");
|
|
11
|
-
|
|
12
|
-
var _builder = _interopRequireDefault(require("../builder"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
16
8
|
const inspect = async (api, options) => {
|
|
17
|
-
const resolvedConfig = api.useResolvedConfigContext();
|
|
18
9
|
const appContext = api.useAppContext();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (resolvedConfig.output.enableModernMode) {
|
|
22
|
-
targets.push('modern-web');
|
|
10
|
+
if (!appContext.builder) {
|
|
11
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
23
12
|
}
|
|
24
|
-
|
|
25
|
-
if ((0, _utils.isUseSSRBundle)(resolvedConfig)) {
|
|
26
|
-
targets.push('node');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const builder = await (0, _builder.default)({
|
|
30
|
-
target: targets,
|
|
31
|
-
appContext,
|
|
32
|
-
normalizedConfig: resolvedConfig
|
|
33
|
-
});
|
|
34
|
-
return builder.inspectConfig({
|
|
13
|
+
return appContext.builder.inspectConfig({
|
|
35
14
|
env: options.env,
|
|
36
15
|
verbose: options.verbose,
|
|
37
|
-
outputPath: (0, _path.join)(builder.context.distPath, options.output),
|
|
16
|
+
outputPath: (0, _path.join)(appContext === null || appContext === void 0 ? void 0 : appContext.builder.context.distPath, options.output),
|
|
38
17
|
writeToDisk: true
|
|
39
18
|
});
|
|
40
19
|
};
|
|
41
|
-
|
|
42
20
|
exports.inspect = inspect;
|
|
@@ -4,20 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.start = void 0;
|
|
7
|
-
|
|
8
7
|
var _utils = require("@modern-js/utils");
|
|
9
|
-
|
|
10
8
|
var _prodServer = _interopRequireDefault(require("@modern-js/prod-server"));
|
|
11
|
-
|
|
12
9
|
var _printInstructions = require("../utils/printInstructions");
|
|
13
|
-
|
|
14
10
|
var _createServer = require("../utils/createServer");
|
|
15
|
-
|
|
16
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
-
|
|
18
12
|
const start = async api => {
|
|
19
13
|
var _userConfig$source;
|
|
20
|
-
|
|
21
14
|
const appContext = api.useAppContext();
|
|
22
15
|
const userConfig = api.useResolvedConfigContext();
|
|
23
16
|
const hookRunners = api.useHookRunners();
|
|
@@ -26,12 +19,11 @@ const start = async api => {
|
|
|
26
19
|
port,
|
|
27
20
|
serverConfigFile
|
|
28
21
|
} = appContext;
|
|
29
|
-
|
|
30
22
|
_utils.logger.log(_utils.chalk.cyan(`Starting the modern server...`));
|
|
31
|
-
|
|
32
23
|
const apiOnly = await (0, _utils.isApiOnly)(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (_userConfig$source = userConfig.source) === null || _userConfig$source === void 0 ? void 0 : _userConfig$source.entriesDir);
|
|
33
24
|
const app = await (0, _prodServer.default)({
|
|
34
25
|
pwd: appDirectory,
|
|
26
|
+
// FIXME: remove the `any` type
|
|
35
27
|
config: userConfig,
|
|
36
28
|
serverConfigFile,
|
|
37
29
|
internalPlugins: (0, _createServer.injectDataLoaderPlugin)(appContext.serverInternalPlugins),
|
|
@@ -41,9 +33,7 @@ const start = async api => {
|
|
|
41
33
|
if (err) {
|
|
42
34
|
throw err;
|
|
43
35
|
}
|
|
44
|
-
|
|
45
36
|
await (0, _printInstructions.printInstructions)(hookRunners, appContext, userConfig);
|
|
46
37
|
});
|
|
47
38
|
};
|
|
48
|
-
|
|
49
39
|
exports.start = start;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createDefaultConfig = createDefaultConfig;
|
|
7
|
+
exports.createLegacyDefaultConfig = createLegacyDefaultConfig;
|
|
8
|
+
function createDefaultConfig(appContext) {
|
|
9
|
+
const defaultAlias = appContext ? {
|
|
10
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
11
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
12
|
+
'@': appContext.srcDirectory,
|
|
13
|
+
'@shared': appContext.sharedDirectory
|
|
14
|
+
} : {};
|
|
15
|
+
const source = {
|
|
16
|
+
entries: undefined,
|
|
17
|
+
enableAsyncEntry: false,
|
|
18
|
+
disableDefaultEntries: false,
|
|
19
|
+
entriesDir: './src',
|
|
20
|
+
configDir: './config',
|
|
21
|
+
globalVars: undefined,
|
|
22
|
+
moduleScopes: undefined,
|
|
23
|
+
include: [],
|
|
24
|
+
alias: defaultAlias
|
|
25
|
+
};
|
|
26
|
+
const output = {
|
|
27
|
+
assetPrefix: '/',
|
|
28
|
+
distPath: {
|
|
29
|
+
html: 'html',
|
|
30
|
+
js: 'static/js',
|
|
31
|
+
css: 'static/css',
|
|
32
|
+
media: 'static/media',
|
|
33
|
+
root: 'dist'
|
|
34
|
+
},
|
|
35
|
+
copy: undefined,
|
|
36
|
+
disableCssModuleExtension: false,
|
|
37
|
+
enableCssModuleTSDeclaration: false,
|
|
38
|
+
disableMinimize: false,
|
|
39
|
+
enableInlineStyles: false,
|
|
40
|
+
enableInlineScripts: false,
|
|
41
|
+
disableSourceMap: false,
|
|
42
|
+
disableInlineRuntimeChunk: false,
|
|
43
|
+
disableFilenameHash: false,
|
|
44
|
+
enableLatestDecorators: false,
|
|
45
|
+
polyfill: 'entry',
|
|
46
|
+
dataUriLimit: 10000,
|
|
47
|
+
cssModuleLocalIdentName: undefined
|
|
48
|
+
};
|
|
49
|
+
const html = {
|
|
50
|
+
title: '',
|
|
51
|
+
titleByEntries: undefined,
|
|
52
|
+
meta: {
|
|
53
|
+
charset: {
|
|
54
|
+
charset: 'utf-8'
|
|
55
|
+
},
|
|
56
|
+
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',
|
|
57
|
+
'http-equiv': {
|
|
58
|
+
'http-equiv': 'x-ua-compatible',
|
|
59
|
+
content: 'ie=edge'
|
|
60
|
+
},
|
|
61
|
+
renderer: 'webkit',
|
|
62
|
+
layoutmode: 'standard',
|
|
63
|
+
imagemode: 'force',
|
|
64
|
+
'wap-font-scale': 'no',
|
|
65
|
+
'format-detection': 'telephone=no'
|
|
66
|
+
},
|
|
67
|
+
metaByEntries: undefined,
|
|
68
|
+
inject: 'head',
|
|
69
|
+
injectByEntries: undefined,
|
|
70
|
+
mountId: 'root',
|
|
71
|
+
favicon: '',
|
|
72
|
+
faviconByEntries: undefined,
|
|
73
|
+
disableHtmlFolder: false,
|
|
74
|
+
templateParameters: {},
|
|
75
|
+
templateParametersByEntries: undefined
|
|
76
|
+
};
|
|
77
|
+
const server = {
|
|
78
|
+
routes: undefined,
|
|
79
|
+
publicRoutes: undefined,
|
|
80
|
+
ssr: undefined,
|
|
81
|
+
ssrByEntries: undefined,
|
|
82
|
+
baseUrl: '/',
|
|
83
|
+
port: 8080
|
|
84
|
+
};
|
|
85
|
+
const dev = {
|
|
86
|
+
assetPrefix: false,
|
|
87
|
+
https: false
|
|
88
|
+
};
|
|
89
|
+
const tools = {
|
|
90
|
+
webpack: undefined,
|
|
91
|
+
babel: undefined,
|
|
92
|
+
postcss: undefined,
|
|
93
|
+
autoprefixer: undefined,
|
|
94
|
+
devServer: undefined,
|
|
95
|
+
tsLoader: undefined,
|
|
96
|
+
terser: undefined,
|
|
97
|
+
minifyCss: undefined
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
source,
|
|
101
|
+
output,
|
|
102
|
+
server,
|
|
103
|
+
dev,
|
|
104
|
+
html,
|
|
105
|
+
tools,
|
|
106
|
+
plugins: [],
|
|
107
|
+
runtime: {},
|
|
108
|
+
runtimeByEntries: {}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function createLegacyDefaultConfig(appContext) {
|
|
112
|
+
const defaultAlias = appContext ? {
|
|
113
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
114
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
115
|
+
'@': appContext.srcDirectory,
|
|
116
|
+
'@shared': appContext.sharedDirectory
|
|
117
|
+
} : {};
|
|
118
|
+
const sourceDefaults = {
|
|
119
|
+
entries: undefined,
|
|
120
|
+
enableAsyncEntry: false,
|
|
121
|
+
disableDefaultEntries: false,
|
|
122
|
+
entriesDir: './src',
|
|
123
|
+
configDir: './config',
|
|
124
|
+
apiDir: './api',
|
|
125
|
+
envVars: [],
|
|
126
|
+
globalVars: undefined,
|
|
127
|
+
alias: defaultAlias,
|
|
128
|
+
moduleScopes: undefined,
|
|
129
|
+
include: []
|
|
130
|
+
};
|
|
131
|
+
const outputDefaults = {
|
|
132
|
+
assetPrefix: '/',
|
|
133
|
+
htmlPath: 'html',
|
|
134
|
+
jsPath: 'static/js',
|
|
135
|
+
cssPath: 'static/css',
|
|
136
|
+
mediaPath: 'static/media',
|
|
137
|
+
path: 'dist',
|
|
138
|
+
title: '',
|
|
139
|
+
titleByEntries: undefined,
|
|
140
|
+
meta: {
|
|
141
|
+
charset: {
|
|
142
|
+
charset: 'utf-8'
|
|
143
|
+
},
|
|
144
|
+
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',
|
|
145
|
+
'http-equiv': {
|
|
146
|
+
'http-equiv': 'x-ua-compatible',
|
|
147
|
+
content: 'ie=edge'
|
|
148
|
+
},
|
|
149
|
+
renderer: 'webkit',
|
|
150
|
+
layoutmode: 'standard',
|
|
151
|
+
imagemode: 'force',
|
|
152
|
+
'wap-font-scale': 'no',
|
|
153
|
+
'format-detection': 'telephone=no'
|
|
154
|
+
},
|
|
155
|
+
metaByEntries: undefined,
|
|
156
|
+
inject: 'head',
|
|
157
|
+
injectByEntries: undefined,
|
|
158
|
+
mountId: 'root',
|
|
159
|
+
favicon: '',
|
|
160
|
+
faviconByEntries: undefined,
|
|
161
|
+
copy: undefined,
|
|
162
|
+
disableHtmlFolder: false,
|
|
163
|
+
disableCssModuleExtension: false,
|
|
164
|
+
disableCssExtract: false,
|
|
165
|
+
enableCssModuleTSDeclaration: false,
|
|
166
|
+
disableMinimize: false,
|
|
167
|
+
enableInlineStyles: false,
|
|
168
|
+
enableInlineScripts: false,
|
|
169
|
+
disableSourceMap: false,
|
|
170
|
+
disableInlineRuntimeChunk: false,
|
|
171
|
+
disableAssetsCache: false,
|
|
172
|
+
enableLatestDecorators: false,
|
|
173
|
+
polyfill: 'entry',
|
|
174
|
+
dataUriLimit: 10000,
|
|
175
|
+
templateParameters: {},
|
|
176
|
+
templateParametersByEntries: undefined,
|
|
177
|
+
cssModuleLocalIdentName: undefined,
|
|
178
|
+
enableModernMode: false,
|
|
179
|
+
disableNodePolyfill: false,
|
|
180
|
+
enableTsLoader: false
|
|
181
|
+
};
|
|
182
|
+
const serverDefaults = {
|
|
183
|
+
routes: undefined,
|
|
184
|
+
publicRoutes: undefined,
|
|
185
|
+
ssr: undefined,
|
|
186
|
+
ssrByEntries: undefined,
|
|
187
|
+
baseUrl: '/',
|
|
188
|
+
port: 8080
|
|
189
|
+
};
|
|
190
|
+
const devDefaults = {
|
|
191
|
+
assetPrefix: false,
|
|
192
|
+
https: false
|
|
193
|
+
};
|
|
194
|
+
const toolsDefaults = {
|
|
195
|
+
webpack: undefined,
|
|
196
|
+
babel: undefined,
|
|
197
|
+
postcss: undefined,
|
|
198
|
+
autoprefixer: undefined,
|
|
199
|
+
lodash: undefined,
|
|
200
|
+
devServer: undefined,
|
|
201
|
+
tsLoader: undefined,
|
|
202
|
+
terser: undefined,
|
|
203
|
+
minifyCss: undefined
|
|
204
|
+
};
|
|
205
|
+
return {
|
|
206
|
+
source: sourceDefaults,
|
|
207
|
+
output: outputDefaults,
|
|
208
|
+
server: serverDefaults,
|
|
209
|
+
dev: devDefaults,
|
|
210
|
+
tools: toolsDefaults,
|
|
211
|
+
runtime: {},
|
|
212
|
+
runtimeByEntries: {}
|
|
213
|
+
};
|
|
214
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "checkIsLegacyConfig", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _initial.checkIsLegacyConfig;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "createDefaultConfig", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _default.createDefaultConfig;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "createLegacyDefaultConfig", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _default.createLegacyDefaultConfig;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
Object.defineProperty(exports, "initialNormalizedConfig", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _initial.initialNormalizedConfig;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
var _default = require("./default");
|
|
31
|
+
var _initial = require("./initial");
|