@modern-js/utils 2.69.5 → 3.0.0-alpha.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 (233) hide show
  1. package/dist/cjs/cli/alias.js +76 -70
  2. package/dist/cjs/cli/applyOptionsChain.js +44 -45
  3. package/dist/cjs/cli/babel.js +100 -119
  4. package/dist/cjs/cli/commands.js +61 -59
  5. package/dist/cjs/cli/common.js +45 -37
  6. package/dist/cjs/cli/config.js +36 -30
  7. package/dist/cjs/cli/constants.js +124 -161
  8. package/dist/cjs/cli/ensure.js +52 -45
  9. package/dist/cjs/cli/fs.js +41 -38
  10. package/dist/cjs/cli/get/config.js +43 -38
  11. package/dist/cjs/cli/get/data.js +108 -125
  12. package/dist/cjs/cli/get/index.js +109 -58
  13. package/dist/cjs/cli/index.js +202 -63
  14. package/dist/cjs/cli/is/config.js +75 -71
  15. package/dist/cjs/cli/is/env.js +49 -37
  16. package/dist/cjs/cli/is/index.js +76 -25
  17. package/dist/cjs/cli/is/project.js +139 -135
  18. package/dist/cjs/cli/is/type.js +65 -49
  19. package/dist/cjs/cli/logger.js +36 -27
  20. package/dist/cjs/cli/monorepo.js +100 -96
  21. package/dist/cjs/cli/package.js +85 -82
  22. package/dist/cjs/cli/path.js +101 -82
  23. package/dist/cjs/cli/port.js +71 -74
  24. package/dist/cjs/cli/prettyInstructions.js +106 -116
  25. package/dist/cjs/cli/require.js +116 -136
  26. package/dist/cjs/cli/route.js +67 -77
  27. package/dist/cjs/cli/runtimeExports.js +16 -70
  28. package/dist/cjs/cli/version.js +53 -42
  29. package/dist/cjs/cli/watch.js +79 -72
  30. package/dist/cjs/compiled.js +199 -128
  31. package/dist/cjs/import.js +58 -33
  32. package/dist/cjs/index.js +69 -23
  33. package/dist/cjs/universal/constants.js +77 -67
  34. package/dist/cjs/universal/index.js +33 -25
  35. package/dist/cjs/universal/path.js +33 -27
  36. package/dist/cjs/universal/pluginDagSort.js +69 -68
  37. package/dist/compiled/address/index.js +171 -1
  38. package/dist/compiled/browserslist/index.js +1329 -1
  39. package/dist/compiled/chalk/index.js +2368 -1
  40. package/dist/compiled/chokidar/index.js +4138 -16
  41. package/dist/compiled/chokidar/index.js.LICENSE.txt +41 -0
  42. package/dist/compiled/commander/index.js +1540 -1
  43. package/dist/compiled/debug/index.js +621 -1
  44. package/dist/compiled/dotenv/index.js +101 -1
  45. package/dist/compiled/dotenv-expand/index.js +54 -1
  46. package/dist/compiled/execa/index.js +1738 -1
  47. package/dist/compiled/fast-glob/index.js +4645 -17
  48. package/dist/compiled/fast-glob/index.js.LICENSE.txt +38 -0
  49. package/dist/compiled/filesize/index.js +193 -4
  50. package/dist/compiled/filesize/index.js.LICENSE.txt +7 -0
  51. package/dist/compiled/fs-extra/index.js +2222 -1
  52. package/dist/compiled/glob/index.js +2011 -1
  53. package/dist/compiled/globby/index.js +690 -1
  54. package/dist/compiled/gzip-size/index.js +157 -1
  55. package/dist/compiled/import-lazy/index.js +45 -1
  56. package/dist/compiled/inquirer/index.js +20162 -4
  57. package/dist/compiled/inquirer/index.js.LICENSE.txt +7 -0
  58. package/dist/compiled/js-yaml/index.js +2188 -1
  59. package/dist/compiled/json5/index.js +983 -1
  60. package/dist/compiled/lodash/index.js +0 -4
  61. package/dist/compiled/mime-types/index.js +108 -6
  62. package/dist/compiled/mime-types/index.js.LICENSE.txt +13 -0
  63. package/dist/compiled/minimist/index.js +202 -1
  64. package/dist/compiled/nanoid/index.js +83 -1
  65. package/dist/compiled/ora/index.js +3936 -3
  66. package/dist/compiled/ora/index.js.LICENSE.txt +1 -0
  67. package/dist/compiled/pkg-up/index.js +177 -1
  68. package/dist/compiled/semver/index.js +1779 -1
  69. package/dist/compiled/signale/index.js +1704 -1
  70. package/dist/compiled/slash/index.js +32 -1
  71. package/dist/compiled/strip-ansi/index.js +34 -1
  72. package/dist/compiled/tsconfig-paths/index.js +629 -1
  73. package/dist/compiled/upath/index.js +135 -1
  74. package/dist/compiled/url-join/index.js +61 -1
  75. package/dist/compiled/webpack-chain/index.js +1475 -1
  76. package/dist/esm/cli/alias.mjs +31 -0
  77. package/dist/esm/cli/applyOptionsChain.mjs +16 -0
  78. package/dist/esm/cli/babel.mjs +76 -0
  79. package/dist/esm/cli/commands.mjs +23 -0
  80. package/dist/esm/cli/common.mjs +11 -0
  81. package/dist/esm/cli/config.mjs +5 -0
  82. package/dist/esm/cli/constants.mjs +29 -0
  83. package/dist/esm/cli/ensure.mjs +9 -0
  84. package/dist/esm/cli/fs.mjs +9 -0
  85. package/dist/esm/cli/get/config.mjs +14 -0
  86. package/dist/esm/cli/get/data.mjs +57 -0
  87. package/dist/esm/cli/get/index.mjs +18 -0
  88. package/dist/{esm-node/cli/index.js → esm/cli/index.mjs} +0 -1
  89. package/dist/esm/cli/is/config.mjs +34 -0
  90. package/dist/esm/cli/is/env.mjs +6 -0
  91. package/dist/esm/cli/is/project.mjs +104 -0
  92. package/dist/esm/cli/is/type.mjs +26 -0
  93. package/dist/esm/cli/logger.mjs +2 -0
  94. package/dist/esm/cli/monorepo.mjs +50 -0
  95. package/dist/esm/cli/package.mjs +51 -0
  96. package/dist/esm/cli/path.mjs +35 -0
  97. package/dist/esm/cli/port.mjs +35 -0
  98. package/dist/esm/cli/prettyInstructions.mjs +68 -0
  99. package/dist/esm/cli/require.mjs +79 -0
  100. package/dist/esm/cli/route.mjs +36 -0
  101. package/dist/esm/cli/runtimeExports.mjs +0 -0
  102. package/dist/esm/cli/version.mjs +21 -0
  103. package/dist/esm/cli/watch.mjs +40 -0
  104. package/dist/esm/compiled.mjs +115 -0
  105. package/dist/esm/import.mjs +25 -0
  106. package/dist/esm/universal/constants.mjs +13 -0
  107. package/dist/{esm-node/universal/index.js → esm/universal/index.mjs} +1 -3
  108. package/dist/esm/universal/path.mjs +2 -0
  109. package/dist/esm/universal/pluginDagSort.mjs +41 -0
  110. package/dist/esm-node/cli/alias.mjs +31 -0
  111. package/dist/esm-node/cli/applyOptionsChain.mjs +16 -0
  112. package/dist/esm-node/cli/babel.mjs +76 -0
  113. package/dist/esm-node/cli/commands.mjs +23 -0
  114. package/dist/esm-node/cli/common.mjs +11 -0
  115. package/dist/esm-node/cli/config.mjs +5 -0
  116. package/dist/esm-node/cli/constants.mjs +29 -0
  117. package/dist/esm-node/cli/ensure.mjs +9 -0
  118. package/dist/esm-node/cli/fs.mjs +9 -0
  119. package/dist/esm-node/cli/get/config.mjs +14 -0
  120. package/dist/esm-node/cli/get/data.mjs +57 -0
  121. package/dist/esm-node/cli/get/index.mjs +18 -0
  122. package/dist/esm-node/cli/index.mjs +22 -0
  123. package/dist/esm-node/cli/is/config.mjs +34 -0
  124. package/dist/esm-node/cli/is/env.mjs +6 -0
  125. package/dist/esm-node/cli/is/index.mjs +4 -0
  126. package/dist/esm-node/cli/is/project.mjs +104 -0
  127. package/dist/esm-node/cli/is/type.mjs +26 -0
  128. package/dist/esm-node/cli/logger.mjs +2 -0
  129. package/dist/esm-node/cli/monorepo.mjs +50 -0
  130. package/dist/esm-node/cli/package.mjs +51 -0
  131. package/dist/esm-node/cli/path.mjs +35 -0
  132. package/dist/esm-node/cli/port.mjs +35 -0
  133. package/dist/esm-node/cli/prettyInstructions.mjs +68 -0
  134. package/dist/esm-node/cli/require.mjs +79 -0
  135. package/dist/esm-node/cli/route.mjs +36 -0
  136. package/dist/esm-node/cli/runtimeExports.mjs +0 -0
  137. package/dist/esm-node/cli/version.mjs +21 -0
  138. package/dist/esm-node/cli/watch.mjs +40 -0
  139. package/dist/esm-node/compiled.mjs +115 -0
  140. package/dist/esm-node/import.mjs +25 -0
  141. package/dist/esm-node/index.mjs +3 -0
  142. package/dist/esm-node/universal/constants.mjs +13 -0
  143. package/dist/esm-node/universal/index.mjs +2 -0
  144. package/dist/esm-node/universal/path.mjs +2 -0
  145. package/dist/esm-node/universal/pluginDagSort.mjs +41 -0
  146. package/dist/types/cli/constants.d.ts +2 -26
  147. package/dist/types/cli/get/data.d.ts +0 -1
  148. package/dist/types/cli/index.d.ts +0 -1
  149. package/dist/types/cli/is/config.d.ts +1 -1
  150. package/dist/types/cli/runtimeExports.d.ts +1 -4
  151. package/dist/types/cli/watch.d.ts +1 -1
  152. package/dist/types/compiled.d.ts +0 -5
  153. package/dist/types/universal/constants.d.ts +4 -7
  154. package/package.json +27 -27
  155. package/rslib.config.mts +140 -0
  156. package/dist/cjs/cli/action.js +0 -55
  157. package/dist/cjs/universal/formatWebpack.js +0 -127
  158. package/dist/esm/cli/action.js +0 -68
  159. package/dist/esm/cli/alias.js +0 -43
  160. package/dist/esm/cli/applyOptionsChain.js +0 -29
  161. package/dist/esm/cli/babel.js +0 -122
  162. package/dist/esm/cli/commands.js +0 -39
  163. package/dist/esm/cli/common.js +0 -20
  164. package/dist/esm/cli/config.js +0 -11
  165. package/dist/esm/cli/constants.js +0 -114
  166. package/dist/esm/cli/ensure.js +0 -16
  167. package/dist/esm/cli/fs.js +0 -65
  168. package/dist/esm/cli/get/config.js +0 -19
  169. package/dist/esm/cli/get/data.js +0 -143
  170. package/dist/esm/cli/get/index.js +0 -38
  171. package/dist/esm/cli/index.js +0 -23
  172. package/dist/esm/cli/is/config.js +0 -70
  173. package/dist/esm/cli/is/env.js +0 -22
  174. package/dist/esm/cli/is/index.js +0 -4
  175. package/dist/esm/cli/is/project.js +0 -146
  176. package/dist/esm/cli/is/type.js +0 -39
  177. package/dist/esm/cli/logger.js +0 -5
  178. package/dist/esm/cli/monorepo.js +0 -82
  179. package/dist/esm/cli/package.js +0 -203
  180. package/dist/esm/cli/path.js +0 -66
  181. package/dist/esm/cli/port.js +0 -97
  182. package/dist/esm/cli/prettyInstructions.js +0 -102
  183. package/dist/esm/cli/require.js +0 -235
  184. package/dist/esm/cli/route.js +0 -64
  185. package/dist/esm/cli/runtimeExports.js +0 -44
  186. package/dist/esm/cli/version.js +0 -26
  187. package/dist/esm/cli/watch.js +0 -112
  188. package/dist/esm/compiled.js +0 -66
  189. package/dist/esm/import.js +0 -11
  190. package/dist/esm/index.js +0 -3
  191. package/dist/esm/universal/constants.js +0 -32
  192. package/dist/esm/universal/formatWebpack.js +0 -95
  193. package/dist/esm/universal/index.js +0 -4
  194. package/dist/esm/universal/path.js +0 -6
  195. package/dist/esm/universal/pluginDagSort.js +0 -73
  196. package/dist/esm-node/cli/action.js +0 -30
  197. package/dist/esm-node/cli/alias.js +0 -40
  198. package/dist/esm-node/cli/applyOptionsChain.js +0 -27
  199. package/dist/esm-node/cli/babel.js +0 -107
  200. package/dist/esm-node/cli/commands.js +0 -39
  201. package/dist/esm-node/cli/common.js +0 -15
  202. package/dist/esm-node/cli/config.js +0 -9
  203. package/dist/esm-node/cli/constants.js +0 -114
  204. package/dist/esm-node/cli/ensure.js +0 -14
  205. package/dist/esm-node/cli/fs.js +0 -18
  206. package/dist/esm-node/cli/get/config.js +0 -19
  207. package/dist/esm-node/cli/get/data.js +0 -96
  208. package/dist/esm-node/cli/get/index.js +0 -22
  209. package/dist/esm-node/cli/is/config.js +0 -50
  210. package/dist/esm-node/cli/is/env.js +0 -12
  211. package/dist/esm-node/cli/is/project.js +0 -105
  212. package/dist/esm-node/cli/is/type.js +0 -36
  213. package/dist/esm-node/cli/logger.js +0 -5
  214. package/dist/esm-node/cli/monorepo.js +0 -67
  215. package/dist/esm-node/cli/package.js +0 -66
  216. package/dist/esm-node/cli/path.js +0 -48
  217. package/dist/esm-node/cli/port.js +0 -48
  218. package/dist/esm-node/cli/prettyInstructions.js +0 -90
  219. package/dist/esm-node/cli/require.js +0 -111
  220. package/dist/esm-node/cli/route.js +0 -60
  221. package/dist/esm-node/cli/runtimeExports.js +0 -38
  222. package/dist/esm-node/cli/version.js +0 -26
  223. package/dist/esm-node/cli/watch.js +0 -45
  224. package/dist/esm-node/compiled.js +0 -66
  225. package/dist/esm-node/import.js +0 -11
  226. package/dist/esm-node/universal/constants.js +0 -32
  227. package/dist/esm-node/universal/formatWebpack.js +0 -102
  228. package/dist/esm-node/universal/path.js +0 -6
  229. package/dist/esm-node/universal/pluginDagSort.js +0 -50
  230. package/dist/types/cli/action.d.ts +0 -2
  231. package/dist/types/universal/formatWebpack.d.ts +0 -26
  232. /package/dist/{esm-node/cli/is/index.js → esm/cli/is/index.mjs} +0 -0
  233. /package/dist/{esm-node/index.js → esm/index.mjs} +0 -0
