@modern-js/app-tools 2.19.1 → 2.20.0
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 +45 -0
- package/dist/cjs/analyze/generateCode.js +4 -47
- package/dist/cjs/analyze/getBundleEntry.js +2 -6
- package/dist/cjs/analyze/getClientRoutes/getRoutes.js +2 -6
- package/dist/cjs/analyze/getClientRoutes/getRoutesLegacy.js +2 -6
- package/dist/cjs/analyze/getClientRoutes/utils.js +2 -6
- package/dist/cjs/analyze/getFileSystemEntry.js +3 -7
- package/dist/cjs/analyze/getHtmlTemplate.js +4 -47
- package/dist/cjs/analyze/getServerRoutes.js +5 -7
- package/dist/cjs/analyze/index.js +7 -46
- package/dist/cjs/analyze/isDefaultExportFunction.js +5 -48
- package/dist/cjs/analyze/nestedRoutes.js +2 -41
- package/dist/cjs/analyze/templates.js +2 -6
- package/dist/cjs/analyze/utils.js +3 -7
- package/dist/cjs/builder/builder-rspack/adapterCopy.js +3 -7
- package/dist/cjs/builder/builder-webpack/index.js +2 -41
- package/dist/cjs/builder/generator/index.js +3 -42
- package/dist/cjs/builder/index.js +4 -43
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -41
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +5 -43
- package/dist/cjs/builder/shared/builderPlugins/index.js +4 -16
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +3 -15
- package/dist/cjs/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +5 -17
- package/dist/cjs/builder/shared/bundlerPlugins/RouterPlugin.js +2 -6
- package/dist/cjs/builder/shared/bundlerPlugins/index.js +4 -16
- package/dist/cjs/builder/shared/createCopyInfo.js +2 -6
- package/dist/cjs/builder/shared/index.js +4 -16
- package/dist/cjs/commands/index.js +4 -16
- package/dist/cjs/commands/serve.js +2 -6
- package/dist/cjs/config/index.js +4 -16
- package/dist/cjs/config/initialize/inits.js +2 -41
- package/dist/cjs/index.js +30 -74
- package/dist/cjs/schema/Schema.js +2 -14
- package/dist/cjs/schema/index.js +2 -6
- package/dist/cjs/types/config/index.js +2 -14
- package/dist/cjs/types/index.js +4 -16
- package/dist/cjs/utils/config.js +2 -41
- package/dist/cjs/utils/generateWatchFiles.js +2 -6
- package/dist/cjs/utils/routes.js +2 -6
- package/dist/esm/analyze/generateCode.js +5 -167
- package/dist/esm/analyze/getClientRoutes/getRoutes.js +2 -52
- package/dist/esm/analyze/getClientRoutes/getRoutesLegacy.js +2 -52
- package/dist/esm/analyze/getHtmlTemplate.js +6 -151
- package/dist/esm/analyze/getServerRoutes.js +6 -118
- package/dist/esm/analyze/index.js +13 -249
- package/dist/esm/analyze/nestedRoutes.js +5 -184
- package/dist/esm/analyze/templates.js +6 -242
- package/dist/esm/analyze/utils.js +6 -205
- package/dist/esm/builder/builder-rspack/adapterCopy.js +9 -221
- package/dist/esm/builder/builder-webpack/adapterModern.js +1 -34
- package/dist/esm/builder/builder-webpack/index.js +7 -219
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +2 -52
- package/dist/esm/builder/generator/index.js +4 -133
- package/dist/esm/builder/index.js +3 -132
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.js +7 -185
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +8 -136
- package/dist/esm/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +4 -69
- package/dist/esm/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +3 -35
- package/dist/esm/builder/shared/bundlerPlugins/RouterPlugin.js +7 -226
- package/dist/esm/commands/build.js +5 -184
- package/dist/esm/commands/deploy.js +3 -132
- package/dist/esm/commands/dev.js +6 -185
- package/dist/esm/commands/inspect.js +3 -132
- package/dist/esm/commands/serve.js +6 -185
- package/dist/esm/config/default.js +3 -52
- package/dist/esm/config/initialize/inits.js +3 -86
- package/dist/esm/defineConfig.js +2 -52
- package/dist/esm/index.js +36 -198
- package/dist/esm/initialize/index.js +6 -185
- package/dist/esm/schema/Schema.js +8 -213
- package/dist/esm/schema/index.js +1 -13
- package/dist/esm/schema/legacy.js +1 -13
- package/dist/esm/utils/config.js +7 -186
- package/dist/esm/utils/createServer.js +6 -185
- package/dist/esm/utils/generateWatchFiles.js +5 -167
- package/dist/esm/utils/getSelectedEntries.js +3 -132
- package/dist/esm/utils/getServerInternalPlugins.js +5 -184
- package/dist/esm/utils/printInstructions.js +3 -132
- package/dist/esm/utils/restart.js +3 -132
- package/dist/esm/utils/routes.js +3 -132
- package/dist/esm-node/analyze/getServerRoutes.js +2 -0
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +3 -2
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlAsyncChunkPlugin.js +1 -13
- package/dist/esm-node/builder/shared/bundlerPlugins/HtmlBottomTemplate.js +1 -13
- package/dist/esm-node/index.js +11 -0
- package/dist/esm-node/schema/Schema.js +1 -13
- package/dist/types/types/config/output.d.ts +1 -0
- package/dist/types/types/legacyConfig/output.d.ts +2 -2
- package/lib/types.d.ts +8 -8
- package/package.json +25 -25
package/dist/esm/defineConfig.js
CHANGED
|
@@ -1,55 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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;
|
|
13
|
-
}
|
|
14
|
-
function _object_spread(target) {
|
|
15
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
16
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
-
var ownKeys2 = Object.keys(source);
|
|
18
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
ownKeys2.forEach(function(key) {
|
|
24
|
-
_define_property(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 _object_spread_props(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
|
-
}
|
|
1
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
2
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
53
3
|
export var defineConfig = function(config) {
|
|
54
4
|
return config;
|
|
55
5
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,186 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 _async_to_generator(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(void 0);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread(target) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
var ownKeys2 = Object.keys(source);
|
|
47
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
ownKeys2.forEach(function(key) {
|
|
53
|
-
_define_property(target, key, source[key]);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
function ownKeys(object, enumerableOnly) {
|
|
59
|
-
var keys = Object.keys(object);
|
|
60
|
-
if (Object.getOwnPropertySymbols) {
|
|
61
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
-
if (enumerableOnly) {
|
|
63
|
-
symbols = symbols.filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
keys.push.apply(keys, symbols);
|
|
68
|
-
}
|
|
69
|
-
return keys;
|
|
70
|
-
}
|
|
71
|
-
function _object_spread_props(target, source) {
|
|
72
|
-
source = source != null ? source : {};
|
|
73
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
-
} else {
|
|
76
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
var __generator = function(thisArg, body) {
|
|
83
|
-
var f, y, t, g, _ = {
|
|
84
|
-
label: 0,
|
|
85
|
-
sent: function() {
|
|
86
|
-
if (t[0] & 1)
|
|
87
|
-
throw t[1];
|
|
88
|
-
return t[1];
|
|
89
|
-
},
|
|
90
|
-
trys: [],
|
|
91
|
-
ops: []
|
|
92
|
-
};
|
|
93
|
-
return g = {
|
|
94
|
-
next: verb(0),
|
|
95
|
-
"throw": verb(1),
|
|
96
|
-
"return": verb(2)
|
|
97
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
98
|
-
return this;
|
|
99
|
-
}), g;
|
|
100
|
-
function verb(n) {
|
|
101
|
-
return function(v) {
|
|
102
|
-
return step([
|
|
103
|
-
n,
|
|
104
|
-
v
|
|
105
|
-
]);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function step(op) {
|
|
109
|
-
if (f)
|
|
110
|
-
throw new TypeError("Generator is already executing.");
|
|
111
|
-
while (_)
|
|
112
|
-
try {
|
|
113
|
-
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)
|
|
114
|
-
return t;
|
|
115
|
-
if (y = 0, t)
|
|
116
|
-
op = [
|
|
117
|
-
op[0] & 2,
|
|
118
|
-
t.value
|
|
119
|
-
];
|
|
120
|
-
switch (op[0]) {
|
|
121
|
-
case 0:
|
|
122
|
-
case 1:
|
|
123
|
-
t = op;
|
|
124
|
-
break;
|
|
125
|
-
case 4:
|
|
126
|
-
_.label++;
|
|
127
|
-
return {
|
|
128
|
-
value: op[1],
|
|
129
|
-
done: false
|
|
130
|
-
};
|
|
131
|
-
case 5:
|
|
132
|
-
_.label++;
|
|
133
|
-
y = op[1];
|
|
134
|
-
op = [
|
|
135
|
-
0
|
|
136
|
-
];
|
|
137
|
-
continue;
|
|
138
|
-
case 7:
|
|
139
|
-
op = _.ops.pop();
|
|
140
|
-
_.trys.pop();
|
|
141
|
-
continue;
|
|
142
|
-
default:
|
|
143
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
144
|
-
_ = 0;
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
148
|
-
_.label = op[1];
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
-
_.label = t[1];
|
|
153
|
-
t = op;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
if (t && _.label < t[2]) {
|
|
157
|
-
_.label = t[2];
|
|
158
|
-
_.ops.push(op);
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (t[2])
|
|
162
|
-
_.ops.pop();
|
|
163
|
-
_.trys.pop();
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
op = body.call(thisArg, _);
|
|
167
|
-
} catch (e) {
|
|
168
|
-
op = [
|
|
169
|
-
6,
|
|
170
|
-
e
|
|
171
|
-
];
|
|
172
|
-
y = 0;
|
|
173
|
-
} finally {
|
|
174
|
-
f = t = 0;
|
|
175
|
-
}
|
|
176
|
-
if (op[0] & 5)
|
|
177
|
-
throw op[1];
|
|
178
|
-
return {
|
|
179
|
-
value: op[0] ? op[1] : void 0,
|
|
180
|
-
done: true
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
};
|
|
1
|
+
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
+
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
184
5
|
import path from "path";
|
|
185
6
|
import lintPlugin from "@modern-js/plugin-lint";
|
|
186
7
|
import { cleanRequireCache, emptyDir, Import, getCommand } from "@modern-js/utils";
|
|
@@ -199,7 +20,7 @@ var upgradeModel = Import.lazy("@modern-js/upgrade", require);
|
|
|
199
20
|
export var devCommand = function() {
|
|
200
21
|
var _ref = _async_to_generator(function(program, api) {
|
|
201
22
|
var runner, devToolMetas, devProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, meta, _iteratorNormalCompletion1, _didIteratorError1, _iteratorError1, _iterator1, _step1, subCmd;
|
|
202
|
-
return
|
|
23
|
+
return _ts_generator(this, function(_state) {
|
|
203
24
|
switch (_state.label) {
|
|
204
25
|
case 0:
|
|
205
26
|
runner = api.useHookRunners();
|
|
@@ -212,7 +33,7 @@ export var devCommand = function() {
|
|
|
212
33
|
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)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(function() {
|
|
213
34
|
var _ref2 = _async_to_generator(function(options) {
|
|
214
35
|
var dev;
|
|
215
|
-
return
|
|
36
|
+
return _ts_generator(this, function(_state2) {
|
|
216
37
|
switch (_state2.label) {
|
|
217
38
|
case 0:
|
|
218
39
|
return [
|
|
@@ -251,7 +72,7 @@ export var devCommand = function() {
|
|
|
251
72
|
devProgram.command(subCmd).action(/* @__PURE__ */ _async_to_generator(function() {
|
|
252
73
|
var options, appDirectory, isTypescript;
|
|
253
74
|
var _arguments = arguments;
|
|
254
|
-
return
|
|
75
|
+
return _ts_generator(this, function(_state2) {
|
|
255
76
|
switch (_state2.label) {
|
|
256
77
|
case 0:
|
|
257
78
|
options = _arguments.length > 0 && _arguments[0] !== void 0 ? _arguments[0] : {};
|
|
@@ -325,7 +146,7 @@ export var devCommand = function() {
|
|
|
325
146
|
export var buildCommand = function() {
|
|
326
147
|
var _ref = _async_to_generator(function(program, api) {
|
|
327
148
|
var runner, platformBuilders, buildProgram, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _loop, _iterator, _step;
|
|
328
|
-
return
|
|
149
|
+
return _ts_generator(this, function(_state) {
|
|
329
150
|
switch (_state.label) {
|
|
330
151
|
case 0:
|
|
331
152
|
runner = api.useHookRunners();
|
|
@@ -338,7 +159,7 @@ export var buildCommand = function() {
|
|
|
338
159
|
buildProgram = program.command("build").usage("[options]").description(i18n.t(localeKeys.command.build.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).action(function() {
|
|
339
160
|
var _ref2 = _async_to_generator(function(options) {
|
|
340
161
|
var build;
|
|
341
|
-
return
|
|
162
|
+
return _ts_generator(this, function(_state2) {
|
|
342
163
|
switch (_state2.label) {
|
|
343
164
|
case 0:
|
|
344
165
|
return [
|
|
@@ -374,7 +195,7 @@ export var buildCommand = function() {
|
|
|
374
195
|
var platform = _step1.value;
|
|
375
196
|
buildProgram.command(platform).action(/* @__PURE__ */ _async_to_generator(function() {
|
|
376
197
|
var appDirectory, isTypescript;
|
|
377
|
-
return
|
|
198
|
+
return _ts_generator(this, function(_state2) {
|
|
378
199
|
switch (_state2.label) {
|
|
379
200
|
case 0:
|
|
380
201
|
appDirectory = api.useAppContext().appDirectory;
|
|
@@ -480,10 +301,27 @@ export default function() {
|
|
|
480
301
|
locale: locale
|
|
481
302
|
});
|
|
482
303
|
return {
|
|
304
|
+
beforeConfig: function beforeConfig() {
|
|
305
|
+
return _async_to_generator(function() {
|
|
306
|
+
var _userConfig_output, userConfig, appContext;
|
|
307
|
+
return _ts_generator(this, function(_state) {
|
|
308
|
+
userConfig = api.useConfigContext();
|
|
309
|
+
appContext = api.useAppContext();
|
|
310
|
+
if ((_userConfig_output = userConfig.output) === null || _userConfig_output === void 0 ? void 0 : _userConfig_output.tempDir) {
|
|
311
|
+
api.setAppContext(_object_spread_props(_object_spread({}, appContext), {
|
|
312
|
+
internalDirectory: path.resolve(appContext.appDirectory, userConfig.output.tempDir)
|
|
313
|
+
}));
|
|
314
|
+
}
|
|
315
|
+
return [
|
|
316
|
+
2
|
|
317
|
+
];
|
|
318
|
+
});
|
|
319
|
+
})();
|
|
320
|
+
},
|
|
483
321
|
commands: function commands(param) {
|
|
484
322
|
var program = param.program;
|
|
485
323
|
return _async_to_generator(function() {
|
|
486
|
-
return
|
|
324
|
+
return _ts_generator(this, function(_state) {
|
|
487
325
|
switch (_state.label) {
|
|
488
326
|
case 0:
|
|
489
327
|
return [
|
|
@@ -500,7 +338,7 @@ export default function() {
|
|
|
500
338
|
_state.sent();
|
|
501
339
|
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__ */ _async_to_generator(function() {
|
|
502
340
|
var start;
|
|
503
|
-
return
|
|
341
|
+
return _ts_generator(this, function(_state2) {
|
|
504
342
|
switch (_state2.label) {
|
|
505
343
|
case 0:
|
|
506
344
|
return [
|
|
@@ -524,7 +362,7 @@ export default function() {
|
|
|
524
362
|
program.command("deploy").usage("[options]").option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).description(i18n.t(localeKeys.command.deploy.describe)).action(function() {
|
|
525
363
|
var _ref = _async_to_generator(function(options2) {
|
|
526
364
|
var build, deploy;
|
|
527
|
-
return
|
|
365
|
+
return _ts_generator(this, function(_state2) {
|
|
528
366
|
switch (_state2.label) {
|
|
529
367
|
case 0:
|
|
530
368
|
return [
|
|
@@ -565,7 +403,7 @@ export default function() {
|
|
|
565
403
|
program.command("new").usage("[options]").description(i18n.t(localeKeys.command.new.describe)).option("--lang <lang>", i18n.t(localeKeys.command.new.lang)).option("-c, --config <config>", i18n.t(localeKeys.command.new.config)).option("-d, --debug", i18n.t(localeKeys.command.new.debug), false).option("--dist-tag <tag>", i18n.t(localeKeys.command.new.distTag)).option("--registry", i18n.t(localeKeys.command.new.registry)).action(function() {
|
|
566
404
|
var _ref = _async_to_generator(function(options2) {
|
|
567
405
|
var MWANewAction;
|
|
568
|
-
return
|
|
406
|
+
return _ts_generator(this, function(_state2) {
|
|
569
407
|
switch (_state2.label) {
|
|
570
408
|
case 0:
|
|
571
409
|
return [
|
|
@@ -595,7 +433,7 @@ export default function() {
|
|
|
595
433
|
program.command("inspect").description("inspect the internal configs").option("--env <env>", i18n.t(localeKeys.command.inspect.env), "development").option("--output <output>", i18n.t(localeKeys.command.inspect.output), "/").option("--verbose", i18n.t(localeKeys.command.inspect.verbose)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).action(function() {
|
|
596
434
|
var _ref = _async_to_generator(function(options2) {
|
|
597
435
|
var inspect;
|
|
598
|
-
return
|
|
436
|
+
return _ts_generator(this, function(_state2) {
|
|
599
437
|
switch (_state2.label) {
|
|
600
438
|
case 0:
|
|
601
439
|
return [
|
|
@@ -626,7 +464,7 @@ export default function() {
|
|
|
626
464
|
prepare: function prepare() {
|
|
627
465
|
return _async_to_generator(function() {
|
|
628
466
|
var command, resolvedConfig, appContext;
|
|
629
|
-
return
|
|
467
|
+
return _ts_generator(this, function(_state) {
|
|
630
468
|
switch (_state.label) {
|
|
631
469
|
case 0:
|
|
632
470
|
command = getCommand();
|
|
@@ -660,7 +498,7 @@ export default function() {
|
|
|
660
498
|
watchFiles: function watchFiles() {
|
|
661
499
|
return _async_to_generator(function() {
|
|
662
500
|
var appContext, config;
|
|
663
|
-
return
|
|
501
|
+
return _ts_generator(this, function(_state) {
|
|
664
502
|
appContext = api.useAppContext();
|
|
665
503
|
config = api.useResolvedConfigContext();
|
|
666
504
|
return [
|
|
@@ -675,7 +513,7 @@ export default function() {
|
|
|
675
513
|
function fileChange(e) {
|
|
676
514
|
return _async_to_generator(function() {
|
|
677
515
|
var filename, eventType, appContext, appDirectory, srcDirectory, absolutePath, closeServer;
|
|
678
|
-
return
|
|
516
|
+
return _ts_generator(this, function(_state) {
|
|
679
517
|
switch (_state.label) {
|
|
680
518
|
case 0:
|
|
681
519
|
filename = e.filename, eventType = e.eventType;
|
|
@@ -717,7 +555,7 @@ export default function() {
|
|
|
717
555
|
),
|
|
718
556
|
beforeRestart: function beforeRestart() {
|
|
719
557
|
return _async_to_generator(function() {
|
|
720
|
-
return
|
|
558
|
+
return _ts_generator(this, function(_state) {
|
|
721
559
|
cleanRequireCache([
|
|
722
560
|
require.resolve("./analyze")
|
|
723
561
|
]);
|
|
@@ -1,186 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 _async_to_generator(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(void 0);
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
function _define_property(obj, key, value) {
|
|
31
|
-
if (key in obj) {
|
|
32
|
-
Object.defineProperty(obj, key, {
|
|
33
|
-
value: value,
|
|
34
|
-
enumerable: true,
|
|
35
|
-
configurable: true,
|
|
36
|
-
writable: true
|
|
37
|
-
});
|
|
38
|
-
} else {
|
|
39
|
-
obj[key] = value;
|
|
40
|
-
}
|
|
41
|
-
return obj;
|
|
42
|
-
}
|
|
43
|
-
function _object_spread(target) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
46
|
-
var ownKeys2 = Object.keys(source);
|
|
47
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
48
|
-
ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
49
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
ownKeys2.forEach(function(key) {
|
|
53
|
-
_define_property(target, key, source[key]);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return target;
|
|
57
|
-
}
|
|
58
|
-
function ownKeys(object, enumerableOnly) {
|
|
59
|
-
var keys = Object.keys(object);
|
|
60
|
-
if (Object.getOwnPropertySymbols) {
|
|
61
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
62
|
-
if (enumerableOnly) {
|
|
63
|
-
symbols = symbols.filter(function(sym) {
|
|
64
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
keys.push.apply(keys, symbols);
|
|
68
|
-
}
|
|
69
|
-
return keys;
|
|
70
|
-
}
|
|
71
|
-
function _object_spread_props(target, source) {
|
|
72
|
-
source = source != null ? source : {};
|
|
73
|
-
if (Object.getOwnPropertyDescriptors) {
|
|
74
|
-
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
75
|
-
} else {
|
|
76
|
-
ownKeys(Object(source)).forEach(function(key) {
|
|
77
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
return target;
|
|
81
|
-
}
|
|
82
|
-
var __generator = function(thisArg, body) {
|
|
83
|
-
var f, y, t, g, _ = {
|
|
84
|
-
label: 0,
|
|
85
|
-
sent: function() {
|
|
86
|
-
if (t[0] & 1)
|
|
87
|
-
throw t[1];
|
|
88
|
-
return t[1];
|
|
89
|
-
},
|
|
90
|
-
trys: [],
|
|
91
|
-
ops: []
|
|
92
|
-
};
|
|
93
|
-
return g = {
|
|
94
|
-
next: verb(0),
|
|
95
|
-
"throw": verb(1),
|
|
96
|
-
"return": verb(2)
|
|
97
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
98
|
-
return this;
|
|
99
|
-
}), g;
|
|
100
|
-
function verb(n) {
|
|
101
|
-
return function(v) {
|
|
102
|
-
return step([
|
|
103
|
-
n,
|
|
104
|
-
v
|
|
105
|
-
]);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
function step(op) {
|
|
109
|
-
if (f)
|
|
110
|
-
throw new TypeError("Generator is already executing.");
|
|
111
|
-
while (_)
|
|
112
|
-
try {
|
|
113
|
-
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)
|
|
114
|
-
return t;
|
|
115
|
-
if (y = 0, t)
|
|
116
|
-
op = [
|
|
117
|
-
op[0] & 2,
|
|
118
|
-
t.value
|
|
119
|
-
];
|
|
120
|
-
switch (op[0]) {
|
|
121
|
-
case 0:
|
|
122
|
-
case 1:
|
|
123
|
-
t = op;
|
|
124
|
-
break;
|
|
125
|
-
case 4:
|
|
126
|
-
_.label++;
|
|
127
|
-
return {
|
|
128
|
-
value: op[1],
|
|
129
|
-
done: false
|
|
130
|
-
};
|
|
131
|
-
case 5:
|
|
132
|
-
_.label++;
|
|
133
|
-
y = op[1];
|
|
134
|
-
op = [
|
|
135
|
-
0
|
|
136
|
-
];
|
|
137
|
-
continue;
|
|
138
|
-
case 7:
|
|
139
|
-
op = _.ops.pop();
|
|
140
|
-
_.trys.pop();
|
|
141
|
-
continue;
|
|
142
|
-
default:
|
|
143
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
144
|
-
_ = 0;
|
|
145
|
-
continue;
|
|
146
|
-
}
|
|
147
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
148
|
-
_.label = op[1];
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
152
|
-
_.label = t[1];
|
|
153
|
-
t = op;
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
if (t && _.label < t[2]) {
|
|
157
|
-
_.label = t[2];
|
|
158
|
-
_.ops.push(op);
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
if (t[2])
|
|
162
|
-
_.ops.pop();
|
|
163
|
-
_.trys.pop();
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
op = body.call(thisArg, _);
|
|
167
|
-
} catch (e) {
|
|
168
|
-
op = [
|
|
169
|
-
6,
|
|
170
|
-
e
|
|
171
|
-
];
|
|
172
|
-
y = 0;
|
|
173
|
-
} finally {
|
|
174
|
-
f = t = 0;
|
|
175
|
-
}
|
|
176
|
-
if (op[0] & 5)
|
|
177
|
-
throw op[1];
|
|
178
|
-
return {
|
|
179
|
-
value: op[0] ? op[1] : void 0,
|
|
180
|
-
done: true
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
};
|
|
1
|
+
import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
+
import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
|
|
3
|
+
import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
|
|
4
|
+
import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
|
|
184
5
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
185
6
|
import { legacySchema, schema } from "../schema";
|
|
186
7
|
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
|
|
@@ -217,7 +38,7 @@ export default function(param) {
|
|
|
217
38
|
var resolved = param2.resolved;
|
|
218
39
|
return _async_to_generator(function() {
|
|
219
40
|
var _resolved_output_distPath, appContext, userConfig, port, normalizedConfig, _normalizedConfig_autoLoadPlugins;
|
|
220
|
-
return
|
|
41
|
+
return _ts_generator(this, function(_state) {
|
|
221
42
|
switch (_state.label) {
|
|
222
43
|
case 0:
|
|
223
44
|
appContext = api.useAppContext();
|
|
@@ -284,7 +105,7 @@ function getServerPort(config) {
|
|
|
284
105
|
function _getServerPort() {
|
|
285
106
|
_getServerPort = _async_to_generator(function(config) {
|
|
286
107
|
var prodPort;
|
|
287
|
-
return
|
|
108
|
+
return _ts_generator(this, function(_state) {
|
|
288
109
|
prodPort = Number(process.env.PORT) || config.server.port || 8080;
|
|
289
110
|
if (isDev() && isDevCommand()) {
|
|
290
111
|
return [
|