From aa0154d2d86b0bed7ffed3324c7a650ffe111c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 12 Mar 2024 14:58:52 +0900 Subject: [PATCH 01/13] fix(es/minifier): Fix evaluation of array literals with `void 0` (#8733) **Related issue:** - Closes #8706 --- .../tests/fixture/issues/8706/config.json | 3 +++ .../tests/fixture/issues/8706/input.js | 1 + .../tests/fixture/issues/8706/output.js | 1 + crates/swc_ecma_utils/src/lib.rs | 10 ++++++++++ 4 files changed, 15 insertions(+) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8706/config.json create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8706/input.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8706/output.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8706/config.json b/crates/swc_ecma_minifier/tests/fixture/issues/8706/config.json new file mode 100644 index 000000000000..ee65e9fdc67e --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8706/config.json @@ -0,0 +1,3 @@ +{ + "defaults": true +} diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8706/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/8706/input.js new file mode 100644 index 000000000000..97839772a01d --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8706/input.js @@ -0,0 +1 @@ +console.log([void 0] + 'swc'); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8706/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/8706/output.js new file mode 100644 index 000000000000..e7d809d714df --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8706/output.js @@ -0,0 +1 @@ +console.log("swc"); diff --git a/crates/swc_ecma_utils/src/lib.rs b/crates/swc_ecma_utils/src/lib.rs index 61562fedf53f..2963edaca181 100644 --- a/crates/swc_ecma_utils/src/lib.rs +++ b/crates/swc_ecma_utils/src/lib.rs @@ -1027,6 +1027,16 @@ pub trait ExprExt { let ExprOrSpread { ref expr, .. } = *elem; match &**expr { Expr::Lit(Lit::Null(..)) => Cow::Borrowed(""), + Expr::Unary(UnaryExpr { + op: op!("void"), + arg, + .. + }) => { + if arg.may_have_side_effects(ctx) { + return Value::Unknown; + } + Cow::Borrowed("") + } Expr::Ident(Ident { sym: undefined, .. }) if &**undefined == "undefined" => { From e46dd5a208d228a1707dec67ec5ac6bce00df1a1 Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Tue, 12 Mar 2024 06:00:28 +0000 Subject: [PATCH 02/13] chore: Bump crates --- CHANGELOG.md | 6 +++--- Cargo.lock | 8 ++++---- crates/swc/Cargo.toml | 4 ++-- crates/swc_bundler/Cargo.toml | 2 +- crates/swc_core/Cargo.toml | 4 ++-- crates/swc_ecma_compat_bugfixes/Cargo.toml | 2 +- crates/swc_ecma_compat_common/Cargo.toml | 4 ++-- crates/swc_ecma_compat_es2015/Cargo.toml | 4 ++-- crates/swc_ecma_compat_es2016/Cargo.toml | 2 +- crates/swc_ecma_compat_es2017/Cargo.toml | 2 +- crates/swc_ecma_compat_es2018/Cargo.toml | 4 ++-- crates/swc_ecma_compat_es2019/Cargo.toml | 2 +- crates/swc_ecma_compat_es2020/Cargo.toml | 2 +- crates/swc_ecma_compat_es2021/Cargo.toml | 2 +- crates/swc_ecma_compat_es2022/Cargo.toml | 4 ++-- crates/swc_ecma_compat_es3/Cargo.toml | 2 +- crates/swc_ecma_ext_transforms/Cargo.toml | 4 ++-- crates/swc_ecma_lints/Cargo.toml | 2 +- crates/swc_ecma_minifier/Cargo.toml | 4 ++-- crates/swc_ecma_preset_env/Cargo.toml | 2 +- crates/swc_ecma_transforms/Cargo.toml | 2 +- crates/swc_ecma_transforms_base/Cargo.toml | 2 +- crates/swc_ecma_transforms_classes/Cargo.toml | 2 +- crates/swc_ecma_transforms_compat/Cargo.toml | 4 ++-- crates/swc_ecma_transforms_module/Cargo.toml | 2 +- crates/swc_ecma_transforms_optimization/Cargo.toml | 2 +- crates/swc_ecma_transforms_proposal/Cargo.toml | 2 +- crates/swc_ecma_transforms_react/Cargo.toml | 2 +- crates/swc_ecma_transforms_testing/Cargo.toml | 2 +- crates/swc_ecma_transforms_typescript/Cargo.toml | 2 +- crates/swc_ecma_usage_analyzer/Cargo.toml | 4 ++-- crates/swc_ecma_utils/Cargo.toml | 2 +- crates/swc_ecmascript/Cargo.toml | 2 +- crates/swc_estree_compat/Cargo.toml | 2 +- crates/swc_node_bundler/Cargo.toml | 2 +- 35 files changed, 50 insertions(+), 50 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcad69ae1e2d..e32a9c995091 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,9 @@ - **(es/minifier)** Handle cyclic references while dropping unused properties ([#8725](https://github.com/swc-project/swc/issues/8725)) ([102241b](https://github.com/swc-project/swc/commit/102241b812b8e815b59575178193bb71b4264bab)) + +- **(es/minifier)** Fix evaluation of array literals with `void 0` ([#8733](https://github.com/swc-project/swc/issues/8733)) ([aa0154d](https://github.com/swc-project/swc/commit/aa0154d2d86b0bed7ffed3324c7a650ffe111c93)) + ### Features @@ -1416,9 +1419,6 @@ - **(common)** Make `ahash` optional ([#7816](https://github.com/swc-project/swc/issues/7816)) ([981d7b1](https://github.com/swc-project/swc/commit/981d7b152b2f488a67d42052152db22225f1d094)) -- **(es/parser)** Remove needless `unsafe` ([#7818](https://github.com/swc-project/swc/issues/7818)) ([8b809db](https://github.com/swc-project/swc/commit/8b809dbe23cab3db2159979cf1852a69c109f1e0)) - - - Use `ahash` from `swc_common` in more places ([#7815](https://github.com/swc-project/swc/issues/7815)) ([b43e38d](https://github.com/swc-project/swc/commit/b43e38d3f92bc889e263b741dbe173a6f2206d88)) diff --git a/Cargo.lock b/Cargo.lock index 2c643c0797c9..f01d4310b134 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4204,7 +4204,7 @@ dependencies = [ [[package]] name = "swc_ecma_compat_common" -version = "0.4.10" +version = "0.4.11" dependencies = [ "swc_common", "swc_ecma_ast", @@ -4375,7 +4375,7 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.113.10" +version = "0.113.11" dependencies = [ "phf", "swc_atoms", @@ -4833,7 +4833,7 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.23.10" +version = "0.23.11" dependencies = [ "indexmap 2.1.0", "rustc-hash", @@ -4848,7 +4848,7 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.127.10" +version = "0.127.11" dependencies = [ "indexmap 2.1.0", "num_cpus", diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 56a05d557cde..7338fb06092e 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -78,7 +78,7 @@ swc_compiler_base = { version = "0.7.15", path = "../swc_compiler_base" } swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } -swc_ecma_ext_transforms = { version = "0.113.10", path = "../swc_ecma_ext_transforms" } +swc_ecma_ext_transforms = { version = "0.113.11", path = "../swc_ecma_ext_transforms" } swc_ecma_lints = { version = "0.92.16", path = "../swc_ecma_lints" } swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = [ "cache", @@ -99,7 +99,7 @@ swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", f swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_error_reporters = { version = "0.17.18", path = "../swc_error_reporters" } swc_node_comments = { version = "0.20.18", path = "../swc_node_comments" } diff --git a/crates/swc_bundler/Cargo.toml b/crates/swc_bundler/Cargo.toml index 565d7e3487ba..d8d2c83f5fbd 100644 --- a/crates/swc_bundler/Cargo.toml +++ b/crates/swc_bundler/Cargo.toml @@ -45,7 +45,7 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_lo swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_fast_graph = { version = "0.21.19", path = "../swc_fast_graph/" } swc_graph_analyzer = { version = "0.22.21", path = "../swc_graph_analyzer/" } diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index e90346e9341b..719913600cfe 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -358,8 +358,8 @@ swc_ecma_transforms_proposal = { optional = true, version = "0.171.14", path swc_ecma_transforms_react = { optional = true, version = "0.183.14", path = "../swc_ecma_transforms_react" } swc_ecma_transforms_testing = { optional = true, version = "0.140.14", path = "../swc_ecma_transforms_testing" } swc_ecma_transforms_typescript = { optional = true, version = "0.188.14", path = "../swc_ecma_transforms_typescript" } -swc_ecma_usage_analyzer = { optional = true, version = "0.23.10", path = "../swc_ecma_usage_analyzer" } -swc_ecma_utils = { optional = true, version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_usage_analyzer = { optional = true, version = "0.23.11", path = "../swc_ecma_usage_analyzer" } +swc_ecma_utils = { optional = true, version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { optional = true, version = "0.98.6", path = "../swc_ecma_visit" } swc_malloc = { optional = true, version = "0.5.10", path = "../swc_malloc" } swc_node_bundler = { optional = true, version = "0.62.18", path = "../swc_node_bundler" } diff --git a/crates/swc_ecma_compat_bugfixes/Cargo.toml b/crates/swc_ecma_compat_bugfixes/Cargo.toml index eae2c52f875c..ba9587027ea1 100644 --- a/crates/swc_ecma_compat_bugfixes/Cargo.toml +++ b/crates/swc_ecma_compat_bugfixes/Cargo.toml @@ -16,7 +16,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_compat_es2015 = { version = "0.4.14", path = "../swc_ecma_compat_es2015" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } tracing = "0.1.37" diff --git a/crates/swc_ecma_compat_common/Cargo.toml b/crates/swc_ecma_compat_common/Cargo.toml index 8dfd4888d647..e2ba7d0fde05 100644 --- a/crates/swc_ecma_compat_common/Cargo.toml +++ b/crates/swc_ecma_compat_common/Cargo.toml @@ -7,13 +7,13 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_compat_common" repository = "https://github.com/swc-project/swc.git" -version = "0.4.10" +version = "0.4.11" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2015/Cargo.toml b/crates/swc_ecma_compat_es2015/Cargo.toml index e356d9e84cb1..3b8c945e6b87 100644 --- a/crates/swc_ecma_compat_es2015/Cargo.toml +++ b/crates/swc_ecma_compat_es2015/Cargo.toml @@ -25,11 +25,11 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_compat_common = { version = "0.4.10", path = "../swc_ecma_compat_common" } +swc_ecma_compat_common = { version = "0.4.11", path = "../swc_ecma_compat_common" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "0.126.14", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } tracing = "0.1.37" diff --git a/crates/swc_ecma_compat_es2016/Cargo.toml b/crates/swc_ecma_compat_es2016/Cargo.toml index d650d09f30b9..db82a1b9c2a6 100644 --- a/crates/swc_ecma_compat_es2016/Cargo.toml +++ b/crates/swc_ecma_compat_es2016/Cargo.toml @@ -18,7 +18,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } tracing = "0.1.37" diff --git a/crates/swc_ecma_compat_es2017/Cargo.toml b/crates/swc_ecma_compat_es2017/Cargo.toml index f6185c1fce5a..fcc089b14cec 100644 --- a/crates/swc_ecma_compat_es2017/Cargo.toml +++ b/crates/swc_ecma_compat_es2017/Cargo.toml @@ -21,7 +21,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2018/Cargo.toml b/crates/swc_ecma_compat_es2018/Cargo.toml index 083c557666fd..129ba7cfce7c 100644 --- a/crates/swc_ecma_compat_es2018/Cargo.toml +++ b/crates/swc_ecma_compat_es2018/Cargo.toml @@ -19,10 +19,10 @@ tracing = "0.1.37" swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_compat_common = { version = "0.4.10", path = "../swc_ecma_compat_common" } +swc_ecma_compat_common = { version = "0.4.11", path = "../swc_ecma_compat_common" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2019/Cargo.toml b/crates/swc_ecma_compat_es2019/Cargo.toml index 2b0f36a47b00..343ee5275616 100644 --- a/crates/swc_ecma_compat_es2019/Cargo.toml +++ b/crates/swc_ecma_compat_es2019/Cargo.toml @@ -20,7 +20,7 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2020/Cargo.toml b/crates/swc_ecma_compat_es2020/Cargo.toml index c1b8b1aa5683..a5f9f3e85870 100644 --- a/crates/swc_ecma_compat_es2020/Cargo.toml +++ b/crates/swc_ecma_compat_es2020/Cargo.toml @@ -19,7 +19,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_compat_es2022 = { version = "0.4.14", path = "../swc_ecma_compat_es2022" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } tracing = "0.1.37" diff --git a/crates/swc_ecma_compat_es2021/Cargo.toml b/crates/swc_ecma_compat_es2021/Cargo.toml index 01e89167c872..7a8cb6ea8eb9 100644 --- a/crates/swc_ecma_compat_es2021/Cargo.toml +++ b/crates/swc_ecma_compat_es2021/Cargo.toml @@ -19,6 +19,6 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2022/Cargo.toml b/crates/swc_ecma_compat_es2022/Cargo.toml index efc7c734808f..f2a782d19434 100644 --- a/crates/swc_ecma_compat_es2022/Cargo.toml +++ b/crates/swc_ecma_compat_es2022/Cargo.toml @@ -19,10 +19,10 @@ tracing = "0.1.37" swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_compat_common = { version = "0.4.10", path = "../swc_ecma_compat_common" } +swc_ecma_compat_common = { version = "0.4.11", path = "../swc_ecma_compat_common" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "0.126.14", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es3/Cargo.toml b/crates/swc_ecma_compat_es3/Cargo.toml index d2bc29a59ee5..ae5d4c419f91 100644 --- a/crates/swc_ecma_compat_es3/Cargo.toml +++ b/crates/swc_ecma_compat_es3/Cargo.toml @@ -18,7 +18,7 @@ tracing = "0.1.37" swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_ext_transforms/Cargo.toml b/crates/swc_ecma_ext_transforms/Cargo.toml index 66140284f06b..882fabc6fd0a 100644 --- a/crates/swc_ecma_ext_transforms/Cargo.toml +++ b/crates/swc_ecma_ext_transforms/Cargo.toml @@ -5,7 +5,7 @@ documentation = "https://rustdoc.swc.rs/swc_ecma_ext_transforms/" edition = "2021" license = "Apache-2.0" name = "swc_ecma_ext_transforms" -version = "0.113.10" +version = "0.113.11" [lib] bench = false @@ -16,5 +16,5 @@ phf = { version = "0.11", features = ["macros"] } swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_lints/Cargo.toml b/crates/swc_ecma_lints/Cargo.toml index fa342a5c6da3..240197516d27 100644 --- a/crates/swc_ecma_lints/Cargo.toml +++ b/crates/swc_ecma_lints/Cargo.toml @@ -28,7 +28,7 @@ swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast", features = [ "serde", ] } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_minifier/Cargo.toml b/crates/swc_ecma_minifier/Cargo.toml index 0d437dddeb34..0fffc8dbe71a 100644 --- a/crates/swc_ecma_minifier/Cargo.toml +++ b/crates/swc_ecma_minifier/Cargo.toml @@ -62,8 +62,8 @@ swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } -swc_ecma_usage_analyzer = { version = "0.23.10", path = "../swc_ecma_usage_analyzer" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_usage_analyzer = { version = "0.23.11", path = "../swc_ecma_usage_analyzer" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_timer = { version = "0.21.20", path = "../swc_timer" } diff --git a/crates/swc_ecma_preset_env/Cargo.toml b/crates/swc_ecma_preset_env/Cargo.toml index 6ecc90b081bc..6eaf08d07177 100644 --- a/crates/swc_ecma_preset_env/Cargo.toml +++ b/crates/swc_ecma_preset_env/Cargo.toml @@ -36,7 +36,7 @@ swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", f "compat", "proposal", ] } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms/Cargo.toml b/crates/swc_ecma_transforms/Cargo.toml index 432a2a80e391..18a629123c89 100644 --- a/crates/swc_ecma_transforms/Cargo.toml +++ b/crates/swc_ecma_transforms/Cargo.toml @@ -41,7 +41,7 @@ swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_t swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal", optional = true } swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react", optional = true } swc_ecma_transforms_typescript = { version = "0.188.14", path = "../swc_ecma_transforms_typescript", optional = true } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms_base/Cargo.toml b/crates/swc_ecma_transforms_base/Cargo.toml index 664757743126..4aacb57f1b24 100644 --- a/crates/swc_ecma_transforms_base/Cargo.toml +++ b/crates/swc_ecma_transforms_base/Cargo.toml @@ -32,7 +32,7 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms_classes/Cargo.toml b/crates/swc_ecma_transforms_classes/Cargo.toml index 4e69ad885b36..2ca9b3b3f0ca 100644 --- a/crates/swc_ecma_transforms_classes/Cargo.toml +++ b/crates/swc_ecma_transforms_classes/Cargo.toml @@ -16,5 +16,5 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_compat/Cargo.toml b/crates/swc_ecma_transforms_compat/Cargo.toml index 7500757c946e..fbacdc81f0dc 100644 --- a/crates/swc_ecma_transforms_compat/Cargo.toml +++ b/crates/swc_ecma_transforms_compat/Cargo.toml @@ -34,7 +34,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_compat_bugfixes = { version = "0.4.14", path = "../swc_ecma_compat_bugfixes" } -swc_ecma_compat_common = { version = "0.4.10", path = "../swc_ecma_compat_common" } +swc_ecma_compat_common = { version = "0.4.11", path = "../swc_ecma_compat_common" } swc_ecma_compat_es2015 = { version = "0.4.14", path = "../swc_ecma_compat_es2015" } swc_ecma_compat_es2016 = { version = "0.4.14", path = "../swc_ecma_compat_es2016" } swc_ecma_compat_es2017 = { version = "0.4.14", path = "../swc_ecma_compat_es2017" } @@ -47,7 +47,7 @@ swc_ecma_compat_es3 = { version = "0.4.14", path = "../swc_ecma_compat_e swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "0.126.14", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_trace_macro = { version = "0.1.3", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_transforms_module/Cargo.toml b/crates/swc_ecma_transforms_module/Cargo.toml index 579ca88bc1ca..baab17513cfc 100644 --- a/crates/swc_ecma_transforms_module/Cargo.toml +++ b/crates/swc_ecma_transforms_module/Cargo.toml @@ -33,7 +33,7 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = ] } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms_optimization/Cargo.toml b/crates/swc_ecma_transforms_optimization/Cargo.toml index ee812592b438..ecdc133ba570 100644 --- a/crates/swc_ecma_transforms_optimization/Cargo.toml +++ b/crates/swc_ecma_transforms_optimization/Cargo.toml @@ -37,7 +37,7 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_fast_graph = { version = "0.21.19", path = "../swc_fast_graph" } diff --git a/crates/swc_ecma_transforms_proposal/Cargo.toml b/crates/swc_ecma_transforms_proposal/Cargo.toml index b70e1d5b748a..85c3e2c5b137 100644 --- a/crates/swc_ecma_transforms_proposal/Cargo.toml +++ b/crates/swc_ecma_transforms_proposal/Cargo.toml @@ -29,7 +29,7 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader" swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "0.126.14", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms_react/Cargo.toml b/crates/swc_ecma_transforms_react/Cargo.toml index de5b2870fe30..70489a861710 100644 --- a/crates/swc_ecma_transforms_react/Cargo.toml +++ b/crates/swc_ecma_transforms_react/Cargo.toml @@ -34,7 +34,7 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "0.5.4", path = "../swc_ecma_transforms_macros" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_transforms_testing/Cargo.toml b/crates/swc_ecma_transforms_testing/Cargo.toml index 654a450df638..95b1d8036129 100644 --- a/crates/swc_ecma_transforms_testing/Cargo.toml +++ b/crates/swc_ecma_transforms_testing/Cargo.toml @@ -30,6 +30,6 @@ swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_testing = { version = "0.22.21", path = "../swc_ecma_testing" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_ecma_transforms_typescript/Cargo.toml b/crates/swc_ecma_transforms_typescript/Cargo.toml index 88924ddc0ac9..0511e46798f5 100644 --- a/crates/swc_ecma_transforms_typescript/Cargo.toml +++ b/crates/swc_ecma_transforms_typescript/Cargo.toml @@ -21,7 +21,7 @@ swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_usage_analyzer/Cargo.toml b/crates/swc_ecma_usage_analyzer/Cargo.toml index 21bee8992e81..ab4aa215a664 100644 --- a/crates/swc_ecma_usage_analyzer/Cargo.toml +++ b/crates/swc_ecma_usage_analyzer/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_usage_analyzer" repository = "https://github.com/swc-project/swc.git" -version = "0.23.10" +version = "0.23.11" [package.metadata.docs.rs] all-features = true @@ -29,6 +29,6 @@ tracing = "0.1.37" swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_timer = { version = "0.21.20", path = "../swc_timer" } diff --git a/crates/swc_ecma_utils/Cargo.toml b/crates/swc_ecma_utils/Cargo.toml index 96b053e38be3..ae96e3820807 100644 --- a/crates/swc_ecma_utils/Cargo.toml +++ b/crates/swc_ecma_utils/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_ecma_utils" repository = "https://github.com/swc-project/swc.git" -version = "0.127.10" +version = "0.127.11" [package.metadata.docs.rs] all-features = true diff --git a/crates/swc_ecmascript/Cargo.toml b/crates/swc_ecmascript/Cargo.toml index fdbfbf4f4eaa..46950fdcbae2 100644 --- a/crates/swc_ecmascript/Cargo.toml +++ b/crates/swc_ecmascript/Cargo.toml @@ -45,7 +45,7 @@ swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser", option swc_ecma_preset_env = { version = "0.206.14", path = "../swc_ecma_preset_env", optional = true } swc_ecma_quote = { version = "0.59.11", path = "../swc_ecma_quote", optional = true } swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", optional = true } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils", optional = true } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils", optional = true } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit", optional = true } [dev-dependencies] diff --git a/crates/swc_estree_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml index 35ac331254ef..3ab837854ee2 100644 --- a/crates/swc_estree_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -31,7 +31,7 @@ swc_common = { version = "0.33.19", path = "../swc_common", features = [ ] } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_estree_ast = { version = "0.23.18", path = "../swc_estree_ast" } swc_node_comments = { version = "0.20.18", path = "../swc_node_comments/" } diff --git a/crates/swc_node_bundler/Cargo.toml b/crates/swc_node_bundler/Cargo.toml index 3ba47ade127b..83275dfb07e5 100644 --- a/crates/swc_node_bundler/Cargo.toml +++ b/crates/swc_node_bundler/Cargo.toml @@ -42,7 +42,7 @@ swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms" } -swc_ecma_utils = { version = "0.127.10", path = "../swc_ecma_utils" } +swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_malloc = { version = "0.5.10", path = "../swc_malloc" } From 312f0d8427b3c4436b491ed4265f9469dc017f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Tue, 12 Mar 2024 15:24:36 +0900 Subject: [PATCH 03/13] fix(es/minifier): Fix removal of array pattern bindings (#8730) **Related issue:** - Closes #8670 --- .../src/compress/optimize/unused.rs | 15 ++++++--------- crates/swc_ecma_minifier/tests/TODO.txt | 1 - .../tests/fixture/issues/8670/config.json | 5 +++++ .../tests/fixture/issues/8670/input.js | 2 ++ .../tests/fixture/issues/8670/output.js | 8 ++++++++ crates/swc_ecma_minifier/tests/passing.txt | 1 + .../output.js | 10 +++++++++- 7 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8670/config.json create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8670/input.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8670/output.js diff --git a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs index 14b810be9d64..79ebff51d8f3 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/unused.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/unused.rs @@ -345,25 +345,22 @@ impl Optimizer<'_> { } Pat::Array(arr) => { - for (idx, elem) in arr.elems.iter_mut().enumerate() { - match elem { + for (idx, arr_elem) in arr.elems.iter_mut().enumerate() { + match arr_elem { Some(p) => { - if p.is_ident() { - continue; - } - let elem = init .as_mut() .and_then(|expr| self.access_numeric_property(expr, idx)); self.take_pat_if_unused(p, elem, is_var_decl); + + if p.is_invalid() { + *arr_elem = None; + } } None => {} } } - - arr.elems - .retain(|elem| !matches!(elem, Some(Pat::Invalid(..)))) } Pat::Object(obj) => { diff --git a/crates/swc_ecma_minifier/tests/TODO.txt b/crates/swc_ecma_minifier/tests/TODO.txt index 2031e7c8c43e..cec001dfbdf4 100644 --- a/crates/swc_ecma_minifier/tests/TODO.txt +++ b/crates/swc_ecma_minifier/tests/TODO.txt @@ -184,7 +184,6 @@ harmony/issue_2874_2/input.js harmony/module_enabled/input.js harmony/module_mangle_scope/input.js harmony/regression_cannot_use_of/input.js -hoist_props/contains_this_3/input.js hoist_props/hoist_function_with_call/input.js if_return/if_return_same_value/input.js if_return/if_var_return/input.js diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8670/config.json b/crates/swc_ecma_minifier/tests/fixture/issues/8670/config.json new file mode 100644 index 000000000000..b15be3b3e06b --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8670/config.json @@ -0,0 +1,5 @@ +{ + "defaults": true, + "pure_getters": true, + "toplevel": true +} diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8670/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/8670/input.js new file mode 100644 index 000000000000..7b0444cf7412 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8670/input.js @@ -0,0 +1,2 @@ +const [a, b, c, d, e] = [1, 2, 3, 4, 5] +console.log(c) \ No newline at end of file diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8670/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/8670/output.js new file mode 100644 index 000000000000..482e2841b0ed --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8670/output.js @@ -0,0 +1,8 @@ +const [, , c, , ] = [ + 1, + 2, + 3, + 4, + 5 +]; +console.log(c); diff --git a/crates/swc_ecma_minifier/tests/passing.txt b/crates/swc_ecma_minifier/tests/passing.txt index f6a47e6515ce..d3f2f33b63db 100644 --- a/crates/swc_ecma_minifier/tests/passing.txt +++ b/crates/swc_ecma_minifier/tests/passing.txt @@ -739,6 +739,7 @@ hoist/hoist_no_destructurings/input.js hoist/hoist_vars/input.js hoist_props/contains_this_1/input.js hoist_props/contains_this_2/input.js +hoist_props/contains_this_3/input.js hoist_props/direct_access_1/input.js hoist_props/direct_access_2/input.js hoist_props/direct_access_3/input.js diff --git a/crates/swc_ecma_minifier/tests/terser/compress/destructuring/unused_destructuring_declaration_complex_1/output.js b/crates/swc_ecma_minifier/tests/terser/compress/destructuring/unused_destructuring_declaration_complex_1/output.js index 816d1b56097d..be76f977eb06 100644 --- a/crates/swc_ecma_minifier/tests/terser/compress/destructuring/unused_destructuring_declaration_complex_1/output.js +++ b/crates/swc_ecma_minifier/tests/terser/compress/destructuring/unused_destructuring_declaration_complex_1/output.js @@ -1,2 +1,10 @@ -const [, w, , x, { z: z }] = [1, 2, 3, 4, { z: 5 }]; +const [, , , x, { z: z }] = [ + 1, + 2, + 3, + 4, + { + z: 5 + } +]; console.log(x, z); From e4ce46682361554396341df959797f4a2a39a364 Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Tue, 12 Mar 2024 06:26:14 +0000 Subject: [PATCH 04/13] chore: Bump crates --- CHANGELOG.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e32a9c995091..c52821866efa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ - **(es/minifier)** Fix evaluation of array literals with `void 0` ([#8733](https://github.com/swc-project/swc/issues/8733)) ([aa0154d](https://github.com/swc-project/swc/commit/aa0154d2d86b0bed7ffed3324c7a650ffe111c93)) + +- **(es/minifier)** Fix removal of array pattern bindings ([#8730](https://github.com/swc-project/swc/issues/8730)) ([312f0d8](https://github.com/swc-project/swc/commit/312f0d8427b3c4436b491ed4265f9469dc017f8f)) + ### Features @@ -1418,7 +1421,4 @@ - **(common)** Make `ahash` optional ([#7816](https://github.com/swc-project/swc/issues/7816)) ([981d7b1](https://github.com/swc-project/swc/commit/981d7b152b2f488a67d42052152db22225f1d094)) - -- Use `ahash` from `swc_common` in more places ([#7815](https://github.com/swc-project/swc/issues/7815)) ([b43e38d](https://github.com/swc-project/swc/commit/b43e38d3f92bc889e263b741dbe173a6f2206d88)) - From 391d6f6820d385ac7c4181abd1f7d2c01a9b2172 Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Tue, 12 Mar 2024 06:34:54 +0000 Subject: [PATCH 05/13] chore: Publish 1.4.7-nightly-20240312.1 --- bindings/Cargo.lock | 138 +++++++++++----------- bindings/binding_core_node/Cargo.toml | 2 +- bindings/binding_core_wasm/Cargo.toml | 4 +- bindings/binding_minifier_node/Cargo.toml | 4 +- bindings/binding_minifier_wasm/Cargo.toml | 4 +- bindings/swc_cli/Cargo.toml | 4 +- package.json | 2 +- packages/minifier/package.json | 2 +- 8 files changed, 80 insertions(+), 80 deletions(-) diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index 297e3ff38ff9..cc7bd48cd2a3 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "binding_core_wasm" -version = "1.4.7-nightly-20240310.2" +version = "1.4.7-nightly-20240312.1" dependencies = [ "anyhow", "getrandom", @@ -236,9 +236,9 @@ dependencies = [ [[package]] name = "binding_macros" -version = "0.64.17" +version = "0.64.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6dce5324435c74a774df03256a70a84ef5a033da96e282ad01467f9b00994f" +checksum = "bd296ea88689d27d3c1e603c54c208c7fe91875b111ebf1ea0cf1ba59ae3787e" dependencies = [ "anyhow", "console_error_panic_hook", @@ -283,7 +283,7 @@ dependencies = [ [[package]] name = "binding_minifier_wasm" -version = "1.4.7-nightly-20240310.2" +version = "1.4.7-nightly-20240312.1" dependencies = [ "anyhow", "getrandom", @@ -2926,9 +2926,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.273.17" +version = "0.273.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5697e6ea7a715dd5d6606f7e131b6b047277efb7ab720998deff7e8dd47fd0f" +checksum = "c61371c0375d66cbbdb601513f6d2f0713e6fe984deb549ac80a7861fc3c22b2" dependencies = [ "anyhow", "base64", @@ -2993,9 +2993,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.225.13" +version = "0.225.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f5d8dcab6db0bdafb4928cd333464ec3dbc9ae57953910b7a3a05e3a5a3f82c" +checksum = "0061b48aeff696bf8f1623d843a48dbec83451496dbdaf260f8613220e19e849" dependencies = [ "anyhow", "crc", @@ -3039,7 +3039,7 @@ dependencies = [ [[package]] name = "swc_cli" -version = "0.91.197" +version = "0.91.198" dependencies = [ "anyhow", "swc_cli_impl", @@ -3047,9 +3047,9 @@ dependencies = [ [[package]] name = "swc_cli_impl" -version = "0.8.17" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c41eea4fc5f95f3c90b8d059696c6f0ae3829a3c753f66e73d628d00149b82c5" +checksum = "bc166dcd6a5c9cc0cdee11bbf7519467e847da5cfd514fe04c4e51e670c54fda" dependencies = [ "anyhow", "atty", @@ -3102,9 +3102,9 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ca1146aff9655a17a7958f2484a5ca4f81ba9c641410896c0e7bb80c84db2ab" +checksum = "b44065d50b699d2d8108edaa9f134e1dc411cd379e3e46e29898e14dcd266d0d" dependencies = [ "anyhow", "base64", @@ -3154,9 +3154,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.90.18" +version = "0.90.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c498fc0c7bc3a81257e6474636ea8dbfeb372371bfc31b3d95918d336df3822" +checksum = "8651aaebeb5a5c2b29af32cef6eac55861d0e475cdb76a6939c81786de0fce30" dependencies = [ "binding_macros", "swc", @@ -3232,9 +3232,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b78793b8d68a64c4e0c0e2c55f31330fe953b9d38e264bd2a6cc9481e6194d" +checksum = "fac3f77e07132056bdf7336e6930fdc4365c394466f97c992f29642c3e55793e" dependencies = [ "swc_atoms", "swc_common", @@ -3249,9 +3249,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_common" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9e6db48f9bbde54338832c4c100ba400e773bf5d6357eee599bd8d631b1caa2" +checksum = "b0a9bf70ce439c6dab8617ebe7691865fe80687d796c806fc39008f6ac102f84" dependencies = [ "swc_common", "swc_ecma_ast", @@ -3262,9 +3262,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321f1d679d24e894eab81c415828f6c8283fb665fd1639aff1c1eed810657f5b" +checksum = "0f6705c0d640f42dbbdb43f9da4cd83269bcc19b888cb31433d401a2e68a9d6c" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3288,9 +3288,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "727983ef362b8a347247bfde562b4f842578585f89ca3a1ccd77b7cbcbfe77ec" +checksum = "2edefbf5cd69132c3e9dc2bd450e0fb39e82f9eba07ca37b18fc9bcac7d9a8cd" dependencies = [ "swc_atoms", "swc_common", @@ -3305,9 +3305,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3bd9774bbb0173aa4ecaccc95e98d209f2fbb42e594fe2d9e35cd70bed0bbc" +checksum = "3455e30c73c79a1e583bf22bdb99c1e766dca2d863e1ea721e9d685b6345e133" dependencies = [ "serde", "swc_atoms", @@ -3323,9 +3323,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66a77eac0032cba8696461896a2bf05f1db9b453c3ad1573275bebb5e3bd5dc0" +checksum = "027190a908e5af75d3a9ccb20ab036a55f82702e6de61ac9341fd40c2855a557" dependencies = [ "serde", "swc_atoms", @@ -3342,9 +3342,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bcb35f9478cdc3fab186f1b06f725583bfddca43b66d9e686a5c0dc72110b18" +checksum = "8dfd12f37aa46c2faa4c542377c1e86d52df6e8c05c59fd43552e6a9d37857a3" dependencies = [ "swc_atoms", "swc_common", @@ -3358,9 +3358,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36db7815ebe0c6ac65d47f0f31db364824ad501b8262176269a12c79362bc96" +checksum = "2a2c8bdd554bd4c3d819de7c28f697d5fc23118bb7fcd5e8ea0dc8cb28103094" dependencies = [ "serde", "swc_atoms", @@ -3376,9 +3376,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2021" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07a98d073aac3e47c5c8b4d4fbf606d9fea008d9ffc36aac170db97016d103b9" +checksum = "33fdbb6fb08f498189dd95c118f9c583572df4c61fc5ff158b860a8f4338a7c0" dependencies = [ "swc_atoms", "swc_common", @@ -3392,9 +3392,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2022" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec6a3a7b059d4b123b54cdcbe52601f9e83a432c26fff8bcc9b127a60ee705e" +checksum = "97b10f83e74b21c32de25a9391aabd3b725baf5b31696cd7ce57a971bb71f190" dependencies = [ "swc_atoms", "swc_common", @@ -3411,9 +3411,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3d3a090e3f9c4e8c4f2fd0a22321f4389b8a1baa49399d9e0e420b1bce70a3" +checksum = "7a1ae4cdab0e1d269e8baffa7f16f4808d2bc0e7b898a1b5ec9d90df8d852fe6" dependencies = [ "swc_common", "swc_ecma_ast", @@ -3426,9 +3426,9 @@ dependencies = [ [[package]] name = "swc_ecma_ext_transforms" -version = "0.113.10" +version = "0.113.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91f36c0e3a192d1477d5ab00c7924f85e998eb6f26cd36121255efcb104cf4a" +checksum = "a2abcbbff3c42d6a4333ac77872958610888305d03f6c38312697c5b076c4f88" dependencies = [ "phf", "swc_atoms", @@ -3440,9 +3440,9 @@ dependencies = [ [[package]] name = "swc_ecma_lints" -version = "0.92.15" +version = "0.92.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53e92d321be276a31e612a7926cfef05484f661bbd08b7ff40b585576015aeb" +checksum = "7894a057a4c5f240a61955a4f40353b728b5b555800b704f8c5547c63c93b7ed" dependencies = [ "auto_impl", "dashmap", @@ -3482,9 +3482,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.192.14" +version = "0.192.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b108f08d487ce79cfb2599c0532fde6ed30738824da7f8d9f25fce527db75395" +checksum = "01d138fa420d6939ca43b87c8cd9bfd5c9e9408b9e8eb80ccd10cf3834aac719" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3538,9 +3538,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.206.13" +version = "0.206.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83f6d4e577171a9c21317bba1bc7207830f4f3cef63b5702b1a2ba280c0e3a64" +checksum = "beb4e0016f42208333dc7edafd6241fb68a1d740d860b6f627a3e797c4870701" dependencies = [ "anyhow", "dashmap", @@ -3563,9 +3563,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.229.13" +version = "0.229.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b02bdbac1ea925fecaba08292ce2b8b022a0703b74c13b52742c032ed361867e" +checksum = "047f84ab4c4b7a08a7894e48019d3f0f32a71eadc123186fefba3ea36d5c23af" dependencies = [ "swc_atoms", "swc_common", @@ -3583,9 +3583,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.137.13" +version = "0.137.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47a5d4bc7ba8b19d09d8024e60111041c1e728b38bc1f745859e809e17911a92" +checksum = "2c36ec1188950c6f5b74fa751db8bcfc7bdd97f231287a34ed43b5fe0752f02d" dependencies = [ "better_scoped_tls", "bitflags 2.3.3", @@ -3607,9 +3607,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.126.13" +version = "0.126.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d90dca67c3eeefe00cf76a783f5cc1ff2614e270d0e71cbe2e0a1e926e34fd84" +checksum = "c86a23a79abb7e609f17a0ca4ed4060ce911ba5f2055896b45c987574c913e03" dependencies = [ "swc_atoms", "swc_common", @@ -3621,9 +3621,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.163.13" +version = "0.163.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0935b56a2cfc0977a7abd5922f40816190937f703c45d7d98a3a080e7e1158aa" +checksum = "e26dfa2fe6a3273ec341de0090f556d037604eebf5f38e07c5ecdcaf2a3435e9" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3670,9 +3670,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.180.13" +version = "0.180.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c0627abb2062203bba6b17198ae4ca27f8e5fe18a99fce2608f3c396d87885a" +checksum = "b2e25fb5e0627bc17e0f6fcd5c9fb903d98143c2ff0b30906ff5b52abae5930d" dependencies = [ "Inflector", "anyhow", @@ -3697,9 +3697,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.198.13" +version = "0.198.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf2fcca33fbed8088bdd9978be4b460080662511e50742b32b20347f08296d7" +checksum = "51052ccc02161109066c40ccbefb96f81d959ef47b2244059ffc24f6f7f294d9" dependencies = [ "dashmap", "indexmap 2.1.0", @@ -3722,9 +3722,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.171.13" +version = "0.171.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9723deb426703981b232db1f091140cc5a197af68d8090bace6afa5f3e2dbd0" +checksum = "3a4e8f7b02320dc446d38fc797aa764b9b574839106327295a177ee38ad37da7" dependencies = [ "either", "rustc-hash", @@ -3742,9 +3742,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.183.13" +version = "0.183.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35e62a60e66f7f9e7490c5b7b8ed32c5746447bd7ee4ddda910e3825a369ba49" +checksum = "36d33e1f84d75e7c1b66433dfbfe9866855a896b9d18c33199ead961d3606a39" dependencies = [ "base64", "dashmap", @@ -3767,9 +3767,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.188.13" +version = "0.188.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60ac06411e6370b545808f80516bec2dd38e0ec573f797802d2f85195e6b4abe" +checksum = "a591d07a82edaf90b35c0d6c98b60cec1ff1f239035707a19276cebf856c569a" dependencies = [ "ryu-js", "serde", @@ -3784,9 +3784,9 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "0.23.10" +version = "0.23.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "742aed73c3d3b9b8cfcd6a1a4ff6585a3e1b0f4b487f5dbf7e4fee8a46a174aa" +checksum = "f6ff1c851a55df4803e8bd56e9a3161b743203b4ef651ac2b1b4dc9b24df11fb" dependencies = [ "indexmap 2.1.0", "rustc-hash", @@ -3801,9 +3801,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.127.10" +version = "0.127.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643f52aae3ab2558cbe9f480bae68a8b3a5233d4a9dd355e1afe833d574b7c05" +checksum = "fbe5ea2a95bea51461395cb4d7cfcbcb361562981d19cb502b7f90dff35364ac" dependencies = [ "indexmap 2.1.0", "num_cpus", @@ -3905,9 +3905,9 @@ dependencies = [ [[package]] name = "swc_node_bundler" -version = "0.62.17" +version = "0.62.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a78418c3fae8224c426028f3662bec2b62b80fb376f85f5798cdc2e9cfecdd44" +checksum = "9191d8223e7f2acdca7a48bb5603a565cba3a7e40a37099e6932bcf59638dc19" dependencies = [ "anyhow", "dashmap", diff --git a/bindings/binding_core_node/Cargo.toml b/bindings/binding_core_node/Cargo.toml index 659570f5d562..c5c6102a413e 100644 --- a/bindings/binding_core_node/Cargo.toml +++ b/bindings/binding_core_node/Cargo.toml @@ -51,7 +51,7 @@ tracing-chrome = "0.5.0" tracing-futures = "0.2.5" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } -swc_core = { version = "0.90.18", features = [ +swc_core = { version = "0.90.19", features = [ "allocator_node", "ecma_ast", "ecma_codegen", diff --git a/bindings/binding_core_wasm/Cargo.toml b/bindings/binding_core_wasm/Cargo.toml index bc60fc1130d9..87e8c359d24b 100644 --- a/bindings/binding_core_wasm/Cargo.toml +++ b/bindings/binding_core_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "binding_core_wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.4.7-nightly-20240310.2" +version = "1.4.7-nightly-20240312.1" [lib] bench = false @@ -35,7 +35,7 @@ anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" -swc_core = { version = "0.90.18", features = [ +swc_core = { version = "0.90.19", features = [ "ecma_ast_serde", "ecma_codegen", "binding_macro_wasm", diff --git a/bindings/binding_minifier_node/Cargo.toml b/bindings/binding_minifier_node/Cargo.toml index 29221b24a7d2..7006f5da2d88 100644 --- a/bindings/binding_minifier_node/Cargo.toml +++ b/bindings/binding_minifier_node/Cargo.toml @@ -35,9 +35,9 @@ tracing-chrome = "0.5.0" tracing-futures = "0.2.5" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } -swc_compiler_base = { version = "0.7.14", features = ["node"] } +swc_compiler_base = { version = "0.7.15", features = ["node"] } swc_config = "0.1.11" -swc_core = { version = "0.90.18", features = [ +swc_core = { version = "0.90.19", features = [ "allocator_node", "common_concurrent", "common_sourcemap", diff --git a/bindings/binding_minifier_wasm/Cargo.toml b/bindings/binding_minifier_wasm/Cargo.toml index 52bb1c31c331..6dfd73757bf0 100644 --- a/bindings/binding_minifier_wasm/Cargo.toml +++ b/bindings/binding_minifier_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "binding_minifier_wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.4.7-nightly-20240310.2" +version = "1.4.7-nightly-20240312.1" [lib] bench = false @@ -35,7 +35,7 @@ anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" -swc_core = { version = "0.90.18", features = [ +swc_core = { version = "0.90.19", features = [ "ecma_ast_serde", "ecma_codegen", "binding_macro_wasm", diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index 561b04313b56..a182279bb8ee 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_cli" repository = "https://github.com/swc-project/swc.git" -version = "0.91.197" +version = "0.91.198" [[bin]] bench = false @@ -19,4 +19,4 @@ plugin = ["swc_cli_impl/plugin"] [dependencies] anyhow = "1.0.66" -swc_cli_impl = "0.8.17" +swc_cli_impl = "0.8.18" diff --git a/package.json b/package.json index ef2043df392b..4fee618486c7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swc/core", - "version": "1.4.7-nightly-20240310.2", + "version": "1.4.7-nightly-20240312.1", "description": "Super-fast alternative for babel", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/packages/minifier/package.json b/packages/minifier/package.json index e218d6f8b6c5..856589b16c9b 100644 --- a/packages/minifier/package.json +++ b/packages/minifier/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier", - "version": "1.4.7-nightly-20240310.2", + "version": "1.4.7-nightly-20240312.1", "description": "Super-fast alternative for terser", "homepage": "https://swc.rs", "main": "./index.js", From 95761b76bf09a4d2c09517b2bd7bf7b78ee2149f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 13 Mar 2024 11:21:15 +0900 Subject: [PATCH 06/13] fix(es/minifier): Make `Finalizer` handle `hoisted_props` correctly (#8738) **Related issue:** - Closes #8737 --- .../fixture/issues-8xxx/8737/input/.swcrc | 63 +++++++++++++++++++ .../tests/fixture/issues-8xxx/8737/input/1.js | 14 +++++ .../fixture/issues-8xxx/8737/output/1.js | 8 +++ .../src/compress/optimize/mod.rs | 1 + .../src/compress/optimize/util.rs | 33 ++++++---- .../tests/fixture/issues/8737/2/input.js | 10 +++ .../tests/fixture/issues/8737/2/output.js | 8 +++ .../tests/fixture/issues/8737/config.json | 47 ++++++++++++++ .../tests/fixture/issues/8737/input.js | 14 +++++ .../tests/fixture/issues/8737/output.js | 6 ++ 10 files changed, 193 insertions(+), 11 deletions(-) create mode 100644 crates/swc/tests/fixture/issues-8xxx/8737/input/.swcrc create mode 100644 crates/swc/tests/fixture/issues-8xxx/8737/input/1.js create mode 100644 crates/swc/tests/fixture/issues-8xxx/8737/output/1.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8737/2/input.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8737/2/output.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8737/config.json create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8737/input.js create mode 100644 crates/swc_ecma_minifier/tests/fixture/issues/8737/output.js diff --git a/crates/swc/tests/fixture/issues-8xxx/8737/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8737/input/.swcrc new file mode 100644 index 000000000000..cd530500a1f2 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8737/input/.swcrc @@ -0,0 +1,63 @@ +{ + "jsc": { + "parser": { + "syntax": "ecmascript", + "jsx": false + }, + "target": "es5", + "loose": false, + "minify": { + "compress": { + "arguments": false, + "arrows": true, + "booleans": true, + "booleans_as_integers": false, + "collapse_vars": true, + "comparisons": true, + "computed_props": true, + "conditionals": true, + "dead_code": true, + "directives": true, + "drop_console": false, + "drop_debugger": true, + "evaluate": true, + "expression": false, + "hoist_funs": false, + "hoist_props": true, + "hoist_vars": false, + "if_return": true, + "join_vars": true, + "keep_classnames": false, + "keep_fargs": true, + "keep_fnames": false, + "keep_infinity": false, + "loops": true, + "negate_iife": true, + "properties": true, + "reduce_funcs": false, + "reduce_vars": false, + "side_effects": true, + "switches": true, + "typeofs": true, + "unsafe": false, + "unsafe_arrows": false, + "unsafe_comps": false, + "unsafe_Function": false, + "unsafe_math": false, + "unsafe_symbols": false, + "unsafe_methods": false, + "unsafe_proto": false, + "unsafe_regexp": false, + "unsafe_undefined": false, + "unused": true, + "const_to_let": true, + "pristine_globals": true + }, + "mangle": false + } + }, + "module": { + "type": "es6" + }, + "isModule": true +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8737/input/1.js b/crates/swc/tests/fixture/issues-8xxx/8737/input/1.js new file mode 100644 index 000000000000..c77842050387 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8737/input/1.js @@ -0,0 +1,14 @@ +d(() => { + var obj = { + key: "some string", + }; + + var b = () => { + switch (a) { + default: + break; + } + return obj.key; + }; + return () => b; +}); \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8737/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8737/output/1.js new file mode 100644 index 000000000000..bb0fd3bbeaa5 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8737/output/1.js @@ -0,0 +1,8 @@ +d(function() { + var b = function() { + return a, "some string"; + }; + return function() { + return b; + }; +}); diff --git a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs index f9e1a7146916..770d14ecf4e5 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/mod.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/mod.rs @@ -269,6 +269,7 @@ impl Vars { || !self.lits.is_empty() || !self.lits_for_cmp.is_empty() || !self.lits_for_array_access.is_empty() + || !self.hoisted_props.is_empty() || !self.removed.is_empty() { let mut v = Finalizer { diff --git a/crates/swc_ecma_minifier/src/compress/optimize/util.rs b/crates/swc_ecma_minifier/src/compress/optimize/util.rs index ab671c14a532..7ae6087aeae3 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/util.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/util.rs @@ -405,24 +405,35 @@ impl VisitMut for Finalizer<'_> { } fn visit_mut_expr(&mut self, n: &mut Expr) { - if let Expr::Ident(i) = n { - if let Some(expr) = self.lits.get(&i.to_id()) { - *n = *expr.clone(); + match n { + Expr::Ident(i) => { + if let Some(expr) = self.lits.get(&i.to_id()) { + *n = *expr.clone(); + return; + } } - } else { - n.visit_mut_children_with(self); - } - - if let Expr::Member(e) = n { - if let Expr::Ident(obj) = &*e.obj { - if let MemberProp::Ident(prop) = &e.prop { - if let Some(ident) = self.hoisted_props.get(&(obj.to_id(), prop.sym.clone())) { + Expr::Member(e) => { + if let Expr::Ident(obj) = &*e.obj { + let sym = match &e.prop { + MemberProp::Ident(i) => &i.sym, + MemberProp::Computed(e) => match &*e.expr { + Expr::Lit(Lit::Str(s)) => &s.value, + _ => return, + }, + _ => return, + }; + + if let Some(ident) = self.hoisted_props.get(&(obj.to_id(), sym.clone())) { self.changed = true; *n = ident.clone().into(); + return; } } } + _ => {} } + + n.visit_mut_children_with(self); } fn visit_mut_stmts(&mut self, n: &mut Vec) { diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/input.js new file mode 100644 index 000000000000..bbca9b5721ca --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/input.js @@ -0,0 +1,10 @@ +d(function () { + var obj = { + key: "some string" + }, b = function () { + return a, obj.key; + }; + return function () { + return b; + }; +}); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/output.js new file mode 100644 index 000000000000..bb0fd3bbeaa5 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8737/2/output.js @@ -0,0 +1,8 @@ +d(function() { + var b = function() { + return a, "some string"; + }; + return function() { + return b; + }; +}); diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8737/config.json b/crates/swc_ecma_minifier/tests/fixture/issues/8737/config.json new file mode 100644 index 000000000000..7e144b291fa7 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8737/config.json @@ -0,0 +1,47 @@ +{ + "defaults": true, + "arguments": false, + "arrows": true, + "booleans": true, + "booleans_as_integers": false, + "collapse_vars": true, + "comparisons": true, + "computed_props": true, + "conditionals": true, + "dead_code": true, + "directives": true, + "drop_console": false, + "drop_debugger": true, + "evaluate": true, + "expression": false, + "hoist_funs": false, + "hoist_props": true, + "hoist_vars": false, + "if_return": true, + "join_vars": true, + "keep_classnames": false, + "keep_fargs": true, + "keep_fnames": false, + "keep_infinity": false, + "loops": true, + "negate_iife": true, + "properties": true, + "reduce_funcs": false, + "reduce_vars": false, + "side_effects": true, + "switches": true, + "typeofs": true, + "unsafe": false, + "unsafe_arrows": false, + "unsafe_comps": false, + "unsafe_Function": false, + "unsafe_math": false, + "unsafe_symbols": false, + "unsafe_methods": false, + "unsafe_proto": false, + "unsafe_regexp": false, + "unsafe_undefined": false, + "unused": true, + "const_to_let": true, + "pristine_globals": true +} diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8737/input.js b/crates/swc_ecma_minifier/tests/fixture/issues/8737/input.js new file mode 100644 index 000000000000..c77842050387 --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8737/input.js @@ -0,0 +1,14 @@ +d(() => { + var obj = { + key: "some string", + }; + + var b = () => { + switch (a) { + default: + break; + } + return obj.key; + }; + return () => b; +}); \ No newline at end of file diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/8737/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/8737/output.js new file mode 100644 index 000000000000..2d9886ffdc7f --- /dev/null +++ b/crates/swc_ecma_minifier/tests/fixture/issues/8737/output.js @@ -0,0 +1,6 @@ +d(()=>{ + var obj = { + key: "some string" + }, b = ()=>(a, obj.key); + return ()=>b; +}); From 8a5163ce5d0cd02f77887bf306e9f8ecac4b41b9 Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Wed, 13 Mar 2024 02:23:10 +0000 Subject: [PATCH 07/13] chore: Bump crates --- CHANGELOG.md | 9 +++------ Cargo.lock | 24 ++++++++++++------------ crates/binding_macros/Cargo.toml | 4 ++-- crates/dbg-swc/Cargo.toml | 4 ++-- crates/swc/Cargo.toml | 6 +++--- crates/swc_bundler/Cargo.toml | 4 ++-- crates/swc_cli_impl/Cargo.toml | 4 ++-- crates/swc_compiler_base/Cargo.toml | 4 ++-- crates/swc_core/Cargo.toml | 12 ++++++------ crates/swc_ecma_minifier/Cargo.toml | 2 +- crates/swc_ecmascript/Cargo.toml | 4 ++-- crates/swc_estree_compat/Cargo.toml | 4 ++-- crates/swc_html/Cargo.toml | 2 +- crates/swc_html_minifier/Cargo.toml | 2 +- crates/swc_node_bundler/Cargo.toml | 6 +++--- 15 files changed, 44 insertions(+), 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c52821866efa..0b70e1fc12aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,9 @@ - **(es/minifier)** Fix removal of array pattern bindings ([#8730](https://github.com/swc-project/swc/issues/8730)) ([312f0d8](https://github.com/swc-project/swc/commit/312f0d8427b3c4436b491ed4265f9469dc017f8f)) + +- **(es/minifier)** Make `Finalizer` handle `hoisted_props` correctly ([#8738](https://github.com/swc-project/swc/issues/8738)) ([95761b7](https://github.com/swc-project/swc/commit/95761b76bf09a4d2c09517b2bd7bf7b78ee2149f)) + ### Features @@ -1415,10 +1418,4 @@ - **(es/module)** Improve error message about relative `jsc.baseUrl` ([#7827](https://github.com/swc-project/swc/issues/7827)) ([9099883](https://github.com/swc-project/swc/commit/9099883175c590106109670de01ab32b33303bfd)) -### Refactor - - - -- **(common)** Make `ahash` optional ([#7816](https://github.com/swc-project/swc/issues/7816)) ([981d7b1](https://github.com/swc-project/swc/commit/981d7b152b2f488a67d42052152db22225f1d094)) - diff --git a/Cargo.lock b/Cargo.lock index f01d4310b134..e25ba0d5f856 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "binding_macros" -version = "0.64.18" +version = "0.64.19" dependencies = [ "anyhow", "console_error_panic_hook", @@ -1056,7 +1056,7 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "dbg-swc" -version = "0.91.19" +version = "0.91.20" dependencies = [ "anyhow", "clap 3.2.25", @@ -3667,7 +3667,7 @@ dependencies = [ [[package]] name = "swc" -version = "0.273.18" +version = "0.273.19" dependencies = [ "ansi_term", "anyhow", @@ -3737,7 +3737,7 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.225.14" +version = "0.225.15" dependencies = [ "anyhow", "crc", @@ -3792,7 +3792,7 @@ dependencies = [ [[package]] name = "swc_cli_impl" -version = "0.8.18" +version = "0.8.19" dependencies = [ "anyhow", "assert_cmd", @@ -3851,7 +3851,7 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.7.15" +version = "0.7.16" dependencies = [ "anyhow", "base64", @@ -3897,7 +3897,7 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.90.19" +version = "0.90.20" dependencies = [ "anyhow", "binding_macros", @@ -4430,7 +4430,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.192.15" +version = "0.192.16" dependencies = [ "ansi_term", "anyhow", @@ -4880,7 +4880,7 @@ dependencies = [ [[package]] name = "swc_ecmascript" -version = "0.239.18" +version = "0.239.19" dependencies = [ "swc_ecma_ast", "swc_ecma_codegen", @@ -4926,7 +4926,7 @@ dependencies = [ [[package]] name = "swc_estree_compat" -version = "0.198.17" +version = "0.198.18" dependencies = [ "ahash 0.8.8", "anyhow", @@ -4974,7 +4974,7 @@ dependencies = [ [[package]] name = "swc_html" -version = "0.137.15" +version = "0.137.16" dependencies = [ "swc_html_ast", "swc_html_codegen", @@ -5109,7 +5109,7 @@ dependencies = [ [[package]] name = "swc_node_bundler" -version = "0.62.18" +version = "0.62.19" dependencies = [ "anyhow", "dashmap", diff --git a/crates/binding_macros/Cargo.toml b/crates/binding_macros/Cargo.toml index d34662e0326d..f7d59cae1141 100644 --- a/crates/binding_macros/Cargo.toml +++ b/crates/binding_macros/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "binding_macros" repository = "https://github.com/swc-project/swc.git" -version = "0.64.18" +version = "0.64.19" [lib] bench = false @@ -33,7 +33,7 @@ binding_wasm = [ [dependencies] # Common deps for the SWC imports -swc = { optional = true, version = "0.273.18", path = "../swc" } +swc = { optional = true, version = "0.273.19", path = "../swc" } swc_common = { optional = true, version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { optional = true, version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms = { optional = true, version = "0.229.14", path = "../swc_ecma_transforms" } diff --git a/crates/dbg-swc/Cargo.toml b/crates/dbg-swc/Cargo.toml index df24ccae064d..41d91a34077a 100644 --- a/crates/dbg-swc/Cargo.toml +++ b/crates/dbg-swc/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "dbg-swc" repository = "https://github.com/kdy1/dbg-swc.git" -version = "0.91.19" +version = "0.91.20" [[bin]] bench = false @@ -32,7 +32,7 @@ swc_common = { version = "0.33.19", features = [ ], path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", features = [ "concurrent", ] } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 7338fb06092e..1454e92a93c8 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -9,7 +9,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc" repository = "https://github.com/swc-project/swc.git" -version = "0.273.18" +version = "0.273.19" [lib] bench = false @@ -74,7 +74,7 @@ swc_common = { version = "0.33.19", path = "../swc_common", features = [ "sourcemap", "parking_lot", ] } -swc_compiler_base = { version = "0.7.15", path = "../swc_compiler_base" } +swc_compiler_base = { version = "0.7.16", path = "../swc_compiler_base" } swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } @@ -85,7 +85,7 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = "node", "tsc", ] } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier" } +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_preset_env = { version = "0.206.14", path = "../swc_ecma_preset_env" } swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", features = [ diff --git a/crates/swc_bundler/Cargo.toml b/crates/swc_bundler/Cargo.toml index d8d2c83f5fbd..b4540bbb0fba 100644 --- a/crates/swc_bundler/Cargo.toml +++ b/crates/swc_bundler/Cargo.toml @@ -9,7 +9,7 @@ include = ["Cargo.toml", "build.rs", "src/**/*.rs", "src/**/*.js"] license = "Apache-2.0" name = "swc_bundler" repository = "https://github.com/swc-project/swc.git" -version = "0.225.14" +version = "0.225.15" [package.metadata.docs.rs] all-features = true @@ -63,7 +63,7 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = "node", "cache", ] } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", features = [ "concurrent", ] } swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal" } diff --git a/crates/swc_cli_impl/Cargo.toml b/crates/swc_cli_impl/Cargo.toml index 03d7d3be7390..78fb38d0ab75 100644 --- a/crates/swc_cli_impl/Cargo.toml +++ b/crates/swc_cli_impl/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_cli_impl" repository = "https://github.com/swc-project/swc.git" -version = "0.8.18" +version = "0.8.19" [[bin]] name = "swc" @@ -40,7 +40,7 @@ tracing-futures = "0.2.5" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } walkdir = "2" -swc_core = { version = "0.90.19", features = [ +swc_core = { version = "0.90.20", features = [ "trace_macro", "common_concurrent", "base_concurrent", diff --git a/crates/swc_compiler_base/Cargo.toml b/crates/swc_compiler_base/Cargo.toml index edb3fe7f49e8..2483fc91141c 100644 --- a/crates/swc_compiler_base/Cargo.toml +++ b/crates/swc_compiler_base/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_compiler_base" repository = "https://github.com/swc-project/swc.git" -version = "0.7.15" +version = "0.7.16" [features] node = ["napi", "napi-derive"] @@ -27,7 +27,7 @@ swc_common = { version = "0.33.19", path = "../swc_common", features = [ swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier" } +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_timer = { version = "0.21.20", path = "../swc_timer" } diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 719913600cfe..0728266f8c9a 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_core" repository = "https://github.com/swc-project/swc.git" -version = "0.90.19" +version = "0.90.20" [package.metadata.docs.rs] features = [ "allocator_node", @@ -327,10 +327,10 @@ __visit = ["__ecma", "swc_ecma_visit"] once_cell = { optional = true, version = "1.18.0" } # swc_* dependencies -binding_macros = { optional = true, version = "0.64.18", path = "../binding_macros" } -swc = { optional = true, version = "0.273.18", path = "../swc" } +binding_macros = { optional = true, version = "0.64.19", path = "../binding_macros" } +swc = { optional = true, version = "0.273.19", path = "../swc" } swc_atoms = { optional = true, version = "0.6.5", path = "../swc_atoms" } -swc_bundler = { optional = true, version = "0.225.14", path = "../swc_bundler" } +swc_bundler = { optional = true, version = "0.225.15", path = "../swc_bundler" } swc_cached = { optional = true, version = "0.3.19", path = "../swc_cached" } swc_common = { optional = true, version = "0.33.19", path = "../swc_common" } swc_css_ast = { optional = true, version = "0.140.20", path = "../swc_css_ast" } @@ -346,7 +346,7 @@ swc_ecma_ast = { optional = true, version = "0.112.5", path swc_ecma_codegen = { optional = true, version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_lints = { optional = true, version = "0.92.16", path = "../swc_ecma_lints" } swc_ecma_loader = { optional = true, version = "0.45.21", path = "../swc_ecma_loader" } -swc_ecma_minifier = { optional = true, version = "0.192.15", path = "../swc_ecma_minifier" } +swc_ecma_minifier = { optional = true, version = "0.192.16", path = "../swc_ecma_minifier" } swc_ecma_parser = { optional = true, version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_preset_env = { optional = true, version = "0.206.14", path = "../swc_ecma_preset_env" } swc_ecma_quote_macros = { optional = true, version = "0.54.11", path = "../swc_ecma_quote_macros" } @@ -362,7 +362,7 @@ swc_ecma_usage_analyzer = { optional = true, version = "0.23.11", path swc_ecma_utils = { optional = true, version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { optional = true, version = "0.98.6", path = "../swc_ecma_visit" } swc_malloc = { optional = true, version = "0.5.10", path = "../swc_malloc" } -swc_node_bundler = { optional = true, version = "0.62.18", path = "../swc_node_bundler" } +swc_node_bundler = { optional = true, version = "0.62.19", path = "../swc_node_bundler" } swc_nodejs_common = { optional = true, version = "0.0.8", path = "../swc_nodejs_common" } swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" } swc_plugin_macro = { optional = true, version = "0.9.16", path = "../swc_plugin_macro" } diff --git a/crates/swc_ecma_minifier/Cargo.toml b/crates/swc_ecma_minifier/Cargo.toml index 0fffc8dbe71a..d3828a41b3de 100644 --- a/crates/swc_ecma_minifier/Cargo.toml +++ b/crates/swc_ecma_minifier/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "src/lists/*.json"] license = "Apache-2.0" name = "swc_ecma_minifier" repository = "https://github.com/swc-project/swc.git" -version = "0.192.15" +version = "0.192.16" [package.metadata.docs.rs] all-features = true diff --git a/crates/swc_ecmascript/Cargo.toml b/crates/swc_ecmascript/Cargo.toml index 46950fdcbae2..b3fcb7ff6ec6 100644 --- a/crates/swc_ecmascript/Cargo.toml +++ b/crates/swc_ecmascript/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_ecmascript" repository = "https://github.com/swc-project/swc.git" -version = "0.239.18" +version = "0.239.19" [package.metadata.docs.rs] all-features = true @@ -40,7 +40,7 @@ typescript = ["typescript-parser", "swc_ecma_transforms/typescript"] [dependencies] swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen", optional = true } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier", optional = true } +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", optional = true } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser", optional = true, default-features = false } swc_ecma_preset_env = { version = "0.206.14", path = "../swc_ecma_preset_env", optional = true } swc_ecma_quote = { version = "0.59.11", path = "../swc_ecma_quote", optional = true } diff --git a/crates/swc_estree_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml index 3ab837854ee2..9d7b8854a501 100644 --- a/crates/swc_estree_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_estree_compat" repository = "https://github.com/swc-project/swc.git" -version = "0.198.17" +version = "0.198.18" [package.metadata.docs.rs] all-features = true @@ -40,7 +40,7 @@ swc_node_comments = { version = "0.20.18", path = "../swc_node_comments/" } criterion = "0.5" pretty_assertions = "1.3" -swc = { version = "0.273.18", path = "../swc" } +swc = { version = "0.273.19", path = "../swc" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms/" } diff --git a/crates/swc_html/Cargo.toml b/crates/swc_html/Cargo.toml index 0196570c297f..3676bf032c26 100644 --- a/crates/swc_html/Cargo.toml +++ b/crates/swc_html/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_html" repository = "https://github.com/swc-project/swc.git" -version = "0.137.15" +version = "0.137.16" [package.metadata.docs.rs] all-features = true diff --git a/crates/swc_html_minifier/Cargo.toml b/crates/swc_html_minifier/Cargo.toml index d9d3af33ee69..b01d60b5e473 100644 --- a/crates/swc_html_minifier/Cargo.toml +++ b/crates/swc_html_minifier/Cargo.toml @@ -31,7 +31,7 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen", features = [ "serde-impl", ] } -swc_ecma_minifier = { version = "0.192.15", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", features = [ "extra-serde", ] } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } diff --git a/crates/swc_node_bundler/Cargo.toml b/crates/swc_node_bundler/Cargo.toml index 83275dfb07e5..223caa28573c 100644 --- a/crates/swc_node_bundler/Cargo.toml +++ b/crates/swc_node_bundler/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_node_bundler" repository = "https://github.com/swc-project/swc.git" -version = "0.62.18" +version = "0.62.19" [lib] bench = false @@ -29,9 +29,9 @@ serde_json = "1" tracing = "0.1.37" string_enum = { version = "0.4.2", path = "../string_enum" } -swc = { version = "0.273.18", path = "../swc" } +swc = { version = "0.273.19", path = "../swc" } swc_atoms = { version = "0.6.5", path = "../swc_atoms" } -swc_bundler = { version = "0.225.14", path = "../swc_bundler", features = [ +swc_bundler = { version = "0.225.15", path = "../swc_bundler", features = [ "concurrent", ] } swc_common = { version = "0.33.19", path = "../swc_common", features = [ From 633cd89bacef5f0efef20f1dfa709cff1ecba36f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 13 Mar 2024 12:06:29 +0900 Subject: [PATCH 08/13] fix(es/proposal): Fix var placement for using transform (#8732) **Related issue:** - Closes #8629 --- .../fixture/issues-8xxx/8629/input/.swcrc | 22 ++ .../tests/fixture/issues-8xxx/8629/input/1.js | 9 + .../tests/fixture/issues-8xxx/8629/input/2.js | 5 + .../fixture/issues-8xxx/8629/output/1.js | 22 ++ .../fixture/issues-8xxx/8629/output/2.js | 16 ++ ...TopLevelOfModule.1(module=es6).1.normal.js | 10 +- ...pLevelOfModule.1(module=es6).2.minified.js | 12 +- ...LevelOfModule.1(module=system).1.normal.js | 12 +- ...velOfModule.1(module=system).2.minified.js | 12 +- ...TopLevelOfModule.1(module=amd).1.normal.js | 12 +- ...pLevelOfModule.1(module=amd).2.minified.js | 15 +- ...velOfModule.1(module=commonjs).1.normal.js | 12 +- ...lOfModule.1(module=commonjs).2.minified.js | 16 +- ...TopLevelOfModule.1(module=es6).1.normal.js | 10 +- ...pLevelOfModule.1(module=es6).2.minified.js | 12 +- ...LevelOfModule.1(module=system).1.normal.js | 12 +- ...velOfModule.1(module=system).2.minified.js | 12 +- ...module=commonjs,target=es2015).1.normal.js | 8 +- ...dule=commonjs,target=es2015).2.minified.js | 11 +- ....2(module=commonjs,target=es5).1.normal.js | 12 +- ...(module=commonjs,target=es5).2.minified.js | 12 +- ...module=commonjs,target=esnext).1.normal.js | 8 +- ...dule=commonjs,target=esnext).2.minified.js | 11 +- ...rs.2(module=es6,target=es2015).1.normal.js | 7 +- ....2(module=es6,target=es2015).2.minified.js | 10 +- ...ators.2(module=es6,target=es5).1.normal.js | 11 +- ...ors.2(module=es6,target=es5).2.minified.js | 12 +- ...rs.2(module=es6,target=esnext).1.normal.js | 7 +- ....2(module=es6,target=esnext).2.minified.js | 10 +- ...2(module=system,target=es2015).1.normal.js | 11 +- ...module=system,target=es2015).2.minified.js | 11 +- ...rs.2(module=system,target=es5).1.normal.js | 16 +- ....2(module=system,target=es5).2.minified.js | 15 +- ...2(module=system,target=esnext).1.normal.js | 11 +- ...module=system,target=esnext).2.minified.js | 11 +- ...module=commonjs,target=es2015).1.normal.js | 8 +- ...dule=commonjs,target=es2015).2.minified.js | 10 +- ....8(module=commonjs,target=es5).1.normal.js | 12 +- ...(module=commonjs,target=es5).2.minified.js | 12 +- ...module=commonjs,target=esnext).1.normal.js | 8 +- ...dule=commonjs,target=esnext).2.minified.js | 10 +- ...rs.8(module=es6,target=es2015).1.normal.js | 7 +- ....8(module=es6,target=es2015).2.minified.js | 9 +- ...ators.8(module=es6,target=es5).1.normal.js | 11 +- ...ors.8(module=es6,target=es5).2.minified.js | 10 +- ...rs.8(module=es6,target=esnext).1.normal.js | 7 +- ....8(module=es6,target=esnext).2.minified.js | 9 +- ...8(module=system,target=es2015).1.normal.js | 11 +- ...module=system,target=es2015).2.minified.js | 10 +- ...rs.8(module=system,target=es5).1.normal.js | 16 +- ....8(module=system,target=es5).2.minified.js | 15 +- ...8(module=system,target=esnext).1.normal.js | 11 +- ...module=system,target=esnext).2.minified.js | 10 +- .../src/classes/constructor.rs | 1 - .../tests/es2015_classes.rs | 253 ------------------ .../tests/es2015_parameters.rs | 184 ------------- .../tests/es2022_class_properties.rs | 148 ---------- .../src/decorator_2022_03.rs | 12 +- .../src/explicit_resource_management.rs | 131 ++++++++- .../tests/decorators.rs | 1 + .../tests/decorators/issue-8629/input.js | 10 + .../tests/decorators/issue-8629/options.json | 3 + .../tests/decorators/issue-8629/output.js | 10 + .../transform-sync/issue-8629/input.js | 10 + .../transform-sync/issue-8629/output.js | 19 ++ .../transform-top-level/hoisting/output.mjs | 21 +- 66 files changed, 593 insertions(+), 811 deletions(-) create mode 100644 crates/swc/tests/fixture/issues-8xxx/8629/input/.swcrc create mode 100644 crates/swc/tests/fixture/issues-8xxx/8629/input/1.js create mode 100644 crates/swc/tests/fixture/issues-8xxx/8629/input/2.js create mode 100644 crates/swc/tests/fixture/issues-8xxx/8629/output/1.js create mode 100644 crates/swc/tests/fixture/issues-8xxx/8629/output/2.js create mode 100644 crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/input.js create mode 100644 crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/options.json create mode 100644 crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/output.js create mode 100644 crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/input.js create mode 100644 crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/output.js diff --git a/crates/swc/tests/fixture/issues-8xxx/8629/input/.swcrc b/crates/swc/tests/fixture/issues-8xxx/8629/input/.swcrc new file mode 100644 index 000000000000..f90e08607de8 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8629/input/.swcrc @@ -0,0 +1,22 @@ +{ + "jsc": { + "parser": { + "syntax": "typescript", + "decorators": true + }, + "target": "es2015", + "loose": false, + "minify": { + "compress": false, + "mangle": false + }, + "transform": { + "decoratorVersion": "2022-03" + } + }, + "module": { + "type": "es6" + }, + "minify": false, + "isModule": true +} \ No newline at end of file diff --git a/crates/swc/tests/fixture/issues-8xxx/8629/input/1.js b/crates/swc/tests/fixture/issues-8xxx/8629/input/1.js new file mode 100644 index 000000000000..89caa2f08bf4 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8629/input/1.js @@ -0,0 +1,9 @@ +export class Disposable { + [Symbol.dispose]() { + console.log('dispose') + } +} + +using _disposable = new Disposable() + +console.log('ok') diff --git a/crates/swc/tests/fixture/issues-8xxx/8629/input/2.js b/crates/swc/tests/fixture/issues-8xxx/8629/input/2.js new file mode 100644 index 000000000000..2d469f56aac0 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8629/input/2.js @@ -0,0 +1,5 @@ +export var Disposable = 1334 + +using _disposable = new Disposable() + +console.log('ok') diff --git a/crates/swc/tests/fixture/issues-8xxx/8629/output/1.js b/crates/swc/tests/fixture/issues-8xxx/8629/output/1.js new file mode 100644 index 000000000000..a7febe103cd6 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8629/output/1.js @@ -0,0 +1,22 @@ +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +var _Disposable; +try { + var _stack = []; + var _computedKey; + _computedKey = Symbol.dispose; + class Disposable { + [_computedKey]() { + console.log('dispose'); + } + } + _Disposable = Disposable; + var _disposable = _using(_stack, new Disposable()); + console.log('ok'); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { _Disposable as Disposable }; diff --git a/crates/swc/tests/fixture/issues-8xxx/8629/output/2.js b/crates/swc/tests/fixture/issues-8xxx/8629/output/2.js new file mode 100644 index 000000000000..2b4522372a39 --- /dev/null +++ b/crates/swc/tests/fixture/issues-8xxx/8629/output/2.js @@ -0,0 +1,16 @@ +import { _ as _dispose } from "@swc/helpers/_/_dispose"; +import { _ as _using } from "@swc/helpers/_/_using"; +var _Disposable; +try { + var _stack = []; + var Disposable = 1334; + _Disposable = Disposable; + var _disposable = _using(_stack, new Disposable()); + console.log('ok'); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { _Disposable as Disposable }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js index da78166b9beb..a2c01fb7f763 100644 --- a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js @@ -1,16 +1,20 @@ //// [awaitUsingDeclarationsTopLevelOfModule.1.ts] import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export const x = 1; +var _x; export { y }; -export const w = 3; +var _w; export { _default as default }; try { var _stack = []; + const x = 1; + _x = x; var z = _using(_stack, { async [Symbol.asyncDispose] () {} }, true); var y = 2; + const w = 3; + _w = w; var _default = 4; console.log(w, x, y, z); } catch (_) { @@ -19,3 +23,5 @@ try { } finally{ await _dispose(_stack, _error, _hasError); } +export { _x as x }; +export { _w as w }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js index 0842a538c327..458a880a042d 100644 --- a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js @@ -1,16 +1,18 @@ //// [awaitUsingDeclarationsTopLevelOfModule.1.ts] import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export const x = 1; -export const w = 3; try { - var _stack = [], z = _using(_stack, { + var _x, _w, _stack = []; + _x = 1; + var z = _using(_stack, { async [Symbol.asyncDispose] () {} - }, !0), y = 2, _default = 4; + }, !0), y = 2; + _w = 3; + var _default = 4; console.log(3, 1, y, z); } catch (_) { var _error = _, _hasError = !0; } finally{ await _dispose(_stack, _error, _hasError); } -export { y, _default as default }; +export { y, _default as default, _x as x, _w as w }; diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).1.normal.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).1.normal.js index 86209dc7c850..59cebf112d56 100644 --- a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).1.normal.js +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).1.normal.js @@ -4,7 +4,11 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _dispose, _using, x, w; + var _dispose, _using, _x, _w; + _export({ + x: void 0, + w: void 0 + }); return { setters: [ function(_dispose1) { @@ -15,14 +19,16 @@ System.register([ } ], execute: async function() { - _export("x", x = 1); - _export("w", w = 3); try { var _stack = []; + const x = 1; + _export("x", _x = x); var z = _using(_stack, { async [Symbol.asyncDispose] () {} }, true); var y = 2; + const w = 3; + _export("w", _w = w); var _default = 4; console.log(w, x, y, z); } catch (_) { diff --git a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).2.minified.js b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).2.minified.js index bd0e7b367b46..4630f1887b8e 100644 --- a/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).2.minified.js +++ b/crates/swc/tests/tsc-references/awaitUsingDeclarationsTopLevelOfModule.1(module=system).2.minified.js @@ -4,7 +4,10 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { var _dispose, _using; - return { + return _export({ + x: void 0, + w: void 0 + }), { setters: [ function(_dispose1) { _dispose = _dispose1._; @@ -14,12 +17,13 @@ System.register([ } ], execute: async function() { - _export("x", 1), _export("w", 3); try { - var _stack = [], z = _using(_stack, { + var _stack = []; + _export("x", 1); + var z = _using(_stack, { async [Symbol.asyncDispose] () {} }, !0); - console.log(3, 1, 2, z); + _export("w", 3), console.log(3, 1, 2, z); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).1.normal.js index 0485d90abd67..5a7694ff8c14 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).1.normal.js @@ -20,23 +20,27 @@ define([ return _default; }, w: function() { - return w; + return _w; }, x: function() { - return x; + return _x; }, y: function() { return y; } }); - const x = 1; - const w = 3; + var _x; + var _w; try { var _stack = []; + const x = 1; + _x = x; var z = _using._(_stack, { [Symbol.dispose] () {} }); var y = 2; + const w = 3; + _w = w; var _default = 4; console.log(w, x, y, z); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).2.minified.js index 4ee0b5226fdb..235a9ad3569c 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=amd).2.minified.js @@ -17,21 +17,24 @@ define([ return _default; }, w: function() { - return w; + return _w; }, x: function() { - return x; + return _x; }, y: function() { return y; } }); - let x = 1, w = 3; try { - var _stack = [], z = _using._(_stack, { + var _x, _w, _stack = []; + _x = 1; + var z = _using._(_stack, { [Symbol.dispose] () {} - }), y = 2, _default = 4; - console.log(w, x, y, z); + }), y = 2; + _w = 3; + var _default = 4; + console.log(3, 1, y, z); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).1.normal.js index 8017e698d9b2..c40880af7c2e 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).1.normal.js @@ -14,10 +14,10 @@ _export(exports, { return _default; }, w: function() { - return w; + return _w; }, x: function() { - return x; + return _x; }, y: function() { return y; @@ -25,14 +25,18 @@ _export(exports, { }); const _dispose = require("@swc/helpers/_/_dispose"); const _using = require("@swc/helpers/_/_using"); -const x = 1; -const w = 3; +var _x; +var _w; try { var _stack = []; + const x = 1; + _x = x; var z = _using._(_stack, { [Symbol.dispose] () {} }); var y = 2; + const w = 3; + _w = w; var _default = 4; console.log(w, x, y, z); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).2.minified.js index 1bfa130cfc6e..0b85b546bbc0 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=commonjs).2.minified.js @@ -11,21 +11,25 @@ Object.defineProperty(exports, "__esModule", { return _default; }, w: function() { - return w; + return _w; }, x: function() { - return x; + return _x; }, y: function() { return y; } }); -const _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"), x = 1, w = 3; +const _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); try { - var _stack = [], z = _using._(_stack, { + var _x, _w, _stack = []; + _x = 1; + var z = _using._(_stack, { [Symbol.dispose] () {} - }), y = 2, _default = 4; - console.log(w, x, y, z); + }), y = 2; + _w = 3; + var _default = 4; + console.log(3, 1, y, z); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js index 2fb89ce9d837..0604f3baa47c 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).1.normal.js @@ -1,16 +1,20 @@ //// [usingDeclarationsTopLevelOfModule.1.ts] import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export const x = 1; +var _x; export { y }; -export const w = 3; +var _w; export { _default as default }; try { var _stack = []; + const x = 1; + _x = x; var z = _using(_stack, { [Symbol.dispose] () {} }); var y = 2; + const w = 3; + _w = w; var _default = 4; console.log(w, x, y, z); } catch (_) { @@ -19,3 +23,5 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _x as x }; +export { _w as w }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js index 5c89ca304136..fa9e2f05fd83 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=es6).2.minified.js @@ -1,16 +1,18 @@ //// [usingDeclarationsTopLevelOfModule.1.ts] import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export const x = 1; -export const w = 3; try { - var _stack = [], z = _using(_stack, { + var _x, _w, _stack = []; + _x = 1; + var z = _using(_stack, { [Symbol.dispose] () {} - }), y = 2, _default = 4; + }), y = 2; + _w = 3; + var _default = 4; console.log(3, 1, y, z); } catch (_) { var _error = _, _hasError = !0; } finally{ _dispose(_stack, _error, _hasError); } -export { y, _default as default }; +export { y, _default as default, _x as x, _w as w }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).1.normal.js index f8fe79fb4fd7..a8033a3a4d22 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).1.normal.js @@ -4,7 +4,11 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _dispose, _using, x, w; + var _dispose, _using, _x, _w; + _export({ + x: void 0, + w: void 0 + }); return { setters: [ function(_dispose1) { @@ -15,14 +19,16 @@ System.register([ } ], execute: function() { - _export("x", x = 1); - _export("w", w = 3); try { var _stack = []; + const x = 1; + _export("x", _x = x); var z = _using(_stack, { [Symbol.dispose] () {} }); var y = 2; + const w = 3; + _export("w", _w = w); var _default = 4; console.log(w, x, y, z); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).2.minified.js index eb0ce16e5330..7f6b5dcbdf20 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsTopLevelOfModule.1(module=system).2.minified.js @@ -4,7 +4,10 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { var _dispose, _using; - return { + return _export({ + x: void 0, + w: void 0 + }), { setters: [ function(_dispose1) { _dispose = _dispose1._; @@ -14,12 +17,13 @@ System.register([ } ], execute: function() { - _export("x", 1), _export("w", 3); try { - var _stack = [], z = _using(_stack, { + var _stack = []; + _export("x", 1); + var z = _using(_stack, { [Symbol.dispose] () {} }); - console.log(3, 1, 2, z); + _export("w", 3), console.log(3, 1, 2, z); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).1.normal.js index 1ae9d023e761..bf766002e453 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).1.normal.js @@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _dispose = require("@swc/helpers/_/_dispose"); const _using = require("@swc/helpers/_/_using"); -class C { -} +var _C; try { var _stack = []; var before = _using._(_stack, null); + class C { + } + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).2.minified.js index d15b7ebd3f3a..3d5bf0f8fc73 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es2015).2.minified.js @@ -4,15 +4,16 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); -class C { -} try { - var _stack = []; - _using._(_stack, null), C = _ts_decorate._([ + var _C, _stack = []; + _using._(_stack, null); + class C { + } + _C = C, C = _ts_decorate._([ dec ], C); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).1.normal.js index 89d70f0d1b79..6dbef6773916 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).1.normal.js @@ -6,20 +6,22 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); var _class_call_check = require("@swc/helpers/_/_class_call_check"); var _ts_decorate = require("@swc/helpers/_/_ts_decorate"); var _dispose = require("@swc/helpers/_/_dispose"); var _using = require("@swc/helpers/_/_using"); -var C = function C() { - "use strict"; - _class_call_check._(this, C); -}; +var _C; try { var _stack = []; var before = _using._(_stack, null); + var C = function C() { + "use strict"; + _class_call_check._(this, C); + }; + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).2.minified.js index be9f529fdb81..70226f357f9d 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=es5).2.minified.js @@ -4,15 +4,17 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); -var _class_call_check = require("@swc/helpers/_/_class_call_check"), _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"), C = function C() { - _class_call_check._(this, C); -}; +var _C, _class_call_check = require("@swc/helpers/_/_class_call_check"), _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); try { var _stack = []; - _using._(_stack, null), C = _ts_decorate._([ + _using._(_stack, null); + var C = function C() { + _class_call_check._(this, C); + }; + _C = C, C = _ts_decorate._([ dec ], C); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js index 1ae9d023e761..bf766002e453 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).1.normal.js @@ -6,17 +6,19 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _dispose = require("@swc/helpers/_/_dispose"); const _using = require("@swc/helpers/_/_using"); -class C { -} +var _C; try { var _stack = []; var before = _using._(_stack, null); + class C { + } + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js index d15b7ebd3f3a..3d5bf0f8fc73 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=commonjs,target=esnext).2.minified.js @@ -4,15 +4,16 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); -class C { -} try { - var _stack = []; - _using._(_stack, null), C = _ts_decorate._([ + var _C, _stack = []; + _using._(_stack, null); + class C { + } + _C = C, C = _ts_decorate._([ dec ], C); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).1.normal.js index ff48f455bbae..d21a0d275137 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).1.normal.js @@ -2,11 +2,13 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} +var _C; try { var _stack = []; var before = _using(_stack, null); + class C { + } + _C = C; C = _ts_decorate([ dec ], C); @@ -16,3 +18,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).2.minified.js index c4b0cfc77cef..526153f667c2 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es2015).2.minified.js @@ -2,11 +2,12 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} try { - var _stack = []; - _using(_stack, null), C = _ts_decorate([ + var _C, _stack = []; + _using(_stack, null); + class C { + } + _C = C, C = _ts_decorate([ dec ], C); } catch (_) { @@ -14,3 +15,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).1.normal.js index 152c4ff4a3c0..3caca2d874f5 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).1.normal.js @@ -3,13 +3,15 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export var C = function C() { - "use strict"; - _class_call_check(this, C); -}; +var _C; try { var _stack = []; var before = _using(_stack, null); + var C = function C() { + "use strict"; + _class_call_check(this, C); + }; + _C = C; C = _ts_decorate([ dec ], C); @@ -19,3 +21,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).2.minified.js index 6c3dd0be47b5..05b69667369a 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=es5).2.minified.js @@ -3,12 +3,13 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export var C = function C() { - _class_call_check(this, C); -}; try { - var _stack = []; - _using(_stack, null), C = _ts_decorate([ + var _C, _stack = []; + _using(_stack, null); + var C = function C() { + _class_call_check(this, C); + }; + _C = C, C = _ts_decorate([ dec ], C); } catch (_) { @@ -16,3 +17,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js index ff48f455bbae..d21a0d275137 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).1.normal.js @@ -2,11 +2,13 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} +var _C; try { var _stack = []; var before = _using(_stack, null); + class C { + } + _C = C; C = _ts_decorate([ dec ], C); @@ -16,3 +18,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js index c4b0cfc77cef..526153f667c2 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=es6,target=esnext).2.minified.js @@ -2,11 +2,12 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} try { - var _stack = []; - _using(_stack, null), C = _ts_decorate([ + var _C, _stack = []; + _using(_stack, null); + class C { + } + _C = C, C = _ts_decorate([ dec ], C); } catch (_) { @@ -14,3 +15,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).1.normal.js index 2a82f32ab288..cbbd98cadaa1 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).1.normal.js @@ -5,7 +5,7 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using, _C; _export("C", void 0); return { setters: [ @@ -20,14 +20,15 @@ System.register([ } ], execute: function() { - _export("C", C = class C { - }); try { var _stack = []; var before = _using(_stack, null); - _export("C", C = _ts_decorate([ + class C { + } + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _; var _hasError = true; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).2.minified.js index 5fef1b50b93c..b7e46c04b56d 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es2015).2.minified.js @@ -4,7 +4,7 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using; return _export("C", void 0), { setters: [ function(_ts_decorate1) { @@ -18,13 +18,14 @@ System.register([ } ], execute: function() { - _export("C", C = class { - }); try { var _stack = []; - _using(_stack, null), _export("C", C = _ts_decorate([ + _using(_stack, null); + class C { + } + _export("C", C), C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).1.normal.js index d7e10b7f7ee4..fad5d2641ce2 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).1.normal.js @@ -6,7 +6,8 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _class_call_check, _ts_decorate, _dispose, _using, C; + var _class_call_check, _ts_decorate, _dispose, _using, _C; + _export("C", void 0); return { setters: [ function(_class_call_check1) { @@ -23,16 +24,17 @@ System.register([ } ], execute: function() { - _export("C", C = function C() { - "use strict"; - _class_call_check(this, C); - }); try { var _stack = []; var before = _using(_stack, null); - _export("C", C = _ts_decorate([ + var C = function C() { + "use strict"; + _class_call_check(this, C); + }; + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _; var _hasError = true; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).2.minified.js index e792c29e0cb8..c1deb230f753 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=es5).2.minified.js @@ -5,8 +5,8 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _class_call_check, _ts_decorate, _dispose, _using, C; - return { + var _class_call_check, _ts_decorate, _dispose, _using; + return _export("C", void 0), { setters: [ function(_class_call_check1) { _class_call_check = _class_call_check1._; @@ -22,14 +22,15 @@ System.register([ } ], execute: function() { - _export("C", C = function C() { - _class_call_check(this, C); - }); try { var _stack = []; - _using(_stack, null), _export("C", C = _ts_decorate([ + _using(_stack, null); + var C = function C() { + _class_call_check(this, C); + }; + _export("C", C), C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js index 2a82f32ab288..cbbd98cadaa1 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).1.normal.js @@ -5,7 +5,7 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using, _C; _export("C", void 0); return { setters: [ @@ -20,14 +20,15 @@ System.register([ } ], execute: function() { - _export("C", C = class C { - }); try { var _stack = []; var before = _using(_stack, null); - _export("C", C = _ts_decorate([ + class C { + } + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _; var _hasError = true; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js index 5fef1b50b93c..b7e46c04b56d 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.2(module=system,target=esnext).2.minified.js @@ -4,7 +4,7 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using; return _export("C", void 0), { setters: [ function(_ts_decorate1) { @@ -18,13 +18,14 @@ System.register([ } ], execute: function() { - _export("C", C = class { - }); try { var _stack = []; - _using(_stack, null), _export("C", C = _ts_decorate([ + _using(_stack, null); + class C { + } + _export("C", C), C = _ts_decorate([ dec - ], C)); + ], C); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).1.normal.js index 199c2f4579f2..8548e1c8cf4b 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).1.normal.js @@ -6,16 +6,18 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _dispose = require("@swc/helpers/_/_dispose"); const _using = require("@swc/helpers/_/_using"); -class C { -} +var _C; try { var _stack = []; + class C { + } + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).2.minified.js index a21aea63e27d..857eb3e81424 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es2015).2.minified.js @@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); -class C { -} try { - var _stack = []; - C = _ts_decorate._([ + var _C, _stack = []; + class C { + } + _C = C, C = _ts_decorate._([ dec ], C), _using._(_stack, null); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).1.normal.js index b16c7b330ac2..a3c0297321a8 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).1.normal.js @@ -6,19 +6,21 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); var _class_call_check = require("@swc/helpers/_/_class_call_check"); var _ts_decorate = require("@swc/helpers/_/_ts_decorate"); var _dispose = require("@swc/helpers/_/_dispose"); var _using = require("@swc/helpers/_/_using"); -var C = function C() { - "use strict"; - _class_call_check._(this, C); -}; +var _C; try { var _stack = []; + var C = function C() { + "use strict"; + _class_call_check._(this, C); + }; + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).2.minified.js index 9478af3b566e..bc84c9fe84c9 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=es5).2.minified.js @@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); -var _class_call_check = require("@swc/helpers/_/_class_call_check"), _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"), C = function C() { - _class_call_check._(this, C); -}; +var _C, _class_call_check = require("@swc/helpers/_/_class_call_check"), _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); try { - var _stack = []; - C = _ts_decorate._([ + var _stack = [], C = function C() { + _class_call_check._(this, C); + }; + _C = C, C = _ts_decorate._([ dec ], C), _using._(_stack, null); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js index 199c2f4579f2..8548e1c8cf4b 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).1.normal.js @@ -6,16 +6,18 @@ Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "C", { enumerable: true, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"); const _dispose = require("@swc/helpers/_/_dispose"); const _using = require("@swc/helpers/_/_using"); -class C { -} +var _C; try { var _stack = []; + class C { + } + _C = C; C = _ts_decorate._([ dec ], C); diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js index a21aea63e27d..857eb3e81424 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=commonjs,target=esnext).2.minified.js @@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", { }), Object.defineProperty(exports, "C", { enumerable: !0, get: function() { - return C; + return _C; } }); const _ts_decorate = require("@swc/helpers/_/_ts_decorate"), _dispose = require("@swc/helpers/_/_dispose"), _using = require("@swc/helpers/_/_using"); -class C { -} try { - var _stack = []; - C = _ts_decorate._([ + var _C, _stack = []; + class C { + } + _C = C, C = _ts_decorate._([ dec ], C), _using._(_stack, null); } catch (_) { diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).1.normal.js index 6c373ed12a1e..612fe5198fcb 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).1.normal.js @@ -2,10 +2,12 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} +var _C; try { var _stack = []; + class C { + } + _C = C; C = _ts_decorate([ dec ], C); @@ -16,3 +18,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).2.minified.js index a3af30389d45..0b335d56f288 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es2015).2.minified.js @@ -2,11 +2,11 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} try { - var _stack = []; - C = _ts_decorate([ + var _C, _stack = []; + class C { + } + _C = C, C = _ts_decorate([ dec ], C), _using(_stack, null); } catch (_) { @@ -14,3 +14,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).1.normal.js index 556ada9cad96..65b869691318 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).1.normal.js @@ -3,12 +3,14 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export var C = function C() { - "use strict"; - _class_call_check(this, C); -}; +var _C; try { var _stack = []; + var C = function C() { + "use strict"; + _class_call_check(this, C); + }; + _C = C; C = _ts_decorate([ dec ], C); @@ -19,3 +21,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).2.minified.js index a3b5a2e1a314..0e2160687553 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=es5).2.minified.js @@ -3,12 +3,11 @@ import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check"; import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export var C = function C() { - _class_call_check(this, C); -}; try { - var _stack = []; - C = _ts_decorate([ + var _C, _stack = [], C = function C() { + _class_call_check(this, C); + }; + _C = C, C = _ts_decorate([ dec ], C), _using(_stack, null); } catch (_) { @@ -16,3 +15,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js index 6c373ed12a1e..612fe5198fcb 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).1.normal.js @@ -2,10 +2,12 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} +var _C; try { var _stack = []; + class C { + } + _C = C; C = _ts_decorate([ dec ], C); @@ -16,3 +18,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js index a3af30389d45..0b335d56f288 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=es6,target=esnext).2.minified.js @@ -2,11 +2,11 @@ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate"; import { _ as _dispose } from "@swc/helpers/_/_dispose"; import { _ as _using } from "@swc/helpers/_/_using"; -export class C { -} try { - var _stack = []; - C = _ts_decorate([ + var _C, _stack = []; + class C { + } + _C = C, C = _ts_decorate([ dec ], C), _using(_stack, null); } catch (_) { @@ -14,3 +14,4 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _C as C }; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).1.normal.js index 50c063c482ff..dd520731f7c3 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).1.normal.js @@ -5,7 +5,7 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using, _C; _export("C", void 0); return { setters: [ @@ -20,13 +20,14 @@ System.register([ } ], execute: function() { - _export("C", C = class C { - }); try { var _stack = []; - _export("C", C = _ts_decorate([ + class C { + } + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); var after = _using(_stack, null); } catch (_) { var _error = _; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).2.minified.js index f2c0c82a426a..1b7d491d59c1 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es2015).2.minified.js @@ -4,7 +4,7 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using; return _export("C", void 0), { setters: [ function(_ts_decorate1) { @@ -18,13 +18,13 @@ System.register([ } ], execute: function() { - _export("C", C = class { - }); try { var _stack = []; - _export("C", C = _ts_decorate([ + class C { + } + _export("C", C), C = _ts_decorate([ dec - ], C)), _using(_stack, null); + ], C), _using(_stack, null); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).1.normal.js index fb25f44ef1a1..a6801e82cabf 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).1.normal.js @@ -6,7 +6,8 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _class_call_check, _ts_decorate, _dispose, _using, C; + var _class_call_check, _ts_decorate, _dispose, _using, _C; + _export("C", void 0); return { setters: [ function(_class_call_check1) { @@ -23,15 +24,16 @@ System.register([ } ], execute: function() { - _export("C", C = function C() { - "use strict"; - _class_call_check(this, C); - }); try { var _stack = []; - _export("C", C = _ts_decorate([ + var C = function C() { + "use strict"; + _class_call_check(this, C); + }; + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); var after = _using(_stack, null); } catch (_) { var _error = _; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).2.minified.js index bee1ee0a0959..3a1e329a924a 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=es5).2.minified.js @@ -5,8 +5,8 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _class_call_check, _ts_decorate, _dispose, _using, C; - return { + var _class_call_check, _ts_decorate, _dispose, _using; + return _export("C", void 0), { setters: [ function(_class_call_check1) { _class_call_check = _class_call_check1._; @@ -22,14 +22,13 @@ System.register([ } ], execute: function() { - _export("C", C = function C() { - _class_call_check(this, C); - }); try { - var _stack = []; - _export("C", C = _ts_decorate([ + var _stack = [], C = function C() { + _class_call_check(this, C); + }; + _export("C", C), C = _ts_decorate([ dec - ], C)), _using(_stack, null); + ], C), _using(_stack, null); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js index 50c063c482ff..dd520731f7c3 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).1.normal.js @@ -5,7 +5,7 @@ System.register([ "@swc/helpers/_/_using" ], function(_export, _context) { "use strict"; - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using, _C; _export("C", void 0); return { setters: [ @@ -20,13 +20,14 @@ System.register([ } ], execute: function() { - _export("C", C = class C { - }); try { var _stack = []; - _export("C", C = _ts_decorate([ + class C { + } + _export("C", _C = C); + C = _ts_decorate([ dec - ], C)); + ], C); var after = _using(_stack, null); } catch (_) { var _error = _; diff --git a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js index f2c0c82a426a..1b7d491d59c1 100644 --- a/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js +++ b/crates/swc/tests/tsc-references/usingDeclarationsWithLegacyClassDecorators.8(module=system,target=esnext).2.minified.js @@ -4,7 +4,7 @@ System.register([ "@swc/helpers/_/_dispose", "@swc/helpers/_/_using" ], function(_export, _context) { - var _ts_decorate, _dispose, _using, C; + var _ts_decorate, _dispose, _using; return _export("C", void 0), { setters: [ function(_ts_decorate1) { @@ -18,13 +18,13 @@ System.register([ } ], execute: function() { - _export("C", C = class { - }); try { var _stack = []; - _export("C", C = _ts_decorate([ + class C { + } + _export("C", C), C = _ts_decorate([ dec - ], C)), _using(_stack, null); + ], C), _using(_stack, null); } catch (_) { var _error = _, _hasError = !0; } finally{ diff --git a/crates/swc_ecma_compat_es2015/src/classes/constructor.rs b/crates/swc_ecma_compat_es2015/src/classes/constructor.rs index c3739d682bf5..5b091143e5c1 100644 --- a/crates/swc_ecma_compat_es2015/src/classes/constructor.rs +++ b/crates/swc_ecma_compat_es2015/src/classes/constructor.rs @@ -460,7 +460,6 @@ pub(super) fn replace_this_in_constructor(mark: Mark, c: &mut Constructor) -> bo wrap_with_assertion: bool, } - #[swc_trace] impl VisitMut for Replacer { noop_visit_mut_type!(); diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs index ff739a0ab6a6..f1bdc725205b 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_classes.rs @@ -2617,141 +2617,6 @@ class Foo extends Bar { "# ); -//// regression_3028 -//test!( -// syntax(), -// |_| tr(r#"{ -// "plugins": [ "proposal-class-properties"], -// "presets": ["env" "react"] -//} -//"#), -// regression_3028, -// r#" -//class b { -//} -// -//class a1 extends b { -// constructor() { -// super(); -// this.x = () => this; -// } -//} -// -//export default class a2 extends b { -// constructor() { -// super(); -// this.x = () => this; -// } -//} -// -//"# -// r#" -//"use strict"; -// -//Object.defineProperty(exports, "__esModule" { -// value: true -//}); -//exports["default"] = void 0; -// -//var b = function b() { -// _class_call_check(this, b); -//}; -// -//var a1 = -// /*#__PURE__*/ -//function (_b) { -// _inherits(a1, _b); -// -// function a1() { -// var _this; -// -// _class_call_check(this, a1); -// _this = _possible_constructor_return(this, -// _get_prototype_of(a1).call(this)); -// -// _this.x = function () { -// return _assert_this_initialized(_this); -// }; -// -// return _this; -// } -// -// return a1; -//}(b); -// -//var a2 = -// /*#__PURE__*/ -//function (_b2) { -// _inherits(a2, _b2); -// -// function a2() { -// var _this2; -// -// _class_call_check(this, a2); -// _this2 = _possible_constructor_return(this, -// _get_prototype_of(a2).call(this)); -// -// _this2.x = function () { -// return _assert_this_initialized(_this2); -// }; -// -// return _this2; -// } -// -// return a2; -//}(b); -// -//exports["default"] = a2; -// -//"# -//); - -//// regression_t2997 -//test!( -// syntax(), -// |_| tr(r#"{ -// "plugins": [ "proposal-class-properties"], -// "presets": ["env" "react"] -//} -//"#), -// regression_t2997, -// r#" -//class A {} -// -//class B extends A { -// constructor() { -// return super(); -// } -//} -// -//"# -// r#" -//var A = function A() { -// "use strict"; -// -// _class_call_check(this, A); -//}; -// -//var B = -// /*#__PURE__*/ -//function (A) { -// "use strict"; -// -// _inherits(B, A); -// -// function B() { -// var _this; -// -// _class_call_check(this, B); -// return _possible_constructor_return(_this, _this = -// _possible_constructor_return(this, _get_prototype_of(B).call(this))); } -// -// return B; -//}(A); -// -//"# -//); - // extend_builtins_shadowed test!( // Cost is too high while being useless @@ -3263,42 +3128,6 @@ expect(obj[1]).toBe(2); "# ); -//// regression_5769 -//test_exec!( -// syntax(), -// |_| tr(r#"{ -// "plugins": [ "proposal-class-properties"], -// "presets": ["env" "react"] -//} -//"#), -// regression_5769_exec, -// r#" -//class Point { -// getX() { -// expect(this.x).toBe(3); // C -// } -//} -// -//class ColorPoint extends Point { -// constructor() { -// super(); -// this.x = 2; -// super.x = 3; -// expect(this.x).toBe(3); // A -// expect(super.x).toBeUndefined(); // B -// } -// -// m() { -// this.getX() -// } -//} -// -//const cp = new ColorPoint(); -//cp.m(); -// -//"# -//); - // get_set_get_semantics_setter_defined_on_parent test_exec!( syntax(), @@ -3330,88 +3159,6 @@ expect(obj.get()).toBeUndefined(); "# ); -//// regression_t7537 -//test!( -// syntax(), -// |_| tr(r#"{ -// "plugins": ["transform-exponentiation-operator"], -// "presets": ["env"] -//} -//"#), -// regression_t7537, -// r#" -//class B{} -//class A extends B{ -// constructor(track){ -// if (track !== undefined) super(track); -// else super(); -// } -//} -// -//"# -// r#" -//function _typeof(obj) { if (typeof Symbol === "function" && typeof -// Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return -// typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && -// typeof Symbol === "function" && obj.constructor === Symbol && obj !== -// Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -// -//function _possible_constructor_return(self, call) { if (call && -// (_typeof(call) === "object" || typeof call === "function")) { return call; } -// return _assert_this_initialized(self); } -// -//function _assert_this_initialized(self) { if (self === void 0) { throw new -// ReferenceError("this hasn't been initialised - super() hasn't been called"); -// } return self; } -// -//function _get_prototype_of(o) { _get_prototype_of = Object.setPrototypeOf ? -// Object.getPrototypeOf : function _get_prototype_of(o) { return o.__proto__ || -// Object.getPrototypeOf(o); }; return _get_prototype_of(o); } -// -//function _inherits(subClass, superClass) { if (typeof superClass !== -// "function" && superClass !== null) { throw new TypeError("Super expression -// must either be null or a function"); } subClass.prototype = -// Object.create(superClass && superClass.prototype, { constructor: { value: -// subClass, writable: true, configurable: true } }); if (superClass) -// _set_prototype_of(subClass, superClass); } -// -//function _set_prototype_of(o, p) { _set_prototype_of = Object.setPrototypeOf -// || function _set_prototype_of(o, p) { o.__proto__ = p; return o; }; return -// _set_prototype_of(o, p); } -// -//function _class_call_check(instance, Constructor) { if (!(instance instanceof -// Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// -//var B = function B() { -// "use strict"; -// -// _class_call_check(this, B); -//}; -// -//var A = -// /*#__PURE__*/ -//function (_B) { -// "use strict"; -// -// _inherits(A, _B); -// -// function A(track) { -// var _this; -// -// _class_call_check(this, A); -// -// if (track !== undefined) _this = _possible_constructor_return(this, -// _get_prototype_of(A).call(this, track));else _this = -// _possible_constructor_return(this, _get_prototype_of(A).call(this)); -// return _possible_constructor_return(_this); -// } -// -// return A; -//}(B); -// -//"# -//); - // regression_t7010 test!( // TODO: Unignore this diff --git a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs index 416c7239ac30..d0168e88f240 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2015_parameters.rs @@ -789,190 +789,6 @@ function foo(...args){ }"# ); -//// regression_6057_expanded -//test!( -// syntax(), -// |_| tr(r#"{ -// "presets": ["env"], -// "plugins": ["proposal-class-properties"] -//} -//"#), -// regression_6057_expanded, -// r#" -//import args from 'utils/url/args'; -// -//export default class App extends Component { -// exportType = '' -// -// componentDidMount() { -// this.exportType = args.get('type', window.location.href); -// } -//} -// -//"# -// r#" -//"use strict"; -// -//Object.defineProperty(exports, "__esModule" { -// value: true -//}); -//exports["default"] = void 0; -// -//var _args = _interop_require_default(require("utils/url/args")); -// -//function _interop_require_default(obj) { return obj && obj.__esModule ? obj : -// { "default": obj }; } -// -//function _typeof(obj) { if (typeof Symbol === "function" && typeof -// Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return -// typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && -// typeof Symbol === "function" && obj.constructor === Symbol && obj !== -// Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -// -//function _class_call_check(instance, Constructor) { if (!(instance instanceof -// Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// -//function _defineProperties(target, props) { for (var i = 0; i < props.length; -// i++) { var descriptor = props[i]; descriptor.enumerable = -// descriptor.enumerable || false; descriptor.configurable = true; if ("value" -// in descriptor) descriptor.writable = true; Object.defineProperty(target, -// descriptor.key, descriptor); } } -// -//function _create_class(Constructor, protoProps, staticProps) { if -// (protoProps) _defineProperties(Constructor.prototype, protoProps); if -// (staticProps) _defineProperties(Constructor, staticProps); return -// Constructor; } -// -//function _possible_constructor_return(self, call) { if (call && -// (_typeof(call) === "object" || typeof call === "function")) { return call; } -// return _assert_this_initialized(self); } -// -//function _get_prototype_of(o) { _get_prototype_of = Object.setPrototypeOf ? -// Object.getPrototypeOf : function _get_prototype_of(o) { return o.__proto__ || -// Object.getPrototypeOf(o); }; return _get_prototype_of(o); } -// -//function _assert_this_initialized(self) { if (self === void 0) { throw new -// ReferenceError("this hasn't been initialised - super() hasn't been called"); -// } return self; } -// -//function _inherits(subClass, superClass) { if (typeof superClass !== -// "function" && superClass !== null) { throw new TypeError("Super expression -// must either be null or a function"); } subClass.prototype = -// Object.create(superClass && superClass.prototype, { constructor: { value: -// subClass, writable: true, configurable: true } }); if (superClass) -// _set_prototype_of(subClass, superClass); } -// -//function _set_prototype_of(o, p) { _set_prototype_of = Object.setPrototypeOf -// || function _set_prototype_of(o, p) { o.__proto__ = p; return o; }; return -// _set_prototype_of(o, p); } -// -//function _define_property(obj, key, value) { if (key in obj) { -// Object.defineProperty(obj, key, { value: value, enumerable: true, -// configurable: true, writable: true }); } else { obj[key] = value; } return -// obj; } -// -//var App = -// /*#__PURE__*/ -//function (_Component) { -// _inherits(App, _Component); -// -// function App() { -// var _get_prototype_of2; -// -// var _this; -// -// _class_call_check(this, App); -// -// for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < -// _len; _key++) { args[_key] = arguments[_key]; -// } -// -// _this = _possible_constructor_return(this, (_get_prototype_of2 = -// _get_prototype_of(App)).call.apply(_get_prototype_of2, [this].concat(args))); -// -// _define_property(_assert_this_initialized(_this), "exportType" ''); -// -// return _this; -// } -// -// _create_class(App, [{ -// key: "componentDidMount" -// value: function componentDidMount() { -// this.exportType = _args["default"].get('type', window.location.href); -// } -// }]); -// -// return App; -//}(Component); -// -//exports["default"] = App; -// -//"# -//); - -//// parameters_iife_this_9385 -//test!( -// syntax(), -// |_| tr(r#"{ -// "plugins": ["transform-typescript"], -// "presets": ["env"] -//} -//"#), -// parameters_iife_this_9385, -// r#" -//export class Test { -// invite(options: { privacy: string } = {}) { -// const privacy = options.privacy || "Private" -// console.log(this) -// } -//} -//"# -// r#" -//"use strict"; -// -//Object.defineProperty(exports, "__esModule" { -// value: true -//}); -//exports.Test = void 0; -// -//function _class_call_check(instance, Constructor) { if (!(instance instanceof -// Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// -//function _defineProperties(target, props) { for (var i = 0; i < props.length; -// i++) { var descriptor = props[i]; descriptor.enumerable = -// descriptor.enumerable || false; descriptor.configurable = true; if ("value" -// in descriptor) descriptor.writable = true; Object.defineProperty(target, -// descriptor.key, descriptor); } } -// -//function _create_class(Constructor, protoProps, staticProps) { if -// (protoProps) _defineProperties(Constructor.prototype, protoProps); if -// (staticProps) _defineProperties(Constructor, staticProps); return -// Constructor; } -// -//var Test = -// /*#__PURE__*/ -//function () { -// function Test() { -// _class_call_check(this, Test); -// } -// -// _create_class(Test, [{ -// key: "invite" -// value: function invite() { -// var options = arguments.length > 0 && arguments[0] !== undefined ? -// arguments[0] : {}; var privacy = options.privacy || "Private"; -// console.log(this); -// } -// }]); -// -// return Test; -//}(); -// -//exports.Test = Test; -// -//"# -//); - // parameters_rest_async_arrow_functions test!( // See https://github.com/swc-project/swc/issues/490 diff --git a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs index e4f90f0a3b81..aa0f9ff31e4f 100644 --- a/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs +++ b/crates/swc_ecma_transforms_compat/tests/es2022_class_properties.rs @@ -1921,47 +1921,6 @@ function withContext(ComposedComponent) { "# ); -// public_foobar -//test!(syntax(),|t| tr("{ -// "plugins": [ "proposal-class-properties"], -// "presets": ["env"] -//} -//"), public_foobar, r#" -//class Child extends Parent { -// constructor() { -// super(); -// } -// -// scopedFunctionWithThis = () => { -// this.name = {}; -// } -//} -// -//"# r#" -//var Child = -// /*#__PURE__*/ -//function (_Parent) { -// "use strict"; -// -// _inherits(Child, _Parent); -// -// function Child() { -// var _this; -// -// _class_call_check(this, Child); -// _this = _possible_constructor_return(this, -// _get_prototype_of(Child).call(this)); -// _define_property(_assert_this_initialized(_this), -// "scopedFunctionWithThis" function () { _this.name = {}; -// }); -// return _this; -// } -// -// return Child; -//}(Parent); -// -//"#); - // private_reevaluated test!( syntax(), @@ -2458,113 +2417,6 @@ expect(() => new Derived(foo)).toThrow() "# ); -//// regression_6154 -//test!(syntax(),|t| tr("{ -// "presets": ["env"], -// "plugins": class_properties(Some(t.comments.clone()),Default::default()) -//} -//"), regression_6154, r#" -//class Test { -// constructor() { -// class Other extends Test { -// a = () => super.test; -// static a = () => super.test; -// } -// } -//} -// -//"# r#" -//function _typeof(obj) { if (typeof Symbol === "function" && typeof -// Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return -// typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && -// typeof Symbol === "function" && obj.constructor === Symbol && obj !== -// Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -// -//function _possible_constructor_return(self, call) { if (call && -// (_typeof(call) === "object" || typeof call === "function")) { return call; } -// return _assert_this_initialized(self); } -// -//function _assert_this_initialized(self) { if (self === void 0) { throw new -// ReferenceError("this hasn't been initialised - super() hasn't been called"); -// } return self; } -// -//function _inherits(subClass, superClass) { if (typeof superClass !== -// "function" && superClass !== null) { throw new TypeError("Super expression -// must either be null or a function"); } subClass.prototype = -// Object.create(superClass && superClass.prototype, { constructor: { value: -// subClass, writable: true, configurable: true } }); if (superClass) -// _set_prototype_of(subClass, superClass); } -// -//function _set_prototype_of(o, p) { _set_prototype_of = Object.setPrototypeOf -// || function _set_prototype_of(o, p) { o.__proto__ = p; return o; }; return -// _set_prototype_of(o, p); } -// -//function _get(target, property, receiver) { if (typeof Reflect !== -// "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function -// _get(target, property, receiver) { var base = _super_prop_base(target, -// property); if (!base) return; var desc = -// Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return -// desc.get.call(receiver); } return desc.value; }; } return _get(target, -// property, receiver || target); } -// -//function _super_prop_base(object, property) { while -// (!Object.prototype.hasOwnProperty.call(object, property)) { object = -// _get_prototype_of(object); if (object === null) break; } return object; } -// -//function _get_prototype_of(o) { _get_prototype_of = Object.setPrototypeOf ? -// Object.getPrototypeOf : function _get_prototype_of(o) { return o.__proto__ || -// Object.getPrototypeOf(o); }; return _get_prototype_of(o); } -// -//function _define_property(obj, key, value) { if (key in obj) { -// Object.defineProperty(obj, key, { value: value, enumerable: true, -// configurable: true, writable: true }); } else { obj[key] = value; } return -// obj; } -// -//function _class_call_check(instance, Constructor) { if (!(instance instanceof -// Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -// -//var Test = function Test() { -// "use strict"; -// -// _class_call_check(this, Test); -// -// var Other = -// /*#__PURE__*/ -// function (_Test) { -// _inherits(Other, _Test); -// -// function Other() { -// var _get_prototype_of2; -// -// var _this; -// -// _class_call_check(this, Other); -// -// for (var _len = arguments.length, args = new Array(_len), _key = 0; _key -// < _len; _key++) { args[_key] = arguments[_key]; -// } -// -// _this = _possible_constructor_return(this, (_get_prototype_of2 = -// _get_prototype_of(Other)).call.apply(_get_prototype_of2, -// [this].concat(args))); -// -// _define_property(_assert_this_initialized(_this), "a" function () { -// return _get(_get_prototype_of(Other.prototype), "test" -// _assert_this_initialized(_this)); }); -// -// return _this; -// } -// -// return Other; -// }(Test); -// -// _define_property(Other, "a" function () { -// return _get(_get_prototype_of(Other), "test" Other); -// }); -//}; -// -//"#); - // private_static_export test!( syntax(), diff --git a/crates/swc_ecma_transforms_proposal/src/decorator_2022_03.rs b/crates/swc_ecma_transforms_proposal/src/decorator_2022_03.rs index d60acea35ea6..649c1ec2e097 100644 --- a/crates/swc_ecma_transforms_proposal/src/decorator_2022_03.rs +++ b/crates/swc_ecma_transforms_proposal/src/decorator_2022_03.rs @@ -246,10 +246,10 @@ impl Decorator202203 { } }, _ => { - let ident = private_ident!("_computedKey"); + let key_ident = private_ident!("_computedKey"); self.extra_vars.push(VarDeclarator { span: DUMMY_SP, - name: Pat::Ident(ident.clone().into()), + name: Pat::Ident(key_ident.clone().into()), init: None, definite: false, }); @@ -257,20 +257,20 @@ impl Decorator202203 { self.pre_class_inits.push(Box::new(Expr::Assign(AssignExpr { span: DUMMY_SP, op: op!("="), - left: ident.clone().into(), + left: key_ident.clone().into(), right: Box::new(prop_name_to_expr_value(name.take())), }))); *name = PropName::Computed(ComputedPropName { span: DUMMY_SP, - expr: ident.clone().into(), + expr: key_ident.clone().into(), }); let init = Ident::new( format!("_{prefix}_computedKey").into(), - ident.span.private(), + key_ident.span.private(), ); - (Box::new(Expr::Ident(ident)), init) + (Box::new(Expr::Ident(key_ident)), init) } } } diff --git a/crates/swc_ecma_transforms_proposal/src/explicit_resource_management.rs b/crates/swc_ecma_transforms_proposal/src/explicit_resource_management.rs index 5f81501f0d89..625c03b91cf4 100644 --- a/crates/swc_ecma_transforms_proposal/src/explicit_resource_management.rs +++ b/crates/swc_ecma_transforms_proposal/src/explicit_resource_management.rs @@ -3,7 +3,7 @@ use std::iter::once; use swc_common::{util::take::Take, DUMMY_SP}; use swc_ecma_ast::*; use swc_ecma_transforms_base::helper; -use swc_ecma_utils::{private_ident, ExprFactory, ModuleItemLike, StmtLike}; +use swc_ecma_utils::{find_pat_ids, private_ident, ExprFactory, ModuleItemLike, StmtLike}; use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; pub fn explicit_resource_management() -> impl Fold + VisitMut { @@ -60,6 +60,7 @@ impl ExplicitResourceManagement { T: StmtLike + ModuleItemLike, { let mut new = vec![]; + let mut extras = vec![]; let mut try_body = vec![]; let stack_var_decl = VarDeclarator { @@ -173,6 +174,133 @@ impl ExplicitResourceManagement { })))); } + Ok(ModuleDecl::ExportDecl(e)) => { + match &e.decl { + Decl::Class(ClassDecl { ident, .. }) + | Decl::Fn(FnDecl { ident, .. }) => { + let ident = ident.clone(); + let var_name = private_ident!(format!("_{}", ident.sym)); + let var = VarDeclarator { + span: DUMMY_SP, + name: var_name.clone().into(), + init: None, + definite: Default::default(), + }; + + new.push(T::from_stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl { + span: DUMMY_SP, + kind: VarDeclKind::Var, + declare: false, + decls: vec![var], + }))))); + + try_body.push(Stmt::Decl(e.decl)); + try_body.push(Stmt::Expr(ExprStmt { + span: DUMMY_SP, + expr: AssignExpr { + span: DUMMY_SP, + op: op!("="), + left: var_name.clone().into(), + right: ident.clone().into(), + } + .into(), + })); + + let specifier = ExportSpecifier::Named(ExportNamedSpecifier { + span: DUMMY_SP, + orig: ModuleExportName::Ident(var_name), + exported: Some(ModuleExportName::Ident(ident.clone())), + is_type_only: false, + }); + + extras.push( + T::try_from_module_decl(ModuleDecl::ExportNamed(NamedExport { + span: DUMMY_SP, + specifiers: vec![specifier], + src: None, + type_only: false, + with: None, + })) + .unwrap(), + ); + } + Decl::Var(d) => { + let orig_var_names: Vec = find_pat_ids(&d.decls); + + let var_names = orig_var_names + .iter() + .map(|ident| private_ident!(format!("_{}", ident.sym))) + .collect::>(); + + let var_decls = var_names + .iter() + .cloned() + .map(|var_name| VarDeclarator { + span: DUMMY_SP, + name: var_name.into(), + init: None, + definite: Default::default(), + }) + .collect(); + + new.push(T::from_stmt(Stmt::Decl(Decl::Var(Box::new(VarDecl { + span: DUMMY_SP, + kind: VarDeclKind::Var, + declare: false, + decls: var_decls, + }))))); + + try_body.push(Stmt::Decl(e.decl)); + try_body.push(Stmt::Expr(ExprStmt { + span: DUMMY_SP, + expr: Expr::from_exprs( + orig_var_names + .iter() + .zip(var_names.iter()) + .map(|(orig, var_name)| { + AssignExpr { + span: DUMMY_SP, + op: op!("="), + left: var_name.clone().into(), + right: orig.clone().into(), + } + .into() + }) + .collect(), + ), + })); + let specifiers = orig_var_names + .iter() + .zip(var_names.iter()) + .map(|(orig, var)| { + ExportSpecifier::Named(ExportNamedSpecifier { + span: DUMMY_SP, + orig: ModuleExportName::Ident(var.clone()), + exported: Some(ModuleExportName::Ident(orig.clone())), + is_type_only: false, + }) + }) + .collect(); + + extras.push( + T::try_from_module_decl(ModuleDecl::ExportNamed(NamedExport { + span: DUMMY_SP, + specifiers, + src: None, + type_only: false, + with: None, + })) + .unwrap(), + ); + } + _ => { + new.push( + T::try_from_module_decl(ModuleDecl::ExportDecl(e)).unwrap(), + ); + } + }; + } + Ok(stmt) => new.push(T::try_from_module_decl(stmt).unwrap()), Err(stmt) => new.push(stmt), }, @@ -248,6 +376,7 @@ impl ExplicitResourceManagement { }; new.push(T::from_stmt(Stmt::Try(Box::new(try_stmt)))); + new.extend(extras); *stmts = new; } diff --git a/crates/swc_ecma_transforms_proposal/tests/decorators.rs b/crates/swc_ecma_transforms_proposal/tests/decorators.rs index 2fd93980d6f2..7ff5adecaddc 100644 --- a/crates/swc_ecma_transforms_proposal/tests/decorators.rs +++ b/crates/swc_ecma_transforms_proposal/tests/decorators.rs @@ -19,6 +19,7 @@ fn syntax_default() -> Syntax { auto_accessors: true, allow_super_outside_method: true, decorators_before_export: true, + explicit_resource_management: true, ..Default::default() }) } diff --git a/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/input.js b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/input.js new file mode 100644 index 000000000000..4714506c2b8f --- /dev/null +++ b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/input.js @@ -0,0 +1,10 @@ +// main.ts +export class Disposable { + [Symbol.dispose]() { + console.log('dispose') + } +} + +using _disposable = new Disposable() + +console.log('ok') \ No newline at end of file diff --git a/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/options.json b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/options.json new file mode 100644 index 000000000000..4ad37b6e477c --- /dev/null +++ b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/options.json @@ -0,0 +1,3 @@ +{ + "plugins": [["proposal-decorators", { "version": "2022-03" }]] +} diff --git a/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/output.js b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/output.js new file mode 100644 index 000000000000..d1d0b1de8532 --- /dev/null +++ b/crates/swc_ecma_transforms_proposal/tests/decorators/issue-8629/output.js @@ -0,0 +1,10 @@ +// main.ts +var _computedKey; +_computedKey = Symbol.dispose; +export class Disposable { + [_computedKey]() { + console.log('dispose'); + } +} +using _disposable = new Disposable() +console.log('ok'); diff --git a/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/input.js b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/input.js new file mode 100644 index 000000000000..4714506c2b8f --- /dev/null +++ b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/input.js @@ -0,0 +1,10 @@ +// main.ts +export class Disposable { + [Symbol.dispose]() { + console.log('dispose') + } +} + +using _disposable = new Disposable() + +console.log('ok') \ No newline at end of file diff --git a/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/output.js b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/output.js new file mode 100644 index 000000000000..71f3493adabe --- /dev/null +++ b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-sync/issue-8629/output.js @@ -0,0 +1,19 @@ +// main.ts +var _Disposable; +try { + var _stack = []; + class Disposable { + [Symbol.dispose]() { + console.log('dispose'); + } + } + _Disposable = Disposable; + var _disposable = _using(_stack, new Disposable()); + console.log('ok'); +} catch (_) { + var _error = _; + var _hasError = true; +} finally{ + _dispose(_stack, _error, _hasError); +} +export { _Disposable as Disposable }; diff --git a/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-top-level/hoisting/output.mjs b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-top-level/hoisting/output.mjs index d37423ec0574..c4b66aaf50b7 100644 --- a/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-top-level/hoisting/output.mjs +++ b/crates/swc_ecma_transforms_proposal/tests/explicit-resource-management/transform-top-level/hoisting/output.mjs @@ -9,19 +9,25 @@ function h() { b; A; } -export function g() { - c; -} +var _g; export { f }; -export let { b } = {}; -export class B { -} +var _b; +var _B; try { var _stack = []; + function g() { + c; + } + _g = g; doSomething(); + let { b } = {}; + _b = b; var c = 2; class A { } + class B { + } + _B = B; var x = _using(_stack, null); } catch (_) { var _error = _; @@ -29,3 +35,6 @@ try { } finally{ _dispose(_stack, _error, _hasError); } +export { _g as g }; +export { _b as b }; +export { _B as B }; From 6e672aaf9aac66c139e8a7a7325f227c33337c61 Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Wed, 13 Mar 2024 03:08:09 +0000 Subject: [PATCH 09/13] chore: Bump crates --- CHANGELOG.md | 6 +++--- Cargo.lock | 20 +++++++++---------- crates/binding_macros/Cargo.toml | 2 +- crates/swc/Cargo.toml | 8 ++++---- crates/swc_bundler/Cargo.toml | 8 ++++---- crates/swc_core/Cargo.toml | 14 ++++++------- crates/swc_ecma_compat_bugfixes/Cargo.toml | 4 ++-- crates/swc_ecma_compat_es2015/Cargo.toml | 2 +- crates/swc_ecma_minifier/Cargo.toml | 2 +- crates/swc_ecma_preset_env/Cargo.toml | 4 ++-- crates/swc_ecma_transforms/Cargo.toml | 14 ++++++------- crates/swc_ecma_transforms_compat/Cargo.toml | 6 +++--- crates/swc_ecma_transforms_module/Cargo.toml | 4 ++-- .../Cargo.toml | 12 +++++------ .../swc_ecma_transforms_proposal/Cargo.toml | 4 ++-- crates/swc_ecma_transforms_react/Cargo.toml | 6 +++--- .../swc_ecma_transforms_typescript/Cargo.toml | 8 ++++---- crates/swc_ecmascript/Cargo.toml | 4 ++-- crates/swc_estree_compat/Cargo.toml | 2 +- crates/swc_node_bundler/Cargo.toml | 2 +- 20 files changed, 66 insertions(+), 66 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b70e1fc12aa..1b4c82c3b67c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ - **(es/minifier)** Make `Finalizer` handle `hoisted_props` correctly ([#8738](https://github.com/swc-project/swc/issues/8738)) ([95761b7](https://github.com/swc-project/swc/commit/95761b76bf09a4d2c09517b2bd7bf7b78ee2149f)) + +- **(es/proposal)** Fix var placement for using transform ([#8732](https://github.com/swc-project/swc/issues/8732)) ([633cd89](https://github.com/swc-project/swc/commit/633cd89bacef5f0efef20f1dfa709cff1ecba36f)) + ### Features @@ -1398,9 +1401,6 @@ -- **(es/codegen)** Add quotes to property names when `ascii_only` is `true` ([#7820](https://github.com/swc-project/swc/issues/7820)) ([04921f3](https://github.com/swc-project/swc/commit/04921f301afbc2dc74bed4cb24e7656b60e54327)) - - - **(es/compat)** Remove wrong logic for object patterns in `object_rest` ([#7788](https://github.com/swc-project/swc/issues/7788)) ([3766a7c](https://github.com/swc-project/swc/commit/3766a7c776b63e159be3f11f5f931c5e5f968cdb)) diff --git a/Cargo.lock b/Cargo.lock index e25ba0d5f856..68a882bf88a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4187,7 +4187,7 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.4.14" +version = "0.4.15" dependencies = [ "swc_atoms", "swc_common", @@ -4215,7 +4215,7 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.4.14" +version = "0.4.15" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -4498,7 +4498,7 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.206.14" +version = "0.206.15" dependencies = [ "anyhow", "criterion", @@ -4563,7 +4563,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.229.14" +version = "0.229.15" dependencies = [ "pretty_assertions", "sourcemap", @@ -4627,7 +4627,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.163.14" +version = "0.163.15" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -4676,7 +4676,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.180.14" +version = "0.180.15" dependencies = [ "Inflector", "anyhow", @@ -4705,7 +4705,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.198.14" +version = "0.198.15" dependencies = [ "dashmap", "indexmap 2.1.0", @@ -4735,7 +4735,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.171.14" +version = "0.171.15" dependencies = [ "either", "rustc-hash", @@ -4759,7 +4759,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.183.14" +version = "0.183.15" dependencies = [ "base64", "dashmap", @@ -4811,7 +4811,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.188.14" +version = "0.188.15" dependencies = [ "criterion", "ryu-js", diff --git a/crates/binding_macros/Cargo.toml b/crates/binding_macros/Cargo.toml index f7d59cae1141..ad3000692319 100644 --- a/crates/binding_macros/Cargo.toml +++ b/crates/binding_macros/Cargo.toml @@ -36,7 +36,7 @@ binding_wasm = [ swc = { optional = true, version = "0.273.19", path = "../swc" } swc_common = { optional = true, version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { optional = true, version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_transforms = { optional = true, version = "0.229.14", path = "../swc_ecma_transforms" } +swc_ecma_transforms = { optional = true, version = "0.229.15", path = "../swc_ecma_transforms" } swc_ecma_visit = { optional = true, version = "0.98.6", path = "../swc_ecma_visit" } # Optional deps for the wasm binding macro diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 1454e92a93c8..123729415eec 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -87,8 +87,8 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = ] } swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_preset_env = { version = "0.206.14", path = "../swc_ecma_preset_env" } -swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", features = [ +swc_ecma_preset_env = { version = "0.206.15", path = "../swc_ecma_preset_env" } +swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms", features = [ "compat", "module", "optimization", @@ -97,8 +97,8 @@ swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", f "typescript", ] } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_optimization = { version = "0.198.15", path = "../swc_ecma_transforms_optimization" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_error_reporters = { version = "0.17.18", path = "../swc_error_reporters" } diff --git a/crates/swc_bundler/Cargo.toml b/crates/swc_bundler/Cargo.toml index b4540bbb0fba..b58d79214b0c 100644 --- a/crates/swc_bundler/Cargo.toml +++ b/crates/swc_bundler/Cargo.toml @@ -44,7 +44,7 @@ swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_c swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } +swc_ecma_transforms_optimization = { version = "0.198.15", path = "../swc_ecma_transforms_optimization" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_fast_graph = { version = "0.21.19", path = "../swc_fast_graph/" } @@ -66,8 +66,8 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", features = [ "concurrent", ] } -swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal" } -swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react" } -swc_ecma_transforms_typescript = { version = "0.188.14", path = "../swc_ecma_transforms_typescript" } +swc_ecma_transforms_proposal = { version = "0.171.15", path = "../swc_ecma_transforms_proposal" } +swc_ecma_transforms_react = { version = "0.183.15", path = "../swc_ecma_transforms_react" } +swc_ecma_transforms_typescript = { version = "0.188.15", path = "../swc_ecma_transforms_typescript" } swc_malloc = { version = "0.5.10", path = "../swc_malloc" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 0728266f8c9a..933bf1cba7fb 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -348,16 +348,16 @@ swc_ecma_lints = { optional = true, version = "0.92.16", path swc_ecma_loader = { optional = true, version = "0.45.21", path = "../swc_ecma_loader" } swc_ecma_minifier = { optional = true, version = "0.192.16", path = "../swc_ecma_minifier" } swc_ecma_parser = { optional = true, version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_preset_env = { optional = true, version = "0.206.14", path = "../swc_ecma_preset_env" } +swc_ecma_preset_env = { optional = true, version = "0.206.15", path = "../swc_ecma_preset_env" } swc_ecma_quote_macros = { optional = true, version = "0.54.11", path = "../swc_ecma_quote_macros" } swc_ecma_transforms_base = { optional = true, version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_compat = { optional = true, version = "0.163.14", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_module = { optional = true, version = "0.180.14", path = "../swc_ecma_transforms_module" } -swc_ecma_transforms_optimization = { optional = true, version = "0.198.14", path = "../swc_ecma_transforms_optimization" } -swc_ecma_transforms_proposal = { optional = true, version = "0.171.14", path = "../swc_ecma_transforms_proposal" } -swc_ecma_transforms_react = { optional = true, version = "0.183.14", path = "../swc_ecma_transforms_react" } +swc_ecma_transforms_compat = { optional = true, version = "0.163.15", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_module = { optional = true, version = "0.180.15", path = "../swc_ecma_transforms_module" } +swc_ecma_transforms_optimization = { optional = true, version = "0.198.15", path = "../swc_ecma_transforms_optimization" } +swc_ecma_transforms_proposal = { optional = true, version = "0.171.15", path = "../swc_ecma_transforms_proposal" } +swc_ecma_transforms_react = { optional = true, version = "0.183.15", path = "../swc_ecma_transforms_react" } swc_ecma_transforms_testing = { optional = true, version = "0.140.14", path = "../swc_ecma_transforms_testing" } -swc_ecma_transforms_typescript = { optional = true, version = "0.188.14", path = "../swc_ecma_transforms_typescript" } +swc_ecma_transforms_typescript = { optional = true, version = "0.188.15", path = "../swc_ecma_transforms_typescript" } swc_ecma_usage_analyzer = { optional = true, version = "0.23.11", path = "../swc_ecma_usage_analyzer" } swc_ecma_utils = { optional = true, version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { optional = true, version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_compat_bugfixes/Cargo.toml b/crates/swc_ecma_compat_bugfixes/Cargo.toml index ba9587027ea1..243786fee260 100644 --- a/crates/swc_ecma_compat_bugfixes/Cargo.toml +++ b/crates/swc_ecma_compat_bugfixes/Cargo.toml @@ -7,14 +7,14 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_compat_bugfixes" repository = "https://github.com/swc-project/swc.git" -version = "0.4.14" +version = "0.4.15" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_compat_es2015 = { version = "0.4.14", path = "../swc_ecma_compat_es2015" } +swc_ecma_compat_es2015 = { version = "0.4.15", path = "../swc_ecma_compat_es2015" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_compat_es2015/Cargo.toml b/crates/swc_ecma_compat_es2015/Cargo.toml index 3b8c945e6b87..3bb2555d6b97 100644 --- a/crates/swc_ecma_compat_es2015/Cargo.toml +++ b/crates/swc_ecma_compat_es2015/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_compat_es2015" repository = "https://github.com/swc-project/swc.git" -version = "0.4.14" +version = "0.4.15" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/swc_ecma_minifier/Cargo.toml b/crates/swc_ecma_minifier/Cargo.toml index d3828a41b3de..588c1cb07a60 100644 --- a/crates/swc_ecma_minifier/Cargo.toml +++ b/crates/swc_ecma_minifier/Cargo.toml @@ -61,7 +61,7 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast", features = [ swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization" } +swc_ecma_transforms_optimization = { version = "0.198.15", path = "../swc_ecma_transforms_optimization" } swc_ecma_usage_analyzer = { version = "0.23.11", path = "../swc_ecma_usage_analyzer" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_preset_env/Cargo.toml b/crates/swc_ecma_preset_env/Cargo.toml index 6eaf08d07177..61d9eb8dde7a 100644 --- a/crates/swc_ecma_preset_env/Cargo.toml +++ b/crates/swc_ecma_preset_env/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" include = ["Cargo.toml", "src/**/*.rs", "src/**/*.json", "data/**/*.json"] license = "Apache-2.0" name = "swc_ecma_preset_env" -version = "0.206.14" +version = "0.206.15" [lib] bench = false @@ -32,7 +32,7 @@ string_enum = { version = "0.4.2", path = "../string_enum" } swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", features = [ +swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms", features = [ "compat", "proposal", ] } diff --git a/crates/swc_ecma_transforms/Cargo.toml b/crates/swc_ecma_transforms/Cargo.toml index 18a629123c89..0303d407e19e 100644 --- a/crates/swc_ecma_transforms/Cargo.toml +++ b/crates/swc_ecma_transforms/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms" repository = "https://github.com/swc-project/swc.git" -version = "0.229.14" +version = "0.229.15" [package.metadata.docs.rs] all-features = true @@ -35,12 +35,12 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat", optional = true } -swc_ecma_transforms_module = { version = "0.180.14", path = "../swc_ecma_transforms_module", optional = true } -swc_ecma_transforms_optimization = { version = "0.198.14", path = "../swc_ecma_transforms_optimization", optional = true } -swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal", optional = true } -swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react", optional = true } -swc_ecma_transforms_typescript = { version = "0.188.14", path = "../swc_ecma_transforms_typescript", optional = true } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat", optional = true } +swc_ecma_transforms_module = { version = "0.180.15", path = "../swc_ecma_transforms_module", optional = true } +swc_ecma_transforms_optimization = { version = "0.198.15", path = "../swc_ecma_transforms_optimization", optional = true } +swc_ecma_transforms_proposal = { version = "0.171.15", path = "../swc_ecma_transforms_proposal", optional = true } +swc_ecma_transforms_react = { version = "0.183.15", path = "../swc_ecma_transforms_react", optional = true } +swc_ecma_transforms_typescript = { version = "0.188.15", path = "../swc_ecma_transforms_typescript", optional = true } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_compat/Cargo.toml b/crates/swc_ecma_transforms_compat/Cargo.toml index fbacdc81f0dc..4672dfcfb8bc 100644 --- a/crates/swc_ecma_transforms_compat/Cargo.toml +++ b/crates/swc_ecma_transforms_compat/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_compat" repository = "https://github.com/swc-project/swc.git" -version = "0.163.14" +version = "0.163.15" [lib] bench = false @@ -33,9 +33,9 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_config = { version = "0.1.11", path = "../swc_config" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } -swc_ecma_compat_bugfixes = { version = "0.4.14", path = "../swc_ecma_compat_bugfixes" } +swc_ecma_compat_bugfixes = { version = "0.4.15", path = "../swc_ecma_compat_bugfixes" } swc_ecma_compat_common = { version = "0.4.11", path = "../swc_ecma_compat_common" } -swc_ecma_compat_es2015 = { version = "0.4.14", path = "../swc_ecma_compat_es2015" } +swc_ecma_compat_es2015 = { version = "0.4.15", path = "../swc_ecma_compat_es2015" } swc_ecma_compat_es2016 = { version = "0.4.14", path = "../swc_ecma_compat_es2016" } swc_ecma_compat_es2017 = { version = "0.4.14", path = "../swc_ecma_compat_es2017" } swc_ecma_compat_es2018 = { version = "0.4.14", path = "../swc_ecma_compat_es2018" } diff --git a/crates/swc_ecma_transforms_module/Cargo.toml b/crates/swc_ecma_transforms_module/Cargo.toml index baab17513cfc..0822d2a9c6a9 100644 --- a/crates/swc_ecma_transforms_module/Cargo.toml +++ b/crates/swc_ecma_transforms_module/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_module" repository = "https://github.com/swc-project/swc.git" -version = "0.180.14" +version = "0.180.15" [lib] bench = false @@ -44,6 +44,6 @@ swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader", features = "node", "tsc", ] } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_testing = { version = "0.140.14", path = "../swc_ecma_transforms_testing" } testing = { version = "0.35.20", path = "../testing/" } diff --git a/crates/swc_ecma_transforms_optimization/Cargo.toml b/crates/swc_ecma_transforms_optimization/Cargo.toml index ecdc133ba570..594d880436e1 100644 --- a/crates/swc_ecma_transforms_optimization/Cargo.toml +++ b/crates/swc_ecma_transforms_optimization/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_optimization" repository = "https://github.com/swc-project/swc.git" -version = "0.198.14" +version = "0.198.15" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] @@ -42,10 +42,10 @@ swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_fast_graph = { version = "0.21.19", path = "../swc_fast_graph" } [dev-dependencies] -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_module = { version = "0.180.14", path = "../swc_ecma_transforms_module" } -swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal" } -swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_module = { version = "0.180.15", path = "../swc_ecma_transforms_module" } +swc_ecma_transforms_proposal = { version = "0.171.15", path = "../swc_ecma_transforms_proposal" } +swc_ecma_transforms_react = { version = "0.183.15", path = "../swc_ecma_transforms_react" } swc_ecma_transforms_testing = { version = "0.140.14", path = "../swc_ecma_transforms_testing" } -swc_ecma_transforms_typescript = { version = "0.188.14", path = "../swc_ecma_transforms_typescript" } +swc_ecma_transforms_typescript = { version = "0.188.15", path = "../swc_ecma_transforms_typescript" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_ecma_transforms_proposal/Cargo.toml b/crates/swc_ecma_transforms_proposal/Cargo.toml index 85c3e2c5b137..c74d5ed94c39 100644 --- a/crates/swc_ecma_transforms_proposal/Cargo.toml +++ b/crates/swc_ecma_transforms_proposal/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_proposal" repository = "https://github.com/swc-project/swc.git" -version = "0.171.14" +version = "0.171.15" [lib] bench = false @@ -36,6 +36,6 @@ swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } serde_json = "1.0.66" swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_testing = { version = "0.140.14", path = "../swc_ecma_transforms_testing" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_ecma_transforms_react/Cargo.toml b/crates/swc_ecma_transforms_react/Cargo.toml index 70489a861710..85d495cb8eda 100644 --- a/crates/swc_ecma_transforms_react/Cargo.toml +++ b/crates/swc_ecma_transforms_react/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_react" repository = "https://github.com/swc-project/swc.git" -version = "0.183.14" +version = "0.183.15" [lib] bench = false @@ -39,7 +39,7 @@ swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } [dev-dependencies] swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen/" } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat/" } -swc_ecma_transforms_module = { version = "0.180.14", path = "../swc_ecma_transforms_module" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat/" } +swc_ecma_transforms_module = { version = "0.180.15", path = "../swc_ecma_transforms_module" } swc_ecma_transforms_testing = { version = "0.140.14", path = "../swc_ecma_transforms_testing" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_ecma_transforms_typescript/Cargo.toml b/crates/swc_ecma_transforms_typescript/Cargo.toml index 0511e46798f5..45f0d2f312a4 100644 --- a/crates/swc_ecma_transforms_typescript/Cargo.toml +++ b/crates/swc_ecma_transforms_typescript/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_ecma_transforms_typescript" repository = "https://github.com/swc-project/swc.git" -version = "0.188.14" +version = "0.188.15" [lib] bench = false @@ -20,7 +20,7 @@ swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_common = { version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms_base = { version = "0.137.14", path = "../swc_ecma_transforms_base" } -swc_ecma_transforms_react = { version = "0.183.14", path = "../swc_ecma_transforms_react" } +swc_ecma_transforms_react = { version = "0.183.15", path = "../swc_ecma_transforms_react" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } @@ -29,8 +29,8 @@ criterion = "0.5" swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_transforms_compat = { version = "0.163.14", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_proposal = { version = "0.171.14", path = "../swc_ecma_transforms_proposal" } +swc_ecma_transforms_compat = { version = "0.163.15", path = "../swc_ecma_transforms_compat" } +swc_ecma_transforms_proposal = { version = "0.171.15", path = "../swc_ecma_transforms_proposal" } swc_ecma_transforms_testing = { version = "0.140.14", path = "../swc_ecma_transforms_testing" } testing = { version = "0.35.20", path = "../testing" } diff --git a/crates/swc_ecmascript/Cargo.toml b/crates/swc_ecmascript/Cargo.toml index b3fcb7ff6ec6..822dfca913da 100644 --- a/crates/swc_ecmascript/Cargo.toml +++ b/crates/swc_ecmascript/Cargo.toml @@ -42,9 +42,9 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen", optional = true } swc_ecma_minifier = { version = "0.192.16", path = "../swc_ecma_minifier", optional = true } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser", optional = true, default-features = false } -swc_ecma_preset_env = { version = "0.206.14", path = "../swc_ecma_preset_env", optional = true } +swc_ecma_preset_env = { version = "0.206.15", path = "../swc_ecma_preset_env", optional = true } swc_ecma_quote = { version = "0.59.11", path = "../swc_ecma_quote", optional = true } -swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms", optional = true } +swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms", optional = true } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils", optional = true } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit", optional = true } diff --git a/crates/swc_estree_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml index 9d7b8854a501..cade8465ea10 100644 --- a/crates/swc_estree_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -43,7 +43,7 @@ pretty_assertions = "1.3" swc = { version = "0.273.19", path = "../swc" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms/" } +swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms/" } testing = { version = "0.35.20", path = "../testing" } walkdir = "2" diff --git a/crates/swc_node_bundler/Cargo.toml b/crates/swc_node_bundler/Cargo.toml index 223caa28573c..b090ae53050c 100644 --- a/crates/swc_node_bundler/Cargo.toml +++ b/crates/swc_node_bundler/Cargo.toml @@ -41,7 +41,7 @@ swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "0.148.10", path = "../swc_ecma_codegen" } swc_ecma_loader = { version = "0.45.21", path = "../swc_ecma_loader" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } -swc_ecma_transforms = { version = "0.229.14", path = "../swc_ecma_transforms" } +swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms" } swc_ecma_utils = { version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "0.98.6", path = "../swc_ecma_visit" } swc_malloc = { version = "0.5.10", path = "../swc_malloc" } From 583958a112fa761cff7cc5763c9e0ee796b3bddf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 13 Mar 2024 15:03:34 +0900 Subject: [PATCH 10/13] chore: Publish `1.4.7` with `swc_core` `v0.90.20` --- bindings/Cargo.lock | 74 +++++++++---------- bindings/binding_core_node/Cargo.toml | 2 +- bindings/binding_core_wasm/Cargo.toml | 4 +- bindings/binding_minifier_node/Cargo.toml | 2 +- bindings/binding_minifier_wasm/Cargo.toml | 4 +- bindings/swc_cli/Cargo.toml | 2 +- package.json | 2 +- packages/minifier/package.json | 2 +- .../scripts/npm/darwin-arm64/package.json | 2 +- .../scripts/npm/darwin-x64/package.json | 2 +- .../npm/linux-arm-gnueabihf/package.json | 2 +- .../scripts/npm/linux-arm64-gnu/package.json | 2 +- .../scripts/npm/linux-arm64-musl/package.json | 2 +- .../scripts/npm/linux-x64-gnu/package.json | 2 +- .../scripts/npm/linux-x64-musl/package.json | 2 +- .../scripts/npm/win32-arm64-msvc/package.json | 2 +- .../scripts/npm/win32-ia32-msvc/package.json | 2 +- .../scripts/npm/win32-x64-msvc/package.json | 2 +- 18 files changed, 56 insertions(+), 56 deletions(-) diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index cc7bd48cd2a3..e70a0bcf8354 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -223,7 +223,7 @@ dependencies = [ [[package]] name = "binding_core_wasm" -version = "1.4.7-nightly-20240312.1" +version = "1.4.7" dependencies = [ "anyhow", "getrandom", @@ -236,9 +236,9 @@ dependencies = [ [[package]] name = "binding_macros" -version = "0.64.18" +version = "0.64.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd296ea88689d27d3c1e603c54c208c7fe91875b111ebf1ea0cf1ba59ae3787e" +checksum = "9573e61dc4aef6867b9a8dd1f3b2d93a23a93f421fd44a7abd26f1615de98bb8" dependencies = [ "anyhow", "console_error_panic_hook", @@ -283,7 +283,7 @@ dependencies = [ [[package]] name = "binding_minifier_wasm" -version = "1.4.7-nightly-20240312.1" +version = "1.4.7" dependencies = [ "anyhow", "getrandom", @@ -2926,9 +2926,9 @@ dependencies = [ [[package]] name = "swc" -version = "0.273.18" +version = "0.273.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61371c0375d66cbbdb601513f6d2f0713e6fe984deb549ac80a7861fc3c22b2" +checksum = "6da05680a4a6db57fd1456f3412661a830bec749bd9973566618c9bb7541f9e6" dependencies = [ "anyhow", "base64", @@ -2993,9 +2993,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "0.225.14" +version = "0.225.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0061b48aeff696bf8f1623d843a48dbec83451496dbdaf260f8613220e19e849" +checksum = "8be45336922aa85774b351ea6a0a1991027113ee26a092f97f003fdc76da510f" dependencies = [ "anyhow", "crc", @@ -3039,7 +3039,7 @@ dependencies = [ [[package]] name = "swc_cli" -version = "0.91.198" +version = "0.91.199" dependencies = [ "anyhow", "swc_cli_impl", @@ -3102,9 +3102,9 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "0.7.15" +version = "0.7.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b44065d50b699d2d8108edaa9f134e1dc411cd379e3e46e29898e14dcd266d0d" +checksum = "0460c65a4952e0792a1b76b99a2a974d7e4185188cb1b67d34919ec6d6b75ea7" dependencies = [ "anyhow", "base64", @@ -3154,9 +3154,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.90.19" +version = "0.90.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8651aaebeb5a5c2b29af32cef6eac55861d0e475cdb76a6939c81786de0fce30" +checksum = "56fbc5b17538a850a40e5cdbd0f1e4dfbdd0dc1f20a47262e790b2454ef4ebf0" dependencies = [ "binding_macros", "swc", @@ -3232,9 +3232,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fac3f77e07132056bdf7336e6930fdc4365c394466f97c992f29642c3e55793e" +checksum = "c581b4f71587ea0deb86e132b4eb641b7e6a08ffb9fb62cbbae5719b91d0a81e" dependencies = [ "swc_atoms", "swc_common", @@ -3262,9 +3262,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f6705c0d640f42dbbdb43f9da4cd83269bcc19b888cb31433d401a2e68a9d6c" +checksum = "ac027a2e1658c57e16ce4136ae7ebaddae418a6d1885c3234f3efc82051e2648" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3482,9 +3482,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "0.192.15" +version = "0.192.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d138fa420d6939ca43b87c8cd9bfd5c9e9408b9e8eb80ccd10cf3834aac719" +checksum = "0e2b816091a22b20c96a9870c070bc4a04a3da6b10f649aaf8a7e30be766a545" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3538,9 +3538,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.206.14" +version = "0.206.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beb4e0016f42208333dc7edafd6241fb68a1d740d860b6f627a3e797c4870701" +checksum = "7925890dc81da4d52e53cc1fb05802498f839802cf342748a8779dd1e61f1c6e" dependencies = [ "anyhow", "dashmap", @@ -3563,9 +3563,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.229.14" +version = "0.229.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "047f84ab4c4b7a08a7894e48019d3f0f32a71eadc123186fefba3ea36d5c23af" +checksum = "7985caa4b327c9848464287dcb5d5ccaf78a57cf714b0deae86a9a8d1c057f63" dependencies = [ "swc_atoms", "swc_common", @@ -3621,9 +3621,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.163.14" +version = "0.163.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e26dfa2fe6a3273ec341de0090f556d037604eebf5f38e07c5ecdcaf2a3435e9" +checksum = "69a27fa74aef5b4832221ac050ba5479667d6e87d89a4eff8dc62d4ee732885a" dependencies = [ "arrayvec", "indexmap 2.1.0", @@ -3670,9 +3670,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "0.180.14" +version = "0.180.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2e25fb5e0627bc17e0f6fcd5c9fb903d98143c2ff0b30906ff5b52abae5930d" +checksum = "d8235648ce61a997139ee4f06b251c57798b6ea2fed826009321ce81498d8c55" dependencies = [ "Inflector", "anyhow", @@ -3697,9 +3697,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "0.198.14" +version = "0.198.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51052ccc02161109066c40ccbefb96f81d959ef47b2244059ffc24f6f7f294d9" +checksum = "5c7c0664ddbb96f6ba9704fb11b7e21aa03a46ec7d3097500531782e32d8b16d" dependencies = [ "dashmap", "indexmap 2.1.0", @@ -3722,9 +3722,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.171.14" +version = "0.171.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a4e8f7b02320dc446d38fc797aa764b9b574839106327295a177ee38ad37da7" +checksum = "eb39c4788ec628e075617a332ee1a8360ccff4f39d014c4aad86ea2686661b38" dependencies = [ "either", "rustc-hash", @@ -3742,9 +3742,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.183.14" +version = "0.183.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d33e1f84d75e7c1b66433dfbfe9866855a896b9d18c33199ead961d3606a39" +checksum = "c11b4742240a61ad757f5caf11ce4823487c963a204d491e40e26019daee9414" dependencies = [ "base64", "dashmap", @@ -3767,9 +3767,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.188.14" +version = "0.188.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a591d07a82edaf90b35c0d6c98b60cec1ff1f239035707a19276cebf856c569a" +checksum = "e0b6571b0b2d64267571e3ca7e3e72fe65fc3f0dc95b32e7a92458063f44c2fa" dependencies = [ "ryu-js", "serde", @@ -3905,9 +3905,9 @@ dependencies = [ [[package]] name = "swc_node_bundler" -version = "0.62.18" +version = "0.62.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9191d8223e7f2acdca7a48bb5603a565cba3a7e40a37099e6932bcf59638dc19" +checksum = "af090af1cae92f0841197c919d4212f4a38d3d97f2c3ec8edee44878fee34f44" dependencies = [ "anyhow", "dashmap", diff --git a/bindings/binding_core_node/Cargo.toml b/bindings/binding_core_node/Cargo.toml index c5c6102a413e..408ca148c9b5 100644 --- a/bindings/binding_core_node/Cargo.toml +++ b/bindings/binding_core_node/Cargo.toml @@ -51,7 +51,7 @@ tracing-chrome = "0.5.0" tracing-futures = "0.2.5" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } -swc_core = { version = "0.90.19", features = [ +swc_core = { version = "0.90.20", features = [ "allocator_node", "ecma_ast", "ecma_codegen", diff --git a/bindings/binding_core_wasm/Cargo.toml b/bindings/binding_core_wasm/Cargo.toml index 87e8c359d24b..12bb0c9c0f74 100644 --- a/bindings/binding_core_wasm/Cargo.toml +++ b/bindings/binding_core_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "binding_core_wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.4.7-nightly-20240312.1" +version = "1.4.7" [lib] bench = false @@ -35,7 +35,7 @@ anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" -swc_core = { version = "0.90.19", features = [ +swc_core = { version = "0.90.20", features = [ "ecma_ast_serde", "ecma_codegen", "binding_macro_wasm", diff --git a/bindings/binding_minifier_node/Cargo.toml b/bindings/binding_minifier_node/Cargo.toml index 7006f5da2d88..cd1676e896f5 100644 --- a/bindings/binding_minifier_node/Cargo.toml +++ b/bindings/binding_minifier_node/Cargo.toml @@ -37,7 +37,7 @@ tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } swc_compiler_base = { version = "0.7.15", features = ["node"] } swc_config = "0.1.11" -swc_core = { version = "0.90.19", features = [ +swc_core = { version = "0.90.20", features = [ "allocator_node", "common_concurrent", "common_sourcemap", diff --git a/bindings/binding_minifier_wasm/Cargo.toml b/bindings/binding_minifier_wasm/Cargo.toml index 6dfd73757bf0..eb6dfbea7deb 100644 --- a/bindings/binding_minifier_wasm/Cargo.toml +++ b/bindings/binding_minifier_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = "Apache-2.0" name = "binding_minifier_wasm" publish = false repository = "https://github.com/swc-project/swc.git" -version = "1.4.7-nightly-20240312.1" +version = "1.4.7" [lib] bench = false @@ -35,7 +35,7 @@ anyhow = "1.0.66" getrandom = { version = "0.2.10", features = ["js"] } serde = { version = "1", features = ["derive"] } serde-wasm-bindgen = "0.4.5" -swc_core = { version = "0.90.19", features = [ +swc_core = { version = "0.90.20", features = [ "ecma_ast_serde", "ecma_codegen", "binding_macro_wasm", diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index a182279bb8ee..42d89a940cf6 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_cli" repository = "https://github.com/swc-project/swc.git" -version = "0.91.198" +version = "0.91.199" [[bin]] bench = false diff --git a/package.json b/package.json index 4fee618486c7..b94f974eb420 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@swc/core", - "version": "1.4.7-nightly-20240312.1", + "version": "1.4.7", "description": "Super-fast alternative for babel", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/packages/minifier/package.json b/packages/minifier/package.json index 856589b16c9b..2e1784e4bbb5 100644 --- a/packages/minifier/package.json +++ b/packages/minifier/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier", - "version": "1.4.7-nightly-20240312.1", + "version": "1.4.7", "description": "Super-fast alternative for terser", "homepage": "https://swc.rs", "main": "./index.js", diff --git a/packages/minifier/scripts/npm/darwin-arm64/package.json b/packages/minifier/scripts/npm/darwin-arm64/package.json index 56bf22b8694b..f0767426c69f 100644 --- a/packages/minifier/scripts/npm/darwin-arm64/package.json +++ b/packages/minifier/scripts/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-darwin-arm64", - "version": "1.4.6", + "version": "1.4.7", "os": [ "darwin" ], diff --git a/packages/minifier/scripts/npm/darwin-x64/package.json b/packages/minifier/scripts/npm/darwin-x64/package.json index 6ea5fdfb39fc..5dd04dc077d0 100644 --- a/packages/minifier/scripts/npm/darwin-x64/package.json +++ b/packages/minifier/scripts/npm/darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-darwin-x64", - "version": "1.4.6", + "version": "1.4.7", "os": [ "darwin" ], diff --git a/packages/minifier/scripts/npm/linux-arm-gnueabihf/package.json b/packages/minifier/scripts/npm/linux-arm-gnueabihf/package.json index bc94038cf269..d8124bb63c9b 100644 --- a/packages/minifier/scripts/npm/linux-arm-gnueabihf/package.json +++ b/packages/minifier/scripts/npm/linux-arm-gnueabihf/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-linux-arm-gnueabihf", - "version": "1.4.6", + "version": "1.4.7", "os": [ "linux" ], diff --git a/packages/minifier/scripts/npm/linux-arm64-gnu/package.json b/packages/minifier/scripts/npm/linux-arm64-gnu/package.json index 156c26fe085c..4dde20920ad5 100644 --- a/packages/minifier/scripts/npm/linux-arm64-gnu/package.json +++ b/packages/minifier/scripts/npm/linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-linux-arm64-gnu", - "version": "1.4.6", + "version": "1.4.7", "os": [ "linux" ], diff --git a/packages/minifier/scripts/npm/linux-arm64-musl/package.json b/packages/minifier/scripts/npm/linux-arm64-musl/package.json index bdebd2e6612a..ff0a43fb5f3e 100644 --- a/packages/minifier/scripts/npm/linux-arm64-musl/package.json +++ b/packages/minifier/scripts/npm/linux-arm64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-linux-arm64-musl", - "version": "1.4.6", + "version": "1.4.7", "os": [ "linux" ], diff --git a/packages/minifier/scripts/npm/linux-x64-gnu/package.json b/packages/minifier/scripts/npm/linux-x64-gnu/package.json index 87784508eea5..3d04e8da9b56 100644 --- a/packages/minifier/scripts/npm/linux-x64-gnu/package.json +++ b/packages/minifier/scripts/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-linux-x64-gnu", - "version": "1.4.6", + "version": "1.4.7", "os": [ "linux" ], diff --git a/packages/minifier/scripts/npm/linux-x64-musl/package.json b/packages/minifier/scripts/npm/linux-x64-musl/package.json index ed5827ecf227..1f126d8daed0 100644 --- a/packages/minifier/scripts/npm/linux-x64-musl/package.json +++ b/packages/minifier/scripts/npm/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-linux-x64-musl", - "version": "1.4.6", + "version": "1.4.7", "os": [ "linux" ], diff --git a/packages/minifier/scripts/npm/win32-arm64-msvc/package.json b/packages/minifier/scripts/npm/win32-arm64-msvc/package.json index 8b7cb75e49c1..41bc617bd7ef 100644 --- a/packages/minifier/scripts/npm/win32-arm64-msvc/package.json +++ b/packages/minifier/scripts/npm/win32-arm64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-win32-arm64-msvc", - "version": "1.4.6", + "version": "1.4.7", "os": [ "win32" ], diff --git a/packages/minifier/scripts/npm/win32-ia32-msvc/package.json b/packages/minifier/scripts/npm/win32-ia32-msvc/package.json index 46f0cc51f2ef..78eb38becd15 100644 --- a/packages/minifier/scripts/npm/win32-ia32-msvc/package.json +++ b/packages/minifier/scripts/npm/win32-ia32-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-win32-ia32-msvc", - "version": "1.4.6", + "version": "1.4.7", "os": [ "win32" ], diff --git a/packages/minifier/scripts/npm/win32-x64-msvc/package.json b/packages/minifier/scripts/npm/win32-x64-msvc/package.json index 2336754ab789..de31d3fdeca0 100644 --- a/packages/minifier/scripts/npm/win32-x64-msvc/package.json +++ b/packages/minifier/scripts/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@swc/minifier-win32-x64-msvc", - "version": "1.4.6", + "version": "1.4.7", "os": [ "win32" ], From 80449374c1fc78c5a045c9ca16dbf49e6d0a943e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B0=95=EB=8F=99=EC=9C=A4=20=28Donny=29?= Date: Wed, 13 Mar 2024 15:03:36 +0900 Subject: [PATCH 11/13] chore: Update changelog --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b4c82c3b67c..aaab2f31f22f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,5 @@ # Changelog -## [unreleased] +## [1.4.7] - 2024-03-13 ### Bug Fixes @@ -1401,9 +1401,6 @@ -- **(es/compat)** Remove wrong logic for object patterns in `object_rest` ([#7788](https://github.com/swc-project/swc/issues/7788)) ([3766a7c](https://github.com/swc-project/swc/commit/3766a7c776b63e159be3f11f5f931c5e5f968cdb)) - - - **(es/minifier)** Preserve `cooked` while compressing template literals ([#7773](https://github.com/swc-project/swc/issues/7773)) ([05990a9](https://github.com/swc-project/swc/commit/05990a98fd3f06a3c03bd1e795800acf22f16035)) From 9c1eb017fcd90bd21b43f1a988c7fc67639343c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Donny/=EA=B0=95=EB=8F=99=EC=9C=A4?= Date: Wed, 13 Mar 2024 16:43:50 +0900 Subject: [PATCH 12/13] chore(es): Allow using older `tokio` (#8740) **Description:** I made a mistake while working on https://github.com/swc-project/swc/pull/8711 --- crates/swc/Cargo.toml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 123729415eec..5498f4b67e78 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -107,10 +107,7 @@ swc_plugin_proxy = { version = "0.41.5", path = "../swc_plugin_proxy", optional swc_plugin_runner = { version = "0.106.11", path = "../swc_plugin_runner", optional = true, default-features = false } swc_timer = { version = "0.21.20", path = "../swc_timer" } swc_visit = { version = "0.5.10", path = "../swc_visit" } -tokio = { version = "1.36.0", optional = true, features = [ - "rt", - "rt-multi-thread", -] } +tokio = { version = "1", optional = true, features = ["rt", "rt-multi-thread"] } [dependencies.napi-derive] From 10f25067db325f05982d70760535abb9232fe7ce Mon Sep 17 00:00:00 2001 From: SWC Bot Date: Wed, 13 Mar 2024 07:45:30 +0000 Subject: [PATCH 13/13] chore: Bump crates --- CHANGELOG.md | 11 ++++++++--- Cargo.lock | 12 ++++++------ crates/binding_macros/Cargo.toml | 4 ++-- crates/swc/Cargo.toml | 2 +- crates/swc_cli_impl/Cargo.toml | 4 ++-- crates/swc_core/Cargo.toml | 8 ++++---- crates/swc_estree_compat/Cargo.toml | 4 ++-- crates/swc_node_bundler/Cargo.toml | 4 ++-- 8 files changed, 27 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aaab2f31f22f..e8c85ae1921d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,12 @@ # Changelog +## [unreleased] + +### Miscellaneous Tasks + + + +- **(es)** Allow using older `tokio` ([#8740](https://github.com/swc-project/swc/issues/8740)) ([9c1eb01](https://github.com/swc-project/swc/commit/9c1eb017fcd90bd21b43f1a988c7fc67639343c1)) + ## [1.4.7] - 2024-03-13 ### Bug Fixes @@ -1401,9 +1409,6 @@ -- **(es/minifier)** Preserve `cooked` while compressing template literals ([#7773](https://github.com/swc-project/swc/issues/7773)) ([05990a9](https://github.com/swc-project/swc/commit/05990a98fd3f06a3c03bd1e795800acf22f16035)) - - - **(es/minifier)** Abort seq inliner if var is not fn_local or reassigned ([#7804](https://github.com/swc-project/swc/issues/7804)) ([f8ca366](https://github.com/swc-project/swc/commit/f8ca366cc179d2d83d35148c3600b8faa2e7f801)) diff --git a/Cargo.lock b/Cargo.lock index 68a882bf88a1..54d9c75b31a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "binding_macros" -version = "0.64.19" +version = "0.64.20" dependencies = [ "anyhow", "console_error_panic_hook", @@ -3667,7 +3667,7 @@ dependencies = [ [[package]] name = "swc" -version = "0.273.19" +version = "0.273.20" dependencies = [ "ansi_term", "anyhow", @@ -3792,7 +3792,7 @@ dependencies = [ [[package]] name = "swc_cli_impl" -version = "0.8.19" +version = "0.8.20" dependencies = [ "anyhow", "assert_cmd", @@ -3897,7 +3897,7 @@ dependencies = [ [[package]] name = "swc_core" -version = "0.90.20" +version = "0.90.21" dependencies = [ "anyhow", "binding_macros", @@ -4926,7 +4926,7 @@ dependencies = [ [[package]] name = "swc_estree_compat" -version = "0.198.18" +version = "0.198.19" dependencies = [ "ahash 0.8.8", "anyhow", @@ -5109,7 +5109,7 @@ dependencies = [ [[package]] name = "swc_node_bundler" -version = "0.62.19" +version = "0.62.20" dependencies = [ "anyhow", "dashmap", diff --git a/crates/binding_macros/Cargo.toml b/crates/binding_macros/Cargo.toml index ad3000692319..e14d61268b17 100644 --- a/crates/binding_macros/Cargo.toml +++ b/crates/binding_macros/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" license = "Apache-2.0" name = "binding_macros" repository = "https://github.com/swc-project/swc.git" -version = "0.64.19" +version = "0.64.20" [lib] bench = false @@ -33,7 +33,7 @@ binding_wasm = [ [dependencies] # Common deps for the SWC imports -swc = { optional = true, version = "0.273.19", path = "../swc" } +swc = { optional = true, version = "0.273.20", path = "../swc" } swc_common = { optional = true, version = "0.33.19", path = "../swc_common" } swc_ecma_ast = { optional = true, version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_transforms = { optional = true, version = "0.229.15", path = "../swc_ecma_transforms" } diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 5498f4b67e78..29de9ecb8185 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -9,7 +9,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc" repository = "https://github.com/swc-project/swc.git" -version = "0.273.19" +version = "0.273.20" [lib] bench = false diff --git a/crates/swc_cli_impl/Cargo.toml b/crates/swc_cli_impl/Cargo.toml index 78fb38d0ab75..5384b52c3104 100644 --- a/crates/swc_cli_impl/Cargo.toml +++ b/crates/swc_cli_impl/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_cli_impl" repository = "https://github.com/swc-project/swc.git" -version = "0.8.19" +version = "0.8.20" [[bin]] name = "swc" @@ -40,7 +40,7 @@ tracing-futures = "0.2.5" tracing-subscriber = { version = "0.3.9", features = ["env-filter"] } walkdir = "2" -swc_core = { version = "0.90.20", features = [ +swc_core = { version = "0.90.21", features = [ "trace_macro", "common_concurrent", "base_concurrent", diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 933bf1cba7fb..3942d5bc3f19 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_core" repository = "https://github.com/swc-project/swc.git" -version = "0.90.20" +version = "0.90.21" [package.metadata.docs.rs] features = [ "allocator_node", @@ -327,8 +327,8 @@ __visit = ["__ecma", "swc_ecma_visit"] once_cell = { optional = true, version = "1.18.0" } # swc_* dependencies -binding_macros = { optional = true, version = "0.64.19", path = "../binding_macros" } -swc = { optional = true, version = "0.273.19", path = "../swc" } +binding_macros = { optional = true, version = "0.64.20", path = "../binding_macros" } +swc = { optional = true, version = "0.273.20", path = "../swc" } swc_atoms = { optional = true, version = "0.6.5", path = "../swc_atoms" } swc_bundler = { optional = true, version = "0.225.15", path = "../swc_bundler" } swc_cached = { optional = true, version = "0.3.19", path = "../swc_cached" } @@ -362,7 +362,7 @@ swc_ecma_usage_analyzer = { optional = true, version = "0.23.11", path swc_ecma_utils = { optional = true, version = "0.127.11", path = "../swc_ecma_utils" } swc_ecma_visit = { optional = true, version = "0.98.6", path = "../swc_ecma_visit" } swc_malloc = { optional = true, version = "0.5.10", path = "../swc_malloc" } -swc_node_bundler = { optional = true, version = "0.62.19", path = "../swc_node_bundler" } +swc_node_bundler = { optional = true, version = "0.62.20", path = "../swc_node_bundler" } swc_nodejs_common = { optional = true, version = "0.0.8", path = "../swc_nodejs_common" } swc_plugin = { optional = true, version = "0.90.0", path = "../swc_plugin" } swc_plugin_macro = { optional = true, version = "0.9.16", path = "../swc_plugin_macro" } diff --git a/crates/swc_estree_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml index cade8465ea10..9358c732dba1 100644 --- a/crates/swc_estree_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = "Apache-2.0" name = "swc_estree_compat" repository = "https://github.com/swc-project/swc.git" -version = "0.198.18" +version = "0.198.19" [package.metadata.docs.rs] all-features = true @@ -40,7 +40,7 @@ swc_node_comments = { version = "0.20.18", path = "../swc_node_comments/" } criterion = "0.5" pretty_assertions = "1.3" -swc = { version = "0.273.19", path = "../swc" } +swc = { version = "0.273.20", path = "../swc" } swc_ecma_ast = { version = "0.112.5", path = "../swc_ecma_ast" } swc_ecma_parser = { version = "0.143.8", path = "../swc_ecma_parser" } swc_ecma_transforms = { version = "0.229.15", path = "../swc_ecma_transforms/" } diff --git a/crates/swc_node_bundler/Cargo.toml b/crates/swc_node_bundler/Cargo.toml index b090ae53050c..05256507a45f 100644 --- a/crates/swc_node_bundler/Cargo.toml +++ b/crates/swc_node_bundler/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" license = "Apache-2.0" name = "swc_node_bundler" repository = "https://github.com/swc-project/swc.git" -version = "0.62.19" +version = "0.62.20" [lib] bench = false @@ -29,7 +29,7 @@ serde_json = "1" tracing = "0.1.37" string_enum = { version = "0.4.2", path = "../string_enum" } -swc = { version = "0.273.19", path = "../swc" } +swc = { version = "0.273.20", path = "../swc" } swc_atoms = { version = "0.6.5", path = "../swc_atoms" } swc_bundler = { version = "0.225.15", path = "../swc_bundler", features = [ "concurrent",