File tree Expand file tree Collapse file tree 3 files changed +94
-63
lines changed
Expand file tree Collapse file tree 3 files changed +94
-63
lines changed Original file line number Diff line number Diff line change @@ -1477,6 +1477,23 @@ class Server {
14771477 }
14781478 }
14791479
1480+ /**
1481+ * @returns { { isColorSupported: () => boolean, colors: import("webpack").Colors } } colors support
1482+ */
1483+ #getColors( ) {
1484+ const compilerOptions =
1485+ /** @type {MultiCompiler } */
1486+ ( this . compiler ) . compilers
1487+ ? /** @type {MultiCompiler } */ ( this . compiler ) . compilers [ 0 ] . webpack
1488+ : /** @type {Compiler } */ ( this . compiler ) . webpack ;
1489+
1490+ const colors = compilerOptions . cli . createColors ( {
1491+ useColor : compilerOptions . cli . isColorSupported ( ) ,
1492+ } ) ;
1493+
1494+ return { isColorSupported : compilerOptions . cli . isColorSupported , colors } ;
1495+ }
1496+
14801497 /**
14811498 * @private
14821499 * @returns {string } client transport
@@ -2735,7 +2752,10 @@ class Server {
27352752 * @returns {Promise<void> }
27362753 */
27372754 async logStatus ( ) {
2738- const { cyan, isColorSupported, red } = require ( "colorette" ) ;
2755+ const {
2756+ isColorSupported,
2757+ colors : { cyan, red } ,
2758+ } = this . #getColors( ) ;
27392759
27402760 /**
27412761 * @param {Compiler["options"] } compilerOptions compiler options
@@ -2756,7 +2776,7 @@ class Server {
27562776 /** @type {boolean } */
27572777 ( /** @type {StatsOptions } */ ( compilerOptions . stats ) . colors ) ;
27582778 } else {
2759- colorsEnabled = isColorSupported ;
2779+ colorsEnabled = isColorSupported ( ) ;
27602780 }
27612781
27622782 return colorsEnabled ;
You can’t perform that action at this time.
0 commit comments