Skip to content

Commit 23be8c6

Browse files
authored
perf(cli): replace colorette with picocolors (#11932)
1 parent d3cf376 commit 23be8c6

File tree

5 files changed

+9
-110
lines changed

5 files changed

+9
-110
lines changed

packages/rspack-cli/package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
"bin": {
2424
"rspack": "./bin/rspack.js"
2525
},
26-
"files": [
27-
"bin",
28-
"dist"
29-
],
26+
"files": ["bin", "dist"],
3027
"scripts": {
3128
"build": "rslib build",
3229
"dev": "rslib build -w",
@@ -44,10 +41,10 @@
4441
"@rspack/test-tools": "workspace:*",
4542
"@types/webpack-bundle-analyzer": "^4.7.0",
4643
"cac": "^6.7.14",
47-
"colorette": "2.0.20",
4844
"concat-stream": "^2.0.0",
4945
"cross-env": "^10.1.0",
5046
"execa": "^5.1.1",
47+
"picocolors": "^1.1.1",
5148
"pirates": "^4.0.7",
5249
"ts-node": "^10.9.2",
5350
"typescript": "^5.9.3"

packages/rspack-cli/src/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type {
1111
Stats
1212
} from "@rspack/core";
1313
import cac, { type CAC } from "cac";
14-
import { createColors, isColorSupported } from "colorette";
14+
import { createColors, isColorSupported } from "picocolors";
1515
import { BuildCommand } from "./commands/build";
1616
import { PreviewCommand } from "./commands/preview";
1717
import { ServeCommand } from "./commands/serve";
@@ -82,7 +82,7 @@ export class RspackCLI {
8282
createColors(useColor?: boolean): RspackCLIColors {
8383
const shouldUseColor = useColor || isColorSupported;
8484
return {
85-
...createColors({ useColor: shouldUseColor }),
85+
...createColors(shouldUseColor),
8686
isColorSupported: shouldUseColor
8787
};
8888
}

packages/rspack-cli/src/globals.d.ts

Lines changed: 0 additions & 97 deletions
This file was deleted.

packages/rspack-cli/src/types.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
import type { Colorette } from "colorette";
21
import type { RspackCLI } from "./cli";
32

43
export type { Configuration } from "@rspack/core";
54

65
export type LogHandler = (value: any) => void;
76

8-
export interface RspackCLIColors extends Colorette {
7+
export type RspackCLIColors = {
98
isColorSupported: boolean;
10-
}
9+
} & Omit<typeof import("picocolors"), "createColors">;
1110

1211
export interface RspackCLILogger {
1312
error: LogHandler;

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)