@@ -23,9 +23,8 @@ use turbopack_core::{
2323 module:: Module ,
2424 module_graph:: {
2525 ModuleGraph ,
26+ binding_usage_info:: { BindingUsageInfo , ModuleExportUsage } ,
2627 chunk_group_info:: ChunkGroup ,
27- export_usage:: { ExportUsageInfo , ModuleExportUsage } ,
28- import_usage:: UnusedReferences ,
2928 } ,
3029 output:: { OutputAsset , OutputAssets } ,
3130 reference:: ModuleReference ,
@@ -165,14 +164,14 @@ impl BrowserChunkingContextBuilder {
165164 self
166165 }
167166
168- pub fn export_usage ( mut self , export_usage : Option < ResolvedVc < ExportUsageInfo > > ) -> Self {
167+ pub fn export_usage ( mut self , export_usage : Option < ResolvedVc < BindingUsageInfo > > ) -> Self {
169168 self . chunking_context . export_usage = export_usage;
170169 self
171170 }
172171
173172 pub fn unused_references (
174173 mut self ,
175- unused_references : Option < ResolvedVc < UnusedReferences > > ,
174+ unused_references : Option < ResolvedVc < BindingUsageInfo > > ,
176175 ) -> Self {
177176 self . chunking_context . unused_references = unused_references;
178177 self
@@ -294,9 +293,9 @@ pub struct BrowserChunkingContext {
294293 /// The module id strategy to use
295294 module_id_strategy : ResolvedVc < Box < dyn ModuleIdStrategy > > ,
296295 /// The module export usage info, if available.
297- export_usage : Option < ResolvedVc < ExportUsageInfo > > ,
296+ export_usage : Option < ResolvedVc < BindingUsageInfo > > ,
298297 /// Which references are unused and should be skipped (e.g. during codegen).
299- unused_references : Option < ResolvedVc < UnusedReferences > > ,
298+ unused_references : Option < ResolvedVc < BindingUsageInfo > > ,
300299 /// The chunking configs
301300 chunking_configs : Vec < ( ResolvedVc < Box < dyn ChunkType > > , ChunkingConfig ) > ,
302301 /// Whether to use absolute URLs for static assets (e.g. in CSS: `url("/absolute/path")`)
@@ -872,8 +871,6 @@ impl ChunkingContext for BrowserChunkingContext {
872871 if let Some ( export_usage) = self . await ?. export_usage {
873872 Ok ( export_usage. await ?. used_exports ( module) . await ?)
874873 } else {
875- // In development mode, we don't have export usage info, so we assume all exports are
876- // used.
877874 Ok ( ModuleExportUsage :: all ( ) )
878875 }
879876 }
@@ -885,7 +882,7 @@ impl ChunkingContext for BrowserChunkingContext {
885882 ) -> Result < Vc < bool > > {
886883 if let Some ( unused_references) = self . await ?. unused_references {
887884 Ok ( Vc :: cell (
888- unused_references. await ?. contains_reference ( & reference) ,
885+ unused_references. await ?. is_reference_unused ( & reference) ,
889886 ) )
890887 } else {
891888 Ok ( Vc :: cell ( false ) )
0 commit comments