@modern-js/app-tools 2.0.0-beta.1 → 2.0.0-beta.3
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 +445 -0
- package/bin/modern.js +10 -1
- package/dist/js/modern/analyze/constants.js +2 -0
- package/dist/js/modern/analyze/generateCode.js +39 -19
- package/dist/js/modern/analyze/getBundleEntry.js +1 -1
- package/dist/js/modern/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/modern/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/modern/analyze/getServerRoutes.js +8 -4
- package/dist/js/modern/analyze/index.js +12 -27
- package/dist/js/modern/analyze/nestedRoutes.js +17 -6
- package/dist/js/modern/analyze/templates.js +59 -27
- package/dist/js/modern/analyze/utils.js +30 -4
- package/dist/js/modern/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/modern/builder/index.js +31 -16
- package/dist/js/modern/builder/loaders/routerLoader.js +20 -0
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +4 -0
- package/dist/js/modern/builder/share.js +1 -1
- package/dist/js/modern/commands/build.js +8 -2
- package/dist/js/modern/commands/dev.js +37 -32
- package/dist/js/modern/commands/inspect.js +4 -2
- package/dist/js/modern/config/default.js +206 -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 +16 -15
- 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 +7 -5
- 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 +1 -1
- package/dist/js/modern/utils/createFileWatcher.js +82 -0
- package/dist/js/modern/utils/restart.js +17 -0
- package/dist/js/node/analyze/constants.js +5 -1
- package/dist/js/node/analyze/generateCode.js +37 -17
- package/dist/js/node/analyze/getBundleEntry.js +1 -1
- package/dist/js/node/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/node/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/node/analyze/getServerRoutes.js +8 -4
- package/dist/js/node/analyze/index.js +13 -39
- package/dist/js/node/analyze/nestedRoutes.js +15 -4
- package/dist/js/node/analyze/templates.js +60 -27
- package/dist/js/node/analyze/utils.js +31 -3
- package/dist/js/node/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/node/builder/index.js +32 -16
- package/dist/js/node/builder/loaders/routerLoader.js +27 -0
- package/dist/js/node/builder/loaders/serverModuleLoader.js +11 -0
- package/dist/js/node/builder/share.js +1 -1
- package/dist/js/node/commands/build.js +8 -2
- package/dist/js/node/commands/dev.js +37 -32
- package/dist/js/node/commands/inspect.js +4 -2
- package/dist/js/node/config/default.js +213 -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 +16 -15
- 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/hooks.js +23 -28
- package/dist/js/node/index.js +30 -16
- package/dist/js/node/initialize/index.js +79 -0
- 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/config.js +1 -1
- package/dist/js/node/utils/createFileWatcher.js +91 -0
- package/dist/js/node/utils/restart.js +23 -0
- package/dist/js/treeshaking/analyze/constants.js +2 -0
- package/dist/js/treeshaking/analyze/generateCode.js +138 -82
- package/dist/js/treeshaking/analyze/getBundleEntry.js +1 -1
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +1 -1
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +1 -1
- package/dist/js/treeshaking/analyze/getServerRoutes.js +7 -5
- package/dist/js/treeshaking/analyze/index.js +10 -26
- package/dist/js/treeshaking/analyze/nestedRoutes.js +98 -55
- package/dist/js/treeshaking/analyze/templates.js +175 -101
- package/dist/js/treeshaking/analyze/utils.js +80 -4
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +18 -12
- package/dist/js/treeshaking/builder/index.js +29 -16
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +14 -0
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +4 -0
- package/dist/js/treeshaking/builder/share.js +1 -1
- package/dist/js/treeshaking/commands/build.js +33 -23
- package/dist/js/treeshaking/commands/dev.js +56 -43
- package/dist/js/treeshaking/commands/inspect.js +8 -3
- package/dist/js/treeshaking/config/default.js +199 -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 +70 -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 +7 -5
- 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 +1 -1
- package/dist/js/treeshaking/utils/createFileWatcher.js +123 -0
- package/dist/js/treeshaking/utils/restart.js +45 -0
- package/dist/types/analyze/constants.d.ts +2 -0
- 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 -41
- package/dist/types/analyze/templates.d.ts +9 -8
- package/dist/types/analyze/utils.d.ts +10 -2
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -2
- package/dist/types/builder/index.d.ts +5 -2
- 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 +2 -2
- 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 +9 -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 -5
- 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 +22 -0
- package/dist/types/types/hooks.d.ts +81 -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 -2
- package/dist/types/utils/createFileWatcher.d.ts +4 -0
- package/dist/types/utils/printInstructions.d.ts +3 -3
- package/dist/types/utils/restart.d.ts +3 -0
- package/lib/types.d.ts +1 -1
- package/package.json +28 -25
- package/dist/js/modern/builder/createHtmlConfig.js +0 -58
- package/dist/js/modern/builder/createSourceConfig.js +0 -74
- package/dist/js/modern/builder/createToolsConfig.js +0 -87
- package/dist/js/node/builder/createHtmlConfig.js +0 -68
- package/dist/js/node/builder/createSourceConfig.js +0 -82
- package/dist/js/node/builder/createToolsConfig.js +0 -94
- package/dist/js/treeshaking/builder/createHtmlConfig.js +0 -59
- package/dist/js/treeshaking/builder/createOutputConfig.js +0 -70
- package/dist/js/treeshaking/builder/createSourceConfig.js +0 -88
- package/dist/js/treeshaking/builder/createToolsConfig.js +0 -85
- 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
|
@@ -62,14 +62,15 @@ export var PluginCompatModern = function PluginCompatModern(appContext, modernCo
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// apply copy plugin
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
65
|
+
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
|
66
|
+
var defaultCopyPattern = createCopyPattern(appContext, modernConfig, 'public', chain);
|
|
67
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(function (args) {
|
|
68
|
+
var _args$;
|
|
69
|
+
return [{
|
|
70
|
+
patterns: [].concat(_toConsumableArray(((_args$ = args[0]) === null || _args$ === void 0 ? void 0 : _args$.patterns) || []), [defaultCopyPattern])
|
|
71
|
+
}];
|
|
72
|
+
});
|
|
73
|
+
}
|
|
73
74
|
var entrypoints = appContext.entrypoints;
|
|
74
75
|
var existNestedRoutes = entrypoints.some(function (entrypoint) {
|
|
75
76
|
return entrypoint.nestedRoutesEntry;
|
|
@@ -77,6 +78,11 @@ export var PluginCompatModern = function PluginCompatModern(appContext, modernCo
|
|
|
77
78
|
chain.plugin('route-plugin').use(RouterPlugin, [{
|
|
78
79
|
existNestedRoutes: existNestedRoutes
|
|
79
80
|
}]);
|
|
81
|
+
if (target !== 'node') {
|
|
82
|
+
var bareServerModuleReg = /\.(server|node)\.[tj]sx?$/;
|
|
83
|
+
chain.module.rule(CHAIN_ID.RULE.JS).exclude.add(bareServerModuleReg);
|
|
84
|
+
chain.module.rule('bare-server-module').test(bareServerModuleReg).use('server-module-loader').loader(require.resolve("../loaders/serverModuleLoader"));
|
|
85
|
+
}
|
|
80
86
|
function isHtmlEnabled(config, target) {
|
|
81
87
|
var _config$tools;
|
|
82
88
|
return ((_config$tools = config.tools) === null || _config$tools === void 0 ? void 0 : _config$tools.htmlPlugin) !== false && target !== 'node' && target !== 'web-worker';
|
|
@@ -108,7 +114,7 @@ function applyCallbacks(api, options) {
|
|
|
108
114
|
*/
|
|
109
115
|
function applyNodeCompat(chain, modernConfig, isProd) {
|
|
110
116
|
// apply node resolve extensions
|
|
111
|
-
for (var _i = 0, _arr = ['.node.js', '.node.jsx', '.node.ts', '.node.tsx']; _i < _arr.length; _i++) {
|
|
117
|
+
for (var _i = 0, _arr = ['.node.js', '.node.jsx', '.node.ts', '.node.tsx', '.server.js', '.server.ts', '.server.ts', '.server.tsx']; _i < _arr.length; _i++) {
|
|
112
118
|
var ext = _arr[_i];
|
|
113
119
|
chain.resolve.extensions.prepend(ext);
|
|
114
120
|
}
|
|
@@ -165,9 +171,9 @@ function applyBottomHtmlWebpackPlugin(_ref3) {
|
|
|
165
171
|
// FIXME: the only need necessary
|
|
166
172
|
var baseTemplateParams = _objectSpread({
|
|
167
173
|
entryName: entryName,
|
|
168
|
-
title: getEntryOptions(entryName, modernConfig.
|
|
169
|
-
mountId: modernConfig.
|
|
170
|
-
}, getEntryOptions(entryName, modernConfig.
|
|
174
|
+
title: getEntryOptions(entryName, modernConfig.html.title, modernConfig.html.titleByEntries, appContext.packageName),
|
|
175
|
+
mountId: modernConfig.html.mountId
|
|
176
|
+
}, getEntryOptions(entryName, modernConfig.html.templateParameters, modernConfig.html.templateParametersByEntries, appContext.packageName));
|
|
171
177
|
chain.plugin("".concat(CHAIN_ID.PLUGIN.HTML, "-").concat(entryName)).tap(function (args) {
|
|
172
178
|
return [_objectSpread(_objectSpread({}, args[0] || {}), {}, {
|
|
173
179
|
__internal__: true,
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
|
3
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
4
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
5
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
6
|
import { createBuilder } from '@modern-js/builder';
|
|
5
7
|
import { builderWebpackProvider } from '@modern-js/builder-webpack-provider';
|
|
6
8
|
import { applyOptionsChain, isUseSSRBundle } from '@modern-js/utils';
|
|
7
9
|
import { PluginCompatModern } from "./builderPlugins/compatModern";
|
|
8
|
-
import {
|
|
9
|
-
import { createOutputConfig } from "./createOutputConfig";
|
|
10
|
-
import { createSourceConfig } from "./createSourceConfig";
|
|
11
|
-
import { createToolsConfig } from "./createToolsConfig";
|
|
10
|
+
import { createCopyPattern } from "./share";
|
|
12
11
|
function getBuilderTargets(normalizedConfig) {
|
|
13
12
|
var targets = ['web'];
|
|
14
13
|
if (normalizedConfig.output.enableModernMode && !targets.includes('modern-web')) {
|
|
@@ -30,7 +29,8 @@ function _createBuilderForEdenX() {
|
|
|
30
29
|
switch (_context.prev = _context.next) {
|
|
31
30
|
case 0:
|
|
32
31
|
normalizedConfig = _ref.normalizedConfig, appContext = _ref.appContext, compatPluginConfig = _ref.compatPluginConfig;
|
|
33
|
-
|
|
32
|
+
// create webpack provider
|
|
33
|
+
builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
|
34
34
|
webpackProvider = builderWebpackProvider({
|
|
35
35
|
builderConfig: builderConfig
|
|
36
36
|
});
|
|
@@ -53,25 +53,38 @@ function _createBuilderForEdenX() {
|
|
|
53
53
|
}));
|
|
54
54
|
return _createBuilderForEdenX.apply(this, arguments);
|
|
55
55
|
}
|
|
56
|
-
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
57
|
-
var
|
|
58
|
-
var html = createHtmlConfig(normalizedConfig, appContext);
|
|
56
|
+
export function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
57
|
+
var _normalizedConfig$ser;
|
|
59
58
|
var output = createOutputConfig(normalizedConfig, appContext);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
return _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
60
|
+
source: _objectSpread(_objectSpread({}, normalizedConfig.source), {}, {
|
|
61
|
+
resolveExtensionPrefix: '.web'
|
|
62
|
+
}),
|
|
64
63
|
output: output,
|
|
65
|
-
tools: tools,
|
|
66
64
|
dev: {
|
|
65
|
+
port: (_normalizedConfig$ser = normalizedConfig.server) === null || _normalizedConfig$ser === void 0 ? void 0 : _normalizedConfig$ser.port,
|
|
67
66
|
https: normalizedConfig.dev.https,
|
|
68
67
|
assetPrefix: normalizedConfig.dev.assetPrefix
|
|
69
68
|
},
|
|
70
|
-
|
|
69
|
+
html: _objectSpread(_objectSpread({}, normalizedConfig.html), {}, {
|
|
70
|
+
templateByEntries: normalizedConfig.html.templateByEntries || appContext.htmlTemplates
|
|
71
|
+
}),
|
|
72
|
+
performance: _objectSpread(_objectSpread({}, normalizedConfig.performance), {}, {
|
|
71
73
|
// `@modern-js/webpack` used to remove moment locale by default
|
|
72
74
|
removeMomentLocale: true
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
+
})
|
|
76
|
+
});
|
|
77
|
+
function createOutputConfig(config, appContext) {
|
|
78
|
+
var defaultCopyPattern = createCopyPattern(appContext, config, 'upload');
|
|
79
|
+
var copy = config.output.copy;
|
|
80
|
+
var copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
|
81
|
+
var builderCopy = [].concat(_toConsumableArray(copyOptions || []), [defaultCopyPattern]);
|
|
82
|
+
return _objectSpread(_objectSpread({}, config.output), {}, {
|
|
83
|
+
copy: builderCopy,
|
|
84
|
+
// We need to do this in the app-tools prepare hook because some files will be generated into the dist directory in the analyze process
|
|
85
|
+
cleanDistPath: false
|
|
86
|
+
});
|
|
87
|
+
}
|
|
75
88
|
}
|
|
76
89
|
export function createBuilderOptions(target, appContext) {
|
|
77
90
|
// create entries
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function loader(source) {
|
|
2
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
3
|
+
this.cacheable();
|
|
4
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
5
|
+
var target = this._compiler.options.target;
|
|
6
|
+
if (target === 'node' || Array.isArray(target) && target.includes('node')) {
|
|
7
|
+
return source;
|
|
8
|
+
}
|
|
9
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
10
|
+
var resourcePath = this.resourcePath;
|
|
11
|
+
var code = "\n export { default } from \"".concat(resourcePath, "\";\n ");
|
|
12
|
+
return code;
|
|
13
|
+
}
|
|
14
|
+
export default loader;
|
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import { template as lodashTemplate } from '@modern-js/utils/lodash';
|
|
3
3
|
import { removeTailSlash } from '@modern-js/utils';
|
|
4
4
|
export function createCopyPattern(appContext, config, patternsType, chain) {
|
|
5
|
-
var configDir = path.resolve(appContext.appDirectory, config.source.configDir);
|
|
5
|
+
var configDir = path.resolve(appContext.appDirectory, config.source.configDir || './config');
|
|
6
6
|
var uploadDir = path.posix.join(configDir.replace(/\\/g, '/'), 'upload');
|
|
7
7
|
var publicDir = path.posix.join(configDir.replace(/\\/g, '/'), 'public');
|
|
8
8
|
var minifiedJsRexExp = /\.min\.js/;
|
|
@@ -7,75 +7,85 @@ import { generateRoutes } from "../utils/routes";
|
|
|
7
7
|
import { buildServerConfig } from "../utils/config";
|
|
8
8
|
export var build = /*#__PURE__*/function () {
|
|
9
9
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, options) {
|
|
10
|
-
var resolvedConfig, appContext, hookRunners, apiOnly, _appDirectory, _distDirectory, _serverConfigFile, distDirectory, appDirectory, serverConfigFile
|
|
10
|
+
var resolvedConfig, appContext, hookRunners, apiOnly, _appDirectory, _distDirectory, _serverConfigFile, distDirectory, appDirectory, serverConfigFile;
|
|
11
11
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12
12
|
while (1) {
|
|
13
13
|
switch (_context.prev = _context.next) {
|
|
14
14
|
case 0:
|
|
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
|
+
}
|
|
15
19
|
resolvedConfig = api.useResolvedConfigContext();
|
|
16
20
|
appContext = api.useAppContext();
|
|
17
21
|
hookRunners = api.useHookRunners();
|
|
18
22
|
apiOnly = appContext.apiOnly;
|
|
19
23
|
if (!apiOnly) {
|
|
20
|
-
_context.next =
|
|
24
|
+
_context.next = 16;
|
|
21
25
|
break;
|
|
22
26
|
}
|
|
23
27
|
_appDirectory = appContext.appDirectory, _distDirectory = appContext.distDirectory, _serverConfigFile = appContext.serverConfigFile;
|
|
24
|
-
_context.next =
|
|
28
|
+
_context.next = 9;
|
|
25
29
|
return hookRunners.beforeBuild({
|
|
26
30
|
// "null" bundlerConfigs
|
|
27
31
|
bundlerConfigs: undefined
|
|
28
32
|
});
|
|
29
|
-
case
|
|
30
|
-
_context.next =
|
|
33
|
+
case 9:
|
|
34
|
+
_context.next = 11;
|
|
31
35
|
return buildServerConfig({
|
|
32
36
|
appDirectory: _appDirectory,
|
|
33
37
|
distDirectory: _distDirectory,
|
|
34
38
|
configFile: _serverConfigFile
|
|
35
39
|
});
|
|
36
|
-
case
|
|
37
|
-
_context.next =
|
|
40
|
+
case 11:
|
|
41
|
+
_context.next = 13;
|
|
38
42
|
return generateRoutes(appContext);
|
|
39
|
-
case
|
|
40
|
-
_context.next =
|
|
43
|
+
case 13:
|
|
44
|
+
_context.next = 15;
|
|
41
45
|
return hookRunners.afterBuild({
|
|
42
46
|
// "null" stats
|
|
43
47
|
stats: undefined
|
|
44
48
|
});
|
|
45
|
-
case 14:
|
|
46
|
-
return _context.abrupt("return");
|
|
47
49
|
case 15:
|
|
50
|
+
return _context.abrupt("return");
|
|
51
|
+
case 16:
|
|
48
52
|
resolvedConfig = _objectSpread(_objectSpread({}, resolvedConfig), {}, {
|
|
49
53
|
cliOptions: options
|
|
50
54
|
});
|
|
51
55
|
ResolvedConfigContext.set(resolvedConfig);
|
|
52
56
|
distDirectory = appContext.distDirectory, appDirectory = appContext.appDirectory, serverConfigFile = appContext.serverConfigFile;
|
|
53
|
-
_context.next =
|
|
57
|
+
_context.next = 21;
|
|
54
58
|
return buildServerConfig({
|
|
55
59
|
appDirectory: appDirectory,
|
|
56
60
|
distDirectory: distDirectory,
|
|
57
61
|
configFile: serverConfigFile
|
|
58
62
|
});
|
|
59
|
-
case
|
|
60
|
-
_context.prev =
|
|
63
|
+
case 21:
|
|
64
|
+
_context.prev = 21;
|
|
61
65
|
logger.info('Create a production build...\n');
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
if (appContext.builder) {
|
|
67
|
+
_context.next = 25;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
71
|
+
case 25:
|
|
72
|
+
_context.next = 27;
|
|
73
|
+
return appContext.builder.build();
|
|
74
|
+
case 27:
|
|
75
|
+
_context.next = 33;
|
|
66
76
|
break;
|
|
67
|
-
case
|
|
68
|
-
_context.prev =
|
|
69
|
-
_context.t0 = _context["catch"](
|
|
77
|
+
case 29:
|
|
78
|
+
_context.prev = 29;
|
|
79
|
+
_context.t0 = _context["catch"](21);
|
|
70
80
|
printBuildError(_context.t0);
|
|
71
81
|
// eslint-disable-next-line no-process-exit
|
|
72
82
|
process.exit(1);
|
|
73
|
-
case
|
|
83
|
+
case 33:
|
|
74
84
|
case "end":
|
|
75
85
|
return _context.stop();
|
|
76
86
|
}
|
|
77
87
|
}
|
|
78
|
-
}, _callee, null, [[
|
|
88
|
+
}, _callee, null, [[21, 29]]);
|
|
79
89
|
}));
|
|
80
90
|
return function build(_x, _x2) {
|
|
81
91
|
return _ref.apply(this, arguments);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
-
import { logger } from '@modern-js/utils';
|
|
5
4
|
import { ResolvedConfigContext } from '@modern-js/core';
|
|
5
|
+
import { createFileWatcher } from "../utils/createFileWatcher";
|
|
6
6
|
import { printInstructions } from "../utils/printInstructions";
|
|
7
7
|
import { createServer, injectDataLoaderPlugin } from "../utils/createServer";
|
|
8
8
|
import { generateRoutes } from "../utils/routes";
|
|
@@ -10,28 +10,33 @@ import { getSpecifiedEntries } from "../utils/getSpecifiedEntries";
|
|
|
10
10
|
import { buildServerConfig } from "../utils/config";
|
|
11
11
|
export var dev = /*#__PURE__*/function () {
|
|
12
12
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(api, options) {
|
|
13
|
-
var
|
|
13
|
+
var _normalizedConfig$too;
|
|
14
|
+
var normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, entrypoints, serverConfigFile, serverInternalPlugins, checkedEntries, compiler, serverOptions, app;
|
|
14
15
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
15
16
|
while (1) {
|
|
16
17
|
switch (_context2.prev = _context2.next) {
|
|
17
18
|
case 0:
|
|
18
|
-
|
|
19
|
+
if (options.analyze) {
|
|
20
|
+
// Builder will read this env var to enable bundle analyzer
|
|
21
|
+
process.env.BUNDLE_ANALYZE = 'true';
|
|
22
|
+
}
|
|
23
|
+
normalizedConfig = api.useResolvedConfigContext();
|
|
19
24
|
appContext = api.useAppContext();
|
|
20
25
|
hookRunners = api.useHookRunners();
|
|
21
|
-
|
|
26
|
+
normalizedConfig = _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
22
27
|
cliOptions: options
|
|
23
28
|
});
|
|
24
|
-
ResolvedConfigContext.set(
|
|
29
|
+
ResolvedConfigContext.set(normalizedConfig);
|
|
25
30
|
appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, port = appContext.port, apiOnly = appContext.apiOnly, entrypoints = appContext.entrypoints, serverConfigFile = appContext.serverConfigFile, serverInternalPlugins = appContext.serverInternalPlugins;
|
|
26
|
-
_context2.next =
|
|
31
|
+
_context2.next = 9;
|
|
27
32
|
return getSpecifiedEntries(options.entry || false, entrypoints);
|
|
28
|
-
case
|
|
33
|
+
case 9:
|
|
29
34
|
checkedEntries = _context2.sent;
|
|
30
35
|
api.setAppContext(_objectSpread(_objectSpread({}, appContext), {}, {
|
|
31
36
|
checkedEntries: checkedEntries
|
|
32
37
|
}));
|
|
33
38
|
appContext.checkedEntries = checkedEntries;
|
|
34
|
-
_context2.next =
|
|
39
|
+
_context2.next = 14;
|
|
35
40
|
return buildServerConfig({
|
|
36
41
|
appDirectory: appDirectory,
|
|
37
42
|
distDirectory: distDirectory,
|
|
@@ -42,46 +47,46 @@ export var dev = /*#__PURE__*/function () {
|
|
|
42
47
|
}
|
|
43
48
|
}
|
|
44
49
|
});
|
|
45
|
-
case
|
|
46
|
-
_context2.next =
|
|
50
|
+
case 14:
|
|
51
|
+
_context2.next = 16;
|
|
47
52
|
return hookRunners.beforeDev();
|
|
48
|
-
case
|
|
49
|
-
|
|
53
|
+
case 16:
|
|
54
|
+
if (!(!appContext.builder && !apiOnly)) {
|
|
55
|
+
_context2.next = 18;
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
59
|
+
case 18:
|
|
50
60
|
if (apiOnly) {
|
|
51
|
-
_context2.next =
|
|
61
|
+
_context2.next = 22;
|
|
52
62
|
break;
|
|
53
63
|
}
|
|
54
|
-
_context2.next =
|
|
55
|
-
return
|
|
56
|
-
case
|
|
64
|
+
_context2.next = 21;
|
|
65
|
+
return appContext.builder.createCompiler();
|
|
66
|
+
case 21:
|
|
57
67
|
compiler = _context2.sent;
|
|
58
|
-
case 20:
|
|
59
|
-
_context2.next = 22;
|
|
60
|
-
return generateRoutes(appContext);
|
|
61
68
|
case 22:
|
|
62
69
|
_context2.next = 24;
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
},
|
|
68
|
-
devMiddleware: {
|
|
69
|
-
writeToDisk: function writeToDisk(file) {
|
|
70
|
-
return !file.includes('.hot-update.');
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
hot: true,
|
|
74
|
-
liveReload: true,
|
|
70
|
+
return generateRoutes(appContext);
|
|
71
|
+
case 24:
|
|
72
|
+
serverOptions = {
|
|
73
|
+
dev: _objectSpread({
|
|
75
74
|
port: port,
|
|
76
|
-
https:
|
|
77
|
-
}
|
|
78
|
-
compiler: compiler,
|
|
75
|
+
https: normalizedConfig.dev.https
|
|
76
|
+
}, (_normalizedConfig$too = normalizedConfig.tools) === null || _normalizedConfig$too === void 0 ? void 0 : _normalizedConfig$too.devServer),
|
|
77
|
+
compiler: compiler || null,
|
|
79
78
|
pwd: appDirectory,
|
|
80
|
-
config:
|
|
79
|
+
config: normalizedConfig,
|
|
81
80
|
serverConfigFile: serverConfigFile,
|
|
82
81
|
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins)
|
|
83
|
-
}
|
|
84
|
-
|
|
82
|
+
};
|
|
83
|
+
if (!apiOnly) {
|
|
84
|
+
_context2.next = 32;
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
_context2.next = 28;
|
|
88
|
+
return createServer(serverOptions);
|
|
89
|
+
case 28:
|
|
85
90
|
app = _context2.sent;
|
|
86
91
|
app.listen(port, /*#__PURE__*/function () {
|
|
87
92
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(err) {
|
|
@@ -95,11 +100,7 @@ export var dev = /*#__PURE__*/function () {
|
|
|
95
100
|
}
|
|
96
101
|
throw err;
|
|
97
102
|
case 2:
|
|
98
|
-
|
|
99
|
-
logger.info("Starting dev server...\n");
|
|
100
|
-
} else {
|
|
101
|
-
printInstructions(hookRunners, appContext, userConfig);
|
|
102
|
-
}
|
|
103
|
+
printInstructions(hookRunners, appContext, normalizedConfig);
|
|
103
104
|
case 3:
|
|
104
105
|
case "end":
|
|
105
106
|
return _context.stop();
|
|
@@ -111,7 +112,19 @@ export var dev = /*#__PURE__*/function () {
|
|
|
111
112
|
return _ref2.apply(this, arguments);
|
|
112
113
|
};
|
|
113
114
|
}());
|
|
114
|
-
|
|
115
|
+
_context2.next = 34;
|
|
116
|
+
break;
|
|
117
|
+
case 32:
|
|
118
|
+
_context2.next = 34;
|
|
119
|
+
return appContext.builder.startDevServer({
|
|
120
|
+
compiler: compiler,
|
|
121
|
+
printURLs: false,
|
|
122
|
+
serverOptions: serverOptions
|
|
123
|
+
});
|
|
124
|
+
case 34:
|
|
125
|
+
_context2.next = 36;
|
|
126
|
+
return createFileWatcher(appContext, normalizedConfig.source.configDir, hookRunners);
|
|
127
|
+
case 36:
|
|
115
128
|
case "end":
|
|
116
129
|
return _context2.stop();
|
|
117
130
|
}
|
|
@@ -3,20 +3,25 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
export var inspect = /*#__PURE__*/function () {
|
|
5
5
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(api, options) {
|
|
6
|
-
var _appContext$builder;
|
|
7
6
|
var appContext;
|
|
8
7
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9
8
|
while (1) {
|
|
10
9
|
switch (_context.prev = _context.next) {
|
|
11
10
|
case 0:
|
|
12
11
|
appContext = api.useAppContext();
|
|
13
|
-
|
|
12
|
+
if (appContext.builder) {
|
|
13
|
+
_context.next = 3;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
17
|
+
case 3:
|
|
18
|
+
return _context.abrupt("return", appContext.builder.inspectConfig({
|
|
14
19
|
env: options.env,
|
|
15
20
|
verbose: options.verbose,
|
|
16
21
|
outputPath: join(appContext === null || appContext === void 0 ? void 0 : appContext.builder.context.distPath, options.output),
|
|
17
22
|
writeToDisk: true
|
|
18
23
|
}));
|
|
19
|
-
case
|
|
24
|
+
case 4:
|
|
20
25
|
case "end":
|
|
21
26
|
return _context.stop();
|
|
22
27
|
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
export function createDefaultConfig(appContext) {
|
|
3
|
+
var _ref;
|
|
4
|
+
var defaultAlias = appContext ? (_ref = {}, _defineProperty(_ref, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_ref, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_ref, '@', appContext.srcDirectory), _defineProperty(_ref, '@shared', appContext.sharedDirectory), _ref) : {};
|
|
5
|
+
var source = {
|
|
6
|
+
entries: undefined,
|
|
7
|
+
enableAsyncEntry: false,
|
|
8
|
+
disableDefaultEntries: false,
|
|
9
|
+
entriesDir: './src',
|
|
10
|
+
configDir: './config',
|
|
11
|
+
globalVars: undefined,
|
|
12
|
+
moduleScopes: undefined,
|
|
13
|
+
include: [],
|
|
14
|
+
alias: defaultAlias
|
|
15
|
+
};
|
|
16
|
+
var output = {
|
|
17
|
+
assetPrefix: '/',
|
|
18
|
+
distPath: {
|
|
19
|
+
html: 'html',
|
|
20
|
+
js: 'static/js',
|
|
21
|
+
css: 'static/css',
|
|
22
|
+
media: 'static/media',
|
|
23
|
+
root: 'dist'
|
|
24
|
+
},
|
|
25
|
+
copy: undefined,
|
|
26
|
+
disableCssModuleExtension: false,
|
|
27
|
+
enableCssModuleTSDeclaration: false,
|
|
28
|
+
disableMinimize: false,
|
|
29
|
+
enableInlineStyles: false,
|
|
30
|
+
enableInlineScripts: false,
|
|
31
|
+
disableSourceMap: false,
|
|
32
|
+
disableInlineRuntimeChunk: false,
|
|
33
|
+
disableFilenameHash: false,
|
|
34
|
+
enableLatestDecorators: false,
|
|
35
|
+
polyfill: 'entry',
|
|
36
|
+
cssModuleLocalIdentName: undefined
|
|
37
|
+
};
|
|
38
|
+
var html = {
|
|
39
|
+
title: '',
|
|
40
|
+
titleByEntries: undefined,
|
|
41
|
+
meta: {
|
|
42
|
+
charset: {
|
|
43
|
+
charset: 'utf-8'
|
|
44
|
+
},
|
|
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': {
|
|
47
|
+
'http-equiv': 'x-ua-compatible',
|
|
48
|
+
content: 'ie=edge'
|
|
49
|
+
},
|
|
50
|
+
renderer: 'webkit',
|
|
51
|
+
layoutmode: 'standard',
|
|
52
|
+
imagemode: 'force',
|
|
53
|
+
'wap-font-scale': 'no',
|
|
54
|
+
'format-detection': 'telephone=no'
|
|
55
|
+
},
|
|
56
|
+
metaByEntries: undefined,
|
|
57
|
+
inject: 'head',
|
|
58
|
+
injectByEntries: undefined,
|
|
59
|
+
mountId: 'root',
|
|
60
|
+
favicon: '',
|
|
61
|
+
faviconByEntries: undefined,
|
|
62
|
+
disableHtmlFolder: false,
|
|
63
|
+
templateParameters: {},
|
|
64
|
+
templateParametersByEntries: undefined
|
|
65
|
+
};
|
|
66
|
+
var server = {
|
|
67
|
+
routes: undefined,
|
|
68
|
+
publicRoutes: undefined,
|
|
69
|
+
ssr: undefined,
|
|
70
|
+
ssrByEntries: undefined,
|
|
71
|
+
baseUrl: '/',
|
|
72
|
+
port: 8080
|
|
73
|
+
};
|
|
74
|
+
var dev = {
|
|
75
|
+
assetPrefix: false,
|
|
76
|
+
https: false
|
|
77
|
+
};
|
|
78
|
+
var tools = {
|
|
79
|
+
webpack: undefined,
|
|
80
|
+
babel: undefined,
|
|
81
|
+
postcss: undefined,
|
|
82
|
+
autoprefixer: undefined,
|
|
83
|
+
devServer: undefined,
|
|
84
|
+
tsLoader: undefined,
|
|
85
|
+
terser: undefined,
|
|
86
|
+
minifyCss: undefined
|
|
87
|
+
};
|
|
88
|
+
return {
|
|
89
|
+
source: source,
|
|
90
|
+
output: output,
|
|
91
|
+
server: server,
|
|
92
|
+
dev: dev,
|
|
93
|
+
html: html,
|
|
94
|
+
tools: tools,
|
|
95
|
+
plugins: [],
|
|
96
|
+
runtime: {},
|
|
97
|
+
runtimeByEntries: {}
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
export function createLegacyDefaultConfig(appContext) {
|
|
101
|
+
var _ref2;
|
|
102
|
+
var defaultAlias = appContext ? (_ref2 = {}, _defineProperty(_ref2, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_ref2, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_ref2, '@', appContext.srcDirectory), _defineProperty(_ref2, '@shared', appContext.sharedDirectory), _ref2) : {};
|
|
103
|
+
var sourceDefaults = {
|
|
104
|
+
entries: undefined,
|
|
105
|
+
enableAsyncEntry: false,
|
|
106
|
+
disableDefaultEntries: false,
|
|
107
|
+
entriesDir: './src',
|
|
108
|
+
configDir: './config',
|
|
109
|
+
apiDir: './api',
|
|
110
|
+
envVars: [],
|
|
111
|
+
globalVars: undefined,
|
|
112
|
+
alias: defaultAlias,
|
|
113
|
+
moduleScopes: undefined,
|
|
114
|
+
include: []
|
|
115
|
+
};
|
|
116
|
+
var outputDefaults = {
|
|
117
|
+
assetPrefix: '/',
|
|
118
|
+
htmlPath: 'html',
|
|
119
|
+
jsPath: 'static/js',
|
|
120
|
+
cssPath: 'static/css',
|
|
121
|
+
mediaPath: 'static/media',
|
|
122
|
+
path: 'dist',
|
|
123
|
+
title: '',
|
|
124
|
+
titleByEntries: undefined,
|
|
125
|
+
meta: {
|
|
126
|
+
charset: {
|
|
127
|
+
charset: 'utf-8'
|
|
128
|
+
},
|
|
129
|
+
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',
|
|
130
|
+
'http-equiv': {
|
|
131
|
+
'http-equiv': 'x-ua-compatible',
|
|
132
|
+
content: 'ie=edge'
|
|
133
|
+
},
|
|
134
|
+
renderer: 'webkit',
|
|
135
|
+
layoutmode: 'standard',
|
|
136
|
+
imagemode: 'force',
|
|
137
|
+
'wap-font-scale': 'no',
|
|
138
|
+
'format-detection': 'telephone=no'
|
|
139
|
+
},
|
|
140
|
+
metaByEntries: undefined,
|
|
141
|
+
inject: 'head',
|
|
142
|
+
injectByEntries: undefined,
|
|
143
|
+
mountId: 'root',
|
|
144
|
+
favicon: '',
|
|
145
|
+
faviconByEntries: undefined,
|
|
146
|
+
copy: undefined,
|
|
147
|
+
disableHtmlFolder: false,
|
|
148
|
+
disableCssModuleExtension: false,
|
|
149
|
+
disableCssExtract: false,
|
|
150
|
+
enableCssModuleTSDeclaration: false,
|
|
151
|
+
disableMinimize: false,
|
|
152
|
+
enableInlineStyles: false,
|
|
153
|
+
enableInlineScripts: false,
|
|
154
|
+
disableSourceMap: false,
|
|
155
|
+
disableInlineRuntimeChunk: false,
|
|
156
|
+
disableAssetsCache: false,
|
|
157
|
+
enableLatestDecorators: false,
|
|
158
|
+
polyfill: 'entry',
|
|
159
|
+
dataUriLimit: 10000,
|
|
160
|
+
templateParameters: {},
|
|
161
|
+
templateParametersByEntries: undefined,
|
|
162
|
+
cssModuleLocalIdentName: undefined,
|
|
163
|
+
enableModernMode: false,
|
|
164
|
+
disableNodePolyfill: false,
|
|
165
|
+
enableTsLoader: false
|
|
166
|
+
};
|
|
167
|
+
var serverDefaults = {
|
|
168
|
+
routes: undefined,
|
|
169
|
+
publicRoutes: undefined,
|
|
170
|
+
ssr: undefined,
|
|
171
|
+
ssrByEntries: undefined,
|
|
172
|
+
baseUrl: '/',
|
|
173
|
+
port: 8080
|
|
174
|
+
};
|
|
175
|
+
var devDefaults = {
|
|
176
|
+
assetPrefix: false,
|
|
177
|
+
https: false
|
|
178
|
+
};
|
|
179
|
+
var toolsDefaults = {
|
|
180
|
+
webpack: undefined,
|
|
181
|
+
babel: undefined,
|
|
182
|
+
postcss: undefined,
|
|
183
|
+
autoprefixer: undefined,
|
|
184
|
+
lodash: undefined,
|
|
185
|
+
devServer: undefined,
|
|
186
|
+
tsLoader: undefined,
|
|
187
|
+
terser: undefined,
|
|
188
|
+
minifyCss: undefined
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
source: sourceDefaults,
|
|
192
|
+
output: outputDefaults,
|
|
193
|
+
server: serverDefaults,
|
|
194
|
+
dev: devDefaults,
|
|
195
|
+
tools: toolsDefaults,
|
|
196
|
+
runtime: {},
|
|
197
|
+
runtimeByEntries: {}
|
|
198
|
+
};
|
|
199
|
+
}
|