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

Update swc_core to 0.32.2 #41339

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
328 changes: 207 additions & 121 deletions packages/next-swc/Cargo.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions packages/next-swc/Cargo.toml
@@ -1,10 +1,6 @@
[workspace]

members = [
"crates/core",
"crates/napi",
"crates/wasm"
]
members = ["crates/core", "crates/napi", "crates/wasm"]

[profile.dev.package.swc_css_prefixer]
opt-level = 2
Expand All @@ -15,3 +11,6 @@ debug-assertions = false

[profile.release]
lto = true

[workspace.dependencies]
swc_core = "0.32.2"
18 changes: 8 additions & 10 deletions packages/next-swc/crates/core/Cargo.toml
Expand Up @@ -8,9 +8,7 @@ publish = false
crate-type = ["cdylib", "rlib"]

[features]
plugin = [
"swc_core/plugin_transform_host_native"
]
plugin = ["swc_core/plugin_transform_host_native"]

[dependencies]
chrono = "0.4"
Expand All @@ -22,10 +20,10 @@ pathdiff = "0.2.0"
regex = "1.5"
serde = "1"
serde_json = "1"
swc_emotion = {path="../emotion"}
styled_components = {path="../styled_components"}
styled_jsx = {path="../styled_jsx"}
modularize_imports = {path="../modularize_imports"}
swc_emotion = { path = "../emotion" }
styled_components = { path = "../styled_components" }
styled_jsx = { path = "../styled_jsx" }
modularize_imports = { path = "../modularize_imports" }
tracing = { version = "0.1.32", features = ["release_max_level_info"] }

swc_core = { features = [
Expand All @@ -44,10 +42,10 @@ swc_core = { features = [
"ecma_parser",
"ecma_parser_typescript",
"cached",
"base"
], version = "0.29.5" }
"base",
], workspace = true }

[dev-dependencies]
swc_core = { features = ["testing_transform"], version = "0.29.5" }
swc_core = { features = ["testing_transform"], workspace = true }
testing = "0.31.4"
walkdir = "2.3.2"
32 changes: 24 additions & 8 deletions packages/next-swc/crates/core/tests/errors.rs
Expand Up @@ -8,8 +8,11 @@ use next_swc::{
use std::path::PathBuf;
use swc_core::{
common::FileName,
ecma::parser::{EsConfig, Syntax},
ecma::transforms::testing::test_fixture_allowing_error,
ecma::transforms::testing::test_fixture,
ecma::{
parser::{EsConfig, Syntax},
transforms::testing::FixtureTestConfig,
},
};
use testing::fixture;

Expand All @@ -20,21 +23,29 @@ fn syntax() -> Syntax {
})
}

fn allow_error() -> FixtureTestConfig {
FixtureTestConfig {
sourcemap: false,
allow_error: true,
}
}

#[fixture("tests/errors/re-export-all-in-page/**/input.js")]
fn re_export_all_in_page(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|_tr| disallow_re_export_all_in_page(true),
&input,
&output,
allow_error(),
);
}

#[fixture("tests/errors/next-dynamic/**/input.js")]
fn next_dynamic_errors(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|_tr| {
next_dynamic(
Expand All @@ -46,24 +57,26 @@ fn next_dynamic_errors(input: PathBuf) {
},
&input,
&output,
allow_error(),
);
}

#[fixture("tests/errors/next-ssg/**/input.js")]
fn next_ssg_errors(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|_tr| next_ssg(Default::default()),
&input,
&output,
allow_error(),
);
}

