From 79d7a50fa4aba3be96f48c830b4f6a5173ef8cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 15:52:55 +0900 Subject: [PATCH 01/19] Update rustc --- rust-toolchain | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-toolchain b/rust-toolchain index c8dce96fac4a..5eeb3a4d0274 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2024-04-16 \ No newline at end of file +nightly-2024-07-21 \ No newline at end of file From 284a95b309eea706716f638dae4d81a512910165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 15:54:10 +0900 Subject: [PATCH 02/19] fmt --- crates/swc_html_codegen/src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/swc_html_codegen/src/lib.rs b/crates/swc_html_codegen/src/lib.rs index b13fd2f83d70..115a1242150d 100644 --- a/crates/swc_html_codegen/src/lib.rs +++ b/crates/swc_html_codegen/src/lib.rs @@ -620,8 +620,9 @@ where None => true, _ => false, }, - // The closing tag can be omitted if it is immediately followed by a , - // or element opening tag or by its parent closing tag. + // The closing tag can be omitted if it is immediately followed by a , + // or element opening tag or by its parent + // closing tag. "rtc" => match next { Some(Child::Element(Element { namespace, From e18b8a4a35835000e3a7f18abd9abff3aa89d4ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 15:57:48 +0900 Subject: [PATCH 03/19] --fix --- crates/swc_visit/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/swc_visit/src/lib.rs b/crates/swc_visit/src/lib.rs index b1faa036d416..9d3ddd8d58bf 100644 --- a/crates/swc_visit/src/lib.rs +++ b/crates/swc_visit/src/lib.rs @@ -18,7 +18,7 @@ //! # `Fold` //! //! > WARNING: `Fold` is slow, and it's recommended to use VisitMut if you are -//! experienced. +//! > experienced. //! //! //! `Fold` takes ownership of value, which means you have to return the new From dce74bdeb3133ebde83f97169d64e850c273ff3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 15:57:54 +0900 Subject: [PATCH 04/19] cargo lockfile --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index da0db2813371..12341c66e618 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5635,9 +5635,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -5656,9 +5656,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core", From a112489d7def5d418718736197ccdaf6caa90ea5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 16:02:44 +0900 Subject: [PATCH 05/19] --fix --- crates/dbg-swc/src/es/minifier/next/check_size.rs | 4 ++-- crates/swc/benches/minify.rs | 2 +- crates/swc_css_codegen/src/lib.rs | 2 +- crates/swc_css_minifier/src/compressor/mod.rs | 2 +- crates/swc_ecma_codegen/src/lib.rs | 2 +- crates/swc_ecma_lints/src/rules/duplicate_bindings.rs | 7 ++----- crates/swc_ecma_lints/src/rules/no_dupe_args.rs | 2 +- crates/swc_ecma_minifier/benches/full.rs | 2 +- crates/swc_ecma_transforms_testing/src/lib.rs | 2 +- crates/swc_html_minifier/src/lib.rs | 2 +- crates/swc_html_parser/tests/html5lib_tests.rs | 2 +- 11 files changed, 13 insertions(+), 16 deletions(-) diff --git a/crates/dbg-swc/src/es/minifier/next/check_size.rs b/crates/dbg-swc/src/es/minifier/next/check_size.rs index 0f8e1e290f52..5f5e70138121 100644 --- a/crates/dbg-swc/src/es/minifier/next/check_size.rs +++ b/crates/dbg-swc/src/es/minifier/next/check_size.rs @@ -74,7 +74,7 @@ impl CheckSizeCommand { println!( "{}: {} bytes (swc) vs {} bytes (terser)", file.path - .strip_prefix(&self.workspace.join("inputs")) + .strip_prefix(self.workspace.join("inputs")) .unwrap() .display(), file.swc, @@ -92,7 +92,7 @@ impl CheckSizeCommand { format!( "{}: Diff: {} bytes; {} bytes (swc) vs {} bytes (terser)", f.path - .strip_prefix(&self.workspace.join("inputs")) + .strip_prefix(self.workspace.join("inputs")) .unwrap() .display(), f.swc as i32 - f.terser as i32, diff --git a/crates/swc/benches/minify.rs b/crates/swc/benches/minify.rs index 244686660cc2..6f9be3e8f7af 100644 --- a/crates/swc/benches/minify.rs +++ b/crates/swc/benches/minify.rs @@ -62,7 +62,7 @@ fn files_group(c: &mut Criterion) { group.sample_size(10); let mut bench_file = |name: &str| { - group.bench_function(&format!("es/full/minify/libraries/{name}"), |b| { + group.bench_function(format!("es/full/minify/libraries/{name}"), |b| { bench_minify(b, &format!("{}.js", name)); }); }; diff --git a/crates/swc_css_codegen/src/lib.rs b/crates/swc_css_codegen/src/lib.rs index d36316421ea4..f62a04a8325d 100644 --- a/crates/swc_css_codegen/src/lib.rs +++ b/crates/swc_css_codegen/src/lib.rs @@ -2792,7 +2792,7 @@ fn serialize_dimension_unit(value: &str) -> Cow<'_, str> { // Fast-path let need_escape = (value.len() >= 2 && value.as_bytes()[0] == b'e' && value.as_bytes()[1].is_ascii_digit()) - || value.contains(|c| c == char::REPLACEMENT_CHARACTER); + || value.contains(char::REPLACEMENT_CHARACTER); if !need_escape { return Cow::Borrowed(value); diff --git a/crates/swc_css_minifier/src/compressor/mod.rs b/crates/swc_css_minifier/src/compressor/mod.rs index 5d70777693e9..7d91afab17f4 100644 --- a/crates/swc_css_minifier/src/compressor/mod.rs +++ b/crates/swc_css_minifier/src/compressor/mod.rs @@ -489,5 +489,5 @@ impl VisitMut for Compressor { } fn contains_only_ascii_characters(string: &str) -> bool { - string.chars().all(|c: char| c.is_ascii()) + string.is_ascii() } diff --git a/crates/swc_ecma_codegen/src/lib.rs b/crates/swc_ecma_codegen/src/lib.rs index 6fb1b8a37801..3a9737fef6c5 100644 --- a/crates/swc_ecma_codegen/src/lib.rs +++ b/crates/swc_ecma_codegen/src/lib.rs @@ -3908,7 +3908,7 @@ fn get_template_element_from_raw(s: &str, ascii_only: bool) -> String { } fn get_ascii_only_ident(sym: &str, may_need_quote: bool, target: EsVersion) -> Cow { - if sym.chars().all(|c| c.is_ascii()) { + if sym.is_ascii() { return Cow::Borrowed(sym); } diff --git a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs b/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs index d7a25704071a..57c0568a672e 100644 --- a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs +++ b/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs @@ -420,11 +420,8 @@ fn emit_error(name: &str, span: Span, prev_span: Span) { span, &format!("the name `{}` is defined multiple times", name), ) - .span_label( - prev_span, - &format!("previous definition of `{}` here", name), - ) - .span_label(span, &format!("`{}` redefined here", name)) + .span_label(prev_span, format!("previous definition of `{}` here", name)) + .span_label(span, format!("`{}` redefined here", name)) .emit(); }); } diff --git a/crates/swc_ecma_lints/src/rules/no_dupe_args.rs b/crates/swc_ecma_lints/src/rules/no_dupe_args.rs index 6e948ffbc767..42ba092d0b09 100644 --- a/crates/swc_ecma_lints/src/rules/no_dupe_args.rs +++ b/crates/swc_ecma_lints/src/rules/no_dupe_args.rs @@ -25,7 +25,7 @@ fn error(first: &BindingIdent, second: &BindingIdent) { ), ) .span_label(first.span, "previous definition here".to_string()) - .span_label(second.span, &"used as parameter more than once".to_string()) + .span_label(second.span, "used as parameter more than once".to_string()) .emit(); }); } diff --git a/crates/swc_ecma_minifier/benches/full.rs b/crates/swc_ecma_minifier/benches/full.rs index 86c58d31744b..75e1b26e3c36 100644 --- a/crates/swc_ecma_minifier/benches/full.rs +++ b/crates/swc_ecma_minifier/benches/full.rs @@ -23,7 +23,7 @@ pub fn bench_files(c: &mut Criterion) { let mut bench_file = |name: &str| { let src = read_to_string(format!("benches/full/{}.js", name)).unwrap(); - group.bench_function(&format!("es/minifier/libs/{}", name), |b| { + group.bench_function(format!("es/minifier/libs/{}", name), |b| { b.iter(|| { // We benchmark full time, including time for creating cm, handler let allocator = Allocator::default(); diff --git a/crates/swc_ecma_transforms_testing/src/lib.rs b/crates/swc_ecma_transforms_testing/src/lib.rs index 4f53427b3de0..9bda5e768e12 100644 --- a/crates/swc_ecma_transforms_testing/src/lib.rs +++ b/crates/swc_ecma_transforms_testing/src/lib.rs @@ -659,7 +659,7 @@ fn exec_with_node_test_runner(src: &str) -> Result<(), ()> { }; let output = base_cmd - .arg(&format!("{}", path.display())) + .arg(format!("{}", path.display())) .arg("--color") .current_dir(root) .output() diff --git a/crates/swc_html_minifier/src/lib.rs b/crates/swc_html_minifier/src/lib.rs index 102d77c71245..0c68245a0c39 100644 --- a/crates/swc_html_minifier/src/lib.rs +++ b/crates/swc_html_minifier/src/lib.rs @@ -2108,7 +2108,7 @@ impl Minifier<'_> { fn minify_sizes(&self, value: &str) -> Option { let values = value - .rsplitn(2, |c| matches!(c, '\t' | '\n' | '\x0C' | '\r' | ' ')) + .rsplitn(2, ['\t', '\n', '\x0C', '\r', ' ']) .collect::>(); if values.len() != 2 { diff --git a/crates/swc_html_parser/tests/html5lib_tests.rs b/crates/swc_html_parser/tests/html5lib_tests.rs index 159b1b999673..c4a04abe92a1 100644 --- a/crates/swc_html_parser/tests/html5lib_tests.rs +++ b/crates/swc_html_parser/tests/html5lib_tests.rs @@ -63,7 +63,7 @@ fn html5lib_test_tokenizer(input: PathBuf) { let filename = input.to_str().expect("failed to parse path"); let contents = fs::read_to_string(filename).expect("Something went wrong reading the file"); let obj: Value = serde_json::from_str(&contents).expect("json parse error"); - let tests = match obj.get(&"tests".to_string()) { + let tests = match obj.get("tests".to_string()) { Some(Value::Array(tests)) => tests, _ => return, }; From 34a0383da774144204ea83a5112cf8705da5da40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 16:13:51 +0900 Subject: [PATCH 06/19] fix --- crates/binding_macros/build.rs | 8 -------- crates/swc_ecma_transforms_typescript/src/config.rs | 5 +++-- 2 files changed, 3 insertions(+), 10 deletions(-) delete mode 100644 crates/binding_macros/build.rs diff --git a/crates/binding_macros/build.rs b/crates/binding_macros/build.rs deleted file mode 100644 index efd4549ac900..000000000000 --- a/crates/binding_macros/build.rs +++ /dev/null @@ -1,8 +0,0 @@ -#[cfg(all(feature = "binding_node", feature = "binding_wasm",))] -compile_error!( - "Macro cannot enable multiple bindings builder at once. Enable only one binding feature" -); - -fn main() { - //noop -} diff --git a/crates/swc_ecma_transforms_typescript/src/config.rs b/crates/swc_ecma_transforms_typescript/src/config.rs index 8b7b6d8fa3ca..d04c0e3e88fe 100644 --- a/crates/swc_ecma_transforms_typescript/src/config.rs +++ b/crates/swc_ecma_transforms_typescript/src/config.rs @@ -42,8 +42,9 @@ pub struct TsxConfig { #[derive(Default, Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum TsImportExportAssignConfig { - /// - Rewrite `import foo = require("foo")` to `var foo = require("foo")` - /// - Rewrite `export =` to `module.exports = ` + /// - Rewrite `import foo = require("foo")` to `var foo = require("foo")` + /// - Rewrite `export =` to `module.exports = ` + /// /// Note: This option is deprecated as all CJS/AMD/UMD can handle it /// themselves. #[default] From bc514884e753d55678e15f6996ab5ce06eacf5e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Mon, 22 Jul 2024 16:14:24 +0900 Subject: [PATCH 07/19] fix --- crates/swc_bundler/src/bundler/chunk/mod.rs | 3 --- crates/swc_common/benches/serde.rs | 2 -- 2 files changed, 5 deletions(-) diff --git a/crates/swc_bundler/src/bundler/chunk/mod.rs b/crates/swc_bundler/src/bundler/chunk/mod.rs index 5ca2296c2729..0b6d4442033e 100644 --- a/crates/swc_bundler/src/bundler/chunk/mod.rs +++ b/crates/swc_bundler/src/bundler/chunk/mod.rs @@ -15,9 +15,6 @@ mod computed_key; mod merge; mod plan; -#[derive(Debug, Default)] -struct State {} - impl Bundler<'_, L, R> where L: Load, diff --git a/crates/swc_common/benches/serde.rs b/crates/swc_common/benches/serde.rs index f94fac41779d..d8868601ad70 100644 --- a/crates/swc_common/benches/serde.rs +++ b/crates/swc_common/benches/serde.rs @@ -1,5 +1,3 @@ -#![cfg_attr(not(feature = "serde-impl"), allow(unused))] - use ast_node::ast_node; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Criterion}; use serde::{Deserialize, Serialize}; From 421b84b1df6fc79d8f0ba86de67fd9df567ebe00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:37:02 +0900 Subject: [PATCH 08/19] fix --- crates/swc_ecma_usage_analyzer/Cargo.toml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/swc_ecma_usage_analyzer/Cargo.toml b/crates/swc_ecma_usage_analyzer/Cargo.toml index aa265d72317e..4529645681ad 100644 --- a/crates/swc_ecma_usage_analyzer/Cargo.toml +++ b/crates/swc_ecma_usage_analyzer/Cargo.toml @@ -18,8 +18,9 @@ bench = false [features] # This enables global concurrent mode -concurrent = ["swc_common/concurrent", "indexmap/rayon"] -trace-ast = [] +concurrent = ["swc_common/concurrent", "indexmap/rayon"] +trace-ast = [] +tracing-spans = [] [dependencies] indexmap = { workspace = true } From 43bb3f9e6657eb1cf07b1e7300dd2a850da46458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:37:07 +0900 Subject: [PATCH 09/19] fi --- crates/swc_core/build.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/crates/swc_core/build.rs b/crates/swc_core/build.rs index 7259b4d2033c..67e46d8b16c0 100644 --- a/crates/swc_core/build.rs +++ b/crates/swc_core/build.rs @@ -9,7 +9,7 @@ use vergen::EmitBuilder; // Validate conflict between host / plugin features #[cfg(all( - feature = "plugin_transform", + feature = "ecma_plugin_transform", any( feature = "plugin_transform_host_native", feature = "plugin_transform_host_js" @@ -21,15 +21,6 @@ compile_error!( run plugin, use 'plugin_transform_host_*' instead." ); -#[cfg(all(feature = "__plugin_transform", feature = "common_concurrent"))] -compile_error!("plugin transform cannot enable concurrent mode."); - -#[cfg(all(feature = "transforms", feature = "transforms_concurrent"))] -compile_error!( - "'transforms' and 'transforms_concurrent' features are mutually exclusive. Please choose only \ - one feature." -); - fn main() { // Creates a static compile time constants for the version of swc_core. let pkg_version = env::var("CARGO_PKG_VERSION").unwrap(); From 17b2d86f2155e0964735f8f0e58b7a20f6ba92c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:39:32 +0900 Subject: [PATCH 10/19] fix --- crates/swc_common/benches/serde.rs | 29 +------------------ crates/swc_core/src/lib.rs | 2 +- .../src/compress/pure/properties.rs | 7 ++--- .../swc_ecma_minifier/src/pass/precompress.rs | 1 + 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/crates/swc_common/benches/serde.rs b/crates/swc_common/benches/serde.rs index d8868601ad70..817231623cc0 100644 --- a/crates/swc_common/benches/serde.rs +++ b/crates/swc_common/benches/serde.rs @@ -63,32 +63,5 @@ fn bench_serde(c: &mut Criterion) { }); } -fn bench_ast_node(c: &mut Criterion) { - #[cfg(feature = "serde-impl")] - c.bench_function("serialization of ast node", |b| { - let src = AstNode::String(Str { - span: DUMMY_SP, - value: String::from("perf-diff"), - }); - - b.iter(|| black_box(serde_json::to_string(&src).unwrap())); - }); - #[cfg(feature = "serde-impl")] - c.bench_function("deserialization of ast node", |b| { - let src = serde_json::to_string(&AstNode::String(Str { - span: DUMMY_SP, - value: String::from("perf-diff"), - })) - .unwrap(); - println!("{}", src); - - b.iter(|| { - let t: AstNode = serde_json::from_str(&src).unwrap(); - - black_box(t); - }); - }); -} - -criterion_group!(benches, bench_ast_node, bench_serde); +criterion_group!(benches, bench_serde); criterion_main!(benches); diff --git a/crates/swc_core/src/lib.rs b/crates/swc_core/src/lib.rs index 8d035af9db7c..305c429d55d8 100644 --- a/crates/swc_core/src/lib.rs +++ b/crates/swc_core/src/lib.rs @@ -32,7 +32,7 @@ pub extern crate swc_ecma_quote_macros; )] pub mod plugin; -#[cfg(feature = "preset_env")] +#[cfg(feature = "ecma_preset_env")] #[cfg_attr(docsrs, doc(cfg(feature = "preset_env")))] pub mod preset_env { pub use preset_env_base::*; diff --git a/crates/swc_ecma_minifier/src/compress/pure/properties.rs b/crates/swc_ecma_minifier/src/compress/pure/properties.rs index d14438857062..82ba164b65b7 100644 --- a/crates/swc_ecma_minifier/src/compress/pure/properties.rs +++ b/crates/swc_ecma_minifier/src/compress/pure/properties.rs @@ -13,11 +13,8 @@ impl Pure<'_> { if !self.options.props { return None; } - if let Some(obj) = obj { - match obj { - Expr::Array(..) | Expr::Await(..) | Expr::Yield(..) | Expr::Lit(..) => return None, - _ => {} - } + if let Some(Expr::Array(..) | Expr::Await(..) | Expr::Yield(..) | Expr::Lit(..)) = obj { + return None; } match &*c.expr { diff --git a/crates/swc_ecma_minifier/src/pass/precompress.rs b/crates/swc_ecma_minifier/src/pass/precompress.rs index 6252ce537a7b..1793b928e48d 100644 --- a/crates/swc_ecma_minifier/src/pass/precompress.rs +++ b/crates/swc_ecma_minifier/src/pass/precompress.rs @@ -9,6 +9,7 @@ use crate::HEAVY_TASK_PARALLELS; /// Optimizer invoked before invoking compressor. /// /// - Remove parens. +/// /// TODO: remove completely after #8333 pub(crate) fn precompress_optimizer<'a>() -> impl 'a + VisitMut { PrecompressOptimizer {} From 9824766fefffe847a2a705b089a7a68487f2a467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:40:05 +0900 Subject: [PATCH 11/19] fix --- crates/swc_core/tests/quote.rs | 12 ++++++------ crates/swc_css_compat/src/compiler/custom_media.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/swc_core/tests/quote.rs b/crates/swc_core/tests/quote.rs index f7082e5c8ef2..4a02359f3f80 100644 --- a/crates/swc_core/tests/quote.rs +++ b/crates/swc_core/tests/quote.rs @@ -1,13 +1,13 @@ -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] use swc_core::{ast::Ident, common::DUMMY_SP, quote, quote_expr, utils::private_ident}; -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] #[test] fn quote_expr_call_1() { let _expr = quote_expr!("call(arg1, typeof arg2, arg3)"); } -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] #[test] fn quote_expr_var_cloned() { testing::run_test2(false, |_cm, _handler| { @@ -20,7 +20,7 @@ fn quote_expr_var_cloned() { .unwrap(); } -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] #[test] fn quote_example() { let _stmt = quote!( @@ -29,7 +29,7 @@ fn quote_example() { ); } -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] #[test] fn quote_var_type_expr() { let _stmt = quote!( @@ -39,7 +39,7 @@ fn quote_var_type_expr() { ); } -#[cfg(feature = "quote")] +#[cfg(feature = "ecma_quote")] #[test] fn quote_var_type_pat() { let _stmt = quote!( diff --git a/crates/swc_css_compat/src/compiler/custom_media.rs b/crates/swc_css_compat/src/compiler/custom_media.rs index 6eb668c4ccd7..f089e06329f0 100644 --- a/crates/swc_css_compat/src/compiler/custom_media.rs +++ b/crates/swc_css_compat/src/compiler/custom_media.rs @@ -255,7 +255,7 @@ impl CustomMediaHandler { Some((query.modifier.clone(), query.media_type.clone())); } - for condition in &query.condition { + if let Some(condition) = &query.condition { match &**condition { MediaConditionType::All(media_condition) => { if new_media_condition.conditions.is_empty() { From 8c715245c900474b7424d41e32281a8837c8d3b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:41:40 +0900 Subject: [PATCH 12/19] fix --- crates/swc_ecma_ast/src/class.rs | 2 +- crates/swc_ecma_codegen_macros/src/fold.rs | 17 ----------------- .../src/resolver/mod.rs | 10 +++++----- .../tests/par_explode.rs | 7 +++++++ 4 files changed, 13 insertions(+), 23 deletions(-) diff --git a/crates/swc_ecma_ast/src/class.rs b/crates/swc_ecma_ast/src/class.rs index 07ee55016bfc..185f7457b7aa 100644 --- a/crates/swc_ecma_ast/src/class.rs +++ b/crates/swc_ecma_ast/src/class.rs @@ -22,7 +22,7 @@ pub struct Class { pub ctxt: SyntaxContext, - #[cfg_attr(c, serde(default))] + #[cfg_attr(feature = "serde-impl", serde(default))] pub decorators: Vec, #[cfg_attr(feature = "serde-impl", serde(default))] diff --git a/crates/swc_ecma_codegen_macros/src/fold.rs b/crates/swc_ecma_codegen_macros/src/fold.rs index 2a186d45e5f4..e38f960110e5 100644 --- a/crates/swc_ecma_codegen_macros/src/fold.rs +++ b/crates/swc_ecma_codegen_macros/src/fold.rs @@ -12,23 +12,6 @@ pub(crate) struct InjectSelf { pub parser: Option, } -#[cfg(procmacro2_semver_exempt)] -fn get_joined_span(t: &dyn ToTokens) -> Span { - let tts: TokenStream = t.dump().into(); - let (mut first, mut last) = (None, None); - for tt in tts { - match first { - None => first = Some(tt.span()), - _ => {} - } - - last = Some(tt.span()); - } - let cs = Span::call_site(); - first.unwrap_or(cs).join(last.unwrap_or(cs)).unwrap_or(cs) -} - -#[cfg(not(procmacro2_semver_exempt))] fn get_joined_span(t: &dyn ToTokens) -> Span { let tts: TokenStream = t.into_token_stream(); let mut first = None; diff --git a/crates/swc_ecma_transforms_base/src/resolver/mod.rs b/crates/swc_ecma_transforms_base/src/resolver/mod.rs index 2109d4141c1f..a4c8c20bee99 100644 --- a/crates/swc_ecma_transforms_base/src/resolver/mod.rs +++ b/crates/swc_ecma_transforms_base/src/resolver/mod.rs @@ -60,12 +60,12 @@ const LOG: bool = false && cfg!(debug_assertions); /// 3. Defined `a` with syntax context of the block statement. /// /// 4. Found usage of `a`, and determines that it's reference to `a` in the -/// block. So the reference to `a` will have same syntax context as `a` in the -/// block. +/// block. So the reference to `a` will have same syntax context as `a` in +/// the block. /// -/// 5. Found usage of `a` (last line), and determines that it's a -/// reference to top-level `a`, and change syntax context of `a` on last line to -/// top-level syntax context. +/// 5. Found usage of `a` (last line), and determines that it's a reference to +/// top-level `a`, and change syntax context of `a` on last line to top-level +/// syntax context. /// /// /// # Parameters diff --git a/crates/swc_ecma_transforms_base/tests/par_explode.rs b/crates/swc_ecma_transforms_base/tests/par_explode.rs index 551bf92386f1..a37083c2b5ed 100644 --- a/crates/swc_ecma_transforms_base/tests/par_explode.rs +++ b/crates/swc_ecma_transforms_base/tests/par_explode.rs @@ -42,3 +42,10 @@ impl ParExplode for ExampleFold { #[parallel(explode)] impl Fold for ExampleFold {} + +#[test] +fn test_1() { + ExampleFold::default(); + + ExampleVisitMut::default(); +} From eb95d03cfd34de5df488ba57e1571cdb9bd49999 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:41:56 +0900 Subject: [PATCH 13/19] fix --- crates/swc_ecma_transforms_base/tests/par_explode.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/swc_ecma_transforms_base/tests/par_explode.rs b/crates/swc_ecma_transforms_base/tests/par_explode.rs index a37083c2b5ed..2500b6f504d4 100644 --- a/crates/swc_ecma_transforms_base/tests/par_explode.rs +++ b/crates/swc_ecma_transforms_base/tests/par_explode.rs @@ -45,7 +45,7 @@ impl Fold for ExampleFold {} #[test] fn test_1() { - ExampleFold::default(); + let _ = ExampleFold; - ExampleVisitMut::default(); + let _ = ExampleVisitMut; } From 5c280858d1eb6fb26bd0d00c8bcccbabc4952030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:42:30 +0900 Subject: [PATCH 14/19] fix --- crates/swc_ecma_transforms_base/tests/par.rs | 6 ++++++ crates/swc_ecma_transforms_module/src/util.rs | 9 --------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/crates/swc_ecma_transforms_base/tests/par.rs b/crates/swc_ecma_transforms_base/tests/par.rs index 8dcedbf63582..570ec17755fa 100644 --- a/crates/swc_ecma_transforms_base/tests/par.rs +++ b/crates/swc_ecma_transforms_base/tests/par.rs @@ -30,3 +30,9 @@ impl Parallel for ExampleFold { #[parallel] impl Fold for ExampleFold {} + +#[test] +fn test() { + let _ = ExampleFold; + let _ = ExampleVisitMut; +} diff --git a/crates/swc_ecma_transforms_module/src/util.rs b/crates/swc_ecma_transforms_module/src/util.rs index 489329f0acea..cc82cf48b6b2 100644 --- a/crates/swc_ecma_transforms_module/src/util.rs +++ b/crates/swc_ecma_transforms_module/src/util.rs @@ -232,15 +232,6 @@ pub(super) fn use_strict() -> Stmt { Lit::Str(quote_str!("use strict")).into_stmt() } -/// Private `_exports` ident. -pub(super) struct Exports(#[allow(dead_code)] pub Ident); - -impl Default for Exports { - fn default() -> Self { - Exports(private_ident!("_exports")) - } -} - pub(crate) fn object_define_enumerable( target: ExprOrSpread, prop_name: ExprOrSpread, From 72314cac2d06f98c720ed0845eb95606783c10a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:42:48 +0900 Subject: [PATCH 15/19] rnemae --- .../src/analyzer/mod.rs | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs b/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs index 277bf157f6d7..807853e3d76c 100644 --- a/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs +++ b/crates/swc_ecma_usage_analyzer/src/analyzer/mod.rs @@ -225,7 +225,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_arrow_expr(&mut self, n: &ArrowExpr) { self.with_child(n.ctxt, ScopeKind::Fn, |child| { { @@ -248,7 +248,7 @@ where }) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_assign_expr(&mut self, n: &AssignExpr) { let is_op_assign = n.op != op!("="); n.left.visit_with(self); @@ -314,7 +314,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_await_expr(&mut self, n: &AwaitExpr) { let ctx = Ctx { in_await_arg: true, @@ -361,19 +361,19 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_binding_ident(&mut self, n: &BindingIdent) { self.visit_pat_id(&Ident::from(n)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_block_stmt(&mut self, n: &BlockStmt) { self.with_child(n.ctxt, ScopeKind::Block, |child| { n.visit_children_with(child); }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_call_expr(&mut self, n: &CallExpr) { let inline_prevented = self.ctx.inline_prevented || self @@ -478,7 +478,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_catch_clause(&mut self, n: &CatchClause) { { let ctx = Ctx { @@ -498,7 +498,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_class(&mut self, n: &Class) { n.decorators.visit_with(self); @@ -513,14 +513,14 @@ where self.with_child(n.ctxt, ScopeKind::Fn, |child| n.body.visit_with(child)) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_class_decl(&mut self, n: &ClassDecl) { self.declare_decl(&n.ident, true, None, false); n.visit_children_with(self); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_class_expr(&mut self, n: &ClassExpr) { n.visit_children_with(self); @@ -529,7 +529,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_class_method(&mut self, n: &ClassMethod) { n.function.decorators.visit_with(self); @@ -547,7 +547,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_class_prop(&mut self, n: &ClassProp) { let ctx = Ctx { is_id_ref: true, @@ -557,7 +557,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_computed_prop_name(&mut self, n: &ComputedPropName) { let ctx = Ctx { is_id_ref: true, @@ -567,7 +567,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_cond_expr(&mut self, n: &CondExpr) { n.test.visit_with(self); @@ -581,7 +581,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_constructor(&mut self, n: &Constructor) { self.with_child(n.ctxt, ScopeKind::Fn, |child| { { @@ -617,7 +617,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_do_while_stmt(&mut self, n: &DoWhileStmt) { n.body.visit_with(&mut *self.with_ctx(Ctx { executed_multiple_time: true, @@ -629,7 +629,7 @@ where })); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_export_decl(&mut self, n: &ExportDecl) { n.visit_children_with(self); @@ -651,7 +651,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_export_default_expr(&mut self, n: &ExportDefaultExpr) { let ctx = Ctx { is_id_ref: true, @@ -673,7 +673,7 @@ where }; } - #[cfg_attr(feature = "debug", tracing::instrument(skip(self, e)))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip(self, e)))] fn visit_expr(&mut self, e: &Expr) { let ctx = Ctx { in_pat_of_var_decl: false, @@ -687,7 +687,7 @@ where e.visit_children_with(&mut *self.with_ctx(ctx)); if let Expr::Ident(i) = e { - #[cfg(feature = "debug")] + #[cfg(feature = "tracing-spans")] { // debug!( // "Usage: `{}``; update = {:?}, assign_lhs = {:?} ", @@ -701,7 +701,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_expr_or_spread(&mut self, e: &ExprOrSpread) { e.visit_children_with(self); @@ -714,7 +714,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_fn_decl(&mut self, n: &FnDecl) { let ctx = Ctx { in_decl_with_no_side_effect_for_member_access: true, @@ -747,7 +747,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_fn_expr(&mut self, n: &FnExpr) { if let Some(n_id) = &n.ident { self.data @@ -776,7 +776,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_for_in_stmt(&mut self, n: &ForInStmt) { n.right.visit_with(self); @@ -803,7 +803,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_for_of_stmt(&mut self, n: &ForOfStmt) { n.right.visit_with(self); @@ -827,7 +827,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_for_stmt(&mut self, n: &ForStmt) { n.init.visit_with(self); @@ -842,7 +842,7 @@ where self.with_ctx(ctx).visit_in_cond(&n.body); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_function(&mut self, n: &Function) { n.decorators.visit_with(self); @@ -863,7 +863,7 @@ where }) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_getter_prop(&mut self, n: &GetterProp) { self.with_child(SyntaxContext::empty(), ScopeKind::Fn, |a| { n.key.visit_with(a); @@ -872,7 +872,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_if_stmt(&mut self, n: &IfStmt) { let ctx = Ctx { in_cond: true, @@ -896,7 +896,7 @@ where self.declare_decl(&n.local, true, None, false); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_jsx_element_name(&mut self, n: &JSXElementName) { let ctx = Ctx { in_pat_of_var_decl: false, @@ -914,7 +914,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip(self, e)))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip(self, e)))] fn visit_member_expr(&mut self, e: &MemberExpr) { { let ctx = Ctx { @@ -949,7 +949,7 @@ where }) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_method_prop(&mut self, n: &MethodProp) { n.function.decorators.visit_with(self); @@ -982,7 +982,7 @@ where n.visit_children_with(self); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_new_expr(&mut self, n: &NewExpr) { { n.callee.visit_with(self); @@ -1004,7 +1004,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_param(&mut self, n: &Param) { let ctx = Ctx { in_pat_of_param: false, @@ -1021,7 +1021,7 @@ where n.pat.visit_with(&mut *self.with_ctx(ctx)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_pat(&mut self, n: &Pat) { match n { Pat::Ident(i) => { @@ -1037,7 +1037,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_private_method(&mut self, n: &PrivateMethod) { n.function.decorators.visit_with(self); @@ -1055,7 +1055,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_private_prop(&mut self, n: &PrivateProp) { let ctx = Ctx { is_id_ref: true, @@ -1065,7 +1065,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_prop(&mut self, n: &Prop) { let ctx = Ctx { is_id_ref: true, @@ -1086,7 +1086,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_setter_prop(&mut self, n: &SetterProp) { self.with_child(SyntaxContext::empty(), ScopeKind::Fn, |a| { n.key.visit_with(a); @@ -1102,7 +1102,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_spread_element(&mut self, e: &SpreadElement) { e.visit_children_with(self); @@ -1113,7 +1113,7 @@ where }); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_stmt(&mut self, n: &Stmt) { let ctx = Ctx { in_await_arg: false, @@ -1139,7 +1139,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip(self, e)))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip(self, e)))] fn visit_super_prop_expr(&mut self, e: &SuperPropExpr) { if let SuperProp::Computed(c) = &e.prop { let ctx = Ctx { @@ -1159,7 +1159,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_switch_stmt(&mut self, n: &SwitchStmt) { n.discriminant.visit_with(self); @@ -1180,7 +1180,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_tagged_tpl(&mut self, n: &TaggedTpl) { { let ctx = Ctx { @@ -1202,7 +1202,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_tpl(&mut self, n: &Tpl) { let ctx = Ctx { is_id_ref: false, @@ -1212,7 +1212,7 @@ where n.visit_children_with(&mut *self.with_ctx(ctx)) } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_try_stmt(&mut self, n: &TryStmt) { let ctx = Ctx { in_cond: true, @@ -1222,7 +1222,7 @@ where self.with_ctx(ctx).visit_children_in_cond(n); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_unary_expr(&mut self, n: &UnaryExpr) { if n.op == op!("delete") { self.mark_mutation_if_member(n.arg.as_member()); @@ -1230,7 +1230,7 @@ where n.visit_children_with(self); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_update_expr(&mut self, n: &UpdateExpr) { n.visit_children_with(self); @@ -1238,7 +1238,7 @@ where self.mark_mutation_if_member(n.arg.as_member()); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_var_decl(&mut self, n: &VarDecl) { let ctx = Ctx { var_decl_kind_of_pat: Some(n.kind), @@ -1264,7 +1264,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip(self, e)))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip(self, e)))] fn visit_var_declarator(&mut self, e: &VarDeclarator) { let prevent_inline = matches!(&e.name, Pat::Ident(BindingIdent { id: Ident { sym: arguments, .. }, @@ -1318,7 +1318,7 @@ where } } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_while_stmt(&mut self, n: &WhileStmt) { n.test.visit_with(&mut *self.with_ctx(Ctx { executed_multiple_time: true, @@ -1333,7 +1333,7 @@ where self.with_ctx(ctx).visit_in_cond(&n.body); } - #[cfg_attr(feature = "debug", tracing::instrument(skip_all))] + #[cfg_attr(feature = "tracing-spans", tracing::instrument(skip_all))] fn visit_with_stmt(&mut self, n: &WithStmt) { self.scope.mark_with_stmt(); n.visit_children_with(self); From 05f6097c1a2f9c3f45161fc75da945bdb83843c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:43:43 +0900 Subject: [PATCH 16/19] fjix --- crates/swc_fast_graph/src/digraph.rs | 12 ++++++------ crates/swc_macros_common/src/lib.rs | 10 ---------- crates/testing/src/output.rs | 2 +- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/crates/swc_fast_graph/src/digraph.rs b/crates/swc_fast_graph/src/digraph.rs index 265583365a1c..e09139c5175c 100644 --- a/crates/swc_fast_graph/src/digraph.rs +++ b/crates/swc_fast_graph/src/digraph.rs @@ -47,13 +47,13 @@ pub type FastDiGraphMap = FastGraphMap; /// /// - Associated data `N` for nodes and `E` for edges, called *weights*. /// - The node weight `N` must implement `Copy` and will be used as node -/// identifier, duplicated into several places in the data structure. -/// It must be suitable as a hash table key (implementing `Eq + Hash`). -/// The node type must also implement `Ord` so that the implementation can -/// order the pair (`a`, `b`) for an edge connecting any two nodes `a` and `b`. +/// identifier, duplicated into several places in the data structure. It must +/// be suitable as a hash table key (implementing `Eq + Hash`). The node type +/// must also implement `Ord` so that the implementation can order the pair +/// (`a`, `b`) for an edge connecting any two nodes `a` and `b`. /// - `E` can be of arbitrary type. /// - Edge type `Ty` that determines whether the graph edges are directed or -/// undirected. +/// undirected. /// /// You can use the type aliases `UnGraphMap` and `DiGraphMap` for convenience. /// @@ -418,7 +418,7 @@ where /// /// 1. Note that node and edge indices in the `Graph` have nothing in common /// with the `GraphMap`s node weights `N`. The node weights `N` are used - /// as node weights in the resulting `Graph`, too. + /// as node weights in the resulting `Graph`, too. /// 2. Note that the index type is user-chosen. /// /// Computes in **O(|V| + |E|)** time (average). diff --git a/crates/swc_macros_common/src/lib.rs b/crates/swc_macros_common/src/lib.rs index 6da88fd9f549..3347b20259b5 100644 --- a/crates/swc_macros_common/src/lib.rs +++ b/crates/swc_macros_common/src/lib.rs @@ -2,8 +2,6 @@ extern crate proc_macro; -#[cfg(procmacro2_semver_exempt)] -use pmutil::SpanExt; use proc_macro2::{Span, TokenStream}; use quote::ToTokens; use syn::{punctuated::Pair, *}; @@ -17,18 +15,10 @@ pub fn call_site() -> Span { Span::call_site() } -/// `Span::def_site().located_at(Span::call_site())` -#[cfg(not(procmacro2_semver_exempt))] pub fn def_site() -> Span { call_site() } -/// `Span::def_site().located_at(Span::call_site())` -#[cfg(procmacro2_semver_exempt)] -pub fn def_site() -> Span { - Span::def_site().located_at(Span::call_site()) -} - /// `attr` - tokens inside `#[]`. e.g. `derive(EqIgnoreSpan)`, ast_node pub fn print(attr: &'static str, tokens: proc_macro2::TokenStream) -> proc_macro::TokenStream { use std::env; diff --git a/crates/testing/src/output.rs b/crates/testing/src/output.rs index 930849fe1735..b80bb083864e 100644 --- a/crates/testing/src/output.rs +++ b/crates/testing/src/output.rs @@ -35,7 +35,7 @@ pub struct Diff { /// /// - The `CARGO_MANIFEST_DIR` directory is replaced with `$DIR`. /// - All backslashes (\) within same line as `$DIR` are converted to forward -/// slashes (/) (for Windows) - All CR LF newlines are converted to LF +/// slashes (/) (for Windows) - All CR LF newlines are converted to LF /// /// - `normalize-stdout` is not implemented (yet?). #[derive(Clone, Ord, PartialOrd, PartialEq, Eq, Default, Hash)] From 703c25d44c1a5adb315133f8a493402a81d8162f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 23 Jul 2024 13:45:14 +0900 Subject: [PATCH 17/19] Create small-lobsters-happen.md --- .changeset/small-lobsters-happen.md | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .changeset/small-lobsters-happen.md diff --git a/.changeset/small-lobsters-happen.md b/.changeset/small-lobsters-happen.md new file mode 100644 index 000000000000..7318b9ae128c --- /dev/null +++ b/.changeset/small-lobsters-happen.md @@ -0,0 +1,30 @@ +--- +binding_macros: patch +dbg-swc: patch +swc: patch +swc_bundler: patch +swc_common: patch +swc_core: patch +swc_css_codegen: patch +swc_css_compat: patch +swc_css_minifier: patch +swc_ecma_ast: patch +swc_ecma_codegen: patch +swc_ecma_codegen_macros: patch +swc_ecma_lints: patch +swc_ecma_minifier: patch +swc_ecma_transforms_base: patch +swc_ecma_transforms_module: patch +swc_ecma_transforms_testing: patch +swc_ecma_transforms_typescript: patch +swc_ecma_usage_analyzer: patch +swc_fast_graph: patch +swc_html_codegen: patch +swc_html_minifier: patch +swc_html_parser: patch +swc_macros_common: patch +swc_visit: patch +testing: patch +--- + +build: Update `rustc` to `nightly-2024-07-21` From 55152792cbda2d831db01def662d807832a9c9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 13:56:02 +0900 Subject: [PATCH 18/19] fix test --- Cargo.lock | 245 ++++++++++++++++++++------------- crates/swc_core/Cargo.toml | 3 +- crates/swc_core/tests/quote.rs | 10 +- 3 files changed, 157 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12341c66e618..d3f7151a5bfe 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "const-random", @@ -154,9 +154,9 @@ checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e" [[package]] name = "anyhow" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -181,9 +181,9 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "assert_cmd" -version = "2.0.13" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" +checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" dependencies = [ "anstyle", "bstr", @@ -384,7 +384,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf0ca73de70c3da94e4194e4a01fe732378f55d47cf4c0588caab22a0dbfa14" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "chrono", "either", "indexmap 2.2.6", @@ -508,9 +508,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "changesets" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf07f590d03d31b8c8fac9fbefead153de37cc9a621d294e20174fb7279f63e" +checksum = "2cc9a2cd1dfcbaf58c5a8552616ee811323cc614ffa612857b0ff610b5335b0e" [[package]] name = "chrono" @@ -1523,9 +1523,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -1630,7 +1630,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", ] [[package]] @@ -1639,7 +1639,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "allocator-api2", ] @@ -1714,9 +1714,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" dependencies = [ "bytes", "fnv", @@ -1748,9 +1748,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -2148,6 +2148,15 @@ dependencies = [ "hashbrown 0.13.2", ] +[[package]] +name = "lz4_flex" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75761162ae2b0e580d7e7c390558127e5f01b4194debd6221fd8c207fc80e3f5" +dependencies = [ + "twox-hash", +] + [[package]] name = "mach" version = "0.3.2" @@ -2157,6 +2166,21 @@ dependencies = [ "libc", ] +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + [[package]] name = "matchers" version = "0.1.0" @@ -2802,7 +2826,7 @@ dependencies = [ name = "preset_env_base" version = "0.5.1" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "anyhow", "browserslist-rs", "dashmap", @@ -3045,14 +3069,14 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "region" -version = "3.0.0" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e189c2369884dce920945e2ddf79b3dff49e071a167dd1817fa9c4c00d512e" +checksum = "e6b6ebd13bc009aef9cd476c1310d49ac354d36e240cf1bd753290f3dc7199a7" dependencies = [ "bitflags 1.3.2", "libc", - "mach", - "winapi", + "mach2", + "windows-sys 0.52.0", ] [[package]] @@ -3407,21 +3431,9 @@ dependencies = [ [[package]] name = "serde_yaml" -version = "0.8.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" -dependencies = [ - "indexmap 1.9.3", - "ryu", - "serde", - "yaml-rust", -] - -[[package]] -name = "serde_yaml" -version = "0.9.30" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1bf28c79a99f70ee1f1d83d10c875d2e70618417fda01ad1785e027579d9d38" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ "indexmap 2.2.6", "itoa", @@ -3536,6 +3548,17 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" +[[package]] +name = "smoltcp" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee34c1e1bfc7e9206cc0fb8030a90129b4e319ab53856249bb27642cab914fb3" +dependencies = [ + "bitflags 1.3.2", + "byteorder", + "managed", +] + [[package]] name = "socket2" version = "0.4.10" @@ -3799,7 +3822,7 @@ dependencies = [ name = "swc_cached" version = "0.3.20" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "anyhow", "dashmap", "once_cell", @@ -3835,7 +3858,7 @@ dependencies = [ name = "swc_common" version = "0.36.1" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "anyhow", "arbitrary", "ast_node", @@ -4969,7 +4992,7 @@ dependencies = [ name = "swc_estree_compat" version = "0.207.1" dependencies = [ - "ahash 0.8.8", + "ahash 0.8.11", "anyhow", "codspeed-criterion-compat", "copyless", @@ -5635,9 +5658,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", @@ -5656,9 +5679,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ "num-conv", "time-core", @@ -5914,6 +5937,16 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typed-arena" version = "2.0.2" @@ -5994,9 +6027,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4c90930b95a82d00dc9e9ac071b4991924390d46cbd0dfe566148667605e4b" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "url" @@ -6087,9 +6120,9 @@ dependencies = [ [[package]] name = "virtual-mio" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f38a379f14296f9fb93eda42ece4d57b568af417569102c3dcfeb88ab4800f" +checksum = "ff8026c9d7575dc9afd8a0907357acb7aa55ec262097fbccae5da42f67773b3c" dependencies = [ "async-trait", "bytes", @@ -6104,20 +6137,24 @@ dependencies = [ [[package]] name = "virtual-net" -version = "0.6.2" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b66781480898ee7ee62a2bbe2955ce1bb5a90fdc8bfedbdabe3537b177fa3e" +checksum = "74aa69bbb19e531d274ba1aa730028f6fcd2117513ff6696d020af05188dfe92" dependencies = [ "anyhow", "async-trait", "base64", "bincode", + "bytecheck", "bytes", "derivative", "futures-util", "pin-project-lite", + "rkyv", "serde", + "smoltcp", "thiserror", + "tokio", "tracing", "virtual-mio", ] @@ -6188,9 +6225,9 @@ dependencies = [ [[package]] name = "wai-bindgen-wasmer" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f4a7cb5421959864b139870a7ebba26eafc9b46648feda9ac143528e9a8769" +checksum = "39a8ae4f43b477b58e5f69924983a82136ccbaceccf5fac8e069bbd64f55a964" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -6343,9 +6380,9 @@ dependencies = [ [[package]] name = "wasmer" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5467c7a23f9be04d5691590bea509dbea27e5ba5810d0020bef908456a495f33" +checksum = "5c15724dc25d1ee57962334aea8e41ade2675e5ea2ac6b8d42da6051b0face66" dependencies = [ "bytes", "cfg-if", @@ -6359,23 +6396,23 @@ dependencies = [ "shared-buffer", "target-lexicon", "thiserror", + "tracing", "wasm-bindgen", "wasmer-compiler", "wasmer-compiler-cranelift", "wasmer-derive", "wasmer-types", "wasmer-vm", - "wasmparser 0.83.0", - "wasmparser 0.95.0", + "wasmparser", "wat", "winapi", ] [[package]] name = "wasmer-cache" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1613ff5e7db7645eab2f003411b1e7a12dcf0ff4677f6e7712ba74ebf40b276" +checksum = "e3242b5cf4d27d33daa44b60b153365f733e9fb833cf61594e577ae55456e85f" dependencies = [ "blake3", "hex", @@ -6385,9 +6422,9 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "510ad01a668d774f3a103a7c219bbc0970be93e8f1b27e2fdb48d1f4ccd1deff" +checksum = "55a7f3b3a96f8d844c25e2c032af9572306dd63fa93dc17bcca4c5458ac569bd" dependencies = [ "backtrace", "bytes", @@ -6406,15 +6443,15 @@ dependencies = [ "thiserror", "wasmer-types", "wasmer-vm", - "wasmparser 0.95.0", + "wasmparser", "winapi", ] [[package]] name = "wasmer-compiler-cranelift" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54bf93078990d83960d798de3c5935bddaba771fc2fefb9ed6bab9c0bbdea5c1" +checksum = "102e2c5bacac69495c4025767e2fa26797ffb27f242dccb7cf57d9cefd944386" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -6431,9 +6468,9 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b374fd34d97b1c091d8675f9bc472df52dc6787d139d3762d42c7dc84813a9b" +checksum = "0ea737fa08f95d6abc4459f42a70a9833e8974b814e74971d77ef473814f4d4c" dependencies = [ "proc-macro-error", "proc-macro2", @@ -6441,6 +6478,31 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "wasmer-journal" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f7db07627d56d4b714255d8f1f7f07378dd5a3bc67e612ece42afa7e4a0e477" +dependencies = [ + "anyhow", + "async-trait", + "base64", + "bincode", + "bytecheck", + "bytes", + "derivative", + "lz4_flex", + "num_enum", + "rkyv", + "serde", + "serde_json", + "thiserror", + "tracing", + "virtual-net", + "wasmer", + "wasmer-wasix-types", +] + [[package]] name = "wasmer-toml" version = "0.9.2" @@ -6454,16 +6516,16 @@ dependencies = [ "serde", "serde_cbor", "serde_json", - "serde_yaml 0.9.30", + "serde_yaml", "thiserror", "toml 0.8.8", ] [[package]] name = "wasmer-types" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0caf1c87937b52aba8e9f920a278e1beda282f7439612c0b48f51a58e7a87bab" +checksum = "b0689110e291b0f07fc665f2824e5ff81df120848e8a9acfbf1a9bf7990773f9" dependencies = [ "bytecheck", "enum-iterator", @@ -6478,9 +6540,9 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "4.2.5" +version = "4.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58315c25492bc72a33f47a7d7fb0869a0106fc0164ec051e349a9e1eddba9a01" +checksum = "4cd41f822a1ac4242d478754e8ceba2806a00ea5072803622e1fe91e8e28b2a1" dependencies = [ "backtrace", "cc", @@ -6506,13 +6568,15 @@ dependencies = [ [[package]] name = "wasmer-wasix" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9697b8ffc3a37c193648919018848171de0d75e6e955377893d258431b19d7a" +checksum = "25cd997abba5a5b59bad212c53f953eff28c7cee38b67b989b114cf5b80e9625" dependencies = [ "anyhow", "async-trait", + "base64", "bincode", + "bytecheck", "bytes", "cfg-if", "chrono", @@ -6528,18 +6592,22 @@ dependencies = [ "lazy_static", "libc", "linked_hash_set", + "lz4_flex", + "num_enum", "once_cell", "petgraph", "pin-project", "rand", + "rkyv", "rusty_pool", "semver 1.0.21", "serde", "serde_cbor", "serde_derive", "serde_json", - "serde_yaml 0.8.26", + "serde_yaml", "sha2", + "shared-buffer", "tempfile", "term_size", "termios", @@ -6556,6 +6624,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "wasmer", + "wasmer-journal", "wasmer-types", "wasmer-wasix-types", "web-sys", @@ -6567,9 +6636,9 @@ dependencies = [ [[package]] name = "wasmer-wasix-types" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65ca293eae6e3af6e4fd9fe1c8e096151d4f06cbb405ce5dd65edb779aba42d9" +checksum = "a1be275d30cc4c69cd2d52d4fee2e83feb3f35b381497d3f7c71ad5a4cde24d8" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -6591,18 +6660,13 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.83.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718ed7c55c2add6548cca3ddd6383d738cd73b892df400e96b9aa876f0141d7a" - -[[package]] -name = "wasmparser" -version = "0.95.0" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ea896273ea99b15132414be1da01ab0d8836415083298ecaffbe308eaac87a" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ - "indexmap 1.9.3", - "url", + "bitflags 2.5.0", + "indexmap 2.2.6", + "semver 1.0.21", ] [[package]] @@ -6946,18 +7010,9 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" - -[[package]] -name = "yaml-rust" -version = "0.4.5" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" -dependencies = [ - "linked-hash-map", -] +checksum = "63658493314859b4dfdf3fb8c1defd61587839def09582db50b8a4e93afca6bb" [[package]] name = "yansi" diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index fc6e524f81dd..2f1be7d2b175 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -390,4 +390,5 @@ swc_plugin_runner = { optional = true, version = "0.111.0", path = "../swc_plugi vergen = { workspace = true, features = ["cargo"] } [dev-dependencies] -anyhow = { workspace = true } +anyhow = { workspace = true } +testing = { version = "0.38.0", path = "../testing" } diff --git a/crates/swc_core/tests/quote.rs b/crates/swc_core/tests/quote.rs index 4a02359f3f80..cb96e59d5d46 100644 --- a/crates/swc_core/tests/quote.rs +++ b/crates/swc_core/tests/quote.rs @@ -1,5 +1,5 @@ #[cfg(feature = "ecma_quote")] -use swc_core::{ast::Ident, common::DUMMY_SP, quote, quote_expr, utils::private_ident}; +use swc_core::{common::DUMMY_SP, ecma::ast::Ident, ecma::utils::private_ident, quote, quote_expr}; #[cfg(feature = "ecma_quote")] #[test] @@ -25,7 +25,7 @@ fn quote_expr_var_cloned() { fn quote_example() { let _stmt = quote!( "const $name = 4;" as Stmt, - name = Ident::new("ref".into(), DUMMY_SP) + name = Ident::new("ref".into(), DUMMY_SP, Default::default()) ); } @@ -34,7 +34,7 @@ fn quote_example() { fn quote_var_type_expr() { let _stmt = quote!( "const $name = $val;" as Stmt, - name = Ident::new("ref".into(), DUMMY_SP), + name = Ident::new("ref".into(), DUMMY_SP, Default::default()), val: Expr = 4.into(), ); } @@ -44,7 +44,7 @@ fn quote_var_type_expr() { fn quote_var_type_pat() { let _stmt = quote!( "const $name = $val;" as Stmt, - name: Pat = Ident::new("ref".into(), DUMMY_SP).into(), - val: Ident = Ident::new("val".into(), DUMMY_SP), + name: Pat = Ident::new("ref".into(), DUMMY_SP, Default::default()).into(), + val: Ident = Ident::new("val".into(), DUMMY_SP, Default::default()), ); } From b343ab23442d66ab744e86f3e0117f51c6b67289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Tue, 23 Jul 2024 14:01:18 +0900 Subject: [PATCH 19/19] fix --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d3f7151a5bfe..9afa17ab886d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5658,9 +5658,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.34" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", @@ -5679,9 +5679,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ "num-conv", "time-core",