@modern-js/utils 2.15.0 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/FileSizeReporter.js +69 -92
- package/dist/cjs/alias.js +34 -58
- package/dist/cjs/analyzeProject.js +58 -41
- package/dist/cjs/applyOptionsChain.js +15 -42
- package/dist/cjs/babel.js +28 -39
- package/dist/cjs/chainId.js +7 -25
- package/dist/cjs/clearConsole.js +7 -25
- package/dist/cjs/commands.js +14 -29
- package/dist/cjs/compatRequire.js +22 -38
- package/dist/cjs/compiled.js +120 -139
- package/dist/cjs/constants.js +143 -98
- package/dist/cjs/debug.js +8 -26
- package/dist/cjs/emptyDir.js +10 -28
- package/dist/cjs/ensureAbsolutePath.js +13 -36
- package/dist/cjs/ensureArray.js +10 -26
- package/dist/cjs/findExists.js +14 -37
- package/dist/cjs/generateMetaTags.js +12 -31
- package/dist/cjs/getBrowserslist.js +20 -27
- package/dist/cjs/getCoreJsVersion.js +49 -37
- package/dist/cjs/getEntryOptions.js +14 -29
- package/dist/cjs/getPackageManager.js +23 -46
- package/dist/cjs/getPort.js +26 -61
- package/dist/cjs/getServerConfig.js +51 -43
- package/dist/cjs/getTargetDir.js +50 -38
- package/dist/cjs/import.js +16 -27
- package/dist/cjs/index.js +61 -60
- package/dist/cjs/is/index.js +53 -68
- package/dist/cjs/is/nodeEnv.js +13 -29
- package/dist/cjs/is/platform.js +13 -26
- package/dist/cjs/is/type.js +14 -33
- package/dist/cjs/logger.js +54 -50
- package/dist/cjs/monorepo.js +47 -78
- package/dist/cjs/nodeEnv.js +29 -31
- package/dist/cjs/path.js +42 -63
- package/dist/cjs/pathSerializer.js +43 -51
- package/dist/cjs/plugin.js +11 -29
- package/dist/cjs/prettyInstructions.js +35 -68
- package/dist/cjs/printBuildError.js +15 -37
- package/dist/cjs/react.js +18 -41
- package/dist/cjs/readTsConfig.js +21 -39
- package/dist/cjs/removeSlash.js +13 -27
- package/dist/cjs/resolve.js +25 -31
- package/dist/cjs/routes.js +23 -43
- package/dist/cjs/runtime/index.js +18 -17
- package/dist/cjs/runtime/parsed.js +8 -26
- package/dist/cjs/runtimeExports.js +31 -56
- package/dist/cjs/ssr.js +13 -26
- package/dist/cjs/storage.js +51 -41
- package/dist/cjs/testUtils.js +8 -29
- package/dist/cjs/types.js +4 -15
- package/dist/cjs/universal/constants.js +13 -26
- package/dist/cjs/universal/formatWebpack.js +16 -44
- package/dist/cjs/universal/nestedRoutes.js +94 -46
- package/dist/cjs/universal/pluginDagSort.js +58 -0
- package/dist/cjs/universal/remixRouter.js +18 -17
- package/dist/cjs/universal/serialize.js +16 -37
- package/dist/cjs/version.js +25 -41
- package/dist/cjs/wait.js +7 -25
- package/dist/cjs/watch.js +69 -43
- package/dist/esm/FileSizeReporter.js +40 -52
- package/dist/esm/alias.js +9 -19
- package/dist/esm/analyzeProject.js +3 -7
- package/dist/esm/applyOptionsChain.js +5 -17
- package/dist/esm/babel.js +6 -8
- package/dist/esm/chainId.js +1 -4
- package/dist/esm/clearConsole.js +1 -4
- package/dist/esm/commands.js +6 -12
- package/dist/esm/compatRequire.js +10 -17
- package/dist/esm/compiled.js +32 -76
- package/dist/esm/constants.js +143 -89
- package/dist/esm/debug.js +1 -4
- package/dist/esm/emptyDir.js +1 -4
- package/dist/esm/ensureAbsolutePath.js +1 -4
- package/dist/esm/ensureArray.js +4 -5
- package/dist/esm/findExists.js +1 -4
- package/dist/esm/generateMetaTags.js +6 -10
- package/dist/esm/getBrowserslist.js +8 -6
- package/dist/esm/getCoreJsVersion.js +1 -4
- package/dist/esm/getEntryOptions.js +5 -5
- package/dist/esm/getPackageManager.js +1 -4
- package/dist/esm/getPort.js +10 -25
- package/dist/esm/getServerConfig.js +2 -9
- package/dist/esm/getTargetDir.js +1 -4
- package/dist/esm/import.js +3 -4
- package/dist/esm/is/index.js +18 -30
- package/dist/esm/is/nodeEnv.js +5 -12
- package/dist/esm/is/platform.js +2 -6
- package/dist/esm/is/type.js +8 -18
- package/dist/esm/logger.js +37 -17
- package/dist/esm/monorepo.js +21 -38
- package/dist/esm/nodeEnv.js +18 -11
- package/dist/esm/path.js +16 -23
- package/dist/esm/pathSerializer.js +21 -21
- package/dist/esm/plugin.js +1 -4
- package/dist/esm/prettyInstructions.js +13 -32
- package/dist/esm/printBuildError.js +4 -11
- package/dist/esm/react.js +1 -4
- package/dist/esm/readTsConfig.js +2 -6
- package/dist/esm/removeSlash.js +3 -8
- package/dist/esm/resolve.js +14 -11
- package/dist/esm/routes.js +4 -10
- package/dist/esm/runtime/parsed.js +2 -5
- package/dist/esm/runtimeExports.js +17 -22
- package/dist/esm/ssr.js +1 -4
- package/dist/esm/storage.js +2 -6
- package/dist/esm/testUtils.js +2 -8
- package/dist/esm/types.js +1 -0
- package/dist/esm/universal/constants.js +2 -6
- package/dist/esm/universal/formatWebpack.js +10 -22
- package/dist/esm/universal/nestedRoutes.js +41 -27
- package/dist/esm/universal/pluginDagSort.js +50 -0
- package/dist/esm/universal/serialize.js +4 -5
- package/dist/esm/version.js +5 -7
- package/dist/esm/wait.js +1 -3
- package/dist/esm/watch.js +14 -9
- package/dist/types/universal/pluginDagSort.d.ts +1 -0
- package/package.json +17 -5
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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 } =
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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 ===
|
|
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,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 (
|
|
22
|
+
while (_os.default.homedir() !== appDirectory && times < MAX_TIMES) {
|
|
42
23
|
times++;
|
|
43
|
-
if (
|
|
24
|
+
if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "pnpm-lock.yaml"))) {
|
|
44
25
|
return "pnpm";
|
|
45
26
|
}
|
|
46
|
-
if (
|
|
27
|
+
if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "yarn.lock"))) {
|
|
47
28
|
return "yarn";
|
|
48
29
|
}
|
|
49
|
-
if (
|
|
30
|
+
if (_compiled.fs.existsSync(_path.default.resolve(appDirectory, "package-lock.json"))) {
|
|
50
31
|
return "npm";
|
|
51
32
|
}
|
|
52
|
-
appDirectory =
|
|
33
|
+
appDirectory = _path.default.join(appDirectory, "..");
|
|
53
34
|
}
|
|
54
|
-
if (await (0,
|
|
35
|
+
if (await (0, _nodeEnv.canUsePnpm)()) {
|
|
55
36
|
return "pnpm";
|
|
56
37
|
}
|
|
57
|
-
if (await (0,
|
|
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
|
-
});
|
package/dist/cjs/getPort.js
CHANGED
|
@@ -1,42 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
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 =
|
|
30
|
+
const server = _net.default.createServer();
|
|
53
31
|
server.unref();
|
|
54
32
|
server.on("error", reject);
|
|
55
|
-
server.listen(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
()
|
|
61
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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,
|
|
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
|
-
});
|
package/dist/cjs/getTargetDir.js
CHANGED
|
@@ -1,41 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
33
|
-
|
|
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 =
|
|
36
|
-
return
|
|
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
|
-
});
|
package/dist/cjs/import.js
CHANGED
|
@@ -1,33 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
Import,
|
|
32
|
-
lazyImport
|
|
33
|
-
});
|
|
20
|
+
const Import = {
|
|
21
|
+
lazy
|
|
22
|
+
};
|