From 1c8b17483daca72bb50e1eff0bccd38d4a1a5cbc Mon Sep 17 00:00:00 2001 From: Mohamad Mohebifar Date: Sun, 24 Mar 2024 11:31:03 -0400 Subject: [PATCH 1/2] Initial commit for the unforget SWC plugin --- .gitignore | 2 +- .prettierrc | 2 +- .vscode/launch.json | 22 + .vscode/settings.json | 5 +- Cargo.lock | 2006 +++++++++++++++++ Cargo.toml | 14 + package.json | 1 + packages/swc-plugin/.cargo/config | 5 + packages/swc-plugin/Cargo.lock | 1972 ++++++++++++++++ packages/swc-plugin/Cargo.toml | 21 + packages/swc-plugin/package.json | 16 + packages/swc-plugin/src/lib.rs | 32 + packages/swc-plugin/transform/Cargo.toml | 23 + packages/swc-plugin/transform/src/lib.rs | 42 + .../transform/src/models/component.rs | 1 + .../swc-plugin/transform/src/models/mod.rs | 1 + .../transform/src/utils/ast_tools/generic.rs | 28 + .../transform/src/utils/ast_tools/mod.rs | 1 + .../transform/src/utils/babel_shims/mod.rs | 6 + .../transform/src/utils/find_components.rs | 161 ++ .../swc-plugin/transform/src/utils/mod.rs | 8 + .../swc-plugin/transform/tests/fixture.rs | 36 + .../tests/fixtures/simple-jsx/code.js | 25 + .../tests/fixtures/simple-jsx/config.json | 1 + .../tests/fixtures/simple-jsx/output.js | 1 + rust-toolchain | 1 + yarn.lock | 13 + 27 files changed, 4442 insertions(+), 4 deletions(-) create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 packages/swc-plugin/.cargo/config create mode 100644 packages/swc-plugin/Cargo.lock create mode 100644 packages/swc-plugin/Cargo.toml create mode 100644 packages/swc-plugin/package.json create mode 100644 packages/swc-plugin/src/lib.rs create mode 100644 packages/swc-plugin/transform/Cargo.toml create mode 100644 packages/swc-plugin/transform/src/lib.rs create mode 100644 packages/swc-plugin/transform/src/models/component.rs create mode 100644 packages/swc-plugin/transform/src/models/mod.rs create mode 100644 packages/swc-plugin/transform/src/utils/ast_tools/generic.rs create mode 100644 packages/swc-plugin/transform/src/utils/ast_tools/mod.rs create mode 100644 packages/swc-plugin/transform/src/utils/babel_shims/mod.rs create mode 100644 packages/swc-plugin/transform/src/utils/find_components.rs create mode 100644 packages/swc-plugin/transform/src/utils/mod.rs create mode 100644 packages/swc-plugin/transform/tests/fixture.rs create mode 100644 packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js create mode 100644 packages/swc-plugin/transform/tests/fixtures/simple-jsx/config.json create mode 100644 packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js create mode 100644 rust-toolchain diff --git a/.gitignore b/.gitignore index 3866e72..bdfb6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,4 @@ yarn-error.log* *.pem # Rust -target \ No newline at end of file +target diff --git a/.prettierrc b/.prettierrc index b0e6c85..b4bfed3 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,3 +1,3 @@ { - "plugins": ["prettier-plugin-tailwindcss"] + "plugins": ["prettier-plugin-tailwindcss"] } diff --git a/.vscode/launch.json b/.vscode/launch.json index 0b709e0..67400d5 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,6 +1,28 @@ { "version": "1.0.0", "configurations": [ + { + "type": "lldb", + "request": "launch", + "name": "Debug integration test 'fixture'", + "cargo": { + "args": [ + "test", + "--no-run", + "--test=fixture", + "--package=react_unforget_transform" + ], + "filter": { + "name": "fixture", + "kind": "test" + } + }, + "args": [], + "cwd": "${workspaceFolder}", + "env": { + "CARGO_MANIFEST_DIR": "${workspaceFolder}/packages/swc-plugin/transform" + } + }, { "type": "node", "request": "launch", diff --git a/.vscode/settings.json b/.vscode/settings.json index 55712c1..b45baf8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file + "typescript.tsdk": "node_modules/typescript/lib", + "rust-analyzer.linkedProjects": ["./Cargo.toml"] +} diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..79fc331 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2006 @@ +# 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.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" + +[[package]] +name = "ast_node" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e3e06ec6ac7d893a0db7127d91063ad7d9da8988f8a1a256f03729e6eec026" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.70" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95d8e92cac0961e91dbd517496b00f7e9b92363dbe6d42c3198268323798860c" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "better_scoped_tls" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794edcc9b3fb07bb4aecaa11f093fd45663b4feadb782d68303a2268bc2701de" +dependencies = [ + "scoped-tls", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +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 1.0.22", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.22", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "from_variant" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b11eeb173ce52f84ebd943d42e58813a2ebb78a6a3ff0a243b71c5199cd7b" +dependencies = [ + "proc-macro2", + "swc_macros_common", + "syn 2.0.53", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[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.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hstr" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17fafeca18cf0927e23ea44d7a5189c10536279dfe9094e0dfa953053fbb5377" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "phf", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "indexmap" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "is-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a85abdc13717906baccb5a1e435556ce0df215f242892f721dff62bf25288f" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "miette" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" +dependencies = [ + "atty", + "backtrace", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", + "thiserror", + "unicode-width", +] + +[[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 = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[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 = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "react_unforget_transform" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_transforms", + "swc_ecma_transforms_base", + "swc_ecma_transforms_testing", + "swc_ecma_utils", + "swc_ecma_visit", + "testing", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.6", + "regex-syntax 0.8.2", +] + +[[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", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "relative-path" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustix" +version = "0.38.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + +[[package]] +name = "sourcemap" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4cbf65ca7dc576cf50e21f8d0712d96d4fcfd797389744b7b222a85cdf5bd90" +dependencies = [ + "data-encoding", + "debugid", + "if_chain", + "rustc_version", + "serde", + "serde_json", + "unicode-id", + "url", +] + +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_enum" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b650ea2087d32854a0f20b837fc56ec987a1cb4f758c9757e1171ee9812da63" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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_atoms" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d538eaaa6f085161d088a04cf0a3a5a52c5a7f2b3bd9b83f73f058b0ed357c0" +dependencies = [ + "bytecheck", + "hstr", + "once_cell", + "rkyv", + "rustc-hash", + "serde", +] + +[[package]] +name = "swc_common" +version = "0.33.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317d2fcdbb1bc9ecfd0bfc67468d675a5159a6fd1863abf41c8c5b7b7adcab03" +dependencies = [ + "anyhow", + "ast_node", + "atty", + "better_scoped_tls", + "bytecheck", + "cfg-if", + "either", + "from_variant", + "new_debug_unreachable", + "num-bigint", + "once_cell", + "parking_lot", + "rkyv", + "rustc-hash", + "serde", + "siphasher", + "sourcemap", + "swc_atoms", + "swc_eq_ignore_macros", + "swc_visit", + "termcolor", + "tracing", + "unicode-width", + "url", +] + +[[package]] +name = "swc_core" +version = "0.90.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "354892a17af24956c9ae5479c2bd0a2f9c344aab79e6f2fbd01b7b8eb4e46c2e" +dependencies = [ + "once_cell", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_testing", + "swc_ecma_visit", + "swc_plugin", + "swc_plugin_macro", + "swc_plugin_proxy", + "vergen", +] + +[[package]] +name = "swc_ecma_ast" +version = "0.112.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70656acd47c91918635f1e8589963428cb3170975b71d786c79fb7a25605f687" +dependencies = [ + "bitflags 2.5.0", + "bytecheck", + "is-macro", + "num-bigint", + "phf", + "rkyv", + "scoped-tls", + "string_enum", + "swc_atoms", + "swc_common", + "unicode-id", +] + +[[package]] +name = "swc_ecma_codegen" +version = "0.148.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2afcce205914b8451880fc5ef63dae9bac3dc7b71917921ede64f8e7fd8447a1" +dependencies = [ + "memchr", + "num-bigint", + "once_cell", + "rustc-hash", + "serde", + "sourcemap", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen_macros", + "tracing", +] + +[[package]] +name = "swc_ecma_codegen_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "394b8239424b339a12012ceb18726ed0244fce6bf6345053cb9320b2791dcaa5" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.143.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b919bb9ae5e1c8c54fb109f7e94b4a00185bd255c1238ba823e8102601e2133" +dependencies = [ + "either", + "new_debug_unreachable", + "num-bigint", + "num-traits", + "phf", + "serde", + "smallvec", + "smartstring", + "stacker", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "tracing", + "typed-arena", +] + +[[package]] +name = "swc_ecma_testing" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5704ef494b1805bc4566ff566b964bc1e9d3fb0f0e046ad6392b09a54de844" +dependencies = [ + "anyhow", + "hex", + "sha2", + "testing", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms" +version = "0.229.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b22e7877d623332da5f2a93c204e808091ab2da1c060f794eaea66506fb530" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", +] + +[[package]] +name = "swc_ecma_transforms_base" +version = "0.137.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e9a23d6af398b6efd17bbdad2cfa580102f6c560611f85c63b48f76ffe8f0c" +dependencies = [ + "better_scoped_tls", + "bitflags 2.5.0", + "indexmap", + "once_cell", + "phf", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_utils", + "swc_ecma_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_testing" +version = "0.140.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9a51288aebf6894f8643c44ad08ed1d9c81b8bfce47195c13f9ff994b77a946" +dependencies = [ + "ansi_term", + "anyhow", + "base64", + "hex", + "serde", + "serde_json", + "sha2", + "sourcemap", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_parser", + "swc_ecma_testing", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "tempfile", + "testing", +] + +[[package]] +name = "swc_ecma_utils" +version = "0.127.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc9c6ad70038b770d844fdfc20fd970d66ccebb1edc91804c8a9adaa689d4e39" +dependencies = [ + "indexmap", + "num_cpus", + "once_cell", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_visit", + "tracing", + "unicode-id", +] + +[[package]] +name = "swc_ecma_visit" +version = "0.98.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93692bdcdbb63db8f5e10fea5d202b5487cb27eb443aec424f4335c88f9864af" +dependencies = [ + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_visit", + "tracing", +] + +[[package]] +name = "swc_eq_ignore_macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695a1d8b461033d32429b5befbf0ad4d7a2c4d6ba9cd5ba4e0645c615839e8e4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_error_reporters" +version = "0.17.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3329e73f159a3d38d4cd5f606a0918eeff39f5bbdbdafd9b6fecb290d2e9a32d" +dependencies = [ + "anyhow", + "miette", + "once_cell", + "parking_lot", + "swc_common", +] + +[[package]] +name = "swc_macros_common" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50176cfc1cbc8bb22f41c6fe9d1ec53fbe057001219b5954961b8ad0f336fce9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_plugin" +version = "0.90.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5df720531bfbd7ceb1139319c39c20c446abfb8f7e0eb47b104205a71152b4" +dependencies = [ + "once_cell", +] + +[[package]] +name = "swc_plugin_macro" +version = "0.9.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3232db481484070637b20a155c064096c0ea1ba04fa2247b89b618661b3574f4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_plugin_proxy" +version = "0.41.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "012e5996e3fe64805342b6e31a79d826402bbe4eed35be6a9366e54e41f5d75d" +dependencies = [ + "better_scoped_tls", + "rkyv", + "swc_common", + "swc_ecma_ast", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_plugin_react_unforget" +version = "0.1.0" +dependencies = [ + "react_unforget_transform", + "serde", + "serde_json", + "swc_core", +] + +[[package]] +name = "swc_trace_macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_visit" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f5b3e8d1269a7cb95358fed3412645d9c15aa0eb1f4ca003a25a38ef2f30f1b" +dependencies = [ + "either", + "swc_visit_macros", +] + +[[package]] +name = "swc_visit_macros" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fc817055fe127b4285dc85058596768bfde7537ae37da82c67815557f03e33" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +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.35.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "761d1719907168f43b49b438bdb58c41608f4af5eac0995e2a8bb16c522656c5" +dependencies = [ + "ansi_term", + "cargo_metadata 0.15.4", + "difference", + "once_cell", + "pretty_assertions", + "regex", + "serde", + "serde_json", + "swc_common", + "swc_error_reporters", + "testing_macros", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "testing_macros" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d3864d4184569c1428645a51a304b3b6e8d3094cd61fb3cce8dfdd9f6d0f72" +dependencies = [ + "anyhow", + "glob", + "once_cell", + "proc-macro2", + "quote", + "regex", + "relative-path", + "syn 2.0.53", +] + +[[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", +] + +[[package]] +name = "thiserror" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-id" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vergen" +version = "8.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +dependencies = [ + "anyhow", + "cargo_metadata 0.18.1", + "regex", + "rustversion", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "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-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..8c35ebc --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,14 @@ +[workspace] +members = ["packages/swc-plugin"] +resolver = "2" + +[profile.release] +codegen-units = 1 +# debug = true +lto = true + +# Optimize for size +opt-level = "s" + +# Strip debug symbols +strip = "symbols" diff --git a/package.json b/package.json index 6a54a86..684b7f7 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@react-unforget/eslint-config": "*", "@react-unforget/typescript-config": "*", "prettier": "^3.1.1", + "prettier-plugin-rust": "^0.1.9", "prettier-plugin-tailwindcss": "^0.5.12", "turbo": "latest" }, diff --git a/packages/swc-plugin/.cargo/config b/packages/swc-plugin/.cargo/config new file mode 100644 index 0000000..eaa0fee --- /dev/null +++ b/packages/swc-plugin/.cargo/config @@ -0,0 +1,5 @@ +# These command aliases are not final, may change +[alias] +# Alias to build actual plugin binary for the specified target. +build-wasi = "build --target wasm32-wasi" +build-wasm32 = "build --target wasm32-unknown-unknown" diff --git a/packages/swc-plugin/Cargo.lock b/packages/swc-plugin/Cargo.lock new file mode 100644 index 0000000..93f5105 --- /dev/null +++ b/packages/swc-plugin/Cargo.lock @@ -0,0 +1,1972 @@ +# 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.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0952808a6c2afd1aa8947271f3a60f1a6763c7b912d210184c5149b5cf147247" + +[[package]] +name = "ast_node" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e3e06ec6ac7d893a0db7127d91063ad7d9da8988f8a1a256f03729e6eec026" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "better_scoped_tls" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "794edcc9b3fb07bb4aecaa11f093fd45663b4feadb782d68303a2268bc2701de" +dependencies = [ + "scoped-tls", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bytecheck" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +dependencies = [ + "bytecheck_derive", + "ptr_meta", + "simdutf8", +] + +[[package]] +name = "bytecheck_derive" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" +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 1.0.22", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.22", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.0.90" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cd6604a82acf3039f1144f54b8eb34e91ffba622051189e71b781822d5ee1f5" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cpufeatures" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "data-encoding" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" + +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "serde", + "uuid", +] + +[[package]] +name = "diff" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" + +[[package]] +name = "difference" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "either" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "from_variant" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a0b11eeb173ce52f84ebd943d42e58813a2ebb78a6a3ff0a243b71c5199cd7b" +dependencies = [ + "proc-macro2", + "swc_macros_common", + "syn 2.0.53", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" + +[[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.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hstr" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17fafeca18cf0927e23ea44d7a5189c10536279dfe9094e0dfa953053fbb5377" +dependencies = [ + "new_debug_unreachable", + "once_cell", + "phf", + "rustc-hash", + "smallvec", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "if_chain" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" + +[[package]] +name = "indexmap" +version = "2.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", +] + +[[package]] +name = "is-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a85abdc13717906baccb5a1e435556ce0df215f242892f721dff62bf25288f" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[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.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.153" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" + +[[package]] +name = "linux-raw-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" + +[[package]] +name = "lock_api" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + +[[package]] +name = "memchr" +version = "2.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" + +[[package]] +name = "miette" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" +dependencies = [ + "atty", + "backtrace", + "miette-derive", + "once_cell", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", + "thiserror", + "unicode-width", +] + +[[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 = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[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 = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.48.5", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "phf" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" +dependencies = [ + "phf_shared", + "rand", +] + +[[package]] +name = "phf_macros" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "phf_shared" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" + +[[package]] +name = "pretty_assertions" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +dependencies = [ + "diff", + "yansi", +] + +[[package]] +name = "proc-macro2" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + +[[package]] +name = "ptr_meta" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" +dependencies = [ + "ptr_meta_derive", +] + +[[package]] +name = "ptr_meta_derive" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16b845dbfca988fa33db069c0e230574d15a3088f147a87b64c7589eb662c9ac" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "quote" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "react-unforget" +version = "0.1.0" +dependencies = [ + "serde", + "swc_core", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "regex" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.6", + "regex-syntax 0.8.2", +] + +[[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", +] + +[[package]] +name = "regex-automata" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.2", +] + +[[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.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" + +[[package]] +name = "relative-path" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc" + +[[package]] +name = "rend" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" +dependencies = [ + "bytecheck", +] + +[[package]] +name = "rkyv" +version = "0.7.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0200c8230b013893c0b2d6213d6ec64ed2b9be2e0e016682b7224ff82cff5c58" +dependencies = [ + "bitvec", + "bytecheck", + "hashbrown 0.12.3", + "ptr_meta", + "rend", + "rkyv_derive", + "seahash", + "tinyvec", + "uuid", +] + +[[package]] +name = "rkyv_derive" +version = "0.7.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver 0.9.0", +] + +[[package]] +name = "rustix" +version = "0.38.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +dependencies = [ + "bitflags 2.5.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustversion" +version = "1.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" + +[[package]] +name = "ryu" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" + +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.197" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "serde_json" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "simdutf8" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "smartstring" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fb72c633efbaa2dd666986505016c32c3044395ceaf881518399d2f4127ee29" +dependencies = [ + "autocfg", + "static_assertions", + "version_check", +] + +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + +[[package]] +name = "sourcemap" +version = "6.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4cbf65ca7dc576cf50e21f8d0712d96d4fcfd797389744b7b222a85cdf5bd90" +dependencies = [ + "data-encoding", + "debugid", + "if_chain", + "rustc_version", + "serde", + "serde_json", + "unicode-id", + "url", +] + +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "string_enum" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b650ea2087d32854a0f20b837fc56ec987a1cb4f758c9757e1171ee9812da63" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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_atoms" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d538eaaa6f085161d088a04cf0a3a5a52c5a7f2b3bd9b83f73f058b0ed357c0" +dependencies = [ + "bytecheck", + "hstr", + "once_cell", + "rkyv", + "rustc-hash", + "serde", +] + +[[package]] +name = "swc_common" +version = "0.33.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317d2fcdbb1bc9ecfd0bfc67468d675a5159a6fd1863abf41c8c5b7b7adcab03" +dependencies = [ + "anyhow", + "ast_node", + "atty", + "better_scoped_tls", + "bytecheck", + "cfg-if", + "either", + "from_variant", + "new_debug_unreachable", + "num-bigint", + "once_cell", + "parking_lot", + "rkyv", + "rustc-hash", + "serde", + "siphasher", + "sourcemap", + "swc_atoms", + "swc_eq_ignore_macros", + "swc_visit", + "termcolor", + "tracing", + "unicode-width", + "url", +] + +[[package]] +name = "swc_core" +version = "0.90.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "354892a17af24956c9ae5479c2bd0a2f9c344aab79e6f2fbd01b7b8eb4e46c2e" +dependencies = [ + "once_cell", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_transforms_base", + "swc_ecma_transforms_testing", + "swc_ecma_visit", + "swc_plugin", + "swc_plugin_macro", + "swc_plugin_proxy", + "vergen", +] + +[[package]] +name = "swc_ecma_ast" +version = "0.112.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70656acd47c91918635f1e8589963428cb3170975b71d786c79fb7a25605f687" +dependencies = [ + "bitflags 2.5.0", + "bytecheck", + "is-macro", + "num-bigint", + "phf", + "rkyv", + "scoped-tls", + "string_enum", + "swc_atoms", + "swc_common", + "unicode-id", +] + +[[package]] +name = "swc_ecma_codegen" +version = "0.148.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2afcce205914b8451880fc5ef63dae9bac3dc7b71917921ede64f8e7fd8447a1" +dependencies = [ + "memchr", + "num-bigint", + "once_cell", + "rustc-hash", + "serde", + "sourcemap", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen_macros", + "tracing", +] + +[[package]] +name = "swc_ecma_codegen_macros" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "394b8239424b339a12012ceb18726ed0244fce6bf6345053cb9320b2791dcaa5" +dependencies = [ + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.143.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b919bb9ae5e1c8c54fb109f7e94b4a00185bd255c1238ba823e8102601e2133" +dependencies = [ + "either", + "new_debug_unreachable", + "num-bigint", + "num-traits", + "phf", + "serde", + "smallvec", + "smartstring", + "stacker", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "tracing", + "typed-arena", +] + +[[package]] +name = "swc_ecma_testing" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5704ef494b1805bc4566ff566b964bc1e9d3fb0f0e046ad6392b09a54de844" +dependencies = [ + "anyhow", + "hex", + "sha2", + "testing", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_base" +version = "0.137.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69e9a23d6af398b6efd17bbdad2cfa580102f6c560611f85c63b48f76ffe8f0c" +dependencies = [ + "better_scoped_tls", + "bitflags 2.5.0", + "indexmap", + "once_cell", + "phf", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_parser", + "swc_ecma_utils", + "swc_ecma_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_testing" +version = "0.140.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9a51288aebf6894f8643c44ad08ed1d9c81b8bfce47195c13f9ff994b77a946" +dependencies = [ + "ansi_term", + "anyhow", + "base64", + "hex", + "serde", + "serde_json", + "sha2", + "sourcemap", + "swc_common", + "swc_ecma_ast", + "swc_ecma_codegen", + "swc_ecma_parser", + "swc_ecma_testing", + "swc_ecma_transforms_base", + "swc_ecma_utils", + "swc_ecma_visit", + "tempfile", + "testing", +] + +[[package]] +name = "swc_ecma_utils" +version = "0.127.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc9c6ad70038b770d844fdfc20fd970d66ccebb1edc91804c8a9adaa689d4e39" +dependencies = [ + "indexmap", + "num_cpus", + "once_cell", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_ecma_visit", + "tracing", + "unicode-id", +] + +[[package]] +name = "swc_ecma_visit" +version = "0.98.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93692bdcdbb63db8f5e10fea5d202b5487cb27eb443aec424f4335c88f9864af" +dependencies = [ + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecma_ast", + "swc_visit", + "tracing", +] + +[[package]] +name = "swc_eq_ignore_macros" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "695a1d8b461033d32429b5befbf0ad4d7a2c4d6ba9cd5ba4e0645c615839e8e4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_error_reporters" +version = "0.17.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3329e73f159a3d38d4cd5f606a0918eeff39f5bbdbdafd9b6fecb290d2e9a32d" +dependencies = [ + "anyhow", + "miette", + "once_cell", + "parking_lot", + "swc_common", +] + +[[package]] +name = "swc_macros_common" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50176cfc1cbc8bb22f41c6fe9d1ec53fbe057001219b5954961b8ad0f336fce9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_plugin" +version = "0.90.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5df720531bfbd7ceb1139319c39c20c446abfb8f7e0eb47b104205a71152b4" +dependencies = [ + "once_cell", +] + +[[package]] +name = "swc_plugin_macro" +version = "0.9.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3232db481484070637b20a155c064096c0ea1ba04fa2247b89b618661b3574f4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_plugin_proxy" +version = "0.41.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "012e5996e3fe64805342b6e31a79d826402bbe4eed35be6a9366e54e41f5d75d" +dependencies = [ + "better_scoped_tls", + "rkyv", + "swc_common", + "swc_ecma_ast", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_trace_macro" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "swc_visit" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f5b3e8d1269a7cb95358fed3412645d9c15aa0eb1f4ca003a25a38ef2f30f1b" +dependencies = [ + "either", + "swc_visit_macros", +] + +[[package]] +name = "swc_visit_macros" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33fc817055fe127b4285dc85058596768bfde7537ae37da82c67815557f03e33" +dependencies = [ + "Inflector", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.53", +] + +[[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.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7383cd0e49fff4b6b90ca5670bfd3e9d6a733b3f90c686605aa7eec8c4996032" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +dependencies = [ + "cfg-if", + "fastrand", + "rustix", + "windows-sys", +] + +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +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.35.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "761d1719907168f43b49b438bdb58c41608f4af5eac0995e2a8bb16c522656c5" +dependencies = [ + "ansi_term", + "cargo_metadata 0.15.4", + "difference", + "once_cell", + "pretty_assertions", + "regex", + "serde", + "serde_json", + "swc_common", + "swc_error_reporters", + "testing_macros", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "testing_macros" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9d3864d4184569c1428645a51a304b3b6e8d3094cd61fb3cce8dfdd9f6d0f72" +dependencies = [ + "anyhow", + "glob", + "once_cell", + "proc-macro2", + "quote", + "regex", + "relative-path", + "syn 2.0.53", +] + +[[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", +] + +[[package]] +name = "thiserror" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.53", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "unicode-bidi" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" + +[[package]] +name = "unicode-id" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" + +[[package]] +name = "unicode-ident" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" + +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + +[[package]] +name = "unicode-normalization" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-width" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" + +[[package]] +name = "url" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "uuid" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vergen" +version = "8.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e27d6bdd219887a9eadd19e1c34f32e47fa332301184935c6d9bca26f3cca525" +dependencies = [ + "anyhow", + "cargo_metadata 0.18.1", + "regex", + "rustversion", +] + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.4", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "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-targets" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +dependencies = [ + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yansi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" diff --git a/packages/swc-plugin/Cargo.toml b/packages/swc-plugin/Cargo.toml new file mode 100644 index 0000000..0d13fe7 --- /dev/null +++ b/packages/swc-plugin/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "swc_plugin_react_unforget" +version = "0.1.0" +edition = "2021" +license = "MIT" + +[lib] +crate-type = ["cdylib", "rlib"] + +[profile.release] +lto = true + +[dependencies] +serde = "1" +serde_json = "1.0.79" +swc_core = { version = "0.90.*", features = ["ecma_plugin_transform"] } +react_unforget_transform = { path = "./transform" } + +# .cargo/config defines few alias to build plugin. +# cargo build-wasi generates wasm-wasi32 binary +# cargo build-wasm32 generates wasm32-unknown-unknown binary. diff --git a/packages/swc-plugin/package.json b/packages/swc-plugin/package.json new file mode 100644 index 0000000..9bfcebb --- /dev/null +++ b/packages/swc-plugin/package.json @@ -0,0 +1,16 @@ +{ + "name": "@react-unforget/swc-plugin", + "version": "0.1.0", + "author": "Mohamad Mohebifar", + "license": "MIT", + "keywords": [ + "swc-plugin", + "react-unforget" + ], + "main": "target/wasm32-wasi/release/react_unforget.wasm", + "scripts": { + "prepublishOnly": "cargo build-wasi --release" + }, + "files": [], + "preferUnplugged": true +} diff --git a/packages/swc-plugin/src/lib.rs b/packages/swc-plugin/src/lib.rs new file mode 100644 index 0000000..13a34f3 --- /dev/null +++ b/packages/swc-plugin/src/lib.rs @@ -0,0 +1,32 @@ +use react_unforget_transform::Config; +use swc_core::ecma::visit::VisitMutWith; +use swc_core::plugin::{plugin_transform, proxies::TransformPluginProgramMetadata}; +use swc_core::{ + common::FileName, + ecma::ast::Program, + plugin::{metadata::TransformPluginMetadataContextKind, proxies::PluginCommentsProxy}, +}; + +#[plugin_transform] +pub fn swc_react_unforget_plugin( + mut program: Program, + data: TransformPluginProgramMetadata, +) -> Program { + let config = serde_json::from_str::( + &data + .get_transform_plugin_config() + .expect("failed to get plugin config for styled-components"), + ) + .expect("invalid config for styled-components"); + + let file_name = match data.get_context(&TransformPluginMetadataContextKind::Filename) { + Some(s) => FileName::Real(s.into()), + None => FileName::Anon, + }; + + let mut pass = react_unforget_transform::react_unforget(file_name, config, PluginCommentsProxy); + + program.visit_mut_with(&mut pass); + + program +} diff --git a/packages/swc-plugin/transform/Cargo.toml b/packages/swc-plugin/transform/Cargo.toml new file mode 100644 index 0000000..7e3edea --- /dev/null +++ b/packages/swc-plugin/transform/Cargo.toml @@ -0,0 +1,23 @@ +[package] +authors = ["Mohamad Mohebifar"] +edition = "2021" +license = "MIT" +name = "react_unforget_transform" +version = "0.1.0" +include = ["Cargo.toml", "src/**/*.rs"] + +[dependencies] +serde = { version = "1.0.189", features = ["derive"] } +swc_atoms = "0.6.5" +swc_common = "0.33.19" +swc_ecma_ast = "0.112.5" +swc_ecma_utils = "0.127.12" +swc_ecma_visit = "0.98.6" + +[dev-dependencies] +serde_json = "1" +swc_ecma_parser = "0.143.9" +swc_ecma_transforms_base = "0.137.15" +swc_ecma_transforms = "0.229.16" +swc_ecma_transforms_testing = "0.140.15" +testing = "0.35.20" diff --git a/packages/swc-plugin/transform/src/lib.rs b/packages/swc-plugin/transform/src/lib.rs new file mode 100644 index 0000000..c1d32d4 --- /dev/null +++ b/packages/swc-plugin/transform/src/lib.rs @@ -0,0 +1,42 @@ +use std::{cell::RefCell, ptr::null, rc::Rc}; + +use serde::Deserialize; +use swc_common::{chain, comments::Comments, FileName}; +use swc_ecma_visit::{Fold, VisitMut}; + +pub use crate::utils::{component_finder, State}; + +mod models; +mod utils; + +#[derive(Debug, Default, Clone, Deserialize)] +#[serde(rename_all = "camelCase", deny_unknown_fields)] +pub struct Config { + #[serde(default = "false_by_default")] + pub throw_on_failure: bool, + #[serde(default = "default_skip_components")] + pub skip_components: Vec, + #[serde(default = "false_by_default")] + pub skip_components_with_mutation: bool, +} + +fn false_by_default() -> bool { + false +} + +fn default_skip_components() -> Vec { + vec![] +} + +pub fn react_unforget(_file_name: FileName, config: Config, _comments: C) -> impl Fold + VisitMut +where + C: Comments, +{ + let state: Rc> = Default::default(); + let config = Rc::new(config); + + println!("Calling component_finder"); + let finder = crate::utils::component_finder(config, state); + + return finder +} diff --git a/packages/swc-plugin/transform/src/models/component.rs b/packages/swc-plugin/transform/src/models/component.rs new file mode 100644 index 0000000..ad3f5ca --- /dev/null +++ b/packages/swc-plugin/transform/src/models/component.rs @@ -0,0 +1 @@ +pub struct Component {} diff --git a/packages/swc-plugin/transform/src/models/mod.rs b/packages/swc-plugin/transform/src/models/mod.rs new file mode 100644 index 0000000..9cea807 --- /dev/null +++ b/packages/swc-plugin/transform/src/models/mod.rs @@ -0,0 +1 @@ +pub mod component; diff --git a/packages/swc-plugin/transform/src/utils/ast_tools/generic.rs b/packages/swc-plugin/transform/src/utils/ast_tools/generic.rs new file mode 100644 index 0000000..a33b63f --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/ast_tools/generic.rs @@ -0,0 +1,28 @@ +use swc_common::pass::Either; +use swc_ecma_ast::{BlockStmt, BlockStmtOrExpr, Expr, Pat}; + +pub fn find_params(callee: &mut Expr) -> Option> { + match callee { + Expr::Arrow(callee) => Some(callee.params.iter_mut().collect()), + Expr::Fn(callee) => Some( + callee + .function + .params + .iter_mut() + .map(|param| &mut param.pat) + .collect(), + ), + _ => None, + } +} + +pub fn find_body(callee: &mut Expr) -> Option> { + match callee { + Expr::Arrow(e) => match &mut *e.body { + BlockStmtOrExpr::BlockStmt(b) => Some(Either::Left(b)), + BlockStmtOrExpr::Expr(b) => Some(Either::Right(&mut **b)), + }, + Expr::Fn(e) => Some(Either::Left(e.function.body.as_mut().unwrap())), + _ => None, + } +} diff --git a/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs b/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs new file mode 100644 index 0000000..b1ab7d2 --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs @@ -0,0 +1 @@ +pub mod generic; \ No newline at end of file diff --git a/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs b/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs new file mode 100644 index 0000000..65d2fae --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs @@ -0,0 +1,6 @@ +use swc_ecma_ast::{ArrowExpr, Function}; + +pub enum Fn { + Function(Function), + ArrowFunction(ArrowExpr), +} diff --git a/packages/swc-plugin/transform/src/utils/find_components.rs b/packages/swc-plugin/transform/src/utils/find_components.rs new file mode 100644 index 0000000..f93583b --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/find_components.rs @@ -0,0 +1,161 @@ +use std::{cell::RefCell, rc::Rc}; + +use swc_common::pass::Either; +use swc_ecma_ast::{BlockStmt, Expr, Function}; +use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; + +use crate::{Config, State}; + +use super::ast_tools::generic::find_body; + +struct ComponentFinderState { + return_type_mathces_component: bool, + return_count: u32, +} + +impl Default for ComponentFinderState { + fn default() -> Self { + Self { + return_type_mathces_component: true, + return_count: 0, + } + } +} + +impl ComponentFinderState { + fn does_return_type_match_component(&self) -> bool { + self.return_type_mathces_component && self.return_count > 0 + } +} + +struct ComponentFinder { + config: Rc, + state: Rc>, +} + +impl ComponentFinder { + pub fn new(config: Rc, state: Rc>) -> Self { + Self { config, state } + } +} + +impl VisitMut for ComponentFinder { + noop_visit_mut_type!(); + + fn visit_mut_fn_decl(&mut self, fn_decl: &mut swc_ecma_ast::FnDecl) { + if matches_component_name(&fn_decl.ident.sym.to_string()) { + let mut return_visitor: VisitReturnStatements = VisitReturnStatements { + state: Default::default(), + }; + + fn_decl + .function + .body + .visit_mut_children_with(&mut return_visitor); + + if return_visitor.state.does_return_type_match_component() { + println!("Found component: {:?}", fn_decl.ident.sym); + } + } + + if matches_hook_name(&fn_decl.ident.sym.to_string()) { + println!("Found hook: {:?}", fn_decl.ident.sym); + } + } + + fn visit_mut_var_decl(&mut self, n: &mut swc_ecma_ast::VarDecl) { + for decl in &mut n.decls { + if let swc_ecma_ast::Pat::Ident(ref id) = decl.name { + if matches_component_name(&id.sym.to_string()) { + if let Some(ref mut init) = decl.init { + let fn_body = find_body(init); + + let mut visitor: VisitReturnStatements = Default::default(); + + if let Some(fn_body) = fn_body { + let block_stmt = match fn_body { + Either::Left(block_stmt) => block_stmt, + Either::Right(_) => { + todo!("Arrow functions with inline returns not supported yet") + } + }; + + block_stmt.visit_mut_children_with(&mut visitor); + + if visitor.state.does_return_type_match_component() { + println!("Found component: {:?}", id.sym); + } + } + } + } + + if matches_hook_name(&id.sym.to_string()) { + println!("Found hook: {:?}", id.sym); + } + } + } + } +} + +struct VisitReturnStatements { + state: ComponentFinderState, +} + +impl Default for VisitReturnStatements { + fn default() -> Self { + Self { + state: Default::default(), + } + } +} + +impl VisitMut for VisitReturnStatements { + noop_visit_mut_type!(); + fn visit_mut_fn_decl(&mut self, _: &mut swc_ecma_ast::FnDecl) {} + + fn visit_mut_function(&mut self, _: &mut Function) {} + + fn visit_mut_arrow_expr(&mut self, _: &mut swc_ecma_ast::ArrowExpr) {} + + fn visit_mut_return_stmt(&mut self, n: &mut swc_ecma_ast::ReturnStmt) { + let arg = n.arg.as_mut().unwrap(); + self.state.return_count += 1; + if !is_component_return_type(arg) { + self.state.return_type_mathces_component = false; + } + } +} + +/** + * Check if the given expression qualifies as a component return type. + */ +fn is_component_return_type(node: &mut Expr) -> bool { + if let Expr::JSXElement(_) = node { + return true; + } + + if let Expr::JSXFragment(_) = node { + return true; + } + + if let Expr::Lit(literal) = node { + if let swc_ecma_ast::Lit::Null(_) = literal { + return true; + } + } + + false +} + +pub fn component_finder(config: Rc, state: Rc>) -> impl VisitMut + Fold { + as_folder(ComponentFinder::new(config, state)) +} + +fn matches_component_name(name: &str) -> bool { + name.chars().next().unwrap().is_uppercase() + | (name.chars().next().unwrap() == '_' && name.chars().nth(1).unwrap().is_uppercase()) +} + +fn matches_hook_name(name: &str) -> bool { + name.starts_with("use") +} diff --git a/packages/swc-plugin/transform/src/utils/mod.rs b/packages/swc-plugin/transform/src/utils/mod.rs new file mode 100644 index 0000000..f57ea27 --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/mod.rs @@ -0,0 +1,8 @@ +pub use self::find_components::component_finder; + +mod find_components; +mod babel_shims; +mod ast_tools; + +#[derive(Debug, Default)] +pub struct State {} diff --git a/packages/swc-plugin/transform/tests/fixture.rs b/packages/swc-plugin/transform/tests/fixture.rs new file mode 100644 index 0000000..41030e4 --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixture.rs @@ -0,0 +1,36 @@ +#![deny(unused)] + +use std::{fs::read_to_string, path::PathBuf}; + +use react_unforget_transform::{react_unforget, Config}; +use swc_common::{chain, Mark}; +use swc_ecma_parser::{EsConfig, Syntax}; +use swc_ecma_transforms::resolver; +use swc_ecma_transforms_testing::test_fixture; + +#[testing::fixture("tests/fixtures/**/code.js")] +fn fixture(input: PathBuf) { + let dir = input.parent().unwrap(); + let config = read_to_string(dir.join("config.json")).expect("failed to read config.json"); + + let config: Config = serde_json::from_str(&config).expect("failed to parse config.json"); + + test_fixture( + Syntax::Es(EsConfig { + jsx: true, + ..Default::default() + }), + &|t| { + // + let fm = t.cm.load_file(&input).unwrap(); + + chain!( + resolver(Mark::new(), Mark::new(), false), + react_unforget(fm.name.clone(), config.clone(), t.comments.clone()) + ) + }, + &input, + &dir.join("output.js"), + Default::default(), + ) +} diff --git a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js new file mode 100644 index 0000000..1dfb307 --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js @@ -0,0 +1,25 @@ +{ + function Mamad() { + function innerFn() { + return 2; + } + + if (loading) { + return null; + } + + return
Hello World
; + } + + function anotherFunction() { + return
Another Function
; + } +} + +const TestComponent = () => { + if (loading) { + return null; + } + + return
Test Component
; +}; diff --git a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/config.json b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/config.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/config.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js new file mode 100644 index 0000000..dca4bf2 --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js @@ -0,0 +1 @@ +"WIP"; \ No newline at end of file diff --git a/rust-toolchain b/rust-toolchain new file mode 100644 index 0000000..07ade69 --- /dev/null +++ b/rust-toolchain @@ -0,0 +1 @@ +nightly \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 4244276..dd48896 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6636,6 +6636,11 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" +jinx-rust@0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/jinx-rust/-/jinx-rust-0.1.6.tgz#c7bce55d97bfbad76a9b930c01fe6a8629a170d7" + integrity sha512-qP+wtQL1PrDDFwtPKhNGtjWOmijCrKdfUHWTV2G/ikxfjrh+cjdvkQTmny9RAsVF0jiui9m+F0INWu4cuRcZeQ== + jiti@^1.19.1: version "1.21.0" resolved "https://registry.yarnpkg.com/jiti/-/jiti-1.21.0.tgz#7c97f8fe045724e136a397f7340475244156105d" @@ -8390,6 +8395,14 @@ prettier-plugin-packagejson@^2.4.5: sort-package-json "2.8.0" synckit "0.9.0" +prettier-plugin-rust@^0.1.9: + version "0.1.9" + resolved "https://registry.yarnpkg.com/prettier-plugin-rust/-/prettier-plugin-rust-0.1.9.tgz#1a93b035743fa02a006b4980a1035a260ea9e501" + integrity sha512-n1DTTJQaHMdnoG/+nKUvBm3EKsMVWsYES2UPCiOPiZdBrmuAO/pX++m7L3+Hz3uuhtddpH0HRKHB2F3jbtJBOQ== + dependencies: + jinx-rust "0.1.6" + prettier "^2.7.1" + prettier-plugin-tailwindcss@^0.5.12: version "0.5.12" resolved "https://registry.yarnpkg.com/prettier-plugin-tailwindcss/-/prettier-plugin-tailwindcss-0.5.12.tgz#655999849344548ecf4d9b47a051ed856f041c72" From 2a68aa33dbd2481b03ebafa1900107a49ee7d2f5 Mon Sep 17 00:00:00 2001 From: Mohamad Mohebifar Date: Tue, 26 Mar 2024 20:46:58 -0400 Subject: [PATCH 2/2] Complete function detection logic --- .vscode/settings.json | 7 +- packages/swc-plugin/transform/src/lib.rs | 13 +- .../transform/src/models/component.rs | 59 ++++- .../transform/src/models/component_segment.rs | 2 + .../swc-plugin/transform/src/models/mod.rs | 1 + .../transform/src/utils/ast_tools/mod.rs | 3 +- .../utils/ast_tools/returns_like_component.rs | 66 ++++++ .../transform/src/utils/babel_shims/mod.rs | 72 +++++- .../transform/src/utils/find_components.rs | 213 ++++++++---------- .../src/utils/micro_transformers/mod.rs | 1 + .../swc-plugin/transform/src/utils/mod.rs | 13 +- .../fixtures/expands-arrow-function/code.js | 1 + .../expands-arrow-function/config.json | 1 + .../fixtures/expands-arrow-function/output.js | 3 + .../tests/fixtures/simple-jsx/code.js | 60 +++-- .../tests/fixtures/simple-jsx/output.js | 45 +++- 16 files changed, 410 insertions(+), 150 deletions(-) create mode 100644 packages/swc-plugin/transform/src/models/component_segment.rs create mode 100644 packages/swc-plugin/transform/src/utils/ast_tools/returns_like_component.rs create mode 100644 packages/swc-plugin/transform/src/utils/micro_transformers/mod.rs create mode 100644 packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/code.js create mode 100644 packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/config.json create mode 100644 packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/output.js diff --git a/.vscode/settings.json b/.vscode/settings.json index b45baf8..cccee9a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,9 @@ { "typescript.tsdk": "node_modules/typescript/lib", - "rust-analyzer.linkedProjects": ["./Cargo.toml"] + "rust-analyzer.linkedProjects": ["./Cargo.toml"], + "rust-analyzer.check.command": "clippy", + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer", + "editor.formatOnSave": true, + } } diff --git a/packages/swc-plugin/transform/src/lib.rs b/packages/swc-plugin/transform/src/lib.rs index c1d32d4..7c31bbd 100644 --- a/packages/swc-plugin/transform/src/lib.rs +++ b/packages/swc-plugin/transform/src/lib.rs @@ -1,8 +1,8 @@ -use std::{cell::RefCell, ptr::null, rc::Rc}; +use std::{cell::RefCell, rc::Rc}; use serde::Deserialize; -use swc_common::{chain, comments::Comments, FileName}; -use swc_ecma_visit::{Fold, VisitMut}; +use swc_common::{comments::Comments, FileName}; +use swc_ecma_visit::Fold; pub use crate::utils::{component_finder, State}; @@ -28,15 +28,12 @@ fn default_skip_components() -> Vec { vec![] } -pub fn react_unforget(_file_name: FileName, config: Config, _comments: C) -> impl Fold + VisitMut +pub fn react_unforget(_file_name: FileName, config: Config, _comments: C) -> impl Fold where C: Comments, { let state: Rc> = Default::default(); let config = Rc::new(config); - println!("Calling component_finder"); - let finder = crate::utils::component_finder(config, state); - - return finder + crate::utils::component_finder(config, state) } diff --git a/packages/swc-plugin/transform/src/models/component.rs b/packages/swc-plugin/transform/src/models/component.rs index ad3f5ca..76ae87b 100644 --- a/packages/swc-plugin/transform/src/models/component.rs +++ b/packages/swc-plugin/transform/src/models/component.rs @@ -1 +1,58 @@ -pub struct Component {} +#[allow(clippy::all)] +use std::borrow::Borrow; +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +use swc_ecma_ast::{BlockStmt, BlockStmtOrExpr, Stmt}; + +use crate::models::component_segment::ComponentSegment; +use crate::utils::babel_shims::GenericFn; + +#[derive(Debug)] +pub struct Component { + pub name: String, + pub is_hook: bool, + pub function: Rc>, + segments: HashMap, +} + +impl Component { + pub fn new(name: String, is_hook: bool, function: Rc>) -> Self { + function.borrow_mut().ensure_body_block_stmt(); + println!("Creating component: {}", name); + + Self { + name, + is_hook, + function, + segments: Default::default(), + } + } + + pub fn add_segment(&mut self, stmt: Stmt, segment: ComponentSegment) { + self.segments.insert(stmt, segment); + } + + pub fn get_segments(&self) -> &HashMap { + self.segments.borrow() + } + + pub fn get_name(&self) -> &str { + &self.name + } + + pub fn prepare(&self) {} + + fn get_body_block_stmt(&self) -> BlockStmt { + let body = self.function.as_ref().borrow().get_body(); + + match body { + Some(body) => match body { + BlockStmtOrExpr::BlockStmt(block_stmt) => block_stmt, + BlockStmtOrExpr::Expr(_) => panic!("Expected block statement"), + }, + None => panic!("Function has no body"), + } + } +} diff --git a/packages/swc-plugin/transform/src/models/component_segment.rs b/packages/swc-plugin/transform/src/models/component_segment.rs new file mode 100644 index 0000000..be9430c --- /dev/null +++ b/packages/swc-plugin/transform/src/models/component_segment.rs @@ -0,0 +1,2 @@ +#[derive(Debug)] +pub struct ComponentSegment {} diff --git a/packages/swc-plugin/transform/src/models/mod.rs b/packages/swc-plugin/transform/src/models/mod.rs index 9cea807..ca6d372 100644 --- a/packages/swc-plugin/transform/src/models/mod.rs +++ b/packages/swc-plugin/transform/src/models/mod.rs @@ -1 +1,2 @@ pub mod component; +pub mod component_segment; diff --git a/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs b/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs index b1ab7d2..aa2b067 100644 --- a/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs +++ b/packages/swc-plugin/transform/src/utils/ast_tools/mod.rs @@ -1 +1,2 @@ -pub mod generic; \ No newline at end of file +pub mod generic; +pub mod returns_like_component; diff --git a/packages/swc-plugin/transform/src/utils/ast_tools/returns_like_component.rs b/packages/swc-plugin/transform/src/utils/ast_tools/returns_like_component.rs new file mode 100644 index 0000000..eff9fd6 --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/ast_tools/returns_like_component.rs @@ -0,0 +1,66 @@ +use swc_ecma_ast::{ArrowExpr, Expr, FnDecl, Function, Lit, ReturnStmt}; +use swc_ecma_utils::ExprExt; +use swc_ecma_visit::{noop_visit_type, Visit}; + +pub struct ReturnTypeVisitorState { + return_type_mathces_component: bool, + return_count: u32, +} + +impl Default for ReturnTypeVisitorState { + fn default() -> Self { + Self { + return_type_mathces_component: true, + return_count: 0, + } + } +} + +impl ReturnTypeVisitorState { + pub fn does_return_type_match_component(&self) -> bool { + self.return_type_mathces_component && self.return_count > 0 + } +} + +#[derive(Default)] +pub struct VisitReturnStatements { + pub state: ReturnTypeVisitorState, +} + +impl Visit for VisitReturnStatements { + noop_visit_type!(); + + // We don't want to visit nested functions + fn visit_fn_decl(&mut self, _: &FnDecl) {} + fn visit_function(&mut self, _: &Function) {} + fn visit_arrow_expr(&mut self, _: &ArrowExpr) {} + + fn visit_return_stmt(&mut self, n: &ReturnStmt) { + self.state.return_count += 1; + + if let Some(arg) = &n.arg { + if !is_component_return_type(arg.as_expr()) { + self.state.return_type_mathces_component = false; + } + } + } +} + +/** + * Check if the given expression qualifies as a component return type. + */ +pub fn is_component_return_type(node: &Expr) -> bool { + if let Expr::JSXElement(_) = node { + return true; + } + + if let Expr::JSXFragment(_) = node { + return true; + } + + if let Expr::Lit(literal) = node { + return matches!(literal, Lit::Null(_)); + } + + false +} diff --git a/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs b/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs index 65d2fae..fbb2210 100644 --- a/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs +++ b/packages/swc-plugin/transform/src/utils/babel_shims/mod.rs @@ -1,6 +1,70 @@ -use swc_ecma_ast::{ArrowExpr, Function}; +use std::ops::Deref; -pub enum Fn { - Function(Function), - ArrowFunction(ArrowExpr), +use swc_common::DUMMY_SP; +use swc_ecma_ast::{ArrowExpr, BlockStmt, BlockStmtOrExpr, Function}; +use swc_ecma_utils::ExprFactory; +use swc_ecma_visit::VisitWith; + +use super::ast_tools::returns_like_component::{is_component_return_type, VisitReturnStatements}; + +#[derive(Debug, Clone)] +pub enum GenericFn { + Function(Box), + ArrowFunction(Box), +} + +impl GenericFn { + pub fn get_body(&self) -> Option { + match self { + GenericFn::Function(f) => { + let body = &f.body; + body.as_ref() + .map(|body| BlockStmtOrExpr::BlockStmt(body.clone())) + } + GenericFn::ArrowFunction(f) => Some(f.body.deref().clone()), + } + } + + pub fn update_body(&mut self, body: BlockStmt) { + match self { + GenericFn::Function(f) => { + f.body = Some(body); + } + GenericFn::ArrowFunction(f) => { + f.body = Box::new(body.into()); + } + } + } + + pub fn ensure_body_block_stmt(&mut self) { + if let GenericFn::ArrowFunction(arrow_function) = self { + let body = arrow_function.body.deref(); + if let BlockStmtOrExpr::Expr(expr) = body { + let return_arg = expr.clone().into_return_stmt(); + let block_stmt = BlockStmt { + span: DUMMY_SP, + stmts: vec![return_arg.into()], + }; + + self.update_body(block_stmt); + } + } + } + + pub fn return_type_matches_component(&self) -> bool { + let fn_body = self.get_body(); + + if let Some(fn_body) = fn_body { + match fn_body { + BlockStmtOrExpr::BlockStmt(ref block_stmt) => { + let mut visitor: VisitReturnStatements = Default::default(); + block_stmt.visit_children_with(&mut visitor); + visitor.state.does_return_type_match_component() + } + BlockStmtOrExpr::Expr(ref expr) => is_component_return_type(expr.deref()), + } + } else { + false + } + } } diff --git a/packages/swc-plugin/transform/src/utils/find_components.rs b/packages/swc-plugin/transform/src/utils/find_components.rs index f93583b..4923a40 100644 --- a/packages/swc-plugin/transform/src/utils/find_components.rs +++ b/packages/swc-plugin/transform/src/utils/find_components.rs @@ -1,32 +1,13 @@ +use std::ops::Deref; use std::{cell::RefCell, rc::Rc}; -use swc_common::pass::Either; -use swc_ecma_ast::{BlockStmt, Expr, Function}; -use swc_ecma_visit::{as_folder, noop_visit_mut_type, Fold, VisitMut, VisitMutWith}; +use swc_common::DUMMY_SP; +use swc_ecma_ast::{BlockStmt, Expr, FnDecl, Function, VarDecl, VarDeclarator}; +use swc_ecma_visit::{noop_fold_type, Fold}; -use crate::{Config, State}; +use crate::{models::component::Component, Config, State}; -use super::ast_tools::generic::find_body; - -struct ComponentFinderState { - return_type_mathces_component: bool, - return_count: u32, -} - -impl Default for ComponentFinderState { - fn default() -> Self { - Self { - return_type_mathces_component: true, - return_count: 0, - } - } -} - -impl ComponentFinderState { - fn does_return_type_match_component(&self) -> bool { - self.return_type_mathces_component && self.return_count > 0 - } -} +use super::babel_shims::GenericFn; struct ComponentFinder { config: Rc, @@ -39,121 +20,121 @@ impl ComponentFinder { } } -impl VisitMut for ComponentFinder { - noop_visit_mut_type!(); - - fn visit_mut_fn_decl(&mut self, fn_decl: &mut swc_ecma_ast::FnDecl) { - if matches_component_name(&fn_decl.ident.sym.to_string()) { - let mut return_visitor: VisitReturnStatements = VisitReturnStatements { - state: Default::default(), - }; - - fn_decl - .function - .body - .visit_mut_children_with(&mut return_visitor); - - if return_visitor.state.does_return_type_match_component() { - println!("Found component: {:?}", fn_decl.ident.sym); +impl Fold for ComponentFinder { + noop_fold_type!(); + + fn fold_fn_decl(&mut self, fn_decl: FnDecl) -> FnDecl { + let name_matches_component = matches_component_name(fn_decl.ident.sym.as_ref()); + let name_matches_hook = matches_hook_name(fn_decl.ident.sym.as_ref()); + if name_matches_component || name_matches_hook { + let gfn = GenericFn::Function(Box::new(fn_decl.function.deref().clone())); + let function = Rc::new(RefCell::new(gfn)); + + if !name_matches_component || function.borrow().return_type_matches_component() { + let component = + Component::new(fn_decl.ident.sym.to_string(), name_matches_hook, function); + let function = component.function.borrow(); + + if let GenericFn::Function(ref f) = *function { + let new_fn = Function { + span: DUMMY_SP, + params: f.params.clone(), + decorators: f.decorators.clone(), + body: f.body.clone(), + is_async: f.is_async, + is_generator: f.is_generator, + type_params: f.type_params.clone(), + return_type: f.return_type.clone(), + }; + + return FnDecl { + declare: fn_decl.declare, + ident: fn_decl.ident, + function: Box::new(new_fn), + }; + } } } - if matches_hook_name(&fn_decl.ident.sym.to_string()) { - println!("Found hook: {:?}", fn_decl.ident.sym); - } + fn_decl } - fn visit_mut_var_decl(&mut self, n: &mut swc_ecma_ast::VarDecl) { - for decl in &mut n.decls { + fn fold_var_decl(&mut self, var_decl: VarDecl) -> VarDecl { + let mut new_decls: Vec = vec![]; + let mut found_component_in_decls = false; + + 'visit_decl: for decl in &var_decl.decls { if let swc_ecma_ast::Pat::Ident(ref id) = decl.name { - if matches_component_name(&id.sym.to_string()) { - if let Some(ref mut init) = decl.init { - let fn_body = find_body(init); - - let mut visitor: VisitReturnStatements = Default::default(); - - if let Some(fn_body) = fn_body { - let block_stmt = match fn_body { - Either::Left(block_stmt) => block_stmt, - Either::Right(_) => { - todo!("Arrow functions with inline returns not supported yet") - } - }; - - block_stmt.visit_mut_children_with(&mut visitor); - - if visitor.state.does_return_type_match_component() { - println!("Found component: {:?}", id.sym); - } - } - } - } + let name_matches_component = matches_component_name(id.sym.as_ref()); + let name_matches_hook = matches_hook_name(id.sym.as_ref()); - if matches_hook_name(&id.sym.to_string()) { - println!("Found hook: {:?}", id.sym); + if decl.init.is_none() || (!name_matches_component && !name_matches_hook) { + new_decls.push(decl.clone()); + continue 'visit_decl; } - } - } - } -} -struct VisitReturnStatements { - state: ComponentFinderState, -} + let init = decl.init.as_ref().unwrap().deref().clone(); + + let function = match init { + Expr::Arrow(fn_node) => Some(Rc::new(RefCell::new(GenericFn::ArrowFunction( + Box::new(fn_node), + )))), + Expr::Fn(fn_node) => Some(Rc::new(RefCell::new(GenericFn::Function( + Box::new(*fn_node.function), + )))), + _ => None, + }; + + if function.is_none() { + new_decls.push(decl.clone()); + continue 'visit_decl; + } -impl Default for VisitReturnStatements { - fn default() -> Self { - Self { - state: Default::default(), - } - } -} + let function = function.unwrap(); -impl VisitMut for VisitReturnStatements { - noop_visit_mut_type!(); - fn visit_mut_fn_decl(&mut self, _: &mut swc_ecma_ast::FnDecl) {} + if !name_matches_component || function.borrow().return_type_matches_component() { + found_component_in_decls = true; + let component = Component::new(id.sym.to_string(), name_matches_hook, function); - fn visit_mut_function(&mut self, _: &mut Function) {} + let expr = match *component.function.borrow() { + GenericFn::Function(ref f) => Expr::Fn(f.deref().clone().into()), + GenericFn::ArrowFunction(ref f) => Expr::Arrow(f.deref().clone()), + }; - fn visit_mut_arrow_expr(&mut self, _: &mut swc_ecma_ast::ArrowExpr) {} + new_decls.push(VarDeclarator { + span: decl.span, + name: decl.name.clone(), + init: Some(Box::new(expr)), + definite: decl.definite, + }); - fn visit_mut_return_stmt(&mut self, n: &mut swc_ecma_ast::ReturnStmt) { - let arg = n.arg.as_mut().unwrap(); - self.state.return_count += 1; - if !is_component_return_type(arg) { - self.state.return_type_mathces_component = false; + continue 'visit_decl; + } + } else { + new_decls.push(decl.clone()); + } } - } -} - -/** - * Check if the given expression qualifies as a component return type. - */ -fn is_component_return_type(node: &mut Expr) -> bool { - if let Expr::JSXElement(_) = node { - return true; - } - if let Expr::JSXFragment(_) = node { - return true; - } - - if let Expr::Lit(literal) = node { - if let swc_ecma_ast::Lit::Null(_) = literal { - return true; + if found_component_in_decls { + VarDecl { + span: var_decl.span, + kind: var_decl.kind, + decls: new_decls, + declare: var_decl.declare, + } + } else { + var_decl } } - - false } -pub fn component_finder(config: Rc, state: Rc>) -> impl VisitMut + Fold { - as_folder(ComponentFinder::new(config, state)) +pub fn component_finder(config: Rc, state: Rc>) -> impl Fold { + ComponentFinder::new(config, state) } fn matches_component_name(name: &str) -> bool { name.chars().next().unwrap().is_uppercase() - | (name.chars().next().unwrap() == '_' && name.chars().nth(1).unwrap().is_uppercase()) + || (name.starts_with('_') && name.chars().nth(1).unwrap().is_uppercase()) } fn matches_hook_name(name: &str) -> bool { diff --git a/packages/swc-plugin/transform/src/utils/micro_transformers/mod.rs b/packages/swc-plugin/transform/src/utils/micro_transformers/mod.rs new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/packages/swc-plugin/transform/src/utils/micro_transformers/mod.rs @@ -0,0 +1 @@ + diff --git a/packages/swc-plugin/transform/src/utils/mod.rs b/packages/swc-plugin/transform/src/utils/mod.rs index f57ea27..a264268 100644 --- a/packages/swc-plugin/transform/src/utils/mod.rs +++ b/packages/swc-plugin/transform/src/utils/mod.rs @@ -1,8 +1,13 @@ +use crate::models::component::Component; + pub use self::find_components::component_finder; -mod find_components; -mod babel_shims; -mod ast_tools; +pub mod ast_tools; +pub mod babel_shims; +pub mod find_components; +pub mod micro_transformers; #[derive(Debug, Default)] -pub struct State {} +pub struct State { + components: Vec, +} diff --git a/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/code.js b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/code.js new file mode 100644 index 0000000..5c997ed --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/code.js @@ -0,0 +1 @@ +export const MyComponent = () =>
Hello
; diff --git a/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/config.json b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/config.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/config.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/output.js b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/output.js new file mode 100644 index 0000000..6fd3a86 --- /dev/null +++ b/packages/swc-plugin/transform/tests/fixtures/expands-arrow-function/output.js @@ -0,0 +1,3 @@ +export const MyComponent = () => { + return
Hello
; +}; diff --git a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js index 1dfb307..63777ef 100644 --- a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js +++ b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/code.js @@ -1,25 +1,57 @@ -{ - function Mamad() { - function innerFn() { - return 2; - } - - if (loading) { - return null; - } - - return
Hello World
; +function TestComponent1() { + function innerFn() { + return 2; } - function anotherFunction() { - return
Another Function
; + if (loading) { + return null; } + + return
Hello World
; } -const TestComponent = () => { +const TestComponent2 = (props) => { if (loading) { return null; } return
Test Component
; }; + +const TestComponent3 = (props) =>
Hi
; + +const TestComponent4 = function (props) { + return
Hi
; +}; + +const useTest1 = () => { + const [state, setState] = useState(0); + return state; +}; + +function useTest2() { + const [state, setState] = useState(0); + return state; +} + +function nonComponent() { + return
Another Function
; +} + +function nonComponent2() { + return; +} + +function nonComponent3() { + return 10; +} + +function nonComponent4() {} + +const nonComponent5 = () => {}; + +const nonComponent6 = () => 10; + +const nonComponent7 = () => { + return; +}; diff --git a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js index dca4bf2..a2fd589 100644 --- a/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js +++ b/packages/swc-plugin/transform/tests/fixtures/simple-jsx/output.js @@ -1 +1,44 @@ -"WIP"; \ No newline at end of file +function TestComponent1() { + function innerFn() { + return 2; + } + if (loading) { + return null; + } + return
Hello World
; +} +const TestComponent2 = (props) => { + if (loading) { + return null; + } + return
Test Component
; +}; +const TestComponent3 = (props) => { + return
Hi
; +}; +const TestComponent4 = function (props) { + return
Hi
; +}; +const useTest1 = () => { + const [state, setState] = useState(0); + return state; +}; +function useTest2() { + const [state, setState] = useState(0); + return state; +} +function nonComponent() { + return
Another Function
; +} +function nonComponent2() { + return; +} +function nonComponent3() { + return 10; +} +function nonComponent4() {} +const nonComponent5 = () => {}; +const nonComponent6 = () => 10; +const nonComponent7 = () => { + return; +};