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

[WIP] build: Update swc_core to v11.x.x #75327

Draft
wants to merge 6 commits into
base: canary
Choose a base branch
from
Draft
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
20 changes: 10 additions & 10 deletions Cargo.lock

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

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ impl CustomTransformer for NextEdgeNodeApiAssert {
is_unresolved_ref_safe: false,
unresolved_ctxt: SyntaxContext::empty().apply_mark(ctx.unresolved_mark),
in_strict: false,
remaining_depth: 4,
},
self.should_error_for_node_apis,
self.is_production,
Expand Down
2 changes: 1 addition & 1 deletion crates/next-custom-transforms/src/chain_transforms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
&file.name,
&styled_jsx::visitor::Config {
use_lightningcss: config.use_lightningcss,
browsers: target_browsers,
browsers: *target_browsers,

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / rust check / build

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced

Check failure on line 173 in crates/next-custom-transforms/src/chain_transforms.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

type `BrowserData<std::option::Option<preset_env_base::version::Version>>` cannot be dereferenced
},
&styled_jsx::visitor::NativeConfig { process_css: None },
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
unresolved_ctxt: SyntaxContext::empty().apply_mark(Mark::new()),
is_unresolved_ref_safe: false,
in_strict: false,
remaining_depth: 4,

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rust check / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 40 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

struct `ExprCtx` has no field named `remaining_depth`
},
}
}
Expand All @@ -61,7 +62,7 @@
{
let id = id.sym.as_ref();
if let Some(prop) = self.properties.get_mut(id) {
*prop = extract_value(&self.expr_ctx, init, id.to_string());
*prop = extract_value(self.expr_ctx, init, id.to_string());

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

cannot move out of `self.expr_ctx` which is behind a mutable reference

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

cannot move out of `self.expr_ctx` which is behind a mutable reference

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

cannot move out of `self.expr_ctx` which is behind a mutable reference

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rust check / build

cannot move out of `self.expr_ctx` which is behind a mutable reference

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

cannot move out of `self.expr_ctx` which is behind a mutable reference

Check failure on line 65 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

cannot move out of `self.expr_ctx` which is behind a mutable reference
};
}
}
Expand All @@ -74,9 +75,9 @@
}

