@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,44 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 prettyInstructions_exports = {};
|
|
29
|
-
__export(prettyInstructions_exports, {
|
|
30
|
-
getAddressUrls: () => getAddressUrls,
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
31
13
|
getIpv4Interfaces: () => getIpv4Interfaces,
|
|
14
|
+
getAddressUrls: () => getAddressUrls,
|
|
32
15
|
prettyInstructions: () => prettyInstructions
|
|
33
16
|
});
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
17
|
+
const _os = /* @__PURE__ */ _interop_require_default(require("os"));
|
|
18
|
+
const _compiled = require("./compiled");
|
|
19
|
+
const _is = require("./is");
|
|
20
|
+
const _constants = require("./constants");
|
|
21
|
+
function _interop_require_default(obj) {
|
|
22
|
+
return obj && obj.__esModule ? obj : {
|
|
23
|
+
default: obj
|
|
24
|
+
};
|
|
25
|
+
}
|
|
39
26
|
const normalizeUrl = (url) => url.replace(/([^:]\/)\/+/g, "$1");
|
|
40
27
|
const getIpv4Interfaces = () => {
|
|
41
|
-
const interfaces =
|
|
28
|
+
const interfaces = _os.default.networkInterfaces();
|
|
42
29
|
const ipv4Interfaces = [];
|
|
43
30
|
Object.keys(interfaces).forEach((key) => {
|
|
44
31
|
interfaces[key].forEach((detail) => {
|
|
@@ -53,8 +40,10 @@ const getIpv4Interfaces = () => {
|
|
|
53
40
|
const getAddressUrls = (protocol = "http", port, host) => {
|
|
54
41
|
const LOCAL_LABEL = "Local: ";
|
|
55
42
|
const NETWORK_LABEL = "Network: ";
|
|
56
|
-
const isLocalhost = (url) =>
|
|
57
|
-
|
|
43
|
+
const isLocalhost = (url) => {
|
|
44
|
+
return url === null || url === void 0 ? void 0 : url.includes("localhost");
|
|
45
|
+
};
|
|
46
|
+
if (host && host !== _constants.DEFAULT_DEV_HOST) {
|
|
58
47
|
return [
|
|
59
48
|
{
|
|
60
49
|
label: isLocalhost(host) ? LOCAL_LABEL : NETWORK_LABEL,
|
|
@@ -79,52 +68,30 @@ const getAddressUrls = (protocol = "http", port, host) => {
|
|
|
79
68
|
}, []);
|
|
80
69
|
};
|
|
81
70
|
const prettyInstructions = (appContext, config) => {
|
|
82
|
-
var
|
|
71
|
+
var _config_dev;
|
|
83
72
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
|
84
|
-
const urls = getAddressUrls(
|
|
85
|
-
config.dev.https && (0, import_is.isDev)() ? "https" : "http",
|
|
86
|
-
port,
|
|
87
|
-
(_a = config.dev) == null ? void 0 : _a.host
|
|
88
|
-
);
|
|
73
|
+
const urls = getAddressUrls(config.dev.https && (0, _is.isDev)() ? "https" : "http", port, (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.host);
|
|
89
74
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
|
90
75
|
let message = "App running at:\n\n";
|
|
91
|
-
if ((0,
|
|
92
|
-
message += urls.map(
|
|
93
|
-
|
|
94
|
-
normalizeUrl(`${url}/${routes[0].urlPath}`)
|
|
95
|
-
)}
|
|
96
|
-
`
|
|
97
|
-
).join("");
|
|
76
|
+
if ((0, _is.isSingleEntry)(entrypoints) || apiOnly) {
|
|
77
|
+
message += urls.map(({ label, url }) => ` ${_compiled.chalk.bold(`> ${label.padEnd(10)}`)}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${routes[0].urlPath}`))}
|
|
78
|
+
`).join("");
|
|
98
79
|
} else {
|
|
99
80
|
const maxNameLength = Math.max(...routes.map((r) => r.entryName.length));
|
|
100
81
|
urls.forEach(({ label, url }) => {
|
|
101
|
-
message += ` ${
|
|
82
|
+
message += ` ${_compiled.chalk.bold(`> ${label}`)}
|
|
102
83
|
`;
|
|
103
84
|
routes.forEach(({ entryName, urlPath, isSSR }) => {
|
|
104
85
|
if (!checkedEntries.includes(entryName)) {
|
|
105
86
|
return;
|
|
106
87
|
}
|
|
107
|
-
message += ` ${
|
|
108
|
-
isSSR ? "λ" : "○"
|
|
109
|
-
)} ${import_compiled.chalk.yellowBright(
|
|
110
|
-
entryName.padEnd(maxNameLength + 8)
|
|
111
|
-
)}${import_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
|
|
88
|
+
message += ` ${_compiled.chalk.yellowBright(isSSR ? "λ" : "○")} ${_compiled.chalk.yellowBright(entryName.padEnd(maxNameLength + 8))}${_compiled.chalk.cyanBright(normalizeUrl(`${url}/${urlPath}`))}
|
|
112
89
|
`;
|
|
113
90
|
});
|
|
114
91
|
});
|
|
115
92
|
message += "\n";
|
|
116
|
-
message +=
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
message += import_compiled.chalk.cyanBright(
|
|
120
|
-
" ○ (Static) client-side renders as static HTML\n"
|
|
121
|
-
);
|
|
93
|
+
message += _compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
|
|
94
|
+
message += _compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
|
|
122
95
|
}
|
|
123
96
|
return message;
|
|
124
97
|
};
|
|
125
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
126
|
-
0 && (module.exports = {
|
|
127
|
-
getAddressUrls,
|
|
128
|
-
getIpv4Interfaces,
|
|
129
|
-
prettyInstructions
|
|
130
|
-
});
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "printBuildError", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => printBuildError
|
|
21
8
|
});
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var import_logger = require("./logger");
|
|
9
|
+
const _compiled = require("./compiled");
|
|
10
|
+
const _logger = require("./logger");
|
|
25
11
|
function printBuildError(err) {
|
|
26
12
|
const message = err != null && err.message;
|
|
27
13
|
const stack = err != null && err.stack;
|
|
@@ -34,24 +20,16 @@ function printBuildError(err) {
|
|
|
34
20
|
const problemPath = matched[2];
|
|
35
21
|
const line = matched[3];
|
|
36
22
|
const column = matched[4];
|
|
37
|
-
|
|
38
|
-
`Failed to minify the code from this file:
|
|
23
|
+
_logger.logger.error(`Failed to minify the code from this file:
|
|
39
24
|
|
|
40
|
-
${
|
|
41
|
-
|
|
42
|
-
)}
|
|
43
|
-
`
|
|
44
|
-
);
|
|
25
|
+
${_compiled.chalk.yellow(` ${problemPath}:${line}${column !== "0" ? ":" + column : ""}`)}
|
|
26
|
+
`);
|
|
45
27
|
} catch (ignored) {
|
|
46
|
-
|
|
28
|
+
_logger.logger.error(`Failed to minify the bundle. ${err}
|
|
47
29
|
`);
|
|
48
30
|
}
|
|
49
31
|
} else {
|
|
50
|
-
|
|
32
|
+
_logger.logger.error((message || err) + "\n");
|
|
51
33
|
}
|
|
52
|
-
|
|
34
|
+
_logger.logger.log();
|
|
53
35
|
}
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
printBuildError
|
|
57
|
-
});
|
package/dist/cjs/react.js
CHANGED
|
@@ -1,43 +1,24 @@
|
|
|
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 react_exports = {};
|
|
29
|
-
__export(react_exports, {
|
|
30
|
-
isBeyondReact17: () => isBeyondReact17
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
31
4
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
Object.defineProperty(exports, "isBeyondReact17", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => isBeyondReact17
|
|
8
|
+
});
|
|
9
|
+
const _path = /* @__PURE__ */ _interop_require_default(require("path"));
|
|
10
|
+
const _ = require(".");
|
|
11
|
+
function _interop_require_default(obj) {
|
|
12
|
+
return obj && obj.__esModule ? obj : {
|
|
13
|
+
default: obj
|
|
14
|
+
};
|
|
15
|
+
}
|
|
35
16
|
const isBeyondReact17 = (cwd) => {
|
|
36
|
-
const pkgPath =
|
|
37
|
-
if (!
|
|
17
|
+
const pkgPath = _path.default.join(cwd, "package.json");
|
|
18
|
+
if (!_.fs.existsSync(pkgPath)) {
|
|
38
19
|
return false;
|
|
39
20
|
}
|
|
40
|
-
const pkgInfo = JSON.parse(
|
|
21
|
+
const pkgInfo = JSON.parse(_.fs.readFileSync(pkgPath, "utf8"));
|
|
41
22
|
const deps = {
|
|
42
23
|
...pkgInfo.devDependencies,
|
|
43
24
|
...pkgInfo.dependencies
|
|
@@ -45,9 +26,5 @@ const isBeyondReact17 = (cwd) => {
|
|
|
45
26
|
if (typeof deps.react !== "string") {
|
|
46
27
|
return false;
|
|
47
28
|
}
|
|
48
|
-
return
|
|
29
|
+
return _.semver.satisfies(_.semver.minVersion(deps.react), ">=17.0.0");
|
|
49
30
|
};
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
isBeyondReact17
|
|
53
|
-
});
|
package/dist/cjs/readTsConfig.js
CHANGED
|
@@ -1,47 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 readTsConfig_exports = {};
|
|
29
|
-
__export(readTsConfig_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
30
13
|
readTsConfig: () => readTsConfig,
|
|
31
14
|
readTsConfigByFile: () => readTsConfigByFile
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
const _path = /* @__PURE__ */ _interop_require_default(require("path"));
|
|
17
|
+
const _compiled = require("./compiled");
|
|
18
|
+
function _interop_require_default(obj) {
|
|
19
|
+
return obj && obj.__esModule ? obj : {
|
|
20
|
+
default: obj
|
|
21
|
+
};
|
|
22
|
+
}
|
|
36
23
|
const readTsConfig = (root) => {
|
|
37
|
-
return readTsConfigByFile(
|
|
24
|
+
return readTsConfigByFile(_path.default.resolve(root, "./tsconfig.json"));
|
|
38
25
|
};
|
|
39
26
|
const readTsConfigByFile = (filename) => {
|
|
40
|
-
const content =
|
|
41
|
-
return
|
|
27
|
+
const content = _compiled.fs.readFileSync(_path.default.resolve(filename), "utf-8");
|
|
28
|
+
return _compiled.json5.parse(content);
|
|
42
29
|
};
|
|
43
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
-
0 && (module.exports = {
|
|
45
|
-
readTsConfig,
|
|
46
|
-
readTsConfigByFile
|
|
47
|
-
});
|
package/dist/cjs/removeSlash.js
CHANGED
|
@@ -1,33 +1,19 @@
|
|
|
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 removeSlash_exports = {};
|
|
19
|
-
__export(removeSlash_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
20
13
|
removeLeadingSlash: () => removeLeadingSlash,
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
removeTailSlash: () => removeTailSlash,
|
|
15
|
+
removeSlash: () => removeSlash
|
|
23
16
|
});
|
|
24
|
-
module.exports = __toCommonJS(removeSlash_exports);
|
|
25
17
|
const removeLeadingSlash = (s) => s.replace(/^\/+/, "");
|
|
26
18
|
const removeTailSlash = (s) => s.replace(/\/+$/, "");
|
|
27
19
|
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/cjs/resolve.js
CHANGED
|
@@ -1,32 +1,28 @@
|
|
|
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 resolve_exports = {};
|
|
19
|
-
__export(resolve_exports, {
|
|
20
|
-
getAntdMajorVersion: () => getAntdMajorVersion,
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
13
|
+
tryResolve: () => tryResolve,
|
|
21
14
|
isPackageInstalled: () => isPackageInstalled,
|
|
22
|
-
|
|
15
|
+
getAntdMajorVersion: () => getAntdMajorVersion
|
|
23
16
|
});
|
|
24
|
-
|
|
25
|
-
var import_ensureArray = require("./ensureArray");
|
|
17
|
+
const _ensureArray = require("./ensureArray");
|
|
26
18
|
const tryResolve = (name, resolvePath) => {
|
|
27
19
|
let filePath = "";
|
|
28
20
|
try {
|
|
29
|
-
filePath = require.resolve(name, {
|
|
21
|
+
filePath = require.resolve(name, {
|
|
22
|
+
paths: [
|
|
23
|
+
resolvePath
|
|
24
|
+
]
|
|
25
|
+
});
|
|
30
26
|
delete require.cache[filePath];
|
|
31
27
|
} catch (err) {
|
|
32
28
|
if (err.code === "MODULE_NOT_FOUND") {
|
|
@@ -38,7 +34,9 @@ const tryResolve = (name, resolvePath) => {
|
|
|
38
34
|
};
|
|
39
35
|
const isPackageInstalled = (name, resolvePaths) => {
|
|
40
36
|
try {
|
|
41
|
-
require.resolve(name, {
|
|
37
|
+
require.resolve(name, {
|
|
38
|
+
paths: (0, _ensureArray.ensureArray)(resolvePaths)
|
|
39
|
+
});
|
|
42
40
|
return true;
|
|
43
41
|
} catch (err) {
|
|
44
42
|
return false;
|
|
@@ -47,7 +45,9 @@ const isPackageInstalled = (name, resolvePaths) => {
|
|
|
47
45
|
const getAntdMajorVersion = (appDirectory) => {
|
|
48
46
|
try {
|
|
49
47
|
const pkgJsonPath = require.resolve("antd/package.json", {
|
|
50
|
-
paths: [
|
|
48
|
+
paths: [
|
|
49
|
+
appDirectory
|
|
50
|
+
]
|
|
51
51
|
});
|
|
52
52
|
const { version } = require(pkgJsonPath);
|
|
53
53
|
return Number(version.split(".")[0]);
|
|
@@ -55,9 +55,3 @@ const getAntdMajorVersion = (appDirectory) => {
|
|
|
55
55
|
return null;
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
-
0 && (module.exports = {
|
|
60
|
-
getAntdMajorVersion,
|
|
61
|
-
isPackageInstalled,
|
|
62
|
-
tryResolve
|
|
63
|
-
});
|
package/dist/cjs/routes.js
CHANGED
|
@@ -1,58 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
8
6
|
for (var name in all)
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 routes_exports = {};
|
|
29
|
-
__export(routes_exports, {
|
|
7
|
+
Object.defineProperty(target, name, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: all[name]
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
_export(exports, {
|
|
30
13
|
getPathWithoutExt: () => getPathWithoutExt,
|
|
31
14
|
getRouteId: () => getRouteId
|
|
32
15
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
16
|
+
const _path = /* @__PURE__ */ _interop_require_default(require("path"));
|
|
17
|
+
const _path1 = require("./path");
|
|
18
|
+
const _constants = require("./constants");
|
|
19
|
+
function _interop_require_default(obj) {
|
|
20
|
+
return obj && obj.__esModule ? obj : {
|
|
21
|
+
default: obj
|
|
22
|
+
};
|
|
23
|
+
}
|
|
37
24
|
const getPathWithoutExt = (filename) => {
|
|
38
|
-
const extname =
|
|
25
|
+
const extname = _path.default.extname(filename);
|
|
39
26
|
return filename.slice(0, -extname.length);
|
|
40
27
|
};
|
|
41
28
|
const getRouteId = (componentPath, routesDir, entryName) => {
|
|
42
|
-
const relativePath = (0,
|
|
43
|
-
import_path.default.relative(routesDir, componentPath)
|
|
44
|
-
);
|
|
29
|
+
const relativePath = (0, _path1.normalizeToPosixPath)(_path.default.relative(routesDir, componentPath));
|
|
45
30
|
const pathWithoutExt = getPathWithoutExt(relativePath);
|
|
46
31
|
let id = ``;
|
|
47
|
-
if (entryName ===
|
|
32
|
+
if (entryName === _constants.MAIN_ENTRY_NAME) {
|
|
48
33
|
id = pathWithoutExt;
|
|
49
34
|
} else {
|
|
50
35
|
id = `${entryName}_${pathWithoutExt}`;
|
|
51
36
|
}
|
|
52
|
-
return id;
|
|
37
|
+
return id.replace(/\[(.*?)\]/g, "($1)");
|
|
53
38
|
};
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
getPathWithoutExt,
|
|
57
|
-
getRouteId
|
|
58
|
-
});
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
_export_star(require("./parsed"), exports);
|
|
6
|
+
function _export_star(from, to) {
|
|
7
|
+
Object.keys(from).forEach(function(k) {
|
|
8
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
9
|
+
Object.defineProperty(to, k, {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function() {
|
|
12
|
+
return from[k];
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return from;
|
|
18
|
+
}
|
|
@@ -1,30 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 parsed_exports = {};
|
|
19
|
-
__export(parsed_exports, {
|
|
20
|
-
parsedJSONFromElement: () => parsedJSONFromElement
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "parsedJSONFromElement", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: () => parsedJSONFromElement
|
|
21
8
|
});
|
|
22
|
-
module.exports = __toCommonJS(parsed_exports);
|
|
23
9
|
const parsedJSONFromElement = (id) => {
|
|
24
10
|
const element = document.getElementById(id);
|
|
25
11
|
if (element) {
|
|
26
12
|
try {
|
|
27
|
-
const parsed = JSON.parse(element.textContent || "");
|
|
13
|
+
const parsed = JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || "");
|
|
28
14
|
return parsed;
|
|
29
15
|
} catch (e) {
|
|
30
16
|
console.error(`parse ${id} error`, e);
|
|
@@ -33,7 +19,3 @@ const parsedJSONFromElement = (id) => {
|
|
|
33
19
|
}
|
|
34
20
|
return void 0;
|
|
35
21
|
};
|
|
36
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
-
0 && (module.exports = {
|
|
38
|
-
parsedJSONFromElement
|
|
39
|
-
});
|