@umijs/utils 4.0.0-canary.20230427.1 → 4.0.0-canary.20230510.1

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.
@@ -16,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // 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,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // src/getDevBanner.ts
@@ -29,26 +36,34 @@ var import_address = __toESM(require("../compiled/address"));
29
36
  var import_chalk = __toESM(require("../compiled/chalk"));
30
37
  var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
31
38
  var BORDERS = {
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"
39
+ TL: import_chalk.default.gray.dim(""),
40
+ TR: import_chalk.default.gray.dim(""),
41
+ BL: import_chalk.default.gray.dim(""),
42
+ BR: import_chalk.default.gray.dim(""),
43
+ V: import_chalk.default.gray.dim(""),
44
+ H_PURE: ""
38
45
  };
39
46
  function getDevBanner(protocol, host = "0.0.0.0", port, offset = 8) {
40
47
  const header = " App listening at:";
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}`)} `;
48
+ const footer = import_chalk.default.bold(
49
+ " Now you can open browser with the above addresses↑ "
50
+ );
51
+ const local = ` ${import_chalk.default.gray(">")} Local: ${import_chalk.default.green(
52
+ `${protocol}//${host === "0.0.0.0" ? "localhost" : host}:${port}`
53
+ )} `;
43
54
  const ip = import_address.default.ip();
44
55
  const network = ` ${import_chalk.default.gray(">")} Network: ${ip ? import_chalk.default.green(`${protocol}//${ip}:${port}`) : import_chalk.default.gray("Not available")} `;
45
- const maxLen = Math.max(...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length));
56
+ const maxLen = Math.max(
57
+ ...[header, footer, local, network].map((x) => (0, import_strip_ansi.default)(x).length)
58
+ );
46
59
  const beforeLines = [
47
60
  `${BORDERS.TL}${import_chalk.default.gray.dim("".padStart(maxLen, BORDERS.H_PURE))}${BORDERS.TR}`,
48
61
  `${BORDERS.V}${header}${"".padStart(maxLen - header.length)}${BORDERS.V}`,
49
62
  `${BORDERS.V}${local}${"".padStart(maxLen - (0, import_strip_ansi.default)(local).length)}${BORDERS.V}`
50
63
  ];
51
- const mainLine = `${BORDERS.V}${network}${"".padStart(maxLen - (0, import_strip_ansi.default)(network).length)}${BORDERS.V}`;
64
+ const mainLine = `${BORDERS.V}${network}${"".padStart(
65
+ maxLen - (0, import_strip_ansi.default)(network).length
66
+ )}${BORDERS.V}`;
52
67
  const afterLines = [
53
68
  `${BORDERS.V}${"".padStart(maxLen)}${BORDERS.V}`,
54
69
  `${BORDERS.V}${footer}${"".padStart(maxLen - (0, import_strip_ansi.default)(footer).length)}${BORDERS.V}`,
@@ -16,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // src/getGitInfo.ts
@@ -16,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // src/importLazy.ts
@@ -27,7 +34,9 @@ __export(importLazy_exports, {
27
34
  module.exports = __toCommonJS(importLazy_exports);
28
35
  var import_import_lazy = __toESM(require("../compiled/import-lazy"));
29
36
  function importLazy(moduleName, requireFn) {
30
- const importLazyLocal = (0, import_import_lazy.default)(requireFn || require);
37
+ const importLazyLocal = (0, import_import_lazy.default)(
38
+ requireFn || require
39
+ );
31
40
  return importLazyLocal(moduleName);
32
41
  }
33
42
  // Annotate the CommonJS export names for ESM import in node:
@@ -16,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // src/installDeps.ts
@@ -40,15 +47,18 @@ function installDeps({
40
47
  const devTag = useYarn || usePnpm ? "--D" : "--save-dev";
41
48
  const installDependencies = (deps, npmStr, insStr, devStr) => {
42
49
  console.log(`${npmStr} install dependencies packages:${deps.join(" ")}`);
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
- });
50
+ execa.execaCommandSync(
51
+ [npmStr, insStr, devStr].concat(deps).filter((n) => n).join(" "),
52
+ {
53
+ encoding: "utf8",
54
+ cwd,
55
+ env: {
56
+ ...process.env
57
+ },
58
+ stderr: "pipe",
59
+ stdout: "pipe"
60
+ }
61
+ );
52
62
  console.log(`install dependencies packages success`);
53
63
  };
54
64
  if (dependencies) {
@@ -35,7 +35,8 @@ function isMonorepo(opts) {
35
35
  const pkgExist = (0, import_fs.existsSync)(pkgPath);
36
36
  return pkgExist && (MONOREPO_FILE.some((file) => {
37
37
  return (0, import_fs.existsSync)((0, import_path.join)(opts.root, file));
38
- }) || (pkg == null ? void 0 : pkg.workspaces));
38
+ }) || // npm workspaces
39
+ (pkg == null ? void 0 : pkg.workspaces));
39
40
  }
40
41
  // Annotate the CommonJS export names for ESM import in node:
41
42
  0 && (module.exports = {
@@ -16,7 +16,14 @@ 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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
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.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
20
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
28
 
22
29
  // src/randomColor/randomColor.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/utils",
3
- "version": "4.0.0-canary.20230427.1",
3
+ "version": "4.0.0-canary.20230510.1",
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": {