@modern-js/utils 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/FileSizeReporter.d.ts +5 -5
- package/dist/FileSizeReporter.js +143 -136
- package/dist/alias.d.ts +14 -12
- package/dist/alias.js +94 -54
- package/dist/analyzeProject.d.ts +1 -1
- package/dist/analyzeProject.js +58 -33
- package/dist/applyOptionsChain.d.ts +1 -1
- package/dist/applyOptionsChain.js +55 -27
- package/dist/chainId.d.ts +256 -184
- package/dist/chainId.js +132 -187
- package/dist/clearConsole.d.ts +1 -1
- package/dist/clearConsole.js +29 -7
- package/dist/commands.d.ts +1 -1
- package/dist/commands.js +33 -10
- package/dist/compatRequire.d.ts +3 -3
- package/dist/compatRequire.js +74 -38
- package/dist/compiled.d.ts +2 -1
- package/dist/compiled.js +137 -72
- package/dist/constants.d.ts +131 -105
- package/dist/constants.js +298 -277
- package/dist/debug.d.ts +1 -1
- package/dist/debug.js +28 -11
- package/dist/emptyDir.d.ts +1 -1
- package/dist/emptyDir.js +51 -9
- package/dist/ensureAbsolutePath.d.ts +1 -1
- package/dist/ensureAbsolutePath.js +33 -14
- package/dist/ensureArray.d.ts +1 -1
- package/dist/ensureArray.js +30 -8
- package/dist/findExists.d.ts +1 -1
- package/dist/findExists.js +37 -17
- package/dist/format.d.ts +3 -3
- package/dist/format.js +93 -81
- package/dist/generateMetaTags.d.ts +3 -3
- package/dist/generateMetaTags.js +56 -43
- package/dist/getBrowserslist.d.ts +1 -1
- package/dist/getBrowserslist.js +31 -7
- package/dist/getCoreJsVersion.d.ts +1 -1
- package/dist/getCoreJsVersion.js +39 -35
- package/dist/getEntryOptions.d.ts +1 -1
- package/dist/getEntryOptions.js +51 -24
- package/dist/getPackageManager.d.ts +1 -1
- package/dist/getPackageManager.js +75 -28
- package/dist/getPort.d.ts +7 -4
- package/dist/getPort.js +104 -58
- package/dist/getServerConfig.d.ts +1 -1
- package/dist/getServerConfig.js +61 -32
- package/dist/import.d.ts +2 -2
- package/dist/import.js +31 -8
- package/dist/index.d.ts +1 -1
- package/dist/index.js +59 -59
- package/dist/is/index.d.ts +12 -1
- package/dist/is/index.js +83 -82
- package/dist/is/node-env.d.ts +1 -1
- package/dist/is/node-env.js +39 -17
- package/dist/is/platform.d.ts +1 -1
- package/dist/is/platform.js +30 -10
- package/dist/is/type.d.ts +1 -1
- package/dist/is/type.js +48 -22
- package/dist/logger.d.ts +48 -48
- package/dist/logger.js +127 -95
- package/dist/monorepo.d.ts +3 -3
- package/dist/monorepo.js +117 -74
- package/dist/nodeEnv.d.ts +1 -1
- package/dist/nodeEnv.js +72 -25
- package/dist/path.d.ts +3 -1
- package/dist/path.js +76 -59
- package/dist/pathSerializer.d.ts +6 -6
- package/dist/pathSerializer.js +65 -43
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.js +45 -26
- package/dist/prettyInstructions.d.ts +4 -4
- package/dist/prettyInstructions.js +107 -65
- package/dist/printBuildError.d.ts +1 -1
- package/dist/printBuildError.js +54 -40
- package/dist/react.d.ts +1 -1
- package/dist/react.js +57 -21
- package/dist/readTsConfig.d.ts +1 -1
- package/dist/readTsConfig.js +38 -12
- package/dist/removeSlash.d.ts +1 -1
- package/dist/removeSlash.js +33 -9
- package/dist/routes.d.ts +1 -1
- package/dist/routes.js +49 -22
- package/dist/runtimeExports.d.ts +3 -3
- package/dist/runtimeExports.js +59 -39
- package/dist/ssr.d.ts +2 -1
- package/dist/ssr.js +30 -7
- package/dist/storage.d.ts +3 -3
- package/dist/storage.js +65 -59
- package/dist/test-utils.d.ts +1 -1
- package/dist/test-utils.js +30 -24
- package/dist/tryResolve.d.ts +2 -1
- package/dist/tryResolve.js +45 -33
- package/dist/types.d.ts +1 -1
- package/dist/types.js +15 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +83 -24
- package/dist/wait.d.ts +1 -1
- package/dist/wait.js +28 -6
- package/dist/watch.d.ts +3 -3
- package/dist/watch.js +82 -55
- package/package.json +7 -8
package/dist/getCoreJsVersion.js
CHANGED
@@ -1,38 +1,42 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
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;
|
24
18
|
};
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var getCoreJsVersion_exports = {};
|
25
|
+
__export(getCoreJsVersion_exports, {
|
26
|
+
getCoreJsVersion: () => getCoreJsVersion
|
27
|
+
});
|
28
|
+
module.exports = __toCommonJS(getCoreJsVersion_exports);
|
29
|
+
var fs = __toESM(require("../compiled/fs-extra"));
|
28
30
|
const getCoreJsVersion = (corejsPkgPath) => {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
}
|
31
|
+
try {
|
32
|
+
const { version } = fs.readJSONSync(corejsPkgPath);
|
33
|
+
const [major, minor] = version.split(".");
|
34
|
+
return `${major}.${minor}`;
|
35
|
+
} catch (err) {
|
36
|
+
return "3";
|
37
|
+
}
|
37
38
|
};
|
38
|
-
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
40
|
+
0 && (module.exports = {
|
41
|
+
getCoreJsVersion
|
42
|
+
});
|
@@ -1 +1 @@
|
|
1
|
-
export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string) => T | undefined;
|
1
|
+
export declare const getEntryOptions: <T>(name: string, baseOptions?: T | undefined, optionsByEntries?: Record<string, T> | undefined, packageName?: string) => T | undefined;
|
package/dist/getEntryOptions.js
CHANGED
@@ -1,27 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return optionsByEntry !== undefined
|
17
|
-
? (0, is_1.isPlainObject)(optionsByEntry) && (0, is_1.isPlainObject)(baseOptions)
|
18
|
-
? { ...baseOptions, ...optionsByEntry }
|
19
|
-
: optionsByEntry
|
20
|
-
: baseOptions;
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
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]);
|
21
16
|
}
|
22
|
-
|
23
|
-
|
17
|
+
return a;
|
18
|
+
};
|
19
|
+
var __export = (target, all) => {
|
20
|
+
for (var name in all)
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
22
|
+
};
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
25
|
+
for (let key of __getOwnPropNames(from))
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
28
|
+
}
|
29
|
+
return to;
|
30
|
+
};
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
32
|
+
var getEntryOptions_exports = {};
|
33
|
+
__export(getEntryOptions_exports, {
|
34
|
+
getEntryOptions: () => getEntryOptions
|
35
|
+
});
|
36
|
+
module.exports = __toCommonJS(getEntryOptions_exports);
|
37
|
+
var import_is = require("./is");
|
38
|
+
var import_constants = require("./constants");
|
39
|
+
const getEntryOptions = (name, baseOptions, optionsByEntries, packageName) => {
|
40
|
+
if (optionsByEntries) {
|
41
|
+
let optionsByEntry = getOptionsByEntryName(name, optionsByEntries);
|
42
|
+
if (optionsByEntry === void 0 && name === import_constants.MAIN_ENTRY_NAME && packageName) {
|
43
|
+
optionsByEntry = getOptionsByEntryName(packageName, optionsByEntries);
|
24
44
|
}
|
45
|
+
return optionsByEntry !== void 0 ? (0, import_is.isPlainObject)(optionsByEntry) && (0, import_is.isPlainObject)(baseOptions) ? __spreadValues(__spreadValues({}, baseOptions), optionsByEntry) : optionsByEntry : baseOptions;
|
46
|
+
} else {
|
47
|
+
return baseOptions;
|
48
|
+
}
|
25
49
|
};
|
26
|
-
|
27
|
-
|
50
|
+
const getOptionsByEntryName = (name, optionsByEntries) => optionsByEntries.hasOwnProperty(name) ? optionsByEntries[name] : void 0;
|
51
|
+
// Annotate the CommonJS export names for ESM import in node:
|
52
|
+
0 && (module.exports = {
|
53
|
+
getEntryOptions
|
54
|
+
});
|
@@ -1 +1 @@
|
|
1
|
-
export declare function getPackageManager(cwd?: string): Promise<"npm" | "yarn" | "pnpm">;
|
1
|
+
export declare function getPackageManager(cwd?: string): Promise<"npm" | "yarn" | "pnpm">;
|
@@ -1,36 +1,83 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
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 });
|
4
10
|
};
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
25
|
+
return new Promise((resolve, reject) => {
|
26
|
+
var fulfilled = (value) => {
|
27
|
+
try {
|
28
|
+
step(generator.next(value));
|
29
|
+
} catch (e) {
|
30
|
+
reject(e);
|
31
|
+
}
|
32
|
+
};
|
33
|
+
var rejected = (value) => {
|
34
|
+
try {
|
35
|
+
step(generator.throw(value));
|
36
|
+
} catch (e) {
|
37
|
+
reject(e);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
42
|
+
});
|
43
|
+
};
|
44
|
+
var getPackageManager_exports = {};
|
45
|
+
__export(getPackageManager_exports, {
|
46
|
+
getPackageManager: () => getPackageManager
|
47
|
+
});
|
48
|
+
module.exports = __toCommonJS(getPackageManager_exports);
|
49
|
+
var import_os = __toESM(require("os"));
|
50
|
+
var import_path = __toESM(require("path"));
|
51
|
+
var import_compiled = require("./compiled");
|
52
|
+
var import_nodeEnv = require("./nodeEnv");
|
11
53
|
const MAX_TIMES = 5;
|
12
|
-
|
54
|
+
function getPackageManager() {
|
55
|
+
return __async(this, arguments, function* (cwd = process.cwd()) {
|
13
56
|
let appDirectory = cwd;
|
14
57
|
let times = 0;
|
15
|
-
while (
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
58
|
+
while (import_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
|
59
|
+
times++;
|
60
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
|
61
|
+
return "pnpm";
|
62
|
+
}
|
63
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "yarn.lock"))) {
|
64
|
+
return "yarn";
|
65
|
+
}
|
66
|
+
if (import_compiled.fs.existsSync(import_path.default.resolve(appDirectory, "package-lock.json"))) {
|
67
|
+
return "npm";
|
68
|
+
}
|
69
|
+
appDirectory = import_path.default.join(appDirectory, "..");
|
27
70
|
}
|
28
|
-
if (
|
29
|
-
|
71
|
+
if (yield (0, import_nodeEnv.canUsePnpm)()) {
|
72
|
+
return "pnpm";
|
30
73
|
}
|
31
|
-
if (
|
32
|
-
|
74
|
+
if (yield (0, import_nodeEnv.canUseYarn)()) {
|
75
|
+
return "yarn";
|
33
76
|
}
|
34
|
-
return
|
77
|
+
return "npm";
|
78
|
+
});
|
35
79
|
}
|
36
|
-
|
80
|
+
// Annotate the CommonJS export names for ESM import in node:
|
81
|
+
0 && (module.exports = {
|
82
|
+
getPackageManager
|
83
|
+
});
|
package/dist/getPort.d.ts
CHANGED
@@ -5,7 +5,10 @@
|
|
5
5
|
* @param strictPort - Whether to throw an error when the port is occupied.
|
6
6
|
* @returns Available port number.
|
7
7
|
*/
|
8
|
-
export declare const getPort: (port: string | number, {
|
9
|
-
|
10
|
-
|
11
|
-
}
|
8
|
+
export declare const getPort: (port: string | number, {
|
9
|
+
tryLimits,
|
10
|
+
strictPort
|
11
|
+
}?: {
|
12
|
+
tryLimits?: number | undefined;
|
13
|
+
strictPort?: boolean | undefined;
|
14
|
+
}) => Promise<number>;
|
package/dist/getPort.js
CHANGED
@@ -1,62 +1,108 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
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 });
|
4
10
|
};
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
25
|
+
return new Promise((resolve, reject) => {
|
26
|
+
var fulfilled = (value) => {
|
27
|
+
try {
|
28
|
+
step(generator.next(value));
|
29
|
+
} catch (e) {
|
30
|
+
reject(e);
|
31
|
+
}
|
32
|
+
};
|
33
|
+
var rejected = (value) => {
|
34
|
+
try {
|
35
|
+
step(generator.throw(value));
|
36
|
+
} catch (e) {
|
37
|
+
reject(e);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
42
|
+
});
|
43
|
+
};
|
44
|
+
var getPort_exports = {};
|
45
|
+
__export(getPort_exports, {
|
46
|
+
getPort: () => getPort
|
47
|
+
});
|
48
|
+
module.exports = __toCommonJS(getPort_exports);
|
49
|
+
var import_net = __toESM(require("net"));
|
50
|
+
var import_compiled = require("./compiled");
|
51
|
+
var import_logger = require("./logger");
|
52
|
+
const getPort = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (port, {
|
53
|
+
tryLimits = 20,
|
54
|
+
strictPort = false
|
55
|
+
} = {}) {
|
56
|
+
if (typeof port === "string") {
|
57
|
+
port = parseInt(port, 10);
|
58
|
+
}
|
59
|
+
if (strictPort) {
|
60
|
+
tryLimits = 1;
|
61
|
+
}
|
62
|
+
const original = port;
|
63
|
+
let found = false;
|
64
|
+
let attempts = 0;
|
65
|
+
while (!found && attempts <= tryLimits) {
|
66
|
+
try {
|
67
|
+
yield new Promise((resolve, reject) => {
|
68
|
+
const server = import_net.default.createServer();
|
69
|
+
server.unref();
|
70
|
+
server.on("error", reject);
|
71
|
+
server.listen(
|
72
|
+
{
|
73
|
+
port,
|
74
|
+
host: "0.0.0.0"
|
75
|
+
},
|
76
|
+
() => {
|
77
|
+
found = true;
|
78
|
+
server.close(resolve);
|
79
|
+
}
|
80
|
+
);
|
81
|
+
});
|
82
|
+
} catch (e) {
|
83
|
+
if (e.code !== "EADDRINUSE") {
|
84
|
+
throw e;
|
85
|
+
}
|
86
|
+
port++;
|
87
|
+
attempts++;
|
21
88
|
}
|
89
|
+
}
|
90
|
+
if (port !== original) {
|
22
91
|
if (strictPort) {
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
server.unref();
|
33
|
-
server.on('error', reject);
|
34
|
-
server.listen({
|
35
|
-
port,
|
36
|
-
host: '0.0.0.0',
|
37
|
-
}, () => {
|
38
|
-
found = true;
|
39
|
-
server.close(resolve);
|
40
|
-
});
|
41
|
-
});
|
42
|
-
}
|
43
|
-
catch (e) {
|
44
|
-
if (e.code !== 'EADDRINUSE') {
|
45
|
-
throw e;
|
46
|
-
}
|
47
|
-
port++;
|
48
|
-
attempts++;
|
49
|
-
}
|
92
|
+
throw new Error(
|
93
|
+
`Port "${original}" is occupied, please choose another one.`
|
94
|
+
);
|
95
|
+
} else {
|
96
|
+
import_logger.logger.info(
|
97
|
+
`Something is already running on port ${original}. ${import_compiled.chalk.yellow(
|
98
|
+
`Use port ${port} instead.`
|
99
|
+
)}`
|
100
|
+
);
|
50
101
|
}
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
}
|
59
|
-
return port;
|
60
|
-
};
|
61
|
-
exports.getPort = getPort;
|
62
|
-
/* eslint-enable no-param-reassign, @typescript-eslint/no-loop-func */
|
102
|
+
}
|
103
|
+
return port;
|
104
|
+
});
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
106
|
+
0 && (module.exports = {
|
107
|
+
getPort
|
108
|
+
});
|
@@ -1 +1 @@
|
|
1
|
-
export declare const getServerConfig: (appDirectory: string, configFile: string) => Promise<string | false>;
|
1
|
+
export declare const getServerConfig: (appDirectory: string, configFile: string) => Promise<string | false>;
|
package/dist/getServerConfig.js
CHANGED
@@ -1,34 +1,63 @@
|
|
1
|
-
|
2
|
-
var
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
19
|
-
if (mod && mod.__esModule) return mod;
|
20
|
-
var result = {};
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
22
|
-
__setModuleDefault(result, mod);
|
23
|
-
return result;
|
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;
|
24
18
|
};
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
20
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
21
|
+
mod
|
22
|
+
));
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
24
|
+
var __async = (__this, __arguments, generator) => {
|
25
|
+
return new Promise((resolve, reject) => {
|
26
|
+
var fulfilled = (value) => {
|
27
|
+
try {
|
28
|
+
step(generator.next(value));
|
29
|
+
} catch (e) {
|
30
|
+
reject(e);
|
31
|
+
}
|
32
|
+
};
|
33
|
+
var rejected = (value) => {
|
34
|
+
try {
|
35
|
+
step(generator.throw(value));
|
36
|
+
} catch (e) {
|
37
|
+
reject(e);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
41
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
42
|
+
});
|
33
43
|
};
|
34
|
-
|
44
|
+
var getServerConfig_exports = {};
|
45
|
+
__export(getServerConfig_exports, {
|
46
|
+
getServerConfig: () => getServerConfig
|
47
|
+
});
|
48
|
+
module.exports = __toCommonJS(getServerConfig_exports);
|
49
|
+
var path = __toESM(require("path"));
|
50
|
+
var import_constants = require("./constants");
|
51
|
+
var import_findExists = require("./findExists");
|
52
|
+
const getServerConfig = (appDirectory, configFile) => __async(void 0, null, function* () {
|
53
|
+
const configFilePath = (0, import_findExists.findExists)(
|
54
|
+
import_constants.CONFIG_FILE_EXTENSIONS.map(
|
55
|
+
(extension) => path.resolve(appDirectory, `${configFile}${extension}`)
|
56
|
+
)
|
57
|
+
);
|
58
|
+
return configFilePath;
|
59
|
+
});
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
61
|
+
0 && (module.exports = {
|
62
|
+
getServerConfig
|
63
|
+
});
|
package/dist/import.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
declare const lazy: (moduleName: string, requireFn: (id: string) => unknown) => any;
|
2
2
|
export { lazy as lazyImport };
|
3
3
|
export declare const Import: {
|
4
|
-
|
5
|
-
};
|
4
|
+
lazy: (moduleName: string, requireFn: (id: string) => unknown) => any;
|
5
|
+
};
|
package/dist/import.js
CHANGED
@@ -1,10 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
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 import_exports = {};
|
19
|
+
__export(import_exports, {
|
20
|
+
Import: () => Import,
|
21
|
+
lazyImport: () => lazy
|
22
|
+
});
|
23
|
+
module.exports = __toCommonJS(import_exports);
|
5
24
|
const lazy = (moduleName, requireFn) => {
|
6
|
-
|
7
|
-
|
25
|
+
const importLazyLocal = require("../compiled/import-lazy")(requireFn);
|
26
|
+
return importLazyLocal(moduleName);
|
8
27
|
};
|
9
|
-
|
10
|
-
|
28
|
+
const Import = { lazy };
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
30
|
+
0 && (module.exports = {
|
31
|
+
Import,
|
32
|
+
lazyImport
|
33
|
+
});
|
package/dist/index.d.ts
CHANGED