From 51ad471407c1510986e4c66bf8d136567b4f1d81 Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Fri, 29 Nov 2024 09:53:18 +0100 Subject: [PATCH] refactor get_module_graph_for_app_without_issues --- crates/next-api/src/module_graph.rs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/crates/next-api/src/module_graph.rs b/crates/next-api/src/module_graph.rs index de59891a67448..3874999c363c5 100644 --- a/crates/next-api/src/module_graph.rs +++ b/crates/next-api/src/module_graph.rs @@ -173,6 +173,20 @@ async fn get_module_graph_for_endpoint( Ok(Vc::cell(graphs)) } +#[turbo_tasks::function] +async fn get_module_graph_for_app_without_issues( + entries: Vc, +) -> Result> { + let vc = SingleModuleGraph::new_with_entries(entries); + let graph = vc.resolve_strongly_consistent().await?; + let _issues = vc.take_collectibles::>(); + // println!( + // "taking {:?}", + // _issues.iter().map(|i| i.dbg()).try_join().await? + // ); + Ok(graph) +} + #[turbo_tasks::value] pub struct NextDynamicGraph { is_single_page: bool, @@ -321,10 +335,9 @@ pub async fn get_reduced_graphs_for_endpoint( false, vec![ async move { - let vc = SingleModuleGraph::new_with_entries(project.get_all_entries()); - let vc = vc.resolve_strongly_consistent().await?; - let _ = vc.take_collectibles::>(); - vc.to_resolved().await + get_module_graph_for_app_without_issues(project.get_all_entries()) + .to_resolved() + .await } .instrument(tracing::info_span!("module graph for app")) .await?,