@@ -6,15 +6,14 @@ var path = require("path");
66var Tapable = require ( "tapable" ) ;
77
88var Compilation = require ( "./Compilation" ) ;
9-
9+ var Stats = require ( "./Stats" ) ;
1010var NormalModuleFactory = require ( "./NormalModuleFactory" ) ;
1111var ContextModuleFactory = require ( "./ContextModuleFactory" ) ;
1212
1313function Watching ( compiler , watchOptions , handler ) {
1414 this . startTime = null ;
1515 this . invalid = false ;
1616 this . error = null ;
17- this . stats = null ;
1817 this . handler = handler ;
1918 this . closed = false ;
2019 if ( typeof watchOptions === "number" ) {
@@ -61,7 +60,7 @@ Watching.prototype._go = function() {
6160 if ( compilation . applyPluginsBailResult ( "need-additional-pass" ) ) {
6261 compilation . needAdditionalPass = true ;
6362
64- var stats = compilation . getStats ( ) ;
63+ var stats = new Stats ( compilation ) ;
6564 stats . startTime = self . startTime ;
6665 stats . endTime = new Date ( ) . getTime ( ) ;
6766 self . compiler . applyPlugins ( "done" , stats ) ;
@@ -83,7 +82,7 @@ Watching.prototype._done = function(err, compilation) {
8382 this . running = false ;
8483 if ( this . invalid ) return this . _go ( ) ;
8584 this . error = err || null ;
86- this . stats = compilation ? compilation . getStats ( ) : null ;
85+ this . stats = compilation ? new Stats ( compilation ) : null ;
8786 if ( this . stats ) {
8887 this . stats . startTime = this . startTime ;
8988 this . stats . endTime = new Date ( ) . getTime ( ) ;
@@ -232,7 +231,7 @@ Compiler.prototype.run = function(callback) {
232231 if ( err ) return callback ( err ) ;
233232
234233 if ( self . applyPluginsBailResult ( "should-emit" , compilation ) === false ) {
235- var stats = compilation . getStats ( ) ;
234+ var stats = new Stats ( compilation ) ;
236235 stats . startTime = startTime ;
237236 stats . endTime = new Date ( ) . getTime ( ) ;
238237 self . applyPlugins ( "done" , stats ) ;
@@ -245,7 +244,7 @@ Compiler.prototype.run = function(callback) {
245244 if ( compilation . applyPluginsBailResult ( "need-additional-pass" ) ) {
246245 compilation . needAdditionalPass = true ;
247246
248- var stats = compilation . getStats ( ) ;
247+ var stats = new Stats ( compilation ) ;
249248 stats . startTime = startTime ;
250249 stats . endTime = new Date ( ) . getTime ( ) ;
251250 self . applyPlugins ( "done" , stats ) ;
@@ -260,7 +259,7 @@ Compiler.prototype.run = function(callback) {
260259 self . emitRecords ( function ( err ) {
261260 if ( err ) return callback ( err ) ;
262261
263- var stats = compilation . getStats ( ) ;
262+ var stats = new Stats ( compilation ) ;
264263 stats . startTime = startTime ;
265264 stats . endTime = new Date ( ) . getTime ( ) ;
266265 self . applyPlugins ( "done" , stats ) ;
0 commit comments