Skip to content

Commit

Permalink
build: Update swc_core to v0.86.1 (#56770)
Browse files Browse the repository at this point in the history
### What?

Update SWC crates, to apply bugfixes.

### Why?

We adjusted the mangling option to make it identical with `swcMinify:
false` with #56281, and it
revealed some bugs of the name mangler of the SWC minifier.

### How?


 - Fixes #56550
 - Fixes #56614

 - Turbopack counterpart: vercel/turborepo#6171

### Other Turbopack Changes

* vercel/turborepo#6177 <!-- Tim Neutkens - Add
support for FreeVarReference::Error -->
* vercel/turborepo#6180 <!-- Tobias Koppers - fix
chunk loading in build runtime -->
* vercel/turborepo#6191 <!-- Justin Ridgewell -
Deduplicate referenced_output_assets -->
* vercel/turborepo#6171 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.86.1` -->

Closes WEB-1775

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
  • Loading branch information
kdy1 and sokra authored Oct 17, 2023
1 parent 552b974 commit 4b3dfda
Show file tree
Hide file tree
Showing 8 changed files with 457 additions and 193 deletions.
610 changes: 438 additions & 172 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ next-transform-dynamic = { path = "packages/next-swc/crates/next-transform-dynam
next-transform-strip-page-exports = { path = "packages/next-swc/crates/next-transform-strip-page-exports" }

# SWC crates
swc_core = { version = "0.83.28", features = [
swc_core = { version = "0.86.1", features = [
"ecma_loader_lru",
"ecma_loader_parking_lot",
] }
testing = { version = "0.34.1" }
testing = { version = "0.35.0" }

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

# General Deps

Expand Down
4 changes: 2 additions & 2 deletions packages/next-swc/crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ turbopack-binding = { workspace = true, features = [
"__swc_transform_modularize_imports",
"__swc_transform_relay",
] }
react_remove_properties = "0.3.0"
remove_console = "0.4.0"
react_remove_properties = "0.5.0"
remove_console = "0.6.0"

[dev-dependencies]
turbopack-binding = { workspace = true, features = [
Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/core/src/cjs_optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ impl VisitMut for CjsOptimizer {
self.data.imports.insert(
key,
ImportRecord {
module_specifier: v.value.clone().into(),
module_specifier: v.value.clone(),
},
);
}
Expand Down
6 changes: 2 additions & 4 deletions packages/next-swc/crates/core/src/optimize_server_react.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl Fold for OptimizeServerReact {
new_items.push(item.clone().fold_with(self));

if let ModuleItem::ModuleDecl(ModuleDecl::Import(import_decl)) = &item {
if import_decl.src.value.to_string() != "react" {
if import_decl.src.value != "react" {
continue;
}
for specifier in &import_decl.specifiers {
Expand Down Expand Up @@ -119,9 +119,7 @@ impl Fold for OptimizeServerReact {
if &f.to_id() == react_ident {
if let MemberProp::Ident(i) = &member.prop {
// Remove `React.useEffect` and `React.useLayoutEffect` calls
if i.sym.to_string() == "useEffect"
|| i.sym.to_string() == "useLayoutEffect"
{
if i.sym == "useEffect" || i.sym == "useLayoutEffect" {
return Expr::Lit(Lit::Null(Null { span: DUMMY_SP }));
}
}
Expand Down
6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/src/page_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl Fold for PageConfig {
for decl in &var_decl.decls {
let mut is_config = false;
if let Pat::Ident(ident) = &decl.name {
if &ident.id.sym == CONFIG_KEY {
if ident.id.sym == CONFIG_KEY {
is_config = true;
}
}
Expand Down Expand Up @@ -151,14 +151,14 @@ impl Fold for PageConfig {
match &specifier.exported {
Some(ident) => {
if let ModuleExportName::Ident(ident) = ident {
if &ident.sym == CONFIG_KEY {
if ident.sym == CONFIG_KEY {
self.handle_error("Config cannot be re-exported.", specifier.span)
}
}
}
None => {
if let ModuleExportName::Ident(ident) = &specifier.orig {
if &ident.sym == CONFIG_KEY {
if ident.sym == CONFIG_KEY {
self.handle_error("Config cannot be re-exported.", specifier.span)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
"@types/ws": "8.2.0",
"@vercel/ncc": "0.34.0",
"@vercel/nft": "0.22.6",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-231013.3",
"@vercel/turbopack-ecmascript-runtime": "https://gitpkg-fork.vercel.sh/vercel/turbo/crates/turbopack-ecmascript-runtime/js?turbopack-231017.3",
"acorn": "8.5.0",
"amphtml-validator": "1.0.35",
"anser": "1.4.9",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

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

0 comments on commit 4b3dfda

Please sign in to comment.