umi 4.0.32 → 4.0.34

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.
@@ -1,12 +1,12 @@
1
- import _regeneratorRuntime from "@babel/runtime/helpers/regeneratorRuntime";
2
- import _objectSpread from "@babel/runtime/helpers/objectSpread2";
3
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
4
- import _typeof from "@babel/runtime/helpers/typeof";
5
- import _createForOfIteratorHelper from "@babel/runtime/helpers/createForOfIteratorHelper";
6
- import _toArray from "@babel/runtime/helpers/toArray";
7
- import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
8
- import _createClass from "@babel/runtime/helpers/createClass";
9
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
5
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
6
+ import _toArray from "@babel/runtime/helpers/esm/toArray";
7
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
8
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
9
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
10
  import { assert, compose, isPromiseLike } from "./utils";
11
11
  export var ApplyPluginsType;
12
12
 
@@ -1,4 +1,4 @@
1
- import _typeof from "@babel/runtime/helpers/typeof";
1
+ import _typeof from "@babel/runtime/helpers/esm/typeof";
2
2
  export function assert(value, message) {
3
3
  if (!value) throw new Error(message);
4
4
  }
package/dist/cli/fork.js CHANGED
@@ -23,6 +23,7 @@ __export(fork_exports, {
23
23
  });
24
24
  module.exports = __toCommonJS(fork_exports);
25
25
  var import_child_process = require("child_process");
26
+ var import_utils = require("@umijs/utils");
26
27
  var usedPorts = [];
27
28
  function start({ scriptPath }) {
28
29
  const execArgv = process.execArgv.slice(0);
@@ -50,13 +51,36 @@ function start({ scriptPath }) {
50
51
  if (type === "RESTART") {
51
52
  child.kill();
52
53
  if (payload == null ? void 0 : payload.port) {
53
- process.env.PORT = payload.port;
54
+ utilPortValid(payload.port, 20, () => {
55
+ process.env.PORT = payload.port;
56
+ start({ scriptPath });
57
+ });
58
+ } else {
59
+ start({ scriptPath });
54
60
  }
55
- start({ scriptPath });
56
61
  }
57
62
  (_a = process.send) == null ? void 0 : _a.call(process, data);
58
63
  });
59
64
  return child;
60
65
  }
66
+ function utilPortValid(port, totalTry, callback) {
67
+ import_utils.portfinder.getPort({ startPort: port }, (err, findPort) => {
68
+ if (err)
69
+ callback(err);
70
+ else {
71
+ if (findPort === port) {
72
+ callback();
73
+ } else {
74
+ if (totalTry > 0) {
75
+ setTimeout(() => {
76
+ utilPortValid(port, totalTry - 1, callback);
77
+ }, 100);
78
+ } else {
79
+ callback(new Error(`Port ${port} is occupied`));
80
+ }
81
+ }
82
+ }
83
+ });
84
+ }
61
85
  // Annotate the CommonJS export names for ESM import in node:
62
86
  0 && (module.exports = {});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umi",
3
- "version": "4.0.32",
3
+ "version": "4.0.34",
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",
@@ -38,15 +38,15 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@babel/runtime": "7.18.9",
41
- "@umijs/bundler-utils": "4.0.32",
42
- "@umijs/bundler-webpack": "4.0.32",
43
- "@umijs/core": "4.0.32",
44
- "@umijs/lint": "4.0.32",
45
- "@umijs/preset-umi": "4.0.32",
46
- "@umijs/renderer-react": "4.0.32",
47
- "@umijs/server": "4.0.32",
48
- "@umijs/test": "4.0.32",
49
- "@umijs/utils": "4.0.32",
41
+ "@umijs/bundler-utils": "4.0.34",
42
+ "@umijs/bundler-webpack": "4.0.34",
43
+ "@umijs/core": "4.0.34",
44
+ "@umijs/lint": "4.0.34",
45
+ "@umijs/preset-umi": "4.0.34",
46
+ "@umijs/renderer-react": "4.0.34",
47
+ "@umijs/server": "4.0.34",
48
+ "@umijs/test": "4.0.34",
49
+ "@umijs/utils": "4.0.34",
50
50
  "prettier-plugin-organize-imports": "^2.3.4",
51
51
  "prettier-plugin-packagejson": "^2.2.17"
52
52
  },