Skip to content

[turbopack] Reduce the size of module graph datastructures #79706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/next-api/src/dynamic_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ pub async fn map_next_dynamic(graph: Vc<SingleModuleGraph>) -> Result<Vc<Dynamic
.await?
.iter_nodes()
.map(|node| async move {
let SingleModuleGraphModuleNode { module, layer, .. } = node;

if layer
.as_ref()
.is_some_and(|layer| &**layer == "app-client" || &**layer == "client")
{
let SingleModuleGraphModuleNode { module } = node;
let layer = match module.ident().await?.layer {
Some(l) => Some(l.await?),
None => None,
};
if layer.is_some_and(|layer| *layer == "app-client" || *layer == "client") {
if let Some(dynamic_entry_module) =
ResolvedVc::try_downcast_type::<NextDynamicEntryModule>(*module)
{
Expand Down
13 changes: 8 additions & 5 deletions crates/next-api/src/server_actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,14 +435,17 @@ pub async fn map_server_actions(graph: Vc<SingleModuleGraph>) -> Result<Vc<AllMo
.iter_nodes()
.map(|node| {
async move {
let SingleModuleGraphModuleNode { module, layer, .. } = node;

let SingleModuleGraphModuleNode { module } = node;
let layer = match module.ident().await?.layer {
Some(l) => Some(l.await?),
None => None,
};
// TODO: compare module contexts instead?
let layer = match &layer {
Some(layer) if &**layer == "app-rsc" || &**layer == "app-edge-rsc" => {
let layer = match layer {
Some(layer) if *layer == "app-rsc" || *layer == "app-edge-rsc" => {
ActionLayer::Rsc
}
Some(layer) if &**layer == "app-client" => ActionLayer::ActionBrowser,
Some(layer) if *layer == "app-client" => ActionLayer::ActionBrowser,
// TODO really ignore SSR?
_ => return Ok(None),
};
Expand Down
Loading
Loading