@@ -48,10 +48,11 @@ use crate::{
4848 DependencyCodeGeneration , DependencyTemplate , DependencyTemplateType , DependencyType , Entry ,
4949 EntryData , EntryOptions , EntryRuntime , Entrypoint , ExecuteModuleId , Filename , ImportPhase ,
5050 ImportVarMap , ImportedByDeferModulesArtifact , Logger , MemoryGCStorage , ModuleFactory ,
51- ModuleGraph , ModuleGraphCacheArtifact , ModuleGraphPartial , ModuleIdentifier , ModuleIdsArtifact ,
52- ModuleStaticCacheArtifact , PathData , ResolverFactory , RuntimeGlobals , RuntimeKeyMap , RuntimeMode ,
53- RuntimeModule , RuntimeSpec , RuntimeSpecMap , RuntimeTemplate , SharedPluginDriver ,
54- SideEffectsOptimizeArtifact , SourceType , Stats , ValueCacheVersions ,
51+ ModuleGraph , ModuleGraphCacheArtifact , ModuleGraphMut , ModuleGraphPartial , ModuleGraphRef ,
52+ ModuleIdentifier , ModuleIdsArtifact , ModuleStaticCacheArtifact , PathData , ResolverFactory ,
53+ RuntimeGlobals , RuntimeKeyMap , RuntimeMode , RuntimeModule , RuntimeSpec , RuntimeSpecMap ,
54+ RuntimeTemplate , SharedPluginDriver , SideEffectsOptimizeArtifact , SourceType , Stats ,
55+ ValueCacheVersions ,
5556 build_chunk_graph:: artifact:: BuildChunkGraphArtifact ,
5657 compilation:: build_module_graph:: {
5758 BuildModuleGraphArtifact , ModuleExecutor , UpdateParam , build_module_graph,
@@ -452,23 +453,17 @@ impl Compilation {
452453 std:: mem:: swap ( & mut self . build_module_graph_artifact , make_artifact) ;
453454 }
454455
455- pub fn get_module_graph ( & self ) -> ModuleGraph < ' _ > {
456+ pub fn get_module_graph ( & self ) -> ModuleGraphRef < ' _ > {
456457 if let Some ( other_module_graph) = & self . other_module_graph {
457- ModuleGraph :: new (
458- [
459- Some ( self . build_module_graph_artifact . get_module_graph_partial ( ) ) ,
460- Some ( other_module_graph) ,
461- ] ,
462- None ,
463- )
458+ ModuleGraph :: new_ref ( [
459+ Some ( self . build_module_graph_artifact . get_module_graph_partial ( ) ) ,
460+ Some ( other_module_graph) ,
461+ ] )
464462 } else {
465- ModuleGraph :: new (
466- [
467- Some ( self . build_module_graph_artifact . get_module_graph_partial ( ) ) ,
468- None ,
469- ] ,
463+ ModuleGraph :: new_ref ( [
464+ Some ( self . build_module_graph_artifact . get_module_graph_partial ( ) ) ,
470465 None ,
471- )
466+ ] )
472467 }
473468 }
474469
@@ -492,23 +487,21 @@ impl Compilation {
492487 None
493488 }
494489
495- pub fn get_module_graph_mut ( & mut self ) -> ModuleGraph < ' _ > {
490+ pub fn get_module_graph_mut ( & mut self ) -> ModuleGraphMut < ' _ > {
496491 if let Some ( other) = & mut self . other_module_graph {
497- ModuleGraph :: new (
492+ ModuleGraph :: new_mut (
498493 [
499494 Some ( self . build_module_graph_artifact . get_module_graph_partial ( ) ) ,
500495 None ,
501496 ] ,
502- Some ( other) ,
497+ other,
503498 )
504499 } else {
505- ModuleGraph :: new (
500+ ModuleGraph :: new_mut (
506501 [ None , None ] ,
507- Some (
508- self
509- . build_module_graph_artifact
510- . get_module_graph_partial_mut ( ) ,
511- ) ,
502+ self
503+ . build_module_graph_artifact
504+ . get_module_graph_partial_mut ( ) ,
512505 )
513506 }
514507 }
0 commit comments