@modern-js/utils 2.15.0 → 2.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/FileSizeReporter.js +69 -92
  3. package/dist/cjs/alias.js +34 -58
  4. package/dist/cjs/analyzeProject.js +58 -41
  5. package/dist/cjs/applyOptionsChain.js +15 -42
  6. package/dist/cjs/babel.js +28 -39
  7. package/dist/cjs/chainId.js +7 -25
  8. package/dist/cjs/clearConsole.js +7 -25
  9. package/dist/cjs/commands.js +14 -29
  10. package/dist/cjs/compatRequire.js +22 -38
  11. package/dist/cjs/compiled.js +120 -139
  12. package/dist/cjs/constants.js +143 -98
  13. package/dist/cjs/debug.js +8 -26
  14. package/dist/cjs/emptyDir.js +10 -28
  15. package/dist/cjs/ensureAbsolutePath.js +13 -36
  16. package/dist/cjs/ensureArray.js +10 -26
  17. package/dist/cjs/findExists.js +14 -37
  18. package/dist/cjs/generateMetaTags.js +12 -31
  19. package/dist/cjs/getBrowserslist.js +20 -27
  20. package/dist/cjs/getCoreJsVersion.js +49 -37
  21. package/dist/cjs/getEntryOptions.js +14 -29
  22. package/dist/cjs/getPackageManager.js +23 -46
  23. package/dist/cjs/getPort.js +26 -61
  24. package/dist/cjs/getServerConfig.js +51 -43
  25. package/dist/cjs/getTargetDir.js +50 -38
  26. package/dist/cjs/import.js +16 -27
  27. package/dist/cjs/index.js +61 -60
  28. package/dist/cjs/is/index.js +53 -68
  29. package/dist/cjs/is/nodeEnv.js +13 -29
  30. package/dist/cjs/is/platform.js +13 -26
  31. package/dist/cjs/is/type.js +14 -33
  32. package/dist/cjs/logger.js +54 -50
  33. package/dist/cjs/monorepo.js +47 -78
  34. package/dist/cjs/nodeEnv.js +29 -31
  35. package/dist/cjs/path.js +42 -63
  36. package/dist/cjs/pathSerializer.js +43 -51
  37. package/dist/cjs/plugin.js +11 -29
  38. package/dist/cjs/prettyInstructions.js +35 -68
  39. package/dist/cjs/printBuildError.js +15 -37
  40. package/dist/cjs/react.js +18 -41
  41. package/dist/cjs/readTsConfig.js +21 -39
  42. package/dist/cjs/removeSlash.js +13 -27
  43. package/dist/cjs/resolve.js +25 -31
  44. package/dist/cjs/routes.js +23 -43
  45. package/dist/cjs/runtime/index.js +18 -17
  46. package/dist/cjs/runtime/parsed.js +8 -26
  47. package/dist/cjs/runtimeExports.js +31 -56
  48. package/dist/cjs/ssr.js +13 -26
  49. package/dist/cjs/storage.js +51 -41
  50. package/dist/cjs/testUtils.js +8 -29
  51. package/dist/cjs/types.js +4 -15
  52. package/dist/cjs/universal/constants.js +13 -26
  53. package/dist/cjs/universal/formatWebpack.js +16 -44
  54. package/dist/cjs/universal/nestedRoutes.js +94 -46
  55. package/dist/cjs/universal/pluginDagSort.js +58 -0
  56. package/dist/cjs/universal/remixRouter.js +18 -17
  57. package/dist/cjs/universal/serialize.js +16 -37
  58. package/dist/cjs/version.js +25 -41
  59. package/dist/cjs/wait.js +7 -25
  60. package/dist/cjs/watch.js +69 -43
  61. package/dist/esm/FileSizeReporter.js +40 -52
  62. package/dist/esm/alias.js +9 -19
  63. package/dist/esm/analyzeProject.js +3 -7
  64. package/dist/esm/applyOptionsChain.js +5 -17
  65. package/dist/esm/babel.js +6 -8
  66. package/dist/esm/chainId.js +1 -4
  67. package/dist/esm/clearConsole.js +1 -4
  68. package/dist/esm/commands.js +6 -12
  69. package/dist/esm/compatRequire.js +10 -17
  70. package/dist/esm/compiled.js +32 -76
  71. package/dist/esm/constants.js +143 -89
  72. package/dist/esm/debug.js +1 -4
  73. package/dist/esm/emptyDir.js +1 -4
  74. package/dist/esm/ensureAbsolutePath.js +1 -4
  75. package/dist/esm/ensureArray.js +4 -5
  76. package/dist/esm/findExists.js +1 -4
  77. package/dist/esm/generateMetaTags.js +6 -10
  78. package/dist/esm/getBrowserslist.js +8 -6
  79. package/dist/esm/getCoreJsVersion.js +1 -4
  80. package/dist/esm/getEntryOptions.js +5 -5
  81. package/dist/esm/getPackageManager.js +1 -4
  82. package/dist/esm/getPort.js +10 -25
  83. package/dist/esm/getServerConfig.js +2 -9
  84. package/dist/esm/getTargetDir.js +1 -4
  85. package/dist/esm/import.js +3 -4
  86. package/dist/esm/is/index.js +18 -30
  87. package/dist/esm/is/nodeEnv.js +5 -12
  88. package/dist/esm/is/platform.js +2 -6
  89. package/dist/esm/is/type.js +8 -18
  90. package/dist/esm/logger.js +37 -17
  91. package/dist/esm/monorepo.js +21 -38
  92. package/dist/esm/nodeEnv.js +18 -11
  93. package/dist/esm/path.js +16 -23
  94. package/dist/esm/pathSerializer.js +21 -21
  95. package/dist/esm/plugin.js +1 -4
  96. package/dist/esm/prettyInstructions.js +13 -32
  97. package/dist/esm/printBuildError.js +4 -11
  98. package/dist/esm/react.js +1 -4
  99. package/dist/esm/readTsConfig.js +2 -6
  100. package/dist/esm/removeSlash.js +3 -8
  101. package/dist/esm/resolve.js +14 -11
  102. package/dist/esm/routes.js +4 -10
  103. package/dist/esm/runtime/parsed.js +2 -5
  104. package/dist/esm/runtimeExports.js +17 -22
  105. package/dist/esm/ssr.js +1 -4
  106. package/dist/esm/storage.js +2 -6
  107. package/dist/esm/testUtils.js +2 -8
  108. package/dist/esm/types.js +1 -0
  109. package/dist/esm/universal/constants.js +2 -6
  110. package/dist/esm/universal/formatWebpack.js +10 -22
  111. package/dist/esm/universal/nestedRoutes.js +41 -27
  112. package/dist/esm/universal/pluginDagSort.js +50 -0
  113. package/dist/esm/universal/serialize.js +4 -5
  114. package/dist/esm/version.js +5 -7
  115. package/dist/esm/wait.js +1 -3
  116. package/dist/esm/watch.js +14 -9
  117. package/dist/types/universal/pluginDagSort.d.ts +1 -0
  118. package/package.json +17 -5
