@modern-js/utils 2.35.1 → 2.36.0

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.
Files changed (116) hide show
  1. package/dist/cjs/cli/alias.js +45 -46
  2. package/dist/cjs/cli/applyOptionsChain.js +30 -13
  3. package/dist/cjs/cli/babel.js +36 -26
  4. package/dist/cjs/cli/commands.js +29 -21
  5. package/dist/cjs/cli/common.js +29 -20
  6. package/dist/cjs/cli/config.js +24 -7
  7. package/dist/cjs/cli/constants/chainId.js +24 -7
  8. package/dist/cjs/cli/constants/index.js +86 -104
  9. package/dist/cjs/cli/ensure.js +37 -18
  10. package/dist/cjs/cli/fs.js +29 -19
  11. package/dist/cjs/cli/get/config.js +26 -9
  12. package/dist/cjs/cli/get/data.js +67 -54
  13. package/dist/cjs/cli/get/index.js +46 -25
  14. package/dist/cjs/cli/index.js +58 -23
  15. package/dist/cjs/cli/is/config.js +37 -31
  16. package/dist/cjs/cli/is/env.js +32 -29
  17. package/dist/cjs/cli/is/index.js +26 -8
  18. package/dist/cjs/cli/is/project.js +67 -53
  19. package/dist/cjs/cli/is/type.js +39 -36
  20. package/dist/cjs/cli/logger.js +25 -130
  21. package/dist/cjs/cli/monorepo.js +58 -58
  22. package/dist/cjs/cli/package.js +34 -26
  23. package/dist/cjs/cli/path.js +64 -54
  24. package/dist/cjs/cli/port.js +39 -13
  25. package/dist/cjs/cli/prettyInstructions.js +48 -29
  26. package/dist/cjs/cli/require.js +35 -29
  27. package/dist/cjs/cli/runtimeExports.js +42 -16
  28. package/dist/cjs/cli/watch.js +41 -22
  29. package/dist/cjs/compiled.js +127 -138
  30. package/dist/cjs/import.js +25 -15
  31. package/dist/cjs/index.js +24 -6
  32. package/dist/cjs/universal/constants.js +29 -21
  33. package/dist/cjs/universal/formatWebpack.js +25 -15
  34. package/dist/cjs/universal/pluginDagSort.js +25 -8
  35. package/dist/esm/cli/alias.js +10 -22
  36. package/dist/esm/cli/applyOptionsChain.js +4 -1
  37. package/dist/esm/cli/babel.js +6 -2
  38. package/dist/esm/cli/commands.js +10 -4
  39. package/dist/esm/cli/common.js +8 -3
  40. package/dist/esm/cli/config.js +4 -1
  41. package/dist/esm/cli/constants/chainId.js +4 -1
  42. package/dist/esm/cli/constants/index.js +64 -31
  43. package/dist/esm/cli/ensure.js +6 -2
  44. package/dist/esm/cli/fs.js +6 -2
  45. package/dist/esm/cli/get/config.js +4 -1
  46. package/dist/esm/cli/get/data.js +18 -8
  47. package/dist/esm/cli/get/index.js +6 -2
  48. package/dist/esm/cli/is/config.js +14 -6
  49. package/dist/esm/cli/is/env.js +12 -8
  50. package/dist/esm/cli/is/index.js +0 -1
  51. package/dist/esm/cli/is/project.js +17 -8
  52. package/dist/esm/cli/is/type.js +20 -9
  53. package/dist/esm/cli/logger.js +4 -128
  54. package/dist/esm/cli/monorepo.js +14 -16
  55. package/dist/esm/cli/package.js +10 -4
  56. package/dist/esm/cli/path.js +24 -11
  57. package/dist/esm/cli/port.js +5 -2
  58. package/dist/esm/cli/prettyInstructions.js +6 -2
  59. package/dist/esm/cli/require.js +14 -6
  60. package/dist/esm/cli/runtimeExports.js +6 -3
  61. package/dist/esm/cli/watch.js +10 -6
  62. package/dist/esm/compiled.js +65 -31
  63. package/dist/esm/import.js +6 -3
  64. package/dist/esm/universal/constants.js +10 -4
  65. package/dist/esm/universal/formatWebpack.js +5 -2
  66. package/dist/esm/universal/pluginDagSort.js +5 -2
  67. package/dist/esm-node/cli/alias.js +8 -19
  68. package/dist/esm-node/cli/applyOptionsChain.js +4 -1
  69. package/dist/esm-node/cli/babel.js +6 -2
  70. package/dist/esm-node/cli/commands.js +10 -4
  71. package/dist/esm-node/cli/common.js +8 -3
  72. package/dist/esm-node/cli/config.js +4 -1
  73. package/dist/esm-node/cli/constants/chainId.js +4 -1
  74. package/dist/esm-node/cli/constants/index.js +64 -31
  75. package/dist/esm-node/cli/ensure.js +6 -2
  76. package/dist/esm-node/cli/fs.js +6 -2
  77. package/dist/esm-node/cli/get/config.js +4 -1
  78. package/dist/esm-node/cli/get/data.js +18 -8
  79. package/dist/esm-node/cli/get/index.js +6 -2
  80. package/dist/esm-node/cli/is/config.js +14 -6
  81. package/dist/esm-node/cli/is/env.js +12 -6
  82. package/dist/esm-node/cli/is/index.js +0 -1
  83. package/dist/esm-node/cli/is/project.js +16 -7
  84. package/dist/esm-node/cli/is/type.js +20 -9
  85. package/dist/esm-node/cli/logger.js +4 -113
  86. package/dist/esm-node/cli/monorepo.js +14 -18
  87. package/dist/esm-node/cli/package.js +10 -4
  88. package/dist/esm-node/cli/path.js +24 -11
  89. package/dist/esm-node/cli/port.js +4 -1
  90. package/dist/esm-node/cli/prettyInstructions.js +6 -2
  91. package/dist/esm-node/cli/require.js +14 -6
  92. package/dist/esm-node/cli/runtimeExports.js +4 -1
  93. package/dist/esm-node/cli/watch.js +6 -2
  94. package/dist/esm-node/compiled.js +65 -31
  95. package/dist/esm-node/import.js +5 -2
  96. package/dist/esm-node/universal/constants.js +10 -4
  97. package/dist/esm-node/universal/formatWebpack.js +5 -2
  98. package/dist/esm-node/universal/pluginDagSort.js +5 -2
  99. package/dist/types/cli/alias.d.ts +0 -5
  100. package/dist/types/cli/is/env.d.ts +1 -2
  101. package/dist/types/cli/is/index.d.ts +0 -1
  102. package/dist/types/cli/logger.d.ts +1 -69
  103. package/dist/types/cli/monorepo.d.ts +0 -1
  104. package/package.json +6 -13
  105. package/dist/cjs/cli/is/platform.js +0 -21
  106. package/dist/compiled/gradient-string/index.d.ts +0 -1
  107. package/dist/compiled/gradient-string/index.js +0 -1
  108. package/dist/compiled/gradient-string/license +0 -21
  109. package/dist/compiled/gradient-string/package.json +0 -1
  110. package/dist/compiled/webpack-dev-middleware/index.js +0 -7
  111. package/dist/compiled/webpack-dev-middleware/license +0 -20
  112. package/dist/compiled/webpack-dev-middleware/package.json +0 -1
  113. package/dist/compiled/webpack-dev-middleware/types/index.d.ts +0 -262
  114. package/dist/esm/cli/is/platform.js +0 -6
  115. package/dist/esm-node/cli/is/platform.js +0 -2
  116. package/dist/types/cli/is/platform.d.ts +0 -2
