@rspack-canary/cli 1.6.5-canary-1b7f543c-20251121112112 → 1.6.5-canary-5c09e49d-20251121173820
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/constants.d.ts +1 -0
- package/dist/index.js +19 -20
- package/dist/index.mjs +27 -28
- package/package.json +3 -3
package/dist/constants.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -914,20 +914,20 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
914
914
|
return internalPreviewConfig(item);
|
|
915
915
|
}
|
|
916
916
|
function normalizeHotOption(value) {
|
|
917
|
-
if ("boolean" == typeof value || "only" === value) return value;
|
|
918
917
|
if ("false" === value) return false;
|
|
919
|
-
return true;
|
|
918
|
+
if ("true" === value) return true;
|
|
919
|
+
return value;
|
|
920
920
|
}
|
|
921
921
|
class ServeCommand {
|
|
922
922
|
async apply(cli) {
|
|
923
923
|
const command = cli.program.command("serve", "run the rspack dev server.").alias("server").alias("s").alias("dev");
|
|
924
924
|
commonOptionsForBuildAndServe(commonOptions(command)).option("--hot [mode]", "enables hot module replacement").option("--port <port>", "allows to specify a port to use").option("--host <host>", "allows to specify a hostname to use");
|
|
925
|
-
command.action(async (
|
|
926
|
-
setDefaultNodeEnv(
|
|
927
|
-
normalizeCommonOptions(
|
|
928
|
-
|
|
925
|
+
command.action(async (cliOptions)=>{
|
|
926
|
+
setDefaultNodeEnv(cliOptions, "development");
|
|
927
|
+
normalizeCommonOptions(cliOptions, "serve");
|
|
928
|
+
cliOptions.hot = normalizeHotOption(cliOptions.hot);
|
|
929
929
|
const { RspackDevServer } = await import("@rspack/dev-server");
|
|
930
|
-
const compiler = await cli.createCompiler(
|
|
930
|
+
const compiler = await cli.createCompiler(cliOptions, "serve");
|
|
931
931
|
if (!compiler) return;
|
|
932
932
|
const compilers = cli.isMultipleCompiler(compiler) ? compiler.compilers : [
|
|
933
933
|
compiler
|
|
@@ -938,7 +938,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
938
938
|
const compilerForDevServer = possibleCompilers.length > 0 ? possibleCompilers[0] : compilers[0];
|
|
939
939
|
for (const compiler of compilers){
|
|
940
940
|
const devServer = compiler.options.devServer ??= {};
|
|
941
|
-
devServer.hot =
|
|
941
|
+
devServer.hot = cliOptions.hot ?? devServer.hot ?? true;
|
|
942
942
|
if (false !== devServer.client) {
|
|
943
943
|
if (true === devServer.client || null == devServer.client) devServer.client = {};
|
|
944
944
|
devServer.client = {
|
|
@@ -950,10 +950,10 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
950
950
|
};
|
|
951
951
|
}
|
|
952
952
|
}
|
|
953
|
-
const
|
|
954
|
-
const { setupMiddlewares } =
|
|
953
|
+
const devServerOptions = compilerForDevServer.options.devServer ??= {};
|
|
954
|
+
const { setupMiddlewares } = devServerOptions;
|
|
955
955
|
const lazyCompileMiddleware = rspackCore.Z.experiments.lazyCompilationMiddleware(compiler);
|
|
956
|
-
|
|
956
|
+
devServerOptions.setupMiddlewares = (middlewares, server)=>{
|
|
957
957
|
let finalMiddlewares = middlewares;
|
|
958
958
|
if (setupMiddlewares) finalMiddlewares = setupMiddlewares(finalMiddlewares, server);
|
|
959
959
|
return [
|
|
@@ -961,20 +961,19 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
961
961
|
lazyCompileMiddleware
|
|
962
962
|
];
|
|
963
963
|
};
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
if (false !==
|
|
968
|
-
if (true ===
|
|
969
|
-
|
|
964
|
+
devServerOptions.hot = cliOptions.hot ?? devServerOptions.hot ?? true;
|
|
965
|
+
devServerOptions.host = cliOptions.host || devServerOptions.host;
|
|
966
|
+
devServerOptions.port = cliOptions.port ?? devServerOptions.port;
|
|
967
|
+
if (false !== devServerOptions.client) {
|
|
968
|
+
if (true === devServerOptions.client || null == devServerOptions.client) devServerOptions.client = {};
|
|
969
|
+
devServerOptions.client = {
|
|
970
970
|
overlay: {
|
|
971
971
|
errors: true,
|
|
972
972
|
warnings: false
|
|
973
973
|
},
|
|
974
|
-
...
|
|
974
|
+
...devServerOptions.client
|
|
975
975
|
};
|
|
976
976
|
}
|
|
977
|
-
const devServerOptions = result;
|
|
978
977
|
if (devServerOptions.port) {
|
|
979
978
|
const portNumber = Number(devServerOptions.port);
|
|
980
979
|
if (!Number.isNaN(portNumber)) {
|
|
@@ -1188,7 +1187,7 @@ ${section.body}` : section.body).join("\n\n"));
|
|
|
1188
1187
|
this.colors = this.createColors();
|
|
1189
1188
|
this.program = program;
|
|
1190
1189
|
program.help();
|
|
1191
|
-
program.version("1.6.5-canary-
|
|
1190
|
+
program.version("1.6.5-canary-5c09e49d-20251121173820");
|
|
1192
1191
|
}
|
|
1193
1192
|
async createCompiler(options, rspackCommand, callback) {
|
|
1194
1193
|
let { config, pathMap } = await this.loadConfig(options);
|
package/dist/index.mjs
CHANGED
|
@@ -901,21 +901,29 @@ async function getPreviewConfig(item, options, dir) {
|
|
|
901
901
|
if (Array.isArray(item)) return Promise.all(item.map(internalPreviewConfig));
|
|
902
902
|
return internalPreviewConfig(item);
|
|
903
903
|
}
|
|
904
|
+
const DEFAULT_EXTENSIONS = [
|
|
905
|
+
".js",
|
|
906
|
+
".ts",
|
|
907
|
+
".mjs",
|
|
908
|
+
".mts",
|
|
909
|
+
".cjs",
|
|
910
|
+
".cts"
|
|
911
|
+
];
|
|
904
912
|
function normalizeHotOption(value) {
|
|
905
|
-
if ("boolean" == typeof value || "only" === value) return value;
|
|
906
913
|
if ("false" === value) return false;
|
|
907
|
-
return true;
|
|
914
|
+
if ("true" === value) return true;
|
|
915
|
+
return value;
|
|
908
916
|
}
|
|
909
917
|
class ServeCommand {
|
|
910
918
|
async apply(cli) {
|
|
911
919
|
const command = cli.program.command("serve", "run the rspack dev server.").alias("server").alias("s").alias("dev");
|
|
912
920
|
commonOptionsForBuildAndServe(commonOptions(command)).option("--hot [mode]", "enables hot module replacement").option("--port <port>", "allows to specify a port to use").option("--host <host>", "allows to specify a hostname to use");
|
|
913
|
-
command.action(async (
|
|
914
|
-
setDefaultNodeEnv(
|
|
915
|
-
normalizeCommonOptions(
|
|
916
|
-
|
|
921
|
+
command.action(async (cliOptions)=>{
|
|
922
|
+
setDefaultNodeEnv(cliOptions, "development");
|
|
923
|
+
normalizeCommonOptions(cliOptions, "serve");
|
|
924
|
+
cliOptions.hot = normalizeHotOption(cliOptions.hot);
|
|
917
925
|
const { RspackDevServer } = await import("@rspack/dev-server");
|
|
918
|
-
const compiler = await cli.createCompiler(
|
|
926
|
+
const compiler = await cli.createCompiler(cliOptions, "serve");
|
|
919
927
|
if (!compiler) return;
|
|
920
928
|
const compilers = cli.isMultipleCompiler(compiler) ? compiler.compilers : [
|
|
921
929
|
compiler
|
|
@@ -926,7 +934,7 @@ class ServeCommand {
|
|
|
926
934
|
const compilerForDevServer = possibleCompilers.length > 0 ? possibleCompilers[0] : compilers[0];
|
|
927
935
|
for (const compiler of compilers){
|
|
928
936
|
const devServer = compiler.options.devServer ??= {};
|
|
929
|
-
devServer.hot =
|
|
937
|
+
devServer.hot = cliOptions.hot ?? devServer.hot ?? true;
|
|
930
938
|
if (false !== devServer.client) {
|
|
931
939
|
if (true === devServer.client || null == devServer.client) devServer.client = {};
|
|
932
940
|
devServer.client = {
|
|
@@ -938,10 +946,10 @@ class ServeCommand {
|
|
|
938
946
|
};
|
|
939
947
|
}
|
|
940
948
|
}
|
|
941
|
-
const
|
|
942
|
-
const { setupMiddlewares } =
|
|
949
|
+
const devServerOptions = compilerForDevServer.options.devServer ??= {};
|
|
950
|
+
const { setupMiddlewares } = devServerOptions;
|
|
943
951
|
const lazyCompileMiddleware = rspackCore.Z.experiments.lazyCompilationMiddleware(compiler);
|
|
944
|
-
|
|
952
|
+
devServerOptions.setupMiddlewares = (middlewares, server)=>{
|
|
945
953
|
let finalMiddlewares = middlewares;
|
|
946
954
|
if (setupMiddlewares) finalMiddlewares = setupMiddlewares(finalMiddlewares, server);
|
|
947
955
|
return [
|
|
@@ -949,20 +957,19 @@ class ServeCommand {
|
|
|
949
957
|
lazyCompileMiddleware
|
|
950
958
|
];
|
|
951
959
|
};
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if (false !==
|
|
956
|
-
if (true ===
|
|
957
|
-
|
|
960
|
+
devServerOptions.hot = cliOptions.hot ?? devServerOptions.hot ?? true;
|
|
961
|
+
devServerOptions.host = cliOptions.host || devServerOptions.host;
|
|
962
|
+
devServerOptions.port = cliOptions.port ?? devServerOptions.port;
|
|
963
|
+
if (false !== devServerOptions.client) {
|
|
964
|
+
if (true === devServerOptions.client || null == devServerOptions.client) devServerOptions.client = {};
|
|
965
|
+
devServerOptions.client = {
|
|
958
966
|
overlay: {
|
|
959
967
|
errors: true,
|
|
960
968
|
warnings: false
|
|
961
969
|
},
|
|
962
|
-
...
|
|
970
|
+
...devServerOptions.client
|
|
963
971
|
};
|
|
964
972
|
}
|
|
965
|
-
const devServerOptions = result;
|
|
966
973
|
if (devServerOptions.port) {
|
|
967
974
|
const portNumber = Number(devServerOptions.port);
|
|
968
975
|
if (!Number.isNaN(portNumber)) {
|
|
@@ -1015,14 +1022,6 @@ const crossImport = async (path)=>{
|
|
|
1015
1022
|
if (result && "object" == typeof result && "default" in result) result = result.default || {};
|
|
1016
1023
|
return result;
|
|
1017
1024
|
};
|
|
1018
|
-
const DEFAULT_EXTENSIONS = [
|
|
1019
|
-
".js",
|
|
1020
|
-
".ts",
|
|
1021
|
-
".mjs",
|
|
1022
|
-
".mts",
|
|
1023
|
-
".cjs",
|
|
1024
|
-
".cts"
|
|
1025
|
-
];
|
|
1026
1025
|
const findConfig = (basePath)=>DEFAULT_EXTENSIONS.map((ext)=>basePath + ext).find(external_node_fs_["default"].existsSync);
|
|
1027
1026
|
const utils_findConfig = findConfig;
|
|
1028
1027
|
const TS_EXTENSION = [
|
|
@@ -1175,7 +1174,7 @@ class RspackCLI {
|
|
|
1175
1174
|
this.colors = this.createColors();
|
|
1176
1175
|
this.program = program;
|
|
1177
1176
|
program.help();
|
|
1178
|
-
program.version("1.6.5-canary-
|
|
1177
|
+
program.version("1.6.5-canary-5c09e49d-20251121173820");
|
|
1179
1178
|
}
|
|
1180
1179
|
async createCompiler(options, rspackCommand, callback) {
|
|
1181
1180
|
let { config, pathMap } = await this.loadConfig(options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack-canary/cli",
|
|
3
|
-
"version": "1.6.5-canary-
|
|
3
|
+
"version": "1.6.5-canary-5c09e49d-20251121173820",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"pirates": "^4.0.7",
|
|
45
45
|
"ts-node": "^10.9.2",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
|
-
"@rspack/
|
|
48
|
-
"@rspack/
|
|
47
|
+
"@rspack/core": "npm:@rspack-canary/core@1.6.5-canary-5c09e49d-20251121173820",
|
|
48
|
+
"@rspack/test-tools": "npm:@rspack-canary/test-tools@1.6.5-canary-5c09e49d-20251121173820"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@rspack/core": "^1.0.0-alpha || ^1.x"
|