umi 4.0.53 → 4.0.55

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.
@@ -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
- switch (_context.prev = _context.next) {
90
- case 0:
91
- assert(typeof hook === 'function' || _typeof(hook) === 'object' || isPromiseLike(hook), "applyPlugins failed, all hooks for key ".concat(key, " must be function, plain object or Promise."));
92
- if (!isPromiseLike(memo)) {
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
- case 16:
120
- if (!isPromiseLike(hook)) {
121
- _context.next = 20;
122
- break;
123
- }
124
- _context.next = 19;
125
- return hook;
126
- case 19:
127
- hook = _context.sent;
128
- case 20:
129
- return _context.abrupt("return", _objectSpread(_objectSpread({}, memo), hook));
130
- case 21:
131
- case "end":
132
- return _context.stop();
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
- switch (_context2.prev = _context2.next) {
158
- case 0:
159
- _iterator2 = _createForOfIteratorHelper(hooks);
160
- _context2.prev = 1;
161
- _iterator2.s();
162
- case 3:
163
- if ((_step2 = _iterator2.n()).done) {
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
- case 12:
180
- _context2.next = 17;
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
- case 14:
183
- _context2.prev = 14;
184
- _context2.t0 = _context2["catch"](1);
185
- _iterator2.e(_context2.t0);
186
- case 17:
187
- _context2.prev = 17;
188
- _iterator2.f();
189
- return _context2.finish(17);
190
- case 20:
191
- case "end":
192
- return _context2.stop();
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
- if ([import_constants.DEV_COMMAND, "mfsu", "setup"].includes(command)) {
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";
@@ -1,3 +1,4 @@
1
1
  export declare function checkVersion(): void;
2
2
  export declare function checkLocal(): void;
3
3
  export declare function setNodeTitle(name?: string): void;
4
+ export declare function catchUnhandledRejection(): void;
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
- const v = parseInt(process.version.slice(1));
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 ${v} is not supported, please upgrade to ${import_constants.MIN_NODE_VERSION} or above except 15 or 17.`
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.53",
3
+ "version": "4.0.55",
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.20.7",
41
- "@umijs/bundler-utils": "4.0.53",
42
- "@umijs/bundler-webpack": "4.0.53",
43
- "@umijs/core": "4.0.53",
44
- "@umijs/lint": "4.0.53",
45
- "@umijs/preset-umi": "4.0.53",
46
- "@umijs/renderer-react": "4.0.53",
47
- "@umijs/server": "4.0.53",
48
- "@umijs/test": "4.0.53",
49
- "@umijs/utils": "4.0.53",
50
- "prettier-plugin-organize-imports": "^3.2.1",
51
- "prettier-plugin-packagejson": "2.3.0"
40
+ "@babel/runtime": "7.21.0",
41
+ "@umijs/bundler-utils": "4.0.55",
42
+ "@umijs/bundler-webpack": "4.0.55",
43
+ "@umijs/core": "4.0.55",
44
+ "@umijs/lint": "4.0.55",
45
+ "@umijs/preset-umi": "4.0.55",
46
+ "@umijs/renderer-react": "4.0.55",
47
+ "@umijs/server": "4.0.55",
48
+ "@umijs/test": "4.0.55",
49
+ "@umijs/utils": "4.0.55",
50
+ "prettier-plugin-organize-imports": "^3.2.2",
51
+ "prettier-plugin-packagejson": "2.4.3"
52
52
  },
53
53
  "engines": {
54
54
  "node": ">=14"