Skip to content

Commit 99fc677

Browse files
authored
chore: remove colorette dependency and update minimum webpack version to 5.101.0 (#2238)
1 parent c9160bb commit 99fc677

5 files changed

Lines changed: 21 additions & 19 deletions

File tree

.cspell.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"language": "en,en-gb",
44
"words": [
55
"memfs",
6-
"colorette",
76
"noextension",
87
"fullhash",
98
"execa",

package-lock.json

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

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
"release": "standard-version"
4848
},
4949
"dependencies": {
50-
"colorette": "^2.0.10",
5150
"memfs": "^4.43.1",
5251
"mime-types": "^3.0.1",
5352
"on-finished": "^2.4.1",
@@ -106,7 +105,7 @@
106105
"webpack": "^5.101.0"
107106
},
108107
"peerDependencies": {
109-
"webpack": "^5.0.0"
108+
"webpack": "^5.101.0"
110109
},
111110
"peerDependenciesMeta": {
112111
"webpack": {

src/utils/setupHooks.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,8 @@ function setupHooks(context) {
113113
/** @type {MultiCompiler} */
114114
(compiler).compilers;
115115

116-
// TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
117116
childStatsOptions.colors =
118-
typeof firstCompiler.webpack !== "undefined" &&
119-
typeof firstCompiler.webpack.cli !== "undefined" &&
120-
typeof firstCompiler.webpack.cli.isColorSupported ===
121-
"function"
122-
? firstCompiler.webpack.cli.isColorSupported()
123-
: require("colorette").isColorSupported;
117+
firstCompiler.webpack.cli.isColorSupported();
124118
}
125119

126120
return childStatsOptions;
@@ -133,13 +127,7 @@ function setupHooks(context) {
133127

134128
if (typeof statsOptions.colors === "undefined") {
135129
const { compiler } = /** @type {{ compiler: Compiler }} */ (context);
136-
// TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
137-
statsOptions.colors =
138-
typeof compiler.webpack !== "undefined" &&
139-
typeof compiler.webpack.cli !== "undefined" &&
140-
typeof compiler.webpack.cli.isColorSupported === "function"
141-
? compiler.webpack.cli.isColorSupported()
142-
: require("colorette").isColorSupported;
130+
statsOptions.colors = compiler.webpack.cli.isColorSupported();
143131
}
144132
}
145133

test/utils/setupHooks.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ describe("setupHooks", () => {
1212
const loggerInfo = jest.fn();
1313
const loggerWarn = jest.fn();
1414
const loggerError = jest.fn();
15+
const colorSupport = jest.fn();
1516
let nextTick;
1617

1718
const cb1 = jest.fn();
@@ -22,6 +23,11 @@ describe("setupHooks", () => {
2223
context = {
2324
options: {},
2425
compiler: {
26+
webpack: {
27+
cli: {
28+
isColorSupported: colorSupport,
29+
},
30+
},
2531
hooks: {
2632
watchRun: {
2733
tap: watchRunHook,
@@ -126,12 +132,22 @@ describe("setupHooks", () => {
126132
it("handles multi compiler", () => {
127133
context.compiler.compilers = [
128134
{
135+
webpack: {
136+
cli: {
137+
isColorSupported: colorSupport,
138+
},
139+
},
129140
options: {
130141
name: "comp1",
131142
stats: {},
132143
},
133144
},
134145
{
146+
webpack: {
147+
cli: {
148+
isColorSupported: colorSupport,
149+
},
150+
},
135151
options: {
136152
name: "comp2",
137153
stats: {},

0 commit comments

Comments
 (0)