@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,111 +1,58 @@
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
- ROUTE_SPEC_FILE: function() {
14
- return ROUTE_SPEC_FILE;
15
- },
16
- NESTED_ROUTE_SPEC_FILE: function() {
17
- return NESTED_ROUTE_SPEC_FILE;
18
- },
19
- MAIN_ENTRY_NAME: function() {
20
- return MAIN_ENTRY_NAME;
21
- },
22
- SERVER_BUNDLE_DIRECTORY: function() {
23
- return SERVER_BUNDLE_DIRECTORY;
24
- },
25
- SERVER_WORKER_BUNDLE_DIRECTORY: function() {
26
- return SERVER_WORKER_BUNDLE_DIRECTORY;
27
- },
28
- ENTRY_NAME_PATTERN: function() {
29
- return ENTRY_NAME_PATTERN;
30
- },
31
- SERVER_RENDER_FUNCTION_NAME: function() {
32
- return SERVER_RENDER_FUNCTION_NAME;
33
- },
34
- LOADABLE_STATS_FILE: function() {
35
- return LOADABLE_STATS_FILE;
36
- },
37
- API_DIR: function() {
38
- return API_DIR;
39
- },
40
- SERVER_DIR: function() {
41
- return SERVER_DIR;
42
- },
43
- SHARED_DIR: function() {
44
- return SHARED_DIR;
45
- },
46
- CONFIG_CACHE_DIR: function() {
47
- return CONFIG_CACHE_DIR;
48
- },
49
- CONFIG_FILE_EXTENSIONS: function() {
50
- return CONFIG_FILE_EXTENSIONS;
51
- },
52
- OUTPUT_CONFIG_FILE: function() {
53
- return OUTPUT_CONFIG_FILE;
54
- },
55
- DEFAULT_SERVER_CONFIG: function() {
56
- return DEFAULT_SERVER_CONFIG;
57
- },
58
- ROUTE_MANIFEST_FILE: function() {
59
- return ROUTE_MANIFEST_FILE;
60
- },
61
- LOADER_ROUTES_DIR: function() {
62
- return LOADER_ROUTES_DIR;
63
- },
64
- DEFAULT_DEV_HOST: function() {
65
- return DEFAULT_DEV_HOST;
66
- },
67
- INTERNAL_APP_TOOLS_PLUGINS: function() {
68
- return INTERNAL_APP_TOOLS_PLUGINS;
69
- },
70
- INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: function() {
71
- return INTERNAL_APP_TOOLS_RUNTIME_PLUGINS;
72
- },
73
- INTERNAL_MODULE_TOOLS_PLUGINS: function() {
74
- return INTERNAL_MODULE_TOOLS_PLUGINS;
75
- },
76
- INTERNAL_MONOREPO_TOOLS_PLUGINS: function() {
77
- return INTERNAL_MONOREPO_TOOLS_PLUGINS;
78
- },
79
- INTERNAL_DOC_TOOLS_PLUGINS: function() {
80
- return INTERNAL_DOC_TOOLS_PLUGINS;
81
- },
82
- INTERNAL_CLI_PLUGINS: function() {
83
- return INTERNAL_CLI_PLUGINS;
84
- },
85
- SERVER_PLUGIN_BFF: function() {
86
- return SERVER_PLUGIN_BFF;
87
- },
88
- SERVER_PLUGIN_EXPRESS: function() {
89
- return SERVER_PLUGIN_EXPRESS;
90
- },
91
- SERVER_PLUGIN_KOA: function() {
92
- return SERVER_PLUGIN_KOA;
93
- },
94
- SERVER_PLUGIN_SERVER: function() {
95
- return SERVER_PLUGIN_SERVER;
96
- },
97
- SERVER_PLUGIN_POLYFILL: function() {
98
- return SERVER_PLUGIN_POLYFILL;
99
- },
100
- INTERNAL_SERVER_PLUGINS: function() {
101
- return INTERNAL_SERVER_PLUGINS;
102
- },
103
- DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: function() {
104
- return DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS;
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 });
105
15
  }
