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: Refactoring module references #52930

Merged
merged 14 commits into from
Jul 21, 2023
72 changes: 36 additions & 36 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.22" }
testing = { version = "0.33.21" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230721.3" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230721.4" }
# [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-230721.3" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230721.4" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230721.3" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-230721.4" }

# General Deps

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-230721.3",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230721.3",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-230721.4",
"@vercel/turbopack-node": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-node/js?turbopack-230721.4",
"anser": "^2.1.1",
"css.escape": "^1.5.1",
"next": "*",
Expand Down
10 changes: 5 additions & 5 deletions packages/next-swc/crates/next-core/src/app_segment_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,17 @@ impl Issue for NextSegmentConfigParsingIssue {

#[turbo_tasks::function]
pub async fn parse_segment_config_from_source(
module_asset: Vc<Box<dyn Module>>,
module: Vc<Box<dyn Module>>,
source: Vc<Box<dyn Source>>,
) -> Result<Vc<NextSegmentConfig>> {
let Some(ecmascript_asset) =
Vc::try_resolve_downcast_type::<EcmascriptModuleAsset>(module_asset).await?
Vc::try_resolve_downcast_type::<EcmascriptModuleAsset>(module).await?
else {
return Ok(Default::default());
};

let ParseResult::Ok {
program: Program::Module(module),
program: Program::Module(module_ast),
eval_context,
..
} = &*ecmascript_asset.parse().await?
Expand All @@ -230,7 +230,7 @@ pub async fn parse_segment_config_from_source(

let mut config = NextSegmentConfig::default();

for item in &module.body {
for item in &module_ast.body {
let Some(decl) = item
.as_module_decl()
.and_then(|mod_decl| mod_decl.as_export_decl())
Expand All @@ -245,7 +245,7 @@ pub async fn parse_segment_config_from_source(
};

if let Some(init) = decl.init.as_ref() {
parse_config_value(module_asset, source, &mut config, ident, init, eval_context);
parse_config_value(module, source, &mut config, ident, init, eval_context);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/next-core/src/babel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ pub async fn is_babel_loader_available(project_path: Vc<FileSystemPath>) -> Resu
.cell(),
),
);
let assets = result.primary_assets().await?;
let assets = result.primary_sources().await?;
Ok(Vc::cell(!assets.is_empty()))
}

Expand Down