From c15537a98ddd0e5ccc835eda23916638f6c259ed Mon Sep 17 00:00:00 2001 From: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com> Date: Sun, 15 Oct 2023 22:46:17 +0200 Subject: [PATCH] Bump swc (#9306) --- Cargo.lock | 431 +++++++++++++----- packages/transformers/js/core/Cargo.toml | 2 +- .../js/core/src/dependency_collector.rs | 61 ++- .../transformers/js/core/src/env_replacer.rs | 2 +- packages/transformers/js/core/src/lib.rs | 2 +- 5 files changed, 346 insertions(+), 152 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0499b4f3c96..3740d18951d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,7 +91,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -372,7 +372,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4056f63fce3b82d852c3da92b08ea59959890813a7f4ce9c0ff85b10cf301b" dependencies = [ "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -399,7 +399,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -416,7 +416,7 @@ checksum = "a26acccf6f445af85ea056362561a24ef56cdc15fcc685f03aec50b9c702cb6d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -498,7 +498,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "pmutil", "proc-macro2", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -778,7 +778,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -1333,7 +1333,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -1437,9 +1437,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro2" -version = "1.0.64" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78803b62cbf1f46fde80d7c0e803111524b9877184cfe7c3033659490ac7a7da" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -1602,9 +1602,9 @@ checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" [[package]] name = "ryu-js" -version = "0.2.2" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" +checksum = "4950d85bc52415f8432144c97c4791bd0c4f7954de32a7270ee9cccd3c22b12b" [[package]] name = "same-file" @@ -1659,9 +1659,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] @@ -1688,13 +1688,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", - "syn 1.0.105", + "syn 2.0.38", ] [[package]] @@ -1801,7 +1801,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -1858,7 +1858,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -1869,9 +1869,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "swc_atoms" -version = "0.5.9" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f54563d7dcba626d4acfe14ed12def7ecc28e004debe3ecd2c3ee07cc47e449" +checksum = "ebf7a12229f0c0efb654a6a0f8cbfd94fbd320a57c764857a82d8abe9342b450" dependencies = [ "once_cell", "rustc-hash", @@ -1883,9 +1883,9 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.32.1" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c84742fc22df1c293da5354c1cc8a5b45a045e9dc941005c1fd9cb4e9bdabc1" +checksum = "490e199e25d2aa3fbef675524fa81408651f4e7178b51110470ddd1b3e3bbe75" dependencies = [ "ahash", "ast_node", @@ -1931,14 +1931,14 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] name = "swc_core" -version = "0.83.34" +version = "0.86.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8978af13ae3630983086f55affeb44baa558312f0c3720fbf648a58e9c9b3f1" +checksum = "d40c049be93138bf3f521dd42500301762fdd5f5d326e11de012588dcd8135ca" dependencies = [ "swc_atoms", "swc_common", @@ -1958,9 +1958,9 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "0.109.1" +version = "0.110.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e063a1614daed3ea8be56e5dd8edb17003409088d2fc9ce4aca3378879812607" +checksum = "5cbbf9918976a7e7fbdb4f76fe659d08e291a8b56b524b424183fc67d1189679" dependencies = [ "bitflags 2.3.3", "is-macro", @@ -1974,9 +1974,9 @@ dependencies = [ [[package]] name = "swc_ecma_codegen" -version = "0.145.5" +version = "0.146.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "547ed57b827ea4df3e2c27cea153482f8b2ce2d271ae30c456fbb2d5a5ecc19d" +checksum = "1fba119c76654599b71099a0150094f5790f00db63aab6cda1790e731f42c98f" dependencies = [ "memchr", "num-bigint", @@ -2001,14 +2001,207 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", +] + +[[package]] +name = "swc_ecma_compat_bugfixes" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e86fbe39425c5135fbef3bd8ffbbb6d24f8d53942d21914cf765ff43d09be19" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_es2015", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_common" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ecceb5d816d6f416bff1c13aea1814e27f43a25551066c66c0fdbd834be67bf" +dependencies = [ + "swc_common", + "swc_ecma_ast", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", +] + +[[package]] +name = "swc_ecma_compat_es2015" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "000318f4ef8ad1b1e417120b630530a453165b9c6f85052010ce28d01e078e15" +dependencies = [ + "arrayvec", + "indexmap", + "is-macro", + "serde", + "serde_derive", + "smallvec", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2016" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145df6ac733548dae7f31aa21264e8609e5deb0f0a46019a3fc8e4a70c8cbf3a" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2017" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11b1d15155a9d1608e49a8d67e134d6d03e43eaa3f0e2b5eae465d84288c85f5" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2018" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "047286ba45b3afb868452b947cef646ef66d410c269935f30d494d0489c2321c" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2019" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cbbafa9873cd396980b0dbb34304545191f630b822659e7de13eedaa4ec6e26" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2020" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a22db764b289d87676997d6a3c3c00e00fe965711940aedce93a09097b742c3" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2021" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c7ded8f71201833cca75ff0eb490e5d9237e7e1808c9ca204e6e70da545829f" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es2022" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e82e116ad390b63a72250b0624100f9f0052fa0a5053bb6cd78cd11ce1636575" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_compat_common", + "swc_ecma_transforms_base", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_compat_es3" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2546a901da8f8570c1964961eb6d49962dcf1b3b95791e8c5899b4f53c46283a" +dependencies = [ + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "swc_trace_macro", + "tracing", ] [[package]] name = "swc_ecma_parser" -version = "0.140.0" +version = "0.141.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c968599841fcecfdc2e490188ad93251897a1bb912882547e6889e14a368399" +checksum = "a26e535c623db7beb04ba8ebfa821c287b72a23f9fb523990b54db6c1355c990" dependencies = [ "either", "num-bigint", @@ -2026,9 +2219,9 @@ dependencies = [ [[package]] name = "swc_ecma_preset_env" -version = "0.201.24" +version = "0.203.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3401cd267184eedf7e4c3d4806f224b6df18f1fef3fbb6a6ae3ef316e41be738" +checksum = "bfc6a6b74e0136460cf3938a873d158e02ac226c22ee8c1c002c91672cfbaeda" dependencies = [ "anyhow", "dashmap", @@ -2051,9 +2244,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms" -version = "0.224.22" +version = "0.226.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43cde8a1df6b27508859e1b4df48bca5b3bbe2702dd16f0117ae7344aeefcb7b" +checksum = "f989184c2b223d1c0d00e0c4abe2e60ce04c7cbc3be80fc28ef403799d7d00ae" dependencies = [ "swc_atoms", "swc_common", @@ -2067,9 +2260,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_base" -version = "0.133.5" +version = "0.134.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "496e3957e19c22e61cd7ff020a87e1fe94c9334f4fa11267f08614fd5f85ba67" +checksum = "37d30c5aa540b6516875d507d3dc2ca7edf77a30fe9e070868ccd2d90b85a3a3" dependencies = [ "better_scoped_tls", "bitflags 2.3.3", @@ -2090,9 +2283,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_classes" -version = "0.122.5" +version = "0.123.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "519ffccc874b8bb39db0fceec06c172b1d7a6e812ac6f4b0a000e5d3c295e495" +checksum = "abc1dd56c4f76505604c081ff540b3137da6098f0055515af7150e2f0d265af2" dependencies = [ "swc_atoms", "swc_common", @@ -2104,9 +2297,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_compat" -version = "0.159.12" +version = "0.160.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bfdc348f8e402b311cf25661086ea3bcdd8305688b582750d7934e2ba46f79e" +checksum = "413a57c78f02d51af95100928ce62af0c832169ad38c73e46c77015cbe3785f9" dependencies = [ "arrayvec", "indexmap", @@ -2118,6 +2311,17 @@ dependencies = [ "swc_common", "swc_config", "swc_ecma_ast", + "swc_ecma_compat_bugfixes", + "swc_ecma_compat_common", + "swc_ecma_compat_es2015", + "swc_ecma_compat_es2016", + "swc_ecma_compat_es2017", + "swc_ecma_compat_es2018", + "swc_ecma_compat_es2019", + "swc_ecma_compat_es2020", + "swc_ecma_compat_es2021", + "swc_ecma_compat_es2022", + "swc_ecma_compat_es3", "swc_ecma_transforms_base", "swc_ecma_transforms_classes", "swc_ecma_transforms_macros", @@ -2137,14 +2341,14 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] name = "swc_ecma_transforms_optimization" -version = "0.193.22" +version = "0.195.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf576db7189483eb6add53447b96f5cb2e4270793473b1d0663bf01b3ce1cb3c" +checksum = "3d6de1cd412b1bf59f1c71f61c6399a89faab1f2a99657cffcf889cde5cce09f" dependencies = [ "dashmap", "indexmap", @@ -2166,9 +2370,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_proposal" -version = "0.167.14" +version = "0.168.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf934ff95d993096b7c87a934092a07a830ec356cd2cdfe2ce5fa17ce8520ac6" +checksum = "67728d832bdb7d7ff44f8bfb93830df7ec1e3fe516c3022525949b92f822d8c8" dependencies = [ "either", "rustc-hash", @@ -2186,9 +2390,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "0.179.16" +version = "0.180.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3066e5671862ec921d39a210bb94e2fd82c1d4a8b2ccf44feb9017ab8afadd61" +checksum = "417f343e75a3c0c0df0504651947c012b4f8de1519d14c9e7cc7fb847326ced8" dependencies = [ "base64", "dashmap", @@ -2210,9 +2414,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_typescript" -version = "0.183.21" +version = "0.185.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c294314370dd20734aa11fb7d05931df2fcef4886cd930bd9ab9aad44cf5b384" +checksum = "935b5d1dfe618b72c760edd5dfbb9f95d7e5dddfcf11f83a08e851682b0ab20f" dependencies = [ "ryu-js", "serde", @@ -2227,9 +2431,9 @@ dependencies = [ [[package]] name = "swc_ecma_utils" -version = "0.123.0" +version = "0.124.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6d6b59ebd31b25fe2692ff705c806961e7856de8b7e91fd0942328886cd315" +checksum = "4d5dd053e9a21c433504664d7083869c9d02394eb5141b101c81067067536471" dependencies = [ "indexmap", "num_cpus", @@ -2245,9 +2449,9 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "0.95.1" +version = "0.96.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2774848b306e17fa280c598ecb192cc2c72a1163942b02d48606514336e9e7c5" +checksum = "47081acd84cdb2d49d6340ed3204e17738b444da10a3e1dd1eb3d7c8e4d47091" dependencies = [ "num-bigint", "swc_atoms", @@ -2266,14 +2470,14 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] name = "swc_fast_graph" -version = "0.20.1" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2f7297cdefdb54d8d09e0294c1aec3826825b1feefd0c25978365aa7f447a1c" +checksum = "b97e69e9617913611e39284cf724a412ab7fc6081708d0ef2820855774da5357" dependencies = [ "indexmap", "petgraph", @@ -2290,7 +2494,7 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -2301,7 +2505,7 @@ checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -2325,7 +2529,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -2341,9 +2545,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.25" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15e3fc8c0c74267e2df136e5e5fb656a464158aa57624053375eb9c8c6e25ae2" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2408,7 +2612,7 @@ checksum = "463fe12d7993d3b327787537ce8dd4dfa058de32fc2b195ef3cde03dc4771e8f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.25", + "syn 2.0.38", ] [[package]] @@ -2730,113 +2934,113 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm 0.42.0", - "windows_aarch64_msvc 0.42.0", - "windows_i686_gnu 0.42.0", - "windows_i686_msvc 0.42.0", - "windows_x86_64_gnu 0.42.0", - "windows_x86_64_gnullvm 0.42.0", - "windows_x86_64_msvc 0.42.0", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "wyz" @@ -2849,17 +3053,16 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "735a71d46c4d68d71d4b24d03fdc2b98e38cea81730595801db779c04fe80d70" +checksum = "9828b178da53440fa9c766a3d2f73f7cf5d0ac1fe3980c1e5018d899fd19e07b" [[package]] name = "zopfli" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b2bed49d3f0af28729a2338ee8c3a48eba2133a78ebc560779be161ebaaad8" +checksum = "4e0650ae6a051326d798eb099b632f1afb0d323d25ee4ec82ffb0779512084d5" dependencies = [ - "byteorder", "crc32fast", "log", "simd-adler32", diff --git a/packages/transformers/js/core/Cargo.toml b/packages/transformers/js/core/Cargo.toml index a0931317c3e..521cb947526 100644 --- a/packages/transformers/js/core/Cargo.toml +++ b/packages/transformers/js/core/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" crate-type = ["rlib"] [dependencies] -swc_core = { version = "0.83.34", features = [ +swc_core = { version = "0.86.1", features = [ "common", "common_ahash", "common_sourcemap", diff --git a/packages/transformers/js/core/src/dependency_collector.rs b/packages/transformers/js/core/src/dependency_collector.rs index 2d268e29b31..62bb544afb0 100644 --- a/packages/transformers/js/core/src/dependency_collector.rs +++ b/packages/transformers/js/core/src/dependency_collector.rs @@ -720,33 +720,29 @@ impl<'a> Fold for DependencyCollector<'a> { let matched = match &*node.callee { Ident(id) => { - match &id.sym { - &js_word!("Worker") | &js_word!("SharedWorker") => { - // Bail if defined in scope - self.config.is_browser && !self.decls.contains(&id.to_id()) - } - &js_word!("Promise") => { - // Match requires inside promises (e.g. Rollup compiled dynamic imports) - // new Promise(resolve => resolve(require('foo'))) - // new Promise(resolve => { resolve(require('foo')) }) - // new Promise(function (resolve) { resolve(require('foo')) }) - return self.fold_new_promise(node); - } - sym => { - if sym == "__parcel__URL__" { - // new __parcel__URL__(url) -> new URL(url, import.meta.url) - if let Some(args) = &node.args { - if let ast::Expr::New(new) = create_url_constructor( - *args[0].expr.clone().fold_with(self), - self.config.is_esm_output, - ) { - return new; - } + if id.sym == "Worker" || id.sym == "SharedWorker" { + // Bail if defined in scope + self.config.is_browser && !self.decls.contains(&id.to_id()) + } else if id.sym == "Promise" { + // Match requires inside promises (e.g. Rollup compiled dynamic imports) + // new Promise(resolve => resolve(require('foo'))) + // new Promise(resolve => { resolve(require('foo')) }) + // new Promise(function (resolve) { resolve(require('foo')) }) + return self.fold_new_promise(node); + } else { + if id.sym == "__parcel__URL__" { + // new __parcel__URL__(url) -> new URL(url, import.meta.url) + if let Some(args) = &node.args { + if let ast::Expr::New(new) = create_url_constructor( + *args[0].expr.clone().fold_with(self), + self.config.is_esm_output, + ) { + return new; } - unreachable!(); } - false + unreachable!(); } + false } } _ => false, @@ -1361,14 +1357,8 @@ fn match_worker_type(expr: Option<&ast::ExprOrSpread>) -> (SourceType, Option {} + PropName::Ident(Ident { sym, .. }) if sym == "type" => {} + PropName::Str(Str { value, .. }) if value == "type" => {} _ => return true, }; @@ -1378,9 +1368,10 @@ fn match_worker_type(expr: Option<&ast::ExprOrSpread>) -> (SourceType, Option SourceType::Module, - _ => SourceType::Script, + source_type = Some(if v == "module" { + SourceType::Module + } else { + SourceType::Script }); false diff --git a/packages/transformers/js/core/src/env_replacer.rs b/packages/transformers/js/core/src/env_replacer.rs index c1aa2585374..24d54e17b22 100644 --- a/packages/transformers/js/core/src/env_replacer.rs +++ b/packages/transformers/js/core/src/env_replacer.rs @@ -200,7 +200,7 @@ impl<'a> EnvReplacer<'a> { self.used_env.insert(sym.clone()); return Some(Expr::Lit(Lit::Str(Str { span: DUMMY_SP, - value: val.into(), + value: val.clone(), raw: None, }))); } else if fallback_undefined { diff --git a/packages/transformers/js/core/src/lib.rs b/packages/transformers/js/core/src/lib.rs index 7ba13bddf18..b7fa321ef34 100644 --- a/packages/transformers/js/core/src/lib.rs +++ b/packages/transformers/js/core/src/lib.rs @@ -387,7 +387,7 @@ pub fn transform(config: Config) -> Result { // Transpile new syntax to older syntax if needed Optional::new( preset_env( - global_mark, + unresolved_mark, Some(&comments), preset_env_config, assumptions,