Skip to content
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

Turbopack: use try_join instead of future::try_join_all #73261

Merged
merged 2 commits into from
Nov 27, 2024
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
22 changes: 12 additions & 10 deletions turbopack/crates/turbopack-core/src/chunk/chunk_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::collections::HashSet;

use anyhow::Result;
use auto_hash_map::AutoSet;
use futures::future::try_join_all;
use turbo_tasks::{
FxIndexMap, FxIndexSet, ResolvedVc, TryFlatJoinIterExt, TryJoinIterExt, Value, Vc,
};
Expand Down Expand Up @@ -152,15 +151,18 @@ pub async fn make_chunk_group(
.await?
.clone_value();

let rebased_modules = try_join_all(traced_modules.into_iter().map(|module| {
RebasedAsset::new(
*module,
module.ident().path().root(),
module.ident().path().root(),
)
.to_resolved()
}))
.await?;
let rebased_modules = traced_modules
.into_iter()
.map(|module| {
RebasedAsset::new(
*module,
module.ident().path().root(),
module.ident().path().root(),
)
.to_resolved()
})
.try_join()
.await?;

referenced_output_assets.extend(rebased_modules.into_iter().map(ResolvedVc::upcast));

Expand Down
14 changes: 6 additions & 8 deletions turbopack/crates/turbopack-node/src/transforms/webpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use std::mem::take;
use anyhow::{bail, Context, Result};
use async_trait::async_trait;
use either::Either;
use futures::future::try_join_all;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value as JsonValue};
use serde_with::serde_as;
Expand Down Expand Up @@ -279,13 +278,12 @@ impl WebpackLoadersProcessedAsset {
Either::Left(str) => File::from(str),
Either::Right(bytes) => File::from(bytes.binary),
};
let assets = try_join_all(
emitted_assets_to_virtual_sources(processed.assets)
.await?
.into_iter()
.map(|v| v.to_resolved()),
)
.await?;
let assets = emitted_assets_to_virtual_sources(processed.assets)
.await?
.into_iter()
.map(|v| v.to_resolved())
.try_join()
.await?;

let content =
AssetContent::File(FileContent::Content(file).resolved_cell()).resolved_cell();
Expand Down
Loading