16
+ return to;
17
+ };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ API_DIR: () => API_DIR,
23
+ CONFIG_CACHE_DIR: () => CONFIG_CACHE_DIR,
24
+ CONFIG_FILE_EXTENSIONS: () => CONFIG_FILE_EXTENSIONS,
25
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS: () => DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
26
+ DEFAULT_DEV_HOST: () => DEFAULT_DEV_HOST,
27
+ DEFAULT_SERVER_CONFIG: () => DEFAULT_SERVER_CONFIG,
28
+ ENTRY_NAME_PATTERN: () => ENTRY_NAME_PATTERN,
29
+ INTERNAL_APP_TOOLS_PLUGINS: () => INTERNAL_APP_TOOLS_PLUGINS,
30
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS: () => INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
31
+ INTERNAL_CLI_PLUGINS: () => INTERNAL_CLI_PLUGINS,
32
+ INTERNAL_DOC_TOOLS_PLUGINS: () => INTERNAL_DOC_TOOLS_PLUGINS,
33
+ INTERNAL_MODULE_TOOLS_PLUGINS: () => INTERNAL_MODULE_TOOLS_PLUGINS,
34
+ INTERNAL_MONOREPO_TOOLS_PLUGINS: () => INTERNAL_MONOREPO_TOOLS_PLUGINS,
35
+ INTERNAL_SERVER_PLUGINS: () => INTERNAL_SERVER_PLUGINS,
36
+ LOADABLE_STATS_FILE: () => LOADABLE_STATS_FILE,
37
+ LOADER_ROUTES_DIR: () => LOADER_ROUTES_DIR,
38
+ MAIN_ENTRY_NAME: () => MAIN_ENTRY_NAME,
39
+ NESTED_ROUTE_SPEC_FILE: () => NESTED_ROUTE_SPEC_FILE,
40
+ OUTPUT_CONFIG_FILE: () => OUTPUT_CONFIG_FILE,
41
+ ROUTE_MANIFEST_FILE: () => ROUTE_MANIFEST_FILE,
42
+ ROUTE_SPEC_FILE: () => ROUTE_SPEC_FILE,
43
+ SERVER_BUNDLE_DIRECTORY: () => SERVER_BUNDLE_DIRECTORY,
44
+ SERVER_DIR: () => SERVER_DIR,
45
+ SERVER_PLUGIN_BFF: () => SERVER_PLUGIN_BFF,
46
+ SERVER_PLUGIN_EXPRESS: () => SERVER_PLUGIN_EXPRESS,
47
+ SERVER_PLUGIN_KOA: () => SERVER_PLUGIN_KOA,
48
+ SERVER_PLUGIN_POLYFILL: () => SERVER_PLUGIN_POLYFILL,
49
+ SERVER_PLUGIN_SERVER: () => SERVER_PLUGIN_SERVER,
50
+ SERVER_RENDER_FUNCTION_NAME: () => SERVER_RENDER_FUNCTION_NAME,
51
+ SERVER_WORKER_BUNDLE_DIRECTORY: () => SERVER_WORKER_BUNDLE_DIRECTORY,
52
+ SHARED_DIR: () => SHARED_DIR
106
53
  });
107
- const _export_star = require("@swc/helpers/_/_export_star");
108
- _export_star._(require("./chainId"), exports);
54
+ module.exports = __toCommonJS(constants_exports);
55
+ __reExport(constants_exports, require("./chainId"), module.exports);
109
56
  const ROUTE_SPEC_FILE = "route.json";
110
57
  const NESTED_ROUTE_SPEC_FILE = "nestedRoutes.json";
111
58
  const MAIN_ENTRY_NAME = "main";
@@ -207,3 +154,38 @@ const DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS = {
207
154
  optimizeConstEnums: true,
208
155
  isTSX: true
209
156
  };
