Skip to content

Commit

Permalink
chore: Update swc_core to v0.38.4 (vercel#41401)
Browse files Browse the repository at this point in the history
This PR updates swc crates to swc-project/swc@3ff55ca

This PR applies various improvements, and more importantly swc-project/swc#6142
  • Loading branch information
kdy1 authored and Kikobeats committed Oct 24, 2022
1 parent 4767873 commit aa4bf43
Show file tree
Hide file tree
Showing 9 changed files with 113 additions and 115 deletions.
180 changes: 84 additions & 96 deletions packages/next-swc/Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/next-swc/crates/core/Cargo.toml
Expand Up @@ -42,9 +42,9 @@ swc_core = { features = [
"ecma_parser_typescript",
"cached",
"base"
], version = "0.32.8" }
], version = "0.38.4" }

[dev-dependencies]
swc_core = { features = ["testing_transform"], version = "0.32.8" }
testing = "0.31.5"
swc_core = { features = ["testing_transform"], version = "0.38.4" }
testing = "0.31.8"
walkdir = "2.3.2"
6 changes: 3 additions & 3 deletions packages/next-swc/crates/emotion/Cargo.toml
Expand Up @@ -19,9 +19,9 @@ regex = "1.5"
serde = "1"
sourcemap = "6.0.1"
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
swc_core = { features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"], version = "0.32.8" }
swc_core = { features = ["common", "ecma_ast","ecma_codegen", "ecma_utils", "ecma_visit", "trace_macro"], version = "0.38.4" }

[dev-dependencies]
swc_core = { features = ["testing_transform", "ecma_transforms_react"], version = "0.32.8" }
testing = "0.31.5"
swc_core = { features = ["testing_transform", "ecma_transforms_react"], version = "0.38.4" }
testing = "0.31.8"
serde_json = "1"
6 changes: 3 additions & 3 deletions packages/next-swc/crates/modularize_imports/Cargo.toml
Expand Up @@ -15,8 +15,8 @@ handlebars = "4.2.1"
once_cell = "1.13.0"
regex = "1.5"
serde = "1"
swc_core = { features = ["cached", "ecma_ast", "ecma_visit"], version = "0.32.8" }
swc_core = { features = ["cached", "ecma_ast", "ecma_visit"], version = "0.38.4" }

[dev-dependencies]
swc_core = { features = ["testing_transform"], version = "0.32.8" }
testing = "0.31.5"
swc_core = { features = ["testing_transform"], version = "0.38.4" }
testing = "0.31.8"
4 changes: 2 additions & 2 deletions packages/next-swc/crates/napi/Cargo.toml
Expand Up @@ -50,7 +50,7 @@ swc_core = { features = [
"ecma_transforms_typescript",
"ecma_utils",
"ecma_visit",
], version = "0.32.8" }
], version = "0.38.4" }
tracing = { version = "0.1.32", features = ["release_max_level_info"] }
tracing-futures = "0.2.5"
tracing-subscriber = "0.3.9"
Expand All @@ -71,4 +71,4 @@ _sentry_rustls = { package = "sentry", version = "0.27.0", default-features = fa
[build-dependencies]
napi-build = "2"
serde = "1"
serde_json = "1"
serde_json = "1"
6 changes: 3 additions & 3 deletions packages/next-swc/crates/styled_components/Cargo.toml
Expand Up @@ -21,13 +21,13 @@ swc_core = { features = [
"ecma_ast",
"ecma_utils",
"ecma_visit"
], version = "0.32.8" }
], version = "0.38.4" }

[dev-dependencies]
serde_json = "1"
testing = "0.31.5"
testing = "0.31.8"
swc_core = { features = [
"ecma_parser",
"ecma_transforms",
"testing_transform"
], version = "0.32.8" }
], version = "0.38.4" }
6 changes: 3 additions & 3 deletions packages/next-swc/crates/styled_jsx/Cargo.toml
Expand Up @@ -24,10 +24,10 @@ swc_core = { features = [
"ecma_minifier",
"ecma_utils",
"ecma_visit"
], version = "0.32.8" }
], version = "0.38.4" }

[dev-dependencies]
testing = "0.31.5"
testing = "0.31.8"
swc_core = { features = [
"testing_transform"
], version = "0.32.8" }
], version = "0.38.4" }
12 changes: 11 additions & 1 deletion packages/next-swc/crates/styled_jsx/src/transform_css.rs
Expand Up @@ -15,7 +15,10 @@ use swc_core::{
writer::basic::{BasicCssWriter, BasicCssWriterConfig},
CodeGenerator, CodegenConfig, Emit,
},
parser::{parse_str, parse_tokens, parser::ParserConfig},
parser::{
parse_str, parse_tokens,
parser::{input::Tokens, ParserConfig},
},
visit::{VisitMut, VisitMutWith},
},
ecma::ast::{Expr, Tpl, TplElement},
Expand All @@ -38,6 +41,7 @@ pub fn transform_css(
style_info.css_span.hi,
ParserConfig {
allow_wrong_line_comments: true,
..Default::default()
},
// We ignore errors because we inject placeholders for expressions which is
// not a valid css.
Expand Down Expand Up @@ -230,6 +234,7 @@ impl Namespacer {
PseudoClassSelectorChildren::ForgivingRelativeSelectorList(v) => {
to_tokens(v).tokens
}
PseudoClassSelectorChildren::ComplexSelector(v) => to_tokens(v).tokens,
})
.collect::<Vec<_>>();

Expand All @@ -247,6 +252,9 @@ impl Namespacer {
PseudoElementSelectorChildren::CompoundSelector(v) => {
to_tokens(v).tokens
}
PseudoElementSelectorChildren::CustomHighlightName(v) => {
to_tokens(v).tokens
}
})
.collect::<Vec<_>>();

Expand Down Expand Up @@ -279,6 +287,7 @@ impl Namespacer {
&args,
ParserConfig {
allow_wrong_line_comments: true,
..Default::default()
},
// TODO(kdy1): We might be able to report syntax errors.
&mut vec![],
Expand Down Expand Up @@ -516,6 +525,7 @@ where
StringInput::new(&s, span.lo, span.hi),
ParserConfig {
allow_wrong_line_comments: true,
..Default::default()
},
);

Expand Down
2 changes: 1 addition & 1 deletion packages/next-swc/crates/wasm/Cargo.toml
Expand Up @@ -45,7 +45,7 @@ swc_core = { features = [
"ecma_parser_typescript",
"ecma_utils",
"ecma_visit"
], version = "0.32.8" }
], version = "0.38.4" }


# Workaround a bug
Expand Down

0 comments on commit aa4bf43

Please sign in to comment.