Skip to content

Commit

Permalink
Update swc_core to v0.75.22 (#4470)
Browse files Browse the repository at this point in the history
### Description

This update includes an improvement of `@swc/helpers`, so we need to
update `@swc/helpers` too when updating next-swc.

### Testing Instructions

Fix WEB-744
Fix WEB-859

---

 - Fixes #2825.
 - Fixes #4092.
  • Loading branch information
kdy1 committed Apr 18, 2023
1 parent f7e6b09 commit e6d3283
Show file tree
Hide file tree
Showing 20 changed files with 940 additions and 571 deletions.
1,421 changes: 886 additions & 535 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Expand Up @@ -95,14 +95,14 @@ opt-level = 3
[workspace.dependencies]
# Keep consistent with preset_env_base through swc_core
browserslist-rs = { version = "0.12.2" }
mdxjs = { version = "0.1.8" }
modularize_imports = { version = "0.26.10" }
styled_components = { version = "0.53.10" }
styled_jsx = { version = "0.30.10" }
swc_core = { version = "0.69.6" }
swc_emotion = { version = "0.29.10" }
swc_relay = { version = "0.1.0" }
testing = { version = "0.31.31" }
mdxjs = { version = "0.1.11" }
modularize_imports = { version = "0.27.5" }
styled_components = { version = "0.54.5" }
styled_jsx = { version = "0.31.5" }
swc_core = { version = "0.75.23" }
swc_emotion = { version = "0.30.5" }
swc_relay = { version = "0.2.5" }
testing = { version = "0.33.4" }

auto-hash-map = { path = "crates/auto-hash-map" }
node-file-trace = { path = "crates/node-file-trace", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-css/Cargo.toml
Expand Up @@ -27,6 +27,7 @@ turbopack-swc-utils = { workspace = true }
swc_core = { workspace = true, features = [
"ecma_ast",
"css_ast",
"css_ast_serde",
"css_codegen",
"css_parser",
"css_utils",
Expand Down
6 changes: 3 additions & 3 deletions crates/turbopack-css/src/module_asset.rs
Expand Up @@ -155,17 +155,17 @@ impl ModuleCssModuleAssetVc {
for export_class_name in export_class_names {
export.push(match export_class_name {
CssClassName::Import { from, name } => ModuleCssClass::Import {
original: name.to_string(),
original: name.value.to_string(),
from: CssModuleComposeReferenceVc::new(
self.as_resolve_origin(),
RequestVc::parse(Value::new(from.to_string().into())),
),
},
CssClassName::Local { name } => ModuleCssClass::Local {
name: name.to_string(),
name: name.value.to_string(),
},
CssClassName::Global { name } => ModuleCssClass::Global {
name: name.to_string(),
name: name.value.to_string(),
},
})
}
Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-css/src/parse.rs
Expand Up @@ -173,6 +173,7 @@ async fn parse_content(
let config = ParserConfig {
css_modules: matches!(ty, CssModuleAssetType::Module),
legacy_nesting: true,
legacy_ie: true,
..Default::default()
};

Expand Down
1 change: 1 addition & 0 deletions crates/turbopack-ecmascript/Cargo.toml
Expand Up @@ -40,6 +40,7 @@ url = { workspace = true }

swc_core = { workspace = true, features = [
"ecma_ast",
"ecma_ast_serde",
"common",
"common_concurrent",
"common_sourcemap",
Expand Down
15 changes: 14 additions & 1 deletion crates/turbopack-ecmascript/src/transform/mod.rs
@@ -1,7 +1,13 @@
mod server_to_client_proxy;
mod util;

use std::{fmt::Debug, path::Path, sync::Arc};
use std::{
collections::hash_map::DefaultHasher,
fmt::Debug,
hash::{Hash, Hasher},
path::Path,
sync::Arc,
};

use anyhow::Result;
use swc_core::{
Expand Down Expand Up @@ -183,6 +189,7 @@ impl EcmascriptInputTransform {
Some(comments.clone()),
config,
top_level_mark,
unresolved_mark,
));
}
EcmascriptInputTransform::CommonJs => {
Expand Down Expand Up @@ -215,9 +222,15 @@ impl EcmascriptInputTransform {
..Default::default()
};
let p = std::mem::replace(program, Program::Module(Module::dummy()));
let hash = {
let mut hasher = DefaultHasher::new();
p.hash(&mut hasher);
hasher.finish()
};
*program = p.fold_with(&mut swc_emotion::emotion(
options,
Path::new(file_name_str),
hash as u32,
source_map.clone(),
comments.clone(),
))
Expand Down
2 changes: 1 addition & 1 deletion crates/turbopack-swc-utils/src/emitter.rs
Expand Up @@ -23,7 +23,7 @@ impl Emitter for IssueEmitter {
let mut message = db
.message
.iter()
.map(|(s, _)| s.as_ref())
.map(|s| s.0.as_ref())
.collect::<Vec<_>>()
.join("");
let code = db.code.as_ref().map(|d| match d {
Expand Down

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

This file was deleted.

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

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

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

This file was deleted.

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

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

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

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

2 changes: 2 additions & 0 deletions deny.toml
Expand Up @@ -25,6 +25,8 @@ allow = [
"Unlicense",
"OpenSSL",
"Zlib",
# webc (wasmer)
"BUSL-1.1",
]
[[licenses.clarify]]
name = "ring"
Expand Down

0 comments on commit e6d3283

Please sign in to comment.