@rspack/cli 2.0.0-beta.4 → 2.0.0-beta.6
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/131.js +41 -72
- package/dist/cli.d.ts +3 -3
- package/dist/types.d.ts +6 -2
- package/package.json +5 -6
package/dist/131.js
CHANGED
|
@@ -9,72 +9,6 @@ import node_fs from "node:fs";
|
|
|
9
9
|
import { createRequire } from "node:module";
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
11
|
__webpack_require__.add({
|
|
12
|
-
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js" (module) {
|
|
13
|
-
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
14
|
-
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || "win32" === p.platform || (p.stdout || {}).isTTY && "dumb" !== env.TERM || !!env.CI);
|
|
15
|
-
let formatter = (open, close, replace = open)=>(input)=>{
|
|
16
|
-
let string = "" + input, index = string.indexOf(close, open.length);
|
|
17
|
-
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
18
|
-
};
|
|
19
|
-
let replaceClose = (string, close, replace, index)=>{
|
|
20
|
-
let result = "", cursor = 0;
|
|
21
|
-
do {
|
|
22
|
-
result += string.substring(cursor, index) + replace;
|
|
23
|
-
cursor = index + close.length;
|
|
24
|
-
index = string.indexOf(close, cursor);
|
|
25
|
-
}while (~index);
|
|
26
|
-
return result + string.substring(cursor);
|
|
27
|
-
};
|
|
28
|
-
let createColors = (enabled = isColorSupported)=>{
|
|
29
|
-
let f = enabled ? formatter : ()=>String;
|
|
30
|
-
return {
|
|
31
|
-
isColorSupported: enabled,
|
|
32
|
-
reset: f("\x1b[0m", "\x1b[0m"),
|
|
33
|
-
bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"),
|
|
34
|
-
dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"),
|
|
35
|
-
italic: f("\x1b[3m", "\x1b[23m"),
|
|
36
|
-
underline: f("\x1b[4m", "\x1b[24m"),
|
|
37
|
-
inverse: f("\x1b[7m", "\x1b[27m"),
|
|
38
|
-
hidden: f("\x1b[8m", "\x1b[28m"),
|
|
39
|
-
strikethrough: f("\x1b[9m", "\x1b[29m"),
|
|
40
|
-
black: f("\x1b[30m", "\x1b[39m"),
|
|
41
|
-
red: f("\x1b[31m", "\x1b[39m"),
|
|
42
|
-
green: f("\x1b[32m", "\x1b[39m"),
|
|
43
|
-
yellow: f("\x1b[33m", "\x1b[39m"),
|
|
44
|
-
blue: f("\x1b[34m", "\x1b[39m"),
|
|
45
|
-
magenta: f("\x1b[35m", "\x1b[39m"),
|
|
46
|
-
cyan: f("\x1b[36m", "\x1b[39m"),
|
|
47
|
-
white: f("\x1b[37m", "\x1b[39m"),
|
|
48
|
-
gray: f("\x1b[90m", "\x1b[39m"),
|
|
49
|
-
bgBlack: f("\x1b[40m", "\x1b[49m"),
|
|
50
|
-
bgRed: f("\x1b[41m", "\x1b[49m"),
|
|
51
|
-
bgGreen: f("\x1b[42m", "\x1b[49m"),
|
|
52
|
-
bgYellow: f("\x1b[43m", "\x1b[49m"),
|
|
53
|
-
bgBlue: f("\x1b[44m", "\x1b[49m"),
|
|
54
|
-
bgMagenta: f("\x1b[45m", "\x1b[49m"),
|
|
55
|
-
bgCyan: f("\x1b[46m", "\x1b[49m"),
|
|
56
|
-
bgWhite: f("\x1b[47m", "\x1b[49m"),
|
|
57
|
-
blackBright: f("\x1b[90m", "\x1b[39m"),
|
|
58
|
-
redBright: f("\x1b[91m", "\x1b[39m"),
|
|
59
|
-
greenBright: f("\x1b[92m", "\x1b[39m"),
|
|
60
|
-
yellowBright: f("\x1b[93m", "\x1b[39m"),
|
|
61
|
-
blueBright: f("\x1b[94m", "\x1b[39m"),
|
|
62
|
-
magentaBright: f("\x1b[95m", "\x1b[39m"),
|
|
63
|
-
cyanBright: f("\x1b[96m", "\x1b[39m"),
|
|
64
|
-
whiteBright: f("\x1b[97m", "\x1b[39m"),
|
|
65
|
-
bgBlackBright: f("\x1b[100m", "\x1b[49m"),
|
|
66
|
-
bgRedBright: f("\x1b[101m", "\x1b[49m"),
|
|
67
|
-
bgGreenBright: f("\x1b[102m", "\x1b[49m"),
|
|
68
|
-
bgYellowBright: f("\x1b[103m", "\x1b[49m"),
|
|
69
|
-
bgBlueBright: f("\x1b[104m", "\x1b[49m"),
|
|
70
|
-
bgMagentaBright: f("\x1b[105m", "\x1b[49m"),
|
|
71
|
-
bgCyanBright: f("\x1b[106m", "\x1b[49m"),
|
|
72
|
-
bgWhiteBright: f("\x1b[107m", "\x1b[49m")
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
module.exports = createColors();
|
|
76
|
-
module.exports.createColors = createColors;
|
|
77
|
-
},
|
|
78
12
|
"../../node_modules/.pnpm/pirates@4.0.7/node_modules/pirates/lib/index.js" (module, exports, __webpack_require__) {
|
|
79
13
|
module = __webpack_require__.nmd(module);
|
|
80
14
|
const BuiltinModule = __webpack_require__("module");
|
|
@@ -1104,7 +1038,29 @@ async function loadRspackConfig(options, cwd = process.cwd()) {
|
|
|
1104
1038
|
configPath
|
|
1105
1039
|
};
|
|
1106
1040
|
}
|
|
1107
|
-
|
|
1041
|
+
function isEnvColorSupported() {
|
|
1042
|
+
if ("u" < typeof process) return false;
|
|
1043
|
+
const p = process;
|
|
1044
|
+
const argv = p.argv ?? [];
|
|
1045
|
+
const env = p.env ?? {};
|
|
1046
|
+
return !('NO_COLOR' in env || argv.includes('--no-color')) && ('FORCE_COLOR' in env || argv.includes('--color') || 'win32' === p.platform || p.stdout?.isTTY && 'dumb' !== env.TERM || 'CI' in env);
|
|
1047
|
+
}
|
|
1048
|
+
function createAnsiFormatter(open, close, replace = open) {
|
|
1049
|
+
const closeLength = close.length;
|
|
1050
|
+
return (input)=>{
|
|
1051
|
+
const string = String(input);
|
|
1052
|
+
let index = string.indexOf(close, open.length);
|
|
1053
|
+
if (-1 === index) return open + string + close;
|
|
1054
|
+
let result = '';
|
|
1055
|
+
let cursor = 0;
|
|
1056
|
+
do {
|
|
1057
|
+
result += string.substring(cursor, index) + replace;
|
|
1058
|
+
cursor = index + closeLength;
|
|
1059
|
+
index = string.indexOf(close, cursor);
|
|
1060
|
+
}while (-1 !== index);
|
|
1061
|
+
return open + result + string.substring(cursor) + close;
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1108
1064
|
class RspackCLI {
|
|
1109
1065
|
colors;
|
|
1110
1066
|
program;
|
|
@@ -1113,7 +1069,7 @@ class RspackCLI {
|
|
|
1113
1069
|
this.colors = this.createColors();
|
|
1114
1070
|
this.program = program;
|
|
1115
1071
|
program.help();
|
|
1116
|
-
program.version("2.0.0-beta.
|
|
1072
|
+
program.version("2.0.0-beta.6");
|
|
1117
1073
|
}
|
|
1118
1074
|
async buildCompilerConfig(options, rspackCommand) {
|
|
1119
1075
|
let { config, pathMap } = await this.loadConfig(options);
|
|
@@ -1140,10 +1096,24 @@ class RspackCLI {
|
|
|
1140
1096
|
return compiler;
|
|
1141
1097
|
}
|
|
1142
1098
|
createColors(useColor) {
|
|
1143
|
-
const
|
|
1099
|
+
const envSupported = isEnvColorSupported();
|
|
1100
|
+
const enabled = useColor ?? envSupported;
|
|
1101
|
+
if (!enabled) {
|
|
1102
|
+
const passthrough = (text)=>String(text);
|
|
1103
|
+
return {
|
|
1104
|
+
isColorSupported: false,
|
|
1105
|
+
red: passthrough,
|
|
1106
|
+
yellow: passthrough,
|
|
1107
|
+
cyan: passthrough,
|
|
1108
|
+
green: passthrough
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1144
1111
|
return {
|
|
1145
|
-
|
|
1146
|
-
|
|
1112
|
+
isColorSupported: true,
|
|
1113
|
+
red: createAnsiFormatter('\x1b[31m', '\x1b[39m'),
|
|
1114
|
+
green: createAnsiFormatter('\x1b[32m', '\x1b[39m'),
|
|
1115
|
+
yellow: createAnsiFormatter('\x1b[33m', '\x1b[39m'),
|
|
1116
|
+
cyan: createAnsiFormatter('\x1b[36m', '\x1b[39m')
|
|
1147
1117
|
};
|
|
1148
1118
|
}
|
|
1149
1119
|
getLogger() {
|
|
@@ -1212,7 +1182,6 @@ class RspackCLI {
|
|
|
1212
1182
|
else if ('string' == typeof item.stats) item.stats = {
|
|
1213
1183
|
preset: item.stats
|
|
1214
1184
|
};
|
|
1215
|
-
if (this.colors.isColorSupported && void 0 === item.stats.colors) item.stats.colors = true;
|
|
1216
1185
|
return item;
|
|
1217
1186
|
};
|
|
1218
1187
|
if (Array.isArray(item)) return Promise.all(item.map(internalBuildConfig));
|
package/dist/cli.d.ts
CHANGED
|
@@ -12,11 +12,11 @@ export declare class RspackCLI {
|
|
|
12
12
|
constructor();
|
|
13
13
|
buildCompilerConfig(options: CommonOptionsForBuildAndServe, rspackCommand: Command): Promise<RspackOptions | MultiRspackOptions>;
|
|
14
14
|
createCompiler(config: RspackOptions | MultiRspackOptions, callback?: (e: Error | null, res?: Stats | MultiStats) => void): Promise<MultiCompiler | Compiler | null>;
|
|
15
|
-
createColors
|
|
15
|
+
private createColors;
|
|
16
16
|
getLogger(): RspackCLILogger;
|
|
17
17
|
run(argv: string[]): Promise<void>;
|
|
18
|
-
registerCommands
|
|
19
|
-
buildConfig
|
|
18
|
+
private registerCommands;
|
|
19
|
+
private buildConfig;
|
|
20
20
|
loadConfig(options: CommonOptions): Promise<{
|
|
21
21
|
config: RspackOptions | MultiRspackOptions;
|
|
22
22
|
pathMap: WeakMap<RspackOptions, string[]>;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import type { RspackCLI } from './cli';
|
|
2
2
|
export type { Configuration } from '@rspack/core';
|
|
3
3
|
export type LogHandler = (value: any) => void;
|
|
4
|
-
export
|
|
4
|
+
export interface RspackCLIColors {
|
|
5
5
|
isColorSupported: boolean;
|
|
6
|
-
|
|
6
|
+
red(text: string): string;
|
|
7
|
+
yellow(text: string): string;
|
|
8
|
+
cyan(text: string): string;
|
|
9
|
+
green(text: string): string;
|
|
10
|
+
}
|
|
7
11
|
export interface RspackCLILogger {
|
|
8
12
|
error: LogHandler;
|
|
9
13
|
warn: LogHandler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rspack/cli",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.6",
|
|
4
4
|
"description": "CLI for rspack",
|
|
5
5
|
"homepage": "https://rspack.rs",
|
|
6
6
|
"bugs": "https://github.com/web-infra-dev/rspack/issues",
|
|
@@ -32,21 +32,20 @@
|
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@rslib/core": "0.19.6",
|
|
35
|
-
"@rspack/dev-server": "
|
|
35
|
+
"@rspack/dev-server": "2.0.0-beta.4",
|
|
36
36
|
"cac": "^6.7.14",
|
|
37
37
|
"concat-stream": "^2.0.0",
|
|
38
38
|
"cross-env": "^10.1.0",
|
|
39
39
|
"execa": "^5.1.1",
|
|
40
|
-
"picocolors": "^1.1.1",
|
|
41
40
|
"pirates": "^4.0.7",
|
|
42
41
|
"ts-node": "^10.9.2",
|
|
43
42
|
"typescript": "^5.9.3",
|
|
44
|
-
"@rspack/core": "2.0.0-beta.
|
|
45
|
-
"@rspack/test-tools": "2.0.0-beta.
|
|
43
|
+
"@rspack/core": "2.0.0-beta.6",
|
|
44
|
+
"@rspack/test-tools": "2.0.0-beta.6"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"@rspack/core": "^2.0.0-0",
|
|
49
|
-
"@rspack/dev-server": "
|
|
48
|
+
"@rspack/dev-server": "^2.0.0-0"
|
|
50
49
|
},
|
|
51
50
|
"peerDependenciesMeta": {
|
|
52
51
|
"@rspack/dev-server": {
|