@@ -1,30 +1,44 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- getAddressUrls: function() {
14
- return getAddressUrls;
15
- },
16
- prettyInstructions: function() {
17
- return prettyInstructions;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var prettyInstructions_exports = {};
30
+ __export(prettyInstructions_exports, {
31
+ getAddressUrls: () => getAddressUrls,
32
+ prettyInstructions: () => prettyInstructions
19
33
  });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
22
- const _compiled = require("../compiled");
23
- const _is = require("./is");
24
- const _constants = require("./constants");
34
+ module.exports = __toCommonJS(prettyInstructions_exports);
35
+ var import_os = __toESM(require("os"));
36
+ var import_compiled = require("../compiled");
37
+ var import_is = require("./is");
38
+ var import_constants = require("./constants");
25
39
  const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
26
40
  const getIpv4Interfaces = () => {
27
- const interfaces = _os.default.networkInterfaces();
41
+ const interfaces = import_os.default.networkInterfaces();
28
42
  const ipv4Interfaces = [];
29
43
  Object.keys(interfaces).forEach((key) => {
30
44
  interfaces[key].forEach((detail) => {
@@ -40,7 +54,7 @@ const getAddressUrls = (protocol = "http", port, host) => {
40
54
  const LOCAL_LABEL = "Local: ";
41
55
  const NETWORK_LABEL = "Network: ";
42
56
  const isLocalhost = (url) => url === null || url === void 0 ? void 0 : url.includes("localhost");
43
- if (host && host !== _constants.DEFAULT_DEV_HOST) {
57
+ if (host && host !== import_constants.DEFAULT_DEV_HOST) {
44
58
  return [
45
59
  {
46
60
  label: isLocalhost(host) ? LOCAL_LABEL : NETWORK_LABEL,
@@ -67,29 +81,34 @@ const getAddressUrls = (protocol = "http", port, host) => {
67
81
  const prettyInstructions = (appContext, config) => {
68
82
  var _appContext_builder_context_devServer, _appContext_builder, _config_dev, _config_source;
69
83
  const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
70
- const isHttps = (0, _is.isDev)() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
84
+ const isHttps = (0, import_is.isDev)() && ((_appContext_builder = appContext.builder) === null || _appContext_builder === void 0 ? void 0 : (_appContext_builder_context_devServer = _appContext_builder.context.devServer) === null || _appContext_builder_context_devServer === void 0 ? void 0 : _appContext_builder_context_devServer.https);
71
85
  const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
72
86
  const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
73
87
  let message = "\n";
74
- if ((0, _is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
75
- message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
88
+ if ((0, import_is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
89
+ message += urls.map(({ label, url }) => ` ${import_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
76
90
  `).join("");
77
91
  } else {
78
92
  const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
79
93
  urls.forEach(({ label, url }) => {
80
- message += ` ${_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? _compiled.chalk.cyanBright(url) : ""}
94
+ message += ` ${import_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? import_compiled.chalk.cyanBright(url) : ""}
81
95
  `;
82
96
  routes.forEach(({ entryName, urlPath, isSSR }) => {
83
97
  if (!checkedEntries.includes(entryName)) {
84
98
  return;
85
99
  }
86
- message += ` ${_compiled.chalk.yellowBright(isSSR ? "λ" : "○")} ${_compiled.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
100
+ message += ` ${import_compiled.chalk.yellowBright(isSSR ? "λ" : "○")} ${import_compiled.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
87
101
  `;
88
102
  });
89
103
  });
90
104
  message += "\n";
91
- message += _compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
92
- message += _compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
105
+ message += import_compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
106
+ message += import_compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
93
107
  }
94
108
  return message;
95
109
  };
110
+ // Annotate the CommonJS export names for ESM import in node:
111
+ 0 && (module.exports = {
112
+ getAddressUrls,
113
+ prettyInstructions
114
+ });
@@ -1,35 +1,32 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
6
7
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- compatRequire: function() {
14
- return compatRequire;
15
- },
16
- dynamicImport: function() {
17
- return dynamicImport;
18
- },
19
- requireExistModule: function() {
20
- return requireExistModule;
21
- },
22
- cleanRequireCache: function() {
23
- return cleanRequireCache;
24
- },
25
- deleteRequireCache: function() {
26
- return deleteRequireCache;
27
- },
28
- tryResolve: function() {
29
- return tryResolve;
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
30
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var require_exports = {};
20
+ __export(require_exports, {
21
+ cleanRequireCache: () => cleanRequireCache,
22
+ compatRequire: () => compatRequire,
23
+ deleteRequireCache: () => deleteRequireCache,
24
+ dynamicImport: () => dynamicImport,
25
+ requireExistModule: () => requireExistModule,
26
+ tryResolve: () => tryResolve
31
27
  });
32
- const _fs = require("./fs");
28
+ module.exports = __toCommonJS(require_exports);
29
+ var import_fs = require("./fs");
33
30
  const compatRequire = (filePath, interop = true) => {
34
31
  const mod = require(filePath);
35
32
  const rtnESMDefault = interop && (mod === null || mod === void 0 ? void 0 : mod.__esModule);
@@ -45,7 +42,7 @@ const requireExistModule = (filename, opt) => {
45
42
  interop: true,
46
43
  ...opt
47
44
  };
48
- const exist = (0, _fs.findExists)(final.extensions.map((ext) => `${filename}${ext}`));
45
+ const exist = (0, import_fs.findExists)(final.extensions.map((ext) => `${filename}${ext}`));
49
46
  if (!exist) {
50
47
  return null;
51
48
  }
@@ -81,3 +78,12 @@ const tryResolve = (name, resolvePath) => {
81
78
  }
82
79
  return filePath;
83
80
  };
81
+ // Annotate the CommonJS export names for ESM import in node:
82
+ 0 && (module.exports = {
83
+ cleanRequireCache,
84
+ compatRequire,
85
+ deleteRequireCache,
86
+ dynamicImport,
87
+ requireExistModule,
88
+ tryResolve
89
+ });
@@ -1,17 +1,39 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "createRuntimeExportsUtils", {
6
- enumerable: true,
7
- get: function() {
8
- return createRuntimeExportsUtils;
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var runtimeExports_exports = {};
30
+ __export(runtimeExports_exports, {
31
+ createRuntimeExportsUtils: () => createRuntimeExportsUtils
10
32
  });
11
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
13
- const _compiled = require("../compiled");
14
- const _path1 = require("./path");
33
+ module.exports = __toCommonJS(runtimeExports_exports);
34
+ var import_path = __toESM(require("path"));
35
+ var import_compiled = require("../compiled");
36
+ var import_path2 = require("./path");
15
37
  const memo = (fn) => {
16
38
  const cache = /* @__PURE__ */ new Map();
17
39
  return (...params) => {
@@ -26,13 +48,13 @@ const memo = (fn) => {
26
48
  };
27
49
  };
28
50
  const createRuntimeExportsUtils = memo((pwd = "", namespace = "index") => {
29
- const entryExportFile = _path.default.join(pwd, `.runtime-exports/${namespace}.js`);
51
+ const entryExportFile = import_path.default.join(pwd, `.runtime-exports/${namespace}.js`);
30
52
  const addExport = (statement) => {
31
- statement = (0, _path1.normalizeOutputPath)(statement);
53
+ statement = (0, import_path2.normalizeOutputPath)(statement);
32
54
  try {
33
- _compiled.fs.ensureFileSync(entryExportFile);
34
- if (!_compiled.fs.readFileSync(entryExportFile, "utf8").includes(statement)) {
35
- _compiled.fs.appendFileSync(entryExportFile, `${statement}
55
+ import_compiled.fs.ensureFileSync(entryExportFile);
56
+ if (!import_compiled.fs.readFileSync(entryExportFile, "utf8").includes(statement)) {
57
+ import_compiled.fs.appendFileSync(entryExportFile, `${statement}
36
58
  `);
37
59
  }
38
60
  } catch {
@@ -44,3 +66,7 @@ const createRuntimeExportsUtils = memo((pwd = "", namespace = "index") => {
44
66
  getPath
45
67
  };
46
68
  });
69
+ // Annotate the CommonJS export names for ESM import in node:
70
+ 0 && (module.exports = {
71
+ createRuntimeExportsUtils
72
+ });
@@ -1,25 +1,39 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- WatchChangeType: function() {
14
- return WatchChangeType;
15
- },
16
- watch: function() {
17
- return watch;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var watch_exports = {};
30
+ __export(watch_exports, {
31
+ WatchChangeType: () => WatchChangeType,
32
+ watch: () => watch
19
33
  });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
22
- const _compiled = require("../compiled");
34
+ module.exports = __toCommonJS(watch_exports);
35
+ var import_path = __toESM(require("path"));
36
+ var import_compiled = require("../compiled");
23
37
  const WatchChangeType = {
24
38
  ADD: "add",
25
39
  UNLINK: "unlink",
@@ -27,19 +41,19 @@ const WatchChangeType = {
27
41
  };
28
42
  const watch = (watchDir, runTask, ignored = []) => {
29
43
  let ready = false;
30
- const watcher = _compiled.chokidar.watch(watchDir, {
44
+ const watcher = import_compiled.chokidar.watch(watchDir, {
31
45
  ignored
32
46
  });
33
47
  watcher.on("ready", () => ready = true);
34
48
  watcher.on("change", async (filePath) => {
35
- const changedFilePath = _path.default.resolve(filePath);
49
+ const changedFilePath = import_path.default.resolve(filePath);
36
50
  await runTask({
37
51
  changedFilePath,
38
52
  changeType: WatchChangeType.CHANGE
39
53
  });
40
54
  });
41
55
  watcher.on("add", async (filePath) => {
42
- const changedFilePath = _path.default.resolve(filePath);
56
+ const changedFilePath = import_path.default.resolve(filePath);
43
57
  if (ready) {
44
58
  await runTask({
45
59
  changedFilePath,
@@ -48,7 +62,7 @@ const watch = (watchDir, runTask, ignored = []) => {
48
62
  }
49
63
  });
50
64
  watcher.on("unlink", async (filePath) => {
51
- const changedFilePath = _path.default.resolve(filePath);
65
+ const changedFilePath = import_path.default.resolve(filePath);
52
66
  await runTask({
53
67
  changedFilePath,
54
68
  changeType: WatchChangeType.UNLINK
@@ -59,3 +73,8 @@ const watch = (watchDir, runTask, ignored = []) => {
59
73
  });
60
74
  return watcher;
61
75
  };
76
+ // Annotate the CommonJS export names for ESM import in node:
77
+ 0 && (module.exports = {
78
+ WatchChangeType,
79
+ watch
80
+ });
@@ -1,142 +1,131 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- function _export(target, all) {
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
6
9
  for (var name in all)
7
- Object.defineProperty(target, name, {
8
- enumerable: true,
9
- get: all[name]
10
- });
11
- }
12
- _export(exports, {
13
- fs: function() {
14
- return _fsextra.default;
15
- },
16
- ora: function() {
17
- return _ora.default;
18
- },
19
- glob: function() {
20
- return _glob.default;
21
- },
22
- yaml: function() {
23
- return _jsyaml.default;
24
- },
25
- chalk: function() {
26
- return _chalk.default;
27
- },
28
- debug: function() {
29
- return _debug.default;
30
- },
31
- slash: function() {
32
- return _slash.default;
33
- },
34
- execa: function() {
35
- return _execa.default;
36
- },
37
- json5: function() {
38
- return _json5.default;
39
- },
40
- upath: function() {
41
- return _upath.default;
42
- },
43
- pkgUp: function() {
44
- return _pkgup.default;
45
- },
46
- nanoid: function() {
47
- return _nanoid.nanoid;
48
- },
49
- semver: function() {
50
- return _semver.default;
51
- },
52
- dotenv: function() {
53
- return _dotenv.default;
54
- },
55
- lodash: function() {
56
- return _lodash.default;
57
- },
58
- globby: function() {
59
- return _globby.default;
60
- },
61
- address: function() {
62
- return _address.default;
63
- },
64
- signale: function() {
65
- return _signale.default;
66
- },
67
- urlJoin: function() {
68
- return _urljoin.default;
69
- },
70
- minimist: function() {
71
- return _minimist.default;
72
- },
73
- fastGlob: function() {
74
- return _fastglob.default;
75
- },
76
- filesize: function() {
77
- return _filesize.default;
78
- },
79
- gzipSize: function() {
80
- return _gzipsize.default;
81
- },
82
- stripAnsi: function() {
83
- return _stripansi.default;
84
- },
85
- dotenvExpand: function() {
86
- return _dotenvexpand.default;
87
- },
88
- browserslist: function() {
89
- return _browserslist.default;
90
- },
91
- program: function() {
92
- return _commander.program;
93
- },
94
- Command: function() {
95
- return _commander.Command;
96
- },
97
- Signale: function() {
98
- return _signale.Signale;
99
- },
100
- mime: function() {
101
- return mime;
102
- },
103
- chokidar: function() {
104
- return chokidar;
105
- },
106
- inquirer: function() {
107
- return inquirer;
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
108
17
  }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var compiled_exports = {};
30
+ __export(compiled_exports, {
31
+ Command: () => import_commander.Command,
32
+ Signale: () => import_signale2.Signale,
33
+ address: () => import_address.default,
34
+ browserslist: () => import_browserslist.default,
35
+ chalk: () => import_chalk.default,
36
+ chokidar: () => chokidar,
37
+ debug: () => import_debug.default,
38
+ dotenv: () => import_dotenv.default,
39
+ dotenvExpand: () => import_dotenv_expand.default,
40
+ execa: () => import_execa.default,
41
+ fastGlob: () => import_fast_glob.default,
42
+ filesize: () => import_filesize.default,
43
+ fs: () => import_fs_extra.default,
44
+ glob: () => import_glob.default,
45
+ globby: () => import_globby.default,
46
+ gzipSize: () => import_gzip_size.default,
47
+ inquirer: () => inquirer,
48
+ json5: () => import_json5.default,
49
+ lodash: () => import_lodash.default,
50
+ mime: () => mime,
51
+ minimist: () => import_minimist.default,
52
+ nanoid: () => import_nanoid.nanoid,
53
+ ora: () => import_ora.default,
54
+ pkgUp: () => import_pkg_up.default,
55
+ program: () => import_commander.program,
56
+ semver: () => import_semver.default,
57
+ signale: () => import_signale.default,
58
+ slash: () => import_slash.default,
59
+ stripAnsi: () => import_strip_ansi.default,
60
+ upath: () => import_upath.default,
61
+ urlJoin: () => import_url_join.default,
62
+ yaml: () => import_js_yaml.default
63
+ });
64
+ module.exports = __toCommonJS(compiled_exports);
65
+ var import_import = require("./import");
66
+ var import_fs_extra = __toESM(require("../compiled/fs-extra"));
67
+ var import_ora = __toESM(require("../compiled/ora"));
68
+ var import_glob = __toESM(require("../compiled/glob"));
69
+ var import_js_yaml = __toESM(require("../compiled/js-yaml"));
70
+ var import_chalk = __toESM(require("../compiled/chalk"));
71
+ var import_debug = __toESM(require("../compiled/debug"));
72
+ var import_slash = __toESM(require("../compiled/slash"));
73
+ var import_execa = __toESM(require("../compiled/execa"));
74
+ var import_json5 = __toESM(require("../compiled/json5"));
75
+ var import_upath = __toESM(require("../compiled/upath"));
76
+ var import_pkg_up = __toESM(require("../compiled/pkg-up"));
77
+ var import_nanoid = require("../compiled/nanoid");
78
+ var import_semver = __toESM(require("../compiled/semver"));
79
+ var import_dotenv = __toESM(require("../compiled/dotenv"));
80
+ var import_lodash = __toESM(require("../compiled/lodash"));
81
+ var import_globby = __toESM(require("../compiled/globby"));
82
+ var import_address = __toESM(require("../compiled/address"));
83
+ var import_signale = __toESM(require("../compiled/signale"));
84
+ var import_url_join = __toESM(require("../compiled/url-join"));
85
+ var import_minimist = __toESM(require("../compiled/minimist"));
86
+ var import_fast_glob = __toESM(require("../compiled/fast-glob"));
87
+ var import_filesize = __toESM(require("../compiled/filesize"));
88
+ var import_gzip_size = __toESM(require("../compiled/gzip-size"));
89
+ var import_strip_ansi = __toESM(require("../compiled/strip-ansi"));
90
+ var import_dotenv_expand = __toESM(require("../compiled/dotenv-expand"));
91
+ var import_browserslist = __toESM(require("../compiled/browserslist"));
92
+ var import_commander = require("../compiled/commander");
93
+ var import_signale2 = require("../compiled/signale");
94
+ const mime = import_import.Import.lazy("../compiled/mime-types", require);
95
+ const chokidar = import_import.Import.lazy("../compiled/chokidar", require);
96
+ const inquirer = import_import.Import.lazy("../compiled/inquirer", require);
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ Command,
100
+ Signale,
101
+ address,
102
+ browserslist,
103
+ chalk,
104
+ chokidar,
105
+ debug,
106
+ dotenv,
107
+ dotenvExpand,
108
+ execa,
109
+ fastGlob,
110
+ filesize,
111
+ fs,
112
+ glob,
113
+ globby,
114
+ gzipSize,
115
+ inquirer,
116
+ json5,
117
+ lodash,
118
+ mime,
119
+ minimist,
120
+ nanoid,
121
+ ora,
122
+ pkgUp,
123
+ program,
124
+ semver,
125
+ signale,
126
+ slash,
127
+ stripAnsi,
128
+ upath,
129
+ urlJoin,
130
+ yaml
109
131
  });
110
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
111
- const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
112
- const _import = require("./import");
113
- const _fsextra = /* @__PURE__ */ _interop_require_default._(require("../compiled/fs-extra"));
114
- const _ora = /* @__PURE__ */ _interop_require_default._(require("../compiled/ora"));
115
- const _glob = /* @__PURE__ */ _interop_require_default._(require("../compiled/glob"));
116
- const _jsyaml = /* @__PURE__ */ _interop_require_default._(require("../compiled/js-yaml"));
117
- const _chalk = /* @__PURE__ */ _interop_require_default._(require("../compiled/chalk"));
118
- const _debug = /* @__PURE__ */ _interop_require_default._(require("../compiled/debug"));
119
- const _slash = /* @__PURE__ */ _interop_require_default._(require("../compiled/slash"));
120
- const _execa = /* @__PURE__ */ _interop_require_default._(require("../compiled/execa"));
121
- const _json5 = /* @__PURE__ */ _interop_require_default._(require("../compiled/json5"));
122
- const _upath = /* @__PURE__ */ _interop_require_default._(require("../compiled/upath"));
123
- const _pkgup = /* @__PURE__ */ _interop_require_default._(require("../compiled/pkg-up"));
124
- const _nanoid = require("../compiled/nanoid");
125
- const _semver = /* @__PURE__ */ _interop_require_default._(require("../compiled/semver"));
126
- const _dotenv = /* @__PURE__ */ _interop_require_default._(require("../compiled/dotenv"));
127
- const _lodash = /* @__PURE__ */ _interop_require_default._(require("../compiled/lodash"));
128
- const _globby = /* @__PURE__ */ _interop_require_default._(require("../compiled/globby"));
129
- const _address = /* @__PURE__ */ _interop_require_default._(require("../compiled/address"));
130
- const _signale = /* @__PURE__ */ _interop_require_wildcard._(require("../compiled/signale"));
131
- const _urljoin = /* @__PURE__ */ _interop_require_default._(require("../compiled/url-join"));
132
- const _minimist = /* @__PURE__ */ _interop_require_default._(require("../compiled/minimist"));
133
- const _fastglob = /* @__PURE__ */ _interop_require_default._(require("../compiled/fast-glob"));
134
- const _filesize = /* @__PURE__ */ _interop_require_default._(require("../compiled/filesize"));
135
- const _gzipsize = /* @__PURE__ */ _interop_require_default._(require("../compiled/gzip-size"));
136
- const _stripansi = /* @__PURE__ */ _interop_require_default._(require("../compiled/strip-ansi"));
137
- const _dotenvexpand = /* @__PURE__ */ _interop_require_default._(require("../compiled/dotenv-expand"));
138
- const _browserslist = /* @__PURE__ */ _interop_require_default._(require("../compiled/browserslist"));
139
- const _commander = require("../compiled/commander");
140
- const mime = _import.Import.lazy("../compiled/mime-types", require);
141
- const chokidar = _import.Import.lazy("../compiled/chokidar", require);
142
- const inquirer = _import.Import.lazy("../compiled/inquirer", require);