#[fixture("tests/errors/react-server-components/server-graph/**/input.js")]
fn react_server_components_server_graph_errors(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|tr| {
server_components(
Expand All @@ -76,13 +89,14 @@ fn react_server_components_server_graph_errors(input: PathBuf) {
},
&input,
&output,
allow_error(),
);
}

#[fixture("tests/errors/react-server-components/client-graph/**/input.js")]
fn react_server_components_client_graph_errors(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|tr| {
server_components(
Expand All @@ -95,13 +109,14 @@ fn react_server_components_client_graph_errors(input: PathBuf) {
},
&input,
&output,
allow_error(),
);
}

#[fixture("tests/errors/next-font-loaders/**/input.js")]
fn next_font_loaders_errors(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture_allowing_error(
test_fixture(
syntax(),
&|_tr| {
next_font_loaders(FontLoaderConfig {
Expand All @@ -111,5 +126,6 @@ fn next_font_loaders_errors(input: PathBuf) {
},
&input,
&output,
allow_error(),
);
}
29 changes: 27 additions & 2 deletions packages/next-swc/crates/core/tests/fixture.rs
Expand Up @@ -29,7 +29,13 @@ fn syntax() -> Syntax {
#[fixture("tests/fixture/amp/**/input.js")]
fn amp_attributes_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture(syntax(), &|_tr| amp_attributes(), &input, &output);
test_fixture(
syntax(),
&|_tr| amp_attributes(),
&input,
&output,
Default::default(),
);
}

#[fixture("tests/fixture/next-dynamic/**/input.js")]
Expand All @@ -49,6 +55,7 @@ fn next_dynamic_fixture(input: PathBuf) {
},
&input,
&output_dev,
Default::default(),
);
test_fixture(
syntax(),
Expand All @@ -62,6 +69,7 @@ fn next_dynamic_fixture(input: PathBuf) {
},
&input,
&output_prod,
Default::default(),
);
test_fixture(
syntax(),
Expand All @@ -75,6 +83,7 @@ fn next_dynamic_fixture(input: PathBuf) {
},
&input,
&output_server,
Default::default(),
);
}

Expand Down Expand Up @@ -106,13 +115,20 @@ fn next_ssg_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

#[fixture("tests/fixture/page-config/**/input.js")]
fn page_config_fixture(input: PathBuf) {
let output = input.parent().unwrap().join("output.js");
test_fixture(syntax(), &|_tr| page_config_test(), &input, &output);
test_fixture(
syntax(),
&|_tr| page_config_test(),
&input,
&output,
Default::default(),
);
}

#[fixture("tests/fixture/relay/**/input.ts*")]
Expand All @@ -134,6 +150,7 @@ fn relay_no_artifact_dir_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -145,6 +162,7 @@ fn remove_console_fixture(input: PathBuf) {
&|_tr| remove_console(next_swc::remove_console::Config::All(true)),
&input,
&output,
Default::default(),
);
}

Expand All @@ -156,6 +174,7 @@ fn react_remove_properties_default_fixture(input: PathBuf) {
&|_tr| remove_properties(next_swc::react_remove_properties::Config::All(true)),
&input,
&output,
Default::default(),
);
}

Expand All @@ -173,6 +192,7 @@ fn react_remove_properties_custom_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -194,6 +214,7 @@ fn shake_exports_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -209,6 +230,7 @@ fn shake_exports_fixture_default(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -228,6 +250,7 @@ fn react_server_components_server_graph_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -247,6 +270,7 @@ fn react_server_components_client_graph_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}

Expand All @@ -263,5 +287,6 @@ fn next_font_loaders_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}
14 changes: 12 additions & 2 deletions packages/next-swc/crates/emotion/Cargo.toml
Expand Up @@ -19,9 +19,19 @@ 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.29.5" }
swc_core = { features = [
"common",
"ecma_ast",
"ecma_codegen",
"ecma_utils",
"ecma_visit",
"trace_macro",
], workspace = true }

[dev-dependencies]
swc_core = { features = ["testing_transform", "ecma_transforms_react"], version = "0.29.5" }
swc_core = { features = [
"testing_transform",
"ecma_transforms_react",
], workspace = true }
testing = "0.31.4"
serde_json = "1"
1 change: 1 addition & 0 deletions packages/next-swc/crates/emotion/tests/fixture.rs
Expand Up @@ -59,5 +59,6 @@ fn next_emotion_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}
4 changes: 2 additions & 2 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.29.5" }
swc_core = { features = ["cached", "ecma_ast", "ecma_visit"], workspace = true }

[dev-dependencies]
swc_core = { features = ["testing_transform"], version = "0.29.5" }
swc_core = { features = ["testing_transform"], workspace = true }
testing = "0.31.4"
Expand Up @@ -61,5 +61,6 @@ fn modularize_imports_fixture(input: PathBuf) {
},
&input,
&output,
Default::default(),
);
}