umi 4.0.53 → 4.0.54
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/client/client/plugin.js +77 -81
- package/dist/cli/cli.js +3 -1
- package/dist/cli/node.d.ts +1 -0
- package/dist/cli/node.js +12 -3
- package/package.json +13 -13
package/client/client/plugin.js
CHANGED
|
@@ -85,52 +85,50 @@ export var PluginManager = /*#__PURE__*/function () {
|
|
|
85
85
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(memo, hook) {
|
|
86
86
|
var ret;
|
|
87
87
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
88
|
-
while (1) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
_context.next = 5;
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
_context.next = 4;
|
|
97
|
-
return memo;
|
|
98
|
-
case 4:
|
|
99
|
-
memo = _context.sent;
|
|
100
|
-
case 5:
|
|
101
|
-
if (!(typeof hook === 'function')) {
|
|
102
|
-
_context.next = 16;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
ret = hook(memo, args);
|
|
106
|
-
if (!isPromiseLike(ret)) {
|
|
107
|
-
_context.next = 13;
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
_context.next = 10;
|
|
111
|
-
return ret;
|
|
112
|
-
case 10:
|
|
113
|
-
return _context.abrupt("return", _context.sent);
|
|
114
|
-
case 13:
|
|
115
|
-
return _context.abrupt("return", ret);
|
|
116
|
-
case 14:
|
|
117
|
-
_context.next = 21;
|
|
88
|
+
while (1) switch (_context.prev = _context.next) {
|
|
89
|
+
case 0:
|
|
90
|
+
assert(typeof hook === 'function' || _typeof(hook) === 'object' || isPromiseLike(hook), "applyPlugins failed, all hooks for key ".concat(key, " must be function, plain object or Promise."));
|
|
91
|
+
if (!isPromiseLike(memo)) {
|
|
92
|
+
_context.next = 5;
|
|
118
93
|
break;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
94
|
+
}
|
|
95
|
+
_context.next = 4;
|
|
96
|
+
return memo;
|
|
97
|
+
case 4:
|
|
98
|
+
memo = _context.sent;
|
|
99
|
+
case 5:
|
|
100
|
+
if (!(typeof hook === 'function')) {
|
|
101
|
+
_context.next = 16;
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
ret = hook(memo, args);
|
|
105
|
+
if (!isPromiseLike(ret)) {
|
|
106
|
+
_context.next = 13;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
_context.next = 10;
|
|
110
|
+
return ret;
|
|
111
|
+
case 10:
|
|
112
|
+
return _context.abrupt("return", _context.sent);
|
|
113
|
+
case 13:
|
|
114
|
+
return _context.abrupt("return", ret);
|
|
115
|
+
case 14:
|
|
116
|
+
_context.next = 21;
|
|
117
|
+
break;
|
|
118
|
+
case 16:
|
|
119
|
+
if (!isPromiseLike(hook)) {
|
|
120
|
+
_context.next = 20;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
_context.next = 19;
|
|
124
|
+
return hook;
|
|
125
|
+
case 19:
|
|
126
|
+
hook = _context.sent;
|
|
127
|
+
case 20:
|
|
128
|
+
return _context.abrupt("return", _objectSpread(_objectSpread({}, memo), hook));
|
|
129
|
+
case 21:
|
|
130
|
+
case "end":
|
|
131
|
+
return _context.stop();
|
|
134
132
|
}
|
|
135
133
|
}, _callee);
|
|
136
134
|
}));
|
|
@@ -153,44 +151,42 @@ export var PluginManager = /*#__PURE__*/function () {
|
|
|
153
151
|
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
154
152
|
var _iterator2, _step2, hook, ret;
|
|
155
153
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
156
|
-
while (1) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
_context2.next = 12;
|
|
165
|
-
break;
|
|
166
|
-
}
|
|
167
|
-
hook = _step2.value;
|
|
168
|
-
assert(typeof hook === 'function', "applyPlugins failed, all hooks for key ".concat(key, " must be function."));
|
|
169
|
-
ret = hook(args);
|
|
170
|
-
if (!(async && isPromiseLike(ret))) {
|
|
171
|
-
_context2.next = 10;
|
|
172
|
-
break;
|
|
173
|
-
}
|
|
174
|
-
_context2.next = 10;
|
|
175
|
-
return ret;
|
|
176
|
-
case 10:
|
|
177
|
-
_context2.next = 3;
|
|
154
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
155
|
+
case 0:
|
|
156
|
+
_iterator2 = _createForOfIteratorHelper(hooks);
|
|
157
|
+
_context2.prev = 1;
|
|
158
|
+
_iterator2.s();
|
|
159
|
+
case 3:
|
|
160
|
+
if ((_step2 = _iterator2.n()).done) {
|
|
161
|
+
_context2.next = 12;
|
|
178
162
|
break;
|
|
179
|
-
|
|
180
|
-
|
|
163
|
+
}
|
|
164
|
+
hook = _step2.value;
|
|
165
|
+
assert(typeof hook === 'function', "applyPlugins failed, all hooks for key ".concat(key, " must be function."));
|
|
166
|
+
ret = hook(args);
|
|
167
|
+
if (!(async && isPromiseLike(ret))) {
|
|
168
|
+
_context2.next = 10;
|
|
181
169
|
break;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
170
|
+
}
|
|
171
|
+
_context2.next = 10;
|
|
172
|
+
return ret;
|
|
173
|
+
case 10:
|
|
174
|
+
_context2.next = 3;
|
|
175
|
+
break;
|
|
176
|
+
case 12:
|
|
177
|
+
_context2.next = 17;
|
|
178
|
+
break;
|
|
179
|
+
case 14:
|
|
180
|
+
_context2.prev = 14;
|
|
181
|
+
_context2.t0 = _context2["catch"](1);
|
|
182
|
+
_iterator2.e(_context2.t0);
|
|
183
|
+
case 17:
|
|
184
|
+
_context2.prev = 17;
|
|
185
|
+
_iterator2.f();
|
|
186
|
+
return _context2.finish(17);
|
|
187
|
+
case 20:
|
|
188
|
+
case "end":
|
|
189
|
+
return _context2.stop();
|
|
194
190
|
}
|
|
195
191
|
}, _callee2, null, [[1, 14, 17, 20]]);
|
|
196
192
|
}))();
|
package/dist/cli/cli.js
CHANGED
|
@@ -27,6 +27,7 @@ var import_constants = require("../constants");
|
|
|
27
27
|
var import_service = require("../service/service");
|
|
28
28
|
var import_dev = require("./dev");
|
|
29
29
|
var import_node = require("./node");
|
|
30
|
+
(0, import_node.catchUnhandledRejection)();
|
|
30
31
|
async function run(opts) {
|
|
31
32
|
(0, import_node.checkVersion)();
|
|
32
33
|
(0, import_node.checkLocal)();
|
|
@@ -40,7 +41,8 @@ async function run(opts) {
|
|
|
40
41
|
boolean: ["version"]
|
|
41
42
|
});
|
|
42
43
|
const command = args._[0];
|
|
43
|
-
|
|
44
|
+
const FEATURE_COMMANDS = ["mfsu", "setup", "deadcode"];
|
|
45
|
+
if ([import_constants.DEV_COMMAND, ...FEATURE_COMMANDS].includes(command)) {
|
|
44
46
|
process.env.NODE_ENV = "development";
|
|
45
47
|
} else if (command === "build") {
|
|
46
48
|
process.env.NODE_ENV = "production";
|
package/dist/cli/node.d.ts
CHANGED
package/dist/cli/node.js
CHANGED
|
@@ -19,6 +19,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/cli/node.ts
|
|
20
20
|
var node_exports = {};
|
|
21
21
|
__export(node_exports, {
|
|
22
|
+
catchUnhandledRejection: () => catchUnhandledRejection,
|
|
22
23
|
checkLocal: () => checkLocal,
|
|
23
24
|
checkVersion: () => checkVersion,
|
|
24
25
|
setNodeTitle: () => setNodeTitle
|
|
@@ -26,11 +27,11 @@ __export(node_exports, {
|
|
|
26
27
|
module.exports = __toCommonJS(node_exports);
|
|
27
28
|
var import_utils = require("@umijs/utils");
|
|
28
29
|
var import_constants = require("../constants");
|
|
30
|
+
var ver = parseInt(process.version.slice(1));
|
|
29
31
|
function checkVersion() {
|
|
30
|
-
|
|
31
|
-
if (v < import_constants.MIN_NODE_VERSION || v === 15 || v === 17) {
|
|
32
|
+
if (ver < import_constants.MIN_NODE_VERSION || ver === 15 || ver === 17) {
|
|
32
33
|
import_utils.logger.error(
|
|
33
|
-
`Your node version ${
|
|
34
|
+
`Your node version ${ver} is not supported, please upgrade to ${import_constants.MIN_NODE_VERSION} or above except 15 or 17.`
|
|
34
35
|
);
|
|
35
36
|
process.exit(1);
|
|
36
37
|
}
|
|
@@ -45,8 +46,16 @@ function setNodeTitle(name) {
|
|
|
45
46
|
process.title = name || import_constants.FRAMEWORK_NAME;
|
|
46
47
|
}
|
|
47
48
|
}
|
|
49
|
+
function catchUnhandledRejection() {
|
|
50
|
+
if (ver <= 14) {
|
|
51
|
+
process.on("unhandledRejection", (err) => {
|
|
52
|
+
throw err;
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
48
56
|
// Annotate the CommonJS export names for ESM import in node:
|
|
49
57
|
0 && (module.exports = {
|
|
58
|
+
catchUnhandledRejection,
|
|
50
59
|
checkLocal,
|
|
51
60
|
checkVersion,
|
|
52
61
|
setNodeTitle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.54",
|
|
4
4
|
"description": "umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -37,18 +37,18 @@
|
|
|
37
37
|
"test": "umi-scripts jest-turbo"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@babel/runtime": "7.
|
|
41
|
-
"@umijs/bundler-utils": "4.0.
|
|
42
|
-
"@umijs/bundler-webpack": "4.0.
|
|
43
|
-
"@umijs/core": "4.0.
|
|
44
|
-
"@umijs/lint": "4.0.
|
|
45
|
-
"@umijs/preset-umi": "4.0.
|
|
46
|
-
"@umijs/renderer-react": "4.0.
|
|
47
|
-
"@umijs/server": "4.0.
|
|
48
|
-
"@umijs/test": "4.0.
|
|
49
|
-
"@umijs/utils": "4.0.
|
|
50
|
-
"prettier-plugin-organize-imports": "^3.2.
|
|
51
|
-
"prettier-plugin-packagejson": "2.3
|
|
40
|
+
"@babel/runtime": "7.21.0",
|
|
41
|
+
"@umijs/bundler-utils": "4.0.54",
|
|
42
|
+
"@umijs/bundler-webpack": "4.0.54",
|
|
43
|
+
"@umijs/core": "4.0.54",
|
|
44
|
+
"@umijs/lint": "4.0.54",
|
|
45
|
+
"@umijs/preset-umi": "4.0.54",
|
|
46
|
+
"@umijs/renderer-react": "4.0.54",
|
|
47
|
+
"@umijs/server": "4.0.54",
|
|
48
|
+
"@umijs/test": "4.0.54",
|
|
49
|
+
"@umijs/utils": "4.0.54",
|
|
50
|
+
"prettier-plugin-organize-imports": "^3.2.2",
|
|
51
|
+
"prettier-plugin-packagejson": "2.4.3"
|
|
52
52
|
},
|
|
53
53
|
"engines": {
|
|
54
54
|
"node": ">=14"
|