@@ -63,19 +63,19 @@ function ifArg(name, fn, init) {
6363 }
6464}
6565
66+ var firstOptions = Array . isArray ( options ) ? options [ 0 ] : options ;
6667
67-
68- var outputOptions = {
69- cached : false ,
70- cachedAssets : false ,
71- context : options . context
72- } ;
68+ var outputOptions = Object . create ( options . stats || firstOptions . stats || { } ) ;
69+ if ( typeof outputOptions . context === "undefined" )
70+ outputOptions . context = firstOptions . context ;
7371
7472ifArg ( "json" , function ( bool ) {
75- outputOptions . json = bool ;
73+ if ( bool )
74+ outputOptions . json = bool ;
7675} ) ;
7776
78- outputOptions . colors = require ( "supports-color" ) ;
77+ if ( typeof outputOptions . colors === "undefined" )
78+ outputOptions . colors = require ( "supports-color" ) ;
7979
8080ifArg ( "sort-modules-by" , function ( value ) {
8181 outputOptions . modulesSort = value ;
@@ -94,6 +94,11 @@ ifArg("display-exclude", function(value) {
9494} ) ;
9595
9696if ( ! outputOptions . json ) {
97+ if ( typeof outputOptions . cached === "undefined" )
98+ outputOptions . cached = false ;
99+ if ( typeof outputOptions . cachedAssets === "undefined" )
100+ outputOptions . cachedAssets = false ;
101+
97102 ifArg ( "display-chunks" , function ( bool ) {
98103 outputOptions . modules = ! bool ;
99104 outputOptions . chunks = bool ;
@@ -124,12 +129,18 @@ if(!outputOptions.json) {
124129 if ( ! outputOptions . exclude && ! argv [ "display-modules" ] )
125130 outputOptions . exclude = [ "node_modules" , "bower_components" , "jam" , "components" ] ;
126131} else {
127- outputOptions . chunks = true ;
128- outputOptions . modules = true ;
129- outputOptions . chunkModules = true ;
130- outputOptions . reasons = true ;
131- outputOptions . cached = true ;
132- outputOptions . cachedAssets = true ;
132+ if ( typeof outputOptions . chunks === "undefined" )
133+ outputOptions . chunks = true ;
134+ if ( typeof outputOptions . modules === "undefined" )
135+ outputOptions . modules = true ;
136+ if ( typeof outputOptions . chunkModules === "undefined" )
137+ outputOptions . chunkModules = true ;
138+ if ( typeof outputOptions . reasons === "undefined" )
139+ outputOptions . reasons = true ;
140+ if ( typeof outputOptions . cached === "undefined" )
141+ outputOptions . cached = true ;
142+ if ( typeof outputOptions . cachedAssets === "undefined" )
143+ outputOptions . cachedAssets = true ;
133144}
134145
135146ifArg ( "hide-modules" , function ( bool ) {
0 commit comments