157
+ // Annotate the CommonJS export names for ESM import in node:
158
+ 0 && (module.exports = {
159
+ API_DIR,
160
+ CONFIG_CACHE_DIR,
161
+ CONFIG_FILE_EXTENSIONS,
162
+ DEFAULT_BABEL_PRESET_TYPESCRIPT_OPTIONS,
163
+ DEFAULT_DEV_HOST,
164
+ DEFAULT_SERVER_CONFIG,
165
+ ENTRY_NAME_PATTERN,
166
+ INTERNAL_APP_TOOLS_PLUGINS,
167
+ INTERNAL_APP_TOOLS_RUNTIME_PLUGINS,
168
+ INTERNAL_CLI_PLUGINS,
169
+ INTERNAL_DOC_TOOLS_PLUGINS,
170
+ INTERNAL_MODULE_TOOLS_PLUGINS,
171
+ INTERNAL_MONOREPO_TOOLS_PLUGINS,
172
+ INTERNAL_SERVER_PLUGINS,
173
+ LOADABLE_STATS_FILE,
174
+ LOADER_ROUTES_DIR,
175
+ MAIN_ENTRY_NAME,
176
+ NESTED_ROUTE_SPEC_FILE,
177
+ OUTPUT_CONFIG_FILE,
178
+ ROUTE_MANIFEST_FILE,
179
+ ROUTE_SPEC_FILE,
180
+ SERVER_BUNDLE_DIRECTORY,
181
+ SERVER_DIR,
182
+ SERVER_PLUGIN_BFF,
183
+ SERVER_PLUGIN_EXPRESS,
184
+ SERVER_PLUGIN_KOA,
185
+ SERVER_PLUGIN_POLYFILL,
186
+ SERVER_PLUGIN_SERVER,
187
+ SERVER_RENDER_FUNCTION_NAME,
188
+ SERVER_WORKER_BUNDLE_DIRECTORY,
189
+ SHARED_DIR,
190
+ ...require("./chainId")
191
+ });
@@ -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
- ensureAbsolutePath: function() {
14
- return ensureAbsolutePath;
15
- },
16
- ensureArray: function() {
17
- return ensureArray;
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 ensure_exports = {};
30
+ __export(ensure_exports, {
31
+ ensureAbsolutePath: () => ensureAbsolutePath,
32
+ ensureArray: () => ensureArray
19
33
  });
20
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
21
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
22
- const ensureAbsolutePath = (base, filePath) => _path.default.isAbsolute(filePath) ? filePath : _path.default.resolve(base, filePath);
34
+ module.exports = __toCommonJS(ensure_exports);
35
+ var import_path = __toESM(require("path"));
36
+ const ensureAbsolutePath = (base, filePath) => import_path.default.isAbsolute(filePath) ? filePath : import_path.default.resolve(base, filePath);
23
37
  const ensureArray = (params) => {
24
38
  if (Array.isArray(params)) {
25
39
  return params;
@@ -28,3 +42,8 @@ const ensureArray = (params) => {
28
42
  params
29
43
  ];
30
44
  };
45
+ // Annotate the CommonJS export names for ESM import in node:
46
+ 0 && (module.exports = {
47
+ ensureAbsolutePath,
48
+ ensureArray
49
+ });
@@ -1,33 +1,43 @@
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
- findExists: function() {
14
- return findExists;
15
- },
16
- emptyDir: function() {
17
- return emptyDir;
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 });
18
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var fs_exports = {};
20
+ __export(fs_exports, {
21
+ emptyDir: () => emptyDir,
22
+ findExists: () => findExists
19
23
  });
20
- const _compiled = require("../compiled");
24
+ module.exports = __toCommonJS(fs_exports);
25
+ var import_compiled = require("../compiled");
21
26
  const findExists = (files) => {
22
27
  for (const file of files) {
23
- if (_compiled.fs.existsSync(file) && _compiled.fs.statSync(file).isFile()) {
28
+ if (import_compiled.fs.existsSync(file) && import_compiled.fs.statSync(file).isFile()) {
24
29
  return file;
25
30
  }
26
31
  }
27
32
  return false;
28
33
  };
29
34
  const emptyDir = async (dir) => {
30
- if (await _compiled.fs.pathExists(dir)) {
31
- await _compiled.fs.emptyDir(dir);
35
+ if (await import_compiled.fs.pathExists(dir)) {
36
+ await import_compiled.fs.emptyDir(dir);
32
37
  }
33
38
  };
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ emptyDir,
42
+ findExists
43
+ });
@@ -1,21 +1,34 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getEntryOptions", {
6
- enumerable: true,
7
- get: function() {
8
- return getEntryOptions;
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) => {
7
+ for (var name in all)
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 });
9
15
  }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var config_exports = {};
20
+ __export(config_exports, {
21
+ getEntryOptions: () => getEntryOptions
10
22
  });
