@modern-js/app-tools 2.0.0-beta.4 → 2.0.0-beta.7
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 +366 -0
- package/bin/modern.js +2 -0
- package/dist/js/modern/analyze/constants.js +10 -0
- package/dist/js/modern/analyze/generateCode.js +7 -9
- package/dist/js/modern/analyze/getBundleEntry.js +2 -1
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +9 -6
- package/dist/js/modern/analyze/getFileSystemEntry.js +11 -3
- package/dist/js/modern/analyze/index.js +7 -5
- package/dist/js/modern/analyze/nestedRoutes.js +29 -22
- package/dist/js/modern/analyze/templates.js +8 -1
- package/dist/js/modern/analyze/utils.js +21 -4
- package/dist/js/modern/builder/builderPlugins/compatModern.js +8 -2
- package/dist/js/modern/builder/index.js +9 -9
- package/dist/js/modern/commands/dev.js +6 -9
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/{start.js → serve.js} +3 -1
- package/dist/js/modern/config/default.js +38 -61
- package/dist/js/modern/config/initial/createOutputConfig.js +1 -3
- package/dist/js/modern/config/initial/createSourceConfig.js +5 -1
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +5 -1
- package/dist/js/modern/hooks.js +1 -0
- package/dist/js/modern/index.js +5 -5
- package/dist/js/modern/initialize/index.js +5 -4
- package/dist/js/modern/locale/en.js +1 -1
- package/dist/js/modern/locale/zh.js +1 -1
- package/dist/js/modern/schema/index.js +5 -7
- package/dist/js/modern/schema/legacy.js +1 -2
- package/dist/js/modern/utils/commands.js +6 -1
- package/dist/js/modern/utils/getServerInternalPlugins.js +58 -0
- package/dist/js/node/analyze/Builder.js +14 -8
- package/dist/js/node/analyze/constants.js +35 -3
- package/dist/js/node/analyze/generateCode.js +27 -24
- package/dist/js/node/analyze/getBundleEntry.js +9 -4
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +33 -28
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +24 -22
- package/dist/js/node/analyze/getClientRoutes/index.js +8 -3
- package/dist/js/node/analyze/getClientRoutes/utils.js +10 -3
- package/dist/js/node/analyze/getFileSystemEntry.js +18 -6
- package/dist/js/node/analyze/getHtmlTemplate.js +18 -14
- package/dist/js/node/analyze/getServerRoutes.js +36 -34
- package/dist/js/node/analyze/index.js +45 -59
- package/dist/js/node/analyze/isDefaultExportFunction.js +7 -3
- package/dist/js/node/analyze/makeLegalIdentifier.js +7 -3
- package/dist/js/node/analyze/nestedRoutes.js +58 -49
- package/dist/js/node/analyze/templates.js +45 -32
- package/dist/js/node/analyze/utils.js +41 -18
- package/dist/js/node/builder/builderPlugins/compatModern.js +32 -24
- package/dist/js/node/builder/index.js +38 -49
- package/dist/js/node/builder/loaders/routerLoader.js +5 -3
- package/dist/js/node/builder/loaders/serverModuleLoader.js +5 -3
- package/dist/js/node/builder/share.js +7 -3
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +7 -3
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +7 -3
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +9 -7
- package/dist/js/node/commands/build.js +30 -28
- package/dist/js/node/commands/deploy.js +9 -5
- package/dist/js/node/commands/dev.js +39 -40
- package/dist/js/node/commands/index.js +5 -5
- package/dist/js/node/commands/inspect.js +10 -6
- package/dist/js/node/commands/{start.js → serve.js} +16 -10
- package/dist/js/node/config/default.js +44 -64
- package/dist/js/node/config/index.js +10 -3
- package/dist/js/node/config/initial/createHtmlConfig.js +7 -3
- package/dist/js/node/config/initial/createOutputConfig.js +8 -6
- package/dist/js/node/config/initial/createSourceConfig.js +12 -4
- package/dist/js/node/config/initial/createToolsConfig.js +7 -3
- package/dist/js/node/config/initial/index.js +9 -3
- package/dist/js/node/config/initial/inits.js +26 -22
- package/dist/js/node/config/initial/transformNormalizedConfig.js +12 -4
- package/dist/js/node/defineConfig.js +25 -22
- package/dist/js/node/exports/server.js +7 -3
- package/dist/js/node/hooks.js +8 -3
- package/dist/js/node/index.js +56 -69
- package/dist/js/node/initialize/index.js +33 -32
- package/dist/js/node/locale/en.js +8 -4
- package/dist/js/node/locale/index.js +8 -3
- package/dist/js/node/locale/zh.js +8 -4
- package/dist/js/node/schema/Schema.js +7 -3
- package/dist/js/node/schema/index.js +13 -10
- package/dist/js/node/schema/legacy.js +6 -5
- package/dist/js/node/types/config/deploy.js +15 -0
- package/dist/js/node/types/config/dev.js +15 -0
- package/dist/js/node/types/config/experiments.js +15 -0
- package/dist/js/node/types/config/html.js +15 -0
- package/dist/js/node/types/config/index.js +3 -3
- package/dist/js/node/types/config/output.js +15 -0
- package/dist/js/node/types/config/performance.js +15 -0
- package/dist/js/node/types/config/security.js +15 -0
- package/dist/js/node/types/config/source.js +15 -0
- package/dist/js/node/types/config/tools.js +15 -0
- package/dist/js/node/types/hooks.js +15 -0
- package/dist/js/node/types/index.js +5 -5
- package/dist/js/node/types/legacyConfig/deploy.js +15 -0
- package/dist/js/node/types/legacyConfig/dev.js +15 -0
- package/dist/js/node/types/legacyConfig/index.js +15 -0
- package/dist/js/node/types/legacyConfig/output.js +15 -0
- package/dist/js/node/types/legacyConfig/source.js +15 -0
- package/dist/js/node/types/legacyConfig/tools.js +15 -0
- package/dist/js/node/utils/commands.js +14 -4
- package/dist/js/node/utils/config.js +35 -30
- package/dist/js/node/utils/createFileWatcher.js +15 -10
- package/dist/js/node/utils/createServer.js +35 -29
- package/dist/js/node/utils/getServerInternalPlugins.js +79 -0
- package/dist/js/node/utils/getSpecifiedEntries.js +10 -6
- package/dist/js/node/utils/language.js +7 -3
- package/dist/js/node/utils/printInstructions.js +10 -6
- package/dist/js/node/utils/restart.js +11 -7
- package/dist/js/node/utils/routes.js +11 -7
- package/dist/js/node/utils/types.js +15 -0
- package/dist/js/treeshaking/analyze/constants.js +10 -1
- package/dist/js/treeshaking/analyze/generateCode.js +7 -11
- package/dist/js/treeshaking/analyze/getBundleEntry.js +2 -1
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +9 -6
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +11 -3
- package/dist/js/treeshaking/analyze/index.js +7 -4
- package/dist/js/treeshaking/analyze/nestedRoutes.js +30 -23
- package/dist/js/treeshaking/analyze/templates.js +6 -1
- package/dist/js/treeshaking/analyze/utils.js +14 -4
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +6 -2
- package/dist/js/treeshaking/builder/index.js +4 -9
- package/dist/js/treeshaking/commands/dev.js +19 -24
- package/dist/js/treeshaking/commands/index.js +1 -1
- package/dist/js/treeshaking/commands/{start.js → serve.js} +10 -3
- package/dist/js/treeshaking/config/default.js +53 -56
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +1 -3
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +5 -1
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +5 -1
- package/dist/js/treeshaking/hooks.js +1 -0
- package/dist/js/treeshaking/index.js +5 -5
- package/dist/js/treeshaking/initialize/index.js +6 -5
- package/dist/js/treeshaking/locale/en.js +1 -1
- package/dist/js/treeshaking/locale/zh.js +1 -1
- package/dist/js/treeshaking/schema/index.js +10 -11
- package/dist/js/treeshaking/schema/legacy.js +0 -3
- package/dist/js/treeshaking/utils/commands.js +5 -1
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +210 -0
- package/dist/types/analyze/constants.d.ts +10 -1
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/{start.d.ts → serve.d.ts} +0 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/locale/en.d.ts +1 -1
- package/dist/types/locale/index.d.ts +2 -2
- package/dist/types/locale/zh.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +3 -0
- package/dist/types/types/config/source.d.ts +2 -1
- package/dist/types/types/hooks.d.ts +3 -0
- package/dist/types/types/legacyConfig/source.d.ts +0 -1
- package/dist/types/utils/commands.d.ts +2 -1
- package/dist/types/utils/getServerInternalPlugins.d.ts +2 -0
- package/package.json +25 -22
|
@@ -181,9 +181,10 @@ import { setServer, createServer, injectDataLoaderPlugin } from "../utils/create
|
|
|
181
181
|
import { generateRoutes } from "../utils/routes";
|
|
182
182
|
import { getSpecifiedEntries } from "../utils/getSpecifiedEntries";
|
|
183
183
|
import { buildServerConfig } from "../utils/config";
|
|
184
|
+
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
184
185
|
var dev = function() {
|
|
185
186
|
var _ref = _asyncToGenerator(function(api, options) {
|
|
186
|
-
var ref, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, entrypoints, serverConfigFile,
|
|
187
|
+
var ref, normalizedConfig, appContext, hookRunners, appDirectory, distDirectory, port, apiOnly, entrypoints, serverConfigFile, checkedEntries, serverInternalPlugins, serverOptions, app, server;
|
|
187
188
|
return __generator(this, function(_state) {
|
|
188
189
|
switch(_state.label){
|
|
189
190
|
case 0:
|
|
@@ -197,7 +198,7 @@ var dev = function() {
|
|
|
197
198
|
cliOptions: options
|
|
198
199
|
});
|
|
199
200
|
ResolvedConfigContext.set(normalizedConfig);
|
|
200
|
-
appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, port = appContext.port, apiOnly = appContext.apiOnly, entrypoints = appContext.entrypoints, serverConfigFile = appContext.serverConfigFile
|
|
201
|
+
appDirectory = appContext.appDirectory, distDirectory = appContext.distDirectory, port = appContext.port, apiOnly = appContext.apiOnly, entrypoints = appContext.entrypoints, serverConfigFile = appContext.serverConfigFile;
|
|
201
202
|
return [
|
|
202
203
|
4,
|
|
203
204
|
getSpecifiedEntries(options.entry || false, entrypoints)
|
|
@@ -232,30 +233,23 @@ var dev = function() {
|
|
|
232
233
|
if (!appContext.builder && !apiOnly) {
|
|
233
234
|
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
234
235
|
}
|
|
235
|
-
if (!!apiOnly) return [
|
|
236
|
-
3,
|
|
237
|
-
5
|
|
238
|
-
];
|
|
239
236
|
return [
|
|
240
237
|
4,
|
|
241
|
-
appContext
|
|
238
|
+
generateRoutes(appContext)
|
|
242
239
|
];
|
|
243
240
|
case 4:
|
|
244
|
-
|
|
245
|
-
_state.label = 5;
|
|
246
|
-
case 5:
|
|
241
|
+
_state.sent();
|
|
247
242
|
return [
|
|
248
243
|
4,
|
|
249
|
-
|
|
244
|
+
getServerInternalPlugins(api)
|
|
250
245
|
];
|
|
251
|
-
case
|
|
252
|
-
_state.sent();
|
|
246
|
+
case 5:
|
|
247
|
+
serverInternalPlugins = _state.sent();
|
|
253
248
|
serverOptions = {
|
|
254
249
|
dev: _objectSpread({
|
|
255
250
|
port: port,
|
|
256
251
|
https: normalizedConfig.dev.https
|
|
257
252
|
}, (ref = normalizedConfig.tools) === null || ref === void 0 ? void 0 : ref.devServer),
|
|
258
|
-
compiler: compiler || null,
|
|
259
253
|
pwd: appDirectory,
|
|
260
254
|
config: normalizedConfig,
|
|
261
255
|
serverConfigFile: serverConfigFile,
|
|
@@ -263,13 +257,15 @@ var dev = function() {
|
|
|
263
257
|
};
|
|
264
258
|
if (!apiOnly) return [
|
|
265
259
|
3,
|
|
266
|
-
|
|
260
|
+
7
|
|
267
261
|
];
|
|
268
262
|
return [
|
|
269
263
|
4,
|
|
270
|
-
createServer(serverOptions)
|
|
264
|
+
createServer(_objectSpreadProps(_objectSpread({}, serverOptions), {
|
|
265
|
+
compiler: null
|
|
266
|
+
}))
|
|
271
267
|
];
|
|
272
|
-
case
|
|
268
|
+
case 6:
|
|
273
269
|
app = _state.sent();
|
|
274
270
|
app.listen(port, function() {
|
|
275
271
|
var _ref = _asyncToGenerator(function(err) {
|
|
@@ -289,27 +285,26 @@ var dev = function() {
|
|
|
289
285
|
}());
|
|
290
286
|
return [
|
|
291
287
|
3,
|
|
292
|
-
|
|
288
|
+
9
|
|
293
289
|
];
|
|
294
|
-
case
|
|
290
|
+
case 7:
|
|
295
291
|
return [
|
|
296
292
|
4,
|
|
297
293
|
appContext.builder.startDevServer({
|
|
298
|
-
compiler: compiler,
|
|
299
294
|
printURLs: false,
|
|
300
295
|
serverOptions: serverOptions
|
|
301
296
|
})
|
|
302
297
|
];
|
|
303
|
-
case
|
|
298
|
+
case 8:
|
|
304
299
|
server = _state.sent().server;
|
|
305
300
|
setServer(server);
|
|
306
|
-
_state.label =
|
|
307
|
-
case
|
|
301
|
+
_state.label = 9;
|
|
302
|
+
case 9:
|
|
308
303
|
return [
|
|
309
304
|
4,
|
|
310
305
|
createFileWatcher(appContext, normalizedConfig.source.configDir, hookRunners)
|
|
311
306
|
];
|
|
312
|
-
case
|
|
307
|
+
case 10:
|
|
313
308
|
_state.sent();
|
|
314
309
|
return [
|
|
315
310
|
2
|
|
@@ -126,9 +126,10 @@ import { logger, chalk, isApiOnly } from "@modern-js/utils";
|
|
|
126
126
|
import server from "@modern-js/prod-server";
|
|
127
127
|
import { printInstructions } from "../utils/printInstructions";
|
|
128
128
|
import { injectDataLoaderPlugin } from "../utils/createServer";
|
|
129
|
+
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
129
130
|
var start = function() {
|
|
130
131
|
var _ref = _asyncToGenerator(function(api) {
|
|
131
|
-
var ref, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, app;
|
|
132
|
+
var ref, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, serverInternalPlugins, app;
|
|
132
133
|
return __generator(this, function(_state) {
|
|
133
134
|
switch(_state.label){
|
|
134
135
|
case 0:
|
|
@@ -143,17 +144,23 @@ var start = function() {
|
|
|
143
144
|
];
|
|
144
145
|
case 1:
|
|
145
146
|
apiOnly = _state.sent();
|
|
147
|
+
return [
|
|
148
|
+
4,
|
|
149
|
+
getServerInternalPlugins(api)
|
|
150
|
+
];
|
|
151
|
+
case 2:
|
|
152
|
+
serverInternalPlugins = _state.sent();
|
|
146
153
|
return [
|
|
147
154
|
4,
|
|
148
155
|
server({
|
|
149
156
|
pwd: appDirectory,
|
|
150
157
|
config: userConfig,
|
|
151
158
|
serverConfigFile: serverConfigFile,
|
|
152
|
-
internalPlugins: injectDataLoaderPlugin(
|
|
159
|
+
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
|
|
153
160
|
apiOnly: apiOnly
|
|
154
161
|
})
|
|
155
162
|
];
|
|
156
|
-
case
|
|
163
|
+
case 3:
|
|
157
164
|
app = _state.sent();
|
|
158
165
|
app.listen(port, function() {
|
|
159
166
|
var _ref = _asyncToGenerator(function(err) {
|
|
@@ -11,45 +11,64 @@ function _defineProperty(obj, key, value) {
|
|
|
11
11
|
}
|
|
12
12
|
return obj;
|
|
13
13
|
}
|
|
14
|
+
function _objectSpread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
ownKeys.forEach(function(key) {
|
|
24
|
+
_defineProperty(target, key, source[key]);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
}
|
|
29
|
+
function ownKeys(object, enumerableOnly) {
|
|
30
|
+
var keys = Object.keys(object);
|
|
31
|
+
if (Object.getOwnPropertySymbols) {
|
|
32
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
33
|
+
if (enumerableOnly) {
|
|
34
|
+
symbols = symbols.filter(function(sym) {
|
|
35
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
keys.push.apply(keys, symbols);
|
|
39
|
+
}
|
|
40
|
+
return keys;
|
|
41
|
+
}
|
|
42
|
+
function _objectSpreadProps(target, source) {
|
|
43
|
+
source = source != null ? source : {};
|
|
44
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
45
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
46
|
+
} else {
|
|
47
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
48
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return target;
|
|
52
|
+
}
|
|
53
|
+
import { createDefaultConfig as createDefaultBuilderConfig } from "@modern-js/builder-webpack-provider";
|
|
14
54
|
function createDefaultConfig(appContext) {
|
|
55
|
+
var defaultBuilderConfig = createDefaultBuilderConfig();
|
|
56
|
+
var dev = _objectSpread({}, defaultBuilderConfig.dev);
|
|
57
|
+
var tools = _objectSpread({}, defaultBuilderConfig.tools);
|
|
58
|
+
var output = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.output), {
|
|
59
|
+
disableNodePolyfill: true
|
|
60
|
+
});
|
|
15
61
|
var _obj;
|
|
16
|
-
var
|
|
17
|
-
var source = {
|
|
62
|
+
var source = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.source), {
|
|
18
63
|
entries: void 0,
|
|
19
64
|
enableAsyncEntry: false,
|
|
20
65
|
disableDefaultEntries: false,
|
|
21
66
|
entriesDir: "./src",
|
|
22
67
|
configDir: "./config",
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
alias: defaultAlias
|
|
27
|
-
};
|
|
28
|
-
var output = {
|
|
29
|
-
assetPrefix: "/",
|
|
30
|
-
distPath: {
|
|
31
|
-
html: "html",
|
|
32
|
-
js: "static/js",
|
|
33
|
-
css: "static/css",
|
|
34
|
-
media: "static/media",
|
|
35
|
-
root: "dist"
|
|
36
|
-
},
|
|
37
|
-
copy: void 0,
|
|
38
|
-
disableCssModuleExtension: false,
|
|
39
|
-
enableCssModuleTSDeclaration: false,
|
|
40
|
-
disableMinimize: false,
|
|
41
|
-
enableInlineStyles: false,
|
|
42
|
-
enableInlineScripts: false,
|
|
43
|
-
disableSourceMap: false,
|
|
44
|
-
disableInlineRuntimeChunk: false,
|
|
45
|
-
disableFilenameHash: false,
|
|
46
|
-
enableLatestDecorators: false,
|
|
47
|
-
polyfill: "entry",
|
|
48
|
-
cssModuleLocalIdentName: void 0
|
|
49
|
-
};
|
|
50
|
-
var html = {
|
|
68
|
+
alias: (_obj = {}, _defineProperty(_obj, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_obj, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_obj, "@", appContext.srcDirectory), _defineProperty(_obj, "@shared", appContext.sharedDirectory), _obj)
|
|
69
|
+
});
|
|
70
|
+
var html = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.html), {
|
|
51
71
|
title: "",
|
|
52
|
-
titleByEntries: void 0,
|
|
53
72
|
meta: {
|
|
54
73
|
charset: {
|
|
55
74
|
charset: "utf-8"
|
|
@@ -64,17 +83,8 @@ function createDefaultConfig(appContext) {
|
|
|
64
83
|
imagemode: "force",
|
|
65
84
|
"wap-font-scale": "no",
|
|
66
85
|
"format-detection": "telephone=no"
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
inject: "head",
|
|
70
|
-
injectByEntries: void 0,
|
|
71
|
-
mountId: "root",
|
|
72
|
-
favicon: "",
|
|
73
|
-
faviconByEntries: void 0,
|
|
74
|
-
disableHtmlFolder: false,
|
|
75
|
-
templateParameters: {},
|
|
76
|
-
templateParametersByEntries: void 0
|
|
77
|
-
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
78
88
|
var server = {
|
|
79
89
|
routes: void 0,
|
|
80
90
|
publicRoutes: void 0,
|
|
@@ -83,20 +93,6 @@ function createDefaultConfig(appContext) {
|
|
|
83
93
|
baseUrl: "/",
|
|
84
94
|
port: 8080
|
|
85
95
|
};
|
|
86
|
-
var dev = {
|
|
87
|
-
assetPrefix: false,
|
|
88
|
-
https: false
|
|
89
|
-
};
|
|
90
|
-
var tools = {
|
|
91
|
-
webpack: void 0,
|
|
92
|
-
babel: void 0,
|
|
93
|
-
postcss: void 0,
|
|
94
|
-
autoprefixer: void 0,
|
|
95
|
-
devServer: void 0,
|
|
96
|
-
tsLoader: void 0,
|
|
97
|
-
terser: void 0,
|
|
98
|
-
minifyCss: void 0
|
|
99
|
-
};
|
|
100
96
|
return {
|
|
101
97
|
source: source,
|
|
102
98
|
output: output,
|
|
@@ -105,6 +101,7 @@ function createDefaultConfig(appContext) {
|
|
|
105
101
|
html: html,
|
|
106
102
|
tools: tools,
|
|
107
103
|
plugins: [],
|
|
104
|
+
builderPlugins: [],
|
|
108
105
|
runtime: {},
|
|
109
106
|
runtimeByEntries: {}
|
|
110
107
|
};
|
|
@@ -19,6 +19,7 @@ function createOutputConfig(config) {
|
|
|
19
19
|
font: dataUriLimit,
|
|
20
20
|
media: dataUriLimit
|
|
21
21
|
},
|
|
22
|
+
cssModuleLocalIdentName: cssModuleLocalIdentName,
|
|
22
23
|
disableCssExtract: disableCssExtract,
|
|
23
24
|
disableCssModuleExtension: disableCssModuleExtension,
|
|
24
25
|
disableInlineRuntimeChunk: disableInlineRuntimeChunk,
|
|
@@ -31,9 +32,6 @@ function createOutputConfig(config) {
|
|
|
31
32
|
polyfill: polyfill,
|
|
32
33
|
disableFilenameHash: disableAssetsCache,
|
|
33
34
|
enableLatestDecorators: enableLatestDecorators,
|
|
34
|
-
filename: {
|
|
35
|
-
css: cssModuleLocalIdentName
|
|
36
|
-
},
|
|
37
35
|
ssg: ssg,
|
|
38
36
|
enableAssetFallback: true,
|
|
39
37
|
enableAssetManifest: true,
|
|
@@ -32,7 +32,11 @@ function createSourceConfig(config) {
|
|
|
32
32
|
enableAsyncEntry: enableAsyncEntry,
|
|
33
33
|
disableDefaultEntries: disableDefaultEntries,
|
|
34
34
|
entriesDir: entriesDir,
|
|
35
|
-
configDir: configDir
|
|
35
|
+
configDir: configDir,
|
|
36
|
+
resolveExtensionPrefix: {
|
|
37
|
+
web: ".web",
|
|
38
|
+
node: ".node"
|
|
39
|
+
}
|
|
36
40
|
};
|
|
37
41
|
}
|
|
38
42
|
export { createSourceConfig };
|
|
@@ -21,11 +21,15 @@ function transformNormalizedConfig(config) {
|
|
|
21
21
|
server: server,
|
|
22
22
|
cliOptions: cliOptions,
|
|
23
23
|
testing: testing,
|
|
24
|
+
builderPlugins: [],
|
|
24
25
|
plugins: plugins,
|
|
25
26
|
security: {},
|
|
26
27
|
_raw: {},
|
|
27
28
|
experiments: {},
|
|
28
|
-
|
|
29
|
+
autoLoadPlugins: true,
|
|
30
|
+
performance: {
|
|
31
|
+
removeMomentLocale: true
|
|
32
|
+
}
|
|
29
33
|
};
|
|
30
34
|
}
|
|
31
35
|
export { transformNormalizedConfig };
|
|
@@ -10,6 +10,7 @@ var hooks = {
|
|
|
10
10
|
htmlPartials: createAsyncWaterfall(),
|
|
11
11
|
beforeGenerateRoutes: createAsyncWaterfall(),
|
|
12
12
|
addDefineTypes: createAsyncWaterfall(),
|
|
13
|
+
collectServerPlugins: createAsyncWaterfall(),
|
|
13
14
|
beforeDev: createAsyncWorkflow(),
|
|
14
15
|
afterDev: createAsyncWorkflow(),
|
|
15
16
|
beforeCreateCompiler: createAsyncWorkflow(),
|
|
@@ -201,7 +201,7 @@ var devCommand = function() {
|
|
|
201
201
|
];
|
|
202
202
|
case 1:
|
|
203
203
|
devToolMetas = _state.sent();
|
|
204
|
-
devProgram = program.command("dev").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).action(function() {
|
|
204
|
+
devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).action(function() {
|
|
205
205
|
var _ref = _asyncToGenerator(function(options) {
|
|
206
206
|
var dev;
|
|
207
207
|
return __generator(this, function(_state) {
|
|
@@ -449,7 +449,7 @@ var src_default = function() {
|
|
|
449
449
|
"@modern-js/plugin-document",
|
|
450
450
|
"@modern-js/plugin-state",
|
|
451
451
|
"@modern-js/plugin-router",
|
|
452
|
-
"@modern-js/plugin-router-
|
|
452
|
+
"@modern-js/plugin-router-v5",
|
|
453
453
|
"@modern-js/plugin-polyfill"
|
|
454
454
|
],
|
|
455
455
|
registerHook: hooks,
|
|
@@ -482,14 +482,14 @@ var src_default = function() {
|
|
|
482
482
|
];
|
|
483
483
|
case 2:
|
|
484
484
|
_state.sent();
|
|
485
|
-
program.command("
|
|
485
|
+
program.command("serve").usage("[options]").description(i18n.t(localeKeys.command.serve.describe)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(/*#__PURE__*/ _asyncToGenerator(function() {
|
|
486
486
|
var start;
|
|
487
487
|
return __generator(this, function(_state) {
|
|
488
488
|
switch(_state.label){
|
|
489
489
|
case 0:
|
|
490
490
|
return [
|
|
491
491
|
4,
|
|
492
|
-
import("./commands/
|
|
492
|
+
import("./commands/serve")
|
|
493
493
|
];
|
|
494
494
|
case 1:
|
|
495
495
|
start = _state.sent().start;
|
|
@@ -614,7 +614,7 @@ var src_default = function() {
|
|
|
614
614
|
switch(_state.label){
|
|
615
615
|
case 0:
|
|
616
616
|
command = getCommand();
|
|
617
|
-
if (!(command === "dev" || command === "build")) return [
|
|
617
|
+
if (!(command === "dev" || command === "start" || command === "build")) return [
|
|
618
618
|
3,
|
|
619
619
|
2
|
|
620
620
|
];
|
|
@@ -176,7 +176,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
176
176
|
};
|
|
177
177
|
import { ensureAbsolutePath, getPort, isDev } from "@modern-js/utils";
|
|
178
178
|
import { legacySchema, schema } from "../schema";
|
|
179
|
-
import {
|
|
179
|
+
import { isDevCommand } from "../utils/commands";
|
|
180
180
|
import { transformNormalizedConfig } from "../config/initial/transformNormalizedConfig";
|
|
181
181
|
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig } from "../config";
|
|
182
182
|
var initialize_default = function() {
|
|
@@ -234,11 +234,13 @@ var initialize_default = function() {
|
|
|
234
234
|
tools: normalizedConfig.tools || {},
|
|
235
235
|
testing: normalizedConfig.testing || {},
|
|
236
236
|
plugins: normalizedConfig.plugins || [],
|
|
237
|
+
builderPlugins: normalizedConfig.builderPlugins || [],
|
|
237
238
|
runtime: normalizedConfig.runtime || {},
|
|
238
239
|
runtimeByEntries: normalizedConfig.runtimeByEntries || {},
|
|
239
240
|
deploy: normalizedConfig.deploy || {},
|
|
240
241
|
performance: normalizedConfig.performance || {},
|
|
241
|
-
experiments: normalizedConfig.experiments || {}
|
|
242
|
+
experiments: normalizedConfig.experiments || {},
|
|
243
|
+
autoLoadPlugins: normalizedConfig.autoLoadPlugins || false
|
|
242
244
|
}
|
|
243
245
|
}
|
|
244
246
|
];
|
|
@@ -255,12 +257,11 @@ function getDevServerPort(appContext, resolved) {
|
|
|
255
257
|
}
|
|
256
258
|
function _getDevServerPort() {
|
|
257
259
|
_getDevServerPort = _asyncToGenerator(function(appContext, resolved) {
|
|
258
|
-
var
|
|
260
|
+
var _port, _tmp;
|
|
259
261
|
return __generator(this, function(_state) {
|
|
260
262
|
switch(_state.label){
|
|
261
263
|
case 0:
|
|
262
|
-
|
|
263
|
-
if (!(isDev() && command === "dev")) return [
|
|
264
|
+
if (!(isDev() && isDevCommand())) return [
|
|
264
265
|
3,
|
|
265
266
|
4
|
|
266
267
|
];
|
|
@@ -34,8 +34,8 @@ var source = {
|
|
|
34
34
|
disableMount: {
|
|
35
35
|
type: "boolean"
|
|
36
36
|
},
|
|
37
|
-
|
|
38
|
-
type: "
|
|
37
|
+
customBootstrap: {
|
|
38
|
+
type: "string"
|
|
39
39
|
}
|
|
40
40
|
},
|
|
41
41
|
additionalProperties: false
|
|
@@ -57,6 +57,9 @@ var source = {
|
|
|
57
57
|
entriesDir: {
|
|
58
58
|
type: "string"
|
|
59
59
|
},
|
|
60
|
+
disableEntryDirs: {
|
|
61
|
+
type: "array"
|
|
62
|
+
},
|
|
60
63
|
configDir: {
|
|
61
64
|
type: "string"
|
|
62
65
|
},
|
|
@@ -87,14 +90,7 @@ var output = {
|
|
|
87
90
|
type: "boolean"
|
|
88
91
|
}
|
|
89
92
|
};
|
|
90
|
-
var dev = {
|
|
91
|
-
proxy: {
|
|
92
|
-
type: [
|
|
93
|
-
"boolean",
|
|
94
|
-
"object"
|
|
95
|
-
]
|
|
96
|
-
}
|
|
97
|
-
};
|
|
93
|
+
var dev = {};
|
|
98
94
|
var server = {
|
|
99
95
|
routes: {
|
|
100
96
|
type: "object"
|
|
@@ -176,7 +172,10 @@ var deploy = {
|
|
|
176
172
|
]
|
|
177
173
|
}
|
|
178
174
|
};
|
|
175
|
+
var builderPlugins = {
|
|
176
|
+
type: "array"
|
|
177
|
+
};
|
|
179
178
|
var schema = new Schema();
|
|
180
|
-
schema.setSchema("bff", bff).setSchema("dev", dev).setSchema("server", server).setSchema("source", source).setSchema("output", output).setSchema("tools", tools).setSchema("deploy", deploy);
|
|
179
|
+
schema.setSchema("bff", bff).setSchema("dev", dev).setSchema("server", server).setSchema("source", source).setSchema("output", output).setSchema("tools", tools).setSchema("deploy", deploy).set("builderPlugin", builderPlugins);
|
|
181
180
|
import { default as default2 } from "./legacy";
|
|
182
181
|
export { default2 as legacySchema, schema };
|