@@ -1,76 +1,82 @@
1
1
  "use strict";
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 });
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 alias_exports = {};
30
- __export(alias_exports, {
31
- getAliasConfig: () => getAliasConfig,
32
- getUserAlias: () => getUserAlias,
33
- mergeAlias: () => mergeAlias
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ getUserAlias: ()=>getUserAlias,
37
+ getAliasConfig: ()=>getAliasConfig,
38
+ mergeAlias: ()=>mergeAlias
34
39
  });
35
- module.exports = __toCommonJS(alias_exports);
36
- var import_fs = __toESM(require("fs"));
37
- var import_path = __toESM(require("path"));
38
- var import_applyOptionsChain = require("./applyOptionsChain");
39
- var import_get = require("./get");
40
- const mergeAlias = (alias) => (0, import_applyOptionsChain.applyOptionsChain)({}, alias);
41
- const getAliasConfig = (aliasOption, option) => {
42
- var _tsconfig_compilerOptions, _tsconfig_compilerOptions1;
43
- const isTsProject = import_fs.default.existsSync(option.tsconfigPath);
44
- const alias = mergeAlias(aliasOption);
45
- if (!isTsProject) {
40
+ const external_fs_namespaceObject = require("fs");
41
+ var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
42
+ const external_path_namespaceObject = require("path");
43
+ var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
44
+ const external_applyOptionsChain_js_namespaceObject = require("./applyOptionsChain.js");
45
+ const index_js_namespaceObject = require("./get/index.js");
46
+ const mergeAlias = (alias)=>(0, external_applyOptionsChain_js_namespaceObject.applyOptionsChain)({}, alias);
47
+ const getAliasConfig = (aliasOption, option)=>{
48
+ const isTsProject = external_fs_default().existsSync(option.tsconfigPath);
49
+ const alias = mergeAlias(aliasOption);
50
+ if (!isTsProject) return {
51
+ absoluteBaseUrl: option.appDirectory,
52
+ paths: alias,
53
+ isTsPath: false,
54
+ isTsProject
55
+ };
56
+ const tsconfig = (0, index_js_namespaceObject.readTsConfigByFile)(option.tsconfigPath);
57
+ const baseUrl = tsconfig?.compilerOptions?.baseUrl;
46
58
  return {
47
- absoluteBaseUrl: option.appDirectory,
48
- paths: alias,
49
- isTsPath: false,
50
- isTsProject
59
+ absoluteBaseUrl: baseUrl ? external_path_default().join(option.appDirectory, baseUrl) : option.appDirectory,
60
+ paths: {
61
+ ...alias,
62
+ ...tsconfig?.compilerOptions?.paths
63
+ },
64
+ isTsPath: true,
65
+ isTsProject
51
66
  };
52
- }
53
- const tsconfig = (0, import_get.readTsConfigByFile)(option.tsconfigPath);
54
- const baseUrl = tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions === void 0 ? void 0 : _tsconfig_compilerOptions.baseUrl;
55
- return {
56
- absoluteBaseUrl: baseUrl ? import_path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
57
- paths: {
58
- ...alias,
59
- ...tsconfig === null || tsconfig === void 0 ? void 0 : (_tsconfig_compilerOptions1 = tsconfig.compilerOptions) === null || _tsconfig_compilerOptions1 === void 0 ? void 0 : _tsconfig_compilerOptions1.paths
60
- },
61
- isTsPath: true,
62
- isTsProject
63
- };
64
67
  };
65
- const getUserAlias = (alias = {}) => Object.keys(alias).reduce((o, k) => {
66
- if (Array.isArray(alias[k])) {
67
- o[k] = alias[k];
68
- }
69
- return o;
70
- }, {});
71
- // Annotate the CommonJS export names for ESM import in node:
72
- 0 && (module.exports = {
73
- getAliasConfig,
74
- getUserAlias,
75
- mergeAlias
68
+ const getUserAlias = (alias = {})=>Object.keys(alias).reduce((o, k)=>{
69
+ if (Array.isArray(alias[k])) o[k] = alias[k];
70
+ return o;
71
+ }, {});
72
+ exports.getAliasConfig = __webpack_exports__.getAliasConfig;
73
+ exports.getUserAlias = __webpack_exports__.getUserAlias;
74
+ exports.mergeAlias = __webpack_exports__.mergeAlias;
75
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
76
+ "getAliasConfig",
77
+ "getUserAlias",
78
+ "mergeAlias"
79
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
80
+ Object.defineProperty(exports, '__esModule', {
81
+ value: true
76
82
  });
@@ -1,51 +1,50 @@
1
1
  "use strict";
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 });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var applyOptionsChain_exports = {};
20
- __export(applyOptionsChain_exports, {
21
- applyOptionsChain: () => applyOptionsChain
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ applyOptionsChain: ()=>applyOptionsChain
22
28
  });
23
- module.exports = __toCommonJS(applyOptionsChain_exports);
24
- var import_is = require("./is");
25
- var import_logger = require("./logger");
29
+ const index_js_namespaceObject = require("./is/index.js");
30
+ const external_logger_js_namespaceObject = require("./logger.js");
26
31
  function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
27
- if (!options) {
32
+ if (!options) return defaults;
33
+ if ((0, index_js_namespaceObject.isPlainObject)(options)) return mergeFn(defaults, options);
34
+ if ((0, index_js_namespaceObject.isFunction)(options)) {
35
+ const ret = options(defaults, utils);
36
+ if (ret) {
37
+ if (!(0, index_js_namespaceObject.isPlainObject)(ret)) external_logger_js_namespaceObject.logger.warn(`${options.name}: Function should mutate the config and return nothing, Or return a cloned or merged version of config object.`);
38
+ return ret;
39
+ }
40
+ } else if (Array.isArray(options)) return options.reduce((memo, cur)=>applyOptionsChain(memo, cur, utils, mergeFn), defaults);
41
+ else throw new Error(`applyOptionsChain error:\ndefault options is: ${JSON.stringify(defaults)}`);
28
42
  return defaults;
29
- }
30
- if ((0, import_is.isPlainObject)(options)) {
31
- return mergeFn(defaults, options);
32
- } else if ((0, import_is.isFunction)(options)) {
33
- const ret = options(defaults, utils);
34
- if (ret) {
35
- if (!(0, import_is.isPlainObject)(ret)) {
36
- import_logger.logger.warn(`${options.name}: Function should mutate the config and return nothing, Or return a cloned or merged version of config object.`);
37
- }
38
- return ret;
39
- }
40
- } else if (Array.isArray(options)) {
41
- return options.reduce((memo, cur) => applyOptionsChain(memo, cur, utils, mergeFn), defaults);
42
- } else {
43
- throw new Error(`applyOptionsChain error:
44
- default options is: ${JSON.stringify(defaults)}`);
45
- }
46
- return defaults;
47
43
  }
