@@ -26,11 +26,9 @@ export function statsToString(json: any, statsConfig: any) {
2626 const g = ( x : string ) => colors ? bold ( green ( x ) ) : x ;
2727 const y = ( x : string ) => colors ? bold ( yellow ( x ) ) : x ;
2828
29- return rs ( stripIndents `
30- Date: ${ w ( new Date ( ) . toISOString ( ) ) }
31- Hash: ${ w ( json . hash ) }
32- Time: ${ w ( '' + json . time ) } ms
33- ${ json . chunks . map ( ( chunk : any ) => {
29+ const changedChunksStats = json . chunks
30+ . filter ( ( chunk : any ) => chunk . rendered )
31+ . map ( ( chunk : any ) => {
3432 const asset = json . assets . filter ( ( x : any ) => x . name == chunk . files [ 0 ] ) [ 0 ] ;
3533 const size = asset ? ` ${ _formatSize ( asset . size ) } ` : '' ;
3634 const files = chunk . files . join ( ', ' ) ;
@@ -41,8 +39,24 @@ export function statsToString(json: any, statsConfig: any) {
4139 . join ( '' ) ;
4240
4341 return `chunk {${ y ( chunk . id ) } } ${ g ( files ) } ${ names } ${ size } ${ initial } ${ flags } ` ;
44- } ) . join ( '\n' ) }
45- ` ) ;
42+ } ) ;
43+
44+ const unchangedChunkNumber = json . chunks . length - changedChunksStats . length ;
45+
46+ if ( unchangedChunkNumber > 0 ) {
47+ return rs ( stripIndents `
48+ Date: ${ w ( new Date ( ) . toISOString ( ) ) } • Hash: ${ w ( json . hash ) } • Time: ${ w ( '' + json . time ) } ms
49+ ${ unchangedChunkNumber } unchanged chunks
50+ ${ changedChunksStats . join ( '\n' ) }
51+ ` ) ;
52+ } else {
53+ return rs ( stripIndents `
54+ Date: ${ w ( new Date ( ) . toISOString ( ) ) }
55+ Hash: ${ w ( json . hash ) }
56+ Time: ${ w ( '' + json . time ) } ms
57+ ${ changedChunksStats . join ( '\n' ) }
58+ ` ) ;
59+ }
4660}
4761
4862export function statsWarningsToString ( json : any , statsConfig : any ) {
0 commit comments