@modern-js/utils 2.12.0 → 2.12.1-alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. package/dist/{alias.js → cjs/alias.js} +4 -15
  2. package/dist/{analyzeProject.js → cjs/analyzeProject.js} +5 -25
  3. package/dist/{babel.js → cjs/babel.js} +9 -16
  4. package/dist/{compatRequire.js → cjs/compatRequire.js} +4 -17
  5. package/dist/{compiled.js → cjs/compiled.js} +3 -3
  6. package/dist/cjs/emptyDir.js +32 -0
  7. package/dist/{getEntryOptions.js → cjs/getEntryOptions.js} +1 -15
  8. package/dist/{getPackageManager.js → cjs/getPackageManager.js} +19 -41
  9. package/dist/{getPort.js → cjs/getPort.js} +4 -24
  10. package/dist/{getServerConfig.js → cjs/getServerConfig.js} +2 -22
  11. package/dist/{import.js → cjs/import.js} +1 -1
  12. package/dist/{logger.js → cjs/logger.js} +5 -16
  13. package/dist/{monorepo.js → cjs/monorepo.js} +4 -15
  14. package/dist/cjs/nodeEnv.js +55 -0
  15. package/dist/{path.js → cjs/path.js} +1 -1
  16. package/dist/{pathSerializer.js → cjs/pathSerializer.js} +1 -1
  17. package/dist/{react.js → cjs/react.js} +4 -15
  18. package/dist/{runtimeExports.js → cjs/runtimeExports.js} +1 -1
  19. package/dist/{universal → cjs/universal}/nestedRoutes.js +2 -19
  20. package/dist/cjs/version.js +59 -0
  21. package/dist/{watch.js → cjs/watch.js} +9 -29
  22. package/dist/esm/FileSizeReporter.js +180 -0
  23. package/dist/esm/alias.js +83 -0
  24. package/dist/esm/analyzeProject.js +168 -0
  25. package/dist/esm/applyOptionsChain.js +26 -0
  26. package/dist/esm/babel.js +169 -0
  27. package/dist/esm/chainId.js +92 -0
  28. package/dist/esm/clearConsole.js +6 -0
  29. package/dist/esm/commands.js +17 -0
  30. package/dist/esm/compatRequire.js +68 -0
  31. package/dist/esm/compiled.js +34 -0
  32. package/dist/esm/constants.js +317 -0
  33. package/dist/esm/debug.js +5 -0
  34. package/dist/esm/emptyDir.js +158 -0
  35. package/dist/esm/ensureAbsolutePath.js +5 -0
  36. package/dist/esm/ensureArray.js +9 -0
  37. package/dist/esm/findExists.js +27 -0
  38. package/dist/esm/generateMetaTags.js +40 -0
  39. package/dist/esm/getBrowserslist.js +12 -0
  40. package/dist/esm/getCoreJsVersion.js +57 -0
  41. package/dist/esm/getEntryOptions.js +45 -0
  42. package/dist/esm/getPackageManager.js +187 -0
  43. package/dist/esm/getPort.js +215 -0
  44. package/dist/esm/getServerConfig.js +145 -0
  45. package/dist/esm/getTargetDir.js +6 -0
  46. package/dist/esm/import.js +8 -0
  47. package/dist/esm/index.js +44 -0
  48. package/dist/esm/is/index.js +85 -0
  49. package/dist/esm/is/nodeEnv.js +16 -0
  50. package/dist/esm/is/platform.js +7 -0
  51. package/dist/esm/is/type.js +25 -0
  52. package/dist/esm/logger.js +207 -0
  53. package/dist/esm/monorepo.js +109 -0
  54. package/dist/esm/nodeEnv.js +258 -0
  55. package/dist/esm/path.js +85 -0
  56. package/dist/esm/pathSerializer.js +85 -0
  57. package/dist/esm/plugin.js +45 -0
  58. package/dist/esm/prettyInstructions.js +96 -0
  59. package/dist/esm/printBuildError.js +24 -0
  60. package/dist/esm/react.js +43 -0
  61. package/dist/esm/readTsConfig.js +10 -0
  62. package/dist/esm/removeSlash.js +10 -0
  63. package/dist/esm/resolve.js +42 -0
  64. package/dist/esm/routes.js +19 -0
  65. package/dist/esm/runtimeExports.js +65 -0
  66. package/dist/esm/ssr.js +3 -0
  67. package/dist/esm/storage.js +36 -0
  68. package/dist/esm/testUtils.js +13 -0
  69. package/dist/esm/types.js +1 -0
  70. package/dist/esm/universal/constants.js +3 -0
  71. package/dist/esm/universal/formatWebpack.js +108 -0
  72. package/dist/esm/universal/nestedRoutes.js +174 -0
  73. package/dist/esm/universal/remixRouter.js +1 -0
  74. package/dist/esm/universal/serialize.js +7 -0
  75. package/dist/esm/version.js +193 -0
  76. package/dist/esm/wait.js +7 -0
  77. package/dist/esm/watch.js +230 -0
  78. package/dist/esm-node/FileSizeReporter.js +133 -0
  79. package/dist/esm-node/alias.js +61 -0
  80. package/dist/esm-node/analyzeProject.js +17 -0
  81. package/dist/esm-node/applyOptionsChain.js +35 -0
  82. package/dist/esm-node/babel.js +105 -0
  83. package/dist/esm-node/chainId.js +173 -0
  84. package/dist/esm-node/clearConsole.js +8 -0
  85. package/dist/esm-node/commands.js +22 -0
  86. package/dist/esm-node/compatRequire.js +42 -0
  87. package/dist/esm-node/compiled.js +77 -0
  88. package/dist/esm-node/constants.js +264 -0
  89. package/dist/esm-node/debug.js +5 -0
  90. package/dist/esm-node/emptyDir.js +9 -0
  91. package/dist/esm-node/ensureAbsolutePath.js +5 -0
  92. package/dist/esm-node/ensureArray.js +9 -0
  93. package/dist/esm-node/findExists.js +12 -0
  94. package/dist/esm-node/generateMetaTags.js +38 -0
  95. package/dist/esm-node/getBrowserslist.js +7 -0
  96. package/dist/esm-node/getCoreJsVersion.js +13 -0
  97. package/dist/esm-node/getEntryOptions.js +17 -0
  98. package/dist/esm-node/getPackageManager.js +32 -0
  99. package/dist/esm-node/getPort.js +59 -0
  100. package/dist/esm-node/getServerConfig.js +14 -0
  101. package/dist/esm-node/getTargetDir.js +8 -0
  102. package/dist/esm-node/import.js +9 -0
  103. package/dist/esm-node/index.js +44 -0
  104. package/dist/esm-node/is/index.js +71 -0
  105. package/dist/esm-node/is/nodeEnv.js +12 -0
  106. package/dist/esm-node/is/platform.js +6 -0
  107. package/dist/esm-node/is/type.js +34 -0
  108. package/dist/esm-node/logger.js +100 -0
  109. package/dist/esm-node/monorepo.js +87 -0
  110. package/dist/esm-node/nodeEnv.js +30 -0
  111. package/dist/esm-node/path.js +50 -0
  112. package/dist/esm-node/pathSerializer.js +46 -0
  113. package/dist/esm-node/plugin.js +23 -0
  114. package/dist/esm-node/prettyInstructions.js +77 -0
  115. package/dist/esm-node/printBuildError.js +34 -0
  116. package/dist/esm-node/react.js +20 -0
  117. package/dist/esm-node/readTsConfig.js +13 -0
  118. package/dist/esm-node/removeSlash.js +8 -0
  119. package/dist/esm-node/resolve.js +38 -0
  120. package/dist/esm-node/routes.js +24 -0
  121. package/dist/esm-node/runtimeExports.js +40 -0
  122. package/dist/esm-node/ssr.js +6 -0
  123. package/dist/esm-node/storage.js +42 -0
  124. package/dist/esm-node/testUtils.js +15 -0
  125. package/dist/esm-node/types.js +0 -0
  126. package/dist/esm-node/universal/constants.js +6 -0
  127. package/dist/esm-node/universal/formatWebpack.js +77 -0
  128. package/dist/esm-node/universal/nestedRoutes.js +93 -0
  129. package/dist/esm-node/universal/remixRouter.js +1 -0
  130. package/dist/esm-node/universal/serialize.js +7 -0
  131. package/dist/esm-node/version.js +25 -0
  132. package/dist/esm-node/wait.js +6 -0
  133. package/dist/esm-node/watch.js +36 -0
  134. package/dist/types/compiled.d.ts +43 -0
  135. package/dist/{debug.d.ts → types/debug.d.ts} +1 -1
  136. package/dist/{logger.d.ts → types/logger.d.ts} +1 -1
  137. package/package.json +53 -21
  138. package/dist/compiled.d.ts +0 -43
  139. package/dist/emptyDir.js +0 -52
  140. package/dist/nodeEnv.js +0 -81
  141. package/dist/version.js +0 -92
  142. /package/dist/{FileSizeReporter.js → cjs/FileSizeReporter.js} +0 -0
  143. /package/dist/{applyOptionsChain.js → cjs/applyOptionsChain.js} +0 -0
  144. /package/dist/{chainId.js → cjs/chainId.js} +0 -0
  145. /package/dist/{clearConsole.js → cjs/clearConsole.js} +0 -0
  146. /package/dist/{commands.js → cjs/commands.js} +0 -0
  147. /package/dist/{constants.js → cjs/constants.js} +0 -0
  148. /package/dist/{debug.js → cjs/debug.js} +0 -0
  149. /package/dist/{ensureAbsolutePath.js → cjs/ensureAbsolutePath.js} +0 -0
  150. /package/dist/{ensureArray.js → cjs/ensureArray.js} +0 -0
  151. /package/dist/{findExists.js → cjs/findExists.js} +0 -0
  152. /package/dist/{generateMetaTags.js → cjs/generateMetaTags.js} +0 -0
  153. /package/dist/{getBrowserslist.js → cjs/getBrowserslist.js} +0 -0
  154. /package/dist/{getCoreJsVersion.js → cjs/getCoreJsVersion.js} +0 -0
  155. /package/dist/{getTargetDir.js → cjs/getTargetDir.js} +0 -0
  156. /package/dist/{index.js → cjs/index.js} +0 -0
  157. /package/dist/{is → cjs/is}/index.js +0 -0
  158. /package/dist/{is → cjs/is}/nodeEnv.js +0 -0
  159. /package/dist/{is → cjs/is}/platform.js +0 -0
  160. /package/dist/{is → cjs/is}/type.js +0 -0
  161. /package/dist/{plugin.js → cjs/plugin.js} +0 -0
  162. /package/dist/{prettyInstructions.js → cjs/prettyInstructions.js} +0 -0
  163. /package/dist/{printBuildError.js → cjs/printBuildError.js} +0 -0
  164. /package/dist/{readTsConfig.js → cjs/readTsConfig.js} +0 -0
  165. /package/dist/{removeSlash.js → cjs/removeSlash.js} +0 -0
  166. /package/dist/{resolve.js → cjs/resolve.js} +0 -0
  167. /package/dist/{routes.js → cjs/routes.js} +0 -0
  168. /package/dist/{ssr.js → cjs/ssr.js} +0 -0
  169. /package/dist/{storage.js → cjs/storage.js} +0 -0
  170. /package/dist/{testUtils.js → cjs/testUtils.js} +0 -0
  171. /package/dist/{types.js → cjs/types.js} +0 -0
  172. /package/dist/{universal → cjs/universal}/constants.js +0 -0
  173. /package/dist/{universal → cjs/universal}/formatWebpack.js +0 -0
  174. /package/dist/{universal → cjs/universal}/remixRouter.js +0 -0
  175. /package/dist/{universal → cjs/universal}/serialize.js +0 -0
  176. /package/dist/{wait.js → cjs/wait.js} +0 -0
  177. /package/dist/{FileSizeReporter.d.ts → types/FileSizeReporter.d.ts} +0 -0
  178. /package/dist/{alias.d.ts → types/alias.d.ts} +0 -0
  179. /package/dist/{analyzeProject.d.ts → types/analyzeProject.d.ts} +0 -0
  180. /package/dist/{applyOptionsChain.d.ts → types/applyOptionsChain.d.ts} +0 -0
  181. /package/dist/{babel.d.ts → types/babel.d.ts} +0 -0
  182. /package/dist/{chainId.d.ts → types/chainId.d.ts} +0 -0
  183. /package/dist/{clearConsole.d.ts → types/clearConsole.d.ts} +0 -0
  184. /package/dist/{commands.d.ts → types/commands.d.ts} +0 -0
  185. /package/dist/{compatRequire.d.ts → types/compatRequire.d.ts} +0 -0
  186. /package/dist/{constants.d.ts → types/constants.d.ts} +0 -0
  187. /package/dist/{emptyDir.d.ts → types/emptyDir.d.ts} +0 -0
  188. /package/dist/{ensureAbsolutePath.d.ts → types/ensureAbsolutePath.d.ts} +0 -0
  189. /package/dist/{ensureArray.d.ts → types/ensureArray.d.ts} +0 -0
  190. /package/dist/{findExists.d.ts → types/findExists.d.ts} +0 -0
  191. /package/dist/{generateMetaTags.d.ts → types/generateMetaTags.d.ts} +0 -0
  192. /package/dist/{getBrowserslist.d.ts → types/getBrowserslist.d.ts} +0 -0
  193. /package/dist/{getCoreJsVersion.d.ts → types/getCoreJsVersion.d.ts} +0 -0
  194. /package/dist/{getEntryOptions.d.ts → types/getEntryOptions.d.ts} +0 -0
  195. /package/dist/{getPackageManager.d.ts → types/getPackageManager.d.ts} +0 -0
  196. /package/dist/{getPort.d.ts → types/getPort.d.ts} +0 -0
  197. /package/dist/{getServerConfig.d.ts → types/getServerConfig.d.ts} +0 -0
  198. /package/dist/{getTargetDir.d.ts → types/getTargetDir.d.ts} +0 -0
  199. /package/dist/{import.d.ts → types/import.d.ts} +0 -0
  200. /package/dist/{index.d.ts → types/index.d.ts} +0 -0
  201. /package/dist/{is → types/is}/index.d.ts +0 -0
  202. /package/dist/{is → types/is}/nodeEnv.d.ts +0 -0
  203. /package/dist/{is → types/is}/platform.d.ts +0 -0
  204. /package/dist/{is → types/is}/type.d.ts +0 -0
  205. /package/dist/{monorepo.d.ts → types/monorepo.d.ts} +0 -0
  206. /package/dist/{nodeEnv.d.ts → types/nodeEnv.d.ts} +0 -0
  207. /package/dist/{path.d.ts → types/path.d.ts} +0 -0
  208. /package/dist/{pathSerializer.d.ts → types/pathSerializer.d.ts} +0 -0
  209. /package/dist/{plugin.d.ts → types/plugin.d.ts} +0 -0
  210. /package/dist/{prettyInstructions.d.ts → types/prettyInstructions.d.ts} +0 -0
  211. /package/dist/{printBuildError.d.ts → types/printBuildError.d.ts} +0 -0
  212. /package/dist/{react.d.ts → types/react.d.ts} +0 -0
  213. /package/dist/{readTsConfig.d.ts → types/readTsConfig.d.ts} +0 -0
  214. /package/dist/{removeSlash.d.ts → types/removeSlash.d.ts} +0 -0
  215. /package/dist/{resolve.d.ts → types/resolve.d.ts} +0 -0
  216. /package/dist/{routes.d.ts → types/routes.d.ts} +0 -0
  217. /package/dist/{runtimeExports.d.ts → types/runtimeExports.d.ts} +0 -0
  218. /package/dist/{ssr.d.ts → types/ssr.d.ts} +0 -0
  219. /package/dist/{storage.d.ts → types/storage.d.ts} +0 -0
  220. /package/dist/{testUtils.d.ts → types/testUtils.d.ts} +0 -0
  221. /package/dist/{types.d.ts → types/types.d.ts} +0 -0
  222. /package/dist/{universal → types/universal}/constants.d.ts +0 -0
  223. /package/dist/{universal → types/universal}/formatWebpack.d.ts +0 -0
  224. /package/dist/{universal → types/universal}/nestedRoutes.d.ts +0 -0
  225. /package/dist/{universal → types/universal}/remixRouter.d.ts +0 -0
  226. /package/dist/{universal → types/universal}/serialize.d.ts +0 -0
  227. /package/dist/{version.d.ts → types/version.d.ts} +0 -0
  228. /package/dist/{wait.d.ts → types/wait.d.ts} +0 -0
  229. /package/dist/{watch.d.ts → types/watch.d.ts} +0 -0
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -88,7 +74,10 @@ const getAliasConfig = (aliasOption, option) => {
88
74
  const baseUrl = (_a = tsconfig == null ? void 0 : tsconfig.compilerOptions) == null ? void 0 : _a.baseUrl;
89
75
  return {
90
76
  absoluteBaseUrl: baseUrl ? import_path.default.join(option.appDirectory, baseUrl) : option.appDirectory,
91
- paths: __spreadValues(__spreadValues({}, alias), (_b = tsconfig == null ? void 0 : tsconfig.compilerOptions) == null ? void 0 : _b.paths),
77
+ paths: {
78
+ ...alias,
79
+ ...(_b = tsconfig == null ? void 0 : tsconfig.compilerOptions) == null ? void 0 : _b.paths
80
+ },
92
81
  isTsPath: true,
93
82
  isTsProject
94
83
  };
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
28
  var analyzeProject_exports = {};
49
29
  __export(analyzeProject_exports, {
50
30
  isApiOnly: () => isApiOnly,
@@ -54,16 +34,16 @@ module.exports = __toCommonJS(analyzeProject_exports);
54
34
  var path = __toESM(require("path"));
55
35
  var import_commands = require("./commands");
56
36
  var import_compiled = require("./compiled");
57
- const isApiOnly = (appDirectory, entryDir) => __async(void 0, null, function* () {
37
+ const isApiOnly = async (appDirectory, entryDir) => {
58
38
  const srcDir = path.join(appDirectory, entryDir != null ? entryDir : "src");
59
- const existSrc = yield import_compiled.fs.pathExists(srcDir);
39
+ const existSrc = await import_compiled.fs.pathExists(srcDir);
60
40
  const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
61
41
  return !existSrc || Boolean(options["api-only"]);
62
- });
63
- const isWebOnly = () => __async(void 0, null, function* () {
42
+ };
43
+ const isWebOnly = async () => {
64
44
  const options = (0, import_compiled.minimist)((0, import_commands.getArgv)());
65
45
  return Boolean(options["web-only"]);
66
- });
46
+ };
67
47
  // Annotate the CommonJS export names for ESM import in node:
68
48
  0 && (module.exports = {
69
49
  isApiOnly,
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -98,7 +84,11 @@ const modifyPresetOptions = (presetName, options, presets = []) => {
98
84
  presets.forEach((preset, index) => {
99
85
  if (Array.isArray(preset)) {
100
86
  if (typeof preset[0] === "string" && (0, import_path2.normalizeToPosixPath)(preset[0]).includes(presetName)) {
101
- preset[1] = __spreadValues(__spreadValues({}, preset[1] || {}), options);
87
+ preset[1] = {
88
+ ...preset[1] || {},
89
+ ...options
90
+ // `options` is specific to different presets
91
+ };
102
92
  }
103
93
  } else if (typeof preset === "string" && (0, import_path2.normalizeToPosixPath)(preset).includes(presetName)) {
104
94
  presets[index] = [preset, options];
@@ -124,7 +114,10 @@ const getBabelUtils = (config) => {
124
114
  };
125
115
  const applyUserBabelConfig = (defaultOptions, userBabelConfig, extraBabelUtils) => {
126
116
  if (userBabelConfig) {
127
- const babelUtils = __spreadValues(__spreadValues({}, getBabelUtils(defaultOptions)), extraBabelUtils);
117
+ const babelUtils = {
118
+ ...getBabelUtils(defaultOptions),
119
+ ...extraBabelUtils
120
+ };
128
121
  return (0, import_applyOptionsChain.applyOptionsChain)(defaultOptions, userBabelConfig || {}, babelUtils);
129
122
  }
130
123
  return defaultOptions;
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -49,10 +35,11 @@ const dynamicImport = new Function(
49
35
  "return import(modulePath)"
50
36
  );
51
37
  const requireExistModule = (filename, opt) => {
52
- const final = __spreadValues({
38
+ const final = {
53
39
  extensions: [".ts", ".js"],
54
- interop: true
55
- }, opt);
40
+ interop: true,
41
+ ...opt
42
+ };
56
43
  const exist = (0, import_findExists.findExists)(final.extensions.map((ext) => `${filename}${ext}`));
57
44
  if (!exist) {
58
45
  return null;
@@ -93,15 +93,15 @@ var import_recursive_readdir = __toESM(require("../compiled/recursive-readdir"))
93
93
  var import_commander = require("../compiled/commander");
94
94
  var import_signale2 = require("../compiled/signale");
95
95
  const mime = import_import.Import.lazy(
96
- "../compiled/mime-types",
96
+ "@compiled/mime-types",
97
97
  require
98
98
  );
99
99
  const chokidar = import_import.Import.lazy(
100
- "../compiled/chokidar",
100
+ "@compiled/chokidar",
101
101
  require
102
102
  );
103
103
  const inquirer = import_import.Import.lazy(
104
- "../compiled/inquirer",
104
+ "@compiled/inquirer",
105
105
  require
106
106
  );
107
107
  // Annotate the CommonJS export names for ESM import in node:
@@ -0,0 +1,32 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var emptyDir_exports = {};
19
+ __export(emptyDir_exports, {
20
+ emptyDir: () => emptyDir
21
+ });
22
+ module.exports = __toCommonJS(emptyDir_exports);
23
+ var import_compiled = require("./compiled");
24
+ const emptyDir = async (dir) => {
25
+ if (await import_compiled.fs.pathExists(dir)) {
26
+ await import_compiled.fs.emptyDir(dir);
27
+ }
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ emptyDir
32
+ });
@@ -1,21 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
5
  var __export = (target, all) => {
20
6
  for (var name in all)
21
7
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -42,7 +28,7 @@ const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
42
28
  if (optionsByEntry === void 0 && name === import_constants.MAIN_ENTRY_NAME && packageName) {
43
29
  optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
44
30
  }
45
- return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? __spreadValues(__spreadValues({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
31
+ return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? { ...baseOptions, ...optionsByEntry } : optionsByEntry : baseOptions;
46
32
  } else {
47
33
  return baseOptions;
48
34
  }
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
28
  var getPackageManager_exports = {};
49
29
  __export(getPackageManager_exports, {
50
30
  getPackageManager: () => getPackageManager
@@ -55,31 +35,29 @@ var import_path = __toESM(require("path"));
55
35
  var import_compiled = require("./compiled");
56
36
  var import_nodeEnv = require("./nodeEnv");
57
37
  const MAX_TIMES = 5;
58
- function getPackageManager() {
59
- return __async(this, arguments, function* (cwd = process.cwd()) {
60
- let appDirectory = cwd;
61
- let times = 0;
62
- while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
63
- times++;
64
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
65
- return "pnpm";
66
- }
67
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
68
- return "yarn";
69
- }
70
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
71
- return "npm";
72
- }
73
- appDirectory = import_path.default.join(appDirectory, "..");
74
- }
75
- if (yield (0, import_nodeEnv.canUsePnpm)()) {
38
+ async function getPackageManager(cwd = process.cwd()) {
39
+ let appDirectory = cwd;
40
+ let times = 0;
41
+ while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
42
+ times++;
43
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
76
44
  return "pnpm";
77
45
  }
78
- if (yield (0, import_nodeEnv.canUseYarn)()) {
46
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
79
47
  return "yarn";
80
48
  }
81
- return "npm";
82
- });
49
+ if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
50
+ return "npm";
51
+ }
52
+ appDirectory = import_path.default.join(appDirectory, "..");
53
+ }
54
+ if (await (0, import_nodeEnv.canUsePnpm)()) {
55
+ return "pnpm";
56
+ }
57
+ if (await (0, import_nodeEnv.canUseYarn)()) {
58
+ return "yarn";
59
+ }
60
+ return "npm";
83
61
  }
84
62
  // Annotate the CommonJS export names for ESM import in node:
85
63
  0 && (module.exports = {
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
28
  var getPort_exports = {};
49
29
  __export(getPort_exports, {
50
30
  getPort: () => getPort
@@ -53,10 +33,10 @@ module.exports = __toCommonJS(getPort_exports);
53
33
  var import_net = __toESM(require("net"));
54
34
  var import_compiled = require("./compiled");
55
35
  var import_logger = require("./logger");
56
- const getPort = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (port, {
36
+ const getPort = async (port, {
57
37
  tryLimits = 20,
58
38
  strictPort = false
59
- } = {}) {
39
+ } = {}) => {
60
40
  if (typeof port === "string") {
61
41
  port = parseInt(port, 10);
62
42
  }
@@ -68,7 +48,7 @@ const getPort = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (port, {
68
48
  let attempts = 0;
69
49
  while (!found && attempts <= tryLimits) {
70
50
  try {
71
- yield new Promise((resolve, reject) => {
51
+ await new Promise((resolve, reject) => {
72
52
  const server = import_net.default.createServer();
73
53
  server.unref();
74
54
  server.on("error", reject);
@@ -105,7 +85,7 @@ const getPort = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (port, {
105
85
  }
106
86
  }
107
87
  return port;
108
- });
88
+ };
109
89
  // Annotate the CommonJS export names for ESM import in node:
110
90
  0 && (module.exports = {
111
91
  getPort
@@ -25,26 +25,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
25
25
  mod
26
26
  ));
27
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var __async = (__this, __arguments, generator) => {
29
- return new Promise((resolve, reject) => {
30
- var fulfilled = (value) => {
31
- try {
32
- step(generator.next(value));
33
- } catch (e) {
34
- reject(e);
35
- }
36
- };
37
- var rejected = (value) => {
38
- try {
39
- step(generator.throw(value));
40
- } catch (e) {
41
- reject(e);
42
- }
43
- };
44
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
45
- step((generator = generator.apply(__this, __arguments)).next());
46
- });
47
- };
48
28
  var getServerConfig_exports = {};
49
29
  __export(getServerConfig_exports, {
50
30
  getServerConfig: () => getServerConfig
@@ -53,14 +33,14 @@ module.exports = __toCommonJS(getServerConfig_exports);
53
33
  var path = __toESM(require("path"));
54
34
  var import_constants = require("./constants");
55
35
  var import_findExists = require("./findExists");
56
- const getServerConfig = (appDirectory, configFile) => __async(void 0, null, function* () {
36
+ const getServerConfig = async (appDirectory, configFile) => {
57
37
  const configFilePath = (0, import_findExists.findExists)(
58
38
  import_constants.CONFIG_FILE_EXTENSIONS.map(
59
39
  (extension) => path.resolve(appDirectory, `${configFile}${extension}`)
60
40
  )
61
41
  );
62
42
  return configFilePath;
63
- });
43
+ };
64
44
  // Annotate the CommonJS export names for ESM import in node:
65
45
  0 && (module.exports = {
66
46
  getServerConfig
@@ -22,7 +22,7 @@ __export(import_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(import_exports);
24
24
  const lazy = (moduleName, requireFn) => {
25
- const importLazyLocal = require("../compiled/import-lazy")(requireFn);
25
+ const importLazyLocal = require("../@compiled/import-lazy")(requireFn);
26
26
  return importLazyLocal(moduleName);
27
27
  };
28
28
  const Import = { lazy };
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -88,8 +74,11 @@ const DEFAULT_CONFIG = {
88
74
  class Logger {
89
75
  constructor(options = {}) {
90
76
  this.level = options.level || LOG_TYPES.log.level;
91
- this.config = __spreadValues(__spreadValues({}, DEFAULT_CONFIG), options.config || {});
92
- this.types = __spreadValues(__spreadValues({}, LOG_TYPES), options.types || {});
77
+ this.config = { ...DEFAULT_CONFIG, ...options.config || {} };
78
+ this.types = {
79
+ ...LOG_TYPES,
80
+ ...options.types || {}
81
+ };
93
82
  this.longestLabel = this.getLongestLabel();
94
83
  Object.keys(this.types).forEach((type) => {
95
84
  this[type] = this._log.bind(this, type);
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -77,7 +63,10 @@ const isModernjsMonorepo = (root) => {
77
63
  return false;
78
64
  }
79
65
  const json = JSON.parse(import_fs.default.readFileSync(pkgJsonPath, "utf8"));
80
- const deps = __spreadValues(__spreadValues({}, json.dependencies || {}), json.devDependencies || {});
66
+ const deps = {
67
+ ...json.dependencies || {},
68
+ ...json.devDependencies || {}
69
+ };
81
70
  return Boolean(deps["@modern-js/monorepo-tools"]);
82
71
  };
83
72
  const findMonorepoRoot = (appDirectory, maxDepth = PACKAGE_MAX_DEPTH) => {
@@ -0,0 +1,55 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var nodeEnv_exports = {};
19
+ __export(nodeEnv_exports, {
20
+ canUseNpm: () => canUseNpm,
21
+ canUsePnpm: () => canUsePnpm,
22
+ canUseYarn: () => canUseYarn
23
+ });
24
+ module.exports = __toCommonJS(nodeEnv_exports);
25
+ var import_compiled = require("./compiled");
26
+ async function canUseNpm() {
27
+ try {
28
+ await (0, import_compiled.execa)("npm", ["--version"], { env: process.env });
29
+ return true;
30
+ } catch (e) {
31
+ return false;
32
+ }
33
+ }
34
+ async function canUseYarn() {
35
+ try {
36
+ await (0, import_compiled.execa)("yarn", ["--version"], { env: process.env });
37
+ return true;
38
+ } catch (e) {
39
+ return false;
40
+ }
41
+ }
42
+ async function canUsePnpm() {
43
+ try {
44
+ await (0, import_compiled.execa)("pnpm", ["--version"], { env: process.env });
45
+ return true;
46
+ } catch (e) {
47
+ return false;
48
+ }
49
+ }
50
+ // Annotate the CommonJS export names for ESM import in node:
51
+ 0 && (module.exports = {
52
+ canUseNpm,
53
+ canUsePnpm,
54
+ canUseYarn
55
+ });
@@ -70,7 +70,7 @@ function getRealTemporaryDirectory() {
70
70
  try {
71
71
  ret = import_os.default.tmpdir();
72
72
  ret = import_fs.default.realpathSync(ret);
73
- } catch (e) {
73
+ } catch {
74
74
  }
75
75
  return ret;
76
76
  }
@@ -56,7 +56,7 @@ function applyMatcherReplacement(matchers, str, options = {}) {
56
56
  const createDefaultPathMatchers = (root) => {
57
57
  const ret = [
58
58
  {
59
- match: new RegExp("(?<=\\/)(\\.pnpm\\/.+?\\/node_modules)(?=\\/)"),
59
+ match: /(?<=\/)(\.pnpm\/.+?\/node_modules)(?=\/)/,
60
60
  mark: "pnpmInner"
61
61
  }
62
62
  ];
@@ -2,22 +2,8 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
5
  var __getProtoOf = Object.getPrototypeOf;
7
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
- var __spreadValues = (a, b) => {
11
- for (var prop in b || (b = {}))
12
- if (__hasOwnProp.call(b, prop))
13
- __defNormalProp(a, prop, b[prop]);
14
- if (__getOwnPropSymbols)
15
- for (var prop of __getOwnPropSymbols(b)) {
16
- if (__propIsEnum.call(b, prop))
17
- __defNormalProp(a, prop, b[prop]);
18
- }
19
- return a;
20
- };
21
7
  var __export = (target, all) => {
22
8
  for (var name in all)
23
9
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -52,7 +38,10 @@ const isBeyondReact17 = (cwd) => {
52
38
  return false;
53
39
  }
54
40
  const pkgInfo = JSON.parse(import__.fs.readFileSync(pkgPath, "utf8"));
55
- const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
41
+ const deps = {
42
+ ...pkgInfo.devDependencies,
43
+ ...pkgInfo.dependencies
44
+ };
56
45
  if (typeof deps.react !== "string") {
57
46
  return false;
58
47
  }
@@ -57,7 +57,7 @@ const createRuntimeExportsUtils = memo(
57
57
  import_compiled.fs.appendFileSync(entryExportFile, `${statement}
58
58
  `);
59
59
  }
60
- } catch (e) {
60
+ } catch {
61
61
  }
62
62
  };
63
63
  const getPath = () => entryExportFile;