@modern-js/utils 2.66.0 → 2.67.1
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/dist/cjs/cli/constants.js +1 -0
- package/dist/cjs/cli/is/config.js +0 -6
- package/dist/cjs/cli/prettyInstructions.js +4 -4
- package/dist/cjs/cli/version.js +7 -0
- package/dist/esm/cli/constants.js +1 -0
- package/dist/esm/cli/is/config.js +0 -5
- package/dist/esm/cli/prettyInstructions.js +4 -4
- package/dist/esm/cli/version.js +6 -0
- package/dist/esm-node/cli/constants.js +1 -0
- package/dist/esm-node/cli/is/config.js +0 -5
- package/dist/esm-node/cli/prettyInstructions.js +4 -4
- package/dist/esm-node/cli/version.js +6 -0
- package/dist/types/cli/is/config.d.ts +0 -7
- package/dist/types/cli/version.d.ts +1 -0
- package/package.json +2 -2
@@ -115,6 +115,7 @@ const INTERNAL_CLI_PLUGINS = {
|
|
115
115
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
116
116
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
117
117
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
118
|
+
"@modern-js/plugin-state": "@modern-js/plugin-state/cli",
|
118
119
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
119
120
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
120
121
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
@@ -18,7 +18,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
19
|
var config_exports = {};
|
20
20
|
__export(config_exports, {
|
21
|
-
isRouterV5: () => isRouterV5,
|
22
21
|
isSSGEntry: () => isSSGEntry,
|
23
22
|
isSSR: () => isSSR,
|
24
23
|
isServiceWorker: () => isServiceWorker,
|
@@ -62,10 +61,6 @@ const isServiceWorker = (config) => {
|
|
62
61
|
}
|
63
62
|
return false;
|
64
63
|
};
|
65
|
-
const isRouterV5 = (config) => {
|
66
|
-
var _config_runtime, _config_runtime_router, _config_runtime1;
|
67
|
-
return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && (config === null || config === void 0 ? void 0 : (_config_runtime1 = config.runtime) === null || _config_runtime1 === void 0 ? void 0 : (_config_runtime_router = _config_runtime1.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.mode) === "react-router-5";
|
68
|
-
};
|
69
64
|
const isSSGEntry = (config, entryName, entrypoints) => {
|
70
65
|
var _config_source;
|
71
66
|
const ssgConfig = config.output.ssg;
|
@@ -75,7 +70,6 @@ const isSSGEntry = (config, entryName, entrypoints) => {
|
|
75
70
|
const isSingleEntry = (entrypoints, mainEntryName = import_constants.MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
76
71
|
// Annotate the CommonJS export names for ESM import in node:
|
77
72
|
0 && (module.exports = {
|
78
|
-
isRouterV5,
|
79
73
|
isSSGEntry,
|
80
74
|
isSSR,
|
81
75
|
isServiceWorker,
|
@@ -86,10 +86,10 @@ const getAddressUrls = (protocol = "http", port, host) => {
|
|
86
86
|
}, []);
|
87
87
|
};
|
88
88
|
const prettyInstructions = (appContext, config) => {
|
89
|
-
var
|
89
|
+
var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
|
90
90
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
91
|
-
const isHttps = (0, import_is.isDev)() && ((
|
92
|
-
const urls = getAddressUrls(isHttps ? "https" : "http", port, (
|
91
|
+
const isHttps = (0, import_is.isDev)() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
|
92
|
+
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
|
93
93
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
94
94
|
let message = "\n";
|
95
95
|
if ((0, import_is.isSingleEntry)(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
@@ -112,7 +112,7 @@ const prettyInstructions = (appContext, config) => {
|
|
112
112
|
message += import_compiled.chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
|
113
113
|
message += import_compiled.chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
|
114
114
|
}
|
115
|
-
if ((
|
115
|
+
if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
|
116
116
|
message += ` ${import_compiled.chalk.dim("> press")} ${import_compiled.chalk.bold("h + enter")} ${import_compiled.chalk.dim("to show shortcuts")}
|
117
117
|
`;
|
118
118
|
}
|
package/dist/cjs/cli/version.js
CHANGED
@@ -20,6 +20,7 @@ var version_exports = {};
|
|
20
20
|
__export(version_exports, {
|
21
21
|
isVersionAtLeast18: () => isVersionAtLeast18,
|
22
22
|
isVersionAtLeast1819: () => isVersionAtLeast1819,
|
23
|
+
isVersionAtLeast20: () => isVersionAtLeast20,
|
23
24
|
isVersionAtLeast22: () => isVersionAtLeast22
|
24
25
|
});
|
25
26
|
module.exports = __toCommonJS(version_exports);
|
@@ -38,9 +39,15 @@ function isVersionAtLeast22() {
|
|
38
39
|
const versionArr = nodeVersion.split(".").map(Number);
|
39
40
|
return versionArr[0] >= 22;
|
40
41
|
}
|
42
|
+
function isVersionAtLeast20() {
|
43
|
+
const nodeVersion = process.versions.node;
|
44
|
+
const versionArr = nodeVersion.split(".").map(Number);
|
45
|
+
return versionArr[0] >= 20;
|
46
|
+
}
|
41
47
|
// Annotate the CommonJS export names for ESM import in node:
|
42
48
|
0 && (module.exports = {
|
43
49
|
isVersionAtLeast18,
|
44
50
|
isVersionAtLeast1819,
|
51
|
+
isVersionAtLeast20,
|
45
52
|
isVersionAtLeast22
|
46
53
|
});
|
@@ -62,6 +62,7 @@ var INTERNAL_CLI_PLUGINS = {
|
|
62
62
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
63
63
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
64
64
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
65
|
+
"@modern-js/plugin-state": "@modern-js/plugin-state/cli",
|
65
66
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
66
67
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
67
68
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
@@ -50,10 +50,6 @@ var isServiceWorker = function(config) {
|
|
50
50
|
}
|
51
51
|
return false;
|
52
52
|
};
|
53
|
-
var isRouterV5 = function(config) {
|
54
|
-
var _config_runtime, _config_runtime_router, _config_runtime1;
|
55
|
-
return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && (config === null || config === void 0 ? void 0 : (_config_runtime1 = config.runtime) === null || _config_runtime1 === void 0 ? void 0 : (_config_runtime_router = _config_runtime1.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.mode) === "react-router-5";
|
56
|
-
};
|
57
53
|
var isSSGEntry = function(config, entryName, entrypoints) {
|
58
54
|
var _config_source;
|
59
55
|
var ssgConfig = config.output.ssg;
|
@@ -65,7 +61,6 @@ var isSingleEntry = function(entrypoints) {
|
|
65
61
|
return entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
66
62
|
};
|
67
63
|
export {
|
68
|
-
isRouterV5,
|
69
64
|
isSSGEntry,
|
70
65
|
isSSR,
|
71
66
|
isServiceWorker,
|
@@ -58,10 +58,10 @@ var getAddressUrls = function() {
|
|
58
58
|
}, []);
|
59
59
|
};
|
60
60
|
var prettyInstructions = function(appContext, config) {
|
61
|
-
var
|
61
|
+
var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
|
62
62
|
var entrypoints = appContext.entrypoints, serverRoutes = appContext.serverRoutes, port = appContext.port, apiOnly = appContext.apiOnly, checkedEntries = appContext.checkedEntries;
|
63
|
-
var isHttps = isDev() && ((
|
64
|
-
var urls = getAddressUrls(isHttps ? "https" : "http", port, (
|
63
|
+
var isHttps = isDev() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
|
64
|
+
var urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
|
65
65
|
var routes = !apiOnly ? serverRoutes.filter(function(route) {
|
66
66
|
return route.entryName;
|
67
67
|
}) : serverRoutes;
|
@@ -91,7 +91,7 @@ var prettyInstructions = function(appContext, config) {
|
|
91
91
|
message += chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
|
92
92
|
message += chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
|
93
93
|
}
|
94
|
-
if ((
|
94
|
+
if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
|
95
95
|
message += " ".concat(chalk.dim("> press"), " ").concat(chalk.bold("h + enter"), " ").concat(chalk.dim("to show shortcuts"), "\n");
|
96
96
|
}
|
97
97
|
return message;
|
package/dist/esm/cli/version.js
CHANGED
@@ -13,8 +13,14 @@ function isVersionAtLeast22() {
|
|
13
13
|
var versionArr = nodeVersion.split(".").map(Number);
|
14
14
|
return versionArr[0] >= 22;
|
15
15
|
}
|
16
|
+
function isVersionAtLeast20() {
|
17
|
+
var nodeVersion = process.versions.node;
|
18
|
+
var versionArr = nodeVersion.split(".").map(Number);
|
19
|
+
return versionArr[0] >= 20;
|
20
|
+
}
|
16
21
|
export {
|
17
22
|
isVersionAtLeast18,
|
18
23
|
isVersionAtLeast1819,
|
24
|
+
isVersionAtLeast20,
|
19
25
|
isVersionAtLeast22
|
20
26
|
};
|
@@ -62,6 +62,7 @@ const INTERNAL_CLI_PLUGINS = {
|
|
62
62
|
"@modern-js/module-tools": "@modern-js/module-tools",
|
63
63
|
"@modern-js/doc-tools": "@modern-js/doc-tools",
|
64
64
|
"@modern-js/runtime": "@modern-js/runtime/cli",
|
65
|
+
"@modern-js/plugin-state": "@modern-js/plugin-state/cli",
|
65
66
|
"@modern-js/plugin-proxy": "@modern-js/plugin-proxy/cli",
|
66
67
|
"@modern-js/plugin-ssg": "@modern-js/plugin-ssg/cli",
|
67
68
|
"@modern-js/plugin-bff": "@modern-js/plugin-bff/cli",
|
@@ -33,10 +33,6 @@ const isServiceWorker = (config) => {
|
|
33
33
|
}
|
34
34
|
return false;
|
35
35
|
};
|
36
|
-
const isRouterV5 = (config) => {
|
37
|
-
var _config_runtime, _config_runtime_router, _config_runtime1;
|
38
|
-
return typeof ((_config_runtime = config.runtime) === null || _config_runtime === void 0 ? void 0 : _config_runtime.router) !== "boolean" && (config === null || config === void 0 ? void 0 : (_config_runtime1 = config.runtime) === null || _config_runtime1 === void 0 ? void 0 : (_config_runtime_router = _config_runtime1.router) === null || _config_runtime_router === void 0 ? void 0 : _config_runtime_router.mode) === "react-router-5";
|
39
|
-
};
|
40
36
|
const isSSGEntry = (config, entryName, entrypoints) => {
|
41
37
|
var _config_source;
|
42
38
|
const ssgConfig = config.output.ssg;
|
@@ -45,7 +41,6 @@ const isSSGEntry = (config, entryName, entrypoints) => {
|
|
45
41
|
};
|
46
42
|
const isSingleEntry = (entrypoints, mainEntryName = MAIN_ENTRY_NAME) => entrypoints.length === 1 && entrypoints[0].entryName === mainEntryName;
|
47
43
|
export {
|
48
|
-
isRouterV5,
|
49
44
|
isSSGEntry,
|
50
45
|
isSSR,
|
51
46
|
isServiceWorker,
|
@@ -52,10 +52,10 @@ const getAddressUrls = (protocol = "http", port, host) => {
|
|
52
52
|
}, []);
|
53
53
|
};
|
54
54
|
const prettyInstructions = (appContext, config) => {
|
55
|
-
var
|
55
|
+
var _config_dev, _config_tools_devServer, _config_tools, _config_dev1, _config_source, _config_dev2;
|
56
56
|
const { entrypoints, serverRoutes, port, apiOnly, checkedEntries } = appContext;
|
57
|
-
const isHttps = isDev() && ((
|
58
|
-
const urls = getAddressUrls(isHttps ? "https" : "http", port, (
|
57
|
+
const isHttps = isDev() && ((config === null || config === void 0 ? void 0 : (_config_dev = config.dev) === null || _config_dev === void 0 ? void 0 : _config_dev.https) || (config === null || config === void 0 ? void 0 : (_config_tools = config.tools) === null || _config_tools === void 0 ? void 0 : (_config_tools_devServer = _config_tools.devServer) === null || _config_tools_devServer === void 0 ? void 0 : _config_tools_devServer.https));
|
58
|
+
const urls = getAddressUrls(isHttps ? "https" : "http", port, (_config_dev1 = config.dev) === null || _config_dev1 === void 0 ? void 0 : _config_dev1.host);
|
59
59
|
const routes = !apiOnly ? serverRoutes.filter((route) => route.entryName) : serverRoutes;
|
60
60
|
let message = "\n";
|
61
61
|
if (isSingleEntry(entrypoints, (_config_source = config.source) === null || _config_source === void 0 ? void 0 : _config_source.mainEntryName) || apiOnly) {
|
@@ -78,7 +78,7 @@ const prettyInstructions = (appContext, config) => {
|
|
78
78
|
message += chalk.cyanBright(" λ (Server) server-side renders at runtime\n");
|
79
79
|
message += chalk.cyanBright(" ○ (Static) client-side renders as static HTML\n");
|
80
80
|
}
|
81
|
-
if ((
|
81
|
+
if ((_config_dev2 = config.dev) === null || _config_dev2 === void 0 ? void 0 : _config_dev2.cliShortcuts) {
|
82
82
|
message += ` ${chalk.dim("> press")} ${chalk.bold("h + enter")} ${chalk.dim("to show shortcuts")}
|
83
83
|
`;
|
84
84
|
}
|
@@ -13,8 +13,14 @@ function isVersionAtLeast22() {
|
|
13
13
|
const versionArr = nodeVersion.split(".").map(Number);
|
14
14
|
return versionArr[0] >= 22;
|
15
15
|
}
|
16
|
+
function isVersionAtLeast20() {
|
17
|
+
const nodeVersion = process.versions.node;
|
18
|
+
const versionArr = nodeVersion.split(".").map(Number);
|
19
|
+
return versionArr[0] >= 20;
|
20
|
+
}
|
16
21
|
export {
|
17
22
|
isVersionAtLeast18,
|
18
23
|
isVersionAtLeast1819,
|
24
|
+
isVersionAtLeast20,
|
19
25
|
isVersionAtLeast22
|
20
26
|
};
|
@@ -17,13 +17,6 @@ export declare const isUseRsc: (config: any) => boolean;
|
|
17
17
|
* @returns Whether to use worker deploy.
|
18
18
|
*/
|
19
19
|
export declare const isServiceWorker: (config: any) => boolean;
|
20
|
-
export declare const isRouterV5: (config: {
|
21
|
-
runtime?: {
|
22
|
-
router?: {
|
23
|
-
mode?: string;
|
24
|
-
} | boolean;
|
25
|
-
};
|
26
|
-
}) => boolean;
|
27
20
|
export declare const isSSGEntry: (config: any, entryName: string, entrypoints: EntryPoint[]) => boolean;
|
28
21
|
export declare const isSingleEntry: (entrypoints: EntryPoint[], mainEntryName?: string) => boolean;
|
29
22
|
export {};
|
package/package.json
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
"modern",
|
16
16
|
"modern.js"
|
17
17
|
],
|
18
|
-
"version": "2.
|
18
|
+
"version": "2.67.1",
|
19
19
|
"jsnext:source": "./src/index.ts",
|
20
20
|
"types": "./dist/types/index.d.ts",
|
21
21
|
"main": "./dist/cjs/index.js",
|
@@ -190,7 +190,7 @@
|
|
190
190
|
"jest": "^29",
|
191
191
|
"typescript": "^5",
|
192
192
|
"webpack": "^5.98.0",
|
193
|
-
"@modern-js/types": "2.
|
193
|
+
"@modern-js/types": "2.67.1",
|
194
194
|
"@scripts/build": "2.66.0",
|
195
195
|
"@scripts/jest-config": "2.66.0"
|
196
196
|
},
|