@rspack/cli 0.3.12 → 0.3.13
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/commands/build.js +10 -3
- package/dist/rspack-cli.d.ts +1 -1
- package/dist/rspack-cli.js +1 -0
- package/dist/utils/options.js +3 -0
- package/dist/utils/profile.js +8 -2
- package/package.json +3 -3
package/dist/commands/build.js
CHANGED
|
@@ -39,11 +39,13 @@ class BuildCommand {
|
|
|
39
39
|
}
|
|
40
40
|
}), async (options) => {
|
|
41
41
|
const logger = cli.getLogger();
|
|
42
|
+
// @ts-expect-error
|
|
42
43
|
let createJsonStringifyStream;
|
|
43
44
|
if (options.json) {
|
|
44
45
|
const jsonExt = await import("@discoveryjs/json-ext");
|
|
45
46
|
createJsonStringifyStream = jsonExt.default.stringifyStream;
|
|
46
47
|
}
|
|
48
|
+
// @ts-expect-error
|
|
47
49
|
const callback = (error, stats) => {
|
|
48
50
|
if (error) {
|
|
49
51
|
logger.error(error);
|
|
@@ -59,10 +61,14 @@ class BuildCommand {
|
|
|
59
61
|
? {
|
|
60
62
|
children: compiler.compilers.map(compiler => compiler.options ? compiler.options.stats : undefined)
|
|
61
63
|
}
|
|
62
|
-
:
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
: // @ts-expect-error
|
|
65
|
+
compiler.options
|
|
66
|
+
? // @ts-expect-error
|
|
67
|
+
compiler.options.stats
|
|
68
|
+
: undefined;
|
|
69
|
+
// @ts-expect-error
|
|
65
70
|
if (options.json && createJsonStringifyStream) {
|
|
71
|
+
// @ts-expect-error
|
|
66
72
|
const handleWriteError = error => {
|
|
67
73
|
logger.error(error);
|
|
68
74
|
process.exit(2);
|
|
@@ -94,6 +100,7 @@ class BuildCommand {
|
|
|
94
100
|
}
|
|
95
101
|
};
|
|
96
102
|
const rspackOptions = { ...options, argv: { ...options } };
|
|
103
|
+
// @ts-expect-error
|
|
97
104
|
const errorHandler = (err, Stats) => {
|
|
98
105
|
callback(err, Stats);
|
|
99
106
|
};
|
package/dist/rspack-cli.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare class RspackCLI {
|
|
|
7
7
|
colors: RspackCLIColors;
|
|
8
8
|
program: yargs.Argv;
|
|
9
9
|
constructor();
|
|
10
|
-
createCompiler(options: RspackBuildCLIOptions, rspackCommand: Command, callback?: (e: Error, res?: Stats | MultiStats) => void): Promise<MultiCompiler
|
|
10
|
+
createCompiler(options: RspackBuildCLIOptions, rspackCommand: Command, callback?: (e: Error, res?: Stats | MultiStats) => void): Promise<MultiCompiler & Compiler>;
|
|
11
11
|
createColors(useColor?: boolean): RspackCLIColors;
|
|
12
12
|
getLogger(): RspackCLILogger;
|
|
13
13
|
run(argv: string[]): Promise<void>;
|
package/dist/rspack-cli.js
CHANGED
package/dist/utils/options.js
CHANGED
|
@@ -84,12 +84,15 @@ const previewOptions = (yargs) => {
|
|
|
84
84
|
});
|
|
85
85
|
};
|
|
86
86
|
exports.previewOptions = previewOptions;
|
|
87
|
+
// @ts-expect-error
|
|
87
88
|
function normalizeEnv(argv) {
|
|
88
89
|
var _a;
|
|
90
|
+
// @ts-expect-error
|
|
89
91
|
function parseValue(previous, value) {
|
|
90
92
|
const [allKeys, val] = value.split(/=(.+)/, 2);
|
|
91
93
|
const splitKeys = allKeys.split(/\.(?!$)/);
|
|
92
94
|
let prevRef = previous;
|
|
95
|
+
// @ts-expect-error
|
|
93
96
|
splitKeys.forEach((someKey, index) => {
|
|
94
97
|
// https://github.com/webpack/webpack-cli/issues/3284
|
|
95
98
|
if (someKey.endsWith("=")) {
|
package/dist/utils/profile.js
CHANGED
|
@@ -131,12 +131,15 @@ class RspackProfileJSCPUProfilePlugin {
|
|
|
131
131
|
constructor(output) {
|
|
132
132
|
this.output = output;
|
|
133
133
|
}
|
|
134
|
+
// @ts-expect-error
|
|
134
135
|
apply(compiler) {
|
|
135
136
|
const session = new inspector_1.default.Session();
|
|
136
137
|
session.connect();
|
|
137
138
|
session.post("Profiler.enable");
|
|
138
139
|
session.post("Profiler.start");
|
|
139
|
-
compiler.hooks.done.tapAsync(RspackProfileJSCPUProfilePlugin.name,
|
|
140
|
+
compiler.hooks.done.tapAsync(RspackProfileJSCPUProfilePlugin.name,
|
|
141
|
+
// @ts-expect-error
|
|
142
|
+
(stats, callback) => {
|
|
140
143
|
if (compiler.watchMode)
|
|
141
144
|
return callback();
|
|
142
145
|
session.post("Profiler.stop", (error, param) => {
|
|
@@ -154,8 +157,11 @@ class RspackProfileLoggingPlugin {
|
|
|
154
157
|
constructor(output) {
|
|
155
158
|
this.output = output;
|
|
156
159
|
}
|
|
160
|
+
// @ts-expect-error
|
|
157
161
|
apply(compiler) {
|
|
158
|
-
compiler.hooks.done.tapAsync(RspackProfileLoggingPlugin.name,
|
|
162
|
+
compiler.hooks.done.tapAsync(RspackProfileLoggingPlugin.name,
|
|
163
|
+
// @ts-expect-error
|
|
164
|
+
(stats, callback) => {
|
|
159
165
|
if (compiler.watchMode)
|
|
160
166
|
return callback();
|
|
161
167
|
const logging = stats.toJson({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "CLI for rspack",
|
|
6
6
|
"bin": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"semver": "6.3.1",
|
|
38
38
|
"webpack-bundle-analyzer": "4.6.1",
|
|
39
39
|
"yargs": "17.6.2",
|
|
40
|
-
"@rspack/core": "0.3.
|
|
41
|
-
"@rspack/dev-server": "0.3.
|
|
40
|
+
"@rspack/core": "0.3.13",
|
|
41
|
+
"@rspack/dev-server": "0.3.13"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "rimraf dist/ && tsc -b ./tsconfig.build.json --force",
|