Skip to content

Commit

Permalink
turbopack: Module Trait (#52401)
Browse files Browse the repository at this point in the history
### What?

refactoring see vercel/turbo#5477

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
sokra and kodiakhq[bot] committed Jul 10, 2023
1 parent 73e2979 commit 8643014
Show file tree
Hide file tree
Showing 27 changed files with 219 additions and 198 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 @@ -42,11 +42,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-230707.3" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230710.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-230707.3" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230710.2" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230707.3" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230710.2" }

# General Deps

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use turbopack_binding::{
turbopack::{
core::{
asset::AssetVc,
chunk::{ChunkableAsset, ChunkingContext, ChunkingContextVc},
chunk::{ChunkableModule, ChunkingContext, ChunkingContextVc},
context::{AssetContext, AssetContextVc},
reference_type::ReferenceType,
},
Expand Down Expand Up @@ -70,8 +70,11 @@ impl PagesBuildClientContextVc {
let this = self.await?;

let client_asset_page = this.client_asset_context.process(asset, reference_type);
let client_asset_page =
create_page_loader_entry_asset(this.client_asset_context, client_asset_page, pathname);
let client_asset_page = create_page_loader_entry_asset(
this.client_asset_context,
client_asset_page.into(),
pathname,
);

let Some(client_module_asset) =
EcmascriptModuleAssetVc::resolve_from(client_asset_page).await?
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-230707.3",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230707.3",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230710.2",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230710.2",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::{bail, Result};
use turbopack_binding::{
turbo::tasks_fs::FileSystemPathVc,
turbopack::{
core::{asset::AssetVc, compile_time_info::CompileTimeInfoVc},
core::{compile_time_info::CompileTimeInfoVc, module::ModuleVc},
ecmascript::chunk::EcmascriptChunkPlaceableVc,
turbopack::{
module_options::ModuleOptionsContextVc,
Expand Down Expand Up @@ -55,10 +55,10 @@ impl Transition for NextServerComponentTransition {
#[turbo_tasks::function]
async fn process_module(
&self,
asset: AssetVc,
module: ModuleVc,
_context: ModuleAssetContextVc,
) -> Result<AssetVc> {
let Some(asset) = EcmascriptChunkPlaceableVc::resolve_from(asset).await? else {
) -> Result<ModuleVc> {
let Some(asset) = EcmascriptChunkPlaceableVc::resolve_from(module).await? else {
bail!("Not an ecmascript module");
};

Expand Down

0 comments on commit 8643014

Please sign in to comment.