@@ -1,31 +1,24 @@
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) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
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 getBrowserslist_exports = {};
19
- __export(getBrowserslist_exports, {
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
20
13
  defaults: () => defaults,
21
14
  getBrowserslist: () => getBrowserslist
22
15
  });
23
- module.exports = __toCommonJS(getBrowserslist_exports);
24
- var import_compiled = require("./compiled");
25
- const defaults = ["> 0.01%", "not dead", "not op_mini all"];
26
- const getBrowserslist = (appDirectory) => import_compiled.browserslist.loadConfig({ path: appDirectory }) || defaults;
27
- // Annotate the CommonJS export names for ESM import in node:
28
- 0 && (module.exports = {
29
- defaults,
30
- getBrowserslist
31
- });
16
+ const _compiled = require("./compiled");
17
+ const defaults = [
18
+ "> 0.01%",
19
+ "not dead",
20
+ "not op_mini all"
21
+ ];
22
+ const getBrowserslist = (appDirectory) => _compiled.browserslist.loadConfig({
23
+ path: appDirectory
24
+ }) || defaults;
@@ -1,46 +1,58 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getCoreJsVersion_exports = {};
29
- __export(getCoreJsVersion_exports, {
30
- getCoreJsVersion: () => getCoreJsVersion
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(getCoreJsVersion_exports);
33
- var fs = __toESM(require("../compiled/fs-extra"));
5
+ Object.defineProperty(exports, "getCoreJsVersion", {
6
+ enumerable: true,
7
+ get: () => getCoreJsVersion
8
+ });
9
+ const _fsextra = /* @__PURE__ */ _interop_require_wildcard(require("../compiled/fs-extra"));
10
+ function _getRequireWildcardCache(nodeInterop) {
11
+ if (typeof WeakMap !== "function")
12
+ return null;
13
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
14
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
15
+ return (_getRequireWildcardCache = function(nodeInterop2) {
16
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
17
+ })(nodeInterop);
18
+ }
19
+ function _interop_require_wildcard(obj, nodeInterop) {
20
+ if (!nodeInterop && obj && obj.__esModule) {
21
+ return obj;
22
+ }
23
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
+ return {
25
+ default: obj
26
+ };
27
+ }
28
+ var cache = _getRequireWildcardCache(nodeInterop);
29
+ if (cache && cache.has(obj)) {
30
+ return cache.get(obj);
31
+ }
32
+ var newObj = {};
33
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
+ for (var key in obj) {
35
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
+ if (desc && (desc.get || desc.set)) {
38
+ Object.defineProperty(newObj, key, desc);
39
+ } else {
40
+ newObj[key] = obj[key];
41
+ }
42
+ }
43
+ }
44
+ newObj.default = obj;
45
+ if (cache) {
46
+ cache.set(obj, newObj);
47
+ }
48
+ return newObj;
49
+ }
34
50
  const getCoreJsVersion = (corejsPkgPath) => {
35
51
  try {
36
- const { version } = fs.readJSONSync(corejsPkgPath);
52
+ const { version } = _fsextra.readJSONSync(corejsPkgPath);
37
53
  const [major, minor] = version.split(".");
38
54
  return `${major}.${minor}`;
39
55
  } catch (err) {
40
56
  return "3";
41
57
  }
42
58
  };
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- getCoreJsVersion
46
- });
@@ -1,40 +1,25 @@
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 getEntryOptions_exports = {};
19
- __export(getEntryOptions_exports, {
20
- getEntryOptions: () => getEntryOptions
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
21
4
  });