48
- // Annotate the CommonJS export names for ESM import in node:
49
- 0 && (module.exports = {
50
- applyOptionsChain
44
+ exports.applyOptionsChain = __webpack_exports__.applyOptionsChain;
45
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
46
+ "applyOptionsChain"
47
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
48
+ Object.defineProperty(exports, '__esModule', {
49
+ value: true
51
50
  });
@@ -1,132 +1,113 @@
1
1
  "use strict";
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 });
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ applyUserBabelConfig: ()=>applyUserBabelConfig,
28
+ getBabelUtils: ()=>getBabelUtils
29
+ });
30
+ const external_path_namespaceObject = require("path");
31
+ const external_applyOptionsChain_js_namespaceObject = require("./applyOptionsChain.js");
32
+ const external_ensure_js_namespaceObject = require("./ensure.js");
33
+ const external_path_js_namespaceObject = require("./path.js");
34
+ const formatPath = (originPath)=>{
35
+ if ((0, external_path_namespaceObject.isAbsolute)(originPath)) return originPath.split(external_path_namespaceObject.sep).join('/');
36
+ return originPath;
9
37
  };
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 });
15
- }
16
- return to;
38
+ const getPluginItemName = (item)=>{
39
+ if ('string' == typeof item) return formatPath(item);
40
+ if (Array.isArray(item) && 'string' == typeof item[0]) return formatPath(item[0]);
41
+ return null;
17
42
  };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var babel_exports = {};
