@@ -491,7 +491,7 @@ impl<'a> FlagDependencyUsagePluginProxy<'a> {
491491 let last_one = i == len - 1 ;
492492 if !last_one && let Some ( nested_info) = export_info. exports_info ( ) {
493493 let changed_flag = export_info. set_used_conditionally (
494- Box :: new ( |used| used == & UsageState :: Unused ) ,
494+ |used| used == & UsageState :: Unused ,
495495 UsageState :: OnlyPropertiesUsed ,
496496 runtime. as_ref ( ) ,
497497 ) ;
@@ -517,7 +517,7 @@ impl<'a> FlagDependencyUsagePluginProxy<'a> {
517517 }
518518
519519 let changed_flag = export_info. set_used_conditionally (
520- Box :: new ( |v| v != & UsageState :: Used ) ,
520+ |v| v != & UsageState :: Used ,
521521 UsageState :: Used ,
522522 runtime. as_ref ( ) ,
523523 ) ;
@@ -707,30 +707,10 @@ fn collect_active_dependencies(
707707 ( block. get_blocks ( ) , block. get_dependencies ( ) )
708708 }
709709 } ;
710- dependencies. extend ( block_dependencies) ;
711- for block_id in blocks {
712- let block = module_graph
713- . block_by_id ( block_id)
714- . expect ( "should have block" ) ;
715- if !global && let Some ( GroupOptions :: Entrypoint ( options) ) = block. get_group_options ( ) {
716- let runtime = RuntimeSpec :: from_entry_options ( options) ;
717- q. push ( (
718- ModuleOrAsyncDependenciesBlock :: AsyncDependenciesBlock ( * block_id) ,
719- runtime,
720- true ,
721- ) ) ;
722- } else {
723- queue. push_back ( ModuleOrAsyncDependenciesBlock :: AsyncDependenciesBlock (
724- * block_id,
725- ) ) ;
726- }
727- }
728- }
729-
730- let dependencies = dependencies
731- . into_iter ( )
732- . filter_map ( |dep_id| {
733- let connection = module_graph. connection_by_dependency_id ( & dep_id) ?;
710+ for & dep_id in block_dependencies {
711+ let Some ( connection) = module_graph. connection_by_dependency_id ( & dep_id) else {
712+ continue ;
713+ } ;
734714 let active_state = connection. active_state (
735715 module_graph,
736716 runtime,
@@ -741,21 +721,38 @@ fn collect_active_dependencies(
741721
742722 match active_state {
743723 ConnectionState :: Active ( false ) => {
744- return None ;
724+ continue ;
745725 }
746726 ConnectionState :: TransitiveOnly => {
747727 q. push ( (
748728 ModuleOrAsyncDependenciesBlock :: Module ( * connection. module_identifier ( ) ) ,
749729 runtime. cloned ( ) ,
750730 false ,
751731 ) ) ;
752- return None ;
732+ continue ;
753733 }
754734 _ => { }
755735 }
756- Some ( ( dep_id, * connection. module_identifier ( ) ) )
757- } )
758- . collect :: < Vec < _ > > ( ) ;
736+ dependencies. push ( ( dep_id, * connection. module_identifier ( ) ) ) ;
737+ }
738+ for block_id in blocks {
739+ let block = module_graph
740+ . block_by_id ( block_id)
741+ . expect ( "should have block" ) ;
742+ if !global && let Some ( GroupOptions :: Entrypoint ( options) ) = block. get_group_options ( ) {
743+ let runtime = RuntimeSpec :: from_entry_options ( options) ;
744+ q. push ( (
745+ ModuleOrAsyncDependenciesBlock :: AsyncDependenciesBlock ( * block_id) ,
746+ runtime,
747+ true ,
748+ ) ) ;
749+ } else {
750+ queue. push_back ( ModuleOrAsyncDependenciesBlock :: AsyncDependenciesBlock (
751+ * block_id,
752+ ) ) ;
753+ }
754+ }
755+ }
759756
760757 ( dependencies, q)
761758}
@@ -846,7 +843,7 @@ fn process_referenced_module_without_nested(
846843 }
847844
848845 let changed_flag = export_info. set_used_conditionally (
849- Box :: new ( |v| v != & UsageState :: Used ) ,
846+ |v| v != & UsageState :: Used ,
850847 UsageState :: Used ,
851848 runtime. as_ref ( ) ,
852849 ) ;
0 commit comments