@modern-js/app-tools 2.0.0-beta.3 → 2.0.0-beta.6
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 +619 -0
- package/bin/modern.js +3 -0
- package/dist/js/modern/analyze/Builder.js +39 -0
- package/dist/js/modern/analyze/constants.js +48 -18
- package/dist/js/modern/analyze/generateCode.js +264 -225
- package/dist/js/modern/analyze/getBundleEntry.js +34 -32
- package/dist/js/modern/analyze/getClientRoutes/getRoutes.js +99 -52
- package/dist/js/modern/analyze/getClientRoutes/getRoutesLegacy.js +89 -47
- package/dist/js/modern/analyze/getClientRoutes/index.js +6 -2
- package/dist/js/modern/analyze/getClientRoutes/utils.js +23 -10
- package/dist/js/modern/analyze/getFileSystemEntry.js +52 -23
- package/dist/js/modern/analyze/getHtmlTemplate.js +89 -49
- package/dist/js/modern/analyze/getServerRoutes.js +122 -126
- package/dist/js/modern/analyze/index.js +204 -161
- package/dist/js/modern/analyze/isDefaultExportFunction.js +30 -16
- package/dist/js/modern/analyze/makeLegalIdentifier.js +10 -11
- package/dist/js/modern/analyze/nestedRoutes.js +118 -65
- package/dist/js/modern/analyze/templates.js +170 -81
- package/dist/js/modern/analyze/utils.js +104 -67
- package/dist/js/modern/builder/builderPlugins/compatModern.js +128 -109
- package/dist/js/modern/builder/index.js +120 -89
- package/dist/js/modern/builder/loaders/routerLoader.js +9 -12
- package/dist/js/modern/builder/loaders/serverModuleLoader.js +4 -1
- package/dist/js/modern/builder/share.js +23 -21
- package/dist/js/modern/builder/webpackPlugins/htmlAsyncChunkPlugin.js +23 -22
- package/dist/js/modern/builder/webpackPlugins/htmlBottomTemplate.js +31 -27
- package/dist/js/modern/builder/webpackPlugins/routerPlugin.js +100 -84
- package/dist/js/modern/commands/build.js +67 -42
- package/dist/js/modern/commands/deploy.js +27 -4
- package/dist/js/modern/commands/dev.js +81 -34
- package/dist/js/modern/commands/index.js +1 -1
- package/dist/js/modern/commands/inspect.js +30 -5
- package/dist/js/modern/commands/serve.js +54 -0
- package/dist/js/modern/config/default.js +112 -145
- package/dist/js/modern/config/index.js +8 -2
- package/dist/js/modern/config/initial/createHtmlConfig.js +5 -2
- package/dist/js/modern/config/initial/createOutputConfig.js +10 -13
- package/dist/js/modern/config/initial/createSourceConfig.js +10 -3
- package/dist/js/modern/config/initial/createToolsConfig.js +7 -6
- package/dist/js/modern/config/initial/index.js +9 -4
- package/dist/js/modern/config/initial/inits.js +109 -73
- package/dist/js/modern/config/initial/transformNormalizedConfig.js +11 -4
- package/dist/js/modern/defineConfig.js +26 -11
- package/dist/js/modern/exports/server.js +4 -1
- package/dist/js/modern/hooks.js +16 -4
- package/dist/js/modern/index.js +178 -90
- package/dist/js/modern/initialize/index.js +100 -52
- package/dist/js/modern/locale/en.js +20 -21
- package/dist/js/modern/locale/index.js +6 -6
- package/dist/js/modern/locale/zh.js +21 -22
- package/dist/js/modern/schema/Schema.js +6 -5
- package/dist/js/modern/schema/index.js +53 -100
- package/dist/js/modern/schema/legacy.js +96 -231
- package/dist/js/modern/types/config/index.js +0 -1
- package/dist/js/modern/types/index.js +0 -1
- package/dist/js/modern/types/legacyConfig/output.js +0 -1
- package/dist/js/modern/utils/commands.js +10 -2
- package/dist/js/modern/utils/config.js +102 -41
- package/dist/js/modern/utils/createFileWatcher.js +84 -51
- package/dist/js/modern/utils/createServer.js +63 -17
- package/dist/js/modern/utils/getServerInternalPlugins.js +58 -0
- package/dist/js/modern/utils/getSpecifiedEntries.js +46 -19
- package/dist/js/modern/utils/language.js +6 -3
- package/dist/js/modern/utils/printInstructions.js +27 -8
- package/dist/js/modern/utils/restart.js +43 -16
- package/dist/js/modern/utils/routes.js +29 -12
- package/dist/js/node/analyze/Builder.js +64 -0
- package/dist/js/node/analyze/constants.js +86 -39
- package/dist/js/node/analyze/generateCode.js +285 -239
- package/dist/js/node/analyze/getBundleEntry.js +62 -44
- package/dist/js/node/analyze/getClientRoutes/getRoutes.js +138 -77
- package/dist/js/node/analyze/getClientRoutes/getRoutesLegacy.js +130 -74
- package/dist/js/node/analyze/getClientRoutes/index.js +27 -16
- package/dist/js/node/analyze/getClientRoutes/utils.js +51 -21
- package/dist/js/node/analyze/getFileSystemEntry.js +82 -39
- package/dist/js/node/analyze/getHtmlTemplate.js +120 -61
- package/dist/js/node/analyze/getServerRoutes.js +145 -137
- package/dist/js/node/analyze/index.js +233 -174
- package/dist/js/node/analyze/isDefaultExportFunction.js +59 -26
- package/dist/js/node/analyze/makeLegalIdentifier.js +31 -15
- package/dist/js/node/analyze/nestedRoutes.js +150 -79
- package/dist/js/node/analyze/templates.js +198 -90
- package/dist/js/node/analyze/utils.js +136 -81
- package/dist/js/node/builder/builderPlugins/compatModern.js +158 -122
- package/dist/js/node/builder/index.js +142 -98
- package/dist/js/node/builder/loaders/routerLoader.js +29 -18
- package/dist/js/node/builder/loaders/serverModuleLoader.js +24 -7
- package/dist/js/node/builder/share.js +50 -26
- package/dist/js/node/builder/webpackPlugins/htmlAsyncChunkPlugin.js +43 -26
- package/dist/js/node/builder/webpackPlugins/htmlBottomTemplate.js +51 -31
- package/dist/js/node/builder/webpackPlugins/routerPlugin.js +120 -90
- package/dist/js/node/commands/build.js +91 -52
- package/dist/js/node/commands/deploy.js +49 -10
- package/dist/js/node/commands/dev.js +105 -48
- package/dist/js/node/commands/index.js +19 -38
- package/dist/js/node/commands/inspect.js +52 -11
- package/dist/js/node/commands/serve.js +83 -0
- package/dist/js/node/config/default.js +131 -149
- package/dist/js/node/config/index.js +31 -28
- package/dist/js/node/config/initial/createHtmlConfig.js +26 -6
- package/dist/js/node/config/initial/createOutputConfig.js +31 -17
- package/dist/js/node/config/initial/createSourceConfig.js +31 -7
- package/dist/js/node/config/initial/createToolsConfig.js +28 -10
- package/dist/js/node/config/initial/index.js +34 -17
- package/dist/js/node/config/initial/inits.js +130 -81
- package/dist/js/node/config/initial/transformNormalizedConfig.js +40 -16
- package/dist/js/node/defineConfig.js +46 -17
- package/dist/js/node/exports/server.js +25 -10
- package/dist/js/node/hooks.js +53 -29
- package/dist/js/node/index.js +213 -129
- package/dist/js/node/initialize/index.js +117 -61
- package/dist/js/node/locale/en.js +40 -25
- package/dist/js/node/locale/index.js +31 -14
- package/dist/js/node/locale/zh.js +41 -26
- package/dist/js/node/schema/Schema.js +27 -10
- package/dist/js/node/schema/index.js +84 -114
- package/dist/js/node/schema/legacy.js +119 -240
- 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 +17 -16
- 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 +19 -38
- 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 -5
- 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 +31 -6
- package/dist/js/node/utils/config.js +125 -51
- package/dist/js/node/utils/createFileWatcher.js +109 -61
- package/dist/js/node/utils/createServer.js +92 -25
- package/dist/js/node/utils/getServerInternalPlugins.js +79 -0
- package/dist/js/node/utils/getSpecifiedEntries.js +68 -25
- package/dist/js/node/utils/language.js +28 -8
- package/dist/js/node/utils/printInstructions.js +51 -16
- package/dist/js/node/utils/restart.js +65 -21
- package/dist/js/node/utils/routes.js +58 -19
- package/dist/js/node/utils/types.js +15 -0
- package/dist/js/treeshaking/analyze/Builder.js +199 -0
- package/dist/js/treeshaking/analyze/constants.js +37 -18
- package/dist/js/treeshaking/analyze/generateCode.js +597 -407
- package/dist/js/treeshaking/analyze/getBundleEntry.js +55 -63
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutes.js +217 -168
- package/dist/js/treeshaking/analyze/getClientRoutes/getRoutesLegacy.js +215 -169
- package/dist/js/treeshaking/analyze/getClientRoutes/index.js +3 -2
- package/dist/js/treeshaking/analyze/getClientRoutes/utils.js +19 -20
- package/dist/js/treeshaking/analyze/getFileSystemEntry.js +97 -86
- package/dist/js/treeshaking/analyze/getHtmlTemplate.js +298 -125
- package/dist/js/treeshaking/analyze/getServerRoutes.js +210 -147
- package/dist/js/treeshaking/analyze/index.js +575 -305
- package/dist/js/treeshaking/analyze/isDefaultExportFunction.js +45 -26
- package/dist/js/treeshaking/analyze/makeLegalIdentifier.js +13 -16
- package/dist/js/treeshaking/analyze/nestedRoutes.js +419 -201
- package/dist/js/treeshaking/analyze/templates.js +438 -236
- package/dist/js/treeshaking/analyze/utils.js +367 -153
- package/dist/js/treeshaking/builder/builderPlugins/compatModern.js +285 -199
- package/dist/js/treeshaking/builder/index.js +365 -165
- package/dist/js/treeshaking/builder/loaders/routerLoader.js +11 -12
- package/dist/js/treeshaking/builder/loaders/serverModuleLoader.js +3 -2
- package/dist/js/treeshaking/builder/share.js +38 -44
- package/dist/js/treeshaking/builder/webpackPlugins/htmlAsyncChunkPlugin.js +108 -44
- package/dist/js/treeshaking/builder/webpackPlugins/htmlBottomTemplate.js +70 -39
- package/dist/js/treeshaking/builder/webpackPlugins/routerPlugin.js +334 -112
- package/dist/js/treeshaking/commands/build.js +286 -88
- package/dist/js/treeshaking/commands/deploy.js +153 -25
- package/dist/js/treeshaking/commands/dev.js +313 -131
- package/dist/js/treeshaking/commands/index.js +1 -1
- package/dist/js/treeshaking/commands/inspect.js +147 -32
- package/dist/js/treeshaking/commands/serve.js +199 -0
- package/dist/js/treeshaking/config/default.js +207 -198
- package/dist/js/treeshaking/config/index.js +3 -2
- package/dist/js/treeshaking/config/initial/createHtmlConfig.js +19 -31
- package/dist/js/treeshaking/config/initial/createOutputConfig.js +41 -70
- package/dist/js/treeshaking/config/initial/createSourceConfig.js +41 -40
- package/dist/js/treeshaking/config/initial/createToolsConfig.js +23 -38
- package/dist/js/treeshaking/config/initial/index.js +10 -9
- package/dist/js/treeshaking/config/initial/inits.js +205 -106
- package/dist/js/treeshaking/config/initial/transformNormalizedConfig.js +31 -34
- package/dist/js/treeshaking/defineConfig.js +60 -13
- package/dist/js/treeshaking/exports/server.js +2 -1
- package/dist/js/treeshaking/hooks.js +31 -25
- package/dist/js/treeshaking/index.js +681 -256
- package/dist/js/treeshaking/initialize/index.js +292 -113
- package/dist/js/treeshaking/locale/en.js +34 -33
- package/dist/js/treeshaking/locale/index.js +5 -5
- package/dist/js/treeshaking/locale/zh.js +34 -33
- package/dist/js/treeshaking/schema/Schema.js +267 -69
- package/dist/js/treeshaking/schema/index.js +171 -121
- package/dist/js/treeshaking/schema/legacy.js +323 -256
- package/dist/js/treeshaking/types/config/deploy.js +1 -0
- package/dist/js/treeshaking/types/config/dev.js +1 -0
- package/dist/js/treeshaking/types/config/experiments.js +1 -0
- package/dist/js/treeshaking/types/config/html.js +1 -0
- package/dist/js/treeshaking/types/config/index.js +0 -1
- package/dist/js/treeshaking/types/config/output.js +1 -0
- package/dist/js/treeshaking/types/config/performance.js +1 -0
- package/dist/js/treeshaking/types/config/security.js +1 -0
- package/dist/js/treeshaking/types/config/source.js +1 -0
- package/dist/js/treeshaking/types/config/tools.js +1 -0
- package/dist/js/treeshaking/types/hooks.js +1 -0
- package/dist/js/treeshaking/types/index.js +0 -1
- package/dist/js/treeshaking/types/legacyConfig/deploy.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/dev.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/index.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/output.js +1 -1
- package/dist/js/treeshaking/types/legacyConfig/source.js +1 -0
- package/dist/js/treeshaking/types/legacyConfig/tools.js +1 -0
- package/dist/js/treeshaking/utils/commands.js +10 -5
- package/dist/js/treeshaking/utils/config.js +295 -117
- package/dist/js/treeshaking/utils/createFileWatcher.js +278 -118
- package/dist/js/treeshaking/utils/createServer.js +252 -67
- package/dist/js/treeshaking/utils/getServerInternalPlugins.js +210 -0
- package/dist/js/treeshaking/utils/getSpecifiedEntries.js +182 -55
- package/dist/js/treeshaking/utils/language.js +6 -5
- package/dist/js/treeshaking/utils/printInstructions.js +151 -29
- package/dist/js/treeshaking/utils/restart.js +184 -42
- package/dist/js/treeshaking/utils/routes.js +151 -27
- package/dist/js/treeshaking/utils/types.js +1 -0
- package/dist/types/analyze/Builder.d.ts +8 -0
- package/dist/types/analyze/constants.d.ts +10 -1
- package/dist/types/analyze/index.d.ts +2 -0
- package/dist/types/analyze/templates.d.ts +3 -1
- package/dist/types/analyze/utils.d.ts +2 -1
- package/dist/types/builder/builderPlugins/compatModern.d.ts +2 -1
- package/dist/types/builder/index.d.ts +3 -3
- package/dist/types/builder/webpackPlugins/routerPlugin.d.ts +1 -7
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/{start.d.ts → serve.d.ts} +0 -0
- package/dist/types/defineConfig.d.ts +1 -0
- package/dist/types/index.d.ts +7 -1
- package/dist/types/initialize/index.d.ts +2 -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/dev.d.ts +2 -2
- package/dist/types/types/config/index.d.ts +4 -0
- package/dist/types/types/config/output.d.ts +0 -1
- package/dist/types/types/config/source.d.ts +2 -0
- package/dist/types/types/config/tools.d.ts +2 -0
- package/dist/types/types/hooks.d.ts +8 -0
- package/dist/types/types/legacyConfig/dev.d.ts +1 -0
- package/dist/types/types/legacyConfig/output.d.ts +1 -1
- package/dist/types/types/legacyConfig/source.d.ts +1 -0
- package/dist/types/types/legacyConfig/tools.d.ts +1 -0
- package/dist/types/utils/commands.d.ts +2 -1
- package/dist/types/utils/config.d.ts +1 -0
- package/dist/types/utils/createServer.d.ts +1 -0
- package/dist/types/utils/getServerInternalPlugins.d.ts +2 -0
- package/dist/types/utils/restart.d.ts +1 -1
- package/package.json +26 -22
- package/dist/js/modern/commands/start.js +0 -30
- package/dist/js/node/commands/start.js +0 -38
- package/dist/js/treeshaking/commands/start.js +0 -69
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
2
|
+
try {
|
|
3
|
+
var info = gen[key](arg);
|
|
4
|
+
var value = info.value;
|
|
5
|
+
} catch (error) {
|
|
6
|
+
reject(error);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (info.done) {
|
|
10
|
+
resolve(value);
|
|
11
|
+
} else {
|
|
12
|
+
Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function _asyncToGenerator(fn) {
|
|
16
|
+
return function() {
|
|
17
|
+
var self = this, args = arguments;
|
|
18
|
+
return new Promise(function(resolve, reject) {
|
|
19
|
+
var gen = fn.apply(self, args);
|
|
20
|
+
function _next(value) {
|
|
21
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
22
|
+
}
|
|
23
|
+
function _throw(err) {
|
|
24
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
25
|
+
}
|
|
26
|
+
_next(undefined);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
31
|
+
var f, y, t, g, _ = {
|
|
32
|
+
label: 0,
|
|
33
|
+
sent: function() {
|
|
34
|
+
if (t[0] & 1) throw t[1];
|
|
35
|
+
return t[1];
|
|
36
|
+
},
|
|
37
|
+
trys: [],
|
|
38
|
+
ops: []
|
|
39
|
+
};
|
|
40
|
+
return(g = {
|
|
41
|
+
next: verb(0),
|
|
42
|
+
"throw": verb(1),
|
|
43
|
+
"return": verb(2)
|
|
44
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
45
|
+
return this;
|
|
46
|
+
}), g);
|
|
47
|
+
function verb(n) {
|
|
48
|
+
return function(v) {
|
|
49
|
+
return step([
|
|
50
|
+
n,
|
|
51
|
+
v
|
|
52
|
+
]);
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function step(op) {
|
|
56
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
57
|
+
while(_)try {
|
|
58
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
59
|
+
if (y = 0, t) op = [
|
|
60
|
+
op[0] & 2,
|
|
61
|
+
t.value
|
|
62
|
+
];
|
|
63
|
+
switch(op[0]){
|
|
64
|
+
case 0:
|
|
65
|
+
case 1:
|
|
66
|
+
t = op;
|
|
67
|
+
break;
|
|
68
|
+
case 4:
|
|
69
|
+
_.label++;
|
|
70
|
+
return {
|
|
71
|
+
value: op[1],
|
|
72
|
+
done: false
|
|
73
|
+
};
|
|
74
|
+
case 5:
|
|
75
|
+
_.label++;
|
|
76
|
+
y = op[1];
|
|
77
|
+
op = [
|
|
78
|
+
0
|
|
79
|
+
];
|
|
80
|
+
continue;
|
|
81
|
+
case 7:
|
|
82
|
+
op = _.ops.pop();
|
|
83
|
+
_.trys.pop();
|
|
84
|
+
continue;
|
|
85
|
+
default:
|
|
86
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
87
|
+
_ = 0;
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
91
|
+
_.label = op[1];
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
95
|
+
_.label = t[1];
|
|
96
|
+
t = op;
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
if (t && _.label < t[2]) {
|
|
100
|
+
_.label = t[2];
|
|
101
|
+
_.ops.push(op);
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
if (t[2]) _.ops.pop();
|
|
105
|
+
_.trys.pop();
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
op = body.call(thisArg, _);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
op = [
|
|
111
|
+
6,
|
|
112
|
+
e
|
|
113
|
+
];
|
|
114
|
+
y = 0;
|
|
115
|
+
} finally{
|
|
116
|
+
f = t = 0;
|
|
117
|
+
}
|
|
118
|
+
if (op[0] & 5) throw op[1];
|
|
119
|
+
return {
|
|
120
|
+
value: op[0] ? op[1] : void 0,
|
|
121
|
+
done: true
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
import { logger, chalk, isApiOnly } from "@modern-js/utils";
|
|
126
|
+
import server from "@modern-js/prod-server";
|
|
127
|
+
import { printInstructions } from "../utils/printInstructions";
|
|
128
|
+
import { injectDataLoaderPlugin } from "../utils/createServer";
|
|
129
|
+
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
130
|
+
var start = function() {
|
|
131
|
+
var _ref = _asyncToGenerator(function(api) {
|
|
132
|
+
var ref, appContext, userConfig, hookRunners, appDirectory, port, serverConfigFile, apiOnly, serverInternalPlugins, app;
|
|
133
|
+
return __generator(this, function(_state) {
|
|
134
|
+
switch(_state.label){
|
|
135
|
+
case 0:
|
|
136
|
+
appContext = api.useAppContext();
|
|
137
|
+
userConfig = api.useResolvedConfigContext();
|
|
138
|
+
hookRunners = api.useHookRunners();
|
|
139
|
+
appDirectory = appContext.appDirectory, port = appContext.port, serverConfigFile = appContext.serverConfigFile;
|
|
140
|
+
logger.log(chalk.cyan("Starting the modern server..."));
|
|
141
|
+
return [
|
|
142
|
+
4,
|
|
143
|
+
isApiOnly(appContext.appDirectory, userConfig === null || userConfig === void 0 ? void 0 : (ref = userConfig.source) === null || ref === void 0 ? void 0 : ref.entriesDir)
|
|
144
|
+
];
|
|
145
|
+
case 1:
|
|
146
|
+
apiOnly = _state.sent();
|
|
147
|
+
return [
|
|
148
|
+
4,
|
|
149
|
+
getServerInternalPlugins(api)
|
|
150
|
+
];
|
|
151
|
+
case 2:
|
|
152
|
+
serverInternalPlugins = _state.sent();
|
|
153
|
+
return [
|
|
154
|
+
4,
|
|
155
|
+
server({
|
|
156
|
+
pwd: appDirectory,
|
|
157
|
+
config: userConfig,
|
|
158
|
+
serverConfigFile: serverConfigFile,
|
|
159
|
+
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
|
|
160
|
+
apiOnly: apiOnly
|
|
161
|
+
})
|
|
162
|
+
];
|
|
163
|
+
case 3:
|
|
164
|
+
app = _state.sent();
|
|
165
|
+
app.listen(port, function() {
|
|
166
|
+
var _ref = _asyncToGenerator(function(err) {
|
|
167
|
+
return __generator(this, function(_state) {
|
|
168
|
+
switch(_state.label){
|
|
169
|
+
case 0:
|
|
170
|
+
if (err) {
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
return [
|
|
174
|
+
4,
|
|
175
|
+
printInstructions(hookRunners, appContext, userConfig)
|
|
176
|
+
];
|
|
177
|
+
case 1:
|
|
178
|
+
_state.sent();
|
|
179
|
+
return [
|
|
180
|
+
2
|
|
181
|
+
];
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
return function(err) {
|
|
186
|
+
return _ref.apply(this, arguments);
|
|
187
|
+
};
|
|
188
|
+
}());
|
|
189
|
+
return [
|
|
190
|
+
2
|
|
191
|
+
];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
return function start(api) {
|
|
196
|
+
return _ref.apply(this, arguments);
|
|
197
|
+
};
|
|
198
|
+
}();
|
|
199
|
+
export { start };
|
|
@@ -1,199 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
include: [],
|
|
14
|
-
alias: defaultAlias
|
|
15
|
-
};
|
|
16
|
-
var output = {
|
|
17
|
-
assetPrefix: '/',
|
|
18
|
-
distPath: {
|
|
19
|
-
html: 'html',
|
|
20
|
-
js: 'static/js',
|
|
21
|
-
css: 'static/css',
|
|
22
|
-
media: 'static/media',
|
|
23
|
-
root: 'dist'
|
|
24
|
-
},
|
|
25
|
-
copy: undefined,
|
|
26
|
-
disableCssModuleExtension: false,
|
|
27
|
-
enableCssModuleTSDeclaration: false,
|
|
28
|
-
disableMinimize: false,
|
|
29
|
-
enableInlineStyles: false,
|
|
30
|
-
enableInlineScripts: false,
|
|
31
|
-
disableSourceMap: false,
|
|
32
|
-
disableInlineRuntimeChunk: false,
|
|
33
|
-
disableFilenameHash: false,
|
|
34
|
-
enableLatestDecorators: false,
|
|
35
|
-
polyfill: 'entry',
|
|
36
|
-
cssModuleLocalIdentName: undefined
|
|
37
|
-
};
|
|
38
|
-
var html = {
|
|
39
|
-
title: '',
|
|
40
|
-
titleByEntries: undefined,
|
|
41
|
-
meta: {
|
|
42
|
-
charset: {
|
|
43
|
-
charset: 'utf-8'
|
|
44
|
-
},
|
|
45
|
-
viewport: 'width=device-width, initial-scale=1.0, shrink-to-fit=no, viewport-fit=cover, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no',
|
|
46
|
-
'http-equiv': {
|
|
47
|
-
'http-equiv': 'x-ua-compatible',
|
|
48
|
-
content: 'ie=edge'
|
|
49
|
-
},
|
|
50
|
-
renderer: 'webkit',
|
|
51
|
-
layoutmode: 'standard',
|
|
52
|
-
imagemode: 'force',
|
|
53
|
-
'wap-font-scale': 'no',
|
|
54
|
-
'format-detection': 'telephone=no'
|
|
55
|
-
},
|
|
56
|
-
metaByEntries: undefined,
|
|
57
|
-
inject: 'head',
|
|
58
|
-
injectByEntries: undefined,
|
|
59
|
-
mountId: 'root',
|
|
60
|
-
favicon: '',
|
|
61
|
-
faviconByEntries: undefined,
|
|
62
|
-
disableHtmlFolder: false,
|
|
63
|
-
templateParameters: {},
|
|
64
|
-
templateParametersByEntries: undefined
|
|
65
|
-
};
|
|
66
|
-
var server = {
|
|
67
|
-
routes: undefined,
|
|
68
|
-
publicRoutes: undefined,
|
|
69
|
-
ssr: undefined,
|
|
70
|
-
ssrByEntries: undefined,
|
|
71
|
-
baseUrl: '/',
|
|
72
|
-
port: 8080
|
|
73
|
-
};
|
|
74
|
-
var dev = {
|
|
75
|
-
assetPrefix: false,
|
|
76
|
-
https: false
|
|
77
|
-
};
|
|
78
|
-
var tools = {
|
|
79
|
-
webpack: undefined,
|
|
80
|
-
babel: undefined,
|
|
81
|
-
postcss: undefined,
|
|
82
|
-
autoprefixer: undefined,
|
|
83
|
-
devServer: undefined,
|
|
84
|
-
tsLoader: undefined,
|
|
85
|
-
terser: undefined,
|
|
86
|
-
minifyCss: undefined
|
|
87
|
-
};
|
|
88
|
-
return {
|
|
89
|
-
source: source,
|
|
90
|
-
output: output,
|
|
91
|
-
server: server,
|
|
92
|
-
dev: dev,
|
|
93
|
-
html: html,
|
|
94
|
-
tools: tools,
|
|
95
|
-
plugins: [],
|
|
96
|
-
runtime: {},
|
|
97
|
-
runtimeByEntries: {}
|
|
98
|
-
};
|
|
1
|
+
function _defineProperty(obj, key, value) {
|
|
2
|
+
if (key in obj) {
|
|
3
|
+
Object.defineProperty(obj, key, {
|
|
4
|
+
value: value,
|
|
5
|
+
enumerable: true,
|
|
6
|
+
configurable: true,
|
|
7
|
+
writable: true
|
|
8
|
+
});
|
|
9
|
+
} else {
|
|
10
|
+
obj[key] = value;
|
|
11
|
+
}
|
|
12
|
+
return obj;
|
|
99
13
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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";
|
|
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
|
+
});
|
|
61
|
+
var _obj;
|
|
62
|
+
var source = _objectSpreadProps(_objectSpread({}, defaultBuilderConfig.source), {
|
|
63
|
+
entries: void 0,
|
|
64
|
+
enableAsyncEntry: false,
|
|
65
|
+
disableDefaultEntries: false,
|
|
66
|
+
entriesDir: "./src",
|
|
67
|
+
configDir: "./config",
|
|
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), {
|
|
71
|
+
title: "",
|
|
72
|
+
meta: {
|
|
73
|
+
charset: {
|
|
74
|
+
charset: "utf-8"
|
|
75
|
+
},
|
|
76
|
+
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",
|
|
77
|
+
"http-equiv": {
|
|
78
|
+
"http-equiv": "x-ua-compatible",
|
|
79
|
+
content: "ie=edge"
|
|
80
|
+
},
|
|
81
|
+
renderer: "webkit",
|
|
82
|
+
layoutmode: "standard",
|
|
83
|
+
imagemode: "force",
|
|
84
|
+
"wap-font-scale": "no",
|
|
85
|
+
"format-detection": "telephone=no"
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
var server = {
|
|
89
|
+
routes: void 0,
|
|
90
|
+
publicRoutes: void 0,
|
|
91
|
+
ssr: void 0,
|
|
92
|
+
ssrByEntries: void 0,
|
|
93
|
+
baseUrl: "/",
|
|
94
|
+
port: 8080
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
source: source,
|
|
98
|
+
output: output,
|
|
99
|
+
server: server,
|
|
100
|
+
dev: dev,
|
|
101
|
+
html: html,
|
|
102
|
+
tools: tools,
|
|
103
|
+
plugins: [],
|
|
104
|
+
builderPlugins: [],
|
|
105
|
+
runtime: {},
|
|
106
|
+
runtimeByEntries: {}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function createLegacyDefaultConfig(appContext) {
|
|
110
|
+
var _obj;
|
|
111
|
+
var defaultAlias = appContext ? (_obj = {}, _defineProperty(_obj, appContext.internalDirAlias, appContext.internalDirectory), _defineProperty(_obj, appContext.internalSrcAlias, appContext.srcDirectory), _defineProperty(_obj, "@", appContext.srcDirectory), _defineProperty(_obj, "@shared", appContext.sharedDirectory), _obj) : {};
|
|
112
|
+
var sourceDefaults = {
|
|
113
|
+
entries: void 0,
|
|
114
|
+
enableAsyncEntry: false,
|
|
115
|
+
disableDefaultEntries: false,
|
|
116
|
+
entriesDir: "./src",
|
|
117
|
+
configDir: "./config",
|
|
118
|
+
apiDir: "./api",
|
|
119
|
+
envVars: [],
|
|
120
|
+
globalVars: void 0,
|
|
121
|
+
alias: defaultAlias,
|
|
122
|
+
moduleScopes: void 0,
|
|
123
|
+
include: []
|
|
124
|
+
};
|
|
125
|
+
var outputDefaults = {
|
|
126
|
+
assetPrefix: "/",
|
|
127
|
+
htmlPath: "html",
|
|
128
|
+
jsPath: "static/js",
|
|
129
|
+
cssPath: "static/css",
|
|
130
|
+
mediaPath: "static/media",
|
|
131
|
+
path: "dist",
|
|
132
|
+
title: "",
|
|
133
|
+
titleByEntries: void 0,
|
|
134
|
+
meta: {
|
|
135
|
+
charset: {
|
|
136
|
+
charset: "utf-8"
|
|
137
|
+
},
|
|
138
|
+
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",
|
|
139
|
+
"http-equiv": {
|
|
140
|
+
"http-equiv": "x-ua-compatible",
|
|
141
|
+
content: "ie=edge"
|
|
142
|
+
},
|
|
143
|
+
renderer: "webkit",
|
|
144
|
+
layoutmode: "standard",
|
|
145
|
+
imagemode: "force",
|
|
146
|
+
"wap-font-scale": "no",
|
|
147
|
+
"format-detection": "telephone=no"
|
|
148
|
+
},
|
|
149
|
+
metaByEntries: void 0,
|
|
150
|
+
inject: "head",
|
|
151
|
+
injectByEntries: void 0,
|
|
152
|
+
mountId: "root",
|
|
153
|
+
favicon: "",
|
|
154
|
+
faviconByEntries: void 0,
|
|
155
|
+
copy: void 0,
|
|
156
|
+
disableHtmlFolder: false,
|
|
157
|
+
disableCssModuleExtension: false,
|
|
158
|
+
disableCssExtract: false,
|
|
159
|
+
enableCssModuleTSDeclaration: false,
|
|
160
|
+
disableMinimize: false,
|
|
161
|
+
enableInlineStyles: false,
|
|
162
|
+
enableInlineScripts: false,
|
|
163
|
+
disableSourceMap: false,
|
|
164
|
+
disableInlineRuntimeChunk: false,
|
|
165
|
+
disableAssetsCache: false,
|
|
166
|
+
enableLatestDecorators: false,
|
|
167
|
+
polyfill: "entry",
|
|
168
|
+
dataUriLimit: 1e4,
|
|
169
|
+
templateParameters: {},
|
|
170
|
+
templateParametersByEntries: void 0,
|
|
171
|
+
cssModuleLocalIdentName: void 0,
|
|
172
|
+
disableNodePolyfill: false,
|
|
173
|
+
enableTsLoader: false
|
|
174
|
+
};
|
|
175
|
+
var serverDefaults = {
|
|
176
|
+
routes: void 0,
|
|
177
|
+
publicRoutes: void 0,
|
|
178
|
+
ssr: void 0,
|
|
179
|
+
ssrByEntries: void 0,
|
|
180
|
+
baseUrl: "/",
|
|
181
|
+
port: 8080
|
|
182
|
+
};
|
|
183
|
+
var devDefaults = {
|
|
184
|
+
assetPrefix: false,
|
|
185
|
+
https: false
|
|
186
|
+
};
|
|
187
|
+
var toolsDefaults = {
|
|
188
|
+
webpack: void 0,
|
|
189
|
+
babel: void 0,
|
|
190
|
+
postcss: void 0,
|
|
191
|
+
autoprefixer: void 0,
|
|
192
|
+
lodash: void 0,
|
|
193
|
+
devServer: void 0,
|
|
194
|
+
tsLoader: void 0,
|
|
195
|
+
terser: void 0,
|
|
196
|
+
minifyCss: void 0
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
source: sourceDefaults,
|
|
200
|
+
output: outputDefaults,
|
|
201
|
+
server: serverDefaults,
|
|
202
|
+
dev: devDefaults,
|
|
203
|
+
tools: toolsDefaults,
|
|
204
|
+
runtime: {},
|
|
205
|
+
runtimeByEntries: {}
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
export { createDefaultConfig, createLegacyDefaultConfig };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { createDefaultConfig, createLegacyDefaultConfig } from "./default";
|
|
2
|
+
import { initialNormalizedConfig, checkIsLegacyConfig } from "./initial";
|
|
3
|
+
export { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, initialNormalizedConfig };
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
inject: inject,
|
|
21
|
-
injectByEntries: injectByEntries,
|
|
22
|
-
meta: meta,
|
|
23
|
-
metaByEntries: metaByEntries,
|
|
24
|
-
mountId: mountId,
|
|
25
|
-
title: title,
|
|
26
|
-
titleByEntries: titleByEntries,
|
|
27
|
-
crossorigin: crossorigin,
|
|
28
|
-
templateParameters: templateParameters,
|
|
29
|
-
templateParametersByEntries: templateParametersByEntries
|
|
30
|
-
};
|
|
31
|
-
}
|
|
1
|
+
function createHtmlConfig(config) {
|
|
2
|
+
var _output = config.output, disableHtmlFolder = _output.disableHtmlFolder, favicon = _output.favicon, faviconByEntries = _output.faviconByEntries, inject = _output.inject, injectByEntries = _output.injectByEntries, meta = _output.meta, metaByEntries = _output.metaByEntries, mountId = _output.mountId, title = _output.title, titleByEntries = _output.titleByEntries, templateParameters = _output.templateParameters, templateParametersByEntries = _output.templateParametersByEntries, crossorigin = _output.crossorigin;
|
|
3
|
+
return {
|
|
4
|
+
disableHtmlFolder: disableHtmlFolder,
|
|
5
|
+
favicon: favicon,
|
|
6
|
+
faviconByEntries: faviconByEntries,
|
|
7
|
+
inject: inject,
|
|
8
|
+
injectByEntries: injectByEntries,
|
|
9
|
+
meta: meta,
|
|
10
|
+
metaByEntries: metaByEntries,
|
|
11
|
+
mountId: mountId,
|
|
12
|
+
title: title,
|
|
13
|
+
titleByEntries: titleByEntries,
|
|
14
|
+
crossorigin: crossorigin,
|
|
15
|
+
templateParameters: templateParameters,
|
|
16
|
+
templateParametersByEntries: templateParametersByEntries
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export { createHtmlConfig };
|