diff --git a/.gitignore b/.gitignore index 5e0044ae1a8a..5781a7ac4439 100644 --- a/.gitignore +++ b/.gitignore @@ -64,4 +64,5 @@ pkg/ swc-core-*.tgz # samply -profile.json \ No newline at end of file +profile.json +profile.json.gz diff --git a/CHANGELOG-CORE.md b/CHANGELOG-CORE.md index 8f69e470b050..61efae1d3149 100644 --- a/CHANGELOG-CORE.md +++ b/CHANGELOG-CORE.md @@ -1,4 +1,70 @@ # Changelog +## [unreleased] + +### Performance + + + +- Replace `rayon` with `par-iter` ([#10774](https://github.com/swc-project/swc/issues/10774)) ([a6e6ebe](https://github.com/swc-project/swc/commit/a6e6ebeacafb8bccbaf3cb9bec3c87861461437a)) + +## [swc_core@v30.1.0] - 2025-07-04 + +### Features + + + +- **(es/minifier)** Implement partial evaluation of array join ([#10758](https://github.com/swc-project/swc/issues/10758)) ([bdf3a98](https://github.com/swc-project/swc/commit/bdf3a98bb45f6f9cdf1b9a8ed8d292ccce257d4e)) + +### Performance + + + +- **(es/lints)** Make rules not parallel ([#10772](https://github.com/swc-project/swc/issues/10772)) ([4e6001c](https://github.com/swc-project/swc/commit/4e6001c5a465ce13547abc2a6b24ae724e1adba5)) + + +- **(es/lints)** Merge critical rules ([#10773](https://github.com/swc-project/swc/issues/10773)) ([816e75a](https://github.com/swc-project/swc/commit/816e75a2094fd633243174f7953c9920f4851c79)) + + +- **(es/parser)** Reduce query ops of current token ([#10766](https://github.com/swc-project/swc/issues/10766)) ([4304f91](https://github.com/swc-project/swc/commit/4304f9129c1d511c94898727306a50535e11ad39)) + + +- **(es/parser)** Remove useless call in `parse_ident` ([#10770](https://github.com/swc-project/swc/issues/10770)) ([4ca12c9](https://github.com/swc-project/swc/commit/4ca12c97259fdf882b0849112473f3deea54be36)) + +### Refactor + + + +- **(es)** Make `swc_ecma_lint` optional for `swc` crate ([#10767](https://github.com/swc-project/swc/issues/10767)) ([f80415b](https://github.com/swc-project/swc/commit/f80415baa60a55a4dea31eff9b1c3431705183e5)) + + +- **(es/parser)** Cleanup `typed-arena` ([#10769](https://github.com/swc-project/swc/issues/10769)) ([ce5138d](https://github.com/swc-project/swc/commit/ce5138d3aae6e23127fc76da9f439d47b7c59374)) + +### Pref + + + +- **(hstr)** Do not compare static tag ([#10771](https://github.com/swc-project/swc/issues/10771)) ([5d3ce83](https://github.com/swc-project/swc/commit/5d3ce83add12c4b147d238e1cd6fdf6083c696d2)) + +## [swc_core@v30.0.2] - 2025-07-03 + +### Features + + + +- **(es/minifier)** Evaluate `Number.XXX` constants ([#10756](https://github.com/swc-project/swc/issues/10756)) ([c47dab5](https://github.com/swc-project/swc/commit/c47dab5f904ecce101b0388cab26805741bc9bd2)) + +### Miscellaneous Tasks + + + +- **(common)** Remove `clone()` in proc macro ([#10762](https://github.com/swc-project/swc/issues/10762)) ([12e3180](https://github.com/swc-project/swc/commit/12e318036caccee6d9b516baf391fccb07118ca9)) + + +- **(es/module)** Drop `node` feature of `swc_ecma_loader` ([#10761](https://github.com/swc-project/swc/issues/10761)) ([44471b5](https://github.com/swc-project/swc/commit/44471b51518d3c74ee4f3992f8474687ada13fc0)) + + +- **(plugin/runner)** Remove unused feature and dependency ([#10764](https://github.com/swc-project/swc/issues/10764)) ([a7d8a0a](https://github.com/swc-project/swc/commit/a7d8a0ac890bd4956d6b400017d6ddeba97e9ab0)) + ## [swc_core@v30.0.0] - 2025-07-02 ### Bug Fixes @@ -2600,47 +2666,4 @@ - **(es/resolver)** Ignore `VarDecl` with `declare: true` ([#9734](https://github.com/swc-project/swc/issues/9734)) ([aa0f784](https://github.com/swc-project/swc/commit/aa0f784c7d38d106e65e6aae1f0a318f575a0f09)) -### Features - - - -- **(plugin)** Bump `rkyv` to `v0.8.8` ([#9730](https://github.com/swc-project/swc/issues/9730)) ([81ac77e](https://github.com/swc-project/swc/commit/81ac77e3ab399446a0962db1e92d8066b73b3b31)) - - -- **(plugin)** Update `wasmer` to `v5` ([#9731](https://github.com/swc-project/swc/issues/9731)) ([9b74ccd](https://github.com/swc-project/swc/commit/9b74ccd92cf138d11790178f5817c89e44aa2deb)) - -### Miscellaneous Tasks - - - -- **(deps)** Update cargo (patch) ([#9724](https://github.com/swc-project/swc/issues/9724)) ([da37439](https://github.com/swc-project/swc/commit/da37439d6b6aae31e2b21690476d93f12dc87bd3)) - -### Performance - - - -- **(es/plugin)** Make `analyze_source_file` lazy, again ([#9732](https://github.com/swc-project/swc/issues/9732)) ([c1d12d6](https://github.com/swc-project/swc/commit/c1d12d6e2a0ad1633652817ebea435eca404bbb8)) - -### Refactor - - - -- Delay Wasm-plugin breaking changes ([#9735](https://github.com/swc-project/swc/issues/9735)) ([92faf5b](https://github.com/swc-project/swc/commit/92faf5b15df2ef5954f1a07c7376c04558efe181)) - -## [swc_core@v5.0.3] - 2024-11-11 - -### Features - - - -- **(es/codegen)** Implement proper `inline_script` support ([#9729](https://github.com/swc-project/swc/issues/9729)) ([e732a36](https://github.com/swc-project/swc/commit/e732a36373f0959a0653dc51a863230a9b3d8982)) - -## [swc_core@v5.0.2] - 2024-11-06 - -### Bug Fixes - - - -- **(es)** Fix typo in feature name ([#9721](https://github.com/swc-project/swc/issues/9721)) ([aff9de5](https://github.com/swc-project/swc/commit/aff9de5ea37d5d34d587b96b8044d08644936524)) - diff --git a/CHANGELOG.md b/CHANGELOG.md index a025fd3ca69d..3cac54b775b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,14 +14,29 @@ - **(es/minifeir)** Inline lazily initialized literals ([#10752](https://github.com/swc-project/swc/issues/10752)) ([fd5d2e2](https://github.com/swc-project/swc/commit/fd5d2e2f33db0d6aee8d133fe23047422a67e28c)) +- **(es/minifier)** Evaluate `Number.XXX` constants ([#10756](https://github.com/swc-project/swc/issues/10756)) ([c47dab5](https://github.com/swc-project/swc/commit/c47dab5f904ecce101b0388cab26805741bc9bd2)) + + +- **(es/minifier)** Implement partial evaluation of array join ([#10758](https://github.com/swc-project/swc/issues/10758)) ([bdf3a98](https://github.com/swc-project/swc/commit/bdf3a98bb45f6f9cdf1b9a8ed8d292ccce257d4e)) + + - **(swc_core)** Expose `swc_ecma_parser/unstable` ([#10744](https://github.com/swc-project/swc/issues/10744)) ([db0679e](https://github.com/swc-project/swc/commit/db0679e5ca675ea7b54bc8804897f1a2f313fe0c)) ### Miscellaneous Tasks +- **(common)** Remove `clone()` in proc macro ([#10762](https://github.com/swc-project/swc/issues/10762)) ([12e3180](https://github.com/swc-project/swc/commit/12e318036caccee6d9b516baf391fccb07118ca9)) + + - **(deps)** Update `browserslist-rs` to `0.19` ([#10750](https://github.com/swc-project/swc/issues/10750)) ([f8bf21c](https://github.com/swc-project/swc/commit/f8bf21c07202ac864d1772d5c46e1a4e99bda2fa)) + +- **(es/module)** Drop `node` feature of `swc_ecma_loader` ([#10761](https://github.com/swc-project/swc/issues/10761)) ([44471b5](https://github.com/swc-project/swc/commit/44471b51518d3c74ee4f3992f8474687ada13fc0)) + + +- **(plugin/runner)** Remove unused feature and dependency ([#10764](https://github.com/swc-project/swc/issues/10764)) ([a7d8a0a](https://github.com/swc-project/swc/commit/a7d8a0ac890bd4956d6b400017d6ddeba97e9ab0)) + ### Performance @@ -29,29 +44,56 @@ - **(es/lexer)** Use `bitflags` for `Syntax` ([#10676](https://github.com/swc-project/swc/issues/10676)) ([bf8c722](https://github.com/swc-project/swc/commit/bf8c722e25018baa45706b890b7464f90fc03f6a)) +- **(es/lints)** Make rules not parallel ([#10772](https://github.com/swc-project/swc/issues/10772)) ([4e6001c](https://github.com/swc-project/swc/commit/4e6001c5a465ce13547abc2a6b24ae724e1adba5)) + + +- **(es/lints)** Merge critical rules ([#10773](https://github.com/swc-project/swc/issues/10773)) ([816e75a](https://github.com/swc-project/swc/commit/816e75a2094fd633243174f7953c9920f4851c79)) + + - **(es/parser)** Reduce the number of context set ops ([#10742](https://github.com/swc-project/swc/issues/10742)) ([08b4e8b](https://github.com/swc-project/swc/commit/08b4e8b285ddb49eeefd06d1f745d9aec25427c1)) - **(es/parser)** Reduce value set operations for context ([#10751](https://github.com/swc-project/swc/issues/10751)) ([4976b12](https://github.com/swc-project/swc/commit/4976b12f9398c471c0f77e69ad141e0172927a2b)) +- **(es/parser)** Reduce query ops of current token ([#10766](https://github.com/swc-project/swc/issues/10766)) ([4304f91](https://github.com/swc-project/swc/commit/4304f9129c1d511c94898727306a50535e11ad39)) + + +- **(es/parser)** Remove useless call in `parse_ident` ([#10770](https://github.com/swc-project/swc/issues/10770)) ([4ca12c9](https://github.com/swc-project/swc/commit/4ca12c97259fdf882b0849112473f3deea54be36)) + + - **(es/renamer)** Reduce time complexity in case of conflict ([#10749](https://github.com/swc-project/swc/issues/10749)) ([0279914](https://github.com/swc-project/swc/commit/02799141bf0d040b6536f3333cfed852b80c611b)) + +- Replace `rayon` with `par-iter` ([#10774](https://github.com/swc-project/swc/issues/10774)) ([a6e6ebe](https://github.com/swc-project/swc/commit/a6e6ebeacafb8bccbaf3cb9bec3c87861461437a)) + ### Refactor +- **(es)** Make `swc_ecma_lint` optional for `swc` crate ([#10767](https://github.com/swc-project/swc/issues/10767)) ([f80415b](https://github.com/swc-project/swc/commit/f80415baa60a55a4dea31eff9b1c3431705183e5)) + + - **(es/lexer)** Use const fn in `SyntaxFlags` ([#10737](https://github.com/swc-project/swc/issues/10737)) ([b9eb23a](https://github.com/swc-project/swc/commit/b9eb23aec3dd0963afa5080d53bca4dd0325f233)) - **(es/parser)** Cleanup `parse_setter_param` ([#10745](https://github.com/swc-project/swc/issues/10745)) ([70734f4](https://github.com/swc-project/swc/commit/70734f40d4ff0d9ad140b705c3356b44f8bd5663)) + +- **(es/parser)** Cleanup `typed-arena` ([#10769](https://github.com/swc-project/swc/issues/10769)) ([ce5138d](https://github.com/swc-project/swc/commit/ce5138d3aae6e23127fc76da9f439d47b7c59374)) + ### Testing - **(es/minifier)** Update the terser test list ([#10748](https://github.com/swc-project/swc/issues/10748)) ([1eace01](https://github.com/swc-project/swc/commit/1eace01303a98a522b67f9005601cbebd0d5b71e)) +### Pref + + + +- **(hstr)** Do not compare static tag ([#10771](https://github.com/swc-project/swc/issues/10771)) ([5d3ce83](https://github.com/swc-project/swc/commit/5d3ce83add12c4b147d238e1cd6fdf6083c696d2)) + ## [1.12.9] - 2025-07-01 ### Bug Fixes @@ -2126,12 +2168,6 @@ -- **(plugin)** Bump `rkyv` to `v0.8.8` ([#9730](https://github.com/swc-project/swc/issues/9730)) ([81ac77e](https://github.com/swc-project/swc/commit/81ac77e3ab399446a0962db1e92d8066b73b3b31)) - - -- **(plugin)** Update `wasmer` to `v5` ([#9731](https://github.com/swc-project/swc/issues/9731)) ([9b74ccd](https://github.com/swc-project/swc/commit/9b74ccd92cf138d11790178f5817c89e44aa2deb)) - - - **(visit)** Derive serde for `AstParentKind` ([#9744](https://github.com/swc-project/swc/issues/9744)) ([e0fdd68](https://github.com/swc-project/swc/commit/e0fdd68183b9851050e1a03a903261275872044e)) ### Miscellaneous Tasks @@ -2140,36 +2176,10 @@ - **(bindings/node)** Format `binding.js` ([#9738](https://github.com/swc-project/swc/issues/9738)) ([9f8c14f](https://github.com/swc-project/swc/commit/9f8c14f5f81ca66609fe2fbfdac4c970240702e4)) - -- **(deps)** Update cargo (patch) ([#9724](https://github.com/swc-project/swc/issues/9724)) ([da37439](https://github.com/swc-project/swc/commit/da37439d6b6aae31e2b21690476d93f12dc87bd3)) - -### Performance - - - -- **(es/plugin)** Make `analyze_source_file` lazy, again ([#9732](https://github.com/swc-project/swc/issues/9732)) ([c1d12d6](https://github.com/swc-project/swc/commit/c1d12d6e2a0ad1633652817ebea435eca404bbb8)) - ### Refactor - **(es/compat)** Use special span instead of passing `static_blocks_mark` ([#9725](https://github.com/swc-project/swc/issues/9725)) ([6ad0735](https://github.com/swc-project/swc/commit/6ad0735033b405c04e53c1e3c7ec56db4b8fcf93)) - -- Delay Wasm-plugin breaking changes ([#9735](https://github.com/swc-project/swc/issues/9735)) ([92faf5b](https://github.com/swc-project/swc/commit/92faf5b15df2ef5954f1a07c7376c04558efe181)) - -## [1.9.2] - 2024-11-11 - -### Bug Fixes - - - -- **(es)** Fix typo in feature name ([#9721](https://github.com/swc-project/swc/issues/9721)) ([aff9de5](https://github.com/swc-project/swc/commit/aff9de5ea37d5d34d587b96b8044d08644936524)) - -### Features - - - -- **(es/codegen)** Implement proper `inline_script` support ([#9729](https://github.com/swc-project/swc/issues/9729)) ([e732a36](https://github.com/swc-project/swc/commit/e732a36373f0959a0653dc51a863230a9b3d8982)) - diff --git a/Cargo.lock b/Cargo.lock index dbf41827eaf9..59f37cfbff37 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,7 +205,7 @@ dependencies = [ [[package]] name = "ast_node" -version = "3.0.1" +version = "3.0.2" dependencies = [ "proc-macro2", "quote", @@ -1233,13 +1233,14 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476" [[package]] name = "dbg-swc" -version = "25.0.0" +version = "25.0.1" dependencies = [ "anyhow", "clap 3.2.25", "dialoguer", "flate2", "par-core", + "par-iter", "rayon", "serde", "serde_json", @@ -1973,7 +1974,7 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hstr" -version = "1.1.1" +version = "1.1.3" dependencies = [ "compact_str", "criterion", @@ -1982,9 +1983,9 @@ dependencies = [ "new_debug_unreachable", "num_cpus", "once_cell", + "par-iter", "phf", "rand 0.8.5", - "rayon", "rkyv", "rustc-hash 2.1.1", "serde", @@ -4741,7 +4742,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swc" -version = "29.0.0" +version = "29.1.0" dependencies = [ "ansi_term", "anyhow", @@ -4894,7 +4895,7 @@ dependencies = [ [[package]] name = "swc_cli_impl" -version = "30.0.0" +version = "30.0.1" dependencies = [ "anyhow", "assert_cmd", @@ -4902,8 +4903,8 @@ dependencies = [ "clap 3.2.25", "glob", "par-core", + "par-iter", "path-absolutize", - "rayon", "relative-path", "serde", "serde_json", @@ -4918,7 +4919,7 @@ dependencies = [ [[package]] name = "swc_common" -version = "13.0.2" +version = "13.0.3" dependencies = [ "anyhow", "arbitrary", @@ -4934,9 +4935,9 @@ dependencies = [ "new_debug_unreachable", "num-bigint", "once_cell", + "par-iter", "parking_lot", "rancor", - "rayon", "rkyv", "rustc-hash 2.1.1", "serde", @@ -5012,7 +5013,7 @@ dependencies = [ [[package]] name = "swc_core" -version = "30.0.1" +version = "30.1.1" dependencies = [ "anyhow", "binding_macros", @@ -5144,12 +5145,12 @@ dependencies = [ [[package]] name = "swc_css_lints" -version = "14.0.0" +version = "14.0.1" dependencies = [ "anyhow", "auto_impl", + "par-iter", "parking_lot", - "rayon", "rustc-hash 2.1.1", "serde", "serde_json", @@ -5531,7 +5532,7 @@ dependencies = [ [[package]] name = "swc_ecma_lexer" -version = "18.0.0" +version = "18.0.1" dependencies = [ "arrayvec", "ascii", @@ -5559,13 +5560,12 @@ dependencies = [ "swc_malloc", "testing", "tracing", - "typed-arena", "walkdir", ] [[package]] name = "swc_ecma_lints" -version = "19.0.0" +version = "19.0.1" dependencies = [ "anyhow", "auto_impl", @@ -5616,7 +5616,7 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "24.0.1" +version = "24.0.2" dependencies = [ "ansi_term", "anyhow", @@ -5664,7 +5664,7 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "18.0.0" +version = "18.0.1" dependencies = [ "arrayvec", "bitflags 2.6.0", @@ -5690,7 +5690,6 @@ dependencies = [ "swc_malloc", "testing", "tracing", - "typed-arena", "walkdir", ] @@ -5849,7 +5848,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "19.0.0" +version = "19.0.1" dependencies = [ "better_scoped_tls", "bitflags 2.6.0", @@ -5858,6 +5857,7 @@ dependencies = [ "indexmap 2.7.1", "once_cell", "par-core", + "par-iter", "phf", "rayon", "rustc-hash 2.1.1", @@ -5940,7 +5940,7 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "21.0.0" +version = "21.0.1" dependencies = [ "Inflector", "anyhow", @@ -6473,7 +6473,7 @@ dependencies = [ [[package]] name = "swc_plugin_runner" -version = "15.0.0" +version = "15.0.1" dependencies = [ "anyhow", "codspeed-criterion-compat", @@ -6500,7 +6500,6 @@ dependencies = [ "tokio", "tracing", "vergen", - "virtual-fs", "wasmer", "wasmer-cache", "wasmer-compiler-cranelift", @@ -7261,12 +7260,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "typed-arena" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" - [[package]] name = "typenum" version = "1.17.0" diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index 991870621f4d..02a989e6637e 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -281,7 +281,7 @@ dependencies = [ [[package]] name = "binding_core_wasm" -version = "1.12.9" +version = "1.12.10" dependencies = [ "anyhow", "getrandom 0.3.3", @@ -321,9 +321,9 @@ dependencies = [ [[package]] name = "binding_macros" -version = "28.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd2db24612502c080c6466d8a502a2b51954a831f2b5a87aa282ce84cbd2262a" +checksum = "9ac6e1109a48b18ace0a35f766166b7110914cceb17e68b3774ae9ad248a5860" dependencies = [ "anyhow", "console_error_panic_hook", @@ -370,7 +370,7 @@ dependencies = [ [[package]] name = "binding_minifier_wasm" -version = "1.12.9" +version = "1.12.10" dependencies = [ "anyhow", "getrandom 0.3.3", @@ -410,7 +410,7 @@ dependencies = [ [[package]] name = "binding_typescript_wasm" -version = "1.12.9" +version = "1.12.10" dependencies = [ "anyhow", "getrandom 0.3.3", @@ -475,16 +475,26 @@ dependencies = [ "generic-array", ] +[[package]] +name = "browserslist-data" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f42db7dd1800856ac32d4a08c2915de9a9a2a72ce1fdd86189daed368729fd4" +dependencies = [ + "ahash 0.8.12", + "chrono", +] + [[package]] name = "browserslist-rs" -version = "0.18.2" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf24e007a83ff1f58d2441b459fa26124aa1a7367da88948e9940f14e723d06" +checksum = "8dd48a6ca358df4f7000e3fb5f08738b1b91a0e5d5f862e2f77b2b14647547f5" dependencies = [ "ahash 0.8.12", + "browserslist-data", "chrono", "either", - "indexmap 2.9.0", "itertools 0.13.0", "nom 7.1.3", "serde", @@ -3280,9 +3290,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "preset_env_base" -version = "3.0.2" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7ef56d3bd1b2cb104e716ec6babbca1df3b59754d4e3e99426163572e6bc0cc" +checksum = "a7592384c098e7cdb7e31d0ce7294d922f5cd381f170f0eb9e545e50fb87d613" dependencies = [ "anyhow", "browserslist-rs", @@ -4425,9 +4435,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swc" -version = "28.0.1" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d337e9bcf724035cf11b650e2eec678016cd5c6b0bb045fe84143f56d2f1bf37" +checksum = "e57ddfe0560df8c0097d6183e7cc4e80c40b6464bd6d5e275c5bcfcfc7d9e4be" dependencies = [ "anyhow", "base64", @@ -4511,9 +4521,9 @@ dependencies = [ [[package]] name = "swc_bundler" -version = "22.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "179ea4f155224df226993151f012b0fabed186e10e42daf26de3b73a99de79a4" +checksum = "b5b3b74e9ae0f72eed6c9fc83eac566eb3a3226a4d07383a10f92cb204fcc7cc" dependencies = [ "anyhow", "crc", @@ -4543,7 +4553,7 @@ dependencies = [ [[package]] name = "swc_cli" -version = "0.91.579" +version = "0.91.580" dependencies = [ "anyhow", "par-core", @@ -4552,9 +4562,9 @@ dependencies = [ [[package]] name = "swc_cli_impl" -version = "29.0.0" +version = "30.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2743dadb2930071c25cde076b587fb22e1d2b3168bc7a7e398715fd125037e1b" +checksum = "bbe0dfec6a74d846a93b8f3b249af48bcb2724fbf1426602b13b68cf2338608e" dependencies = [ "anyhow", "clap", @@ -4609,9 +4619,9 @@ dependencies = [ [[package]] name = "swc_compiler_base" -version = "25.0.0" +version = "26.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a45b0fe21cd1e18247069717627228075039305ee548d40e2969e6fefe57fef" +checksum = "d83bc1443865d7cf6e567497a8af84f7d788c66d699281e06be851e7c5cb5232" dependencies = [ "anyhow", "base64", @@ -4671,9 +4681,9 @@ dependencies = [ [[package]] name = "swc_core" -version = "29.4.2" +version = "30.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41f837258f84d0d6d0a1dd8bbd277bbab34de9fa2180b6bc6e838f652b304c9" +checksum = "ec387d0be9f3a82c051ddcfc8a5075fec67023a38f7b5fb4d8cfc82d843e7710" dependencies = [ "binding_macros", "swc", @@ -4857,9 +4867,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_bugfixes" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356e45a22368e4a4c7ff1438d778e071daf77a7bf1e506b3a9877d3b5d0d6d42" +checksum = "9169f129a481546e4eb620dba0c26109862cf5bce96e3680d4db01abbb2b665e" dependencies = [ "rustc-hash 2.1.1", "swc_atoms", @@ -4888,9 +4898,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2015" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613d59fc91170b523608ee9b2e3206dc969fc763ecd4709cca1cb7606b869f3d" +checksum = "78c5e4b8677241c8bab9973ee1029b2805617d6de24c79f6e92aef98c6914a04" dependencies = [ "arrayvec", "indexmap 2.9.0", @@ -4915,9 +4925,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2016" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223c7fe67b8586117a8ed969ce14cc9e4b9f7d4792052dc227485be4f6d58597" +checksum = "da37c77b89c051adae231f418b4bc692c64d317f000b84dc6237d1684dcf6a17" dependencies = [ "swc_atoms", "swc_common", @@ -4932,9 +4942,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2017" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46ec946ed7f16de4850fd46022d99b6b10ed05c9736d6ee5efcbfa861b003c95" +checksum = "cda5d7eebf7bb5ebb9423e3edfeb7b821e2aada1a30e1bfe0e95960c978f6635" dependencies = [ "serde", "swc_atoms", @@ -4950,9 +4960,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2018" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb019c275026b788b240c86d07b41757bbcc883a3df5283f2310d2afee9af20" +checksum = "bb135269fbba79ae05a36975409c41da275d317297555a954a3d113ac67d5838" dependencies = [ "serde", "swc_atoms", @@ -4969,9 +4979,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2019" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ad53e027532c3e30855395c7d88862501654b43aaa3c65316a66905c6a5b6cc" +checksum = "e291f270b5a6837be3e8b9234d97e375ff55cb1f5abc71ea3356a6707be2dfcb" dependencies = [ "swc_atoms", "swc_common", @@ -4985,9 +4995,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2020" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea2e62880d1a83aee7e653443a7f878e03d9072b69c1649fceb6b2fbc8036a0" +checksum = "135d8617f15be0d4bca63bff159354fd06aee5fa0ecb451123fb3bde19b2f946" dependencies = [ "serde", "swc_atoms", @@ -5003,9 +5013,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2021" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d4d588af0fb0928ce0dc19db304e90a1dccb20701fac9ced61bdb7ea65b9227" +checksum = "9e0a3142bf6430d05f19bace9efd64665a0511e02debfa76b07ee342dc213504" dependencies = [ "swc_atoms", "swc_common", @@ -5019,9 +5029,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es2022" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9390f39b879e5f7f2a62990a05d29e2c0e8dad2c6d3f76bab3104512c41e92" +checksum = "551718d7d0304f308e28aa8418c47a0a96e3876ea0801055490e828d5ca7c658" dependencies = [ "rustc-hash 2.1.1", "swc_atoms", @@ -5039,9 +5049,9 @@ dependencies = [ [[package]] name = "swc_ecma_compat_es3" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89174560c3fdc0964797afd57b7ea9ba084ba1946eeb4fcac3590602ef911336" +checksum = "97a2d522e48762ecfd40851f568eb504a22eb9fcaed03a47faf86de159c85a01" dependencies = [ "swc_common", "swc_ecma_ast", @@ -5068,9 +5078,9 @@ dependencies = [ [[package]] name = "swc_ecma_lexer" -version = "17.0.7" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff2f560591181601f15316838bd5872b19902e7b4605a08743c6cb3e853b3db" +checksum = "3b009fbd9113e82513e8f85f8405a3eaf4836b0e2b1bf35e1d492dba48108441" dependencies = [ "arrayvec", "ascii", @@ -5139,9 +5149,9 @@ dependencies = [ [[package]] name = "swc_ecma_minifier" -version = "23.0.5" +version = "24.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83acbd779994eff0c3fe70a556969a1c315afe49e4c0f7a928939f812e96c541" +checksum = "efba6301e1675e1ab9e03d0dcd691695b62a0e6eb5841d88c770524e491a793a" dependencies = [ "arrayvec", "bitflags 2.9.1", @@ -5177,9 +5187,9 @@ dependencies = [ [[package]] name = "swc_ecma_parser" -version = "17.2.1" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "821520cc73106140a379ba2614e67e35f9c5dff40f078fa791b16ed92e00053d" +checksum = "f4ebb9d932251ca0a4db5cd952a5134bef6e1f9853a914cf3bd1fbc4118f107a" dependencies = [ "arrayvec", "bitflags 2.9.1", @@ -5203,9 +5213,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "23.0.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e996c47428aab2686a420cc28aaac584427dcf58c54a7c44f3f5f64a3fed2813" +checksum = "f3e77aa57a357c19e85b03f80780b6529f2e9f51134a94f45f252e0d4550caa1" dependencies = [ "anyhow", "dashmap 5.5.3", @@ -5240,9 +5250,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "22.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "997f66127d99492f5eba755503915912dab5adfbac9a3a95257fb9088ac2e834" +checksum = "802136884637d4f9fdde93c3a34f829e4c7e1831eae2a6e6d06ebb49d54ed442" dependencies = [ "par-core", "swc_atoms", @@ -5261,9 +5271,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a9971c1f27f6b3ebcad7424e81861c35bfd009be81786da71a6e3a7002d808" +checksum = "abface3af9575e3849dce475189384d4b549335cb127fd5691d1c8f304f694c0" dependencies = [ "better_scoped_tls", "bitflags 2.9.1", @@ -5286,9 +5296,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd24f6d56d12d2170178d3d90593c7eb2df7f15656f05522b2f872f0ed7af5d" +checksum = "53837c7f0545bc03f9fe1158bf2a6aae3cf05018ab66252dc7cfdcffe4c80e04" dependencies = [ "swc_atoms", "swc_common", @@ -5300,9 +5310,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a4920aadf61e7554104de3cf12a8b0f34b091a4e216d1486f47bdac3196780f" +checksum = "e734c4cd3ffe18a38b072fd31758397014254e2b0b7fdea80f0b8d50ec723d89" dependencies = [ "arrayvec", "indexmap 2.9.0", @@ -5350,9 +5360,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_module" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9adf8a0e833abee9b6baf05e7504be1bdda9937837a65f877ea05599b3e4d1f" +checksum = "600c8dc240cf762e6121aef2a1076a5c2774cd438a639beb145e8afa66778f11" dependencies = [ "Inflector", "anyhow", @@ -5378,9 +5388,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_optimization" -version = "19.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "148b59208253c618c0e1c363f6f5bdd6ff309fb09743dfa4c0fa0b1bd220e454" +checksum = "67322d743c07fc94e3eac22f6cbbfd7e518d5022839aaaee6fb1c39432bb1bb2" dependencies = [ "bytes-str", "dashmap 5.5.3", @@ -5404,9 +5414,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "18.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f990b680ccc79fc42283051d6fd264d78849a1eb95fd8df7de8e00e5e1ab21" +checksum = "fd53518b08dcfdc21fcc2342cbb6d9bd3b7169002c0b245273d2537f9650c873" dependencies = [ "either", "rustc-hash 2.1.1", @@ -5424,9 +5434,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212612746ce4f866a966b980474b00b93378fde8fa1af37e7da6e9fc3d003eac" +checksum = "e64abb192166cbd9b211642eeb93567762819980636d467f56498d349f1180f5" dependencies = [ "base64", "bytes-str", @@ -5452,9 +5462,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "20.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020205bafa5e6a01023bff2aa66b1bcef03c10b4113a3f73443f478392d209c5" +checksum = "7729efdae45a96ff2ab56ae47e2c5f3d66d438c964601170aa3368673841c816" dependencies = [ "bytes-str", "once_cell", @@ -5472,9 +5482,9 @@ dependencies = [ [[package]] name = "swc_ecma_usage_analyzer" -version = "19.0.1" +version = "19.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209cc62665a5a6f7cded15c198a27b5aed49f8f4bc2b1c14ebec61c02889b2e6" +checksum = "d1a370efe3cefc6e07089e312ea06b1d1179efa3f418d6f2947f3a09b8565c29" dependencies = [ "bitflags 2.9.1", "indexmap 2.9.0", @@ -5567,9 +5577,9 @@ dependencies = [ [[package]] name = "swc_html" -version = "23.0.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6021df0737c4d1442028be1b964b23acadd050db5d966cc69453d31bb873eb" +checksum = "bfe7e5c2e3fd206969146fd94c6c5fede077c1acefcf2b2309632b1672d6a0ad" dependencies = [ "swc_html_ast", "swc_html_codegen", @@ -5620,9 +5630,9 @@ dependencies = [ [[package]] name = "swc_html_minifier" -version = "23.0.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d46974bd8c24fa35f396f9141e628ed67992a8e1ecf9a994b4cae8375a39551" +checksum = "4fbbfa4dece5e240dc8b2f75d4779e92cfc9080aed9bc75875d66bc36e0214f2" dependencies = [ "once_cell", "rustc-hash 2.1.1", @@ -5711,9 +5721,9 @@ dependencies = [ [[package]] name = "swc_node_bundler" -version = "29.0.0" +version = "30.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81076975dfb011b74b7a8f8cdf1a5f1c983d7160ad9fab92081926ee15ddb5e3" +checksum = "f4188317acef450b3f457d50550215264ca5831ea4a9e433554eb1f6134758e0" dependencies = [ "anyhow", "dashmap 5.5.3", @@ -5865,9 +5875,9 @@ dependencies = [ [[package]] name = "swc_ts_fast_strip" -version = "23.1.0" +version = "24.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a67ba9f48e9731a6389499d66d5ae5d2ea5fdd9972a6c3989da4d03dae7fa7" +checksum = "0b01dbeab557f08c31fd78806da14853c59b29a359543e0e98974fdc7d8c4889" dependencies = [ "anyhow", "bytes-str", diff --git a/bindings/Cargo.toml b/bindings/Cargo.toml index 8b8e35843975..8152b47ddad3 100644 --- a/bindings/Cargo.toml +++ b/bindings/Cargo.toml @@ -36,24 +36,24 @@ resolver = "2" serde-wasm-bindgen = "0.6.5" serde_json = "1.0.140" swc_atoms = "6.0.0" - swc_cli_impl = "29.0.0" + swc_cli_impl = "30.0.0" swc_common = "13.0.2" - swc_compiler_base = "25.0.0" + swc_compiler_base = "26.0.0" swc_config = "3.1.1" - swc_core = "29.4.2" + swc_core = "30.0.1" swc_css_ast = "13.0.0" swc_css_codegen = "13.0.0" swc_css_minifier = "13.0.0" swc_css_parser = "13.0.0" swc_ecma_react_compiler = "6.0.1" swc_error_reporters = "15.0.0" - swc_ts_fast_strip = "23.1.0" - swc_html = "23.0.0" + swc_html = "24.0.0" swc_html_ast = "13.0.0" - swc_html_minifier = "23.0.0" + swc_html_minifier = "24.0.0" swc_malloc = "1.2.3" swc_nodejs_common = "1.0.1" swc_sourcemap = "9.3.2" + swc_ts_fast_strip = "24.0.0" tracing = "0.1.41" tracing-chrome = "0.7.2" tracing-futures = "0.2.5" @@ -146,5 +146,5 @@ strip = "symbols" opt-level = "s" -[profile.dev.package."*"] -debug-assertions = false + [profile.dev.package."*"] + debug-assertions = false diff --git a/bindings/binding_core_wasm/Cargo.toml b/bindings/binding_core_wasm/Cargo.toml index 3a8ae608ab5f..21901dd7dc33 100644 --- a/bindings/binding_core_wasm/Cargo.toml +++ b/bindings/binding_core_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = { workspace = true } name = "binding_core_wasm" publish = false repository = { workspace = true } -version = "1.12.9" +version = "1.12.10" [lib] bench = false diff --git a/bindings/binding_minifier_wasm/Cargo.toml b/bindings/binding_minifier_wasm/Cargo.toml index 9fa73e5fc566..ab3d94e73deb 100644 --- a/bindings/binding_minifier_wasm/Cargo.toml +++ b/bindings/binding_minifier_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = { workspace = true } name = "binding_minifier_wasm" publish = false repository = { workspace = true } -version = "1.12.9" +version = "1.12.10" [lib] bench = false diff --git a/bindings/binding_typescript_wasm/Cargo.toml b/bindings/binding_typescript_wasm/Cargo.toml index a7772b4c5be2..d5dbcb463ad4 100644 --- a/bindings/binding_typescript_wasm/Cargo.toml +++ b/bindings/binding_typescript_wasm/Cargo.toml @@ -6,7 +6,7 @@ license = { workspace = true } name = "binding_typescript_wasm" publish = false repository = { workspace = true } -version = "1.12.9" +version = "1.12.10" [lib] bench = false diff --git a/bindings/swc_cli/Cargo.toml b/bindings/swc_cli/Cargo.toml index 99f7e195d1d0..0613b4767c8c 100644 --- a/bindings/swc_cli/Cargo.toml +++ b/bindings/swc_cli/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = { workspace = true } name = "swc_cli" repository = { workspace = true } -version = "0.91.579" +version = "0.91.580" [[bin]] bench = false diff --git a/crates/ast_node/Cargo.toml b/crates/ast_node/Cargo.toml index 17774e0ca693..b1189226d15f 100644 --- a/crates/ast_node/Cargo.toml +++ b/crates/ast_node/Cargo.toml @@ -6,7 +6,7 @@ edition = { workspace = true } license = { workspace = true } name = "ast_node" repository = { workspace = true } -version = "3.0.1" +version = "3.0.2" [lib] bench = false diff --git a/crates/ast_node/src/enum_deserialize.rs b/crates/ast_node/src/enum_deserialize.rs index 018539846f6f..df53e3e0e53b 100644 --- a/crates/ast_node/src/enum_deserialize.rs +++ b/crates/ast_node/src/enum_deserialize.rs @@ -178,13 +178,13 @@ pub fn expand( ) } if tags.len() == 1 { - make_pat(tags.first().unwrap().clone()) + make_pat(tags.into_iter().next().unwrap()) } else { let mut str_cases = Punctuated::new(); let mut bytes_cases = Punctuated::new(); for tag in tags { - let (str_pat, bytes_pat) = make_pat(tag.clone()); + let (str_pat, bytes_pat) = make_pat(tag); str_cases.push(str_pat); bytes_cases.push(bytes_pat); } diff --git a/crates/binding_macros/Cargo.toml b/crates/binding_macros/Cargo.toml index 80db9a846922..7be31106f5e5 100644 --- a/crates/binding_macros/Cargo.toml +++ b/crates/binding_macros/Cargo.toml @@ -33,8 +33,8 @@ binding_wasm = [ [dependencies] # Common deps for the SWC imports -swc = { optional = true, version = "29.0.0", path = "../swc" } -swc_common = { optional = true, version = "13.0.2", path = "../swc_common" } +swc = { optional = true, version = "29.1.0", path = "../swc" } +swc_common = { optional = true, version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { optional = true, version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_transforms = { optional = true, version = "23.0.0", path = "../swc_ecma_transforms" } swc_ecma_visit = { optional = true, version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/dbg-swc/Cargo.toml b/crates/dbg-swc/Cargo.toml index c8fc6eef8a7c..998a0a9928b2 100644 --- a/crates/dbg-swc/Cargo.toml +++ b/crates/dbg-swc/Cargo.toml @@ -5,7 +5,7 @@ edition = { workspace = true } license = { workspace = true } name = "dbg-swc" repository = { workspace = true } -version = "25.0.0" +version = "25.0.1" [[bin]] bench = false @@ -17,6 +17,7 @@ clap = { version = "3", features = ["derive"] } dialoguer = { workspace = true } flate2 = { workspace = true } par-core = { workspace = true, features = ["chili"] } +par-iter = { workspace = true } rayon = { workspace = true } serde = { workspace = true } serde_json = { workspace = true } @@ -27,17 +28,17 @@ tracing-subscriber = { workspace = true, features = ["fmt", "env-filter"] } url = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", features = [ +swc_common = { version = "13.0.3", features = [ "concurrent", "tty-emitter", ], path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier", features = [ "concurrent", ] } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_error_reporters = { version = "15.0.0", path = "../swc_error_reporters" } swc_timer = { version = "1.0.0", path = "../swc_timer" } diff --git a/crates/dbg-swc/src/es/minifier/ensure_size.rs b/crates/dbg-swc/src/es/minifier/ensure_size.rs index e511aa4fdcd7..65b4ed92db8e 100644 --- a/crates/dbg-swc/src/es/minifier/ensure_size.rs +++ b/crates/dbg-swc/src/es/minifier/ensure_size.rs @@ -5,7 +5,7 @@ use std::{ use anyhow::{Context, Result}; use clap::Args; -use rayon::prelude::*; +use par_iter::prelude::*; use swc_common::{ errors::{ColorConfig, Handler, HANDLER}, SourceFile, SourceMap, GLOBALS, diff --git a/crates/dbg-swc/src/es/minifier/reduce.rs b/crates/dbg-swc/src/es/minifier/reduce.rs index 7b3f96cd9e36..12fa5d08e253 100644 --- a/crates/dbg-swc/src/es/minifier/reduce.rs +++ b/crates/dbg-swc/src/es/minifier/reduce.rs @@ -8,7 +8,7 @@ use std::{ use anyhow::{Context, Result}; use clap::{ArgEnum, Args}; -use rayon::prelude::*; +use par_iter::prelude::*; use sha1::{Digest, Sha1}; use swc_common::{SourceMap, GLOBALS}; use tempfile::TempDir; diff --git a/crates/hstr/Cargo.toml b/crates/hstr/Cargo.toml index 397705285d48..473d2b29a690 100644 --- a/crates/hstr/Cargo.toml +++ b/crates/hstr/Cargo.toml @@ -5,7 +5,7 @@ edition = { workspace = true } license = { workspace = true } name = "hstr" repository = { workspace = true } -version = "1.1.1" +version = "1.1.3" [lib] bench = false @@ -33,8 +33,8 @@ compact_str = { workspace = true } criterion = { workspace = true } kstring = { workspace = true } num_cpus = { workspace = true } +par-iter = { workspace = true } rand = { workspace = true } -rayon = { workspace = true } smartstring = { workspace = true } smol_str = { workspace = true } string_cache = { workspace = true } diff --git a/crates/hstr/benches/libs.rs b/crates/hstr/benches/libs.rs index 6812bee3c9a2..f5ca6621cf55 100644 --- a/crates/hstr/benches/libs.rs +++ b/crates/hstr/benches/libs.rs @@ -8,8 +8,8 @@ use std::{hash::Hash, mem::forget}; use compact_str::CompactString; use criterion::{black_box, BatchSize, BenchmarkId, Criterion}; +use par_iter::prelude::*; use rand::distributions::{Alphanumeric, DistString}; -use rayon::prelude::*; use rustc_hash::FxHashSet; use smartstring::{LazyCompact, SmartString}; diff --git a/crates/hstr/src/lib.rs b/crates/hstr/src/lib.rs index b64b2cd7f490..6c8bd92138ac 100644 --- a/crates/hstr/src/lib.rs +++ b/crates/hstr/src/lib.rs @@ -255,14 +255,14 @@ impl Atom { .header .hash } - STATIC_TAG => { - todo!("static hash") - } INLINE_TAG => { // This is passed as input to the caller's `Hasher` implementation, so it's okay // that this isn't really a hash self.unsafe_data.hash() } + STATIC_TAG => { + todo!("static hash") + } _ => unsafe { debug_unreachable!() }, } } @@ -274,14 +274,14 @@ impl Atom { let item = crate::dynamic::deref_from(self.unsafe_data); from_utf8_unchecked(transmute::<&[u8], &'static [u8]>(&item.slice)) }, - STATIC_TAG => { - todo!("static as_str") - } INLINE_TAG => { let len = (self.unsafe_data.tag() & LEN_MASK) >> LEN_OFFSET; let src = self.unsafe_data.data(); unsafe { std::str::from_utf8_unchecked(&src[..(len as usize)]) } } + STATIC_TAG => { + todo!("static as_str") + } _ => unsafe { debug_unreachable!() }, } } diff --git a/crates/jsdoc/Cargo.toml b/crates/jsdoc/Cargo.toml index 6045841d29c4..6af545fe8dc0 100644 --- a/crates/jsdoc/Cargo.toml +++ b/crates/jsdoc/Cargo.toml @@ -20,12 +20,12 @@ nom = { workspace = true } serde = { workspace = true, features = ["derive"], optional = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } [dev-dependencies] anyhow = { workspace = true } dashmap = { workspace = true } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc/Cargo.toml b/crates/swc/Cargo.toml index 10799b725ce6..3f9bf73dce0f 100644 --- a/crates/swc/Cargo.toml +++ b/crates/swc/Cargo.toml @@ -9,7 +9,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = { workspace = true } name = "swc" repository = { workspace = true } -version = "29.0.0" +version = "29.1.0" [lib] bench = false @@ -25,7 +25,7 @@ concurrent = [ ] debug = ["swc_ecma_visit/debug", "swc_ecma_minifier/debug"] -default = ["es3"] +default = ["es3", "lint"] es3 = [] node = ["napi", "napi-derive", "swc_compiler_base/node"] plugin = [ @@ -50,6 +50,8 @@ plugin_transform_host_native = [ # Do not inject tokio runtime while running plugin transforms manual-tokio-runtime = [] +lint = ["swc_ecma_lints"] + [dependencies] anyhow = { workspace = true } base64 = { workspace = true } @@ -74,7 +76,7 @@ url = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", "parking_lot", ] } @@ -83,14 +85,14 @@ swc_config = { version = "3.1.1", path = "../swc_config" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } swc_ecma_ext_transforms = { version = "18.0.0", path = "../swc_ecma_ext_transforms" } -swc_ecma_lints = { version = "19.0.0", path = "../swc_ecma_lints" } +swc_ecma_lints = { version = "19.0.1", path = "../swc_ecma_lints", optional = true } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader", features = [ "cache", "node", "tsc", ] } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_preset_env = { version = "24.0.0", path = "../swc_ecma_preset_env" } swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms", features = [ "compat", @@ -100,7 +102,7 @@ swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms", fea "react", "typescript", ] } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_compat = { version = "21.0.0", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_optimization = { version = "20.0.0", path = "../swc_ecma_transforms_optimization" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } @@ -108,7 +110,7 @@ swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_error_reporters = { version = "15.0.0", path = "../swc_error_reporters" } swc_node_comments = { version = "13.0.0", path = "../swc_node_comments" } swc_plugin_proxy = { version = "13.0.0", path = "../swc_plugin_proxy", optional = true } -swc_plugin_runner = { version = "15.0.0", path = "../swc_plugin_runner", optional = true, default-features = false } +swc_plugin_runner = { version = "15.0.1", path = "../swc_plugin_runner", optional = true, default-features = false } swc_timer = { version = "1.0.0", path = "../swc_timer" } swc_transform_common = { version = "7.0.0", path = "../swc_transform_common" } swc_typescript = { version = "17.0.1", path = "../swc_typescript" } @@ -144,7 +146,7 @@ par-core = { workspace = true, features = ["chili"] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast", features = [ "serde-impl", ] } -swc_ecma_lints = { version = "19.0.0", path = "../swc_ecma_lints", features = [ +swc_ecma_lints = { version = "19.0.1", path = "../swc_ecma_lints", features = [ "non_critical_lints", ] } swc_ecma_testing = { version = "14.0.0", path = "../swc_ecma_testing" } diff --git a/crates/swc/src/config/mod.rs b/crates/swc/src/config/mod.rs index 544ade127381..0b3ea230c88d 100644 --- a/crates/swc/src/config/mod.rs +++ b/crates/swc/src/config/mod.rs @@ -19,7 +19,7 @@ use swc_common::plugin::metadata::TransformPluginMetadataContext; use swc_common::{ comments::{Comments, SingleThreadedComments}, errors::Handler, - FileName, Mark, SourceMap, SyntaxContext, + FileName, Mark, SourceMap, }; pub use swc_compiler_base::SourceMapsConfig; pub use swc_config::is_module::IsModule; @@ -30,6 +30,7 @@ use swc_config::{ }; use swc_ecma_ast::{noop_pass, EsVersion, Expr, Pass, Program}; use swc_ecma_ext_transforms::jest; +#[cfg(feature = "lint")] use swc_ecma_lints::{ config::LintConfig, rules::{lint_pass, LintParams}, @@ -263,6 +264,7 @@ impl Options { paths, minify: mut js_minify, experimental, + #[cfg(feature = "lint")] lints, preserve_all_comments, .. @@ -504,9 +506,6 @@ impl Options { .map(|opts| opts.build(cm, handler, unresolved_mark)) }; - let unresolved_ctxt = SyntaxContext::empty().apply_mark(unresolved_mark); - let top_level_ctxt = SyntaxContext::empty().apply_mark(top_level_mark); - let pass = ( const_modules, optimization, @@ -653,7 +652,6 @@ impl Options { ); let keep_import_attributes = experimental.keep_import_attributes.into_bool(); - let disable_all_lints = experimental.disable_all_lints.into_bool(); #[cfg(feature = "plugin")] let plugin_transforms: Box = { @@ -737,7 +735,24 @@ impl Options { ), DecoratorVersion::V202311 => todo!("2023-11 decorator"), }; - + #[cfg(feature = "lint")] + let lint = { + use swc_common::SyntaxContext; + let disable_all_lints = experimental.disable_all_lints.into_bool(); + let unresolved_ctxt = SyntaxContext::empty().apply_mark(unresolved_mark); + let top_level_ctxt = SyntaxContext::empty().apply_mark(top_level_mark); + Optional::new( + lint_pass(swc_ecma_lints::rules::all(LintParams { + program: &program, + lint_config: &lints, + top_level_ctxt, + unresolved_ctxt, + es_version, + source_map: cm.clone(), + })), + !disable_all_lints, + ) + }; Box::new(( ( if experimental.run_plugin_first.into_bool() { @@ -745,17 +760,8 @@ impl Options { } else { None }, - Optional::new( - lint_pass(swc_ecma_lints::rules::all(LintParams { - program: &program, - lint_config: &lints, - top_level_ctxt, - unresolved_ctxt, - es_version, - source_map: cm.clone(), - })), - !disable_all_lints, - ), + #[cfg(feature = "lint")] + lint, // Decorators may use type information Optional::new(decorator_pass, syntax.decorators()), Optional::new( @@ -1265,6 +1271,7 @@ pub struct JscConfig { pub experimental: JscExperimental, #[serde(default)] + #[cfg(feature = "lint")] pub lints: LintConfig, #[serde(default)] diff --git a/crates/swc_atoms/Cargo.toml b/crates/swc_atoms/Cargo.toml index e8cd78271fc0..c2a12c9f048f 100644 --- a/crates/swc_atoms/Cargo.toml +++ b/crates/swc_atoms/Cargo.toml @@ -27,4 +27,4 @@ rustc-hash = { workspace = true } serde = { workspace = true } shrink-to-fit = { workspace = true, optional = true } -hstr = { version = "1.1.1", path = "../hstr" } +hstr = { version = "1.1.3", path = "../hstr" } diff --git a/crates/swc_bundler/Cargo.toml b/crates/swc_bundler/Cargo.toml index 06a1482d8579..0bb3e3920ec8 100644 --- a/crates/swc_bundler/Cargo.toml +++ b/crates/swc_bundler/Cargo.toml @@ -39,12 +39,12 @@ rustc-hash = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_optimization = { version = "20.0.0", path = "../swc_ecma_transforms_optimization" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -64,7 +64,7 @@ swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader", features = "node", "cache", ] } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier", features = [ "concurrent", ] } swc_ecma_transforms_proposal = { version = "19.0.0", path = "../swc_ecma_transforms_proposal" } diff --git a/crates/swc_cli_impl/Cargo.toml b/crates/swc_cli_impl/Cargo.toml index f538ee71e625..cc37067d87ac 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 = { workspace = true } name = "swc_cli_impl" repository = { workspace = true } -version = "30.0.0" +version = "30.0.1" [[bin]] name = "swc" @@ -28,8 +28,8 @@ anyhow = { workspace = true } clap = { version = "3.2.25", features = ["derive", "wrap_help"] } glob = { workspace = true } par-core = { workspace = true, features = ["chili"] } +par-iter = { workspace = true } path-absolutize = { workspace = true, features = ["once_cell_cache"] } -rayon = { workspace = true } relative-path = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["unbounded_depth"] } @@ -40,7 +40,7 @@ tracing-futures = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } walkdir = { workspace = true } -swc_core = { version = "30.0.1", features = [ +swc_core = { version = "30.1.1", features = [ "trace_macro", "common_concurrent", "base_concurrent", diff --git a/crates/swc_cli_impl/src/commands/compile.rs b/crates/swc_cli_impl/src/commands/compile.rs index 695d46e47a0a..328ecefc0dea 100644 --- a/crates/swc_cli_impl/src/commands/compile.rs +++ b/crates/swc_cli_impl/src/commands/compile.rs @@ -8,8 +8,8 @@ use std::{ use anyhow::Context; use clap::Parser; use glob::glob; +use par_iter::prelude::*; use path_absolutize::Absolutize; -use rayon::prelude::*; use relative_path::RelativePath; use swc_core::{ base::{ diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index 75ee04687009..c8a8a81dd2ed 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -6,7 +6,7 @@ edition = { workspace = true } license = { workspace = true } name = "swc_common" repository = { workspace = true } -version = "13.0.2" +version = "13.0.3" [package.metadata.docs.rs] all-features = true @@ -69,7 +69,7 @@ tracing = { workspace = true } unicode-width = { workspace = true } url = { workspace = true } -ast_node = { version = "3.0.1", path = "../ast_node" } +ast_node = { version = "3.0.2", path = "../ast_node" } better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" } from_variant = { version = "2.0.1", path = "../from_variant" } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } @@ -81,5 +81,5 @@ swc_visit = { version = "2.0.1", path = "../swc_visit" } [dev-dependencies] codspeed-criterion-compat = { workspace = true } criterion = { workspace = true } -rayon = { workspace = true } +par-iter = { workspace = true } serde_json = { workspace = true } diff --git a/crates/swc_common/tests/concurrent.rs b/crates/swc_common/tests/concurrent.rs index 4441c6f5b0af..832374203497 100644 --- a/crates/swc_common/tests/concurrent.rs +++ b/crates/swc_common/tests/concurrent.rs @@ -2,7 +2,7 @@ use std::{env, path::PathBuf, sync::Arc}; -use rayon::prelude::*; +use par_iter::prelude::*; use swc_common::{sync::Lrc, FilePathMapping, SourceFile, SourceMap}; #[test] diff --git a/crates/swc_common/tests/source_map.rs b/crates/swc_common/tests/source_map.rs deleted file mode 100644 index 7a5609ad979e..000000000000 --- a/crates/swc_common/tests/source_map.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![cfg(feature = "concurrent")] - -use rayon::{prelude::*, ThreadPoolBuilder}; -use swc_common::{sync::Lrc, FileName, FilePathMapping, SourceMap}; - -#[test] -fn stress() { - let _ = ThreadPoolBuilder::new().num_threads(100).build_global(); - let fm = SourceMap::new(FilePathMapping::empty()); - - (0..10000).into_par_iter().for_each(|_| { - fm.new_source_file( - Lrc::new(FileName::Anon), - "@Entity() -export class Product extends TimestampedEntity { - @PrimaryGeneratedColumn('uuid') - public id!: string; - - @Column() - public price!: number; - - @Column({ enum: ProductType }) - public type!: ProductType; - - @Column() - public productEntityId!: string; - - /* ANCHOR: Relations ------------------------------------------------------ */ - @OneToMany(() => Order, (order) => order.product) - public orders!: Order[]; - - @OneToMany(() => Discount, (discount) => discount.product) - public discounts!: Discount[]; -}", - ); - }) -} diff --git a/crates/swc_compiler_base/Cargo.toml b/crates/swc_compiler_base/Cargo.toml index be1a31651871..b971a07cc1eb 100644 --- a/crates/swc_compiler_base/Cargo.toml +++ b/crates/swc_compiler_base/Cargo.toml @@ -25,14 +25,14 @@ swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features swc_sourcemap = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_config = { version = "3.1.1", path = "../swc_config" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_timer = { version = "1.0.0", path = "../swc_timer" } diff --git a/crates/swc_core/Cargo.toml b/crates/swc_core/Cargo.toml index 81d337746c98..d5de25450328 100644 --- a/crates/swc_core/Cargo.toml +++ b/crates/swc_core/Cargo.toml @@ -6,7 +6,7 @@ edition = { workspace = true } license = { workspace = true } name = "swc_core" repository = { workspace = true } -version = "30.0.1" +version = "30.1.1" [package.metadata.docs.rs] features = [ "allocator_node", @@ -350,11 +350,11 @@ par-core = { workspace = true, optional = true } # swc_* dependencies binding_macros = { optional = true, version = "29.0.0", path = "../binding_macros" } -swc = { optional = true, version = "29.0.0", path = "../swc" } +swc = { optional = true, version = "29.1.0", path = "../swc" } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } swc_atoms = { optional = true, version = "6.0.0", path = "../swc_atoms" } swc_bundler = { optional = true, version = "23.0.0", path = "../swc_bundler" } -swc_common = { optional = true, version = "13.0.2", path = "../swc_common" } +swc_common = { optional = true, version = "13.0.3", path = "../swc_common" } swc_config = { optional = true, version = "3.1.1", path = "../swc_config" } swc_css_ast = { optional = true, version = "13.0.0", path = "../swc_css_ast" } swc_css_codegen = { optional = true, version = "13.0.0", path = "../swc_css_codegen" } @@ -367,16 +367,16 @@ swc_css_utils = { optional = true, version = "13.0.0", path = swc_css_visit = { optional = true, version = "13.0.0", path = "../swc_css_visit" } swc_ecma_ast = { optional = true, version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { optional = true, version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_lints = { optional = true, version = "19.0.0", path = "../swc_ecma_lints" } +swc_ecma_lints = { optional = true, version = "19.0.1", path = "../swc_ecma_lints" } swc_ecma_loader = { optional = true, version = "13.0.0", path = "../swc_ecma_loader" } -swc_ecma_minifier = { optional = true, version = "24.0.1", path = "../swc_ecma_minifier" } -swc_ecma_parser = { optional = true, version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_minifier = { optional = true, version = "24.0.2", path = "../swc_ecma_minifier" } +swc_ecma_parser = { optional = true, version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_preset_env = { optional = true, version = "24.0.0", path = "../swc_ecma_preset_env" } swc_ecma_quote_macros = { optional = true, version = "18.0.0", path = "../swc_ecma_quote_macros" } swc_ecma_react_compiler = { optional = true, version = "6.0.1", path = "../swc_ecma_react_compiler" } -swc_ecma_transforms_base = { optional = true, version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { optional = true, version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_compat = { optional = true, version = "21.0.0", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_module = { optional = true, version = "21.0.0", path = "../swc_ecma_transforms_module" } +swc_ecma_transforms_module = { optional = true, version = "21.0.1", path = "../swc_ecma_transforms_module" } swc_ecma_transforms_optimization = { optional = true, version = "20.0.0", path = "../swc_ecma_transforms_optimization" } swc_ecma_transforms_proposal = { optional = true, version = "19.0.0", path = "../swc_ecma_transforms_proposal" } swc_ecma_transforms_react = { optional = true, version = "21.0.0", path = "../swc_ecma_transforms_react" } @@ -391,7 +391,7 @@ swc_nodejs_common = { optional = true, version = "1.0.1", path = swc_plugin = { optional = true, version = "1.0.0", path = "../swc_plugin" } swc_plugin_macro = { optional = true, version = "1.1.0", path = "../swc_plugin_macro" } swc_plugin_proxy = { optional = true, version = "13.0.0", path = "../swc_plugin_proxy" } -swc_plugin_runner = { optional = true, version = "15.0.0", path = "../swc_plugin_runner", default-features = false } +swc_plugin_runner = { optional = true, version = "15.0.1", path = "../swc_plugin_runner", default-features = false } swc_trace_macro = { optional = true, version = "2.0.1", path = "../swc_trace_macro" } swc_transform_common = { optional = true, version = "7.0.0", path = "../swc_transform_common" } swc_typescript = { optional = true, version = "17.0.1", path = "../swc_typescript" } diff --git a/crates/swc_css_ast/Cargo.toml b/crates/swc_css_ast/Cargo.toml index 602dffdab64a..a1a718ff4cac 100644 --- a/crates/swc_css_ast/Cargo.toml +++ b/crates/swc_css_ast/Cargo.toml @@ -32,6 +32,6 @@ serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.1", path = "../string_enum/" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } rkyv = { workspace = true, optional = true } diff --git a/crates/swc_css_codegen/Cargo.toml b/crates/swc_css_codegen/Cargo.toml index 7b14be4f2d17..ee8d40857d58 100644 --- a/crates/swc_css_codegen/Cargo.toml +++ b/crates/swc_css_codegen/Cargo.toml @@ -19,13 +19,13 @@ rustc-hash = { workspace = true } serde = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_codegen_macros = { version = "1.0.1", path = "../swc_css_codegen_macros" } swc_css_utils = { version = "13.0.0", path = "../swc_css_utils" } [dev-dependencies] -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_css_parser = { version = "13.0.0", path = "../swc_css_parser" } diff --git a/crates/swc_css_compat/Cargo.toml b/crates/swc_css_compat/Cargo.toml index b21c1e76420a..6af579ac7def 100644 --- a/crates/swc_css_compat/Cargo.toml +++ b/crates/swc_css_compat/Cargo.toml @@ -19,7 +19,7 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_utils = { version = "13.0.0", path = "../swc_css_utils/" } swc_css_visit = { version = "13.0.0", path = "../swc_css_visit" } diff --git a/crates/swc_css_lints/Cargo.toml b/crates/swc_css_lints/Cargo.toml index ebb0dfc84953..bfcc0f9961ba 100644 --- a/crates/swc_css_lints/Cargo.toml +++ b/crates/swc_css_lints/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = { workspace = true } name = "swc_css_lints" repository = { workspace = true } -version = "14.0.0" +version = "14.0.1" [lib] bench = false @@ -15,14 +15,14 @@ bench = false [dependencies] anyhow = { workspace = true } auto_impl = { workspace = true } +par-iter = { workspace = true } parking_lot = { workspace = true } -rayon = { workspace = true } rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } thiserror = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config", features = ["regex"] } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_visit = { version = "13.0.0", path = "../swc_css_visit" } diff --git a/crates/swc_css_lints/src/rule.rs b/crates/swc_css_lints/src/rule.rs index 8afb17035d35..08b5f137b26f 100644 --- a/crates/swc_css_lints/src/rule.rs +++ b/crates/swc_css_lints/src/rule.rs @@ -1,8 +1,8 @@ use std::{fmt::Debug, sync::Arc}; use auto_impl::auto_impl; +use par_iter::prelude::*; use parking_lot::Mutex; -use rayon::prelude::*; use serde::Serialize; use swc_common::{ errors::{Diagnostic, DiagnosticBuilder, Emitter, Handler, HANDLER}, diff --git a/crates/swc_css_minifier/Cargo.toml b/crates/swc_css_minifier/Cargo.toml index e1b1785cf7b9..1d0c404c90a2 100644 --- a/crates/swc_css_minifier/Cargo.toml +++ b/crates/swc_css_minifier/Cargo.toml @@ -17,7 +17,7 @@ rustc-hash = { workspace = true } serde = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_utils = { version = "13.0.0", path = "../swc_css_utils/" } swc_css_visit = { version = "13.0.0", path = "../swc_css_visit" } diff --git a/crates/swc_css_modules/Cargo.toml b/crates/swc_css_modules/Cargo.toml index 777862733f3d..7d26f6cc3cf5 100644 --- a/crates/swc_css_modules/Cargo.toml +++ b/crates/swc_css_modules/Cargo.toml @@ -19,7 +19,7 @@ rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_codegen = { version = "13.0.0", path = "../swc_css_codegen" } swc_css_parser = { version = "13.0.0", path = "../swc_css_parser" } diff --git a/crates/swc_css_parser/Cargo.toml b/crates/swc_css_parser/Cargo.toml index 0669b936a061..d6617eee55ee 100644 --- a/crates/swc_css_parser/Cargo.toml +++ b/crates/swc_css_parser/Cargo.toml @@ -20,7 +20,7 @@ lexical = { workspace = true } serde = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } [dev-dependencies] diff --git a/crates/swc_css_prefixer/Cargo.toml b/crates/swc_css_prefixer/Cargo.toml index 95b205e32104..844ed8269fc7 100644 --- a/crates/swc_css_prefixer/Cargo.toml +++ b/crates/swc_css_prefixer/Cargo.toml @@ -20,7 +20,7 @@ serde_json = { workspace = true } preset_env_base = { version = "4.0.0", path = "../preset_env_base" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_utils = { version = "13.0.0", path = "../swc_css_utils/" } swc_css_visit = { version = "13.0.0", path = "../swc_css_visit" } diff --git a/crates/swc_css_utils/Cargo.toml b/crates/swc_css_utils/Cargo.toml index ba7bc9a47e83..e2ebeb727682 100644 --- a/crates/swc_css_utils/Cargo.toml +++ b/crates/swc_css_utils/Cargo.toml @@ -19,6 +19,6 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_css_visit = { version = "13.0.0", path = "../swc_css_visit" } diff --git a/crates/swc_css_visit/Cargo.toml b/crates/swc_css_visit/Cargo.toml index 1821b1649f6f..1255a83de6d4 100644 --- a/crates/swc_css_visit/Cargo.toml +++ b/crates/swc_css_visit/Cargo.toml @@ -24,6 +24,6 @@ serde-impl = ["serde"] serde = { workspace = true, optional = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast" } swc_visit = { version = "2.0.1", path = "../swc_visit" } diff --git a/crates/swc_ecma_ast/Cargo.toml b/crates/swc_ecma_ast/Cargo.toml index d70f007c878f..eda69e8f52a2 100644 --- a/crates/swc_ecma_ast/Cargo.toml +++ b/crates/swc_ecma_ast/Cargo.toml @@ -53,7 +53,7 @@ unicode-id-start = { workspace = true } string_enum = { version = "1.0.1", path = "../string_enum" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_visit = { version = "2.0.1", path = "../swc_visit" } [dev-dependencies] diff --git a/crates/swc_ecma_codegen/Cargo.toml b/crates/swc_ecma_codegen/Cargo.toml index 6ea14ee4f29e..572e32d61f19 100644 --- a/crates/swc_ecma_codegen/Cargo.toml +++ b/crates/swc_ecma_codegen/Cargo.toml @@ -33,7 +33,7 @@ swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features "hashbrown", ] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen_macros = { version = "2.0.1", path = "../swc_ecma_codegen_macros" } @@ -44,10 +44,10 @@ criterion = { workspace = true } serde_json = { workspace = true } swc_allocator = { version = "4.0.0", path = "../swc_allocator" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_testing = { version = "14.0.0", path = "../swc_ecma_testing" } swc_malloc = { version = "1.2.3", path = "../swc_malloc" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_compat_bugfixes/Cargo.toml b/crates/swc_ecma_compat_bugfixes/Cargo.toml index c2eb01342b33..28efde745885 100644 --- a/crates/swc_ecma_compat_bugfixes/Cargo.toml +++ b/crates/swc_ecma_compat_bugfixes/Cargo.toml @@ -15,14 +15,14 @@ rustc-hash = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_es2015 = { version = "20.0.0", path = "../swc_ecma_compat_es2015" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_common/Cargo.toml b/crates/swc_ecma_compat_common/Cargo.toml index 12e8a48d9769..8f60314a4b97 100644 --- a/crates/swc_ecma_compat_common/Cargo.toml +++ b/crates/swc_ecma_compat_common/Cargo.toml @@ -12,7 +12,7 @@ version = "18.0.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_compat_es2015/Cargo.toml b/crates/swc_ecma_compat_es2015/Cargo.toml index 4c862552c4df..aae39e172aa0 100644 --- a/crates/swc_ecma_compat_es2015/Cargo.toml +++ b/crates/swc_ecma_compat_es2015/Cargo.toml @@ -23,11 +23,11 @@ smallvec = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_common = { version = "18.0.0", path = "../swc_ecma_compat_common" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "19.0.0", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } @@ -36,5 +36,5 @@ swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } tracing = { workspace = true } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2016/Cargo.toml b/crates/swc_ecma_compat_es2016/Cargo.toml index 13dd053ace33..018e272c8b73 100644 --- a/crates/swc_ecma_compat_es2016/Cargo.toml +++ b/crates/swc_ecma_compat_es2016/Cargo.toml @@ -14,9 +14,9 @@ version = "19.0.0" [dependencies] swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -24,5 +24,5 @@ swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } tracing = { workspace = true } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2017/Cargo.toml b/crates/swc_ecma_compat_es2017/Cargo.toml index e1425e3c8eb6..a86db6aa4a93 100644 --- a/crates/swc_ecma_compat_es2017/Cargo.toml +++ b/crates/swc_ecma_compat_es2017/Cargo.toml @@ -17,14 +17,14 @@ serde = { workspace = true, features = ["derive"] } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2018/Cargo.toml b/crates/swc_ecma_compat_es2018/Cargo.toml index e1fdf263751b..e61771f0c0fd 100644 --- a/crates/swc_ecma_compat_es2018/Cargo.toml +++ b/crates/swc_ecma_compat_es2018/Cargo.toml @@ -17,15 +17,15 @@ serde = { workspace = true, features = ["derive"] } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_common = { version = "18.0.0", path = "../swc_ecma_compat_common" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2019/Cargo.toml b/crates/swc_ecma_compat_es2019/Cargo.toml index 3a861ca1f51c..5ed34097f885 100644 --- a/crates/swc_ecma_compat_es2019/Cargo.toml +++ b/crates/swc_ecma_compat_es2019/Cargo.toml @@ -17,13 +17,13 @@ tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2020/Cargo.toml b/crates/swc_ecma_compat_es2020/Cargo.toml index d7164ba99177..6a4aa9a5ab87 100644 --- a/crates/swc_ecma_compat_es2020/Cargo.toml +++ b/crates/swc_ecma_compat_es2020/Cargo.toml @@ -15,15 +15,15 @@ version = "20.0.0" [dependencies] serde = { workspace = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_es2022 = { version = "20.0.0", path = "../swc_ecma_compat_es2022" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } tracing = { workspace = true } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_compat_es2021/Cargo.toml b/crates/swc_ecma_compat_es2021/Cargo.toml index 2b53e7131e34..58f1e2a6efbc 100644 --- a/crates/swc_ecma_compat_es2021/Cargo.toml +++ b/crates/swc_ecma_compat_es2021/Cargo.toml @@ -16,9 +16,9 @@ version = "19.0.0" tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } diff --git a/crates/swc_ecma_compat_es2022/Cargo.toml b/crates/swc_ecma_compat_es2022/Cargo.toml index d395e0214b0d..e1d52c2e109e 100644 --- a/crates/swc_ecma_compat_es2022/Cargo.toml +++ b/crates/swc_ecma_compat_es2022/Cargo.toml @@ -18,10 +18,10 @@ tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_common = { version = "18.0.0", path = "../swc_ecma_compat_common" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "19.0.0", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } diff --git a/crates/swc_ecma_compat_es3/Cargo.toml b/crates/swc_ecma_compat_es3/Cargo.toml index 783f5ca15b08..3280b21d1dc8 100644 --- a/crates/swc_ecma_compat_es3/Cargo.toml +++ b/crates/swc_ecma_compat_es3/Cargo.toml @@ -15,13 +15,13 @@ version = "19.0.0" [dependencies] tracing = { workspace = true } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_ext_transforms/Cargo.toml b/crates/swc_ecma_ext_transforms/Cargo.toml index 3f32b594d516..833e0d6e3df2 100644 --- a/crates/swc_ecma_ext_transforms/Cargo.toml +++ b/crates/swc_ecma_ext_transforms/Cargo.toml @@ -15,7 +15,7 @@ bench = false phf = { workspace = true, features = ["macros"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_lexer/Cargo.toml b/crates/swc_ecma_lexer/Cargo.toml index 606d857e4488..f2c67cbc311c 100644 --- a/crates/swc_ecma_lexer/Cargo.toml +++ b/crates/swc_ecma_lexer/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = { workspace = true } name = "swc_ecma_lexer" repository = { workspace = true } -version = "18.0.0" +version = "18.0.1" [package.metadata.docs.rs] all-features = true @@ -40,10 +40,9 @@ serde = { workspace = true, features = ["derive"] } smallvec = { workspace = true } smartstring = { workspace = true } tracing = { workspace = true } -typed-arena = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit", optional = true } diff --git a/crates/swc_ecma_lexer/src/common/parser/expr.rs b/crates/swc_ecma_lexer/src/common/parser/expr.rs index 8ab7bd9f6094..870fd34cb2dd 100644 --- a/crates/swc_ecma_lexer/src/common/parser/expr.rs +++ b/crates/swc_ecma_lexer/src/common/parser/expr.rs @@ -27,6 +27,7 @@ use crate::{ object::parse_object_expr, pat::{parse_paren_items_as_params, reparse_expr_as_pat}, pat_type::PatType, + token_and_span::TokenAndSpan, typescript::*, unwrap_ts_non_null, }, @@ -1499,12 +1500,16 @@ fn parse_bin_op_recursively_inner<'a, P: Parser<'a>>( /// spec: 'UnaryExpression' pub(crate) fn parse_unary_expr<'a, P: Parser<'a>>(p: &mut P) -> PResult> { trace_cur!(p, parse_unary_expr); - let start = p.cur_pos(); - if !p.input().syntax().jsx() - && p.input().syntax().typescript() - && p.input_mut().eat(&P::Token::LESS) - { + p.input_mut().cur(); + let Some(token_and_span) = p.input().get_cur() else { + syntax_error!(p, p.input().cur_span(), SyntaxError::TS1109); + }; + let start = token_and_span.span().lo; + let cur = token_and_span.token(); + + if !p.input().syntax().jsx() && p.input().syntax().typescript() && cur.is_less() { + p.bump(); // consume `<` if p.input_mut().eat(&P::Token::CONST) { expect!(p, &P::Token::GREATER); let expr = p.parse_unary_expr()?; @@ -1518,10 +1523,8 @@ pub(crate) fn parse_unary_expr<'a, P: Parser<'a>>(p: &mut P) -> PResult>(p: &mut P) -> PResult>(p: &mut P) -> PResult>(p: &mut P) -> PResult>(p: &mut P) -> PResult { - let start = p.cur_pos(); - let Some(cur) = p.input_mut().cur() else { + p.input_mut().cur(); + let Some(token_and_span) = p.input().get_cur() else { return Err(eof_error(p)); }; + let start = token_and_span.span().lo; + let cur = token_and_span.token(); let w = if cur.is_word() { let t = p.bump(); t.take_word(p.input_mut()).unwrap() @@ -147,81 +153,81 @@ pub fn parse_ident<'a>( ) -> PResult { trace_cur!(p, parse_ident); - let start = p.cur_pos(); + p.input_mut().cur(); + let Some(token_and_span) = p.input().get_cur() else { + return Err(eof_error(p)); + }; + if !token_and_span.token().is_word() { + syntax_error!(p, SyntaxError::ExpectedIdent) + } + let start = token_and_span.span().lo; + let t = p.bump(); + + // Spec: + // It is a Syntax Error if this phrase is contained in strict mode code and the + // StringValue of IdentifierName is: "implements", "interface", "let", + // "package", "private", "protected", "public", "static", or "yield". + if t.is_enum() { + p.emit_err( + p.input().prev_span(), + SyntaxError::InvalidIdentInStrict(t.clone().take_word(p.input()).unwrap()), + ); + } else if t.is_yield() + || t.is_let() + || t.is_static() + || t.is_implements() + || t.is_interface() + || t.is_package() + || t.is_private() + || t.is_protected() + || t.is_public() + { + p.emit_strict_mode_err( + p.input().prev_span(), + SyntaxError::InvalidIdentInStrict(t.clone().take_word(p.input()).unwrap()), + ); + }; - let word = p.parse_with(|p| { - let Some(t) = p.input_mut().cur() else { - return Err(eof_error(p)); - }; - if !t.is_word() { - syntax_error!(p, SyntaxError::ExpectedIdent) - } - let t = p.bump(); + let word; - // Spec: - // It is a Syntax Error if this phrase is contained in strict mode code and the - // StringValue of IdentifierName is: "implements", "interface", "let", - // "package", "private", "protected", "public", "static", or "yield". - if t.is_enum() { - p.emit_err( - p.input().prev_span(), - SyntaxError::InvalidIdentInStrict(t.clone().take_word(p.input()).unwrap()), - ); - } else if t.is_yield() - || t.is_let() - || t.is_static() - || t.is_implements() - || t.is_interface() - || t.is_package() - || t.is_private() - || t.is_protected() - || t.is_public() - { - p.emit_strict_mode_err( - p.input().prev_span(), - SyntaxError::InvalidIdentInStrict(t.clone().take_word(p.input()).unwrap()), - ); - }; - - // Spec: - // It is a Syntax Error if StringValue of IdentifierName is the same String - // value as the StringValue of any ReservedWord except for yield or await. - if t.is_await() { - let ctx = p.ctx(); - if ctx.contains(Context::InDeclare) { - Ok(atom!("await")) - } else if ctx.contains(Context::InStaticBlock) { - syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) - } else if ctx.contains(Context::Module) | ctx.contains(Context::InAsync) { - syntax_error!(p, p.input().prev_span(), SyntaxError::InvalidIdentInAsync) - } else if incl_await { - Ok(atom!("await")) - } else { - syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) - } - } else if t.is_this() && p.input().syntax().typescript() { - Ok(atom!("this")) - } else if t.is_let() { - Ok(atom!("let")) - } else if t.is_known_ident() { - let ident = t.take_known_ident(); - Ok(ident) - } else if t.is_unknown_ident() { - let ident = t.take_unknown_ident(p.input_mut()); - if p.ctx().contains(Context::InClassField) && ident == atom!("arguments") { - p.emit_err(p.input().prev_span(), SyntaxError::ArgumentsInClassField) - } - Ok(ident) - } else if t.is_yield() && incl_yield { - Ok(atom!("yield")) - } else if t.is_null() || t.is_true() || t.is_false() { - syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) - } else if t.is_keyword() { + // Spec: + // It is a Syntax Error if StringValue of IdentifierName is the same String + // value as the StringValue of any ReservedWord except for yield or await. + if t.is_await() { + let ctx = p.ctx(); + if ctx.contains(Context::InDeclare) { + word = atom!("await"); + } else if ctx.contains(Context::InStaticBlock) { syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) + } else if ctx.contains(Context::Module) | ctx.contains(Context::InAsync) { + syntax_error!(p, p.input().prev_span(), SyntaxError::InvalidIdentInAsync) + } else if incl_await { + word = atom!("await") } else { - unreachable!() + syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) + } + } else if t.is_this() && p.input().syntax().typescript() { + word = atom!("this") + } else if t.is_let() { + word = atom!("let") + } else if t.is_known_ident() { + let ident = t.take_known_ident(); + word = ident + } else if t.is_unknown_ident() { + let ident = t.take_unknown_ident(p.input_mut()); + if p.ctx().contains(Context::InClassField) && ident == atom!("arguments") { + p.emit_err(p.input().prev_span(), SyntaxError::ArgumentsInClassField) } - })?; + word = ident + } else if t.is_yield() && incl_yield { + word = atom!("yield") + } else if t.is_null() || t.is_true() || t.is_false() { + syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) + } else if t.is_keyword() { + syntax_error!(p, p.input().prev_span(), SyntaxError::ExpectedIdent) + } else { + unreachable!() + } Ok(Ident::new_no_ctxt(word, p.span(start))) } diff --git a/crates/swc_ecma_lexer/src/common/parser/stmt.rs b/crates/swc_ecma_lexer/src/common/parser/stmt.rs index 114e9a231ac9..0a875621c3b0 100644 --- a/crates/swc_ecma_lexer/src/common/parser/stmt.rs +++ b/crates/swc_ecma_lexer/src/common/parser/stmt.rs @@ -2,7 +2,6 @@ use std::ops::DerefMut; use swc_common::{BytePos, Span, Spanned}; use swc_ecma_ast::*; -use typed_arena::Arena; use super::{ buffer::Buffer, @@ -1383,17 +1382,20 @@ pub(super) fn parse_block_body<'a, P: Parser<'a>, Type: IsDirective + From let old_ctx = p.ctx(); - let stmts = Arena::new(); + let mut stmts = Vec::with_capacity(8); while { - if p.input_mut().cur().is_none() && end.is_some() { - let eof_text = p.input_mut().dump_cur(); - p.emit_err( - p.input().cur_span(), - SyntaxError::Expected(format!("{:?}", end.unwrap()), eof_text), - ); - false - } else { - p.input_mut().cur() != end + match (p.input_mut().cur(), end) { + (Some(cur), Some(end)) => cur != end, + (Some(_), None) => true, + (None, None) => false, + (None, Some(_)) => { + let eof_text = p.input_mut().dump_cur(); + p.emit_err( + p.input().cur_span(), + SyntaxError::Expected(format!("{:?}", end.unwrap()), eof_text), + ); + false + } } } { let stmt = parse_stmt_like(p, true, &handle_import_export)?; @@ -1411,7 +1413,7 @@ pub(super) fn parse_block_body<'a, P: Parser<'a>, Type: IsDirective + From } } - stmts.alloc(stmt); + stmts.push(stmt); } if p.input_mut().cur().is_some() && end.is_some() { @@ -1420,5 +1422,5 @@ pub(super) fn parse_block_body<'a, P: Parser<'a>, Type: IsDirective + From p.set_ctx(old_ctx); - Ok(stmts.into_vec()) + Ok(stmts) } diff --git a/crates/swc_ecma_lints/Cargo.toml b/crates/swc_ecma_lints/Cargo.toml index b0be9e47fea5..cd818becfae6 100644 --- a/crates/swc_ecma_lints/Cargo.toml +++ b/crates/swc_ecma_lints/Cargo.toml @@ -6,7 +6,7 @@ include = ["Cargo.toml", "src/**/*.rs"] license = { workspace = true } name = "swc_ecma_lints" repository = { workspace = true } -version = "19.0.0" +version = "19.0.1" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [lib] @@ -22,7 +22,7 @@ rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "concurrent", ] } swc_config = { version = "3.1.1", path = "../swc_config" } @@ -38,9 +38,9 @@ codspeed-criterion-compat = { workspace = true } criterion = { workspace = true } pretty_assertions = { workspace = true } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_testing = { version = "14.0.0", path = "../swc_ecma_testing" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_malloc = { version = "1.2.3", path = "../swc_malloc" } testing = { version = "14.0.0", path = "../testing" } walkdir = { workspace = true } diff --git a/crates/swc_ecma_lints/src/rules/const_assign.rs b/crates/swc_ecma_lints/src/rules/const_assign.rs deleted file mode 100644 index 75d69871f038..000000000000 --- a/crates/swc_ecma_lints/src/rules/const_assign.rs +++ /dev/null @@ -1,227 +0,0 @@ -use rustc_hash::FxHashMap; -use swc_common::{errors::HANDLER, Span}; -use swc_ecma_ast::*; -use swc_ecma_utils::parallel::{cpu_count, Parallel, ParallelExt}; -use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; - -use crate::rule::Rule; - -pub fn const_assign() -> Box { - Box::new(ConstAssignRule) -} - -#[derive(Debug)] -struct ConstAssignRule; - -impl Rule for ConstAssignRule { - fn lint_module(&mut self, program: &Module) { - let mut const_vars = FxHashMap::default(); - let mut import_binding = FxHashMap::default(); - - program.visit_children_with(&mut Collector { - const_vars: &mut const_vars, - import_binding: &mut import_binding, - var_decl_kind: None, - }); - - program.visit_children_with(&mut ConstAssign { - const_vars: &const_vars, - import_binding: &import_binding, - is_pat_decl: false, - }); - } - - fn lint_script(&mut self, program: &Script) { - let mut const_vars = FxHashMap::default(); - let mut import_binding = FxHashMap::default(); - - program.visit_children_with(&mut Collector { - const_vars: &mut const_vars, - // I don't believe that import stmt exists in Script - // But it's ok. Let's pass it in. - import_binding: &mut import_binding, - var_decl_kind: None, - }); - - program.visit_children_with(&mut ConstAssign { - const_vars: &const_vars, - import_binding: &import_binding, - is_pat_decl: false, - }); - } -} - -#[derive(Clone, Copy)] -struct ConstAssign<'a> { - const_vars: &'a FxHashMap, - import_binding: &'a FxHashMap, - - is_pat_decl: bool, -} - -impl Parallel for ConstAssign<'_> { - fn create(&self) -> Self { - *self - } - - fn merge(&mut self, _: Self) {} -} - -impl ConstAssign<'_> { - fn check(&mut self, id: &Ident) { - if self.is_pat_decl { - return; - } - - if let Some(&decl_span) = self.const_vars.get(&id.to_id()) { - HANDLER.with(|handler| { - handler - .struct_span_err( - id.span, - "cannot reassign to a variable declared with `const`", - ) - .span_label(decl_span, "const variable was declared here") - .span_suggestion( - decl_span, - "consider making this variable mutable", - format!("let {}", id.sym), - ) - .span_label(id.span, "cannot reassign") - .emit(); - }); - } - - if let Some(&binding_span) = self.import_binding.get(&id.to_id()) { - HANDLER.with(|handler| { - handler - .struct_span_err(id.span, "cannot reassign to an imported binding") - .span_label(binding_span, "imported binding") - .emit(); - }); - } - } -} - -impl Visit for ConstAssign<'_> { - noop_visit_type!(); - - fn visit_binding_ident(&mut self, n: &BindingIdent) { - self.check(&Ident::from(n)); - } - - fn visit_class_members(&mut self, members: &[ClassMember]) { - self.maybe_par(cpu_count(), members, |v, member| { - member.visit_with(v); - }); - } - - fn visit_expr_or_spreads(&mut self, n: &[ExprOrSpread]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_exprs(&mut self, exprs: &[Box]) { - self.maybe_par(cpu_count(), exprs, |v, expr| { - expr.visit_with(v); - }); - } - - fn visit_module_items(&mut self, items: &[ModuleItem]) { - self.maybe_par(cpu_count(), items, |v, item| { - item.visit_with(v); - }); - } - - fn visit_opt_vec_expr_or_spreads(&mut self, n: &[Option]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_prop_or_spreads(&mut self, n: &[PropOrSpread]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_stmts(&mut self, stmts: &[Stmt]) { - self.maybe_par(cpu_count(), stmts, |v, stmt| { - stmt.visit_with(v); - }); - } - - fn visit_update_expr(&mut self, n: &UpdateExpr) { - n.visit_children_with(self); - - if let Expr::Ident(ident) = &*n.arg { - self.check(ident); - } - } - - fn visit_var_declarator(&mut self, var_declarator: &VarDeclarator) { - let old_is_pat_decl = self.is_pat_decl; - self.is_pat_decl = true; - var_declarator.name.visit_with(self); - self.is_pat_decl = old_is_pat_decl; - - var_declarator.init.visit_with(self); - } -} - -struct Collector<'a> { - const_vars: &'a mut FxHashMap, - import_binding: &'a mut FxHashMap, - - var_decl_kind: Option, -} - -impl Visit for Collector<'_> { - noop_visit_type!(); - - fn visit_import_specifier(&mut self, n: &ImportSpecifier) { - match n { - ImportSpecifier::Named(ImportNamedSpecifier { local, .. }) - | ImportSpecifier::Default(ImportDefaultSpecifier { local, .. }) - | ImportSpecifier::Namespace(ImportStarAsSpecifier { local, .. }) => { - self.import_binding.insert(local.to_id(), local.span); - } - } - } - - fn visit_assign_pat_prop(&mut self, p: &AssignPatProp) { - p.visit_children_with(self); - - if let Some(VarDeclKind::Const) = self.var_decl_kind { - *self.const_vars.entry(p.key.to_id()).or_default() = p.span; - } - } - - fn visit_expr(&mut self, e: &Expr) { - let old_var_decl_kind = self.var_decl_kind; - self.var_decl_kind = None; - - e.visit_children_with(self); - - self.var_decl_kind = old_var_decl_kind; - } - - fn visit_pat(&mut self, p: &Pat) { - p.visit_children_with(self); - - if let Some(VarDeclKind::Const) = self.var_decl_kind { - if let Pat::Ident(i) = p { - *self.const_vars.entry(i.to_id()).or_default() = i.span; - } - } - } - - fn visit_var_decl(&mut self, var_decl: &VarDecl) { - let old_var_decl_kind = self.var_decl_kind; - self.var_decl_kind = Some(var_decl.kind); - - var_decl.visit_children_with(self); - - self.var_decl_kind = old_var_decl_kind; - } -} diff --git a/crates/swc_ecma_lints/src/rules/critical_rules.rs b/crates/swc_ecma_lints/src/rules/critical_rules.rs new file mode 100644 index 000000000000..5abea66d21f6 --- /dev/null +++ b/crates/swc_ecma_lints/src/rules/critical_rules.rs @@ -0,0 +1,775 @@ +use std::collections::hash_map::Entry; + +use rustc_hash::{FxHashMap, FxHashSet}; +use swc_atoms::{atom, Atom}; +use swc_common::{errors::HANDLER, Span, SyntaxContext}; +use swc_ecma_ast::*; +use swc_ecma_utils::for_each_binding_ident; +use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; + +use crate::rule::Rule; + +// Helper macro for checking duplicate arguments +macro_rules! check_dupe_args { + ($node:expr) => {{ + // This vector allocates only if there are duplicate parameters. + // This is used to handle the case where the same parameter is used 3 or more + // times. + let mut done = Vec::new(); + + let mut hash_mode = false; + + let mut i1 = 0; + for_each_binding_ident($node, |id1| { + i1 += 1; + + if !hash_mode { + let mut i2 = 0; + for_each_binding_ident($node, |id2| { + i2 += 1; + + if hash_mode { + return; + } else if i2 >= 100 { + // While iterating for the first `id1`, we detect that there are more than + // 100 identifiers. We switch to hash mode. + hash_mode = true; + } + + if i1 >= i2 || done.contains(&i1) { + return; + } + + if id1.ctxt == id2.ctxt && id1.sym == id2.sym { + done.push(i1); + + emit_dupe_args_error(id1, id2); + } + }); + } + }); + + if hash_mode { + let mut map = FxHashMap::default(); + + for_each_binding_ident($node, |id| { + // + match map.entry((id.sym.clone(), id.ctxt)) { + Entry::Occupied(v) => { + emit_dupe_args_error(v.get(), id); + } + + Entry::Vacant(v) => { + v.insert(id.clone()); + } + } + }); + } + }}; +} + +pub fn critical_rules() -> Box { + Box::new(CriticalRules::default()) +} + +#[derive(Debug, Default)] +struct CriticalRules { + // For const_assign + const_vars: FxHashMap, + import_binding: FxHashMap, + + // For duplicate_bindings + bindings: FxHashMap, + type_bindings: FxHashSet, + + // For duplicate_exports + exports: FxHashMap, + export_assign: Option, + + // Shared state + var_decl_kind: Option, + is_pat_decl: bool, + lexical_function: bool, +} + +#[derive(Debug, Default, Clone, Copy)] +struct BindingInfo { + span: Span, + ctxt: SyntaxContext, + unique: bool, + is_function: bool, +} + +impl Rule for CriticalRules { + fn lint_module(&mut self, program: &Module) { + // First pass: collect type bindings and const variables + program.visit_with(&mut TypeCollector { + type_bindings: &mut self.type_bindings, + }); + + let mut const_collector = ConstCollector { + const_vars: &mut self.const_vars, + import_binding: &mut self.import_binding, + var_decl_kind: None, + }; + program.visit_children_with(&mut const_collector); + + // Reset state and do main visit + self.lexical_function = true; + self.visit_module(program); + } + + fn lint_script(&mut self, program: &Script) { + // First pass: collect type bindings and const variables + program.visit_with(&mut TypeCollector { + type_bindings: &mut self.type_bindings, + }); + + let mut const_collector = ConstCollector { + const_vars: &mut self.const_vars, + import_binding: &mut self.import_binding, + var_decl_kind: None, + }; + program.visit_children_with(&mut const_collector); + + // Reset state and do main visit + self.visit_script(program); + } +} + +impl CriticalRules { + // Helper methods from duplicate_bindings + fn add_binding(&mut self, id: Atom, info: BindingInfo) { + match self.bindings.entry((id.clone(), info.ctxt)) { + Entry::Occupied(mut prev) => { + if !(info.is_function && prev.get().is_function) + && (info.unique || prev.get().unique) + { + emit_duplicate_binding_error(&id, info.span, prev.get().span); + } + + if info.unique || !prev.get().unique { + *prev.get_mut() = info + } + } + Entry::Vacant(e) => { + e.insert(info); + } + } + } + + fn is_unique_var_kind(&self) -> bool { + matches!( + self.var_decl_kind, + Some(VarDeclKind::Const) | Some(VarDeclKind::Let) + ) + } + + fn visit_with_kind>(&mut self, e: &V, kind: Option) { + let old_var_decl_kind = self.var_decl_kind.take(); + let old_is_pat_decl = self.is_pat_decl; + + self.var_decl_kind = kind; + self.is_pat_decl = true; + + e.visit_children_with(self); + + self.is_pat_decl = old_is_pat_decl; + self.var_decl_kind = old_var_decl_kind; + } + + fn visit_with_stmt_like, F: Fn(&T) -> Option>( + &mut self, + s: &[T], + get_fn_ident: F, + ) { + let mut fn_name = FxHashMap::default(); + for s in s { + if let Some(ident) = get_fn_ident(s) { + if let Some(prev) = fn_name.get(&ident.sym) { + emit_duplicate_binding_error(&ident.sym, ident.span, *prev) + } else { + fn_name.insert(ident.sym.clone(), ident.span); + } + } + + s.visit_with(self); + } + } + + fn visit_with_stmts(&mut self, s: &[Stmt], lexical_function: bool) { + let old = self.lexical_function; + self.lexical_function = lexical_function; + + if lexical_function { + self.visit_with_stmt_like(s, |s| match s { + Stmt::Decl(Decl::Fn(FnDecl { + ident, function: f, .. + })) if f.body.is_some() => Some(ident.clone()), + _ => None, + }); + } else { + s.visit_children_with(self); + } + self.lexical_function = old; + } + + // Helper methods from duplicate_exports + fn add_export(&mut self, id: &Ident) { + match self.exports.entry(id.sym.clone()) { + Entry::Occupied(mut prev) => { + let name = &id.sym; + + HANDLER.with(|handler| { + handler + .struct_span_err( + id.span, + &format!("the name `{name}` is exported multiple times"), + ) + .span_label(*prev.get(), "previous exported here") + .span_label(id.span, "exported more than once") + .note("Exported identifiers must be unique") + .emit(); + }); + + *prev.get_mut() = id.span; + } + Entry::Vacant(e) => { + e.insert(id.span); + } + } + + self.check_no_coexist(); + } + + fn add_export_assign(&mut self, span: Span) { + if let Some(prev_span) = self.export_assign { + HANDLER.with(|handler| { + handler + .struct_span_err(span, "multiple `export =` found") + .span_label(prev_span, "previous `export =` declared here") + .emit() + }); + } + + self.export_assign = Some(span); + + self.check_no_coexist(); + } + + fn check_no_coexist(&self) { + if let Some(span) = self.export_assign { + if !self.exports.is_empty() { + HANDLER.with(|handler| { + handler + .struct_span_err(span, r#"An export assignment cannot be used in a module with other exported elements."#) + .emit() + }); + } + } + } + + // Helper methods from const_assign + fn check_const_assign(&self, id: &Ident) { + if self.is_pat_decl { + return; + } + + if let Some(&decl_span) = self.const_vars.get(&id.to_id()) { + HANDLER.with(|handler| { + handler + .struct_span_err( + id.span, + "cannot reassign to a variable declared with `const`", + ) + .span_label(decl_span, "const variable was declared here") + .span_suggestion( + decl_span, + "consider making this variable mutable", + format!("let {}", id.sym), + ) + .span_label(id.span, "cannot reassign") + .emit(); + }); + } + + if let Some(&binding_span) = self.import_binding.get(&id.to_id()) { + HANDLER.with(|handler| { + handler + .struct_span_err(id.span, "cannot reassign to an imported binding") + .span_label(binding_span, "imported binding") + .emit(); + }); + } + } +} + +impl Visit for CriticalRules { + noop_visit_type!(); + + // Visit methods for all rules combined + + fn visit_module(&mut self, m: &Module) { + self.lexical_function = true; + + self.visit_with_stmt_like(&m.body, |s| match s { + ModuleItem::Stmt(Stmt::Decl(Decl::Fn(FnDecl { + ident, function: f, .. + }))) + | ModuleItem::ModuleDecl( + ModuleDecl::ExportDecl(ExportDecl { + decl: + Decl::Fn(FnDecl { + ident, function: f, .. + }), + .. + }) + | ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { + decl: + DefaultDecl::Fn(FnExpr { + ident: Some(ident), + function: f, + }), + .. + }), + ) if f.body.is_some() => Some(ident.clone()), + _ => None, + }); + } + + fn visit_script(&mut self, s: &Script) { + s.body.visit_children_with(self); + } + + fn visit_arrow_expr(&mut self, a: &ArrowExpr) { + // Check for duplicate args + check_dupe_args!(&a.params); + + let ArrowExpr { params, body, .. } = a; + params.visit_with(self); + if let BlockStmtOrExpr::BlockStmt(b) = &**body { + self.visit_with_stmts(&b.stmts, false) + } + } + + fn visit_function(&mut self, f: &Function) { + // Check for duplicate args + check_dupe_args!(&f.params); + + let Function { + body, + params, + decorators, + .. + } = f; + params.visit_with(self); + decorators.visit_with(self); + if let Some(body) = body { + self.visit_with_stmts(&body.stmts, false) + } + } + + fn visit_constructor(&mut self, f: &Constructor) { + // Check for duplicate args + check_dupe_args!(&f.params); + + f.visit_children_with(self); + } + + fn visit_var_decl(&mut self, d: &VarDecl) { + if d.declare { + return; + } + + self.visit_with_kind(d, Some(d.kind)) + } + + fn visit_var_declarator(&mut self, var_declarator: &VarDeclarator) { + let old_is_pat_decl = self.is_pat_decl; + self.is_pat_decl = true; + var_declarator.name.visit_with(self); + self.is_pat_decl = old_is_pat_decl; + + var_declarator.init.visit_with(self); + } + + fn visit_binding_ident(&mut self, n: &BindingIdent) { + self.check_const_assign(&Ident::from(n)); + } + + fn visit_update_expr(&mut self, n: &UpdateExpr) { + n.visit_children_with(self); + + if let Expr::Ident(ident) = &*n.arg { + self.check_const_assign(ident); + } + } + + fn visit_pat(&mut self, p: &Pat) { + p.visit_children_with(self); + + if let Pat::Ident(p) = p { + if self.is_pat_decl { + self.add_binding( + p.sym.clone(), + BindingInfo { + span: p.span, + ctxt: p.ctxt, + unique: self.is_unique_var_kind(), + is_function: false, + }, + ); + } + } + } + + fn visit_assign_pat_prop(&mut self, p: &AssignPatProp) { + p.visit_children_with(self); + + if self.is_pat_decl { + self.add_binding( + p.key.sym.clone(), + BindingInfo { + span: p.key.span, + ctxt: p.key.ctxt, + unique: self.is_unique_var_kind(), + is_function: false, + }, + ); + } + } + + fn visit_expr(&mut self, e: &Expr) { + let old_var_decl_kind = self.var_decl_kind.take(); + let old_is_pat_decl = self.is_pat_decl; + + self.var_decl_kind = None; + self.is_pat_decl = false; + + e.visit_children_with(self); + + self.is_pat_decl = old_is_pat_decl; + self.var_decl_kind = old_var_decl_kind; + } + + fn visit_class_decl(&mut self, d: &ClassDecl) { + if d.declare { + return; + } + + self.add_binding( + d.ident.sym.clone(), + BindingInfo { + span: d.ident.span, + ctxt: d.ident.ctxt, + unique: true, + is_function: false, + }, + ); + + d.visit_children_with(self); + } + + fn visit_fn_decl(&mut self, d: &FnDecl) { + if d.function.body.is_none() || d.declare { + return; + } + + self.add_binding( + d.ident.sym.clone(), + BindingInfo { + span: d.ident.span, + ctxt: d.ident.ctxt, + unique: self.lexical_function, + is_function: true, + }, + ); + + d.visit_children_with(self); + } + + fn visit_import_decl(&mut self, s: &ImportDecl) { + if s.type_only { + return; + } + + s.visit_children_with(self); + } + + fn visit_import_default_specifier(&mut self, s: &ImportDefaultSpecifier) { + s.visit_children_with(self); + + if !self.type_bindings.contains(&s.local.to_id()) { + self.add_binding( + s.local.sym.clone(), + BindingInfo { + span: s.local.span, + ctxt: s.local.ctxt, + unique: true, + is_function: false, + }, + ); + } + } + + fn visit_import_named_specifier(&mut self, s: &ImportNamedSpecifier) { + s.visit_children_with(self); + + if !s.is_type_only && !self.type_bindings.contains(&s.local.to_id()) { + self.add_binding( + s.local.sym.clone(), + BindingInfo { + span: s.local.span, + ctxt: s.local.ctxt, + unique: true, + is_function: false, + }, + ); + } + } + + fn visit_import_star_as_specifier(&mut self, s: &ImportStarAsSpecifier) { + s.visit_children_with(self); + + if !self.type_bindings.contains(&s.local.to_id()) { + self.add_binding( + s.local.sym.clone(), + BindingInfo { + span: s.local.span, + ctxt: s.local.ctxt, + unique: true, + is_function: false, + }, + ); + } + } + + fn visit_catch_clause(&mut self, c: &CatchClause) { + self.visit_with_kind(c, Some(VarDeclKind::Var)) + } + + fn visit_param(&mut self, p: &Param) { + self.visit_with_kind(p, Some(VarDeclKind::Var)) + } + + fn visit_static_block(&mut self, c: &StaticBlock) { + self.visit_with_stmts(&c.body.stmts, false) + } + + fn visit_stmts(&mut self, b: &[Stmt]) { + self.visit_with_stmts(b, true) + } + + // Export related visits + fn visit_export_default_decl(&mut self, d: &ExportDefaultDecl) { + match &d.decl { + DefaultDecl::Class(ClassExpr { + ident: Some(ident), .. + }) => self.add_binding( + ident.sym.clone(), + BindingInfo { + span: ident.span, + ctxt: ident.ctxt, + unique: true, + is_function: false, + }, + ), + DefaultDecl::Fn(FnExpr { + ident: Some(ident), + function: f, + .. + }) if f.body.is_some() => self.add_binding( + ident.sym.clone(), + BindingInfo { + span: ident.span, + ctxt: ident.ctxt, + unique: self.lexical_function, + is_function: true, + }, + ), + _ => {} + } + + // Check for duplicate exports + if match &d.decl { + DefaultDecl::Fn(FnExpr { function: f, .. }) if f.body.is_none() => true, + DefaultDecl::TsInterfaceDecl(..) => true, + _ => false, + } { + return; + } + + d.visit_children_with(self); + + self.add_export(&Ident::new_no_ctxt(atom!("default"), d.span)); + } + + fn visit_export_default_expr(&mut self, d: &ExportDefaultExpr) { + d.visit_children_with(self); + + match &*d.expr { + Expr::Fn(FnExpr { function: f, .. }) if f.body.is_none() => return, + _ => {} + } + + self.add_export(&Ident::new_no_ctxt(atom!("default"), d.span)); + } + + fn visit_export_default_specifier(&mut self, s: &ExportDefaultSpecifier) { + self.add_export(&s.exported); + } + + fn visit_export_named_specifier(&mut self, s: &ExportNamedSpecifier) { + let exported = match &s.exported { + Some(ModuleExportName::Ident(ident)) => Some(ident), + Some(ModuleExportName::Str(..)) => return, + _ => None, + }; + let orig = match &s.orig { + ModuleExportName::Ident(ident) => ident, + ModuleExportName::Str(..) => return, + }; + self.add_export(exported.as_ref().unwrap_or(&orig)); + } + + fn visit_export_namespace_specifier(&mut self, s: &ExportNamespaceSpecifier) { + match &s.name { + ModuleExportName::Ident(name) => self.add_export(name), + ModuleExportName::Str(..) => {} + }; + } + + fn visit_ts_export_assignment(&mut self, n: &TsExportAssignment) { + self.add_export_assign(n.span); + } + + fn visit_ts_import_equals_decl(&mut self, n: &TsImportEqualsDecl) { + if n.is_export && !n.is_type_only { + self.add_export(&n.id) + } + + if !n.is_type_only && !self.type_bindings.contains(&n.id.to_id()) { + self.add_binding( + n.id.sym.clone(), + BindingInfo { + span: n.id.span, + ctxt: n.id.ctxt, + unique: true, + is_function: false, + }, + ); + } + } + + fn visit_ts_module_decl(&mut self, d: &TsModuleDecl) { + if !d.declare { + let old_exports = std::mem::take(&mut self.exports); + let old_export_assign = self.export_assign.take(); + d.visit_children_with(self); + self.exports = old_exports; + self.export_assign = old_export_assign; + } + } +} + +// Collector structs +struct ConstCollector<'a> { + const_vars: &'a mut FxHashMap, + import_binding: &'a mut FxHashMap, + var_decl_kind: Option, +} + +impl Visit for ConstCollector<'_> { + noop_visit_type!(); + + fn visit_import_specifier(&mut self, n: &ImportSpecifier) { + match n { + ImportSpecifier::Named(ImportNamedSpecifier { local, .. }) + | ImportSpecifier::Default(ImportDefaultSpecifier { local, .. }) + | ImportSpecifier::Namespace(ImportStarAsSpecifier { local, .. }) => { + self.import_binding.insert(local.to_id(), local.span); + } + } + } + + fn visit_assign_pat_prop(&mut self, p: &AssignPatProp) { + p.visit_children_with(self); + + if let Some(VarDeclKind::Const) = self.var_decl_kind { + *self.const_vars.entry(p.key.to_id()).or_default() = p.span; + } + } + + fn visit_expr(&mut self, e: &Expr) { + let old_var_decl_kind = self.var_decl_kind; + self.var_decl_kind = None; + + e.visit_children_with(self); + + self.var_decl_kind = old_var_decl_kind; + } + + fn visit_pat(&mut self, p: &Pat) { + p.visit_children_with(self); + + if let Some(VarDeclKind::Const) = self.var_decl_kind { + if let Pat::Ident(i) = p { + *self.const_vars.entry(i.to_id()).or_default() = i.span; + } + } + } + + fn visit_var_decl(&mut self, var_decl: &VarDecl) { + let old_var_decl_kind = self.var_decl_kind; + self.var_decl_kind = Some(var_decl.kind); + + var_decl.visit_children_with(self); + + self.var_decl_kind = old_var_decl_kind; + } +} + +struct TypeCollector<'a> { + type_bindings: &'a mut FxHashSet, +} + +impl Visit for TypeCollector<'_> { + fn visit_ts_entity_name(&mut self, n: &TsEntityName) { + n.visit_children_with(self); + + if let TsEntityName::Ident(ident) = n { + self.type_bindings.insert(ident.to_id()); + } + } +} + +#[cold] +fn emit_dupe_args_error(first: &BindingIdent, second: &BindingIdent) { + HANDLER.with(|handler| { + handler + .struct_span_err( + second.span, + &format!( + "the name `{}` is bound more than once in this parameter list", + first.sym + ), + ) + .span_label(first.span, "previous definition here".to_string()) + .span_label(second.span, "used as parameter more than once".to_string()) + .emit(); + }); +} + +#[cold] +fn emit_duplicate_binding_error(name: &str, span: Span, prev_span: Span) { + HANDLER.with(|handler| { + handler + .struct_span_err( + span, + &format!("the name `{name}` is defined multiple times"), + ) + .span_label(prev_span, format!("previous definition of `{name}` here")) + .span_label(span, format!("`{name}` redefined here")) + .emit(); + }); +} diff --git a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs b/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs deleted file mode 100644 index d2f512077a1e..000000000000 --- a/crates/swc_ecma_lints/src/rules/duplicate_bindings.rs +++ /dev/null @@ -1,425 +0,0 @@ -use std::collections::hash_map::Entry; - -use rustc_hash::{FxHashMap, FxHashSet}; -use swc_atoms::Atom; -use swc_common::{errors::HANDLER, Span, SyntaxContext}; -use swc_ecma_ast::*; -use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; - -use crate::rule::{visitor_rule, Rule}; - -pub fn duplicate_bindings() -> Box { - visitor_rule(DuplicateBindings::default()) -} - -#[derive(Debug, Default, Clone, Copy)] -struct BindingInfo { - span: Span, - ctxt: SyntaxContext, - unique: bool, - is_function: bool, -} - -#[derive(Debug, Default)] -struct DuplicateBindings { - bindings: FxHashMap, - type_bindings: FxHashSet, - - var_decl_kind: Option, - is_pat_decl: bool, - - /// at the top level of script of function, function behaves like var - /// in other scope it behaves like let - lexical_function: bool, -} - -impl DuplicateBindings { - /// Add a binding. - fn add(&mut self, id: Atom, info: BindingInfo) { - match self.bindings.entry((id.clone(), info.ctxt)) { - Entry::Occupied(mut prev) => { - if !(info.is_function && prev.get().is_function) - && (info.unique || prev.get().unique) - { - emit_error(&id, info.span, prev.get().span); - } - - // Next span. - if info.unique || !prev.get().unique { - *prev.get_mut() = info - } - } - Entry::Vacant(e) => { - e.insert(info); - } - } - } - - /// `const` or `let` - fn is_unique_var_kind(&self) -> bool { - matches!( - self.var_decl_kind, - Some(VarDeclKind::Const) | Some(VarDeclKind::Let) - ) - } - - fn visit_with_kind>(&mut self, e: &V, kind: Option) { - let old_var_decl_kind = self.var_decl_kind.take(); - let old_is_pat_decl = self.is_pat_decl; - - self.var_decl_kind = kind; - self.is_pat_decl = true; - - e.visit_children_with(self); - - self.is_pat_decl = old_is_pat_decl; - self.var_decl_kind = old_var_decl_kind; - } - - // this is for the wired case: - // in non strict mode, function in non top level or function scope - // is hoisted, while still error when collides with same level lexical var - fn visit_with_stmt_like, F: Fn(&T) -> Option>( - &mut self, - s: &[T], - get_fn_ident: F, - ) { - let mut fn_name = FxHashMap::default(); - for s in s { - if let Some(ident) = get_fn_ident(s) { - if let Some(prev) = fn_name.get(&ident.sym) { - emit_error(&ident.sym, ident.span, *prev) - } else { - fn_name.insert(ident.sym.clone(), ident.span); - } - } - - s.visit_with(self); - } - } - - fn visit_with_stmts(&mut self, s: &[Stmt], lexical_function: bool) { - let old = self.lexical_function; - self.lexical_function = lexical_function; - - if lexical_function { - self.visit_with_stmt_like(s, |s| match s { - Stmt::Decl(Decl::Fn(FnDecl { - ident, function: f, .. - })) if f.body.is_some() => Some(ident.clone()), - _ => None, - }); - } else { - s.visit_children_with(self); - } - self.lexical_function = old; - } -} - -impl Visit for DuplicateBindings { - noop_visit_type!(); - - fn visit_assign_pat_prop(&mut self, p: &AssignPatProp) { - p.visit_children_with(self); - - if self.is_pat_decl { - self.add( - p.key.sym.clone(), - BindingInfo { - span: p.key.span, - ctxt: p.key.ctxt, - unique: self.is_unique_var_kind(), - is_function: false, - }, - ); - } - } - - fn visit_function(&mut self, f: &Function) { - // in case any new parts is added - let Function { - body, - params, - decorators, - .. - } = f; - params.visit_with(self); - decorators.visit_with(self); - if let Some(body) = body { - self.visit_with_stmts(&body.stmts, false) - } - } - - fn visit_arrow_expr(&mut self, a: &ArrowExpr) { - let ArrowExpr { params, body, .. } = a; - params.visit_with(self); - if let BlockStmtOrExpr::BlockStmt(b) = &**body { - self.visit_with_stmts(&b.stmts, false) - } - } - - fn visit_static_block(&mut self, c: &StaticBlock) { - self.visit_with_stmts(&c.body.stmts, false) - } - - // block stmt and case block - fn visit_stmts(&mut self, b: &[Stmt]) { - self.visit_with_stmts(b, true) - } - - fn visit_catch_clause(&mut self, c: &CatchClause) { - self.visit_with_kind(c, Some(VarDeclKind::Var)) - } - - fn visit_class_decl(&mut self, d: &ClassDecl) { - if d.declare { - return; - } - - self.add( - d.ident.sym.clone(), - BindingInfo { - span: d.ident.span, - ctxt: d.ident.ctxt, - unique: true, - is_function: false, - }, - ); - - d.visit_children_with(self); - } - - fn visit_expr(&mut self, e: &Expr) { - let old_var_decl_kind = self.var_decl_kind.take(); - let old_is_pat_decl = self.is_pat_decl; - - self.var_decl_kind = None; - self.is_pat_decl = false; - - e.visit_children_with(self); - - self.is_pat_decl = old_is_pat_decl; - self.var_decl_kind = old_var_decl_kind; - } - - fn visit_fn_decl(&mut self, d: &FnDecl) { - if d.function.body.is_none() || d.declare { - return; - } - - self.add( - d.ident.sym.clone(), - BindingInfo { - span: d.ident.span, - ctxt: d.ident.ctxt, - unique: self.lexical_function, - is_function: true, - }, - ); - - d.visit_children_with(self); - } - - fn visit_import_decl(&mut self, s: &ImportDecl) { - if s.type_only { - return; - } - - s.visit_children_with(self); - } - - fn visit_export_default_decl(&mut self, e: &ExportDefaultDecl) { - // export default function foo() {} should be treated as hoisted - match &e.decl { - DefaultDecl::Class(ClassExpr { - ident: Some(ident), .. - }) => self.add( - ident.sym.clone(), - BindingInfo { - span: ident.span, - ctxt: ident.ctxt, - unique: true, - is_function: false, - }, - ), - DefaultDecl::Fn(FnExpr { - ident: Some(ident), - function: f, - .. - }) if f.body.is_some() => self.add( - ident.sym.clone(), - BindingInfo { - span: ident.span, - ctxt: ident.ctxt, - unique: self.lexical_function, - is_function: true, - }, - ), - _ => {} - } - - e.visit_children_with(self); - } - - fn visit_import_default_specifier(&mut self, s: &ImportDefaultSpecifier) { - s.visit_children_with(self); - - if !self.type_bindings.contains(&s.local.to_id()) { - self.add( - s.local.sym.clone(), - BindingInfo { - span: s.local.span, - ctxt: s.local.ctxt, - unique: true, - is_function: false, - }, - ); - } - } - - fn visit_import_named_specifier(&mut self, s: &ImportNamedSpecifier) { - s.visit_children_with(self); - - if !s.is_type_only && !self.type_bindings.contains(&s.local.to_id()) { - self.add( - s.local.sym.clone(), - BindingInfo { - span: s.local.span, - ctxt: s.local.ctxt, - unique: true, - is_function: false, - }, - ); - } - } - - fn visit_import_star_as_specifier(&mut self, s: &ImportStarAsSpecifier) { - s.visit_children_with(self); - - if !self.type_bindings.contains(&s.local.to_id()) { - self.add( - s.local.sym.clone(), - BindingInfo { - span: s.local.span, - ctxt: s.local.ctxt, - unique: true, - is_function: false, - }, - ); - } - } - - fn visit_ts_import_equals_decl(&mut self, s: &TsImportEqualsDecl) { - s.visit_children_with(self); - - if !s.is_type_only && !self.type_bindings.contains(&s.id.to_id()) { - self.add( - s.id.sym.clone(), - BindingInfo { - span: s.id.span, - ctxt: s.id.ctxt, - unique: true, - is_function: false, - }, - ); - } - } - - fn visit_module(&mut self, m: &Module) { - m.visit_with(&mut TypeCollector { - type_bindings: &mut self.type_bindings, - }); - - self.lexical_function = true; - - self.visit_with_stmt_like(&m.body, |s| match s { - ModuleItem::Stmt(Stmt::Decl(Decl::Fn(FnDecl { - ident, function: f, .. - }))) - | ModuleItem::ModuleDecl( - ModuleDecl::ExportDecl(ExportDecl { - decl: - Decl::Fn(FnDecl { - ident, function: f, .. - }), - .. - }) - | ModuleDecl::ExportDefaultDecl(ExportDefaultDecl { - decl: - DefaultDecl::Fn(FnExpr { - ident: Some(ident), - function: f, - }), - .. - }), - ) if f.body.is_some() => Some(ident.clone()), - _ => None, - }); - } - - fn visit_pat(&mut self, p: &Pat) { - p.visit_children_with(self); - - if let Pat::Ident(p) = p { - if self.is_pat_decl { - self.add( - p.sym.clone(), - BindingInfo { - span: p.span, - ctxt: p.ctxt, - unique: self.is_unique_var_kind(), - is_function: false, - }, - ); - } - } - } - - fn visit_script(&mut self, s: &Script) { - s.visit_with(&mut TypeCollector { - type_bindings: &mut self.type_bindings, - }); - - s.body.visit_children_with(self); - } - - fn visit_var_decl(&mut self, d: &VarDecl) { - if d.declare { - return; - } - - self.visit_with_kind(d, Some(d.kind)) - } - - fn visit_param(&mut self, p: &Param) { - self.visit_with_kind(p, Some(VarDeclKind::Var)) - } -} - -struct TypeCollector<'a> { - type_bindings: &'a mut FxHashSet, -} - -impl Visit for TypeCollector<'_> { - fn visit_ts_entity_name(&mut self, n: &TsEntityName) { - n.visit_children_with(self); - - if let TsEntityName::Ident(ident) = n { - self.type_bindings.insert(ident.to_id()); - } - } -} - -#[cold] -fn emit_error(name: &str, span: Span, prev_span: Span) { - HANDLER.with(|handler| { - handler - .struct_span_err( - span, - &format!("the name `{name}` is defined multiple times"), - ) - .span_label(prev_span, format!("previous definition of `{name}` here")) - .span_label(span, format!("`{name}` redefined here")) - .emit(); - }); -} diff --git a/crates/swc_ecma_lints/src/rules/duplicate_exports.rs b/crates/swc_ecma_lints/src/rules/duplicate_exports.rs deleted file mode 100644 index 11325c708cc4..000000000000 --- a/crates/swc_ecma_lints/src/rules/duplicate_exports.rs +++ /dev/null @@ -1,153 +0,0 @@ -use std::{collections::hash_map::Entry, mem}; - -use rustc_hash::FxHashMap; -use swc_atoms::{atom, Atom}; -use swc_common::{errors::HANDLER, Span}; -use swc_ecma_ast::*; -use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; - -use crate::rule::{visitor_rule, Rule}; - -pub fn duplicate_exports() -> Box { - visitor_rule(DuplicateExports::default()) -} - -#[derive(Debug, Default)] -struct DuplicateExports { - exports: FxHashMap, - export_assign: Option, -} - -impl DuplicateExports { - /// Add an export. - fn add(&mut self, id: &Ident) { - match self.exports.entry(id.sym.clone()) { - Entry::Occupied(mut prev) => { - let name = &id.sym; - - HANDLER.with(|handler| { - handler - .struct_span_err( - id.span, - &format!("the name `{name}` is exported multiple times"), - ) - .span_label(*prev.get(), "previous exported here") - .span_label(id.span, "exported more than once") - .note("Exported identifiers must be unique") - .emit(); - }); - - // Next span. - *prev.get_mut() = id.span; - } - Entry::Vacant(e) => { - e.insert(id.span); - } - } - - self.check_no_coexist(); - } - - fn add_export_assign(&mut self, span: Span) { - if let Some(prev_span) = self.export_assign { - // TS2300 - HANDLER.with(|handler| { - handler - .struct_span_err(span, "multiple `export =` found") - .span_label(prev_span, "previous `export =` declared here") - .emit() - }); - } - - self.export_assign = Some(span); - - self.check_no_coexist(); - } - - fn check_no_coexist(&self) { - if let Some(span) = self.export_assign { - if !self.exports.is_empty() { - // TS2309 - HANDLER.with(|handler| { - handler - .struct_span_err(span, r#"An export assignment cannot be used in a module with other exported elements."#) - .emit() - }); - } - } - } -} - -impl Visit for DuplicateExports { - noop_visit_type!(); - - fn visit_export_default_decl(&mut self, d: &ExportDefaultDecl) { - if match &d.decl { - DefaultDecl::Fn(FnExpr { function: f, .. }) if f.body.is_none() => true, - DefaultDecl::TsInterfaceDecl(..) => true, - _ => false, - } { - return; - } - - d.visit_children_with(self); - - self.add(&Ident::new_no_ctxt(atom!("default"), d.span)); - } - - fn visit_export_default_expr(&mut self, d: &ExportDefaultExpr) { - d.visit_children_with(self); - - match &*d.expr { - Expr::Fn(FnExpr { function: f, .. }) if f.body.is_none() => return, - _ => {} - } - - self.add(&Ident::new_no_ctxt(atom!("default"), d.span)); - } - - fn visit_export_default_specifier(&mut self, s: &ExportDefaultSpecifier) { - self.add(&s.exported); - } - - fn visit_export_named_specifier(&mut self, s: &ExportNamedSpecifier) { - let exported = match &s.exported { - Some(ModuleExportName::Ident(ident)) => Some(ident), - Some(ModuleExportName::Str(..)) => return, - _ => None, - }; - let orig = match &s.orig { - ModuleExportName::Ident(ident) => ident, - ModuleExportName::Str(..) => return, - }; - self.add(exported.as_ref().unwrap_or(&orig)); - } - - fn visit_export_namespace_specifier(&mut self, s: &ExportNamespaceSpecifier) { - match &s.name { - ModuleExportName::Ident(name) => self.add(name), - ModuleExportName::Str(..) => {} - }; - } - - /// Noop. Just to ensure that the visitor do not recurse into stmt. - fn visit_stmt(&mut self, _: &Stmt) {} - - fn visit_ts_export_assignment(&mut self, n: &TsExportAssignment) { - self.add_export_assign(n.span); - } - - fn visit_ts_import_equals_decl(&mut self, n: &TsImportEqualsDecl) { - if n.is_export && !n.is_type_only { - self.add(&n.id) - } - } - - fn visit_ts_module_decl(&mut self, d: &TsModuleDecl) { - if !d.declare { - let old = mem::take(self); - d.visit_children_with(self); - *self = old; - } - } -} diff --git a/crates/swc_ecma_lints/src/rules/mod.rs b/crates/swc_ecma_lints/src/rules/mod.rs index e6c606d71230..2875d0002bc8 100644 --- a/crates/swc_ecma_lints/src/rules/mod.rs +++ b/crates/swc_ecma_lints/src/rules/mod.rs @@ -5,10 +5,7 @@ use swc_ecma_ast::*; use crate::{config::LintConfig, rule::Rule}; -mod const_assign; -mod duplicate_bindings; -mod duplicate_exports; -mod no_dupe_args; +mod critical_rules; mod utils; #[cfg(feature = "non_critical_lints")] @@ -64,12 +61,7 @@ pub struct LintParams<'a> { } pub fn all(lint_params: LintParams) -> Vec> { - let mut rules = vec![ - const_assign::const_assign(), - duplicate_bindings::duplicate_bindings(), - duplicate_exports::duplicate_exports(), - no_dupe_args::no_dupe_args(), - ]; + let mut rules = vec![critical_rules::critical_rules()]; #[cfg(feature = "non_critical_lints")] { diff --git a/crates/swc_ecma_lints/src/rules/no_dupe_args.rs b/crates/swc_ecma_lints/src/rules/no_dupe_args.rs deleted file mode 100644 index fa92c754f8e0..000000000000 --- a/crates/swc_ecma_lints/src/rules/no_dupe_args.rs +++ /dev/null @@ -1,168 +0,0 @@ -use std::collections::hash_map::Entry; - -use rustc_hash::FxHashMap; -use swc_common::errors::HANDLER; -use swc_ecma_ast::*; -use swc_ecma_utils::{ - for_each_binding_ident, - parallel::{cpu_count, Parallel, ParallelExt}, -}; -use swc_ecma_visit::{noop_visit_type, Visit, VisitWith}; - -use crate::rule::{visitor_rule, Rule}; - -pub fn no_dupe_args() -> Box { - visitor_rule(NoDupeArgs) -} - -#[derive(Debug, Default)] -struct NoDupeArgs; - -impl Parallel for NoDupeArgs { - fn create(&self) -> Self { - Self - } - - fn merge(&mut self, _: Self) {} -} - -#[cold] -fn error(first: &BindingIdent, second: &BindingIdent) { - HANDLER.with(|handler| { - handler - .struct_span_err( - second.span, - &format!( - "the name `{}` is bound more than once in this parameter list", - first.sym - ), - ) - .span_label(first.span, "previous definition here".to_string()) - .span_label(second.span, "used as parameter more than once".to_string()) - .emit(); - }); -} - -/// This has time complexity of O(n^2), but it's fine as the number of paramters -/// is usually small. -macro_rules! check { - ($node:expr) => {{ - // This vector allocates only if there are duplicate parameters. - // This is used to handle the case where the same parameter is used 3 or more - // times. - let mut done = Vec::new(); - - let mut hash_mode = false; - - let mut i1 = 0; - for_each_binding_ident($node, |id1| { - i1 += 1; - - if !hash_mode { - let mut i2 = 0; - for_each_binding_ident($node, |id2| { - i2 += 1; - - if hash_mode { - return; - } else if i2 >= 100 { - // While iterating for the first `id1`, we detect that there are more than - // 100 identifiers. We switch to hash mode. - hash_mode = true; - } - - if i1 >= i2 || done.contains(&i1) { - return; - } - - if id1.ctxt == id2.ctxt && id1.sym == id2.sym { - done.push(i1); - - error(id1, id2); - } - }); - } - }); - - if hash_mode { - let mut map = FxHashMap::default(); - - for_each_binding_ident($node, |id| { - // - match map.entry((id.sym.clone(), id.ctxt)) { - Entry::Occupied(v) => { - error(v.get(), id); - } - - Entry::Vacant(v) => { - v.insert(id.clone()); - } - } - }); - } - }}; -} - -impl Visit for NoDupeArgs { - noop_visit_type!(); - - fn visit_arrow_expr(&mut self, f: &ArrowExpr) { - check!(&f.params); - - f.visit_children_with(self); - } - - fn visit_class_members(&mut self, members: &[ClassMember]) { - self.maybe_par(cpu_count(), members, |v, member| { - member.visit_with(v); - }); - } - - fn visit_constructor(&mut self, f: &Constructor) { - check!(&f.params); - - f.visit_children_with(self); - } - - fn visit_expr_or_spreads(&mut self, n: &[ExprOrSpread]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_exprs(&mut self, exprs: &[Box]) { - self.maybe_par(cpu_count(), exprs, |v, expr| { - expr.visit_with(v); - }); - } - - fn visit_function(&mut self, f: &Function) { - check!(&f.params); - - f.visit_children_with(self); - } - - fn visit_module_items(&mut self, items: &[ModuleItem]) { - self.maybe_par(cpu_count(), items, |v, item| { - item.visit_with(v); - }); - } - - fn visit_opt_vec_expr_or_spreads(&mut self, n: &[Option]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_prop_or_spreads(&mut self, n: &[PropOrSpread]) { - self.maybe_par(cpu_count(), n, |v, n| { - n.visit_with(v); - }); - } - - fn visit_stmts(&mut self, stmts: &[Stmt]) { - self.maybe_par(cpu_count(), stmts, |v, stmt| { - stmt.visit_with(v); - }); - } -} diff --git a/crates/swc_ecma_loader/Cargo.toml b/crates/swc_ecma_loader/Cargo.toml index 1df8b6a9b08c..a6b6d47cd7f7 100644 --- a/crates/swc_ecma_loader/Cargo.toml +++ b/crates/swc_ecma_loader/Cargo.toml @@ -38,7 +38,7 @@ serde_json = { workspace = true, optional = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } [dev-dependencies] lazy_static = { workspace = true } diff --git a/crates/swc_ecma_minifier/Cargo.toml b/crates/swc_ecma_minifier/Cargo.toml index 1411401d057b..4fdd3c21dab5 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 = { workspace = true } name = "swc_ecma_minifier" repository = { workspace = true } -version = "24.0.1" +version = "24.0.2" [package.metadata.docs.rs] all-features = true @@ -54,7 +54,7 @@ tracing = { workspace = true } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config", features = [ "sourcemap", "file_pattern", @@ -64,8 +64,8 @@ swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast", features = [ "serde", ] } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_optimization = { version = "20.0.0", path = "../swc_ecma_transforms_optimization" } swc_ecma_usage_analyzer = { version = "19.0.2", path = "../swc_ecma_usage_analyzer" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } diff --git a/crates/swc_ecma_minifier/src/compress/optimize/evaluate.rs b/crates/swc_ecma_minifier/src/compress/optimize/evaluate.rs index 8976ea25edfa..b0b7529b9c78 100644 --- a/crates/swc_ecma_minifier/src/compress/optimize/evaluate.rs +++ b/crates/swc_ecma_minifier/src/compress/optimize/evaluate.rs @@ -139,6 +139,62 @@ impl Optimizer<'_> { .into(); } + Expr::Member(MemberExpr { + obj, + prop: MemberProp::Ident(prop), + span, + .. + }) if matches!(obj.as_ref(), Expr::Ident(ident) if &*ident.sym == "Number") => { + match &*prop.sym { + "MIN_VALUE" => { + report_change!("evaluate: `Number.MIN_VALUE` -> `5e-324`"); + self.changed = true; + *e = Lit::Num(Number { + span: *span, + value: 5e-324, + raw: None, + }) + .into(); + } + "NaN" => { + report_change!("evaluate: `Number.NaN` -> `NaN`"); + self.changed = true; + *e = Ident::new( + atom!("NaN"), + *span, + SyntaxContext::empty().apply_mark(self.marks.unresolved_mark), + ) + .into(); + } + "POSITIVE_INFINITY" => { + report_change!("evaluate: `Number.POSITIVE_INFINITY` -> `Infinity`"); + self.changed = true; + *e = Ident::new( + atom!("Infinity"), + *span, + SyntaxContext::empty().apply_mark(self.marks.unresolved_mark), + ) + .into(); + } + "NEGATIVE_INFINITY" => { + report_change!("evaluate: `Number.NEGATIVE_INFINITY` -> `-Infinity`"); + self.changed = true; + *e = UnaryExpr { + span: *span, + op: op!(unary, "-"), + arg: Ident::new( + atom!("Infinity"), + *span, + SyntaxContext::empty().apply_mark(self.marks.unresolved_mark), + ) + .into(), + } + .into(); + } + _ => {} + } + } + _ => {} } } diff --git a/crates/swc_ecma_minifier/src/compress/pure/misc.rs b/crates/swc_ecma_minifier/src/compress/pure/misc.rs index 79c374b3c80e..25e636fa4292 100644 --- a/crates/swc_ecma_minifier/src/compress/pure/misc.rs +++ b/crates/swc_ecma_minifier/src/compress/pure/misc.rs @@ -95,6 +95,12 @@ fn collect_exprs_from_object(obj: &mut ObjectLit) -> Vec> { exprs } +#[derive(Debug)] +enum GroupType<'a> { + Literals(Vec<&'a ExprOrSpread>), + Expression(&'a ExprOrSpread), +} + impl Pure<'_> { /// `a = a + 1` => `a += 1`. pub(super) fn compress_bin_assignment_to_left(&mut self, e: &mut AssignExpr) { @@ -501,6 +507,19 @@ impl Pure<'_> { return; } + // Handle empty array case first + if arr.elems.is_empty() { + report_change!("Compressing empty array.join()"); + self.changed = true; + *e = Lit::Str(Str { + span: call.span, + raw: None, + value: atom!(""), + }) + .into(); + return; + } + let cannot_join_as_str_lit = arr .elems .iter() @@ -520,11 +539,19 @@ impl Pure<'_> { return; } - if !self.options.unsafe_passes { + // Try partial optimization (grouping consecutive literals) + if let Some(new_expr) = + self.compress_array_join_partial(arr.span, &mut arr.elems, &separator) + { + self.changed = true; + report_change!("Compressing array.join() with partial optimization"); + *e = new_expr; return; } - // TODO: Partial join + if !self.options.unsafe_passes { + return; + } if arr .elems @@ -625,6 +652,277 @@ impl Pure<'_> { .into() } + /// Performs partial optimization on array.join() when there are mixed + /// literals and expressions. Groups consecutive literals into string + /// concatenations. + fn compress_array_join_partial( + &mut self, + _span: Span, + elems: &mut Vec>, + separator: &str, + ) -> Option { + if !self.options.evaluate { + return None; + } + + // Check if we have any non-literal elements + let has_non_literals = elems.iter().flatten().any(|elem| match &*elem.expr { + Expr::Lit(Lit::Str(..) | Lit::Num(..) | Lit::Null(..)) => false, + e if is_pure_undefined(self.expr_ctx, e) => false, + _ => true, + }); + + if !has_non_literals { + return None; // Pure literal case will be handled elsewhere + } + + // For non-empty separators, only optimize if we have at least 2 consecutive + // literals This prevents infinite loop and ensures meaningful + // optimization + if !separator.is_empty() { + let mut consecutive_literals = 0; + let mut max_consecutive = 0; + + for elem in elems.iter().flatten() { + let is_literal = match &*elem.expr { + Expr::Lit(Lit::Str(..) | Lit::Num(..) | Lit::Null(..)) => true, + e if is_pure_undefined(self.expr_ctx, e) => true, + _ => false, + }; + + if is_literal { + consecutive_literals += 1; + max_consecutive = max_consecutive.max(consecutive_literals); + } else { + consecutive_literals = 0; + } + } + + if max_consecutive < 2 { + return None; + } + + // Only optimize for single-character separators to avoid bloating the code + // Long separators like "really-long-separator" should not be optimized + if separator.len() > 1 { + return None; + } + + // For comma separator, require a higher threshold to avoid infinite loops + if separator == "," && max_consecutive < 6 { + return None; + } + } else { + // For empty string joins, optimize more aggressively since we're + // doing string concatenation We can always optimize + // these as long as there are mixed expressions and literals + } + + // Group consecutive literals and create a string concatenation expression + let mut groups = Vec::new(); + let mut current_group = Vec::new(); + + for elem in elems.iter().flatten() { + let is_literal = match &*elem.expr { + Expr::Lit(Lit::Str(..) | Lit::Num(..) | Lit::Null(..)) => true, + e if is_pure_undefined(self.expr_ctx, e) => true, + _ => false, + }; + + if is_literal { + current_group.push(elem); + } else { + if !current_group.is_empty() { + groups.push(GroupType::Literals(current_group)); + current_group = Vec::new(); + } + groups.push(GroupType::Expression(elem)); + } + } + + if !current_group.is_empty() { + groups.push(GroupType::Literals(current_group)); + } + + // If we don't have any grouped literals, no optimization possible + if groups.iter().all(|g| matches!(g, GroupType::Expression(_))) { + return None; + } + + // Handle different separators + let is_string_concat = separator.is_empty(); + + if is_string_concat { + // Convert to string concatenation + let mut result_parts = Vec::new(); + + // Only add empty string prefix when the first element is a non-string + // expression that needs coercion to string AND there's no string + // literal early enough to provide coercion + let needs_empty_string_prefix = match groups.first() { + Some(GroupType::Expression(first_expr)) => { + // Check if the first expression is already a string concatenation + let first_needs_coercion = match &*first_expr.expr { + Expr::Bin(BinExpr { + op: op!(bin, "+"), .. + }) => false, // Already string concat + Expr::Lit(Lit::Str(..)) => false, // Already a string literal + Expr::Call(_call) => { + // Function calls may return any type and need string coercion + true + } + _ => true, // Other expressions need string coercion + }; + + // If the first element needs coercion, check if the second element is a string + // literal that can provide the coercion + if first_needs_coercion { + match groups.get(1) { + Some(GroupType::Literals(_)) => false, /* String literals will */ + // provide coercion + _ => true, // No string literal to provide coercion + } + } else { + false + } + } + _ => false, + }; + + if needs_empty_string_prefix { + result_parts.push(Box::new(Expr::Lit(Lit::Str(Str { + span: DUMMY_SP, + raw: None, + value: atom!(""), + })))); + } + + for group in groups { + match group { + GroupType::Literals(literals) => { + let mut joined = String::new(); + for literal in literals.iter() { + match &*literal.expr { + Expr::Lit(Lit::Str(s)) => joined.push_str(&s.value), + Expr::Lit(Lit::Num(n)) => write!(joined, "{}", n.value).unwrap(), + Expr::Lit(Lit::Null(..)) => { + // For string concatenation, null becomes + // empty string + } + e if is_pure_undefined(self.expr_ctx, e) => { + // undefined becomes empty string in string + // context + } + _ => unreachable!(), + } + } + + result_parts.push(Box::new(Expr::Lit(Lit::Str(Str { + span: DUMMY_SP, + raw: None, + value: joined.into(), + })))); + } + GroupType::Expression(expr) => { + result_parts.push(expr.expr.clone()); + } + } + } + + // Create string concatenation expression + if result_parts.len() == 1 { + return Some(*result_parts.into_iter().next().unwrap()); + } + + let mut result = *result_parts.remove(0); + for part in result_parts { + result = Expr::Bin(BinExpr { + span: DUMMY_SP, + left: Box::new(result), + op: op!(bin, "+"), + right: part, + }); + } + + Some(result) + } else { + // For non-empty separator, create a more compact array + let mut new_elems = Vec::new(); + + for group in groups { + match group { + GroupType::Literals(literals) => { + let mut joined = String::new(); + for (idx, literal) in literals.iter().enumerate() { + if idx > 0 { + joined.push_str(separator); + } + + match &*literal.expr { + Expr::Lit(Lit::Str(s)) => joined.push_str(&s.value), + Expr::Lit(Lit::Num(n)) => write!(joined, "{}", n.value).unwrap(), + Expr::Lit(Lit::Null(..)) => { + // null becomes empty string + } + e if is_pure_undefined(self.expr_ctx, e) => { + // undefined becomes empty string + } + _ => unreachable!(), + } + } + + new_elems.push(Some(ExprOrSpread { + spread: None, + expr: Box::new(Expr::Lit(Lit::Str(Str { + span: DUMMY_SP, + raw: None, + value: joined.into(), + }))), + })); + } + GroupType::Expression(expr) => { + new_elems.push(Some(ExprOrSpread { + spread: None, + expr: expr.expr.clone(), + })); + } + } + } + + // Create a new array.join() call with the original separator + let new_array = Expr::Array(ArrayLit { + span: _span, + elems: new_elems, + }); + + // For comma separator, use .join() without arguments (shorter) + let args = if separator == "," { + vec![] + } else { + vec![ExprOrSpread { + spread: None, + expr: Box::new(Expr::Lit(Lit::Str(Str { + span: DUMMY_SP, + raw: None, + value: separator.into(), + }))), + }] + }; + + Some(Expr::Call(CallExpr { + span: _span, + ctxt: Default::default(), + callee: Callee::Expr(Box::new(Expr::Member(MemberExpr { + span: _span, + obj: Box::new(new_array), + prop: MemberProp::Ident(IdentName::new(atom!("join"), _span)), + }))), + args, + ..Default::default() + })) + } + } + pub(super) fn drop_undefined_from_return_arg(&mut self, s: &mut ReturnStmt) { if let Some(e) = s.arg.as_deref() { if is_pure_undefined(self.expr_ctx, e) { diff --git a/crates/swc_ecma_minifier/tests/TODO.txt b/crates/swc_ecma_minifier/tests/TODO.txt index 683a82decf06..dc5fbf3e3f00 100644 --- a/crates/swc_ecma_minifier/tests/TODO.txt +++ b/crates/swc_ecma_minifier/tests/TODO.txt @@ -1,7 +1,5 @@ arguments/modified/input.js -arrays/constant_join_2/input.js arrays/constant_join_3/input.js -arrays/constant_join/input.js arrays/for_loop/input.js arrays/index_length/input.js arrow/issue_2084/input.js @@ -122,7 +120,6 @@ drop_unused/reassign_const/input.js drop_unused/unused_circular_references_2/input.js drop_unused/unused_circular_references_3/input.js drop_unused/var_catch_toplevel/input.js -evaluate/issue_2207_3/input.js evaluate/issue_2535_1/input.js evaluate/issue_399/input.js evaluate/prototype_function/input.js diff --git a/crates/swc_ecma_minifier/tests/benches-full/echarts.js b/crates/swc_ecma_minifier/tests/benches-full/echarts.js index f3fd27544516..640a7d2bc0ab 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/echarts.js +++ b/crates/swc_ecma_minifier/tests/benches-full/echarts.js @@ -4044,7 +4044,7 @@ }, 0), remainder = map(votesPerQuota, function(votes, idx) { return votes - seats[idx]; }); currentSum < targetSeats;){ - for(var max = Number.NEGATIVE_INFINITY, maxId = null, i = 0, len = remainder.length; i < len; ++i)remainder[i] > max && (max = remainder[i], maxId = i); + for(var max = -1 / 0, maxId = null, i = 0, len = remainder.length; i < len; ++i)remainder[i] > max && (max = remainder[i], maxId = i); // Add a vote to max remainder. ++seats[maxId], remainder[maxId] = 0, ++currentSum; } @@ -20006,13 +20006,11 @@ } else { this._width = this._getSize(0), this._height = this._getSize(1); var width1, height1, domRoot, domRoot1 = this._domRoot = (width1 = this._width, height1 = this._height, (domRoot = document.createElement('div')).style.cssText = [ - 'position:relative', + "position:relative", 'width:' + width1 + 'px', 'height:' + height1 + 'px', - 'padding:0', - 'margin:0', - 'border-width:0' - ].join(';') + ';', domRoot); + "padding:0;margin:0;border-width:0" + ].join(";") + ';', domRoot); root.appendChild(domRoot1); } } @@ -21793,7 +21791,7 @@ }, BarView.prototype._isOrderChangedWithinSameData = function(data, orderMapping, baseAxis) { for(var scale = baseAxis.scale, ordinalDataDim = data.mapDimension(baseAxis.dim), lastValue = Number.MAX_VALUE, tickNum = 0, len = scale.getOrdinalMeta().categories.length; tickNum < len; ++tickNum){ var rawIdx = data.rawIndexOf(ordinalDataDim, scale.getRawOrdinalNumber(tickNum)), value = rawIdx < 0 // If some tick have no bar, the tick will be treated as min. - ? Number.MIN_VALUE // PENDING: if dataZoom on baseAxis exits, is it a performance issue? + ? 5e-324 // PENDING: if dataZoom on baseAxis exits, is it a performance issue? : orderMapping(data.indexOfRawIndex(rawIdx)); if (value > lastValue) return !0; lastValue = value; @@ -41758,14 +41756,7 @@ 'right' ], arrowPos) > -1 ? (positionStyle += 'top:50%', transformStyle += "translateY(-50%) rotate(" + ('left' === arrowPos ? -225 : -45) + "deg)") : (positionStyle += 'left:50%', transformStyle += "translateX(-50%) rotate(" + ('top' === arrowPos ? 225 : 45) + "deg)"); var borderStyle = borderColor + " solid 1px;"; - return "
"; + return "
'; }(tooltipModel.get('backgroundColor'), borderColor, arrowPosition)), isString(content)) el.innerHTML = content; else if (content) { // Clear previous diff --git a/crates/swc_ecma_minifier/tests/benches-full/lodash.js b/crates/swc_ecma_minifier/tests/benches-full/lodash.js index 619e142e65e9..8adbfc500bd5 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/lodash.js +++ b/crates/swc_ecma_minifier/tests/benches-full/lodash.js @@ -70,11 +70,9 @@ ].join('|') + ')', rsUpper + '?' + rsMiscLower + '+' + rsOptContrLower, rsUpper + '+' + rsOptContrUpper, - '\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])', - '\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])', - '\\d+', + "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+", rsEmoji - ].join('|'), 'g'), reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'), reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, contextProps = [ + ].join("|"), 'g'), reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'), reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, contextProps = [ 'Array', 'Buffer', 'DataView', diff --git a/crates/swc_ecma_minifier/tests/benches-full/terser.js b/crates/swc_ecma_minifier/tests/benches-full/terser.js index 81a80c4cbf26..e834151c83a6 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/terser.js +++ b/crates/swc_ecma_minifier/tests/benches-full/terser.js @@ -2375,13 +2375,7 @@ var index = args_values.indexOf(":"); index < 0 && (index = args_values.length); var body = this.body; - return parse([ - "(function(", - args_values.slice(0, index), - '){"$ORIG"})(', - args_values.slice(index + 1), - ")" - ].join("")).transform(new TreeTransformer(function(node) { + return parse("(function(" + args_values.slice(0, index) + '){"$ORIG"})(' + args_values.slice(index + 1) + ")").transform(new TreeTransformer(function(node) { if (node instanceof AST_Directive && "$ORIG" == node.value) return MAP.splice(body); })); } diff --git a/crates/swc_ecma_minifier/tests/benches-full/three.js b/crates/swc_ecma_minifier/tests/benches-full/three.js index 5da14a0faafa..7526c702cf87 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/three.js +++ b/crates/swc_ecma_minifier/tests/benches-full/three.js @@ -5663,20 +5663,11 @@ function(global, factory) { '\n' ].filter(filterEmptyLine).join('\n')), vertexShader = replaceClippingPlaneNums(vertexShader = replaceLightNums(vertexShader = resolveIncludes(vertexShader), parameters), parameters), fragmentShader = replaceClippingPlaneNums(fragmentShader = replaceLightNums(fragmentShader = resolveIncludes(fragmentShader), parameters), parameters), vertexShader = unrollLoops(vertexShader), fragmentShader = unrollLoops(fragmentShader), parameters.isWebGL2 && !0 !== parameters.isRawShaderMaterial && (// GLSL 3.0 conversion for built-in materials and ShaderMaterial versionString = '#version 300 es\n', prefixVertex = "#define attribute in\n#define varying out\n#define texture2D texture\n" + prefixVertex, prefixFragment = [ - '#define varying in', + "#define varying in", parameters.glslVersion === GLSL3 ? '' : 'out highp vec4 pc_fragColor;', parameters.glslVersion === GLSL3 ? '' : '#define gl_FragColor pc_fragColor', - '#define gl_FragDepthEXT gl_FragDepth', - '#define texture2D texture', - '#define textureCube texture', - '#define texture2DProj textureProj', - '#define texture2DLodEXT textureLod', - '#define texture2DProjLodEXT textureProjLod', - '#define textureCubeLodEXT textureLod', - '#define texture2DGradEXT textureGrad', - '#define texture2DProjGradEXT textureProjGrad', - '#define textureCubeGradEXT textureGrad' - ].join('\n') + '\n' + prefixFragment); + "#define gl_FragDepthEXT gl_FragDepth\n#define texture2D texture\n#define textureCube texture\n#define texture2DProj textureProj\n#define texture2DLodEXT textureLod\n#define texture2DProjLodEXT textureProjLod\n#define textureCubeLodEXT textureLod\n#define texture2DGradEXT textureGrad\n#define texture2DProjGradEXT textureProjGrad\n#define textureCubeGradEXT textureGrad" + ].join("\n") + '\n' + prefixFragment); var vertexGlsl = versionString + prefixVertex + vertexShader, fragmentGlsl = versionString + prefixFragment + fragmentShader, glVertexShader = WebGLShader(gl, 35633, vertexGlsl), glFragmentShader = WebGLShader(gl, 35632, fragmentGlsl); if (gl.attachShader(program, glVertexShader), gl.attachShader(program, glFragmentShader), void 0 !== parameters.index0AttributeName ? gl.bindAttribLocation(program, 0, parameters.index0AttributeName) : !0 === parameters.morphTargets && // programs with morphTargets displace position out of attribute 0 gl.bindAttribLocation(program, 0, 'position'), gl.linkProgram(program), renderer.debug.checkShaderErrors) { diff --git a/crates/swc_ecma_minifier/tests/benches-full/victory.js b/crates/swc_ecma_minifier/tests/benches-full/victory.js index a976b8053cfd..9b91bd2693f8 100644 --- a/crates/swc_ecma_minifier/tests/benches-full/victory.js +++ b/crates/swc_ecma_minifier/tests/benches-full/victory.js @@ -16990,7 +16990,7 @@ case "number": // The standard `isNaN` is fine in this case since we already know the // type is number. - return !isNaN(obj) && obj !== Number.POSITIVE_INFINITY && obj !== Number.NEGATIVE_INFINITY; + return !isNaN(obj) && obj !== 1 / 0 && obj !== -1 / 0; case "string": case "function": // d3 might not *actually* be able to interpolate the string, but it diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js index d8f863c998d4..e0b4a35bad03 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/2257/full/output.js @@ -12066,46 +12066,24 @@ const index = result.length; return void 0 === value || options.skipNull && null === value || options.skipEmptyString && "" === value ? result : null === value ? [ ...result, - [ - encode(key, options), - "[", - index, - "]" - ].join("") + encode(key, options) + "[" + index + "]" ] : [ ...result, - [ - encode(key, options), - "[", - encode(index, options), - "]=", - encode(value, options) - ].join("") + encode(key, options) + "[" + encode(index, options) + "]=" + encode(value, options) ]; }; case "bracket": return (key)=>(result, value)=>void 0 === value || options.skipNull && null === value || options.skipEmptyString && "" === value ? result : null === value ? [ ...result, - [ - encode(key, options), - "[]" - ].join("") + encode(key, options) + "[]" ] : [ ...result, - [ - encode(key, options), - "[]=", - encode(value, options) - ].join("") + encode(key, options) + "[]=" + encode(value, options) ]; case "comma": case "separator": return (key)=>(result, value)=>null == value || 0 === value.length ? result : 0 === result.length ? [ - [ - encode(key, options), - "=", - encode(value, options) - ].join("") + encode(key, options) + "=" + encode(value, options) ] : [ [ result, @@ -12118,11 +12096,7 @@ encode(key, options) ] : [ ...result, - [ - encode(key, options), - "=", - encode(value, options) - ].join("") + encode(key, options) + "=" + encode(value, options) ]; } }(options), objectCopy = {}; diff --git a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js index ab43efc67858..a0739feae17e 100644 --- a/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/issues/firebase-firestore/1/output.js @@ -4977,7 +4977,7 @@ return js.resolve(this.In.slice()); } getAllMutationBatchesAffectingDocumentKey(t, e) { - const n = new Pr(e, 0), s = new Pr(e, Number.POSITIVE_INFINITY), i = []; + const n = new Pr(e, 0), s = new Pr(e, 1 / 0), i = []; return this.ds.forEachInRange([ n, s @@ -4989,7 +4989,7 @@ getAllMutationBatchesAffectingDocumentKeys(t, e) { let n = new gn(et); return e.forEach((t)=>{ - const e = new Pr(t, 0), s = new Pr(t, Number.POSITIVE_INFINITY); + const e = new Pr(t, 0), s = new Pr(t, 1 / 0); this.ds.forEachInRange([ e, s diff --git a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js index b3c19c8911a7..6ec8863fe3ba 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/33265/static/chunks/d6e1aeb5-38a8d7ae57119c23/output.js @@ -9899,12 +9899,7 @@ '").join(""); }, /** * Create foreground color element for the component @@ -9915,17 +9910,7 @@ * @private */ _proto.createElFgColor_ = function() { var legendId = "captions-text-legend-" + this.id_; - return [ - '
', - '', - this.localize("Text"), - "", - this.createElSelect_("color", legendId), - '', - this.createElSelect_("textOpacity", legendId), - "", - "
" - ].join(""); + return '
' + this.localize("Text") + "" + this.createElSelect_("color", legendId) + '' + this.createElSelect_("textOpacity", legendId) + "
"; }, /** * Create background color element for the component * @@ -9935,17 +9920,7 @@ * @private */ _proto.createElBgColor_ = function() { var legendId = "captions-background-" + this.id_; - return [ - '
', - '', - this.localize("Background"), - "", - this.createElSelect_("backgroundColor", legendId), - '', - this.createElSelect_("backgroundOpacity", legendId), - "", - "
" - ].join(""); + return '
' + this.localize("Background") + "" + this.createElSelect_("backgroundColor", legendId) + '' + this.createElSelect_("backgroundOpacity", legendId) + "
"; }, /** * Create window color element for the component * @@ -9955,17 +9930,7 @@ * @private */ _proto.createElWinColor_ = function() { var legendId = "captions-window-" + this.id_; - return [ - '
', - '', - this.localize("Window"), - "", - this.createElSelect_("windowColor", legendId), - '', - this.createElSelect_("windowOpacity", legendId), - "", - "
" - ].join(""); + return '
' + this.localize("Window") + "" + this.createElSelect_("windowColor", legendId) + '' + this.createElSelect_("windowOpacity", legendId) + "
"; }, /** * Create color elements for the component * @@ -9992,17 +9957,7 @@ */ _proto.createElFont_ = function() { return createEl("div", { className: "vjs-track-settings-font", - innerHTML: [ - '
', - this.createElSelect_("fontPercent", "", "legend"), - "
", - '
', - this.createElSelect_("edgeStyle", "", "legend"), - "
", - '
', - this.createElSelect_("fontFamily", "", "legend"), - "
" - ].join("") + innerHTML: '
' + this.createElSelect_("fontPercent", "", "legend") + '
' + this.createElSelect_("edgeStyle", "", "legend") + '
' + this.createElSelect_("fontFamily", "", "legend") + "
" }); }, /** * Create controls for the component @@ -10015,13 +9970,7 @@ var defaultsDescription = this.localize("restore all settings to the default values"); return createEl("div", { className: "vjs-track-settings-controls", - innerHTML: [ - '", - '" - ].join("") + innerHTML: '" }); }, _proto.content = function() { return [ diff --git a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js index 7f01d9787c47..55d4a0d59d5a 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/syncfusion/933-e9f9a6bf671b96fc/output.js @@ -19812,41 +19812,33 @@ function fb_calculate_attributes(radius, innerConainer, trgClass) { var start, end, diameter = 2 * radius, svg = innerConainer.querySelector('.' + trgClass), circle = svg.querySelector('.e-path-circle'), path = svg.querySelector('.e-path-arc'), transformOrigin = diameter / 2 + 'px'; circle.setAttribute('d', [ - 'M', + "M", radius, radius, - 'm', + "m", -radius, - 0, - 'a', + "0 a", radius, radius, - 0, - 1, - 0, + "0 1 0", 2 * radius, - 0, - 'a', + "0 a", radius, radius, - 0, - 1, - 0, + "0 1 0", -(2 * radius), - 0 - ].join(' ')), path.setAttribute('d', (start = defineArcPoints(radius, radius, radius, 45), end = defineArcPoints(radius, radius, radius, 315), [ - 'M', + "0" + ].join(" ")), path.setAttribute('d', (start = defineArcPoints(radius, radius, radius, 45), end = defineArcPoints(radius, radius, radius, 315), [ + "M", start.x, start.y, - 'A', + "A", radius, radius, - 0, - 0, - 0, + "0 0 0", end.x, end.y - ].join(' '))), svg.setAttribute('viewBox', '0 0 ' + diameter + ' ' + diameter), svg.style.transformOrigin = transformOrigin + ' ' + transformOrigin + ' ' + transformOrigin, svg.style.width = svg.style.height = diameter + 'px'; + ].join(" "))), svg.setAttribute('viewBox', '0 0 ' + diameter + ' ' + diameter), svg.style.transformOrigin = transformOrigin + ' ' + transformOrigin + ' ' + transformOrigin, svg.style.width = svg.style.height = diameter + 'px'; } /** * diff --git a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js index ca5e8ca3cd22..9e9bcdff4f19 100644 --- a/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js +++ b/crates/swc_ecma_minifier/tests/fixture/next/wrap-contracts/output.js @@ -6399,23 +6399,7 @@ }, DERNode.prototype._encodeTime = function(time, tag) { let str; const date = new Date(time); - return 'gentime' === tag ? str = [ - two(date.getUTCFullYear()), - two(date.getUTCMonth() + 1), - two(date.getUTCDate()), - two(date.getUTCHours()), - two(date.getUTCMinutes()), - two(date.getUTCSeconds()), - 'Z' - ].join('') : 'utctime' === tag ? str = [ - two(date.getUTCFullYear() % 100), - two(date.getUTCMonth() + 1), - two(date.getUTCDate()), - two(date.getUTCHours()), - two(date.getUTCMinutes()), - two(date.getUTCSeconds()), - 'Z' - ].join('') : this.reporter.error('Encoding ' + tag + ' time is not supported yet'), this._encodeStr(str, 'octstr'); + return 'gentime' === tag ? str = "" + two(date.getUTCFullYear()) + two(date.getUTCMonth() + 1) + two(date.getUTCDate()) + two(date.getUTCHours()) + two(date.getUTCMinutes()) + two(date.getUTCSeconds()) + "Z" : 'utctime' === tag ? str = "" + two(date.getUTCFullYear() % 100) + two(date.getUTCMonth() + 1) + two(date.getUTCDate()) + two(date.getUTCHours()) + two(date.getUTCMinutes()) + two(date.getUTCSeconds()) + "Z" : this.reporter.error('Encoding ' + tag + ' time is not supported yet'), this._encodeStr(str, 'octstr'); }, DERNode.prototype._encodeNull = function() { return this._createEncoderBuffer(''); }, DERNode.prototype._encodeInt = function(num, values) { diff --git a/crates/swc_ecma_minifier/tests/libs-size.snapshot.md b/crates/swc_ecma_minifier/tests/libs-size.snapshot.md index d68366a7ed6e..84e31898db26 100644 --- a/crates/swc_ecma_minifier/tests/libs-size.snapshot.md +++ b/crates/swc_ecma_minifier/tests/libs-size.snapshot.md @@ -2,13 +2,13 @@ | --- | --- | --- | --- | | antd.js | 6.38 MiB | 2.06 MiB | 445.41 KiB | | d3.js | 542.74 KiB | 261.44 KiB | 85.33 KiB | -| echarts.js | 3.41 MiB | 977.53 KiB | 314.18 KiB | +| echarts.js | 3.41 MiB | 977.49 KiB | 314.16 KiB | | jquery.js | 280.89 KiB | 87.80 KiB | 30.21 KiB | | lodash.js | 531.35 KiB | 68.91 KiB | 24.60 KiB | | moment.js | 169.83 KiB | 57.39 KiB | 18.26 KiB | | react.js | 70.45 KiB | 22.44 KiB | 8.04 KiB | -| terser.js | 1.08 MiB | 446.68 KiB | 120.49 KiB | -| three.js | 1.19 MiB | 630.83 KiB | 154.80 KiB | -| typescript.js | 10.45 MiB | 3.17 MiB | 840.66 KiB | -| victory.js | 2.30 MiB | 694.16 KiB | 154.24 KiB | +| terser.js | 1.08 MiB | 446.67 KiB | 120.49 KiB | +| three.js | 1.19 MiB | 630.82 KiB | 154.79 KiB | +| typescript.js | 10.45 MiB | 3.17 MiB | 840.64 KiB | +| victory.js | 2.30 MiB | 694.12 KiB | 154.21 KiB | | vue.js | 334.13 KiB | 113.72 KiB | 41.82 KiB | diff --git a/crates/swc_ecma_minifier/tests/passing.txt b/crates/swc_ecma_minifier/tests/passing.txt index 78eb3e54219f..7e531d066a9d 100644 --- a/crates/swc_ecma_minifier/tests/passing.txt +++ b/crates/swc_ecma_minifier/tests/passing.txt @@ -11,6 +11,8 @@ arguments/replace_index_keep_fargs/input.js arguments/replace_index_strict/input.js arguments/replace_index/input.js array_constructor/array_constructor/input.js +arrays/constant_join_2/input.js +arrays/constant_join/input.js arrays/holes_and_undefined/input.js arrays/index/input.js arrays/length/input.js @@ -516,6 +518,7 @@ evaluate/issue_1964_1/input.js evaluate/issue_1964_2/input.js evaluate/issue_2207_1/input.js evaluate/issue_2207_2/input.js +evaluate/issue_2207_3/input.js evaluate/issue_2231_1/input.js evaluate/issue_2231_2/input.js evaluate/issue_2231_3/input.js diff --git a/crates/swc_ecma_minifier/tests/projects-size.snapshot.md b/crates/swc_ecma_minifier/tests/projects-size.snapshot.md index f8307655c6cf..d87123a634a0 100644 --- a/crates/swc_ecma_minifier/tests/projects-size.snapshot.md +++ b/crates/swc_ecma_minifier/tests/projects-size.snapshot.md @@ -1,11 +1,11 @@ | File | Original Size | Compressed Size | Gzipped Size | | --- | --- | --- | --- | -| angular-1.2.5.js | 757.44 KiB | 101.92 KiB | 37.18 KiB | +| angular-1.2.5.js | 757.44 KiB | 101.91 KiB | 37.18 KiB | | backbone-1.1.0.js | 59.77 KiB | 18.33 KiB | 6.29 KiB | | jquery-1.9.1.js | 309.61 KiB | 90.76 KiB | 32.09 KiB | -| jquery.mobile-1.4.2.js | 534.38 KiB | 191.29 KiB | 52.61 KiB | +| jquery.mobile-1.4.2.js | 534.38 KiB | 191.28 KiB | 52.61 KiB | | mootools-1.4.5.js | 181.36 KiB | 88.54 KiB | 27.48 KiB | | react-17.0.1.js | 82.58 KiB | 22.44 KiB | 8.04 KiB | -| react-dom-17.0.2.js | 959.53 KiB | 236.53 KiB | 72.88 KiB | +| react-dom-17.0.2.js | 959.53 KiB | 236.50 KiB | 72.87 KiB | | underscore-1.5.2.js | 43.49 KiB | 13.85 KiB | 4.69 KiB | | yui-3.12.0.js | 321.32 KiB | 86.04 KiB | 24.95 KiB | diff --git a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js index 89a40741e2df..a36b9b743d8c 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js +++ b/crates/swc_ecma_minifier/tests/projects/output/angular-1.2.5.js @@ -10391,7 +10391,7 @@ "$element", "$parse", function($scope, $exceptionHandler, $attr, $element, $parse) { - this.$viewValue = Number.NaN, this.$modelValue = Number.NaN, this.$parsers = [], this.$formatters = [], this.$viewChangeListeners = [], this.$pristine = !0, this.$dirty = !1, this.$valid = !0, this.$invalid = !1, this.$name = $attr.name; + this.$viewValue = NaN, this.$modelValue = NaN, this.$parsers = [], this.$formatters = [], this.$viewChangeListeners = [], this.$pristine = !0, this.$dirty = !1, this.$valid = !0, this.$invalid = !1, this.$name = $attr.name; var ngModelGet = $parse($attr.ngModel), ngModelSet = ngModelGet.assign; if (!ngModelSet) throw minErr("ngModel")("nonassign", "Expression '{0}' is non-assignable. Element: {1}", $attr.ngModel, startingTag($element)); /** diff --git a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js index 79f28732e3ef..fe13dc683ed2 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/jquery.mobile-1.4.2.js @@ -3657,11 +3657,7 @@ }), (wrapper = document1.createElement("div")).className = "ui-slider-inneroffset", j = 0, length = domSlider.childNodes.length; j < length; j++)wrapper.appendChild(domSlider.childNodes[j]); for(domSlider.appendChild(wrapper), // slider.wrapInner( "
" ); // make the handle move with a smooth transition - handle.addClass("ui-slider-handle-snapping"), i = 0, optionsCount = (options = control.find("option")).length; i < optionsCount; i++)side = i ? "a" : "b", activeClass = i ? " " + jQuery.mobile.activeBtnClass : "", (sliderImg = document1.createElement("span")).className = [ - "ui-slider-label ui-slider-label-", - side, - activeClass - ].join(""), sliderImg.setAttribute("role", "img"), sliderImg.appendChild(document1.createTextNode(options[i].innerHTML)), jQuery(sliderImg).prependTo(slider); + handle.addClass("ui-slider-handle-snapping"), i = 0, optionsCount = (options = control.find("option")).length; i < optionsCount; i++)side = i ? "a" : "b", activeClass = i ? " " + jQuery.mobile.activeBtnClass : "", (sliderImg = document1.createElement("span")).className = "ui-slider-label ui-slider-label-" + side + activeClass, sliderImg.setAttribute("role", "img"), sliderImg.appendChild(document1.createTextNode(options[i].innerHTML)), jQuery(sliderImg).prependTo(slider); this._labels = jQuery(".ui-slider-label", slider); } // monitor the input for updated values diff --git a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js index 3e07e78d43a0..fd61ce1af53f 100644 --- a/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js +++ b/crates/swc_ecma_minifier/tests/projects/output/react-dom-17.0.2.js @@ -11132,7 +11132,7 @@ // Learn more about this here: // https://github.com/facebook/react/issues/14365 // https://bugs.chromium.org/p/v8/issues/detail?id=8538 - this.actualDuration = Number.NaN, this.actualStartTime = Number.NaN, this.selfBaseDuration = Number.NaN, this.treeBaseDuration = Number.NaN, // This won't trigger the performance cliff mentioned above, + this.actualDuration = NaN, this.actualStartTime = NaN, this.selfBaseDuration = NaN, this.treeBaseDuration = NaN, // This won't trigger the performance cliff mentioned above, // and it simplifies other profiler code (including DevTools). this.actualDuration = 0, this.actualStartTime = -1, this.selfBaseDuration = 0, this.treeBaseDuration = 0, // This isn't directly used but is handy for debugging internals: this._debugID = debugCounter++, this._debugSource = null, this._debugOwner = null, this._debugNeedsRemount = !1, this._debugHookTypes = null, hasBadMapPolyfill || "function" != typeof Object.preventExtensions || Object.preventExtensions(this); diff --git a/crates/swc_ecma_parser/Cargo.toml b/crates/swc_ecma_parser/Cargo.toml index 1a66d6bbcad7..f504e2287029 100644 --- a/crates/swc_ecma_parser/Cargo.toml +++ b/crates/swc_ecma_parser/Cargo.toml @@ -7,7 +7,7 @@ include = ["Cargo.toml", "src/**/*.rs", "examples/**/*.rs"] license = { workspace = true } name = "swc_ecma_parser" repository = { workspace = true } -version = "18.0.0" +version = "18.0.1" [package.metadata.docs.rs] all-features = true @@ -36,14 +36,13 @@ serde = { workspace = true, features = ["derive"] } smallvec = { workspace = true } smartstring = { workspace = true } tracing = { workspace = true } -typed-arena = { workspace = true } new_debug_unreachable = { workspace = true } phf = { workspace = true, features = ["macros"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_lexer = { version = "18.0.0", path = "../swc_ecma_lexer" } +swc_ecma_lexer = { version = "18.0.1", path = "../swc_ecma_lexer" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit", optional = true } [target.'cfg(not(any(target_arch = "wasm32", target_arch = "arm")))'.dependencies] diff --git a/crates/swc_ecma_parser/src/parser/expr.rs b/crates/swc_ecma_parser/src/parser/expr.rs index 1ee713bc6603..eb0dd85d0a82 100644 --- a/crates/swc_ecma_parser/src/parser/expr.rs +++ b/crates/swc_ecma_parser/src/parser/expr.rs @@ -1,15 +1,19 @@ use either::Either; use swc_common::{BytePos, Span, Spanned}; use swc_ecma_lexer::{ - common::parser::{ - class_and_fn::parse_fn_expr, - expr::{ - parse_array_lit, parse_await_expr, parse_lit, parse_member_expr_or_new_expr, - parse_paren_expr_or_arrow_fn, parse_primary_expr_rest, parse_this_expr, - try_parse_async_start, try_parse_regexp, + common::{ + lexer::token::TokenFactory, + parser::{ + class_and_fn::parse_fn_expr, + expr::{ + parse_array_lit, parse_await_expr, parse_lit, parse_member_expr_or_new_expr, + parse_paren_expr_or_arrow_fn, parse_primary_expr_rest, parse_this_expr, + try_parse_async_start, try_parse_regexp, + }, + object::parse_object_expr, + token_and_span::TokenAndSpan, + typescript::parse_ts_type_assertion, }, - object::parse_object_expr, - typescript::parse_ts_type_assertion, }, error::SyntaxError, }; @@ -34,41 +38,44 @@ impl Parser { pub(super) fn parse_unary_expr(&mut self) -> PResult> { trace_cur!(self, parse_unary_expr); - let start = self.cur_pos(); - - if self.input_mut().cur().is_some_and(|cur| cur == &Token::Lt) { - if self.input().syntax().typescript() && !self.input().syntax().jsx() { - self.bump(); // consume `<` - return if self.input_mut().eat(&Token::Const) { - self.expect(&Token::Gt)?; - let expr = self.parse_unary_expr()?; - Ok(TsConstAssertion { - span: self.span(start), - expr, - } - .into()) - } else { - parse_ts_type_assertion(self, start) - .map(Expr::from) - .map(Box::new) - }; - } else if self.input().syntax().jsx() - && self.input_mut().peek().is_some_and(|peek| { - (*peek).is_word() || peek == &Token::Gt || peek.should_rescan_into_gt_in_jsx() - }) - { - fn into_expr(e: Either) -> Box { - match e { - Either::Left(l) => l.into(), - Either::Right(r) => r.into(), - } + + self.input_mut().cur(); + let Some(token_and_span) = self.input().get_cur() else { + syntax_error!(self, self.input().cur_span(), SyntaxError::TS1109); + }; + let start = token_and_span.span().lo; + let cur = *token_and_span.token(); + + if cur == Token::Lt && self.input().syntax().typescript() && !self.input().syntax().jsx() { + self.bump(); // consume `<` + return if self.input_mut().eat(&Token::Const) { + self.expect(&Token::Gt)?; + let expr = self.parse_unary_expr()?; + Ok(TsConstAssertion { + span: self.span(start), + expr, + } + .into()) + } else { + parse_ts_type_assertion(self, start) + .map(Expr::from) + .map(Box::new) + }; + } else if cur == Token::Lt + && self.input().syntax().jsx() + && self.input_mut().peek().is_some_and(|peek| { + (*peek).is_word() || peek == &Token::Gt || peek.should_rescan_into_gt_in_jsx() + }) + { + fn into_expr(e: Either) -> Box { + match e { + Either::Left(l) => l.into(), + Either::Right(r) => r.into(), } - return self.parse_jsx_element(true).map(into_expr); } - } - - // Parse update expression - if self.input_mut().is(&Token::PlusPlus) || self.input_mut().is(&Token::MinusMinus) { + return self.parse_jsx_element(true).map(into_expr); + } else if matches!(cur, Token::PlusPlus | Token::MinusMinus) { + // Parse update expression let op = if self.bump() == Token::PlusPlus { op!("++") } else { @@ -86,19 +93,15 @@ impl Parser { arg, } .into()); - } - - // Parse unary expression - - if self.input_mut().cur().is_some_and(|cur| { - cur == &Token::Delete - || cur == &Token::Void - || cur == &Token::TypeOf - || cur == &Token::Plus - || cur == &Token::Minus - || cur == &Token::Tilde - || cur == &Token::Bang - }) { + } else if cur == Token::Delete + || cur == Token::Void + || cur == Token::TypeOf + || cur == Token::Plus + || cur == Token::Minus + || cur == Token::Tilde + || cur == Token::Bang + { + // Parse unary expression let cur = self.bump(); let op = if cur == Token::Delete { op!("delete") @@ -140,9 +143,7 @@ impl Parser { arg, } .into()); - } - - if self.input_mut().is(&Token::Await) { + } else if cur == Token::Await { return parse_await_expr(self, None); } diff --git a/crates/swc_ecma_preset_env/Cargo.toml b/crates/swc_ecma_preset_env/Cargo.toml index 1924f2ad0709..343e25feb3f1 100644 --- a/crates/swc_ecma_preset_env/Cargo.toml +++ b/crates/swc_ecma_preset_env/Cargo.toml @@ -30,7 +30,7 @@ preset_env_base = { version = "4.0.0", path = "../preset_env_base" } rustc-hash = { workspace = true } string_enum = { version = "1.0.1", path = "../string_enum" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms", features = [ "compat", @@ -45,7 +45,7 @@ criterion = { workspace = true } pretty_assertions = { workspace = true } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } testing = { version = "14.0.0", path = "../testing" } [[bench]] diff --git a/crates/swc_ecma_quote/Cargo.toml b/crates/swc_ecma_quote/Cargo.toml index c514777f0ab0..73c4000a60b2 100644 --- a/crates/swc_ecma_quote/Cargo.toml +++ b/crates/swc_ecma_quote/Cargo.toml @@ -13,7 +13,7 @@ bench = false [dependencies] swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_quote_macros = { version = "18.0.0", path = "../swc_ecma_quote_macros" } diff --git a/crates/swc_ecma_quote_macros/Cargo.toml b/crates/swc_ecma_quote_macros/Cargo.toml index d9fbb2c84c11..c67eff51cfc2 100644 --- a/crates/swc_ecma_quote_macros/Cargo.toml +++ b/crates/swc_ecma_quote_macros/Cargo.toml @@ -20,7 +20,7 @@ rustc-hash = { workspace = true } syn = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_macros_common = { version = "1.0.1", path = "../swc_macros_common" } diff --git a/crates/swc_ecma_react_compiler/Cargo.toml b/crates/swc_ecma_react_compiler/Cargo.toml index 283e5bb8dbeb..c39e75f5b394 100644 --- a/crates/swc_ecma_react_compiler/Cargo.toml +++ b/crates/swc_ecma_react_compiler/Cargo.toml @@ -14,10 +14,10 @@ version = "6.0.1" [dependencies] swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } [dev-dependencies] -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_regexp/Cargo.toml b/crates/swc_ecma_regexp/Cargo.toml index 2751b3339ee8..76e72bff4e8b 100644 --- a/crates/swc_ecma_regexp/Cargo.toml +++ b/crates/swc_ecma_regexp/Cargo.toml @@ -21,7 +21,7 @@ rustc-hash = { workspace = true } unicode-id-start = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_regexp_ast = { version = "0.2.0", path = "../swc_ecma_regexp_ast" } swc_ecma_regexp_common = { version = "0.0.1", path = "../swc_ecma_regexp_common" } swc_ecma_regexp_visit = { version = "0.2.0", path = "../swc_ecma_regexp_visit" } diff --git a/crates/swc_ecma_regexp_ast/Cargo.toml b/crates/swc_ecma_regexp_ast/Cargo.toml index b83de1fbdf49..a4048adb42f9 100644 --- a/crates/swc_ecma_regexp_ast/Cargo.toml +++ b/crates/swc_ecma_regexp_ast/Cargo.toml @@ -25,5 +25,5 @@ rancor = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_regexp_common = { version = "0.0.1", path = "../swc_ecma_regexp_common" } diff --git a/crates/swc_ecma_regexp_visit/Cargo.toml b/crates/swc_ecma_regexp_visit/Cargo.toml index 4ddd59bcfad1..7cbd20af710a 100644 --- a/crates/swc_ecma_regexp_visit/Cargo.toml +++ b/crates/swc_ecma_regexp_visit/Cargo.toml @@ -20,7 +20,7 @@ serde-impl = ["serde"] serde = { workspace = true, optional = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_regexp_ast = { version = "0.2.0", path = "../swc_ecma_regexp_ast" } swc_html_ast = { version = "13.0.0", path = "../swc_html_ast" } swc_visit = { version = "2.0.1", path = "../swc_visit" } diff --git a/crates/swc_ecma_transforms/Cargo.toml b/crates/swc_ecma_transforms/Cargo.toml index 1f4ddf2d2ca8..7ba9c4ddce5b 100644 --- a/crates/swc_ecma_transforms/Cargo.toml +++ b/crates/swc_ecma_transforms/Cargo.toml @@ -36,11 +36,11 @@ typescript = ["swc_ecma_transforms_typescript"] par-core = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_compat = { version = "21.0.0", path = "../swc_ecma_transforms_compat", optional = true } -swc_ecma_transforms_module = { version = "21.0.0", path = "../swc_ecma_transforms_module", optional = true } +swc_ecma_transforms_module = { version = "21.0.1", path = "../swc_ecma_transforms_module", optional = true } swc_ecma_transforms_optimization = { version = "20.0.0", path = "../swc_ecma_transforms_optimization", optional = true } swc_ecma_transforms_proposal = { version = "19.0.0", path = "../swc_ecma_transforms_proposal", optional = true } swc_ecma_transforms_react = { version = "21.0.0", path = "../swc_ecma_transforms_react", optional = true } @@ -56,6 +56,6 @@ swc_sourcemap = { workspace = true } tempfile = { workspace = true } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_transforms_base/Cargo.toml b/crates/swc_ecma_transforms_base/Cargo.toml index 2f08c797c117..9128681bf792 100644 --- a/crates/swc_ecma_transforms_base/Cargo.toml +++ b/crates/swc_ecma_transforms_base/Cargo.toml @@ -7,14 +7,14 @@ include = ["Cargo.toml", "src/**/*.rs", "src/**/*.js"] license = { workspace = true } name = "swc_ecma_transforms_base" repository = { workspace = true } -version = "19.0.0" +version = "19.0.1" [lib] bench = false [features] -concurrent = ["concurrent-renamer", "rayon", "swc_ecma_utils/concurrent"] -concurrent-renamer = ["rayon"] +concurrent = ["concurrent-renamer", "par-iter", "swc_ecma_utils/concurrent"] +concurrent-renamer = ["par-iter"] [dependencies] better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" } @@ -22,17 +22,17 @@ bitflags = { workspace = true } indexmap = { workspace = true } once_cell = { workspace = true } par-core = { workspace = true } +par-iter = { workspace = true, optional = true } phf = { workspace = true, features = ["macros"] } -rayon = { workspace = true, optional = true } rustc-hash = { workspace = true } serde = { workspace = true, features = ["derive"] } smallvec = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_base/benches/parallel.rs b/crates/swc_ecma_transforms_base/benches/parallel.rs index fbe48a30a7db..89f10e500c3c 100644 --- a/crates/swc_ecma_transforms_base/benches/parallel.rs +++ b/crates/swc_ecma_transforms_base/benches/parallel.rs @@ -3,7 +3,7 @@ extern crate swc_malloc; use codspeed_criterion_compat::{black_box, criterion_group, criterion_main, Bencher, Criterion}; -use rayon::prelude::*; +use par_iter::prelude::*; use swc_common::{errors::HANDLER, FileName, Mark, GLOBALS}; use swc_ecma_ast::Program; use swc_ecma_parser::{Parser, StringInput, Syntax}; diff --git a/crates/swc_ecma_transforms_base/src/perf.rs b/crates/swc_ecma_transforms_base/src/perf.rs index 6e7fb396f622..19469ce9a85d 100644 --- a/crates/swc_ecma_transforms_base/src/perf.rs +++ b/crates/swc_ecma_transforms_base/src/perf.rs @@ -130,7 +130,7 @@ where N: Send + Sync + FoldWith, { if nodes.len() >= threshold { - use rayon::prelude::*; + use par_iter::prelude::*; let (visitor, nodes) = GLOBALS.with(|globals| { HELPERS.with(|helpers| { diff --git a/crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs b/crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs index d639e364e681..c0e346a73120 100644 --- a/crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs +++ b/crates/swc_ecma_transforms_base/src/rename/analyzer/scope.rs @@ -8,7 +8,7 @@ use std::{ use indexmap::IndexSet; #[cfg(feature = "concurrent-renamer")] -use rayon::prelude::*; +use par_iter::prelude::*; use rustc_hash::{FxHashMap, FxHashSet, FxHasher}; use swc_atoms::{atom, Atom}; use swc_common::{util::take::Take, Mark, SyntaxContext}; diff --git a/crates/swc_ecma_transforms_base/src/rename/ops.rs b/crates/swc_ecma_transforms_base/src/rename/ops.rs index 3ae17d63b35a..d471305e3d5c 100644 --- a/crates/swc_ecma_transforms_base/src/rename/ops.rs +++ b/crates/swc_ecma_transforms_base/src/rename/ops.rs @@ -397,7 +397,7 @@ where #[cfg(feature = "concurrent")] if nodes.len() >= 8 * cpu_count() { ::swc_common::GLOBALS.with(|globals| { - use rayon::prelude::*; + use par_iter::prelude::*; let (visitor, new_nodes) = take(nodes) .into_par_iter() @@ -540,7 +540,7 @@ where #[cfg(feature = "concurrent")] if nodes.len() >= 100 * cpu_count() { ::swc_common::GLOBALS.with(|globals| { - use rayon::prelude::*; + use par_iter::prelude::*; let (visitor, new_nodes) = take(nodes) .into_par_iter() diff --git a/crates/swc_ecma_transforms_classes/Cargo.toml b/crates/swc_ecma_transforms_classes/Cargo.toml index 0d91425e63f7..efaf0a3cfdb5 100644 --- a/crates/swc_ecma_transforms_classes/Cargo.toml +++ b/crates/swc_ecma_transforms_classes/Cargo.toml @@ -13,8 +13,8 @@ bench = false [dependencies] swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_compat/Cargo.toml b/crates/swc_ecma_transforms_compat/Cargo.toml index 268e5072e3ad..05566bc503be 100644 --- a/crates/swc_ecma_transforms_compat/Cargo.toml +++ b/crates/swc_ecma_transforms_compat/Cargo.toml @@ -31,7 +31,7 @@ smallvec = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_compat_bugfixes = { version = "20.0.0", path = "../swc_ecma_compat_bugfixes" } @@ -45,7 +45,7 @@ swc_ecma_compat_es2020 = { version = "20.0.0", path = "../swc_ecma_compat_e swc_ecma_compat_es2021 = { version = "19.0.0", path = "../swc_ecma_compat_es2021" } swc_ecma_compat_es2022 = { version = "20.0.0", path = "../swc_ecma_compat_es2022" } swc_ecma_compat_es3 = { version = "19.0.0", path = "../swc_ecma_compat_es3" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "19.0.0", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } @@ -56,6 +56,6 @@ swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } par-core = { workspace = true, features = ["chili"] } serde_json = { workspace = true } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_transforms_module/Cargo.toml b/crates/swc_ecma_transforms_module/Cargo.toml index bd5e4d568cb0..13f29cc65ecb 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 = { workspace = true } name = "swc_ecma_transforms_module" repository = { workspace = true } -version = "21.0.0" +version = "21.0.1" [lib] bench = false @@ -26,16 +26,15 @@ serde = { workspace = true, features = ["derive"] } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config", features = [ "file_pattern", ] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader", features = [ - "node", ] } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_optimization/Cargo.toml b/crates/swc_ecma_transforms_optimization/Cargo.toml index 9c30f641f5e2..f56dc9a88c56 100644 --- a/crates/swc_ecma_transforms_optimization/Cargo.toml +++ b/crates/swc_ecma_transforms_optimization/Cargo.toml @@ -34,10 +34,10 @@ serde_json = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -48,7 +48,7 @@ par-core = { workspace = true, features = ["chili"] } swc_ecma_transforms_compat = { version = "21.0.0", path = "../swc_ecma_transforms_compat" } -swc_ecma_transforms_module = { version = "21.0.0", path = "../swc_ecma_transforms_module" } +swc_ecma_transforms_module = { version = "21.0.1", path = "../swc_ecma_transforms_module" } swc_ecma_transforms_proposal = { version = "19.0.0", path = "../swc_ecma_transforms_proposal" } swc_ecma_transforms_react = { version = "21.0.0", path = "../swc_ecma_transforms_react" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_transforms_proposal/Cargo.toml b/crates/swc_ecma_transforms_proposal/Cargo.toml index cf27fd1aaaab..9aaf2ae0ef8a 100644 --- a/crates/swc_ecma_transforms_proposal/Cargo.toml +++ b/crates/swc_ecma_transforms_proposal/Cargo.toml @@ -23,10 +23,10 @@ serde = { workspace = true, features = ["derive"] } smallvec = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader", optional = true } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_classes = { version = "19.0.0", path = "../swc_ecma_transforms_classes" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } @@ -36,7 +36,7 @@ swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } serde_json = { workspace = true } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_compat = { version = "21.0.0", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_transforms_react/Cargo.toml b/crates/swc_ecma_transforms_react/Cargo.toml index 2000b0314490..25ead439e413 100644 --- a/crates/swc_ecma_transforms_react/Cargo.toml +++ b/crates/swc_ecma_transforms_react/Cargo.toml @@ -31,11 +31,11 @@ sha1 = { workspace = true } string_enum = { version = "1.0.1", path = "../string_enum" } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_macros = { version = "1.0.1", path = "../swc_ecma_transforms_macros" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_transforms_testing/Cargo.toml b/crates/swc_ecma_transforms_testing/Cargo.toml index 599ecf41971d..d5b50b10fd58 100644 --- a/crates/swc_ecma_transforms_testing/Cargo.toml +++ b/crates/swc_ecma_transforms_testing/Cargo.toml @@ -23,14 +23,14 @@ swc_sourcemap = { workspace = true } tempfile = { workspace = true } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_testing = { version = "14.0.0", path = "../swc_ecma_testing" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_transforms_typescript/Cargo.toml b/crates/swc_ecma_transforms_typescript/Cargo.toml index 38170e91e7f9..f0282ff77d99 100644 --- a/crates/swc_ecma_transforms_typescript/Cargo.toml +++ b/crates/swc_ecma_transforms_typescript/Cargo.toml @@ -23,9 +23,9 @@ ryu-js = { workspace = true } serde = { workspace = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_react = { version = "21.0.0", path = "../swc_ecma_transforms_react" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -35,7 +35,7 @@ codspeed-criterion-compat = { workspace = true } criterion = { workspace = true } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms_compat = { version = "21.0.0", path = "../swc_ecma_transforms_compat" } swc_ecma_transforms_proposal = { version = "19.0.0", path = "../swc_ecma_transforms_proposal" } swc_ecma_transforms_testing = { version = "22.0.0", path = "../swc_ecma_transforms_testing" } diff --git a/crates/swc_ecma_usage_analyzer/Cargo.toml b/crates/swc_ecma_usage_analyzer/Cargo.toml index 8f53789a99f0..e6465e122572 100644 --- a/crates/swc_ecma_usage_analyzer/Cargo.toml +++ b/crates/swc_ecma_usage_analyzer/Cargo.toml @@ -29,7 +29,7 @@ rustc-hash = { workspace = true } tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_ecma_utils/Cargo.toml b/crates/swc_ecma_utils/Cargo.toml index e796fae06455..38ece21582e2 100644 --- a/crates/swc_ecma_utils/Cargo.toml +++ b/crates/swc_ecma_utils/Cargo.toml @@ -32,7 +32,7 @@ tracing = { workspace = true } unicode-id = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -41,5 +41,5 @@ stacker = { version = "0.1.15", optional = true } [dev-dependencies] par-core = { workspace = true, features = ["chili"] } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_ecma_visit/Cargo.toml b/crates/swc_ecma_visit/Cargo.toml index d6199dba7300..25e6c4a5f2bc 100644 --- a/crates/swc_ecma_visit/Cargo.toml +++ b/crates/swc_ecma_visit/Cargo.toml @@ -28,6 +28,6 @@ serde = { workspace = true, optional = true, features = ["derive tracing = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_visit = { version = "2.0.1", path = "../swc_visit" } diff --git a/crates/swc_ecmascript/Cargo.toml b/crates/swc_ecmascript/Cargo.toml index df1d7195de02..db44945c5a3e 100644 --- a/crates/swc_ecmascript/Cargo.toml +++ b/crates/swc_ecmascript/Cargo.toml @@ -40,8 +40,8 @@ typescript = ["typescript-parser", "swc_ecma_transforms/typescript"] [dependencies] swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen", optional = true } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier", optional = true } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser", optional = true, default-features = false } +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier", optional = true } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser", optional = true, default-features = false } swc_ecma_preset_env = { version = "24.0.0", path = "../swc_ecma_preset_env", optional = true } swc_ecma_quote = { version = "18.0.0", path = "../swc_ecma_quote", optional = true } swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms", optional = true } diff --git a/crates/swc_error_reporters/Cargo.toml b/crates/swc_error_reporters/Cargo.toml index 3d11a78d69ff..f242a85ecbe7 100644 --- a/crates/swc_error_reporters/Cargo.toml +++ b/crates/swc_error_reporters/Cargo.toml @@ -20,6 +20,6 @@ serde = { workspace = true } serde_derive = { workspace = true } serde_json = { workspace = true } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "concurrent", ] } diff --git a/crates/swc_estree_ast/Cargo.toml b/crates/swc_estree_ast/Cargo.toml index ad4e5c147422..ff18a93d2feb 100644 --- a/crates/swc_estree_ast/Cargo.toml +++ b/crates/swc_estree_ast/Cargo.toml @@ -27,4 +27,4 @@ serde_json = { workspace = true } better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_estree_compat/Cargo.toml b/crates/swc_estree_compat/Cargo.toml index 425cadc9408a..a0904575f492 100644 --- a/crates/swc_estree_compat/Cargo.toml +++ b/crates/swc_estree_compat/Cargo.toml @@ -25,12 +25,12 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", "tty-emitter", ] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_estree_ast = { version = "13.0.0", path = "../swc_estree_ast" } @@ -41,9 +41,9 @@ codspeed-criterion-compat = { workspace = true } criterion = { workspace = true } pretty_assertions = { workspace = true } -swc = { version = "29.0.0", path = "../swc" } +swc = { version = "29.1.0", path = "../swc" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms/" } testing = { version = "14.0.0", path = "../testing" } walkdir = { workspace = true } diff --git a/crates/swc_graph_analyzer/Cargo.toml b/crates/swc_graph_analyzer/Cargo.toml index 3ce88d0cfbb1..8be8ab48f80d 100644 --- a/crates/swc_graph_analyzer/Cargo.toml +++ b/crates/swc_graph_analyzer/Cargo.toml @@ -15,7 +15,7 @@ bench = false auto_impl = { workspace = true } petgraph = { workspace = true } rustc-hash = { workspace = true } -swc_common = { version = "13.0.2", path = "../swc_common/" } +swc_common = { version = "13.0.3", path = "../swc_common/" } tracing = { workspace = true } [dev-dependencies] diff --git a/crates/swc_html_ast/Cargo.toml b/crates/swc_html_ast/Cargo.toml index 0ee88f9f0902..4ac30eb1706c 100644 --- a/crates/swc_html_ast/Cargo.toml +++ b/crates/swc_html_ast/Cargo.toml @@ -33,4 +33,4 @@ serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.1", path = "../string_enum/" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_html_codegen/Cargo.toml b/crates/swc_html_codegen/Cargo.toml index 5da57b979d4d..56595ee5f92f 100644 --- a/crates/swc_html_codegen/Cargo.toml +++ b/crates/swc_html_codegen/Cargo.toml @@ -21,13 +21,13 @@ bitflags = { workspace = true } rustc-hash = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_html_ast = { version = "13.0.0", path = "../swc_html_ast" } swc_html_codegen_macros = { version = "1.0.0", path = "../swc_html_codegen_macros" } swc_html_utils = { version = "13.0.0", path = "../swc_html_utils" } [dev-dependencies] -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_html_parser = { version = "13.0.0", path = "../swc_html_parser" } diff --git a/crates/swc_html_minifier/Cargo.toml b/crates/swc_html_minifier/Cargo.toml index 3c65ea14b01d..203a71f773c8 100644 --- a/crates/swc_html_minifier/Cargo.toml +++ b/crates/swc_html_minifier/Cargo.toml @@ -32,7 +32,7 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_config = { version = "3.1.1", path = "../swc_config", features = ["regex"] } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast", optional = true } swc_css_codegen = { version = "13.0.0", path = "../swc_css_codegen", optional = true } @@ -42,11 +42,11 @@ swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen", features = [ "serde-impl", ] } -swc_ecma_minifier = { version = "24.0.1", path = "../swc_ecma_minifier", features = [ +swc_ecma_minifier = { version = "24.0.2", path = "../swc_ecma_minifier", features = [ "extra-serde", ] } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_html_ast = { version = "13.0.0", path = "../swc_html_ast" } swc_html_codegen = { version = "13.0.0", path = "../swc_html_codegen" } diff --git a/crates/swc_html_parser/Cargo.toml b/crates/swc_html_parser/Cargo.toml index 5540a2748010..4e6b7f9423e6 100644 --- a/crates/swc_html_parser/Cargo.toml +++ b/crates/swc_html_parser/Cargo.toml @@ -22,7 +22,7 @@ debug = [] rustc-hash = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_html_ast = { version = "13.0.0", path = "../swc_html_ast" } swc_html_utils = { version = "13.0.0", path = "../swc_html_utils" } diff --git a/crates/swc_html_utils/Cargo.toml b/crates/swc_html_utils/Cargo.toml index 78b045704b80..1560482a9947 100644 --- a/crates/swc_html_utils/Cargo.toml +++ b/crates/swc_html_utils/Cargo.toml @@ -22,4 +22,4 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_html_visit/Cargo.toml b/crates/swc_html_visit/Cargo.toml index 198a86c26530..f429eb70f00f 100644 --- a/crates/swc_html_visit/Cargo.toml +++ b/crates/swc_html_visit/Cargo.toml @@ -27,6 +27,6 @@ serde-impl = ["serde"] serde = { workspace = true, optional = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_html_ast = { version = "13.0.0", path = "../swc_html_ast" } swc_visit = { version = "2.0.1", path = "../swc_visit" } diff --git a/crates/swc_node_bundler/Cargo.toml b/crates/swc_node_bundler/Cargo.toml index 31cac3f2da1d..2b7c6783fd7a 100644 --- a/crates/swc_node_bundler/Cargo.toml +++ b/crates/swc_node_bundler/Cargo.toml @@ -30,18 +30,18 @@ serde_json = { workspace = true } tracing = { workspace = true } string_enum = { version = "1.0.1", path = "../string_enum" } -swc = { version = "29.0.0", path = "../swc" } +swc = { version = "29.1.0", path = "../swc" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } swc_bundler = { version = "23.0.0", path = "../swc_bundler", features = [ "concurrent", ] } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "concurrent", ] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_transforms = { version = "23.0.0", path = "../swc_ecma_transforms" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_node_comments/Cargo.toml b/crates/swc_node_comments/Cargo.toml index b3edd6c48a1e..83568a00892f 100644 --- a/crates/swc_node_comments/Cargo.toml +++ b/crates/swc_node_comments/Cargo.toml @@ -19,4 +19,4 @@ dashmap = { workspace = true } rustc-hash = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_plugin_proxy/Cargo.toml b/crates/swc_plugin_proxy/Cargo.toml index f69a37547538..c613129adf13 100644 --- a/crates/swc_plugin_proxy/Cargo.toml +++ b/crates/swc_plugin_proxy/Cargo.toml @@ -28,6 +28,6 @@ rustc-hash = { workspace = true } tracing = { workspace = true } better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_trace_macro = { version = "2.0.1", path = "../swc_trace_macro" } diff --git a/crates/swc_plugin_runner/Cargo.toml b/crates/swc_plugin_runner/Cargo.toml index 627d08e5c31c..235b264ac9b6 100644 --- a/crates/swc_plugin_runner/Cargo.toml +++ b/crates/swc_plugin_runner/Cargo.toml @@ -6,7 +6,7 @@ edition = { workspace = true } license = { workspace = true } name = "swc_plugin_runner" repository = { workspace = true } -version = "15.0.0" +version = "15.0.1" [lib] bench = false @@ -20,7 +20,8 @@ plugin_transform_host_js = [ "wasmer-compiler-cranelift/wasm", ] plugin_transform_host_native = [ - "wasmer/default", + "wasmer/cranelift", + "wasmer/sys", "wasmer-wasix/sys", "wasmer-wasix/logging", "wasmer-wasix/host-fs", @@ -60,12 +61,11 @@ serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } tokio = { workspace = true, optional = true } tracing = { workspace = true } -virtual-fs = { workspace = true } wasmer = { workspace = true } wasmer-wasix = { workspace = true } swc_atoms = { version = "6.0.0", path = '../swc_atoms' } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "concurrent", ] } swc_css_ast = { version = "13.0.0", path = "../swc_css_ast", optional = true } @@ -89,7 +89,7 @@ swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast", features = [ "rkyv-impl", ] } swc_ecma_loader = { version = "13.0.0", path = "../swc_ecma_loader" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } swc_malloc = { version = "1.2.3", path = "../swc_malloc" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_transform_common/Cargo.toml b/crates/swc_transform_common/Cargo.toml index 5b9e0c391004..d83dcff48c4a 100644 --- a/crates/swc_transform_common/Cargo.toml +++ b/crates/swc_transform_common/Cargo.toml @@ -22,4 +22,4 @@ serde = { workspace = true } serde_json = { workspace = true } better_scoped_tls = { version = "1.0.1", path = "../better_scoped_tls" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_ts_fast_strip/Cargo.toml b/crates/swc_ts_fast_strip/Cargo.toml index a781fd102233..3f553d36f8f0 100644 --- a/crates/swc_ts_fast_strip/Cargo.toml +++ b/crates/swc_ts_fast_strip/Cargo.toml @@ -23,15 +23,15 @@ wasm-bindgen = { workspace = true, optional = true } swc_allocator = { version = "4.0.0", path = "../swc_allocator", default-features = false } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser", features = [ +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser", features = [ "unstable", ] } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } swc_ecma_transforms_react = { version = "21.0.0", path = "../swc_ecma_transforms_react" } swc_ecma_transforms_typescript = { version = "21.0.0", path = "../swc_ecma_transforms_typescript" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } diff --git a/crates/swc_typescript/Cargo.toml b/crates/swc_typescript/Cargo.toml index 1e0f73b7dde0..c2dcfb4fee44 100644 --- a/crates/swc_typescript/Cargo.toml +++ b/crates/swc_typescript/Cargo.toml @@ -15,7 +15,7 @@ rustc-hash = { workspace = true } thiserror = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_ecma_ast = { version = "13.0.0", path = "../swc_ecma_ast" } swc_ecma_utils = { version = "18.0.2", path = "../swc_ecma_utils" } swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } @@ -23,6 +23,6 @@ swc_ecma_visit = { version = "13.0.0", path = "../swc_ecma_visit" } [dev-dependencies] swc_ecma_codegen = { version = "15.0.1", path = "../swc_ecma_codegen" } -swc_ecma_parser = { version = "18.0.0", path = "../swc_ecma_parser" } -swc_ecma_transforms_base = { version = "19.0.0", path = "../swc_ecma_transforms_base" } +swc_ecma_parser = { version = "18.0.1", path = "../swc_ecma_parser" } +swc_ecma_transforms_base = { version = "19.0.1", path = "../swc_ecma_transforms_base" } testing = { version = "14.0.0", path = "../testing" } diff --git a/crates/swc_xml_ast/Cargo.toml b/crates/swc_xml_ast/Cargo.toml index 84ccdf0b135b..74622bf3d88b 100644 --- a/crates/swc_xml_ast/Cargo.toml +++ b/crates/swc_xml_ast/Cargo.toml @@ -23,4 +23,4 @@ serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.1", path = "../string_enum/" } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } diff --git a/crates/swc_xml_codegen/Cargo.toml b/crates/swc_xml_codegen/Cargo.toml index 87d3b13e25b5..2647bd280ce0 100644 --- a/crates/swc_xml_codegen/Cargo.toml +++ b/crates/swc_xml_codegen/Cargo.toml @@ -21,12 +21,12 @@ bitflags = { workspace = true } rustc-hash = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_xml_ast = { version = "13.0.0", path = "../swc_xml_ast" } swc_xml_codegen_macros = { version = "1.0.0", path = "../swc_xml_codegen_macros" } [dev-dependencies] -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "sourcemap", ] } swc_xml_parser = { version = "13.0.0", path = "../swc_xml_parser" } diff --git a/crates/swc_xml_parser/Cargo.toml b/crates/swc_xml_parser/Cargo.toml index 0a1ef7cfdc79..f3e48ddcf9cc 100644 --- a/crates/swc_xml_parser/Cargo.toml +++ b/crates/swc_xml_parser/Cargo.toml @@ -22,7 +22,7 @@ debug = [] rustc-hash = { workspace = true } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_xml_ast = { version = "13.0.0", path = "../swc_xml_ast" } [dev-dependencies] diff --git a/crates/swc_xml_visit/Cargo.toml b/crates/swc_xml_visit/Cargo.toml index 80b821644d69..80f71b033dd5 100644 --- a/crates/swc_xml_visit/Cargo.toml +++ b/crates/swc_xml_visit/Cargo.toml @@ -27,6 +27,6 @@ serde-impl = ["serde"] serde = { workspace = true, optional = true, features = ["derive"] } swc_atoms = { version = "6.0.0", path = "../swc_atoms" } -swc_common = { version = "13.0.2", path = "../swc_common" } +swc_common = { version = "13.0.3", path = "../swc_common" } swc_visit = { version = "2.0.1", path = "../swc_visit" } swc_xml_ast = { version = "13.0.0", path = "../swc_xml_ast" } diff --git a/crates/testing/Cargo.toml b/crates/testing/Cargo.toml index ba34d45842aa..65a78a4b15ce 100644 --- a/crates/testing/Cargo.toml +++ b/crates/testing/Cargo.toml @@ -24,7 +24,7 @@ serde_json = { workspace = true } tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter"] } -swc_common = { version = "13.0.2", path = "../swc_common", features = [ +swc_common = { version = "13.0.3", path = "../swc_common", features = [ "tty-emitter", ] } swc_error_reporters = { version = "15.0.0", path = "../swc_error_reporters" }