11
- const _is = require("../is");
23
+ module.exports = __toCommonJS(config_exports);
24
+ var import_is = require("../is");
12
25
  const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packageName) => {
13
26
  if (optionsByEntries) {
14
27
  let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
15
28
  if (optionsByEntry === void 0 && isMainEntry && packageName) {
16
29
  optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
17
30
  }
18
- return optionsByEntry !== void 0 ? (0, _is.isPlainObject)(optionsByEntry) && (0, _is.isPlainObject)(baseOptions) ? {
31
+ return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? {
19
32
  ...baseOptions,
20
33
  ...optionsByEntry
21
34
  } : optionsByEntry : baseOptions;
@@ -24,3 +37,7 @@ const getEntryOptions = (name, isMainEntry, baseOptions, optionsByEntries, packa
24
37
  }
25
38
  };
26
39
  const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
40
+ // Annotate the CommonJS export names for ESM import in node:
41
+ 0 && (module.exports = {
42
+ getEntryOptions
43
+ });
@@ -1,75 +1,77 @@
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
- getPackageManager: function() {
14
- return getPackageManager;
15
- },
16
- getCoreJsVersion: function() {
17
- return getCoreJsVersion;
18
- },
19
- getAntdMajorVersion: function() {
20
- return getAntdMajorVersion;
21
- },
22
- defaults: function() {
23
- return defaults;
24
- },
25
- getBrowserslist: function() {
26
- return getBrowserslist;
27
- },
28
- getInternalPlugins: function() {
29
- return getInternalPlugins;
30
- },
31
- readTsConfig: function() {
32
- return readTsConfig;
33
- },
34
- readTsConfigByFile: function() {
35
- return readTsConfigByFile;
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 });
36
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 data_exports = {};
30
+ __export(data_exports, {
31
+ defaults: () => defaults,
32
+ getAntdMajorVersion: () => getAntdMajorVersion,
33
+ getBrowserslist: () => getBrowserslist,
34
+ getCoreJsVersion: () => getCoreJsVersion,
35
+ getInternalPlugins: () => getInternalPlugins,
36
+ getPackageManager: () => getPackageManager,
37
+ readTsConfig: () => readTsConfig,
38
+ readTsConfigByFile: () => readTsConfigByFile
37
39
  });
38
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
39
- const _os = /* @__PURE__ */ _interop_require_default._(require("os"));
40
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
41
- const _compiled = require("../../compiled");
42
- const _constants = require("../constants");
43
- const _is = require("../is");
44
- const _package = require("../package");
40
+ module.exports = __toCommonJS(data_exports);
41
+ var import_os = __toESM(require("os"));
42
+ var import_path = __toESM(require("path"));
43
+ var import_compiled = require("../../compiled");
44
+ var import_constants = require("../constants");
45
+ var import_is = require("../is");
46
+ var import_package = require("../package");
45
47
  const MAX_TIMES = 5;
46
48
  async function getPackageManager(cwd = process.cwd()) {
47
49
  let appDirectory = cwd;
48
50
  let times = 0;
49
- while (_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
51
+ while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
50
52
  times++;
51
- if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
53
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
52
54
  return "pnpm";
53
55
  }
54
- if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "yarn.lock"))) {
56
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
55
57
  return "yarn";
56
58
  }
57
- if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "package-lock.json"))) {
59
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
58
60
  return "npm";
59
61
  }
60
- appDirectory = _path.default.join(appDirectory, "..");
62
+ appDirectory = import_path.default.join(appDirectory, "..");
61
63
  }