/// Coerece the actual value of the given ast node.
fn extract_value(ctx: &ExprCtx, init: &Expr, id: String) -> Option<Const> {
fn extract_value(ctx: ExprCtx, init: &Expr, id: String) -> Option<Const> {
match init {
init if init.is_undefined(ctx) => Some(Const::Value(Value::Null)),

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

mismatched types

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

mismatched types

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

mismatched types

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / rust check / build

mismatched types

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

mismatched types

Check failure on line 80 in crates/next-custom-transforms/src/transforms/page_static_info/collect_exported_const_visitor.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

mismatched types
Expr::Ident(ident) => Some(Const::Unsupported(format!(
"Unknown identifier \"{}\" at \"{}\".",
ident.sym, id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,14 @@
Expr::Member(member) => {
if member.prop.is_ident_with("NEXT_RUNTIME") {
if let Expr::Member(obj_member) = &*member.obj {
if obj_member.obj.is_global_ref_to(&self.ctx, "process")
if obj_member.obj.is_global_ref_to(self.ctx, "process")

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

mismatched types

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

mismatched types

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

mismatched types

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rust check / build

mismatched types

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

mismatched types

Check failure on line 237 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

mismatched types
&& obj_member.prop.is_ident_with("env")
{
self.guarded_runtime = true;
}
}
}
if member.obj.is_global_ref_to(&self.ctx, "process") {
if member.obj.is_global_ref_to(self.ctx, "process") {

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

mismatched types

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

mismatched types

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

mismatched types

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rust check / build

mismatched types

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

mismatched types

Check failure on line 244 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

mismatched types
if let MemberProp::Ident(prop) = &member.prop {
self.guarded_process_props.push(prop.sym.clone());
}
Expand Down Expand Up @@ -364,7 +364,7 @@
}

fn visit_member_expr(&mut self, n: &MemberExpr) {
if n.obj.is_global_ref_to(&self.ctx, "process") {
if n.obj.is_global_ref_to(self.ctx, "process") {

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (web)

mismatched types

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / build-wasm (nodejs)

mismatched types

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

mismatched types

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / rust check / build

mismatched types

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo benches / Test

mismatched types

Check failure on line 367 in crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs

View workflow job for this annotation

GitHub Actions / test cargo unit / build

mismatched types
if let MemberProp::Ident(prop) = &n.prop {
self.warn_for_unsupported_process_api(n.span, prop);
return;
Expand Down
10 changes: 6 additions & 4 deletions crates/next-custom-transforms/tests/fixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::{
env::current_dir,
iter::FromIterator,
path::{Path, PathBuf},
sync::Arc,
};

use next_custom_transforms::transforms::{
Expand Down Expand Up @@ -363,8 +364,8 @@ fn next_ssg_fixture(input: PathBuf) {
next: false.into(),
runtime: None,
import_source: Some("".into()),
pragma: Some("__jsx".into()),
pragma_frag: Some("__jsxFrag".into()),
pragma: Some(Arc::new("__jsx".into())),
pragma_frag: Some(Arc::new("__jsxFrag".into())),
throw_if_namespace: false.into(),
development: false.into(),
refresh: Default::default(),
Expand Down Expand Up @@ -777,8 +778,8 @@ fn run_stip_page_exports_test(input: &Path, output: &Path, mode: ExportFilter) {
next: false.into(),
runtime: None,
import_source: Some("".into()),
pragma: Some("__jsx".into()),
pragma_frag: Some("__jsxFrag".into()),
pragma: Some(Arc::new("__jsx".into())),
pragma_frag: Some(Arc::new("__jsxFrag".into())),
throw_if_namespace: false.into(),
development: false.into(),
..Default::default()
Expand Down Expand Up @@ -854,6 +855,7 @@ fn test_edge_assert(input: PathBuf) {
is_unresolved_ref_safe: false,
unresolved_ctxt: SyntaxContext::empty().apply_mark(unresolved_mark),
in_strict: false,
remaining_depth: 4,
},
true,
true,
Expand Down
8 changes: 4 additions & 4 deletions turbopack/crates/turbopack-ecmascript/src/transform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use anyhow::Result;
use async_trait::async_trait;
use swc_core::{
atoms::Atom,
atoms::{atom, Atom},
base::SwcComments,
common::{collections::AHashMap, comments::Comments, util::take::Take, Mark, SourceMap},
ecma::{
Expand Down Expand Up @@ -164,11 +164,11 @@
let config = Options {
runtime: Some(runtime),
development: Some(*development),
import_source: import_source.await?.as_deref().map(ToString::to_string),
import_source: import_source.await?.as_deref().map(Atom::from),

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test devlow package / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (18) / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (20) / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test next-swc wasm / build

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu - node@16

mismatched types

Check failure on line 167 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native-windows / build

mismatched types
refresh: if *refresh {
Some(swc_core::ecma::transforms::react::RefreshOptions {
refresh_reg: "__turbopack_refresh__.register".to_string(),
refresh_sig: "__turbopack_refresh__.signature".to_string(),
refresh_reg: atom!("__turbopack_refresh__.register"),

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test devlow package / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (18) / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (20) / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test next-swc wasm / build

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu - node@16

mismatched types

Check failure on line 170 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native-windows / build

mismatched types
refresh_sig: atom!("__turbopack_refresh__.signature"),

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test devlow package / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (18) / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test unit (20) / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / test next-swc wasm / build

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu - node@16

mismatched types

Check failure on line 171 in turbopack/crates/turbopack-ecmascript/src/transform/mod.rs

View workflow job for this annotation

GitHub Actions / build-native-windows / build

mismatched types
..Default::default()
})
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1246,10 +1246,11 @@
let side_effects = !has_explicit_pure
&& (vars.found_unresolved
|| decl.init.as_deref().is_some_and(|e| {
e.may_have_side_effects(&ExprCtx {
e.may_have_side_effects(ExprCtx {

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build-native / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test devlow package / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test unit (18) / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test unit (20) / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test next-swc wasm / build

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu - node@16

mismatched types

Check failure on line 1249 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build-native-windows / build

mismatched types
unresolved_ctxt,
is_unresolved_ref_safe: false,
in_strict: false,
remaining_depth: 4,

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build-native / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test devlow package / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test unit (18) / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test unit (20) / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / test next-swc wasm / build

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / stable - x86_64-unknown-linux-gnu - node@16

struct `ExprCtx` has no field named `remaining_depth`

Check failure on line 1253 in turbopack/crates/turbopack-ecmascript/src/tree_shake/graph.rs

View workflow job for this annotation

GitHub Actions / build-native-windows / build

struct `ExprCtx` has no field named `remaining_depth`
})
}));

Expand Down
Loading