@modern-js/app-tools 2.0.0-beta.1 → 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 +194 -0
- package/dist/js/modern/analyze/generateCode.js +1 -1
- 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 +10 -6
- package/dist/js/modern/analyze/index.js +12 -27
- package/dist/js/modern/builder/builderPlugins/compatModern.js +12 -11
- package/dist/js/modern/builder/index.js +33 -16
- 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 +18 -9
- package/dist/js/modern/commands/inspect.js +4 -2
- package/dist/js/modern/commands/start.js +1 -0
- 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 +14 -16
- 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/generateCode.js +1 -1
- 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 +10 -6
- package/dist/js/node/analyze/index.js +13 -39
- package/dist/js/node/builder/builderPlugins/compatModern.js +12 -11
- package/dist/js/node/builder/index.js +34 -16
- 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 +18 -9
- package/dist/js/node/commands/inspect.js +4 -2
- package/dist/js/node/commands/start.js +1 -0
- 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 +14 -16
- 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 +90 -0
- package/dist/js/node/utils/restart.js +23 -0
- package/dist/js/treeshaking/analyze/generateCode.js +1 -1
- 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 +8 -7
- package/dist/js/treeshaking/analyze/index.js +10 -26
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +12 -11
- package/dist/js/treeshaking/builder/index.js +31 -16
- 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 +36 -22
- package/dist/js/treeshaking/commands/inspect.js +8 -3
- package/dist/js/treeshaking/commands/start.js +1 -0
- 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 +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/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 +1 -1
- package/dist/types/analyze/utils.d.ts +1 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -2
- package/dist/types/builder/index.d.ts +5 -2
- 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 +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 -2
- 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 +24 -24
- 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
|
@@ -123,7 +123,7 @@ const generateCode = async (appContext, config, entrypoints, api) => {
|
|
|
123
123
|
const islegacy = Boolean(config === null || config === void 0 ? void 0 : (_config$runtime = config.runtime) === null || _config$runtime === void 0 ? void 0 : (_config$runtime$route = _config$runtime.router) === null || _config$runtime$route === void 0 ? void 0 : _config$runtime$route.legacy);
|
|
124
124
|
const {
|
|
125
125
|
mountId
|
|
126
|
-
} = config.
|
|
126
|
+
} = config.html;
|
|
127
127
|
const getRoutes = islegacy ? _getClientRoutes.getClientRoutesLegacy : _getClientRoutes.getClientRoutes;
|
|
128
128
|
await Promise.all(entrypoints.map(generateEntryCode));
|
|
129
129
|
async function generateEntryCode(entrypoint) {
|
|
@@ -63,7 +63,7 @@ const getBundleEntry = (appContext, config) => {
|
|
|
63
63
|
}
|
|
64
64
|
if (!disableDefaultEntries) {
|
|
65
65
|
// find main entry point which server route is '/'.
|
|
66
|
-
const entriesDirAbs = (0, _utils.ensureAbsolutePath)(appDirectory, entriesDir);
|
|
66
|
+
const entriesDirAbs = (0, _utils.ensureAbsolutePath)(appDirectory, entriesDir || '');
|
|
67
67
|
const found = defaults.find(({
|
|
68
68
|
entryName,
|
|
69
69
|
entry,
|
|
@@ -74,7 +74,7 @@ const getFileSystemEntry = (appContext, config) => {
|
|
|
74
74
|
entriesDir
|
|
75
75
|
}
|
|
76
76
|
} = config;
|
|
77
|
-
const src = (0, _utils.ensureAbsolutePath)(appDirectory, entriesDir);
|
|
77
|
+
const src = (0, _utils.ensureAbsolutePath)(appDirectory, entriesDir || '');
|
|
78
78
|
if (_fs.default.existsSync(src)) {
|
|
79
79
|
if (_fs.default.statSync(src).isDirectory()) {
|
|
80
80
|
return scanDir(isBundleEntry(src) ? [src] : _fs.default.readdirSync(src).map(file => _path.default.join(src, file)).filter(file => _fs.default.statSync(file).isDirectory() && isBundleEntry(file)));
|
|
@@ -45,7 +45,7 @@ const getHtmlTemplate = async (entrypoints, api, {
|
|
|
45
45
|
configDir
|
|
46
46
|
}
|
|
47
47
|
} = config;
|
|
48
|
-
const htmlDir = _path.default.resolve(appDirectory, configDir, _constants.HTML_PARTIALS_FOLDER);
|
|
48
|
+
const htmlDir = _path.default.resolve(appDirectory, configDir || '', _constants.HTML_PARTIALS_FOLDER);
|
|
49
49
|
const htmlTemplates = {};
|
|
50
50
|
for (const entrypoint of entrypoints) {
|
|
51
51
|
const {
|
|
@@ -100,10 +100,13 @@ const applyRouteOptions = (original, routeOptions) => {
|
|
|
100
100
|
*/
|
|
101
101
|
const collectHtmlRoutes = (entrypoints, appContext, config) => {
|
|
102
102
|
const {
|
|
103
|
+
html: {
|
|
104
|
+
disableHtmlFolder
|
|
105
|
+
},
|
|
103
106
|
output: {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
distPath: {
|
|
108
|
+
html: htmlPath
|
|
109
|
+
} = {}
|
|
107
110
|
},
|
|
108
111
|
server: {
|
|
109
112
|
baseUrl,
|
|
@@ -130,7 +133,8 @@ const collectHtmlRoutes = (entrypoints, appContext, config) => {
|
|
|
130
133
|
isSPA: true,
|
|
131
134
|
isSSR,
|
|
132
135
|
responseHeaders: resHeaders,
|
|
133
|
-
|
|
136
|
+
// FIXME: remove the config.enableModernMode
|
|
137
|
+
// enableModernMode: Boolean(enableModernMode),
|
|
134
138
|
bundle: isSSR ? `${_utils.SERVER_BUNDLE_DIRECTORY}/${entryName}.js` : undefined
|
|
135
139
|
};
|
|
136
140
|
if (routes !== null && routes !== void 0 && routes.hasOwnProperty(entryName)) {
|
|
@@ -163,14 +167,14 @@ const collectStaticRoutes = (appContext, config) => {
|
|
|
163
167
|
publicRoutes = {}
|
|
164
168
|
}
|
|
165
169
|
} = config;
|
|
166
|
-
const publicFolder = _path.default.resolve(appDirectory, configDir, 'public');
|
|
170
|
+
const publicFolder = _path.default.resolve(appDirectory, configDir || '', 'public');
|
|
167
171
|
return _fs.default.existsSync(publicFolder) ? (0, _utils2.walkDirectory)(publicFolder).map(filePath => {
|
|
168
172
|
const urlPath = `${(0, _utils.urlJoin)(toPosix(filePath).slice(toPosix(publicFolder).length))}`;
|
|
169
173
|
return {
|
|
170
174
|
urlPath: publicRoutes[(0, _utils.removeLeadingSlash)(urlPath)] || urlPath,
|
|
171
175
|
isSPA: true,
|
|
172
176
|
isSSR: false,
|
|
173
|
-
entryPath: toPosix(_path.default.relative(_path.default.resolve(appDirectory, configDir), filePath))
|
|
177
|
+
entryPath: toPosix(_path.default.relative(_path.default.resolve(appDirectory, configDir || ''), filePath))
|
|
174
178
|
};
|
|
175
179
|
}) : [];
|
|
176
180
|
};
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var path = _interopRequireWildcard(require("path"));
|
|
8
|
-
var _plugin = require("@modern-js/plugin");
|
|
9
8
|
var _utils = require("@modern-js/utils");
|
|
10
9
|
var _lodash = require("@modern-js/utils/lodash");
|
|
11
10
|
var _builder = require("../builder");
|
|
@@ -13,6 +12,7 @@ var _printInstructions = require("../utils/printInstructions");
|
|
|
13
12
|
var _routes = require("../utils/routes");
|
|
14
13
|
var _config = require("../utils/config");
|
|
15
14
|
var _commands = require("../utils/commands");
|
|
15
|
+
var _config2 = require("../config");
|
|
16
16
|
var _utils2 = require("./utils");
|
|
17
17
|
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); }
|
|
18
18
|
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; }
|
|
@@ -20,43 +20,8 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
20
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
21
21
|
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; }
|
|
22
22
|
const debug = (0, _utils.createDebugger)('plugin-analyze');
|
|
23
|
-
const modifyEntryImports = (0, _plugin.createAsyncWaterfall)();
|
|
24
|
-
exports.modifyEntryImports = modifyEntryImports;
|
|
25
|
-
const modifyEntryExport = (0, _plugin.createAsyncWaterfall)();
|
|
26
|
-
exports.modifyEntryExport = modifyEntryExport;
|
|
27
|
-
const addRuntimeExports = (0, _plugin.createAsyncWaterfall)();
|
|
28
|
-
exports.addRuntimeExports = addRuntimeExports;
|
|
29
|
-
const modifyEntryRuntimePlugins = (0, _plugin.createAsyncWaterfall)();
|
|
30
|
-
exports.modifyEntryRuntimePlugins = modifyEntryRuntimePlugins;
|
|
31
|
-
const modifyEntryRenderFunction = (0, _plugin.createAsyncWaterfall)();
|
|
32
|
-
exports.modifyEntryRenderFunction = modifyEntryRenderFunction;
|
|
33
|
-
const modifyAsyncEntry = (0, _plugin.createAsyncWaterfall)();
|
|
34
|
-
exports.modifyAsyncEntry = modifyAsyncEntry;
|
|
35
|
-
const modifyFileSystemRoutes = (0, _plugin.createAsyncWaterfall)();
|
|
36
|
-
exports.modifyFileSystemRoutes = modifyFileSystemRoutes;
|
|
37
|
-
const modifyServerRoutes = (0, _plugin.createAsyncWaterfall)();
|
|
38
|
-
exports.modifyServerRoutes = modifyServerRoutes;
|
|
39
|
-
const htmlPartials = (0, _plugin.createAsyncWaterfall)();
|
|
40
|
-
exports.htmlPartials = htmlPartials;
|
|
41
|
-
const beforeGenerateRoutes = (0, _plugin.createAsyncWaterfall)();
|
|
42
|
-
exports.beforeGenerateRoutes = beforeGenerateRoutes;
|
|
43
|
-
const addDefineTypes = (0, _plugin.createAsyncWaterfall)();
|
|
44
|
-
exports.addDefineTypes = addDefineTypes;
|
|
45
23
|
var _default = () => ({
|
|
46
24
|
name: '@modern-js/plugin-analyze',
|
|
47
|
-
registerHook: {
|
|
48
|
-
modifyAsyncEntry,
|
|
49
|
-
modifyEntryImports,
|
|
50
|
-
modifyEntryExport,
|
|
51
|
-
modifyEntryRuntimePlugins,
|
|
52
|
-
modifyEntryRenderFunction,
|
|
53
|
-
modifyFileSystemRoutes,
|
|
54
|
-
modifyServerRoutes,
|
|
55
|
-
htmlPartials,
|
|
56
|
-
addRuntimeExports,
|
|
57
|
-
beforeGenerateRoutes,
|
|
58
|
-
addDefineTypes
|
|
59
|
-
},
|
|
60
25
|
setup: api => {
|
|
61
26
|
let pagesDir = [];
|
|
62
27
|
let originEntrypoints = [];
|
|
@@ -71,7 +36,7 @@ var _default = () => ({
|
|
|
71
36
|
} catch (_unused) {
|
|
72
37
|
// FIXME:
|
|
73
38
|
}
|
|
74
|
-
const apiOnly = await (0, _utils.isApiOnly)(appContext.appDirectory,
|
|
39
|
+
const apiOnly = await (0, _utils.isApiOnly)(appContext.appDirectory, (_resolvedConfig$sourc = resolvedConfig.source) === null || _resolvedConfig$sourc === void 0 ? void 0 : _resolvedConfig$sourc.entriesDir);
|
|
75
40
|
await hookRunners.addRuntimeExports();
|
|
76
41
|
if (apiOnly) {
|
|
77
42
|
const {
|
|
@@ -138,7 +103,7 @@ var _default = () => ({
|
|
|
138
103
|
if (buildCommands.includes(command)) {
|
|
139
104
|
const normalizedConfig = api.useResolvedConfigContext();
|
|
140
105
|
const builder = await (0, _builder.createBuilderForEdenX)({
|
|
141
|
-
normalizedConfig,
|
|
106
|
+
normalizedConfig: normalizedConfig,
|
|
142
107
|
appContext,
|
|
143
108
|
compatPluginConfig: {
|
|
144
109
|
async onBeforeBuild({
|
|
@@ -199,6 +164,15 @@ var _default = () => ({
|
|
|
199
164
|
watchFiles() {
|
|
200
165
|
return pagesDir;
|
|
201
166
|
},
|
|
167
|
+
resolvedConfig({
|
|
168
|
+
resolved
|
|
169
|
+
}) {
|
|
170
|
+
const appContext = api.useAppContext();
|
|
171
|
+
const config = (0, _config2.initialNormalizedConfig)(resolved, appContext);
|
|
172
|
+
return {
|
|
173
|
+
resolved: config
|
|
174
|
+
};
|
|
175
|
+
},
|
|
202
176
|
async fileChange(e) {
|
|
203
177
|
const appContext = api.useAppContext();
|
|
204
178
|
const {
|
|
@@ -69,14 +69,15 @@ const PluginCompatModern = (appContext, modernConfig, options) => ({
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// apply copy plugin
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
if (chain.plugins.has(CHAIN_ID.PLUGIN.COPY)) {
|
|
73
|
+
const defaultCopyPattern = (0, _share.createCopyPattern)(appContext, modernConfig, 'public', chain);
|
|
74
|
+
chain.plugin(CHAIN_ID.PLUGIN.COPY).tap(args => {
|
|
75
|
+
var _args$;
|
|
76
|
+
return [{
|
|
77
|
+
patterns: [...(((_args$ = args[0]) === null || _args$ === void 0 ? void 0 : _args$.patterns) || []), defaultCopyPattern]
|
|
78
|
+
}];
|
|
79
|
+
});
|
|
80
|
+
}
|
|
80
81
|
const {
|
|
81
82
|
entrypoints
|
|
82
83
|
} = appContext;
|
|
@@ -175,9 +176,9 @@ function applyBottomHtmlWebpackPlugin({
|
|
|
175
176
|
// FIXME: the only need necessary
|
|
176
177
|
const baseTemplateParams = _objectSpread({
|
|
177
178
|
entryName,
|
|
178
|
-
title: (0, _utils.getEntryOptions)(entryName, modernConfig.
|
|
179
|
-
mountId: modernConfig.
|
|
180
|
-
}, (0, _utils.getEntryOptions)(entryName, modernConfig.
|
|
179
|
+
title: (0, _utils.getEntryOptions)(entryName, modernConfig.html.title, modernConfig.html.titleByEntries, appContext.packageName),
|
|
180
|
+
mountId: modernConfig.html.mountId
|
|
181
|
+
}, (0, _utils.getEntryOptions)(entryName, modernConfig.html.templateParameters, modernConfig.html.templateParametersByEntries, appContext.packageName));
|
|
181
182
|
chain.plugin(`${CHAIN_ID.PLUGIN.HTML}-${entryName}`).tap(args => [_objectSpread(_objectSpread({}, args[0] || {}), {}, {
|
|
182
183
|
__internal__: true,
|
|
183
184
|
bottomTemplate: appContext.htmlTemplates[`__${entryName}-bottom__`] && (0, _lodash.template)(appContext.htmlTemplates[`__${entryName}-bottom__`])(baseTemplateParams)
|
|
@@ -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,41 @@ async function createBuilderForEdenX({
|
|
|
42
43
|
return builder;
|
|
43
44
|
}
|
|
44
45
|
function createBuilderProviderConfig(normalizedConfig, appContext) {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
source,
|
|
51
|
-
html,
|
|
46
|
+
const output = createOutputConfig(normalizedConfig, appContext);
|
|
47
|
+
return _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
48
|
+
source: _objectSpread(_objectSpread({}, normalizedConfig.source), {}, {
|
|
49
|
+
resolveExtensionPrefix: '.web'
|
|
50
|
+
}),
|
|
52
51
|
output,
|
|
53
|
-
tools,
|
|
54
52
|
dev: {
|
|
55
53
|
https: normalizedConfig.dev.https,
|
|
56
54
|
assetPrefix: normalizedConfig.dev.assetPrefix
|
|
57
55
|
},
|
|
58
|
-
|
|
56
|
+
html: _objectSpread(_objectSpread({}, normalizedConfig.html), {}, {
|
|
57
|
+
templateByEntries: normalizedConfig.html.templateByEntries || appContext.htmlTemplates
|
|
58
|
+
}),
|
|
59
|
+
performance: _objectSpread(_objectSpread({}, normalizedConfig.performance), {}, {
|
|
59
60
|
// `@modern-js/webpack` used to remove moment locale by default
|
|
60
61
|
removeMomentLocale: true
|
|
61
|
-
}
|
|
62
|
-
};
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
function createOutputConfig(config, appContext) {
|
|
65
|
+
const defaultCopyPattern = (0, _share.createCopyPattern)(appContext, config, 'upload');
|
|
66
|
+
const {
|
|
67
|
+
copy
|
|
68
|
+
} = config.output;
|
|
69
|
+
const copyOptions = Array.isArray(copy) ? copy : copy === null || copy === void 0 ? void 0 : copy.patterns;
|
|
70
|
+
const builderCopy = [...(copyOptions || []), defaultCopyPattern];
|
|
71
|
+
return _objectSpread(_objectSpread({}, config.output), {}, {
|
|
72
|
+
copy: builderCopy,
|
|
73
|
+
// 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
|
|
74
|
+
cleanDistPath: false,
|
|
75
|
+
// `@modern-js/webpack` used to generate asset manifest by default
|
|
76
|
+
enableAssetManifest: true,
|
|
77
|
+
// compatible the modern-js with fallback behavior
|
|
78
|
+
enableAssetFallback: true
|
|
79
|
+
});
|
|
80
|
+
}
|
|
63
81
|
}
|
|
64
82
|
function createBuilderOptions(target, appContext) {
|
|
65
83
|
// create entries
|
|
@@ -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
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.dev = void 0;
|
|
7
7
|
var _utils = require("@modern-js/utils");
|
|
8
8
|
var _core = require("@modern-js/core");
|
|
9
|
+
var _createFileWatcher = require("../utils/createFileWatcher");
|
|
9
10
|
var _printInstructions = require("../utils/printInstructions");
|
|
10
11
|
var _createServer = require("../utils/createServer");
|
|
11
12
|
var _routes = require("../utils/routes");
|
|
@@ -15,13 +16,18 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
15
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; }
|
|
16
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; }
|
|
17
18
|
const dev = async (api, options) => {
|
|
18
|
-
|
|
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();
|
|
19
25
|
const appContext = api.useAppContext();
|
|
20
26
|
const hookRunners = api.useHookRunners();
|
|
21
|
-
|
|
27
|
+
normalizedConfig = _objectSpread(_objectSpread({}, normalizedConfig), {}, {
|
|
22
28
|
cliOptions: options
|
|
23
29
|
});
|
|
24
|
-
_core.ResolvedConfigContext.set(
|
|
30
|
+
_core.ResolvedConfigContext.set(normalizedConfig);
|
|
25
31
|
const {
|
|
26
32
|
appDirectory,
|
|
27
33
|
distDirectory,
|
|
@@ -49,8 +55,10 @@ const dev = async (api, options) => {
|
|
|
49
55
|
await hookRunners.beforeDev();
|
|
50
56
|
let compiler = null;
|
|
51
57
|
if (!apiOnly) {
|
|
52
|
-
|
|
53
|
-
|
|
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();
|
|
54
62
|
}
|
|
55
63
|
await (0, _routes.generateRoutes)(appContext);
|
|
56
64
|
const app = await (0, _createServer.createServer)({
|
|
@@ -64,11 +72,11 @@ const dev = async (api, options) => {
|
|
|
64
72
|
hot: true,
|
|
65
73
|
liveReload: true,
|
|
66
74
|
port,
|
|
67
|
-
https:
|
|
68
|
-
}),
|
|
75
|
+
https: normalizedConfig.dev.https
|
|
76
|
+
}), (_normalizedConfig$too = normalizedConfig.tools) === null || _normalizedConfig$too === void 0 ? void 0 : _normalizedConfig$too.devServer),
|
|
69
77
|
compiler,
|
|
70
78
|
pwd: appDirectory,
|
|
71
|
-
config:
|
|
79
|
+
config: normalizedConfig,
|
|
72
80
|
serverConfigFile,
|
|
73
81
|
internalPlugins: (0, _createServer.injectDataLoaderPlugin)(serverInternalPlugins)
|
|
74
82
|
});
|
|
@@ -79,8 +87,9 @@ const dev = async (api, options) => {
|
|
|
79
87
|
if (!apiOnly) {
|
|
80
88
|
_utils.logger.info(`Starting dev server...\n`);
|
|
81
89
|
} else {
|
|
82
|
-
(0, _printInstructions.printInstructions)(hookRunners, appContext,
|
|
90
|
+
(0, _printInstructions.printInstructions)(hookRunners, appContext, normalizedConfig);
|
|
83
91
|
}
|
|
84
92
|
});
|
|
93
|
+
await (0, _createFileWatcher.createFileWatcher)(appContext, normalizedConfig.source.configDir, hookRunners);
|
|
85
94
|
};
|
|
86
95
|
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),
|
|
@@ -23,6 +23,7 @@ const start = async api => {
|
|
|
23
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);
|
|
24
24
|
const app = await (0, _prodServer.default)({
|
|
25
25
|
pwd: appDirectory,
|
|
26
|
+
// FIXME: remove the `any` type
|
|
26
27
|
config: userConfig,
|
|
27
28
|
serverConfigFile,
|
|
28
29
|
internalPlugins: (0, _createServer.injectDataLoaderPlugin)(appContext.serverInternalPlugins),
|
|
@@ -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
|
+
}
|