@@ -72,15 +72,6 @@ if (semver.satisfies(process.version, '8.6.0 - 9')) {
72
72
tls . DEFAULT_ECDH_CURVE = 'auto' ;
73
73
}
74
74
75
- const STATS = {
76
- all : false ,
77
- hash : true ,
78
- assets : true ,
79
- warnings : true ,
80
- errors : true ,
81
- errorDetails : false ,
82
- } ;
83
-
84
75
class Server {
85
76
constructor ( compiler , options = { } , _log ) {
86
77
this . log = _log || createLogger ( options ) ;
@@ -91,6 +82,15 @@ class Server {
91
82
throw new Error ( "'filename' option must be set in lazy mode." ) ;
92
83
}
93
84
85
+ this . stats = options . stats ;
86
+ this . DEFAULT_STATS = {
87
+ all : false ,
88
+ hash : true ,
89
+ assets : true ,
90
+ warnings : true ,
91
+ errors : true ,
92
+ errorDetails : false ,
93
+ } ;
94
94
this . hot = options . hot || options . hotOnly ;
95
95
this . headers = options . headers ;
96
96
this . progress = options . progress ;
@@ -144,7 +144,7 @@ class Server {
144
144
compile . tap ( 'webpack-dev-server' , invalidPlugin ) ;
145
145
invalid . tap ( 'webpack-dev-server' , invalidPlugin ) ;
146
146
done . tap ( 'webpack-dev-server' , ( stats ) => {
147
- this . _sendStats ( this . sockets , stats . toJson ( STATS ) ) ;
147
+ this . _sendStats ( this . sockets , this . getStats ( stats ) ) ;
148
148
this . _stats = stats ;
149
149
} ) ;
150
150
} ;
@@ -650,6 +650,13 @@ class Server {
650
650
} , this ) ;
651
651
}
652
652
653
+ getStats ( statsObj ) {
654
+ return Object . assign (
655
+ statsObj . toJson ( this . DEFAULT_STATS ) ,
656
+ statsObj . toJson ( this . stats )
657
+ ) ;
658
+ }
659
+
653
660
use ( ) {
654
661
// eslint-disable-next-line
655
662
this . app . use . apply ( this . app , arguments ) ;
@@ -817,7 +824,7 @@ class Server {
817
824
return ;
818
825
}
819
826
820
- this . _sendStats ( [ connection ] , this . _stats . toJson ( STATS ) , true ) ;
827
+ this . _sendStats ( [ connection ] , this . getStats ( this . _stats ) , true ) ;
821
828
} ) ;
822
829
823
830
socket . installHandlers ( this . listeningApp , {
0 commit comments