Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"language": "en,en-gb",
"words": [
"memfs",
"colorette",
"noextension",
"fullhash",
"execa",
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"release": "standard-version"
},
"dependencies": {
"colorette": "^2.0.10",
"memfs": "^4.43.1",
"mime-types": "^3.0.1",
"on-finished": "^2.4.1",
Expand Down Expand Up @@ -106,7 +105,7 @@
"webpack": "^5.101.0"
},
"peerDependencies": {
"webpack": "^5.0.0"
"webpack": "^5.101.0"
},
"peerDependenciesMeta": {
"webpack": {
Expand Down
16 changes: 2 additions & 14 deletions src/utils/setupHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,8 @@ function setupHooks(context) {
/** @type {MultiCompiler} */
(compiler).compilers;

// TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
childStatsOptions.colors =
typeof firstCompiler.webpack !== "undefined" &&
typeof firstCompiler.webpack.cli !== "undefined" &&
typeof firstCompiler.webpack.cli.isColorSupported ===
"function"
? firstCompiler.webpack.cli.isColorSupported()
: require("colorette").isColorSupported;
firstCompiler.webpack.cli.isColorSupported();
}

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

if (typeof statsOptions.colors === "undefined") {
const { compiler } = /** @type {{ compiler: Compiler }} */ (context);
// TODO remove `colorette` and set minimum supported webpack version is `5.101.0`
statsOptions.colors =
typeof compiler.webpack !== "undefined" &&
typeof compiler.webpack.cli !== "undefined" &&
typeof compiler.webpack.cli.isColorSupported === "function"
? compiler.webpack.cli.isColorSupported()
: require("colorette").isColorSupported;
statsOptions.colors = compiler.webpack.cli.isColorSupported();
}
}

Expand Down
16 changes: 16 additions & 0 deletions test/utils/setupHooks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe("setupHooks", () => {
const loggerInfo = jest.fn();
const loggerWarn = jest.fn();
const loggerError = jest.fn();
const colorSupport = jest.fn();
let nextTick;

const cb1 = jest.fn();
Expand All @@ -22,6 +23,11 @@ describe("setupHooks", () => {
context = {
options: {},
compiler: {
webpack: {
cli: {
isColorSupported: colorSupport,
},
},
hooks: {
watchRun: {
tap: watchRunHook,
Expand Down Expand Up @@ -126,12 +132,22 @@ describe("setupHooks", () => {
it("handles multi compiler", () => {
context.compiler.compilers = [
{
webpack: {
cli: {
isColorSupported: colorSupport,
},
},
options: {
name: "comp1",
stats: {},
},
},
{
webpack: {
cli: {
isColorSupported: colorSupport,
},
},
options: {
name: "comp2",
stats: {},
Expand Down