@umijs/utils 4.0.66 → 4.0.67

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.
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/BaseGenerator/generateFile.ts
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/getDevBanner.ts
@@ -32,34 +29,26 @@ var import_address = __toESM(require("../compiled/address"));
32
29
  var import_chalk = __toESM(require("../compiled/chalk"));
33
30
  var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
34
31
  var BORDERS = {
35
- TL: import_chalk.default.gray.dim(""),
36
- TR: import_chalk.default.gray.dim(""),
37
- BL: import_chalk.default.gray.dim(""),
38
- BR: import_chalk.default.gray.dim(""),
39
- V: import_chalk.default.gray.dim(""),
40
- H_PURE: ""
32
+ TL: import_chalk.default.gray.dim("\u2554"),
33
+ TR: import_chalk.default.gray.dim("\u2557"),
34
+ BL: import_chalk.default.gray.dim("\u255A"),
35
+ BR: import_chalk.default.gray.dim("\u255D"),
36
+ V: import_chalk.default.gray.dim("\u2551"),
37
+ H_PURE: "\u2550"
41
38
  };
42
39
  function getDevBanner(protocol, host = "0.0.0.0", port, offset = 8) {
43
40
  const header = " App listening at:";
44
- const footer = import_chalk.default.bold(
45
- " Now you can open browser with the above addresses↑ "
46
- );
47
- const local = ` ${import_chalk.default.gray(">")} Local: ${import_chalk.default.green(
48
- `${protocol}//${host === "0.0.0.0" ? "localhost" : host}:${port}`
49
- )} `;
41
+ const footer = import_chalk.default.bold(" Now you can open browser with the above addresses\u2191 ");
42
+ const local = ` ${import_chalk.default.gray(">")} Local: ${import_chalk.default.green(`${protocol}//${host === "0.0.0.0" ? "localhost" : host}:${port}`)} `;
50
43
  const ip = import_address.default.ip();
51
44
  const network = ` ${import_chalk.default.gray(">")} Network: ${ip ? import_chalk.default.green(`${protocol}//${ip}:${port}`) : import_chalk.default.gray("Not available")} `;
52
- const maxLen = Math.max(
53
- ...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length)
54
- );
45
+ const maxLen = Math.max(...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length));
55
46
  const beforeLines = [
56
47
  `${BORDERS.TL}${import_chalk.default.gray.dim("".padStart(maxLen, BORDERS.H_PURE))}${BORDERS.TR}`,
57
48
  `${BORDERS.V}${header}${"".padStart(maxLen - header.length)}${BORDERS.V}`,
58
49
  `${BORDERS.V}${local}${"".padStart(maxLen - (0, import_strip_ansi.default)(local).length)}${BORDERS.V}`
59
50
  ];
60
- const mainLine = `${BORDERS.V}${network}${"".padStart(
61
- maxLen - (0, import_strip_ansi.default)(network).length
62
- )}${BORDERS.V}`;
51
+ const mainLine = `${BORDERS.V}${network}${"".padStart(maxLen - (0, import_strip_ansi.default)(network).length)}${BORDERS.V}`;
63
52
  const afterLines = [
64
53
  `${BORDERS.V}${"".padStart(maxLen)}${BORDERS.V}`,
65
54
  `${BORDERS.V}${footer}${"".padStart(maxLen - (0, import_strip_ansi.default)(footer).length)}${BORDERS.V}`,
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/getGitInfo.ts
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/importLazy.ts
@@ -30,9 +27,7 @@ __export(importLazy_exports, {
30
27
  module.exports = __toCommonJS(importLazy_exports);
31
28
  var import_import_lazy = __toESM(require("../compiled/import-lazy"));
32
29
  function importLazy(moduleName, requireFn) {
33
- const importLazyLocal = (0, import_import_lazy.default)(
34
- requireFn || require
35
- );
30
+ const importLazyLocal = (0, import_import_lazy.default)(requireFn || require);
36
31
  return importLazyLocal(moduleName);
37
32
  }
38
33
  // Annotate the CommonJS export names for ESM import in node:
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/installDeps.ts
@@ -43,18 +40,15 @@ function installDeps({
43
40
  const devTag = useYarn || usePnpm ? "--D" : "--save-dev";
44
41
  const installDependencies = (deps, npmStr, insStr, devStr) => {
45
42
  console.log(`${npmStr} install dependencies packages:${deps.join(" ")}`);
46
- execa.execaCommandSync(
47
- [npmStr, insStr, devStr].concat(deps).filter((n) => n).join(" "),
48
- {
49
- encoding: "utf8",
50
- cwd,
51
- env: {
52
- ...process.env
53
- },
54
- stderr: "pipe",
55
- stdout: "pipe"
56
- }
57
- );
43
+ execa.execaCommandSync([npmStr, insStr, devStr].concat(deps).filter((n) => n).join(" "), {
44
+ encoding: "utf8",
45
+ cwd,
46
+ env: {
47
+ ...process.env
48
+ },
49
+ stderr: "pipe",
50
+ stdout: "pipe"
51
+ });
58
52
  console.log(`install dependencies packages success`);
59
53
  };
60
54
  if (dependencies) {
package/dist/npmClient.js CHANGED
@@ -17,6 +17,10 @@ var __copyProps = (to, from, except, desc) => {
17
17
  return to;
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
24
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
25
  mod
22
26
  ));
@@ -16,10 +16,7 @@ var __copyProps = (to, from, except, desc) => {
16
16
  }
17
17
  return to;
18
18
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
21
- mod
22
- ));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
23
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
21
 
25
22
  // src/randomColor/randomColor.ts
package/dist/register.js CHANGED
@@ -42,6 +42,8 @@ function transform(opts) {
42
42
  return implementor.transformSync(code, {
43
43
  sourcefile: filename,
44
44
  loader: ext.slice(1),
45
+ // consistent with `tsconfig.base.json`
46
+ // https://github.com/umijs/umi-next/pull/729
45
47
  target: "es2019",
46
48
  format: "cjs",
47
49
  logLevel: "error"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.66",
3
+ "version": "4.0.67",
4
4
  "homepage": "https://github.com/umijs/umi/tree/master/packages/utils#readme",
5
5
  "bugs": "https://github.com/umijs/umi/issues",
6
6
  "repository": {