diff --git a/.cargo/config.toml b/.cargo/config.toml index 586348b..903235f 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,4 +1,7 @@ # These command aliases are not final, may change [alias] # Alias to build actual plugin binary for the specified target. -prepublish = "build --target wasm32-wasip1" \ No newline at end of file +prepublish = "build --target wasm32-wasip1" + +[target.'cfg(target_arch = "wasm32")'] +rustflags = ["--cfg=swc_ast_unknown"] diff --git a/Cargo.lock b/Cargo.lock index 684cb24..8ae2afd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,31 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +version = 4 [[package]] name = "ahash" @@ -69,12 +44,6 @@ version = "1.0.98" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - [[package]] name = "ascii" version = "1.1.0" @@ -83,36 +52,13 @@ checksum = "d92bec98840b8f03a5ff5413de5293bfcd8bf96467cf5452609f939ec6f5de16" [[package]] name = "ast_node" -version = "0.9.9" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9184f2b369b3e8625712493c89b785881f27eedc6cde480a81883cef78868b2" +checksum = "2eb025ef00a6da925cf40870b9c8d008526b6004ece399cb0974209720f0b194" dependencies = [ - "proc-macro2", "quote", - "swc_macros_common 0.3.14", - "syn 2.0.104", -] - -[[package]] -name = "ast_node" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1e2cddd48eafd883890770673b1971faceaf80a185445671abc3ea0c00593ee" -dependencies = [ - "quote", - "swc_macros_common 1.0.1", - "syn 2.0.104", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", + "swc_macros_common", + "syn", ] [[package]] @@ -121,21 +67,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" -[[package]] -name = "backtrace" -version = "0.3.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets 0.52.6", -] - [[package]] name = "base64" version = "0.22.1" @@ -152,15 +83,6 @@ dependencies = [ "vsimd", ] -[[package]] -name = "better_scoped_tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297b153aa5e573b5863108a6ddc9d5c968bd0b20e75cc614ee9821d2f45679c7" -dependencies = [ - "scoped-tls", -] - [[package]] name = "better_scoped_tls" version = "1.0.1" @@ -226,7 +148,7 @@ checksum = "efb7846e0cb180355c2dec69e721edafa36919850f1a9f52ffba4ebc0393cb71" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -264,20 +186,6 @@ dependencies = [ "serde", ] -[[package]] -name = "cargo_metadata" -version = "0.15.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" -dependencies = [ - "camino", - "cargo-platform", - "semver", - "serde", - "serde_json", - "thiserror 1.0.69", -] - [[package]] name = "cargo_metadata" version = "0.18.1" @@ -315,6 +223,12 @@ dependencies = [ "rustversion", ] +[[package]] +name = "cbor4ii" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faed1a83001dc2c9201451030cc317e35bef36c84d3781d7c5bb9f343c397da8" + [[package]] name = "cc" version = "1.2.30" @@ -392,7 +306,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.104", + "syn", ] [[package]] @@ -403,7 +317,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -440,7 +354,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -450,7 +364,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.104", + "syn", ] [[package]] @@ -483,7 +397,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -531,23 +445,12 @@ dependencies = [ [[package]] name = "from_variant" -version = "0.1.9" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32016f1242eb82af5474752d00fd8ebcd9004bd69b462b1c91de833972d08ed4" +checksum = "e5ff35a391aef949120a0340d690269b3d9f63460a6106e99bd07b961f345ea9" dependencies = [ - "proc-macro2", - "swc_macros_common 0.3.14", - "syn 2.0.104", -] - -[[package]] -name = "from_variant" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308530a56b099da144ebc5d8e179f343ad928fa2b3558d1eb3db9af18d6eff43" -dependencies = [ - "swc_macros_common 1.0.1", - "syn 2.0.104", + "swc_macros_common", + "syn", ] [[package]] @@ -578,12 +481,6 @@ dependencies = [ "wasi", ] -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - [[package]] name = "glob" version = "0.3.2" @@ -612,15 +509,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.5.2" @@ -635,14 +523,15 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hstr" -version = "2.0.0" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4933df6fceb5d21a21e9fb5b46e572a83be4108e5b544de7ebe87cc1245b5d23" +checksum = "0c43c0a9e8fbdb3bb9dc8eee85e1e2ac81605418b4c83b6b7413cbf14d56ca5c" dependencies = [ "hashbrown 0.14.5", "new_debug_unreachable", "once_cell", - "rustc-hash 2.1.1", + "rustc-hash", + "serde", "triomphe", ] @@ -784,15 +673,9 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] -[[package]] -name = "is_ci" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" - [[package]] name = "itoa" version = "1.0.15" @@ -851,11 +734,11 @@ checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" [[package]] name = "matchers" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +checksum = "d1525a2a28c7f4fa0fc98bb91ae755d1e2d1505079e05539e35bc876b5d65ae9" dependencies = [ - "regex-automata 0.1.10", + "regex-automata", ] [[package]] @@ -864,26 +747,6 @@ version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" -[[package]] -name = "miette" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" -dependencies = [ - "atty", - "backtrace", - "miette-derive 4.7.1", - "once_cell", - "owo-colors 3.5.0", - "supports-color", - "supports-hyperlinks", - "supports-unicode", - "terminal_size", - "textwrap 0.15.2", - "thiserror 1.0.69", - "unicode-width 0.1.14", -] - [[package]] name = "miette" version = "7.6.0" @@ -891,23 +754,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f98efec8807c63c752b5bd61f862c165c115b0a35685bdcfd9238c7aeb592b7" dependencies = [ "cfg-if", - "miette-derive 7.6.0", - "owo-colors 4.2.2", - "textwrap 0.16.2", + "miette-derive", + "owo-colors", + "textwrap", "unicode-width 0.1.14", ] -[[package]] -name = "miette-derive" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "miette-derive" version = "7.6.0" @@ -916,16 +768,7 @@ checksum = "db5b29714e950dbb20d5e6f74f9dcec4edbcc1067bb7f8ed198c097b8c1a818b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", + "syn", ] [[package]] @@ -945,7 +788,7 @@ checksum = "574af9cd5b9971cbfdf535d6a8d533778481b241c447826d976101e0149392a1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -956,12 +799,11 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" [[package]] name = "nu-ansi-term" -version = "0.46.0" +version = "0.50.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" dependencies = [ - "overload", - "winapi", + "windows-sys 0.60.2", ] [[package]] @@ -999,19 +841,10 @@ version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" dependencies = [ - "hermit-abi 0.5.2", + "hermit-abi", "libc", ] -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.21.3" @@ -1024,18 +857,6 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a80800c0488c3a21695ea981a54918fbb37abf04f4d0720c453632255e2ff0e" -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "owo-colors" -version = "3.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" - [[package]] name = "owo-colors" version = "4.2.2" @@ -1110,7 +931,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -1137,12 +958,6 @@ dependencies = [ "zerovec", ] -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "pretty_assertions" version = "1.4.1" @@ -1188,7 +1003,7 @@ checksum = "ca414edb151b4c8d125c12566ab0d74dc9cdba36fb80eb7b848c15f495fd32d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -1253,17 +1068,8 @@ checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.9", - "regex-syntax 0.8.5", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", + "regex-automata", + "regex-syntax", ] [[package]] @@ -1274,15 +1080,9 @@ checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.5", + "regex-syntax", ] -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - [[package]] name = "regex-syntax" version = "0.8.5" @@ -1331,21 +1131,9 @@ checksum = "246b40ac189af6c675d124b802e8ef6d5246c53e17367ce9501f8f66a81abb7a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] -[[package]] -name = "rustc-demangle" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - [[package]] name = "rustc-hash" version = "2.1.1" @@ -1412,22 +1200,32 @@ checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -1514,12 +1312,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1545,31 +1337,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string_cache" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf776ba3fa74f83bf4b63c3dcbbf82173db2632ed8452cb2d891d33f459de70f" -dependencies = [ - "new_debug_unreachable", - "parking_lot", - "phf_shared", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c711928715f1fe0fe509c53b43e993a9a557babc2d0a3567d0a3006f1ac931a0" -dependencies = [ - "phf_generator", - "phf_shared", - "proc-macro2", - "quote", -] - [[package]] name = "string_enum" version = "1.0.2" @@ -1577,8 +1344,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae36a4951ca7bd1cfd991c241584a9824a70f6aff1e7d4f693fb3f2465e4030e" dependencies = [ "quote", - "swc_macros_common 1.0.1", - "syn 2.0.104", + "swc_macros_common", + "syn", ] [[package]] @@ -1587,34 +1354,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "supports-color" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ba6faf2ca7ee42fdd458f4347ae0a9bd6bcc445ad7cb57ad82b383f18870d6f" -dependencies = [ - "atty", - "is_ci", -] - -[[package]] -name = "supports-hyperlinks" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "590b34f7c5f01ecc9d78dba4b3f445f31df750a67621cf31626f3b7441ce6406" -dependencies = [ - "atty", -] - -[[package]] -name = "supports-unicode" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8b945e45b417b125a8ec51f1b7df2f8df7920367700d1f98aedd21e5735f8b2" -dependencies = [ - "atty", -] - [[package]] name = "swc_allocator" version = "4.0.1" @@ -1624,30 +1363,17 @@ dependencies = [ "allocator-api2", "bumpalo", "hashbrown 0.14.5", - "rustc-hash 2.1.1", -] - -[[package]] -name = "swc_atoms" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f54563d7dcba626d4acfe14ed12def7ecc28e004debe3ecd2c3ee07cc47e449" -dependencies = [ - "once_cell", - "rustc-hash 1.1.0", - "serde", - "string_cache", - "string_cache_codegen", - "triomphe", + "rustc-hash", ] [[package]] name = "swc_atoms" -version = "7.0.0" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3500dcf04c84606b38464561edc5e46f5132201cb3e23cf9613ed4033d6b1bb2" +checksum = "d4ccbe2ecad10ad7432100f878a107b1d972a8aee83ca53184d00c23a078bb8a" dependencies = [ "bytecheck", + "cbor4ii", "hstr", "once_cell", "rancor", @@ -1657,70 +1383,41 @@ dependencies = [ [[package]] name = "swc_common" -version = "0.31.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d00f960c667c59c133f30492f4d07f26242fcf988a066d3871e6d3d838d528" -dependencies = [ - "ast_node 0.9.9", - "atty", - "better_scoped_tls 0.1.2", - "cfg-if", - "either", - "from_variant 0.1.9", - "new_debug_unreachable", - "num-bigint", - "once_cell", - "parking_lot", - "rustc-hash 1.1.0", - "serde", - "siphasher 0.3.11", - "string_cache", - "swc_atoms 0.5.9", - "swc_eq_ignore_macros 0.1.4", - "swc_visit 0.5.14", - "termcolor", - "tracing", - "unicode-width 0.1.14", - "url", -] - -[[package]] -name = "swc_common" -version = "14.0.2" +version = "18.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e510ae120281a9daee0b9246b6740b509b99bd78f88b2a7210c87ec78572a7" +checksum = "a1c06698254e9b47daaf9bbb062af489a350bd8d10dfaab0cabbd32d46cec69d" dependencies = [ "anyhow", - "ast_node 3.0.3", - "better_scoped_tls 1.0.1", + "ast_node", + "better_scoped_tls", "bytecheck", "bytes-str", + "cbor4ii", "either", - "from_variant 2.0.2", - "new_debug_unreachable", + "from_variant", "num-bigint", "once_cell", "parking_lot", "rancor", "rkyv", - "rustc-hash 2.1.1", + "rustc-hash", "serde", "siphasher 0.3.11", - "swc_atoms 7.0.0", - "swc_eq_ignore_macros 1.0.1", + "swc_atoms", + "swc_eq_ignore_macros", "swc_sourcemap", - "swc_visit 2.0.1", + "swc_visit", "termcolor", "tracing", - "unicode-width 0.1.14", + "unicode-width 0.2.1", "url", ] [[package]] name = "swc_config" -version = "3.1.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d94f41e0f3c4c119a06af5e164674b63ae7eb6d7c1c60e46036c4a548f9fbe44" +checksum = "72e90b52ee734ded867104612218101722ad87ff4cf74fe30383bd244a533f97" dependencies = [ "anyhow", "bytes-str", @@ -1738,19 +1435,19 @@ checksum = "7b416e8ce6de17dc5ea496e10c7012b35bbc0e3fef38d2e065eed936490db0b3" dependencies = [ "proc-macro2", "quote", - "swc_macros_common 1.0.1", - "syn 2.0.104", + "swc_macros_common", + "syn", ] [[package]] name = "swc_core" -version = "32.0.5" +version = "50.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3305ca3e02eff0cbaf481a8ebb7d3725f34426f66c682b93ad776ce73544c901" +checksum = "a54c1aed1e2ff44fa189d3ae6d60412be423c7cb6668a9b3fa97532a37c9bb8f" dependencies = [ "swc_allocator", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", "swc_ecma_parser", "swc_ecma_quote_macros", @@ -1768,31 +1465,29 @@ dependencies = [ [[package]] name = "swc_ecma_ast" -version = "14.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5d8d26e697ce58654f0816890af7a28efd8660c154b613acefa2d3727e8ec93" +checksum = "724195600825cbdd2a899d5473d2ce1f24ae418bff1231f160ecf38a3bc81f46" dependencies = [ "bitflags", - "bytecheck", + "cbor4ii", "is-macro", "num-bigint", "once_cell", "phf", - "rancor", - "rkyv", - "rustc-hash 2.1.1", + "rustc-hash", "string_enum", - "swc_atoms 7.0.0", - "swc_common 14.0.2", - "swc_visit 2.0.1", + "swc_atoms", + "swc_common", + "swc_visit", "unicode-id-start", ] [[package]] name = "swc_ecma_codegen" -version = "16.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b3a46868f249b86a74f91774c8faf12340abb86ba7c3ff152bdc7a8f94011b6" +checksum = "5c77d9d21345ca986ae3b5ff1a4fa3607b15b07ed397506e6dba32e867cf40fd" dependencies = [ "ascii", "compact_str", @@ -1800,12 +1495,12 @@ dependencies = [ "num-bigint", "once_cell", "regex", - "rustc-hash 2.1.1", + "rustc-hash", "ryu-js", "serde", "swc_allocator", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", "swc_ecma_codegen_macros", "swc_sourcemap", @@ -1819,96 +1514,77 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e276dc62c0a2625a560397827989c82a93fd545fcf6f7faec0935a82cc4ddbb8" dependencies = [ "proc-macro2", - "swc_macros_common 1.0.1", - "syn 2.0.104", + "swc_macros_common", + "syn", ] [[package]] -name = "swc_ecma_lexer" -version = "20.0.1" +name = "swc_ecma_parser" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc30a8702bc048781c69c973b2e28cabe306255147b590be066603987a2f1ee" +checksum = "0c2c1a432a5fa26e01db57a272aea12c4682fe882796418d30ca47fdf7b7ceec" dependencies = [ - "arrayvec", "bitflags", "either", - "new_debug_unreachable", "num-bigint", "phf", - "rustc-hash 2.1.1", + "rustc-hash", "seq-macro", "serde", - "smallvec", "smartstring", "stacker", - "swc_atoms 7.0.0", - "swc_common 14.0.2", - "swc_ecma_ast", - "tracing", -] - -[[package]] -name = "swc_ecma_parser" -version = "20.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b758a1f755b4f5a05f899eab2aa38404fcbe123402d37c3c85d76c6a3e90bdf6" -dependencies = [ - "either", - "num-bigint", - "serde", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", - "swc_ecma_lexer", "tracing", ] [[package]] name = "swc_ecma_quote_macros" -version = "20.0.0" +version = "29.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e580e5c58029412b493e01511c828e75a511fd9772e1a6438f070319f760ed4a" +checksum = "596dbb78166e8a0984f422fe3f635ef7f3dd94606af4cd4ad5d5cb0473b48025" dependencies = [ "anyhow", "proc-macro2", "quote", - "rustc-hash 2.1.1", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "rustc-hash", + "swc_atoms", + "swc_common", "swc_ecma_ast", "swc_ecma_parser", - "swc_macros_common 1.0.1", - "syn 2.0.104", + "swc_macros_common", + "syn", ] [[package]] name = "swc_ecma_testing" -version = "15.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd297865d417cf7e99bf36f4f29928e89ccf3446b56440e110b2f488f6d8d2d0" +checksum = "177244625cdecd268a07534c3b087f7f263604dd40f3ec7c7a984ca95351b632" dependencies = [ "anyhow", "hex", "sha2", - "testing 15.0.0", + "testing", "tracing", ] [[package]] name = "swc_ecma_transforms_base" -version = "21.0.0" +version = "32.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43d2097a813930337cd1093ffd441bf054ae26534e970cb74d820672f9da79f7" +checksum = "499486ed875ba49af2f36d0d809f61ce6e42943a3aa1d97f592d96f10fe734cc" dependencies = [ - "better_scoped_tls 1.0.1", + "better_scoped_tls", "indexmap", "once_cell", "par-core", "phf", - "rustc-hash 2.1.1", + "rustc-hash", "serde", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", "swc_ecma_parser", "swc_ecma_utils", @@ -1918,20 +1594,20 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_react" -version = "23.0.0" +version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2d54a439a68f84c9700f816744a2e379f81ed95dd9abb4ef41be3dc47503ce6" +checksum = "35d917bf232b72a3fee91b6eb281930264bab6ae1c20b311f5d27f9c918bb8ea" dependencies = [ "base64", "bytes-str", "indexmap", "once_cell", - "rustc-hash 2.1.1", + "rustc-hash", "serde", "sha1", "string_enum", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_config", "swc_ecma_ast", "swc_ecma_parser", @@ -1942,9 +1618,9 @@ dependencies = [ [[package]] name = "swc_ecma_transforms_testing" -version = "24.0.0" +version = "35.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c94f1003e20dbe57f74fa3b3cf552957c302fe5e7ed1424e68c917e6467a9d" +checksum = "29ec7851260522b2864983caa3fc7004ebb080842f49ee49a5461b779277378d" dependencies = [ "ansi_term", "anyhow", @@ -1953,7 +1629,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "swc_common 14.0.2", + "swc_common", "swc_ecma_ast", "swc_ecma_codegen", "swc_ecma_parser", @@ -1963,23 +1639,23 @@ dependencies = [ "swc_ecma_visit", "swc_sourcemap", "tempfile", - "testing 15.0.0", + "testing", ] [[package]] name = "swc_ecma_utils" -version = "19.0.0" +version = "25.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b34cc429270ae5d908574f3cf531fcb9dc52d43f689c5e8ca9598ebc117a32" +checksum = "2dd5ee449d21110a271e73d0a9f7640a8854a62cb0e2cb0c9db3445383598e21" dependencies = [ "indexmap", "num_cpus", "once_cell", "par-core", - "rustc-hash 2.1.1", + "rustc-hash", "ryu-js", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", "swc_ecma_visit", "tracing", @@ -1987,30 +1663,19 @@ dependencies = [ [[package]] name = "swc_ecma_visit" -version = "14.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d187b3440f20dac5d5a61aaedff585aefac9c75c1a6650abb7f25936a4f0e67" +checksum = "a69d63f7f704a2ec937edef90a3eba1f64602eceb60c8deb260c01131f680e8b" dependencies = [ "new_debug_unreachable", "num-bigint", - "swc_atoms 7.0.0", - "swc_common 14.0.2", + "swc_atoms", + "swc_common", "swc_ecma_ast", - "swc_visit 2.0.1", + "swc_visit", "tracing", ] -[[package]] -name = "swc_eq_ignore_macros" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63db0adcff29d220c3d151c5b25c0eabe7e32dd936212b84cdaa1392e3130497" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", -] - [[package]] name = "swc_eq_ignore_macros" version = "1.0.1" @@ -2019,33 +1684,20 @@ checksum = "c16ce73424a6316e95e09065ba6a207eba7765496fed113702278b7711d4b632" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", -] - -[[package]] -name = "swc_error_reporters" -version = "0.15.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19c5d3bfe85c5f3e50f5a604398ca6b0830a45344b602a53b153b46fe56d3f02" -dependencies = [ - "anyhow", - "miette 4.7.1", - "once_cell", - "parking_lot", - "swc_common 0.31.22", + "syn", ] [[package]] name = "swc_error_reporters" -version = "16.0.1" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7a16e3c08fd820735631820a7c220d5ce39bdc08b83eddbc73a645ef744511e" +checksum = "bbbc236f3f44337cbc13f49c7e25e92082e59279c268cbd928c3568f339d3fe0" dependencies = [ "anyhow", - "miette 7.6.0", + "miette", "once_cell", "serde", - "swc_common 14.0.2", + "swc_common", ] [[package]] @@ -2054,7 +1706,7 @@ version = "0.0.1" dependencies = [ "common", "swc_core", - "testing 0.33.25", + "testing", ] [[package]] @@ -2063,18 +1715,7 @@ version = "0.1.0" dependencies = [ "common", "swc_core", - "testing 0.33.25", -] - -[[package]] -name = "swc_macros_common" -version = "0.3.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e18fbfe83811ffae2bb23727e45829a0d19c6870bced7c0f545cc99ad248dd" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.104", + "testing", ] [[package]] @@ -2085,7 +1726,7 @@ checksum = "aae1efbaa74943dc5ad2a2fb16cbd78b77d7e4d63188f3c5b4df2b4dcd2faaae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2105,21 +1746,19 @@ checksum = "ace467dfafbbdf3aecff786b8605b35db57d945e92fd88800569aa2cba0cdf61" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] name = "swc_plugin_proxy" -version = "14.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb61022f33eb711aa1644788a76b854a795e0de89c38af3c7cd6071da34bbb58" +checksum = "8f976dc63cd8b1916f265ee7d2647c28a85b433640099a5bf07153346dedffda" dependencies = [ - "better_scoped_tls 1.0.1", - "bytecheck", - "rancor", - "rkyv", - "rustc-hash 2.1.1", - "swc_common 14.0.2", + "better_scoped_tls", + "cbor4ii", + "rustc-hash", + "swc_common", "swc_ecma_ast", "swc_trace_macro", "tracing", @@ -2127,9 +1766,9 @@ dependencies = [ [[package]] name = "swc_sourcemap" -version = "9.3.3" +version = "9.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd6e0cad02163875258edaf9ae6004e2526be137bdde6a46c540515615949b1" +checksum = "de08ef00f816acdd1a58ee8a81c0e1a59eefef2093aefe5611f256fa6b64c4d7" dependencies = [ "base64-simd", "bitvec", @@ -2137,7 +1776,7 @@ dependencies = [ "data-encoding", "debugid", "if_chain", - "rustc-hash 2.1.1", + "rustc-hash", "serde", "serde_json", "unicode-id-start", @@ -2151,29 +1790,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfd2b4b0adb82e36f2ac688d00a6a67132c7f4170c772617516793a701be89e8" dependencies = [ "quote", - "syn 2.0.104", + "syn", ] [[package]] name = "swc_transform_common" -version = "8.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca33f282df60eefee05511c9aaf557696d2f9f0e22f4a5abca318da10c22f1cc" +checksum = "6cc4a0e2aa9fac44d383127e01327710416dda5b637b0d134b7b8cf2ba6bde8e" dependencies = [ - "better_scoped_tls 1.0.1", - "rustc-hash 2.1.1", + "better_scoped_tls", + "rustc-hash", "serde", - "swc_common 14.0.2", -] - -[[package]] -name = "swc_visit" -version = "0.5.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043d11fe683dcb934583ead49405c0896a5af5face522e4682c16971ef7871b9" -dependencies = [ - "either", - "swc_visit_macros", + "swc_common", ] [[package]] @@ -2186,30 +1815,6 @@ dependencies = [ "new_debug_unreachable", ] -[[package]] -name = "swc_visit_macros" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92807d840959f39c60ce8a774a3f83e8193c658068e6d270dbe0a05e40e90b41" -dependencies = [ - "Inflector", - "proc-macro2", - "quote", - "swc_macros_common 0.3.14", - "syn 2.0.104", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - [[package]] name = "syn" version = "2.0.104" @@ -2229,7 +1834,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2260,73 +1865,27 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "terminal_size" -version = "0.1.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "testing" -version = "0.33.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c722daaa5ad2208e7abd37aa92b4699bec2b053297859faecc5ccebf3bc7425" -dependencies = [ - "ansi_term", - "cargo_metadata 0.15.4", - "difference", - "once_cell", - "pretty_assertions", - "regex", - "serde_json", - "swc_common 0.31.22", - "swc_error_reporters 0.15.22", - "testing_macros 0.2.14", - "tracing", - "tracing-subscriber", -] - [[package]] name = "testing" -version = "15.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb14720ff995a98916e7fafc6771242727ed1ac5f2725059f03f203586d8ca1b" +checksum = "ad1506c602222ebab5d96100180f8d3c015b2394eceb00a46d20c25b8b1e5100" dependencies = [ "cargo_metadata 0.18.1", "difference", "once_cell", "pretty_assertions", "regex", - "rustc-hash 2.1.1", + "rustc-hash", "serde", "serde_json", - "swc_common 14.0.2", - "swc_error_reporters 16.0.1", - "testing_macros 1.0.1", + "swc_common", + "swc_error_reporters", + "testing_macros", "tracing", "tracing-subscriber", ] -[[package]] -name = "testing_macros" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a39660370116afe46d5ff8bcb01b7afe2140dda3137ef5cb1914681e37a4ee06" -dependencies = [ - "anyhow", - "glob", - "once_cell", - "proc-macro2", - "quote", - "regex", - "relative-path", - "syn 2.0.104", -] - [[package]] name = "testing_macros" version = "1.0.1" @@ -2340,18 +1899,7 @@ dependencies = [ "quote", "regex", "relative-path", - "syn 2.0.104", -] - -[[package]] -name = "textwrap" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" -dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width 0.1.14", + "syn", ] [[package]] @@ -2390,7 +1938,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2401,7 +1949,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2457,7 +2005,7 @@ checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2483,14 +2031,14 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.19" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" +checksum = "2054a14f5307d601f88daf0553e1cbf472acc4f2c51afab632431cdcd72124d5" dependencies = [ "matchers", "nu-ansi-term", "once_cell", - "regex", + "regex-automata", "sharded-slab", "smallvec", "thread_local", @@ -2646,7 +2194,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.104", + "syn", "wasm-bindgen-shared", ] @@ -2668,7 +2216,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2909,7 +2457,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", "synstructure", ] @@ -2930,7 +2478,7 @@ checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] [[package]] @@ -2950,7 +2498,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", "synstructure", ] @@ -2984,5 +2532,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.104", + "syn", ] diff --git a/Cargo.toml b/Cargo.toml index 267e453..fc67b31 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,8 @@ resolver = "2" members = ["crates/common", "crates/debug_label", "crates/react_refresh"] [workspace.dependencies] -swc_core = "32.0.0" +swc_core = "50.0.0" +testing = "19.0.0" [profile.release] # This removes more dead code @@ -13,4 +14,3 @@ lto = true opt-level = "s" # Strip debug symbols strip = "symbols" - diff --git a/crates/common/src/atom_import_map.rs b/crates/common/src/atom_import_map.rs index 18f0eed..7081efa 100644 --- a/crates/common/src/atom_import_map.rs +++ b/crates/common/src/atom_import_map.rs @@ -45,7 +45,8 @@ impl AtomImportMap { } } ImportSpecifier::Namespace(..) => { - self.namespace_imports.insert(import.src.value.clone()); + self.namespace_imports + .insert(import.src.value.to_atom_lossy().into_owned()); continue; } _ => continue, diff --git a/crates/debug_label/Cargo.toml b/crates/debug_label/Cargo.toml index 3f72ca3..90652eb 100644 --- a/crates/debug_label/Cargo.toml +++ b/crates/debug_label/Cargo.toml @@ -25,4 +25,4 @@ swc_core = { workspace = true, features = [ "ecma_transforms_react", "testing_transform", ] } -testing = "0.33.6" +testing = { workspace = true } diff --git a/crates/debug_label/src/lib.rs b/crates/debug_label/src/lib.rs index 69d775c..c1829e6 100644 --- a/crates/debug_label/src/lib.rs +++ b/crates/debug_label/src/lib.rs @@ -31,7 +31,7 @@ fn create_debug_label_assign_expr(atom_name_id: Id) -> Expr { span: DUMMY_SP, })), right: Box::new(Expr::Lit(Lit::Str(Str { - value: atom_name, + value: atom_name.into(), span: DUMMY_SP, raw: None, }))), diff --git a/crates/react_refresh/Cargo.toml b/crates/react_refresh/Cargo.toml index c960634..aeb3356 100644 --- a/crates/react_refresh/Cargo.toml +++ b/crates/react_refresh/Cargo.toml @@ -23,4 +23,7 @@ swc_core = { workspace = true, features = [ "ecma_transforms_react", "testing_transform", ] } -testing = "0.33.6" +testing = { workspace = true } + +[lints.rust] +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(swc_ast_unknown)'] } diff --git a/crates/react_refresh/src/lib.rs b/crates/react_refresh/src/lib.rs index 7e5caf4..2053984 100644 --- a/crates/react_refresh/src/lib.rs +++ b/crates/react_refresh/src/lib.rs @@ -68,7 +68,7 @@ fn show_prop_name(pn: &PropName) -> String { use PropName::*; match pn { Ident(ref i) => i.sym.to_string(), - Str(ref s) => s.value.to_string(), + Str(ref s) => s.value.to_string_lossy().to_string(), Num(ref n) => n .raw .as_ref() @@ -80,6 +80,8 @@ fn show_prop_name(pn: &PropName) -> String { .as_ref() .expect("BigInt(b).raw should be Some") .to_string(), + #[cfg(swc_ast_unknown)] + _ => panic!("unknown node"), } } @@ -142,8 +144,8 @@ impl VisitMut for ReactRefreshTransformVisitor { match stmt { Stmt::Expr(ExprStmt { expr, .. }) => { if let Expr::Lit(Lit::Str(str_lit)) = &**expr { - if str_lit.value.as_str() == "use client" - || str_lit.value.as_str() == "use strict" + if str_lit.value.as_str() == Some("use client") + || str_lit.value.as_str() == Some("use strict") { insert_pos = i + 1; continue; @@ -162,6 +164,8 @@ impl VisitMut for ReactRefreshTransformVisitor { script.body.insert(insert_pos, jotai_cache_stmt); } } + #[cfg(swc_ast_unknown)] + _ => panic!("unknown node"), } } @@ -200,8 +204,8 @@ impl VisitMut for ReactRefreshTransformVisitor { ModuleItem::Stmt(Stmt::Expr(ExprStmt { expr, .. })) => { // Check if this is a directive like 'use client' or 'use strict' if let Expr::Lit(Lit::Str(str_lit)) = &**expr { - if str_lit.value.as_str() == "use client" - || str_lit.value.as_str() == "use strict" + if str_lit.value.as_str() == Some("use client") + || str_lit.value.as_str() == Some("use strict") { insert_pos = i + 1; continue;