@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
@@ -1,72 +1,114 @@
|
|
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
|
-
|
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 prettyInstructions_exports = {};
|
25
|
+
__export(prettyInstructions_exports, {
|
26
|
+
getAddressUrls: () => getAddressUrls,
|
27
|
+
getIpv4Interfaces: () => getIpv4Interfaces,
|
28
|
+
isSingleEntry: () => isSingleEntry,
|
29
|
+
prettyInstructions: () => prettyInstructions
|
30
|
+
});
|
31
|
+
module.exports = __toCommonJS(prettyInstructions_exports);
|
32
|
+
var import_os = __toESM(require("os"));
|
33
|
+
var import_compiled = require("./compiled");
|
34
|
+
var import_is = require("./is");
|
35
|
+
const isSingleEntry = (entrypoints) => entrypoints.length === 1 && entrypoints[0].entryName === "main";
|
36
|
+
const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
|
14
37
|
const getIpv4Interfaces = () => {
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
-
});
|
38
|
+
const interfaces = import_os.default.networkInterfaces();
|
39
|
+
const ipv4Interfaces = [];
|
40
|
+
Object.keys(interfaces).forEach((key) => {
|
41
|
+
interfaces[key].forEach((detail) => {
|
42
|
+
const familyV4Value = typeof detail.family === "string" ? "IPv4" : 4;
|
43
|
+
if (detail.family === familyV4Value) {
|
44
|
+
ipv4Interfaces.push(detail);
|
45
|
+
}
|
25
46
|
});
|
26
|
-
|
47
|
+
});
|
48
|
+
return ipv4Interfaces;
|
27
49
|
};
|
28
|
-
|
29
|
-
const
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
},
|
50
|
+
const getAddressUrls = (protocol = "http", port) => {
|
51
|
+
const ipv4Interfaces = getIpv4Interfaces();
|
52
|
+
return ipv4Interfaces.reduce(
|
53
|
+
(memo, detail) => {
|
54
|
+
let type = "Network: ";
|
55
|
+
let url = `${protocol}://${detail.address}:${port}`;
|
56
|
+
if (detail.address.includes(`localhost`) || detail.internal) {
|
57
|
+
type = "Local: ";
|
58
|
+
url = `${protocol}://localhost:${port}`;
|
59
|
+
}
|
60
|
+
memo.push({ type, url });
|
61
|
+
return memo;
|
62
|
+
},
|
63
|
+
[]
|
64
|
+
);
|
41
65
|
};
|
42
|
-
exports.getAddressUrls = getAddressUrls;
|
43
66
|
const prettyInstructions = (appContext, config) => {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
message +=
|
68
|
-
|
69
|
-
|
70
|
-
|
67
|
+
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
68
|
+
const urls = getAddressUrls(
|
69
|
+
config.dev.https && (0, import_is.isDev)() ? "https" : "http",
|
70
|
+
port
|
71
|
+
);
|
72
|
+
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
73
|
+
let message = "App running at:\n\n";
|
74
|
+
if (isSingleEntry(entrypoints) || apiOnly) {
|
75
|
+
message += urls.map(
|
76
|
+
({ type, url }) => ` ${import_compiled.chalk.bold(`> ${type.padEnd(10)}`)}${import_compiled.chalk.cyanBright(
|
77
|
+
normalizeUrl(`${url}/${routes[0].urlPath}`)
|
78
|
+
)}
|
79
|
+
`
|
80
|
+
).join("");
|
81
|
+
} else {
|
82
|
+
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
83
|
+
urls.forEach(({ type, url }) => {
|
84
|
+
message += ` ${import_compiled.chalk.bold(`> ${type}`)}
|
85
|
+
`;
|
86
|
+
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
87
|
+
if (!checkedEntries.includes(entryName)) {
|
88
|
+
return;
|
89
|
+
}
|
90
|
+
message += ` ${import_compiled.chalk.yellowBright(
|
91
|
+
isSSR ? "λ" : "○"
|
92
|
+
)} ${import_compiled.chalk.yellowBright(
|
93
|
+
entryName.padEnd(maxNameLength + 8)
|
94
|
+
)}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
|
95
|
+
`;
|
96
|
+
});
|
97
|
+
});
|
98
|
+
message += "\n";
|
99
|
+
message += import_compiled.chalk.cyanBright(
|
100
|
+
" λ (Server) server-side renders at runtime\n"
|
101
|
+
);
|
102
|
+
message += import_compiled.chalk.cyanBright(
|
103
|
+
" ○ (Static) client-side renders as static HTML\n"
|
104
|
+
);
|
105
|
+
}
|
106
|
+
return message;
|
71
107
|
};
|
72
|
-
|
108
|
+
// Annotate the CommonJS export names for ESM import in node:
|
109
|
+
0 && (module.exports = {
|
110
|
+
getAddressUrls,
|
111
|
+
getIpv4Interfaces,
|
112
|
+
isSingleEntry,
|
113
|
+
prettyInstructions
|
114
|
+
});
|
package/dist/printBuildError.js
CHANGED
@@ -1,43 +1,57 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 printBuildError_exports = {};
|
19
|
+
__export(printBuildError_exports, {
|
20
|
+
printBuildError: () => printBuildError
|
21
|
+
});
|
22
|
+
module.exports = __toCommonJS(printBuildError_exports);
|
23
|
+
var import_compiled = require("./compiled");
|
24
|
+
var import_logger = require("./logger");
|
16
25
|
function printBuildError(err) {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
const message = err != null && err.message;
|
27
|
+
const stack = err != null && err.stack;
|
28
|
+
if (stack && typeof message === "string" && message.indexOf("from Terser") !== -1) {
|
29
|
+
try {
|
30
|
+
const matched = /(.+)\[(.+):(.+),(.+)\]\[.+\]/.exec(stack);
|
31
|
+
if (!matched) {
|
32
|
+
throw new Error("Using errors for control flow is bad.");
|
33
|
+
}
|
34
|
+
const problemPath = matched[2];
|
35
|
+
const line = matched[3];
|
36
|
+
const column = matched[4];
|
37
|
+
import_logger.logger.error(
|
38
|
+
`Failed to minify the code from this file:
|
39
|
+
|
40
|
+
${import_compiled.chalk.yellow(
|
41
|
+
` ${problemPath}:${line}${column !== "0" ? ":" + column : ""}`
|
42
|
+
)}
|
43
|
+
`
|
44
|
+
);
|
45
|
+
} catch (ignored) {
|
46
|
+
import_logger.logger.error(`Failed to minify the bundle. ${err}
|
47
|
+
`);
|
36
48
|
}
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
49
|
+
} else {
|
50
|
+
import_logger.logger.error((message || err) + "\n");
|
51
|
+
}
|
52
|
+
import_logger.logger.log();
|
41
53
|
}
|
42
|
-
|
43
|
-
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
55
|
+
0 && (module.exports = {
|
56
|
+
printBuildError
|
57
|
+
});
|
package/dist/react.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export declare const isBeyondReact17: (cwd: string) => boolean;
|
1
|
+
export declare const isBeyondReact17: (cwd: string) => boolean;
|
package/dist/react.js
CHANGED
@@ -1,24 +1,60 @@
|
|
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 __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
10
|
+
var __spreadValues = (a, b) => {
|
11
|
+
for (var prop in b || (b = {}))
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
14
|
+
if (__getOwnPropSymbols)
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
16
|
+
if (__propIsEnum.call(b, prop))
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
18
|
+
}
|
19
|
+
return a;
|
20
|
+
};
|
21
|
+
var __export = (target, all) => {
|
22
|
+
for (var name in all)
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
24
|
+
};
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
27
|
+
for (let key of __getOwnPropNames(from))
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
30
|
+
}
|
31
|
+
return to;
|
4
32
|
};
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
34
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
35
|
+
mod
|
36
|
+
));
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
38
|
+
var react_exports = {};
|
39
|
+
__export(react_exports, {
|
40
|
+
isBeyondReact17: () => isBeyondReact17
|
41
|
+
});
|
42
|
+
module.exports = __toCommonJS(react_exports);
|
43
|
+
var import_path = __toESM(require("path"));
|
44
|
+
var import__ = require(".");
|
9
45
|
const isBeyondReact17 = (cwd) => {
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
return false;
|
21
|
-
}
|
22
|
-
return _1.semver.satisfies(_1.semver.minVersion(deps.react), '>=17.0.0');
|
46
|
+
const pkgPath = import_path.default.join(cwd, "package.json");
|
47
|
+
if (!import__.fs.existsSync(pkgPath)) {
|
48
|
+
return false;
|
49
|
+
}
|
50
|
+
const pkgInfo = JSON.parse(import__.fs.readFileSync(pkgPath, "utf8"));
|
51
|
+
const deps = __spreadValues(__spreadValues({}, pkgInfo.devDependencies), pkgInfo.dependencies);
|
52
|
+
if (typeof deps.react !== "string") {
|
53
|
+
return false;
|
54
|
+
}
|
55
|
+
return import__.semver.satisfies(import__.semver.minVersion(deps.react), ">=17.0.0");
|
23
56
|
};
|
24
|
-
|
57
|
+
// Annotate the CommonJS export names for ESM import in node:
|
58
|
+
0 && (module.exports = {
|
59
|
+
isBeyondReact17
|
60
|
+
});
|
package/dist/readTsConfig.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const readTsConfig: (root: string) => any;
|
2
|
-
export declare const readTsConfigByFile: (filename: string) => any;
|
2
|
+
export declare const readTsConfigByFile: (filename: string) => any;
|
package/dist/readTsConfig.js
CHANGED
@@ -1,17 +1,43 @@
|
|
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
|
-
|
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 readTsConfig_exports = {};
|
25
|
+
__export(readTsConfig_exports, {
|
26
|
+
readTsConfig: () => readTsConfig,
|
27
|
+
readTsConfigByFile: () => readTsConfigByFile
|
28
|
+
});
|
29
|
+
module.exports = __toCommonJS(readTsConfig_exports);
|
30
|
+
var import_path = __toESM(require("path"));
|
31
|
+
var import_compiled = require("./compiled");
|
9
32
|
const readTsConfig = (root) => {
|
10
|
-
|
33
|
+
return readTsConfigByFile(import_path.default.resolve(root, "./tsconfig.json"));
|
11
34
|
};
|
12
|
-
exports.readTsConfig = readTsConfig;
|
13
35
|
const readTsConfigByFile = (filename) => {
|
14
|
-
|
15
|
-
|
36
|
+
const content = import_compiled.fs.readFileSync(import_path.default.resolve(filename), "utf-8");
|
37
|
+
return import_compiled.json5.parse(content);
|
16
38
|
};
|
17
|
-
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
40
|
+
0 && (module.exports = {
|
41
|
+
readTsConfig,
|
42
|
+
readTsConfigByFile
|
43
|
+
});
|
package/dist/removeSlash.d.ts
CHANGED
package/dist/removeSlash.js
CHANGED
@@ -1,9 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
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 removeSlash_exports = {};
|
19
|
+
__export(removeSlash_exports, {
|
20
|
+
removeLeadingSlash: () => removeLeadingSlash,
|
21
|
+
removeSlash: () => removeSlash,
|
22
|
+
removeTailSlash: () => removeTailSlash
|
23
|
+
});
|
24
|
+
module.exports = __toCommonJS(removeSlash_exports);
|
25
|
+
const removeLeadingSlash = (s) => s.replace(/^\/+/, "");
|
26
|
+
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
27
|
+
const removeSlash = (s) => removeLeadingSlash(removeTailSlash(s));
|
28
|
+
// Annotate the CommonJS export names for ESM import in node:
|
29
|
+
0 && (module.exports = {
|
30
|
+
removeLeadingSlash,
|
31
|
+
removeSlash,
|
32
|
+
removeTailSlash
|
33
|
+
});
|
package/dist/routes.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
export declare const getPathWithoutExt: (filename: string) => string;
|
2
|
-
export declare const getRouteId: (componentPath: string, routesDir: string, entryName: string) => string;
|
2
|
+
export declare const getRouteId: (componentPath: string, routesDir: string, entryName: string) => string;
|
package/dist/routes.js
CHANGED
@@ -1,27 +1,54 @@
|
|
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
|
-
|
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 routes_exports = {};
|
25
|
+
__export(routes_exports, {
|
26
|
+
getPathWithoutExt: () => getPathWithoutExt,
|
27
|
+
getRouteId: () => getRouteId
|
28
|
+
});
|
29
|
+
module.exports = __toCommonJS(routes_exports);
|
30
|
+
var import_path = __toESM(require("path"));
|
31
|
+
var import_path2 = require("./path");
|
32
|
+
var import_constants = require("./constants");
|
10
33
|
const getPathWithoutExt = (filename) => {
|
11
|
-
|
12
|
-
|
34
|
+
const extname = import_path.default.extname(filename);
|
35
|
+
return filename.slice(0, -extname.length);
|
13
36
|
};
|
14
|
-
exports.getPathWithoutExt = getPathWithoutExt;
|
15
37
|
const getRouteId = (componentPath, routesDir, entryName) => {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
|
38
|
+
const relativePath = (0, import_path2.normalizeToPosixPath)(
|
39
|
+
import_path.default.relative(routesDir, componentPath)
|
40
|
+
);
|
41
|
+
const pathWithoutExt = getPathWithoutExt(relativePath);
|
42
|
+
let id = ``;
|
43
|
+
if (entryName === import_constants.MAIN_ENTRY_NAME) {
|
44
|
+
id = pathWithoutExt;
|
45
|
+
} else {
|
46
|
+
id = `${entryName}_${pathWithoutExt}`;
|
47
|
+
}
|
48
|
+
return id;
|
26
49
|
};
|
27
|
-
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
51
|
+
0 && (module.exports = {
|
52
|
+
getPathWithoutExt,
|
53
|
+
getRouteId
|
54
|
+
});
|
package/dist/runtimeExports.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
export declare const createRuntimeExportsUtils: (pwd?: any, namespace?: any) => {
|
2
|
-
|
3
|
-
|
4
|
-
};
|
2
|
+
addExport: (statement: string) => void;
|
3
|
+
getPath: () => string;
|
4
|
+
};
|