20
- __export(babel_exports, {
21
- applyUserBabelConfig: () => applyUserBabelConfig,
22
- getBabelUtils: () => getBabelUtils
23
- });
24
- module.exports = __toCommonJS(babel_exports);
25
- var import_path = require("path");
26
- var import_applyOptionsChain = require("./applyOptionsChain");
27
- var import_ensure = require("./ensure");
28
- var import_path2 = require("./path");
29
- const formatPath = (originPath) => {
30
- if ((0, import_path.isAbsolute)(originPath)) {
31
- return originPath.split(import_path.sep).join("/");
32
- }
33
- return originPath;
43
+ const addPlugins = (plugins, config)=>{
44
+ if (config.plugins) config.plugins.push(...plugins);
45
+ else config.plugins = plugins;
34
46
  };
35
- const getPluginItemName = (item) => {
36
- if (typeof item === "string") {
37
- return formatPath(item);
38
- }
39
- if (Array.isArray(item) && typeof item[0] === "string") {
40
- return formatPath(item[0]);
41
- }
42
- return null;
47
+ const addPresets = (presets, config)=>{
48
+ if (config.presets) config.presets.push(...presets);
49
+ else config.presets = presets;
43
50
  };
44
- const addPlugins = (plugins, config) => {
45
- if (config.plugins) {
46
- config.plugins.push(...plugins);
47
- } else {
48
- config.plugins = plugins;
49
- }
51
+ const removePlugins = (plugins, config)=>{
52
+ if (!config.plugins) return;
53
+ const removeList = (0, external_ensure_js_namespaceObject.ensureArray)(plugins);
54
+ config.plugins = config.plugins.filter((item)=>{
55
+ const name = getPluginItemName(item);
56
+ if (name) return !removeList.find((removeItem)=>name.includes(removeItem));
57
+ return true;
58
+ });
50
59
  };
51
- const addPresets = (presets, config) => {
52
- if (config.presets) {
53
- config.presets.push(...presets);
54
- } else {
55
- config.presets = presets;
56
- }
60
+ const removePresets = (presets, config)=>{
61
+ if (!config.presets) return;
62
+ const removeList = (0, external_ensure_js_namespaceObject.ensureArray)(presets);
63
+ config.presets = config.presets.filter((item)=>{
64
+ const name = getPluginItemName(item);
65
+ if (name) return !removeList.find((removeItem)=>name.includes(removeItem));
66
+ return true;
67
+ });
57
68
  };
58
- const removePlugins = (plugins, config) => {
59
- if (!config.plugins) {
60
- return;
61
- }
62
- const removeList = (0, import_ensure.ensureArray)(plugins);
63
- config.plugins = config.plugins.filter((item) => {
64
- const name = getPluginItemName(item);
65
- if (name) {
66
- return !removeList.find((removeItem) => name.includes(removeItem));
67
- }
68
- return true;
69
- });
69
+ const modifyPresetOptions = (presetName, options, presets = [])=>{
70
+ presets.forEach((preset, index)=>{
71
+ if (Array.isArray(preset)) {
72
+ if ('string' == typeof preset[0] && (0, external_path_js_namespaceObject.normalizeToPosixPath)(preset[0]).includes(presetName)) preset[1] = {
73
+ ...preset[1] || {},
74
+ ...options
75
+ };
76
+ } else if ('string' == typeof preset && (0, external_path_js_namespaceObject.normalizeToPosixPath)(preset).includes(presetName)) presets[index] = [
77
+ preset,
78
+ options
79
+ ];
80
+ });
70
81
  };
71
- const removePresets = (presets, config) => {
72
- if (!config.presets) {
73
- return;
74
- }
75
- const removeList = (0, import_ensure.ensureArray)(presets);
76
- config.presets = config.presets.filter((item) => {
77
- const name = getPluginItemName(item);
78
- if (name) {
79
- return !removeList.find((removeItem) => name.includes(removeItem));
80
- }
81
- return true;
82
- });
82
+ const getBabelUtils = (config)=>{
83
+ const noop = ()=>{};
84
+ return {
85
+ addPlugins: (plugins)=>addPlugins(plugins, config),
86
+ addPresets: (presets)=>addPresets(presets, config),
87
+ removePlugins: (plugins)=>removePlugins(plugins, config),
88
+ removePresets: (presets)=>removePresets(presets, config),
89
+ addIncludes: noop,
90
+ addExcludes: noop,
91
+ modifyPresetEnvOptions: (options)=>modifyPresetOptions('@babel/preset-env', options, config.presets || []),
92
+ modifyPresetReactOptions: (options)=>modifyPresetOptions('@babel/preset-react', options, config.presets || [])
93
+ };
83
94
  };
84
- const modifyPresetOptions = (presetName, options, presets = []) => {
85
- presets.forEach((preset, index) => {
86
- if (Array.isArray(preset)) {
87
- if (typeof preset[0] === "string" && (0, import_path2.normalizeToPosixPath)(preset[0]).includes(presetName)) {
88
- preset[1] = {
89
- ...preset[1] || {},
90
- ...options
95
+ const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils)=>{
96
+ if (userBabelConfig) {
97
+ const babelUtils = {
98
+ ...getBabelUtils(defaultOptions),
99
+ ...extraBabelUtils
91
100
  };
92
- }
93
- } else if (typeof preset === "string" && (0, import_path2.normalizeToPosixPath)(preset).includes(presetName)) {
94
- presets[index] = [
95
- preset,
96
- options
97
- ];
101
+ return (0, external_applyOptionsChain_js_namespaceObject.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
98
102
  }
99
- });
100
- };
101
- const getBabelUtils = (config) => {
102
- const noop = () => {
103
- };
104
- return {
105
- addPlugins: (plugins) => addPlugins(plugins, config),
106
- addPresets: (presets) => addPresets(presets, config),
107
- removePlugins: (plugins) => removePlugins(plugins, config),
108
- removePresets: (presets) => removePresets(presets, config),
109
- // `addIncludes` and `addExcludes` are noop functions by default,
110
- // It can be overridden by `extraBabelUtils`.
111
- addIncludes: noop,
112
- addExcludes: noop,
113
- // Compat `presetEnvOptions` and `presetReactOptions` in Eden.
114
- modifyPresetEnvOptions: (options) => modifyPresetOptions("@babel/preset-env", options, config.presets || []),
115
- modifyPresetReactOptions: (options) => modifyPresetOptions("@babel/preset-react", options, config.presets || [])
116
- };
117
- };
118
- const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
119
- if (userBabelConfig) {
120
- const babelUtils = {
121
- ...getBabelUtils(defaultOptions),
122
- ...extraBabelUtils
123
- };
124
- return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
125
- }
126
- return defaultOptions;
103
+ return defaultOptions;
127
104
  };
128
- // Annotate the CommonJS export names for ESM import in node:
129
- 0 && (module.exports = {
130
- applyUserBabelConfig,
131
- getBabelUtils
105
+ exports.applyUserBabelConfig = __webpack_exports__.applyUserBabelConfig;
106
+ exports.getBabelUtils = __webpack_exports__.getBabelUtils;
107
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
108
+ "applyUserBabelConfig",
109
+ "getBabelUtils"
110
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
111
+ Object.defineProperty(exports, '__esModule', {
112
+ value: true
132
113
  });
@@ -1,67 +1,69 @@
1
1
  "use strict";
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 });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var commands_exports = {};
20
- __export(commands_exports, {
21
- deprecatedCommands: () => deprecatedCommands,
22
- getArgv: () => getArgv,
23
- getCommand: () => getCommand,
24
- getFullArgv: () => getFullArgv,
25
- isDevCommand: () => isDevCommand
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ getCommand: ()=>getCommand,
28
+ getArgv: ()=>getArgv,
29
+ getFullArgv: ()=>getFullArgv,
30
+ deprecatedCommands: ()=>deprecatedCommands,
31
+ isDevCommand: ()=>isDevCommand
26
32
  });
27
- module.exports = __toCommonJS(commands_exports);
28
- var import_logger = require("./logger");
29
- const getFullArgv = () => {
30
- var _process_env_MODERN_ARGV;
31
- return ((_process_env_MODERN_ARGV = process.env.MODERN_ARGV) === null || _process_env_MODERN_ARGV === void 0 ? void 0 : _process_env_MODERN_ARGV.split(" ")) || process.argv;
32
- };
33
- const getArgv = () => {
34
- return getFullArgv().slice(2);
35
- };
36
- const getCommand = () => {
37
- const args = getArgv();
38
- const command = args[0];
39
- return command;
33
+ const external_logger_js_namespaceObject = require("./logger.js");
34
+ const getFullArgv = ()=>process.env.MODERN_ARGV?.split(' ') || process.argv;
35
+ const getArgv = ()=>getFullArgv().slice(2);
36
+ const getCommand = ()=>{
37
+ const args = getArgv();
38
+ const command = args[0];
39
+ return command;
40
40
  };
41
- const isDevCommand = () => {
42
- const command = getCommand();
43
- return command === "dev" || command === "start";
41
+ const isDevCommand = ()=>{
42
+ const command = getCommand();
43
+ return 'dev' === command || 'start' === command;
44
44
  };
45
- const deprecatedCommands = (program) => {
46
- var _program_commandsMap, _program_commandsMap1;
47
- const lintCommand = (_program_commandsMap = program.commandsMap) === null || _program_commandsMap === void 0 ? void 0 : _program_commandsMap.get("lint");
48
- if (!lintCommand) {
49
- program.command("lint [...files]").allowUnknownOption().description("Deprecated").action(() => {
50
- import_logger.logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
45
+ const deprecatedCommands = (program)=>{
46
+ const lintCommand = program.commandsMap?.get('lint');
47
+ if (!lintCommand) program.command('lint [...files]').allowUnknownOption().description('Deprecated').action(()=>{
48
+ external_logger_js_namespaceObject.logger.warn('The "modern lint" command is deprecated, please use "eslint" or "biome" instead.');
51
49
  });
52
- }
53
- const preCommitCommand = (_program_commandsMap1 = program.commandsMap) === null || _program_commandsMap1 === void 0 ? void 0 : _program_commandsMap1.get("pre-commit");
54
- if (!preCommitCommand) {
55
- program.command("pre-commit").description("Deprecated").action(() => {
56
- import_logger.logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
50
+ const preCommitCommand = program.commandsMap?.get('pre-commit');
51
+ if (!preCommitCommand) program.command('pre-commit').description('Deprecated').action(()=>{
52
+ external_logger_js_namespaceObject.logger.warn('The "modern pre-commit" command is deprecated, please use "lint-staged" instead.');
57
53
  });
58
- }
59
54
  };
60
- // Annotate the CommonJS export names for ESM import in node:
61
- 0 && (module.exports = {
62
- deprecatedCommands,
63
- getArgv,
64
- getCommand,
65
- getFullArgv,
66
- isDevCommand
55
+ exports.deprecatedCommands = __webpack_exports__.deprecatedCommands;
56
+ exports.getArgv = __webpack_exports__.getArgv;
57
+ exports.getCommand = __webpack_exports__.getCommand;
58
+ exports.getFullArgv = __webpack_exports__.getFullArgv;
59
+ exports.isDevCommand = __webpack_exports__.isDevCommand;
60
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
61
+ "deprecatedCommands",
62
+ "getArgv",
63
+ "getCommand",
64
+ "getFullArgv",
65
+ "isDevCommand"
66
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
67
+ Object.defineProperty(exports, '__esModule', {
68
+ value: true
67
69
  });