@@ -502,17 +502,80 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
502502 } ) ;
503503 }
504504
505- function processProfile ( module ) {
505+ function processModuleAttributes ( module ) {
506+ colors . normal ( " " ) ;
507+ colors . normal ( formatSize ( module . size ) ) ;
508+ if ( module . chunks ) {
509+ module . chunks . forEach ( function ( chunk ) {
510+ colors . normal ( " {" ) ;
511+ colors . yellow ( chunk ) ;
512+ colors . normal ( "}" ) ;
513+ } ) ;
514+ }
515+ if ( ! module . cacheable ) {
516+ colors . red ( " [not cacheable]" ) ;
517+ }
518+ if ( module . optional ) {
519+ colors . yellow ( " [optional]" ) ;
520+ }
521+ if ( module . built ) {
522+ colors . green ( " [built]" ) ;
523+ }
524+ if ( module . prefetched ) {
525+ colors . magenta ( " [prefetched]" ) ;
526+ }
527+ if ( module . failed )
528+ colors . red ( " [failed]" ) ;
529+ if ( module . warnings )
530+ colors . yellow ( " [" + module . warnings + " warning" + ( module . warnings === 1 ? "" : "s" ) + "]" ) ;
531+ if ( module . errors )
532+ colors . red ( " [" + module . errors + " error" + ( module . errors === 1 ? "" : "s" ) + "]" ) ;
533+ }
534+
535+ function processModuleContent ( module , prefix ) {
536+ if ( Array . isArray ( module . providedExports ) ) {
537+ colors . normal ( prefix ) ;
538+ colors . cyan ( "[exports: " + module . providedExports . join ( ", " ) + "]" ) ;
539+ newline ( ) ;
540+ }
541+ if ( module . usedExports !== undefined ) {
542+ if ( module . usedExports !== true ) {
543+ colors . normal ( prefix ) ;
544+ if ( module . usedExports === false )
545+ colors . cyan ( "[no exports used]" ) ;
546+ else
547+ colors . cyan ( "[only some exports used: " + module . usedExports . join ( ", " ) + "]" ) ;
548+ newline ( ) ;
549+ }
550+ }
551+ if ( module . reasons ) {
552+ module . reasons . forEach ( function ( reason ) {
553+ colors . normal ( prefix ) ;
554+ colors . normal ( reason . type ) ;
555+ colors . normal ( " " ) ;
556+ colors . cyan ( reason . userRequest ) ;
557+ if ( reason . templateModules ) colors . cyan ( reason . templateModules . join ( " " ) ) ;
558+ colors . normal ( " [" ) ;
559+ colors . normal ( reason . moduleId ) ;
560+ colors . normal ( "] " ) ;
561+ colors . magenta ( reason . module ) ;
562+ if ( reason . loc ) {
563+ colors . normal ( " " ) ;
564+ colors . normal ( reason . loc ) ;
565+ }
566+ newline ( ) ;
567+ } ) ;
568+ }
506569 if ( module . profile ) {
507- colors . normal ( " " ) ;
570+ colors . normal ( prefix ) ;
508571 var sum = 0 ;
509572 var path = [ ] ;
510573 var current = module ;
511574 while ( current . issuer ) {
512575 path . unshift ( current = current . issuer ) ;
513576 }
514577 path . forEach ( function ( module ) {
515- colors . normal ( " [" ) ;
578+ colors . normal ( "[" ) ;
516579 colors . normal ( module . id ) ;
517580 colors . normal ( "] " ) ;
518581 if ( module . profile ) {
@@ -535,35 +598,6 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
535598 }
536599 }
537600
538- function processModuleAttributes ( module ) {
539- colors . normal ( " " ) ;
540- colors . normal ( formatSize ( module . size ) ) ;
541- if ( module . chunks ) {
542- module . chunks . forEach ( function ( chunk ) {
543- colors . normal ( " {" ) ;
544- colors . yellow ( chunk ) ;
545- colors . normal ( "}" ) ;
546- } ) ;
547- }
548- if ( ! module . cacheable ) {
549- colors . red ( " [not cacheable]" ) ;
550- }
551- if ( module . optional ) {
552- colors . yellow ( " [optional]" ) ;
553- }
554- if ( module . built ) {
555- colors . green ( " [built]" ) ;
556- }
557- if ( module . prefetched ) {
558- colors . magenta ( " [prefetched]" ) ;
559- }
560- if ( module . failed )
561- colors . red ( " [failed]" ) ;
562- if ( module . warnings )
563- colors . yellow ( " [" + module . warnings + " warning" + ( module . warnings === 1 ? "" : "s" ) + "]" ) ;
564- if ( module . errors )
565- colors . red ( " [" + module . errors + " error" + ( module . errors === 1 ? "" : "s" ) + "]" ) ;
566- }
567601 if ( obj . chunks ) {
568602 obj . chunks . forEach ( function ( chunk ) {
569603 colors . normal ( "chunk " ) ;
@@ -637,40 +671,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
637671 colors . bold ( module . name ) ;
638672 processModuleAttributes ( module ) ;
639673 newline ( ) ;
640- if ( Array . isArray ( module . providedExports ) ) {
641- colors . normal ( " " ) ;
642- colors . cyan ( "[exports: " + module . providedExports . join ( ", " ) + "]" ) ;
643- newline ( ) ;
644- }
645- if ( module . usedExports !== undefined ) {
646- if ( module . usedExports !== true ) {
647- colors . normal ( " " ) ;
648- if ( module . usedExports === false )
649- colors . cyan ( "[no exports used]" ) ;
650- else
651- colors . cyan ( "[only some exports used: " + module . usedExports . join ( ", " ) + "]" ) ;
652- newline ( ) ;
653- }
654- }
655- if ( module . reasons ) {
656- module . reasons . forEach ( function ( reason ) {
657- colors . normal ( " " ) ;
658- colors . normal ( reason . type ) ;
659- colors . normal ( " " ) ;
660- colors . cyan ( reason . userRequest ) ;
661- if ( reason . templateModules ) colors . cyan ( reason . templateModules . join ( " " ) ) ;
662- colors . normal ( " [" ) ;
663- colors . normal ( reason . moduleId ) ;
664- colors . normal ( "] " ) ;
665- colors . magenta ( reason . module ) ;
666- if ( reason . loc ) {
667- colors . normal ( " " ) ;
668- colors . normal ( reason . loc ) ;
669- }
670- newline ( ) ;
671- } ) ;
672- }
673- processProfile ( module ) ;
674+ processModuleContent ( module , " " ) ;
674675 } ) ;
675676 if ( chunk . filteredModules > 0 ) {
676677 colors . normal ( " + " + chunk . filteredModules + " hidden modules" ) ;
@@ -690,35 +691,7 @@ Stats.jsonToString = function jsonToString(obj, useColors) {
690691 colors . bold ( module . name || module . identifier ) ;
691692 processModuleAttributes ( module ) ;
692693 newline ( ) ;
693- if ( module . usedExports !== undefined ) {
694- if ( module . usedExports !== true ) {
695- colors . normal ( " " ) ;
696- if ( module . usedExports === false )
697- colors . cyan ( "[no exports used]" ) ;
698- else
699- colors . cyan ( "[only some exports used: " + module . usedExports . join ( ", " ) + "]" ) ;
700- newline ( ) ;
701- }
702- }
703- if ( module . reasons ) {
704- module . reasons . forEach ( function ( reason ) {
705- colors . normal ( " " ) ;
706- colors . normal ( reason . type ) ;
707- colors . normal ( " " ) ;
708- colors . cyan ( reason . userRequest ) ;
709- if ( reason . templateModules ) colors . cyan ( reason . templateModules . join ( " " ) ) ;
710- colors . normal ( " [" ) ;
711- colors . normal ( reason . moduleId ) ;
712- colors . normal ( "] " ) ;
713- colors . magenta ( reason . module ) ;
714- if ( reason . loc ) {
715- colors . normal ( " " ) ;
716- colors . normal ( reason . loc ) ;
717- }
718- newline ( ) ;
719- } ) ;
720- }
721- processProfile ( module ) ;
694+ processModuleContent ( module , " " ) ;
722695 } ) ;
723696 if ( obj . filteredModules > 0 ) {
724697 colors . normal ( " + " + obj . filteredModules + " hidden modules" ) ;
0 commit comments