22
- module.exports = __toCommonJS(getEntryOptions_exports);
23
- var import_is = require("./is");
24
- var import_constants = require("./constants");
5
+ Object.defineProperty(exports, "getEntryOptions", {
6
+ enumerable: true,
7
+ get: () => getEntryOptions
8
+ });
9
+ const _is = require("./is");
10
+ const _constants = require("./constants");
25
11
  const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
26
12
  if (optionsByEntries) {
27
13
  let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
28
- if (optionsByEntry === void 0 && name === import_constants.MAIN_ENTRY_NAME && packageName) {
14
+ if (optionsByEntry === void 0 && name === _constants.MAIN_ENTRY_NAME && packageName) {
29
15
  optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
30
16
  }
31
- return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? { ...baseOptions, ...optionsByEntry } : optionsByEntry : baseOptions;
17
+ return optionsByEntry !== void 0 ? (0, _is.isPlainObject)(optionsByEntry) && (0, _is.isPlainObject)(baseOptions) ? {
18
+ ...baseOptions,
19
+ ...optionsByEntry
20
+ } : optionsByEntry : baseOptions;
32
21
  } else {
33
22
  return baseOptions;
34
23
  }
35
24
  };
36
25
  const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
37
- // Annotate the CommonJS export names for ESM import in node:
38
- 0 && (module.exports = {
39
- getEntryOptions
40
- });
@@ -1,65 +1,42 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getPackageManager_exports = {};
29
- __export(getPackageManager_exports, {
30
- getPackageManager: () => getPackageManager
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "getPackageManager", {
6
+ enumerable: true,
7
+ get: () => getPackageManager
31
8
  });
32
- module.exports = __toCommonJS(getPackageManager_exports);
33
- var import_os = __toESM(require("os"));
34
- var import_path = __toESM(require("path"));
35
- var import_compiled = require("./compiled");
36
- var import_nodeEnv = require("./nodeEnv");
9
+ const _os = /* @__PURE__ */ _interop_require_default(require("os"));
10
+ const _path = /* @__PURE__ */ _interop_require_default(require("path"));
11
+ const _compiled = require("./compiled");
12
+ const _nodeEnv = require("./nodeEnv");
13
+ function _interop_require_default(obj) {
14
+ return obj && obj.__esModule ? obj : {
15
+ default: obj
16
+ };
17
+ }
37
18
  const MAX_TIMES = 5;
38
19
  async function getPackageManager(cwd = process.cwd()) {
39
20
  let appDirectory = cwd;
40
21
  let times = 0;
41
- while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
22
+ while (_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
42
23
  times++;
43
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
24
+ if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
44
25
  return "pnpm";
45
26
  }
46
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
27
+ if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "yarn.lock"))) {
47
28
  return "yarn";
48
29
  }
49
- if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
30
+ if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "package-lock.json"))) {
50
31
  return "npm";
51
32
  }
