@modern-js/utils 2.69.7 → 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,82 +1,79 @@
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 port_exports = {};
30
- __export(port_exports, {
31
- getPort: () => getPort
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
+ getPort: ()=>getPort
32
37
  });
33
- module.exports = __toCommonJS(port_exports);
34
- var import_net = __toESM(require("net"));
35
- var import_compiled = require("../compiled");
36
- var import_logger = require("./logger");
37
- const getPort = async (expectPort, { tryLimits = 20, strictPort = false, slient = false } = {}) => {
38
- let port = expectPort;
39
- if (typeof port === "string") {
40
- port = parseInt(port, 10);
41
- }
42
- if (strictPort) {
43
- tryLimits = 1;
44
- }
45
- const original = port;
46
- let found = false;
47
- let attempts = 0;
48
- while (!found && attempts <= tryLimits) {
49
- try {
50
- await new Promise((resolve, reject) => {
51
- const server = import_net.default.createServer();
52
- server.unref();
53
- server.on("error", reject);
54
- server.listen({
55
- port,
56
- host: "0.0.0.0"
57
- }, () => {
58
- found = true;
59
- server.close(resolve);
38
+ const external_net_namespaceObject = require("net");
39
+ var external_net_default = /*#__PURE__*/ __webpack_require__.n(external_net_namespaceObject);
40
+ const external_compiled_js_namespaceObject = require("../compiled.js");
41
+ const external_logger_js_namespaceObject = require("./logger.js");
42
+ const getPort = async (expectPort, { tryLimits = 20, strictPort = false, slient = false } = {})=>{
43
+ let port = expectPort;
44
+ if ('string' == typeof port) port = parseInt(port, 10);
45
+ if (strictPort) tryLimits = 1;
46
+ const original = port;
47
+ let found = false;
48
+ let attempts = 0;
49
+ while(!found && attempts <= tryLimits)try {
50
+ await new Promise((resolve, reject)=>{
51
+ const server = external_net_default().createServer();
52
+ server.unref();
53
+ server.on('error', reject);
54
+ server.listen({
55
+ port,
56
+ host: '0.0.0.0'
57
+ }, ()=>{
58
+ found = true;
59
+ server.close(resolve);
60
+ });
60
61
  });
61
- });
62
62
  } catch (e) {
63
- if (e.code !== "EADDRINUSE") {
64
- throw e;
65
- }
66
- port++;
67
- attempts++;
63
+ if ('EADDRINUSE' !== e.code) throw e;
64
+ port++;
65
+ attempts++;
68
66
  }
69
- }
70
- if (port !== original) {
71
- if (strictPort) {
72
- throw new Error(`Port "${original}" is occupied, please choose another one.`);
73
- } else if (!slient) {
74
- import_logger.logger.info(`Port ${original} is in use. ${import_compiled.chalk.yellow(`using port ${port}.`)}`);
67
+ if (port !== original) {
68
+ if (strictPort) throw new Error(`Port "${original}" is occupied, please choose another one.`);
69
+ else if (!slient) external_logger_js_namespaceObject.logger.info(`Port ${original} is in use. ${external_compiled_js_namespaceObject.chalk.yellow(`using port ${port}.`)}`);
75
70
  }
76
- }
77
- return port;
71
+ return port;
78
72
  };
79
- // Annotate the CommonJS export names for ESM import in node:
80
- 0 && (module.exports = {
81
- getPort
73
+ exports.getPort = __webpack_exports__.getPort;
74
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
75
+ "getPort"
76
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
77
+ Object.defineProperty(exports, '__esModule', {
78
+ value: true
82
79
  });
@@ -1,125 +1,115 @@
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 prettyInstructions_exports = {};
30
- __export(prettyInstructions_exports, {
31
- getAddressUrls: () => getAddressUrls,
32
- prettyInstructions: () => prettyInstructions
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
+ prettyInstructions: ()=>prettyInstructions,
37
+ getAddressUrls: ()=>getAddressUrls
33
38
  });
34
- module.exports = __toCommonJS(prettyInstructions_exports);
35
- var import_net = require("net");
36
- var import_os = __toESM(require("os"));
37
- var import_compiled = require("../compiled");
38
- var import_constants = require("./constants");
39
- var import_is = require("./is");
40
- const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
41
- const getIpv4Interfaces = () => {
42
- const interfaces = import_os.default.networkInterfaces();
43
- const ipv4Interfaces = [];
44
- Object.keys(interfaces).forEach((key) => {
45
- interfaces[key].forEach((detail) => {
46
- const familyV4Value = typeof detail.family === "string" ? "IPv4" : 4;
47
- if (detail.family === familyV4Value) {
48
- ipv4Interfaces.push(detail);
49
- }
39
+ const external_net_namespaceObject = require("net");
40
+ const external_os_namespaceObject = require("os");
41
+ var external_os_default = /*#__PURE__*/ __webpack_require__.n(external_os_namespaceObject);
42
+ const external_compiled_js_namespaceObject = require("../compiled.js");
43
+ const external_constants_js_namespaceObject = require("./constants.js");
44
+ const index_js_namespaceObject = require("./is/index.js");
45
+ const normalizeUrl = (url)=>url.replace(/([^:]\/)\/+/g, '$1');
46
+ const getIpv4Interfaces = ()=>{
47
+ const interfaces = external_os_default().networkInterfaces();
48
+ const ipv4Interfaces = [];
49
+ Object.keys(interfaces).forEach((key)=>{
50
+ interfaces[key].forEach((detail)=>{
51
+ const familyV4Value = 'string' == typeof detail.family ? 'IPv4' : 4;
52
+ if (detail.family === familyV4Value) ipv4Interfaces.push(detail);
53
+ });
50
54
  });
51
- });
52
- return ipv4Interfaces;
55
+ return ipv4Interfaces;
53
56
  };
54
- const getHostInUrl = (host) => {
55
- if ((0, import_net.isIPv6)(host)) {
56
- return host === "::" ? "[::1]" : `[${host}]`;
57
- }
58
- return host;
57
+ const getHostInUrl = (host)=>{
58
+ if ((0, external_net_namespaceObject.isIPv6)(host)) return '::' === host ? '[::1]' : `[${host}]`;
59
+ return host;
59
60
  };
60
- const getAddressUrls = (protocol = "http", port, host) => {
61
- const LOCAL_LABEL = "Local: ";
62
- const NETWORK_LABEL = "Network: ";
63
- const isLocalhost = (url) => url === null || url === void 0 ? void 0 : url.includes("localhost");
64
- if (host && host !== import_constants.DEFAULT_DEV_HOST) {
65
- return [
66
- {
67
- label: isLocalhost(host) ? LOCAL_LABEL : NETWORK_LABEL,
68
- url: `${protocol}://${getHostInUrl(host)}:${port}`
69
- }
61
+ const getAddressUrls = (protocol = 'http', port, host)=>{
62
+ const LOCAL_LABEL = 'Local: ';
63
+ const NETWORK_LABEL = 'Network: ';
64
+ const isLocalhost = (url)=>url?.includes('localhost');
65
+ if (host && host !== external_constants_js_namespaceObject.DEFAULT_DEV_HOST) return [
66
+ {
67
+ label: isLocalhost(host) ? LOCAL_LABEL : NETWORK_LABEL,
68
+ url: `${protocol}://${getHostInUrl(host)}:${port}`
69
+ }
70
70
  ];
71
- }
72
- const ipv4Interfaces = getIpv4Interfaces();
73
- return ipv4Interfaces.reduce((memo, detail) => {
74
- if (isLocalhost(detail.address) || detail.internal) {
75
- memo.push({
76
- label: LOCAL_LABEL,
77
- url: `${protocol}://localhost:${port}`
78
- });
79
- } else {
80
- memo.push({
81
- label: NETWORK_LABEL,
82
- url: `${protocol}://${detail.address}:${port}`
83
- });
84
- }
85
- return memo;
86
- }, []);
71
+ const ipv4Interfaces = getIpv4Interfaces();
72
+ return ipv4Interfaces.reduce((memo, detail)=>{
73
+ if (isLocalhost(detail.address) || detail.internal) memo.push({
74
+ label: LOCAL_LABEL,
75
+ url: `${protocol}://localhost:${port}`
76
+ });
77
+ else memo.push({
78
+ label: NETWORK_LABEL,
79
+ url: `${protocol}://${detail.address}:${port}`
80
+ });
81
+ return memo;
82
+ }, []);
87
83
  };
88
- const prettyInstructions = (appContext, config) => {
89
- var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
90
- const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
91
- const isHttps = (0, import_is.isDev)() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
92
- const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
93
- const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
94
- let message = "\n";
95
- if ((0, import_is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
96
- message += urls.map(({ label, url }) => ` ${import_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
97
- `).join("");
98
- } else {
99
- const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
100
- urls.forEach(({ label, url }) => {
101
- message += ` ${import_compiled.chalk.bold(`> ${label}`)}${routes.length === 0 ? import_compiled.chalk.cyanBright(url) : ""}
102
- `;
103
- routes.forEach(({ entryName, urlPath, isSSR }) => {
104
- if (!checkedEntries.includes(entryName)) {
105
- return;
106
- }
107
- message += ` ${import_compiled.chalk.yellowBright(isSSR ? "λ" : "○")} ${import_compiled.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
108
- `;
109
- });
110
- });
111
- message += "\n";
112
- message += import_compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
113
- message += import_compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
114
- }
115
- if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
116
- message += ` ${import_compiled.chalk.dim("> press")} ${import_compiled.chalk.bold("h + enter")} ${import_compiled.chalk.dim("to show shortcuts")}
117
- `;
118
- }
119
- return message;
84
+ const prettyInstructions = (appContext, config)=>{
85
+ const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
86
+ const isHttps = (0, index_js_namespaceObject.isDev)() && (config?.dev?.https || config?.tools?.devServer?.https);
87
+ const urls = getAddressUrls(isHttps ? 'https' : 'http', port, config.dev?.host);
88
+ const routes = apiOnly ? serverRoutes : serverRoutes.filter((route)=>route.entryName);
89
+ let message = '\n';
90
+ if ((0, index_js_namespaceObject.isSingleEntry)(entrypoints, config.source?.mainEntryName) || apiOnly) message += urls.map(({ label, url })=>` ${external_compiled_js_namespaceObject.chalk.bold(`> ${label.padEnd(10)}`)}${external_compiled_js_namespaceObject.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}\n`).join('');
91
+ else {
92
+ const maxNameLength = Math.max(...routes.map((r)=>r.entryName.length));
93
+ urls.forEach(({ label, url })=>{
94
+ message += ` ${external_compiled_js_namespaceObject.chalk.bold(`> ${label}`)}${0 === routes.length ? external_compiled_js_namespaceObject.chalk.cyanBright(url) : ''}\n`;
95
+ routes.forEach(({ entryName, urlPath, isSSR })=>{
96
+ if (!checkedEntries.includes(entryName)) return;
97
+ message += ` ${external_compiled_js_namespaceObject.chalk.yellowBright(isSSR ? 'λ' : '○')} ${external_compiled_js_namespaceObject.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${external_compiled_js_namespaceObject.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}\n`;
98
+ });
99
+ });
100
+ message += '\n';
101
+ message += external_compiled_js_namespaceObject.chalk.cyanBright(' λ (Server) server-side renders at runtime\n');
102
+ message += external_compiled_js_namespaceObject.chalk.cyanBright(' ○ (Static) client-side renders as static HTML\n');
103
+ }
104
+ if (config.dev?.cliShortcuts) message += ` ${external_compiled_js_namespaceObject.chalk.dim('> press')} ${external_compiled_js_namespaceObject.chalk.bold('h + enter')} ${external_compiled_js_namespaceObject.chalk.dim('to show shortcuts')}\n`;
105
+ return message;
120
106
  };
121
- // Annotate the CommonJS export names for ESM import in node:
122
- 0 && (module.exports = {
123
- getAddressUrls,
124
- prettyInstructions
107
+ exports.getAddressUrls = __webpack_exports__.getAddressUrls;
108
+ exports.prettyInstructions = __webpack_exports__.prettyInstructions;
109
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
110
+ "getAddressUrls",
111
+ "prettyInstructions"
112
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
113
+ Object.defineProperty(exports, '__esModule', {
114
+ value: true
125
115
  });