Skip to content

Commit

Permalink
Revert "Turbopack: ensure output assets reference only output assets (#…
Browse files Browse the repository at this point in the history
…52832)"

This reverts commit 0aeda3a.
  • Loading branch information
ijjk authored Jul 18, 2023
1 parent d8660bb commit db9ce8d
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 81 deletions.
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ swc_core = { version = "0.79.13" }
testing = { version = "0.33.20" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.3" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.2" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.3" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.3" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230718.2" }

# General Deps

Expand Down
29 changes: 22 additions & 7 deletions packages/next-swc/crates/next-build/src/next_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ use turbopack_binding::{
environment::ServerAddr,
issue::{IssueContextExt, IssueReporter, IssueSeverity},
output::{OutputAsset, OutputAssets},
reference::AssetReference,
virtual_fs::VirtualFileSystem,
},
dev::DevChunkingContext,
Expand Down Expand Up @@ -559,13 +560,27 @@ async fn all_assets_from_entries(entries: Vc<OutputAssets>) -> Result<Vc<OutputA
async fn get_referenced_assets(
asset: Vc<Box<dyn OutputAsset>>,
) -> Result<impl Iterator<Item = Vc<Box<dyn OutputAsset>>> + Send> {
Ok(asset
.references()
.await?
.iter()
.copied()
.collect::<Vec<_>>()
.into_iter())
Ok(
asset
.references()
.await?
.iter()
.map(|reference| async move {
let primary_assets = reference.resolve_reference().primary_assets().await?;
Ok(primary_assets.clone_value())
})
.try_join()
.await?
.into_iter()
.flatten()
.map(|asset| async move {
Ok(Vc::try_resolve_downcast::<Box<dyn OutputAsset>>(asset).await?)
})
.try_join()
.await?
.into_iter()
.flatten(),
)
}

/// Writes a manifest to disk. This consumes the manifest to ensure we don't
Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/next-core/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"check": "tsc --noEmit"
},
"dependencies": {
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230718.3",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230718.3",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230718.2",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230718.2",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Loading

0 comments on commit db9ce8d

Please sign in to comment.