@@ -378,13 +378,14 @@ class Chunk {
378
378
otherChunk . _groups . clear ( ) ;
379
379
380
380
if ( this . name && otherChunk . name ) {
381
- if ( this . name . length !== otherChunk . name . length )
381
+ if ( this . name . length !== otherChunk . name . length ) {
382
382
this . name =
383
383
this . name . length < otherChunk . name . length
384
384
? this . name
385
385
: otherChunk . name ;
386
- else
386
+ } else {
387
387
this . name = this . name < otherChunk . name ? this . name : otherChunk . name ;
388
+ }
388
389
}
389
390
390
391
return true ;
@@ -420,12 +421,16 @@ class Chunk {
420
421
for ( const chunkGroup of queue ) {
421
422
if ( a . isInGroup ( chunkGroup ) ) continue ;
422
423
if ( chunkGroup . isInitial ( ) ) return false ;
423
- for ( const parent of chunkGroup . parentsIterable ) queue . add ( parent ) ;
424
+ for ( const parent of chunkGroup . parentsIterable ) {
425
+ queue . add ( parent ) ;
426
+ }
424
427
}
425
428
return true ;
426
429
} ;
427
430
428
- if ( this . preventIntegration || otherChunk . preventIntegration ) return false ;
431
+ if ( this . preventIntegration || otherChunk . preventIntegration ) {
432
+ return false ;
433
+ }
429
434
430
435
if ( this . hasRuntime ( ) !== otherChunk . hasRuntime ( ) ) {
431
436
if ( this . hasRuntime ( ) ) {
@@ -436,7 +441,11 @@ class Chunk {
436
441
return false ;
437
442
}
438
443
}
439
- if ( this . hasEntryModule ( ) || otherChunk . hasEntryModule ( ) ) return false ;
444
+
445
+ if ( this . hasEntryModule ( ) || otherChunk . hasEntryModule ( ) ) {
446
+ return false ;
447
+ }
448
+
440
449
return true ;
441
450
}
442
451
@@ -509,14 +518,20 @@ class Chunk {
509
518
) ;
510
519
511
520
for ( const chunkGroup of this . groupsIterable ) {
512
- for ( const child of chunkGroup . childrenIterable ) queue . add ( child ) ;
521
+ for ( const child of chunkGroup . childrenIterable ) {
522
+ queue . add ( child ) ;
523
+ }
513
524
}
514
525
515
526
for ( const chunkGroup of queue ) {
516
527
for ( const chunk of chunkGroup . chunks ) {
517
- if ( ! initialChunks . has ( chunk ) ) chunks . add ( chunk ) ;
528
+ if ( ! initialChunks . has ( chunk ) ) {
529
+ chunks . add ( chunk ) ;
530
+ }
531
+ }
532
+ for ( const child of chunkGroup . childrenIterable ) {
533
+ queue . add ( child ) ;
518
534
}
519
- for ( const child of chunkGroup . childrenIterable ) queue . add ( child ) ;
520
535
}
521
536
522
537
return chunks ;
@@ -530,11 +545,14 @@ class Chunk {
530
545
for ( const chunk of this . getAllAsyncChunks ( ) ) {
531
546
chunkHashMap [ chunk . id ] = realHash ? chunk . hash : chunk . renderedHash ;
532
547
for ( const key of Object . keys ( chunk . contentHash ) ) {
533
- if ( ! chunkContentHashMap [ key ] )
548
+ if ( ! chunkContentHashMap [ key ] ) {
534
549
chunkContentHashMap [ key ] = Object . create ( null ) ;
550
+ }
535
551
chunkContentHashMap [ key ] [ chunk . id ] = chunk . contentHash [ key ] ;
536
552
}
537
- if ( chunk . name ) chunkNameMap [ chunk . id ] = chunk . name ;
553
+ if ( chunk . name ) {
554
+ chunkNameMap [ chunk . id ] = chunk . name ;
555
+ }
538
556
}
539
557
540
558
return {
@@ -572,12 +590,16 @@ class Chunk {
572
590
const cmp = b . order - a . order ;
573
591
if ( cmp !== 0 ) return cmp ;
574
592
// TOOD webpack 5 remove this check of compareTo
575
- if ( a . group . compareTo ) return a . group . compareTo ( b . group ) ;
593
+ if ( a . group . compareTo ) {
594
+ return a . group . compareTo ( b . group ) ;
595
+ }
576
596
return 0 ;
577
597
} ) ;
578
598
result [ name ] = Array . from (
579
599
list . reduce ( ( set , item ) => {
580
- for ( const chunk of item . group . chunks ) set . add ( chunk . id ) ;
600
+ for ( const chunk of item . group . chunks ) {
601
+ set . add ( chunk . id ) ;
602
+ }
581
603
return set ;
582
604
} , new Set ( ) )
583
605
) ;
@@ -592,8 +614,9 @@ class Chunk {
592
614
const data = chunk . getChildIdsByOrders ( ) ;
593
615
for ( const key of Object . keys ( data ) ) {
594
616
let chunkMap = chunkMaps [ key ] ;
595
- if ( chunkMap === undefined )
617
+ if ( chunkMap === undefined ) {
596
618
chunkMaps [ key ] = chunkMap = Object . create ( null ) ;
619
+ }
597
620
chunkMap [ chunk . id ] = data [ key ] ;
598
621
}
599
622
}
@@ -642,12 +665,17 @@ class Chunk {
642
665
if ( ! chunksProcessed . has ( chunk ) ) {
643
666
chunksProcessed . add ( chunk ) ;
644
667
if ( ! filterChunkFn || filterChunkFn ( chunk ) ) {
645
- for ( const module of chunk . modulesIterable )
646
- if ( filterFn ( module ) ) return true ;
668
+ for ( const module of chunk . modulesIterable ) {
669
+ if ( filterFn ( module ) ) {
670
+ return true ;
671
+ }
672
+ }
647
673
}
648
674
}
649
675
}
650
- for ( const child of chunkGroup . childrenIterable ) queue . add ( child ) ;
676
+ for ( const child of chunkGroup . childrenIterable ) {
677
+ queue . add ( child ) ;
678
+ }
651
679
}
652
680
return false ;
653
681
}
0 commit comments