@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
|
@@ -5,16 +5,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.createBuilderForEdenX = createBuilderForEdenX;
|
|
7
7
|
exports.createBuilderOptions = createBuilderOptions;
|
|
8
|
+
exports.createBuilderProviderConfig = createBuilderProviderConfig;
|
|
8
9
|
var _builder = require("@modern-js/builder");
|
|
9
10
|
var _builderWebpackProvider = require("@modern-js/builder-webpack-provider");
|
|
10
11
|
var _utils = require("@modern-js/utils");
|
|
11
12
|
var _compatModern = require("./builderPlugins/compatModern");
|
|
12
|
-
var
|
|
13
|
-
var _createOutputConfig = require("./createOutputConfig");
|
|
14
|
-
var _createSourceConfig = require("./createSourceConfig");
|
|
15
|
-
var _createToolsConfig = require("./createToolsConfig");
|
|
13
|
+
var _share = require("./share");
|
|
16
14
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
15
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
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; }
|
|
18
19
|
function getBuilderTargets(normalizedConfig) {
|
|
19
20
|
const targets = ['web'];
|
|
20
21
|
if (normalizedConfig.output.enableModernMode && !targets.includes('modern-web')) {
|
|
@@ -30,8 +31,8 @@ async function createBuilderForEdenX({
|
|
|
30
31
|
appContext,
|
|
31
32
|
compatPluginConfig
|
|
32
33
|
}) {
|
|
33
|
-
const builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
|
34
34
|
// create webpack provider
|
|
35
|
+
const builderConfig = createBuilderProviderConfig(normalizedConfig, appContext);
|
|
35
36
|
const webpackProvider = (0, _builderWebpackProvider.builderWebpackProvider)({
|
|
36
37
|
builderConfig
|
|
37
38
|
});
|
|
@@ -42,24 +43,39 @@ async function createBuilderForEdenX({
|
|
|
42
43
|
return builder;
|
|
43
44
|
}
|
|
44
45
|
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
html,
|
|
46
|
+
var _normalizedConfig$ser;
|
|
47
|
+
const output = createOutputConfig(normalizedConfig, appContext);
|
|
48
|
+
return _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
49
|
+
source: _objectSpread(_objectSpread({}, normalizedConfig.source), {}, {
|
|
50
|
+
resolveExtensionPrefix: '.web'
|
|
51
|
+
}),
|
|
52
52
|
output,
|
|
53
|
-
tools,
|
|
54
53
|
dev: {
|
|
54
|
+
port: (_normalizedConfig$ser = normalizedConfig.server) === null || _normalizedConfig$ser === void 0 ? void 0 : _normalizedConfig$ser.port,
|
|
55
55
|
https: normalizedConfig.dev.https,
|
|
56
56
|
assetPrefix: normalizedConfig.dev.assetPrefix
|
|
57
57
|
},
|
|
58
|
-
|
|
58
|
+
html: _objectSpread(_objectSpread({}, normalizedConfig.html), {}, {
|
|
59
|
+
templateByEntries: normalizedConfig.html.templateByEntries || appContext.htmlTemplates
|
|
60
|
+
}),
|
|
61
|
+
performance: _objectSpread(_objectSpread({}, normalizedConfig.performance), {}, {
|
|
59
62
|
// `@modern-js/webpack` used to remove moment locale by default
|
|
60
63
|
removeMomentLocale: true
|
|
61
|
-
}
|
|
62
|
-
};
|
|
64
|
+
})
|
|
65
|
+
});
|
|
66
|
+
function createOutputConfig(config, appContext) {
|
|
67
|
+
const defaultCopyPattern = (0, _share.createCopyPattern)(appContext, config, 'upload');
|
|
68
|
+
const {
|
|
69
|
+
copy
|
|
70
|
+
} = config.output;
|
|
71
|
+
const copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
|
72
|
+
const builderCopy = [...(copyOptions || []), defaultCopyPattern];
|
|
73
|
+
return _objectSpread(_objectSpread({}, config.output), {}, {
|
|
74
|
+
copy: builderCopy,
|
|
75
|
+
// 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
|
|
76
|
+
cleanDistPath: false
|
|
77
|
+
});
|
|
78
|
+
}
|
|
63
79
|
}
|
|
64
80
|
function createBuilderOptions(target, appContext) {
|
|
65
81
|
// create entries
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
function loader(source) {
|
|
8
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
9
|
+
this.cacheable();
|
|
10
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
11
|
+
const {
|
|
12
|
+
target
|
|
13
|
+
} = this._compiler.options;
|
|
14
|
+
if (target === 'node' || Array.isArray(target) && target.includes('node')) {
|
|
15
|
+
return source;
|
|
16
|
+
}
|
|
17
|
+
// eslint-disable-next-line @babel/no-invalid-this
|
|
18
|
+
const {
|
|
19
|
+
resourcePath
|
|
20
|
+
} = this;
|
|
21
|
+
const code = `
|
|
22
|
+
export { default } from "${resourcePath}";
|
|
23
|
+
`;
|
|
24
|
+
return code;
|
|
25
|
+
}
|
|
26
|
+
var _default = loader;
|
|
27
|
+
exports.default = _default;
|
|
@@ -9,7 +9,7 @@ var _lodash = require("@modern-js/utils/lodash");
|
|
|
9
9
|
var _utils = require("@modern-js/utils");
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
11
|
function createCopyPattern(appContext, config, patternsType, chain) {
|
|
12
|
-
const configDir = _path.default.resolve(appContext.appDirectory, config.source.configDir);
|
|
12
|
+
const configDir = _path.default.resolve(appContext.appDirectory, config.source.configDir || './config');
|
|
13
13
|
const uploadDir = _path.default.posix.join(configDir.replace(/\\/g, '/'), 'upload');
|
|
14
14
|
const publicDir = _path.default.posix.join(configDir.replace(/\\/g, '/'), 'public');
|
|
15
15
|
const minifiedJsRexExp = /\.min\.js/;
|
|
@@ -12,6 +12,10 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
12
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; }
|
|
13
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; }
|
|
14
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
|
+
}
|
|
15
19
|
let resolvedConfig = api.useResolvedConfigContext();
|
|
16
20
|
const appContext = api.useAppContext();
|
|
17
21
|
const hookRunners = api.useHookRunners();
|
|
@@ -55,9 +59,11 @@ const build = async (api, options) => {
|
|
|
55
59
|
configFile: serverConfigFile
|
|
56
60
|
});
|
|
57
61
|
try {
|
|
58
|
-
var _appContext$builder;
|
|
59
62
|
_utils.logger.info('Create a production build...\n');
|
|
60
|
-
|
|
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();
|
|
61
67
|
} catch (error) {
|
|
62
68
|
(0, _utils.printBuildError)(error);
|
|
63
69
|
// eslint-disable-next-line no-process-exit
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.dev = void 0;
|
|
7
|
-
var _utils = require("@modern-js/utils");
|
|
8
7
|
var _core = require("@modern-js/core");
|
|
8
|
+
var _createFileWatcher = require("../utils/createFileWatcher");
|
|
9
9
|
var _printInstructions = require("../utils/printInstructions");
|
|
10
10
|
var _createServer = require("../utils/createServer");
|
|
11
11
|
var _routes = require("../utils/routes");
|
|
@@ -15,13 +15,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
15
|
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; }
|
|
16
16
|
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; }
|
|
17
17
|
const dev = async (api, options) => {
|
|
18
|
-
|
|
18
|
+
var _normalizedConfig$too;
|
|
19
|
+
if (options.analyze) {
|
|
20
|
+
// Builder will read this env var to enable bundle analyzer
|
|
21
|
+
process.env.BUNDLE_ANALYZE = 'true';
|
|
22
|
+
}
|
|
23
|
+
let normalizedConfig = api.useResolvedConfigContext();
|
|
19
24
|
const appContext = api.useAppContext();
|
|
20
25
|
const hookRunners = api.useHookRunners();
|
|
21
|
-
|
|
26
|
+
normalizedConfig = _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
22
27
|
cliOptions: options
|
|
23
28
|
});
|
|
24
|
-
_core.ResolvedConfigContext.set(
|
|
29
|
+
_core.ResolvedConfigContext.set(normalizedConfig);
|
|
25
30
|
const {
|
|
26
31
|
appDirectory,
|
|
27
32
|
distDirectory,
|
|
@@ -47,40 +52,40 @@ const dev = async (api, options) => {
|
|
|
47
52
|
}
|
|
48
53
|
});
|
|
49
54
|
await hookRunners.beforeDev();
|
|
50
|
-
let compiler
|
|
55
|
+
let compiler;
|
|
56
|
+
if (!appContext.builder && !apiOnly) {
|
|
57
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
58
|
+
}
|
|
51
59
|
if (!apiOnly) {
|
|
52
|
-
|
|
53
|
-
compiler = await ((_appContext$builder = appContext.builder) === null || _appContext$builder === void 0 ? void 0 : _appContext$builder.createCompiler());
|
|
60
|
+
compiler = await appContext.builder.createCompiler();
|
|
54
61
|
}
|
|
55
62
|
await (0, _routes.generateRoutes)(appContext);
|
|
56
|
-
const
|
|
57
|
-
dev: _objectSpread(
|
|
58
|
-
client: {
|
|
59
|
-
port: port.toString()
|
|
60
|
-
},
|
|
61
|
-
devMiddleware: {
|
|
62
|
-
writeToDisk: file => !file.includes('.hot-update.')
|
|
63
|
-
},
|
|
64
|
-
hot: true,
|
|
65
|
-
liveReload: true,
|
|
63
|
+
const serverOptions = {
|
|
64
|
+
dev: _objectSpread({
|
|
66
65
|
port,
|
|
67
|
-
https:
|
|
68
|
-
}
|
|
69
|
-
compiler,
|
|
66
|
+
https: normalizedConfig.dev.https
|
|
67
|
+
}, (_normalizedConfig$too = normalizedConfig.tools) === null || _normalizedConfig$too === void 0 ? void 0 : _normalizedConfig$too.devServer),
|
|
68
|
+
compiler: compiler || null,
|
|
70
69
|
pwd: appDirectory,
|
|
71
|
-
config:
|
|
70
|
+
config: normalizedConfig,
|
|
72
71
|
serverConfigFile,
|
|
73
72
|
internalPlugins: (0, _createServer.injectDataLoaderPlugin)(serverInternalPlugins)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
73
|
+
};
|
|
74
|
+
if (apiOnly) {
|
|
75
|
+
const app = await (0, _createServer.createServer)(serverOptions);
|
|
76
|
+
app.listen(port, async err => {
|
|
77
|
+
if (err) {
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
(0, _printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
81
|
+
});
|
|
82
|
+
} else {
|
|
83
|
+
await appContext.builder.startDevServer({
|
|
84
|
+
compiler,
|
|
85
|
+
printURLs: false,
|
|
86
|
+
serverOptions
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
await (0, _createFileWatcher.createFileWatcher)(appContext, normalizedConfig.source.configDir, hookRunners);
|
|
85
90
|
};
|
|
86
91
|
exports.dev = dev;
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.inspect = void 0;
|
|
7
7
|
var _path = require("path");
|
|
8
8
|
const inspect = async (api, options) => {
|
|
9
|
-
var _appContext$builder;
|
|
10
9
|
const appContext = api.useAppContext();
|
|
11
|
-
|
|
10
|
+
if (!appContext.builder) {
|
|
11
|
+
throw new Error('Expect the Builder to have been initialized, But the appContext.builder received `undefined`');
|
|
12
|
+
}
|
|
13
|
+
return appContext.builder.inspectConfig({
|
|
12
14
|
env: options.env,
|
|
13
15
|
verbose: options.verbose,
|
|
14
16
|
outputPath: (0, _path.join)(appContext === null || appContext === void 0 ? void 0 : appContext.builder.context.distPath, options.output),
|
|
@@ -0,0 +1,213 @@
|
|
|
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
|
+
cssModuleLocalIdentName: undefined
|
|
47
|
+
};
|
|
48
|
+
const html = {
|
|
49
|
+
title: '',
|
|
50
|
+
titleByEntries: undefined,
|
|
51
|
+
meta: {
|
|
52
|
+
charset: {
|
|
53
|
+
charset: 'utf-8'
|
|
54
|
+
},
|
|
55
|
+
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',
|
|
56
|
+
'http-equiv': {
|
|
57
|
+
'http-equiv': 'x-ua-compatible',
|
|
58
|
+
content: 'ie=edge'
|
|
59
|
+
},
|
|
60
|
+
renderer: 'webkit',
|
|
61
|
+
layoutmode: 'standard',
|
|
62
|
+
imagemode: 'force',
|
|
63
|
+
'wap-font-scale': 'no',
|
|
64
|
+
'format-detection': 'telephone=no'
|
|
65
|
+
},
|
|
66
|
+
metaByEntries: undefined,
|
|
67
|
+
inject: 'head',
|
|
68
|
+
injectByEntries: undefined,
|
|
69
|
+
mountId: 'root',
|
|
70
|
+
favicon: '',
|
|
71
|
+
faviconByEntries: undefined,
|
|
72
|
+
disableHtmlFolder: false,
|
|
73
|
+
templateParameters: {},
|
|
74
|
+
templateParametersByEntries: undefined
|
|
75
|
+
};
|
|
76
|
+
const server = {
|
|
77
|
+
routes: undefined,
|
|
78
|
+
publicRoutes: undefined,
|
|
79
|
+
ssr: undefined,
|
|
80
|
+
ssrByEntries: undefined,
|
|
81
|
+
baseUrl: '/',
|
|
82
|
+
port: 8080
|
|
83
|
+
};
|
|
84
|
+
const dev = {
|
|
85
|
+
assetPrefix: false,
|
|
86
|
+
https: false
|
|
87
|
+
};
|
|
88
|
+
const tools = {
|
|
89
|
+
webpack: undefined,
|
|
90
|
+
babel: undefined,
|
|
91
|
+
postcss: undefined,
|
|
92
|
+
autoprefixer: undefined,
|
|
93
|
+
devServer: undefined,
|
|
94
|
+
tsLoader: undefined,
|
|
95
|
+
terser: undefined,
|
|
96
|
+
minifyCss: undefined
|
|
97
|
+
};
|
|
98
|
+
return {
|
|
99
|
+
source,
|
|
100
|
+
output,
|
|
101
|
+
server,
|
|
102
|
+
dev,
|
|
103
|
+
html,
|
|
104
|
+
tools,
|
|
105
|
+
plugins: [],
|
|
106
|
+
runtime: {},
|
|
107
|
+
runtimeByEntries: {}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
function createLegacyDefaultConfig(appContext) {
|
|
111
|
+
const defaultAlias = appContext ? {
|
|
112
|
+
[appContext.internalDirAlias]: appContext.internalDirectory,
|
|
113
|
+
[appContext.internalSrcAlias]: appContext.srcDirectory,
|
|
114
|
+
'@': appContext.srcDirectory,
|
|
115
|
+
'@shared': appContext.sharedDirectory
|
|
116
|
+
} : {};
|
|
117
|
+
const sourceDefaults = {
|
|
118
|
+
entries: undefined,
|
|
119
|
+
enableAsyncEntry: false,
|
|
120
|
+
disableDefaultEntries: false,
|
|
121
|
+
entriesDir: './src',
|
|
122
|
+
configDir: './config',
|
|
123
|
+
apiDir: './api',
|
|
124
|
+
envVars: [],
|
|
125
|
+
globalVars: undefined,
|
|
126
|
+
alias: defaultAlias,
|
|
127
|
+
moduleScopes: undefined,
|
|
128
|
+
include: []
|
|
129
|
+
};
|
|
130
|
+
const outputDefaults = {
|
|
131
|
+
assetPrefix: '/',
|
|
132
|
+
htmlPath: 'html',
|
|
133
|
+
jsPath: 'static/js',
|
|
134
|
+
cssPath: 'static/css',
|
|
135
|
+
mediaPath: 'static/media',
|
|
136
|
+
path: 'dist',
|
|
137
|
+
title: '',
|
|
138
|
+
titleByEntries: undefined,
|
|
139
|
+
meta: {
|
|
140
|
+
charset: {
|
|
141
|
+
charset: 'utf-8'
|
|
142
|
+
},
|
|
143
|
+
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',
|
|
144
|
+
'http-equiv': {
|
|
145
|
+
'http-equiv': 'x-ua-compatible',
|
|
146
|
+
content: 'ie=edge'
|
|
147
|
+
},
|
|
148
|
+
renderer: 'webkit',
|
|
149
|
+
layoutmode: 'standard',
|
|
150
|
+
imagemode: 'force',
|
|
151
|
+
'wap-font-scale': 'no',
|
|
152
|
+
'format-detection': 'telephone=no'
|
|
153
|
+
},
|
|
154
|
+
metaByEntries: undefined,
|
|
155
|
+
inject: 'head',
|
|
156
|
+
injectByEntries: undefined,
|
|
157
|
+
mountId: 'root',
|
|
158
|
+
favicon: '',
|
|
159
|
+
faviconByEntries: undefined,
|
|
160
|
+
copy: undefined,
|
|
161
|
+
disableHtmlFolder: false,
|
|
162
|
+
disableCssModuleExtension: false,
|
|
163
|
+
disableCssExtract: false,
|
|
164
|
+
enableCssModuleTSDeclaration: false,
|
|
165
|
+
disableMinimize: false,
|
|
166
|
+
enableInlineStyles: false,
|
|
167
|
+
enableInlineScripts: false,
|
|
168
|
+
disableSourceMap: false,
|
|
169
|
+
disableInlineRuntimeChunk: false,
|
|
170
|
+
disableAssetsCache: false,
|
|
171
|
+
enableLatestDecorators: false,
|
|
172
|
+
polyfill: 'entry',
|
|
173
|
+
dataUriLimit: 10000,
|
|
174
|
+
templateParameters: {},
|
|
175
|
+
templateParametersByEntries: undefined,
|
|
176
|
+
cssModuleLocalIdentName: undefined,
|
|
177
|
+
enableModernMode: false,
|
|
178
|
+
disableNodePolyfill: false,
|
|
179
|
+
enableTsLoader: false
|
|
180
|
+
};
|
|
181
|
+
const serverDefaults = {
|
|
182
|
+
routes: undefined,
|
|
183
|
+
publicRoutes: undefined,
|
|
184
|
+
ssr: undefined,
|
|
185
|
+
ssrByEntries: undefined,
|
|
186
|
+
baseUrl: '/',
|
|
187
|
+
port: 8080
|
|
188
|
+
};
|
|
189
|
+
const devDefaults = {
|
|
190
|
+
assetPrefix: false,
|
|
191
|
+
https: false
|
|
192
|
+
};
|
|
193
|
+
const toolsDefaults = {
|
|
194
|
+
webpack: undefined,
|
|
195
|
+
babel: undefined,
|
|
196
|
+
postcss: undefined,
|
|
197
|
+
autoprefixer: undefined,
|
|
198
|
+
lodash: undefined,
|
|
199
|
+
devServer: undefined,
|
|
200
|
+
tsLoader: undefined,
|
|
201
|
+
terser: undefined,
|
|
202
|
+
minifyCss: undefined
|
|
203
|
+
};
|
|
204
|
+
return {
|
|
205
|
+
source: sourceDefaults,
|
|
206
|
+
output: outputDefaults,
|
|
207
|
+
server: serverDefaults,
|
|
208
|
+
dev: devDefaults,
|
|
209
|
+
tools: toolsDefaults,
|
|
210
|
+
runtime: {},
|
|
211
|
+
runtimeByEntries: {}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
@@ -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");
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createHtmlConfig = createHtmlConfig;
|
|
7
|
+
function createHtmlConfig(config) {
|
|
8
|
+
const {
|
|
9
|
+
disableHtmlFolder,
|
|
10
|
+
favicon,
|
|
11
|
+
faviconByEntries,
|
|
12
|
+
inject,
|
|
13
|
+
injectByEntries,
|
|
14
|
+
meta,
|
|
15
|
+
metaByEntries,
|
|
16
|
+
mountId,
|
|
17
|
+
title,
|
|
18
|
+
titleByEntries,
|
|
19
|
+
templateParameters,
|
|
20
|
+
templateParametersByEntries,
|
|
21
|
+
crossorigin
|
|
22
|
+
} = config.output;
|
|
23
|
+
return {
|
|
24
|
+
disableHtmlFolder,
|
|
25
|
+
favicon,
|
|
26
|
+
faviconByEntries,
|
|
27
|
+
inject,
|
|
28
|
+
injectByEntries,
|
|
29
|
+
meta,
|
|
30
|
+
metaByEntries,
|
|
31
|
+
mountId,
|
|
32
|
+
title,
|
|
33
|
+
titleByEntries,
|
|
34
|
+
crossorigin,
|
|
35
|
+
templateParameters,
|
|
36
|
+
templateParametersByEntries
|
|
37
|
+
};
|
|
38
|
+
}
|
|
@@ -4,10 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.createOutputConfig = createOutputConfig;
|
|
7
|
-
|
|
8
|
-
function createOutputConfig(normalizedConfig, appContext) {
|
|
9
|
-
// TODO: add `externals` options in Modern.
|
|
10
|
-
|
|
7
|
+
function createOutputConfig(config) {
|
|
11
8
|
const {
|
|
12
9
|
assetPrefix,
|
|
13
10
|
copy,
|
|
@@ -16,8 +13,10 @@ function createOutputConfig(normalizedConfig, appContext) {
|
|
|
16
13
|
jsPath,
|
|
17
14
|
htmlPath,
|
|
18
15
|
mediaPath,
|
|
16
|
+
enableTsLoader,
|
|
19
17
|
path,
|
|
20
18
|
disableInlineRuntimeChunk,
|
|
19
|
+
disableCssExtract,
|
|
21
20
|
disableMinimize,
|
|
22
21
|
disableSourceMap,
|
|
23
22
|
disableTsChecker,
|
|
@@ -28,13 +27,14 @@ function createOutputConfig(normalizedConfig, appContext) {
|
|
|
28
27
|
dataUriLimit,
|
|
29
28
|
disableAssetsCache,
|
|
30
29
|
enableLatestDecorators,
|
|
31
|
-
disableCssModuleExtension
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
disableCssModuleExtension,
|
|
31
|
+
ssg,
|
|
32
|
+
enableModernMode,
|
|
33
|
+
disableNodePolyfill
|
|
34
|
+
} = config.output;
|
|
35
35
|
return {
|
|
36
36
|
assetPrefix,
|
|
37
|
-
copy
|
|
37
|
+
copy,
|
|
38
38
|
distPath: {
|
|
39
39
|
root: path,
|
|
40
40
|
css: cssPath,
|
|
@@ -52,25 +52,26 @@ function createOutputConfig(normalizedConfig, appContext) {
|
|
|
52
52
|
font: dataUriLimit,
|
|
53
53
|
media: dataUriLimit
|
|
54
54
|
},
|
|
55
|
+
disableCssExtract,
|
|
55
56
|
disableCssModuleExtension,
|
|
56
57
|
disableInlineRuntimeChunk,
|
|
57
58
|
disableMinimize,
|
|
58
59
|
disableSourceMap,
|
|
59
|
-
disableTsChecker,
|
|
60
|
+
disableTsChecker: disableTsChecker || enableTsLoader,
|
|
60
61
|
enableCssModuleTSDeclaration,
|
|
61
62
|
enableInlineScripts,
|
|
62
63
|
enableInlineStyles,
|
|
63
64
|
polyfill,
|
|
64
|
-
// 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
|
|
65
|
-
cleanDistPath: false,
|
|
66
65
|
disableFilenameHash: disableAssetsCache,
|
|
67
66
|
enableLatestDecorators,
|
|
68
67
|
filename: {
|
|
69
68
|
css: cssModuleLocalIdentName
|
|
70
69
|
},
|
|
71
|
-
|
|
70
|
+
ssg,
|
|
71
|
+
// set `true`, only in legacy config
|
|
72
|
+
enableAssetFallback: true,
|
|
72
73
|
enableAssetManifest: true,
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
enableModernMode,
|
|
75
|
+
disableNodePolyfill
|
|
75
76
|
};
|
|
76
77
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createSourceConfig = createSourceConfig;
|
|
7
|
+
function createSourceConfig(config) {
|
|
8
|
+
const {
|
|
9
|
+
alias,
|
|
10
|
+
envVars,
|
|
11
|
+
globalVars,
|
|
12
|
+
include,
|
|
13
|
+
moduleScopes,
|
|
14
|
+
preEntry,
|
|
15
|
+
entries,
|
|
16
|
+
enableAsyncEntry,
|
|
17
|
+
disableDefaultEntries,
|
|
18
|
+
entriesDir,
|
|
19
|
+
configDir
|
|
20
|
+
} = config.source;
|
|
21
|
+
const builderGlobalVars = globalVars || {};
|
|
22
|
+
for (const envVar of envVars || []) {
|
|
23
|
+
const envVarValue = process.env[envVar];
|
|
24
|
+
envVarValue && (builderGlobalVars[`process.env.${envVar}`] = envVarValue);
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
alias,
|
|
28
|
+
moduleScopes,
|
|
29
|
+
globalVars: builderGlobalVars,
|
|
30
|
+
include,
|
|
31
|
+
preEntry,
|
|
32
|
+
entries,
|
|
33
|
+
enableAsyncEntry,
|
|
34
|
+
disableDefaultEntries,
|
|
35
|
+
entriesDir,
|
|
36
|
+
configDir
|
|
37
|
+
};
|
|
38
|
+
}
|