62
- if (await (0, _package.canUsePnpm)()) {
64
+ if (await (0, import_package.canUsePnpm)()) {
63
65
  return "pnpm";
64
66
  }
65
- if (await (0, _package.canUseYarn)()) {
67
+ if (await (0, import_package.canUseYarn)()) {
66
68
  return "yarn";
67
69
  }
68
70
  return "npm";
69
71
  }
70
72
  const getCoreJsVersion = (corejsPkgPath) => {
71
73
  try {
72
- const { version } = _compiled.fs.readJSONSync(corejsPkgPath);
74
+ const { version } = import_compiled.fs.readJSONSync(corejsPkgPath);
73
75
  const [major, minor] = version.split(".");
74
76
  return `${major}.${minor}`;
75
77
  } catch (err) {
@@ -94,17 +96,17 @@ const defaults = [
94
96
  "not dead",
95
97
  "not op_mini all"
96
98
  ];
97
- const getBrowserslist = (appDirectory) => _compiled.browserslist.loadConfig({
99
+ const getBrowserslist = (appDirectory) => import_compiled.browserslist.loadConfig({
98
100
  path: appDirectory
99
101
  }) || defaults;
100
- function getInternalPlugins(appDirectory, internalPlugins = _constants.INTERNAL_CLI_PLUGINS) {
102
+ function getInternalPlugins(appDirectory, internalPlugins = import_constants.INTERNAL_CLI_PLUGINS) {
101
103
  return [
102
104
  ...Object.keys(internalPlugins).filter((name) => {
103
105
  const config = internalPlugins[name];
104
106
  if (typeof config !== "string" && config.forced === true) {
105
107
  return true;
106
108
  }
107
- return (0, _is.isDepExists)(appDirectory, name);
109
+ return (0, import_is.isDepExists)(appDirectory, name);
108
110
  }).map((name) => {
109
111
  const config = internalPlugins[name];
110
112
  if (typeof config !== "string") {
@@ -116,9 +118,20 @@ function getInternalPlugins(appDirectory, internalPlugins = _constants.INTERNAL_
116
118
  ];
117
119
  }
118
120
  const readTsConfig = (root) => {
119
- return readTsConfigByFile(_path.default.resolve(root, "./tsconfig.json"));
121
+ return readTsConfigByFile(import_path.default.resolve(root, "./tsconfig.json"));
120
122
  };
121
123
  const readTsConfigByFile = (filename) => {
122
- const content = _compiled.fs.readFileSync(_path.default.resolve(filename), "utf-8");
123
- return _compiled.json5.parse(content);
124
+ const content = import_compiled.fs.readFileSync(import_path.default.resolve(filename), "utf-8");
125
+ return import_compiled.json5.parse(content);
124
126
  };
127
+ // Annotate the CommonJS export names for ESM import in node:
128
+ 0 && (module.exports = {
129
+ defaults,
130
+ getAntdMajorVersion,
131
+ getBrowserslist,
132
+ getCoreJsVersion,
133
+ getInternalPlugins,
134
+ getPackageManager,
135
+ readTsConfig,
136
+ readTsConfigByFile
137
+ });
@@ -1,34 +1,55 @@
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
- getServerConfig: function() {
14
- return getServerConfig;
15
- },
16
- getTargetDir: function() {
17
- return getTargetDir;
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var get_exports = {};
31
+ __export(get_exports, {
32
+ getServerConfig: () => getServerConfig,
33
+ getTargetDir: () => getTargetDir
19
34
  });
20
- const _export_star = require("@swc/helpers/_/_export_star");
21
- const _interop_require_default = require("@swc/helpers/_/_interop_require_default");
22
- const _path = /* @__PURE__ */ _interop_require_default._(require("path"));
23
- const _constants = require("../constants");
24
- const _fs = require("../fs");
25
- _export_star._(require("./data"), exports);
26
- _export_star._(require("./config"), exports);
35
+ module.exports = __toCommonJS(get_exports);
36
+ var import_path = __toESM(require("path"));
37
+ var import_constants = require("../constants");
38
+ var import_fs = require("../fs");
39
+ __reExport(get_exports, require("./data"), module.exports);
40
+ __reExport(get_exports, require("./config"), module.exports);
27
41
  const getServerConfig = async (appDirectory, configFile) => {
28
- const configFilePath = (0, _fs.findExists)(_constants.CONFIG_FILE_EXTENSIONS.map((extension) => _path.default.resolve(appDirectory, `${configFile}${extension}`)));
42
+ const configFilePath = (0, import_fs.findExists)(import_constants.CONFIG_FILE_EXTENSIONS.map((extension) => import_path.default.resolve(appDirectory, `${configFile}${extension}`)));
29
43
  return configFilePath;
30
44
  };
31
45
  const getTargetDir = (from, baseDir, targetBaseDir) => {
32
- const relativePath = _path.default.relative(baseDir, from);
33
- return _path.default.resolve(targetBaseDir, relativePath);
46
+ const relativePath = import_path.default.relative(baseDir, from);
47
+ return import_path.default.resolve(targetBaseDir, relativePath);
34
48
  };
49
+ // Annotate the CommonJS export names for ESM import in node:
50
+ 0 && (module.exports = {
51
+ getServerConfig,
52
+ getTargetDir,
53
+ ...require("./data"),
54
+ ...require("./config")
55
+ });