52
- appDirectory = import_path.default.join(appDirectory, "..");
33
+ appDirectory = _path.default.join(appDirectory, "..");
53
34
  }
54
- if (await (0, import_nodeEnv.canUsePnpm)()) {
35
+ if (await (0, _nodeEnv.canUsePnpm)()) {
55
36
  return "pnpm";
56
37
  }
57
- if (await (0, import_nodeEnv.canUseYarn)()) {
38
+ if (await (0, _nodeEnv.canUseYarn)()) {
58
39
  return "yarn";
59
40
  }
60
41
  return "npm";
61
42
  }
62
- // Annotate the CommonJS export names for ESM import in node:
63
- 0 && (module.exports = {
64
- getPackageManager
65
- });
@@ -1,42 +1,20 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getPort_exports = {};
29
- __export(getPort_exports, {
30
- getPort: () => getPort
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(getPort_exports);
33
- var import_net = __toESM(require("net"));
34
- var import_compiled = require("./compiled");
35
- var import_logger = require("./logger");
36
- const getPort = async (port, {
37
- tryLimits = 20,
38
- strictPort = false
39
- } = {}) => {
5
+ Object.defineProperty(exports, "getPort", {
6
+ enumerable: true,
7
+ get: () => getPort
8
+ });
9
+ const _net = /* @__PURE__ */ _interop_require_default(require("net"));
10
+ const _compiled = require("./compiled");
11
+ const _logger = require("./logger");
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ const getPort = async (port, { tryLimits = 20, strictPort = false } = {}) => {
40
18
  if (typeof port === "string") {
41
19
  port = parseInt(port, 10);
42
20
  }
@@ -49,19 +27,16 @@ const getPort = async (port, {
49
27
  while (!found && attempts <= tryLimits) {
50
28
  try {
51
29
  await new Promise((resolve, reject) => {
52
- const server = import_net.default.createServer();
30
+ const server = _net.default.createServer();
53
31
  server.unref();
54
32
  server.on("error", reject);
55
- server.listen(
56
- {
57
- port,
58
- host: "0.0.0.0"
59
- },
60
- () => {
61
- found = true;
62
- server.close(resolve);
63
- }
64
- );
33
+ server.listen({
34
+ port,
35
+ host: "0.0.0.0"
36
+ }, () => {
37
+ found = true;
38
+ server.close(resolve);
39
+ });
65
40
  });
66
41
  } catch (e) {
67
42
  if (e.code !== "EADDRINUSE") {
@@ -73,20 +48,10 @@ const getPort = async (port, {
73
48
  }
74
49
  if (port !== original) {
75
50
  if (strictPort) {
76
- throw new Error(
77
- `Port "${original}" is occupied, please choose another one.`
78
- );
51
+ throw new Error(`Port "${original}" is occupied, please choose another one.`);
79
52
  } else {
80
- import_logger.logger.info(
81
- `Something is already running on port ${original}. ${import_compiled.chalk.yellow(
82
- `Use port ${port} instead.`
83
- )}`
84
- );
53
+ _logger.logger.info(`Something is already running on port ${original}. ${_compiled.chalk.yellow(`Use port ${port} instead.`)}`);
85
54
  }
86
55
  }
87
56
  return port;
88
57
  };
89
- // Annotate the CommonJS export names for ESM import in node:
90
- 0 && (module.exports = {
91
- getPort
92
- });
@@ -1,47 +1,55 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getServerConfig_exports = {};
29
- __export(getServerConfig_exports, {
30
- getServerConfig: () => getServerConfig
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(getServerConfig_exports);
33
- var path = __toESM(require("path"));
34
- var import_constants = require("./constants");
35
- var import_findExists = require("./findExists");
5
+ Object.defineProperty(exports, "getServerConfig", {
6
+ enumerable: true,
7
+ get: () => getServerConfig
8
+ });
9
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
10
+ const _constants = require("./constants");
11
+ const _findExists = require("./findExists");
12
+ function _getRequireWildcardCache(nodeInterop) {
13
+ if (typeof WeakMap !== "function")
14
+ return null;
15
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
16
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
17
+ return (_getRequireWildcardCache = function(nodeInterop2) {
18
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
19
+ })(nodeInterop);
20
+ }
21
+ function _interop_require_wildcard(obj, nodeInterop) {
22
+ if (!nodeInterop && obj && obj.__esModule) {
23
+ return obj;
24
+ }
25
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
26
+ return {
27
+ default: obj
28
+ };
29
+ }
30
+ var cache = _getRequireWildcardCache(nodeInterop);
31
+ if (cache && cache.has(obj)) {
32
+ return cache.get(obj);
33
+ }
34
+ var newObj = {};
35
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
36
+ for (var key in obj) {
37
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
38
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
39
+ if (desc && (desc.get || desc.set)) {
40
+ Object.defineProperty(newObj, key, desc);
41
+ } else {
42
+ newObj[key] = obj[key];
43
+ }
44
+ }
45
+ }
46
+ newObj.default = obj;
47
+ if (cache) {
48
+ cache.set(obj, newObj);
49
+ }
50
+ return newObj;
51
+ }
36
52
  const getServerConfig = async (appDirectory, configFile) => {
37
- const configFilePath = (0, import_findExists.findExists)(
38
- import_constants.CONFIG_FILE_EXTENSIONS.map(
39
- (extension) => path.resolve(appDirectory, `${configFile}${extension}`)
40
- )
41
- );
53
+ const configFilePath = (0, _findExists.findExists)(_constants.CONFIG_FILE_EXTENSIONS.map((extension) => _path.resolve(appDirectory, `${configFile}${extension}`)));
42
54
  return configFilePath;
43
55
  };
44
- // Annotate the CommonJS export names for ESM import in node:
45
- 0 && (module.exports = {
46
- getServerConfig
47
- });
@@ -1,41 +1,53 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
- var getTargetDir_exports = {};
29
- __export(getTargetDir_exports, {
30
- getTargetDir: () => getTargetDir
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
31
4
  });
32
- module.exports = __toCommonJS(getTargetDir_exports);
33
- var path = __toESM(require("path"));
5
+ Object.defineProperty(exports, "getTargetDir", {
6
+ enumerable: true,
7
+ get: () => getTargetDir
8
+ });
9
+ const _path = /* @__PURE__ */ _interop_require_wildcard(require("path"));
10
+ function _getRequireWildcardCache(nodeInterop) {
11
+ if (typeof WeakMap !== "function")
12
+ return null;
13
+ var cacheBabelInterop = /* @__PURE__ */ new WeakMap();
14
+ var cacheNodeInterop = /* @__PURE__ */ new WeakMap();
15
+ return (_getRequireWildcardCache = function(nodeInterop2) {
16
+ return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
17
+ })(nodeInterop);
18
+ }
19
+ function _interop_require_wildcard(obj, nodeInterop) {
20
+ if (!nodeInterop && obj && obj.__esModule) {
21
+ return obj;
22
+ }
23
+ if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
24
+ return {
25
+ default: obj
26
+ };
27
+ }
28
+ var cache = _getRequireWildcardCache(nodeInterop);
29
+ if (cache && cache.has(obj)) {
30
+ return cache.get(obj);
31
+ }
32
+ var newObj = {};
33
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
34
+ for (var key in obj) {
35
+ if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
36
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
37
+ if (desc && (desc.get || desc.set)) {
38
+ Object.defineProperty(newObj, key, desc);
39
+ } else {
40
+ newObj[key] = obj[key];
41
+ }
42
+ }
43
+ }
44
+ newObj.default = obj;
45
+ if (cache) {
46
+ cache.set(obj, newObj);
47
+ }
48
+ return newObj;
49
+ }
34
50
  const getTargetDir = (from, baseDir, targetBaseDir) => {
35
- const relativePath = path.relative(baseDir, from);
36
- return path.resolve(targetBaseDir, relativePath);
51
+ const relativePath = _path.relative(baseDir, from);
52
+ return _path.resolve(targetBaseDir, relativePath);
37
53
  };
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- getTargetDir
41
- });
@@ -1,33 +1,22 @@
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) => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
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 import_exports = {};
19
- __export(import_exports, {
20
- Import: () => Import,
21
- lazyImport: () => lazy
7
+ Object.defineProperty(target, name, {
8
+ enumerable: true,
9
+ get: all[name]
10
+ });
11
+ }
12
+ _export(exports, {
13
+ lazyImport: () => lazy,
14
+ Import: () => Import
22
15
  });
23
- module.exports = __toCommonJS(import_exports);
24
16
  const lazy = (moduleName, requireFn) => {
25
17
  const importLazyLocal = require("../compiled/import-lazy")(requireFn);
26
18
  return importLazyLocal(moduleName);
27
19
  };
28
- const Import = { lazy };
29
- // Annotate the CommonJS export names for ESM import in node:
30
- 0 && (module.exports = {
31
- Import,
32
- lazyImport
33
- });
20
+ const Import = {
21
+ lazy
22
+ };