Skip to content

Commit

Permalink
remove ChunkingType::Passthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Feb 19, 2025
1 parent f87fda1 commit 76694f6
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 37 deletions.
25 changes: 2 additions & 23 deletions turbopack/crates/turbopack-core/src/chunk/chunk_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use std::collections::HashSet;

use anyhow::Result;
use rustc_hash::FxHashMap;
use turbo_tasks::{
FxIndexMap, FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Value, Vc,
};
use turbo_tasks::{FxIndexMap, FxIndexSet, ResolvedVc, TryJoinIterExt, Value, Vc};

use super::{
availability_info::AvailabilityInfo, chunking::make_chunks, AsyncModuleInfo, Chunk,
Expand Down Expand Up @@ -42,7 +40,6 @@ pub async fn make_chunk_group(
chunkable_modules,
async_modules,
traced_modules,
passthrough_modules,
} = chunk_group_content(
&*module_graph.await?,
chunk_group_entries,
Expand Down Expand Up @@ -135,27 +132,14 @@ pub async fn make_chunk_group(
.try_join()
.await?;

// Get references from passthrough modules and attach them as references output assets
let output_assets_from_passthrough_modules = passthrough_modules
.iter()
.map(|module| {
module
.as_chunk_item(module_graph, *chunking_context)
.references()
})
.try_flat_join()
.await?;

chunk_items.extend(async_loader_chunk_items);
referenced_output_assets.reserve(
async_loader_references
.iter()
.map(|r| r.len())
.sum::<usize>()
+ output_assets_from_passthrough_modules.len(),
.sum::<usize>(),
);
referenced_output_assets.extend(async_loader_references.into_iter().flatten());
referenced_output_assets.extend(output_assets_from_passthrough_modules);

// Pass chunk items to chunking algorithm
let chunks = make_chunks(
Expand Down Expand Up @@ -213,7 +197,6 @@ pub async fn chunk_group_content(
chunkable_modules: FxIndexSet::default(),
async_modules: FxIndexSet::default(),
traced_modules: FxIndexSet::default(),
passthrough_modules: FxIndexSet::default(),
},
};

Expand Down Expand Up @@ -259,10 +242,6 @@ pub async fn chunk_group_content(
};

Ok(match edge {
ChunkingType::Passthrough => {
result.passthrough_modules.insert(chunkable_module);
GraphTraversalAction::Continue
}
ChunkingType::Parallel | ChunkingType::ParallelInheritAsync => {
if is_available {
GraphTraversalAction::Skip
Expand Down
4 changes: 0 additions & 4 deletions turbopack/crates/turbopack-core/src/chunk/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,6 @@ pub enum ChunkingType {
_ty: ChunkGroupType,
merge_tag: Option<RcStr>,
},
/// Module not placed in chunk group, but its references are still followed and placed into the
/// chunk group.
Passthrough,
// Module not placed in chunk group, but its references are still followed.
Traced,
}
Expand All @@ -207,7 +204,6 @@ pub struct ChunkGroupContent {
pub chunkable_modules: FxIndexSet<ResolvedVc<Box<dyn ChunkableModule>>>,
pub async_modules: FxIndexSet<ResolvedVc<Box<dyn ChunkableModule>>>,
pub traced_modules: FxIndexSet<ResolvedVc<Box<dyn Module>>>,
pub passthrough_modules: FxIndexSet<ResolvedVc<Box<dyn ChunkableModule>>>,
}

#[turbo_tasks::value_trait]
Expand Down
6 changes: 0 additions & 6 deletions turbopack/crates/turbopack-core/src/introspect/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@ fn async_reference_ty() -> Vc<RcStr> {
Vc::cell("async reference".into())
}

#[turbo_tasks::function]
fn passthrough_reference_ty() -> Vc<RcStr> {
Vc::cell("passthrough reference".into())
}

#[turbo_tasks::function]
fn isolated_reference_ty() -> Vc<RcStr> {
Vc::cell("isolated reference".into())
Expand Down Expand Up @@ -87,7 +82,6 @@ pub async fn children_from_module_references(
}
Some(ChunkingType::Async) => key = async_reference_ty(),
Some(ChunkingType::Isolated { .. }) => key = isolated_reference_ty(),
Some(ChunkingType::Passthrough) => key = passthrough_reference_ty(),
Some(ChunkingType::Traced) => key = traced_reference_ty(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ async fn compute_async_module_info_single(
ChunkingType::Parallel
| ChunkingType::Async
| ChunkingType::Isolated { .. }
| ChunkingType::Passthrough
| ChunkingType::Traced => {
// Nothing to propagate
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ pub async fn compute_chunk_group_info(graph: &ModuleGraph) -> Result<Vc<ChunkGro
let chunk_groups =
if let Some((parent, chunking_type)) = parent_info {
match chunking_type {
ChunkingType::Parallel
| ChunkingType::ParallelInheritAsync
| ChunkingType::Passthrough => {
ChunkingType::Parallel | ChunkingType::ParallelInheritAsync => {
ChunkGroupInheritance::Inherit(parent.module)
}
ChunkingType::Async => ChunkGroupInheritance::ChunkGroup(Either::Left(
Expand Down

0 comments on commit 76694f6

Please # to comment.