@rspack/cli 1.0.0-rc.1 → 1.0.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/dist/cli.js +19 -2
- package/dist/commands/preview.js +3 -3
- package/package.json +6 -6
package/dist/cli.js
CHANGED
|
@@ -45,7 +45,7 @@ class RspackCLI {
|
|
|
45
45
|
this.program = (0, yargs_1.default)();
|
|
46
46
|
}
|
|
47
47
|
async createCompiler(options, rspackCommand, callback) {
|
|
48
|
-
process.env.RSPACK_CONFIG_VALIDATE
|
|
48
|
+
process.env.RSPACK_CONFIG_VALIDATE ??= "loose";
|
|
49
49
|
process.env.WATCHPACK_WATCHER_LIMIT =
|
|
50
50
|
process.env.WATCHPACK_WATCHER_LIMIT || "20";
|
|
51
51
|
const nodeEnv = process?.env?.NODE_ENV;
|
|
@@ -61,7 +61,24 @@ class RspackCLI {
|
|
|
61
61
|
const isWatch = Array.isArray(config)
|
|
62
62
|
? config.some(i => i.watch)
|
|
63
63
|
: config.watch;
|
|
64
|
-
|
|
64
|
+
let compiler;
|
|
65
|
+
try {
|
|
66
|
+
compiler = (0, core_1.rspack)(config, isWatch ? callback : undefined);
|
|
67
|
+
}
|
|
68
|
+
catch (e) {
|
|
69
|
+
// Aligned with webpack-cli
|
|
70
|
+
// See: https://github.com/webpack/webpack-cli/blob/eea6adf7d34dfbfd3b5b784ece4a4664834f5a6a/packages/webpack-cli/src/webpack-cli.ts#L2394
|
|
71
|
+
if (e instanceof core_1.ValidationError) {
|
|
72
|
+
this.getLogger().error(e.message);
|
|
73
|
+
process.exit(2);
|
|
74
|
+
}
|
|
75
|
+
else if (e instanceof Error) {
|
|
76
|
+
callback?.(e);
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
throw e;
|
|
80
|
+
}
|
|
81
|
+
return compiler;
|
|
65
82
|
}
|
|
66
83
|
createColors(useColor) {
|
|
67
84
|
const { createColors, isColorSupported } = require("colorette");
|
package/dist/commands/preview.js
CHANGED
|
@@ -29,10 +29,10 @@ class PreviewCommand {
|
|
|
29
29
|
// find the possible devServer config
|
|
30
30
|
config = config.find(item => item.devServer) || config[0];
|
|
31
31
|
const devServerOptions = config.devServer;
|
|
32
|
-
const compiler = (0, core_1.rspack)({ entry: {} });
|
|
33
|
-
if (!compiler)
|
|
34
|
-
return;
|
|
35
32
|
try {
|
|
33
|
+
const compiler = (0, core_1.rspack)({ entry: {} });
|
|
34
|
+
if (!compiler)
|
|
35
|
+
return;
|
|
36
36
|
const server = new RspackDevServer(devServerOptions, compiler);
|
|
37
37
|
await server.start();
|
|
38
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "CLI for rspack",
|
|
6
6
|
"publishConfig": {
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"@rspack/core": "^1.0.0-alpha || ^1.x"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@types/rechoir": "^0.6.1",
|
|
31
30
|
"@types/interpret": "^1.1.3",
|
|
31
|
+
"@types/rechoir": "^0.6.1",
|
|
32
32
|
"@types/semver": "^7.5.6",
|
|
33
33
|
"@types/webpack-bundle-analyzer": "^4.6.0",
|
|
34
34
|
"@types/yargs": "17.0.32",
|
|
35
|
-
"typescript": "5.0.2",
|
|
36
|
-
"ts-node": "^10.9.2",
|
|
37
35
|
"concat-stream": "^2.0.0",
|
|
38
36
|
"cross-env": "^7.0.3",
|
|
39
37
|
"execa": "^5.0.0",
|
|
40
38
|
"internal-ip": "6.2.0",
|
|
41
|
-
"
|
|
39
|
+
"ts-node": "^10.9.2",
|
|
40
|
+
"typescript": "5.0.2",
|
|
41
|
+
"@rspack/core": "1.0.0"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@discoveryjs/json-ext": "^0.5.7",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"semver": "^7.6.2",
|
|
50
50
|
"webpack-bundle-analyzer": "4.6.1",
|
|
51
51
|
"yargs": "17.6.2",
|
|
52
|
-
"@rspack/dev-server": "1.0.0
|
|
52
|
+
"@rspack/dev-server": "1.0.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"build": "tsc -b ./tsconfig.build.json",
|