diff --git a/compiler/forget/Cargo.lock b/compiler/forget/Cargo.lock index 19c724edf3..2a5549340e 100644 --- a/compiler/forget/Cargo.lock +++ b/compiler/forget/Cargo.lock @@ -12,6 +12,32 @@ dependencies = [ "regex", ] +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +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.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.3" @@ -21,6 +47,7 @@ dependencies = [ "cfg-if", "getrandom", "once_cell", + "serde", "version_check", ] @@ -42,12 +69,33 @@ dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +[[package]] +name = "arrayvec" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" + [[package]] name = "ast_node" version = "0.9.5" @@ -58,7 +106,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] @@ -72,12 +120,45 @@ dependencies = [ "winapi", ] +[[package]] +name = "auto_impl" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[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.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "better_scoped_tls" version = "0.1.1" @@ -95,9 +176,43 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + +[[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 = "browserslist-rs" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9bda9b4595376bf255f68dafb5dcc5b0e2842b38dc2a7b52c4e0bfe9fd1c651" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "chrono", + "either", + "getrandom", + "itertools", + "js-sys", + "nom", + "once_cell", + "quote", + "serde", + "serde-wasm-bindgen", + "serde_json", + "string_cache", + "string_cache_codegen", + "thiserror", + "wasm-bindgen", +] [[package]] name = "bstr" @@ -137,6 +252,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "time 0.1.45", + "wasm-bindgen", + "winapi", +] + [[package]] name = "console" version = "0.15.7" @@ -149,12 +279,103 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + +[[package]] +name = "cpufeatures" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +dependencies = [ + "cfg-if", +] + +[[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 = "dashmap" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +dependencies = [ + "cfg-if", + "hashbrown 0.12.3", + "lock_api", + "once_cell", + "parking_lot_core", +] + [[package]] name = "data-encoding" version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +[[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.8.1" @@ -193,7 +414,7 @@ checksum = "eecf8589574ce9b895052fa12d69af7a233f99e6107f5cb8dd1044f2a17bfdcb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] @@ -219,8 +440,26 @@ name = "estree-swc" version = "0.1.0" dependencies = [ "estree", - "swc_common", - "swc_ecma_ast", + "swc", + "swc_core 0.79.9", +] + +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + +[[package]] +name = "fixtures" +version = "0.1.0" +dependencies = [ + "build-hir", + "bumpalo", + "estree", + "estree-swc", + "hir", + "insta", ] [[package]] @@ -247,7 +486,17 @@ dependencies = [ "pmutil", "proc-macro2", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.23", +] + +[[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]] @@ -257,8 +506,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", + "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -273,6 +524,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "globset" version = "0.4.10" @@ -291,6 +548,18 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", +] [[package]] name = "hashbrown" @@ -309,12 +578,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hir" @@ -325,6 +591,29 @@ dependencies = [ "serde", ] +[[package]] +name = "iana-time-zone" +version = "0.1.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "idna" version = "0.4.0" @@ -349,6 +638,7 @@ checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown 0.12.3", + "serde", ] [[package]] @@ -386,14 +676,47 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", +] + +[[package]] +name = "is_ci" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", ] [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" + +[[package]] +name = "js-sys" +version = "0.3.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonc-parser" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b56a20e76235284255a09fcd1f45cf55d3c524ea657ebd3854735925c57743d" +dependencies = [ + "serde_json", +] [[package]] name = "lazy_static" @@ -476,9 +799,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "linked-hash-map" @@ -502,18 +825,101 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +[[package]] +name = "lru" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "718e8fae447df0c7e1ba7f5189829e63fd536945c8988d61444c19039f16b670" +dependencies = [ + "hashbrown 0.13.2", +] + [[package]] name = "memchr" version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + +[[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 = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "new_debug_unreachable" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "normpath" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a9da8c9922c35a1033d76f7272dfc2e7ee20392083d75aeea6ced23c6266578" +dependencies = [ + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -547,20 +953,35 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[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" @@ -581,15 +1002,37 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] +[[package]] +name = "path-clean" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecba01bf2678719532c5e3059e0b5f0811273d94b397088b82e3bd0a78c78fdd" + +[[package]] +name = "pathdiff" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" + [[package]] name = "percent-encoding" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "petgraph" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +dependencies = [ + "fixedbitset", + "indexmap 1.9.3", +] + [[package]] name = "phf" version = "0.10.1" @@ -636,9 +1079,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pmutil" @@ -648,7 +1091,7 @@ checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] @@ -663,6 +1106,24 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +[[package]] +name = "preset_env_base" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae83c5857727636a1f2c7188632c8a57986d2f1d2e2cf45f2642f5856c5b8e85" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "browserslist-rs", + "dashmap", + "from_variant", + "once_cell", + "semver 1.0.17", + "serde", + "st-map", + "tracing", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -695,9 +1156,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -713,13 +1174,19 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.28" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] +[[package]] +name = "radix_fmt" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" + [[package]] name = "rand" version = "0.8.5" @@ -750,6 +1217,28 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rayon" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "num_cpus", +] + [[package]] name = "redox_syscall" version = "0.3.5" @@ -776,6 +1265,12 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" +[[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" @@ -788,20 +1283,26 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" dependencies = [ - "semver", + "semver 0.9.0", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" + +[[package]] +name = "ryu-js" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" [[package]] name = "same-file" @@ -833,6 +1334,15 @@ dependencies = [ "semver-parser", ] +[[package]] +name = "semver" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +dependencies = [ + "serde", +] + [[package]] name = "semver-parser" version = "0.7.0" @@ -841,35 +1351,57 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.164" +version = "1.0.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" dependencies = [ "serde_derive", ] [[package]] -name = "serde_derive" -version = "1.0.164" +name = "serde-wasm-bindgen" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" +dependencies = [ + "js-sys", + "serde", + "wasm-bindgen", +] + +[[package]] +name = "serde_derive" +version = "1.0.166" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] name = "serde_json" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa", "ryu", "serde", ] +[[package]] +name = "sha-1" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028f48d513f9678cda28f6e4064755b3fbb2af6acd672f2c209b62323f7aea0f" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "similar" version = "2.2.1" @@ -899,6 +1431,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "smawk" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" + [[package]] name = "sourcemap" version = "6.2.3" @@ -914,6 +1452,16 @@ dependencies = [ "url", ] +[[package]] +name = "st-map" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f352d5d14be5a1f956d76ae0c8060c3487aaa2a080f10a4b4ff023c7c05a9047" +dependencies = [ + "arrayvec", + "static-map-macro", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -933,6 +1481,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "static-map-macro" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7628ae0bd92555d3de4303da41a5c8b1c5363e892001325f34e4be9ed024d0d7" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "syn 2.0.23", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -975,7 +1535,83 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.23", +] + +[[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" +version = "0.264.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96d692a45418867d3b208ad320c9cd27ef8ca4f58d0a043ad30887b32c5144b" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "base64", + "dashmap", + "either", + "indexmap 1.9.3", + "jsonc-parser", + "lru", + "once_cell", + "parking_lot", + "pathdiff", + "regex", + "rustc-hash", + "serde", + "serde_json", + "sourcemap", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_config", + "swc_ecma_ast 0.107.0", + "swc_ecma_codegen", + "swc_ecma_ext_transforms", + "swc_ecma_lints", + "swc_ecma_loader", + "swc_ecma_minifier", + "swc_ecma_parser 0.137.1", + "swc_ecma_preset_env", + "swc_ecma_transforms", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_compat", + "swc_ecma_transforms_optimization", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "swc_error_reporters", + "swc_node_comments", + "swc_timer", + "swc_visit", + "tracing", + "url", ] [[package]] @@ -983,10 +1619,10 @@ name = "swc-demo" version = "0.1.0" dependencies = [ "swc_common", - "swc_core", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_visit", + "swc_core 0.78.28", + "swc_ecma_parser 0.136.8", + "swc_ecma_transforms_base 0.129.15", + "swc_ecma_visit 0.92.5", "swc_visit", ] @@ -1004,13 +1640,27 @@ dependencies = [ "triomphe", ] +[[package]] +name = "swc_cached" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97b8051bbf1c23817f9f2912fce18d9a6efcaaf8f8e1a4c69dbaf72bcaf71136" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "dashmap", + "once_cell", + "regex", + "serde", +] + [[package]] name = "swc_common" version = "0.31.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6414bd4e553f5638961d39b07075ffd37a3d63176829592f4a5900260d94ca1" dependencies = [ - "ahash", + "ahash 0.8.3", "anyhow", "ast_node", "atty", @@ -1021,6 +1671,7 @@ dependencies = [ "new_debug_unreachable", "num-bigint", "once_cell", + "parking_lot", "rustc-hash", "serde", "siphasher", @@ -1036,11 +1687,52 @@ dependencies = [ ] [[package]] -name = "swc_core" -version = "0.78.15" +name = "swc_config" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433f38bf3dd31fc55e6264479a889ea1bef3caec0df8e33358f3bf2de0e569c4" +checksum = "9ba1c7a40d38f9dd4e9a046975d3faf95af42937b34b2b963be4d8f01239584b" dependencies = [ + "indexmap 1.9.3", + "serde", + "serde_json", + "swc_config_macro", +] + +[[package]] +name = "swc_config_macro" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5b5aaca9a0082be4515f0fbbecc191bf5829cd25b5b9c0a2810f6a2bb0d6829" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.23", +] + +[[package]] +name = "swc_core" +version = "0.78.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e38b2fd17f97d84f1152eb82d7ebc089e98ddd02b5b750af37a0c91dec81c87" +dependencies = [ + "vergen", +] + +[[package]] +name = "swc_core" +version = "0.79.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c51e91b0c4f50dd65f94f18a3e3fb9bef463a0d6836470b91c23575ca0778e63" +dependencies = [ + "swc", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_parser 0.137.1", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_visit 0.93.0", "vergen", ] @@ -1050,7 +1742,23 @@ version = "0.106.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebf4d6804b1da4146c4c0359d129e3dd43568d321f69d7953d9abbca4ded76ba" dependencies = [ - "bitflags 2.3.2", + "bitflags 2.3.3", + "is-macro", + "num-bigint", + "scoped-tls", + "string_enum", + "swc_atoms", + "swc_common", + "unicode-id", +] + +[[package]] +name = "swc_ecma_ast" +version = "0.107.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5693558188efdd5b664e517b69ba8056a7f64c214ca8cd034e3ae8314566b866" +dependencies = [ + "bitflags 2.3.3", "is-macro", "num-bigint", "scoped-tls", @@ -1062,10 +1770,134 @@ dependencies = [ ] [[package]] -name = "swc_ecma_parser" -version = "0.136.2" +name = "swc_ecma_codegen" +version = "0.142.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0ed358c991cf61d91b045769eb0336689549d6c444073c360ffa9a94af9e965" +checksum = "12a1e2c520108525667676df493a636afe679112f19fc51a2d226f853f7513a1" +dependencies = [ + "memchr", + "num-bigint", + "once_cell", + "rustc-hash", + "serde", + "sourcemap", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_codegen_macros", + "tracing", +] + +[[package]] +name = "swc_ecma_codegen_macros" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcdff076dccca6cc6a0e0b2a2c8acfb066014382bc6df98ec99e755484814384" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.23", +] + +[[package]] +name = "swc_ecma_ext_transforms" +version = "0.106.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38f16586ee4665969223337d81c1d5a2f3c212b2996c0c2e953fe77590cdcb39" +dependencies = [ + "phf", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_lints" +version = "0.85.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9303e33d47e5e524cece64a1d61cff6c02d1cd026aba60bc97954d03a21ac4f9" +dependencies = [ + "ahash 0.8.3", + "auto_impl", + "dashmap", + "parking_lot", + "rayon", + "regex", + "serde", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast 0.107.0", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_loader" +version = "0.43.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d40f8d1626b33ba85ee17f43268b3bb6382278b9d3a3c1faa52c57e71769a60" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "dashmap", + "lru", + "normpath", + "once_cell", + "parking_lot", + "path-clean", + "pathdiff", + "serde", + "serde_json", + "swc_cached", + "swc_common", + "tracing", +] + +[[package]] +name = "swc_ecma_minifier" +version = "0.184.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c1106ce1d65d21c38857dd0338f59a261b6cdc38f581954b1798a785d014524" +dependencies = [ + "ahash 0.8.3", + "arrayvec", + "indexmap 1.9.3", + "num-bigint", + "num_cpus", + "once_cell", + "parking_lot", + "radix_fmt", + "regex", + "rustc-hash", + "ryu-js", + "serde", + "serde_json", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_config", + "swc_ecma_ast 0.107.0", + "swc_ecma_codegen", + "swc_ecma_parser 0.137.1", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_optimization", + "swc_ecma_usage_analyzer", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "swc_timer", + "tracing", +] + +[[package]] +name = "swc_ecma_parser" +version = "0.136.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45d40421c607d7a48334f78a9b24a5cbde1f36250f9986746ec082208d68b39f" dependencies = [ "either", "lexical", @@ -1076,19 +1908,84 @@ dependencies = [ "stacker", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.106.6", "tracing", "typed-arena", ] [[package]] -name = "swc_ecma_transforms_base" -version = "0.129.8" +name = "swc_ecma_parser" +version = "0.137.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e659ba3b910dc0cc0deb8731293151f56054d603ee47f0042fda530b7d487517" +checksum = "8ea1915adb15d9ca1695e76d41524beb4806e9b603280edb7eedbaebe706a41c" +dependencies = [ + "either", + "lexical", + "num-bigint", + "serde", + "smallvec", + "smartstring", + "stacker", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "tracing", + "typed-arena", +] + +[[package]] +name = "swc_ecma_preset_env" +version = "0.198.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6835b856cbae281ea2aba64af208b3011528e5ef815441f4e4e234674f805472" +dependencies = [ + "ahash 0.8.3", + "anyhow", + "dashmap", + "indexmap 1.9.3", + "once_cell", + "preset_env_base", + "semver 1.0.17", + "serde", + "serde_json", + "st-map", + "string_enum", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_transforms" +version = "0.221.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4f578a16ff264c1f306d38a10b900256b33f636426ebeb5eab980205e8fc9f5" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_compat", + "swc_ecma_transforms_module", + "swc_ecma_transforms_optimization", + "swc_ecma_transforms_proposal", + "swc_ecma_transforms_react", + "swc_ecma_transforms_typescript", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_transforms_base" +version = "0.129.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7707e724db259cd93150fd5bc04559ace997edbce968d29be9c881e317c9b3fb" dependencies = [ "better_scoped_tls", - "bitflags 2.3.2", + "bitflags 2.3.3", "indexmap 1.9.3", "once_cell", "phf", @@ -1097,18 +1994,226 @@ dependencies = [ "smallvec", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_utils", - "swc_ecma_visit", + "swc_ecma_ast 0.106.6", + "swc_ecma_parser 0.136.8", + "swc_ecma_utils 0.119.10", + "swc_ecma_visit 0.92.5", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_base" +version = "0.130.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84594423bc24ec9133265197c314db437c42c2cdbaba275c81e1d3673b8d6beb" +dependencies = [ + "better_scoped_tls", + "bitflags 2.3.3", + "indexmap 1.9.3", + "once_cell", + "phf", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_parser 0.137.1", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_classes" +version = "0.119.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a288e0d1a702f1944df7c1b57468f505a9549d7d7a51d89dfa18d8f956abdbf5" +dependencies = [ + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_transforms_compat" +version = "0.156.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ff9b38ea8bf338a46dda895b841de54360973b600c012c18e1bf93bfba35c06" +dependencies = [ + "ahash 0.8.3", + "arrayvec", + "indexmap 1.9.3", + "is-macro", + "num-bigint", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "swc_trace_macro", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_macros" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f59c4b6ed5d78d3ad9fc7c6f8ab4f85bba99573d31d9a2c0a712077a6b45efd2" +dependencies = [ + "pmutil", + "proc-macro2", + "quote", + "swc_macros_common", + "syn 2.0.23", +] + +[[package]] +name = "swc_ecma_transforms_module" +version = "0.173.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "729cb914afb891896bd3f1648f194e003492568471e6c9483f7667bf3c14fd9b" +dependencies = [ + "Inflector", + "ahash 0.8.3", + "anyhow", + "bitflags 2.3.3", + "indexmap 1.9.3", + "is-macro", + "path-clean", + "pathdiff", + "regex", + "serde", + "swc_atoms", + "swc_cached", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_loader", + "swc_ecma_parser 0.137.1", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_optimization" +version = "0.190.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32c1e2751df41e27e22bf3ad304c3a1831fad141f1491b08c2b7907ccd9d66c5" +dependencies = [ + "ahash 0.8.3", + "dashmap", + "indexmap 1.9.3", + "once_cell", + "petgraph", + "rustc-hash", + "serde_json", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_parser 0.137.1", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_macros", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "swc_fast_graph", + "tracing", +] + +[[package]] +name = "swc_ecma_transforms_proposal" +version = "0.164.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a1a942506b915e48989c13ee3c6bd63eb9b895593b8a47008d9607e2857d4c7" +dependencies = [ + "either", + "rustc-hash", + "serde", + "smallvec", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_classes", + "swc_ecma_transforms_macros", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_transforms_react" +version = "0.176.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "094c9def9589d2687c15cfe859ffab87989a92217e73c93b3ce48e58c4a4ebfe" +dependencies = [ + "ahash 0.8.3", + "base64", + "dashmap", + "indexmap 1.9.3", + "once_cell", + "serde", + "sha-1", + "string_enum", + "swc_atoms", + "swc_common", + "swc_config", + "swc_ecma_ast 0.107.0", + "swc_ecma_parser 0.137.1", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_macros", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_transforms_typescript" +version = "0.180.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d3a7740e75e9a8c690320f2a3507560eb9cb1ce91662174619f21357bb517d3" +dependencies = [ + "serde", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_transforms_base 0.130.1", + "swc_ecma_transforms_react", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", +] + +[[package]] +name = "swc_ecma_usage_analyzer" +version = "0.16.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3c6eb57ce96ed026f21315e510d6710fbfe65b8706ae89ff0ff657e580eb74" +dependencies = [ + "ahash 0.8.3", + "indexmap 1.9.3", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_utils 0.120.1", + "swc_ecma_visit 0.93.0", + "swc_timer", "tracing", ] [[package]] name = "swc_ecma_utils" -version = "0.119.4" +version = "0.119.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266eaf9dc1ba58fca1fd34e97f9493e4df655eecde468104f32ab40d7147efac" +checksum = "452c66399edeb88a97bfdc3bbf11e45db85fdf883bfd4fc8bdd93abb92152b9b" dependencies = [ "indexmap 1.9.3", "num_cpus", @@ -1116,22 +2221,54 @@ dependencies = [ "rustc-hash", "swc_atoms", "swc_common", - "swc_ecma_ast", - "swc_ecma_visit", + "swc_ecma_ast 0.106.6", + "swc_ecma_visit 0.92.5", + "tracing", + "unicode-id", +] + +[[package]] +name = "swc_ecma_utils" +version = "0.120.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ce2d8b6a3ed69ac1a8146efe1f0b1bdb8676cab204b839f42ac8b62fefc772" +dependencies = [ + "indexmap 1.9.3", + "num_cpus", + "once_cell", + "rustc-hash", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", + "swc_ecma_visit 0.93.0", "tracing", "unicode-id", ] [[package]] name = "swc_ecma_visit" -version = "0.92.1" +version = "0.92.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a300bfde6ea4ab8e40e1ecdb3723f31ab3dbdbf9ac9e986164d63caba9d3e" +checksum = "0f61da6cac0ec3b7e62d367cfbd9e38e078a4601271891ad94f0dac5ff69f839" dependencies = [ "num-bigint", "swc_atoms", "swc_common", - "swc_ecma_ast", + "swc_ecma_ast 0.106.6", + "swc_visit", + "tracing", +] + +[[package]] +name = "swc_ecma_visit" +version = "0.93.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82bb87ee3345a7049efcbedc419f121933e0e3967457922848d0026fb3b79dac" +dependencies = [ + "num-bigint", + "swc_atoms", + "swc_common", + "swc_ecma_ast 0.107.0", "swc_visit", "tracing", ] @@ -1145,7 +2282,32 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", +] + +[[package]] +name = "swc_error_reporters" +version = "0.15.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "108322b719696e8c368c39dc6d8748494ea2aa870e7d80ea5956078aa6b4dd4d" +dependencies = [ + "anyhow", + "miette", + "once_cell", + "parking_lot", + "swc_common", +] + +[[package]] +name = "swc_fast_graph" +version = "0.19.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b19b76468219b923c34efdeff812fa951fe1a1ecaba78118b013d034a1669ff5" +dependencies = [ + "indexmap 1.9.3", + "petgraph", + "rustc-hash", + "swc_common", ] [[package]] @@ -1157,7 +2319,39 @@ dependencies = [ "pmutil", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", +] + +[[package]] +name = "swc_node_comments" +version = "0.18.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61839f8a936b5c95ce644d539914bb944b094eee9bd156c3dc41fe8e7eaa84ea" +dependencies = [ + "ahash 0.8.3", + "dashmap", + "swc_atoms", + "swc_common", +] + +[[package]] +name = "swc_timer" +version = "0.19.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9889bf48909289e13e0f343eb8d1238e674e9380a4dd6c6346f62b83cb30236f" +dependencies = [ + "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.23", ] [[package]] @@ -1181,7 +2375,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] @@ -1197,9 +2391,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" dependencies = [ "proc-macro2", "quote", @@ -1216,23 +2410,55 @@ dependencies = [ ] [[package]] -name = "thiserror" -version = "1.0.40" +name = "terminal_size" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "633c1a546cee861a1a6d0dc69ebeca693bf4296661ba7852b9d21d159e0506df" +dependencies = [ + "libc", + "winapi", +] + +[[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.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", +] + +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", ] [[package]] @@ -1291,13 +2517,13 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8803eee176538f94ae9a14b55b2804eb7e1441f8210b1c31290b3bccdccff73b" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.23", ] [[package]] @@ -1325,6 +2551,12 @@ version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -1339,9 +2571,19 @@ checksum = "d70b6494226b36008c8366c288d77190b3fad2eb4c10533139c1c1f461127f1a" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" + +[[package]] +name = "unicode-linebreak" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" +dependencies = [ + "hashbrown 0.12.3", + "regex", +] [[package]] name = "unicode-normalization" @@ -1381,7 +2623,7 @@ dependencies = [ "getset", "rustversion", "thiserror", - "time", + "time 0.3.22", ] [[package]] @@ -1400,12 +2642,72 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.23", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.23", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.87" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" + [[package]] name = "winapi" version = "0.3.9" @@ -1437,6 +2739,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.1", +] + [[package]] name = "windows-sys" version = "0.45.0" @@ -1463,9 +2774,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", diff --git a/compiler/forget/Cargo.toml b/compiler/forget/Cargo.toml index 2d68bed6b4..b135c5e09a 100644 --- a/compiler/forget/Cargo.toml +++ b/compiler/forget/Cargo.toml @@ -2,6 +2,7 @@ members = [ "crates/build-hir", + "crates/fixtures", "crates/hir", "crates/swc-demo", "crates/estree", diff --git a/compiler/forget/crates/build-hir/src/build.rs b/compiler/forget/crates/build-hir/src/build.rs index abff514eab..a0f19d46f6 100644 --- a/compiler/forget/crates/build-hir/src/build.rs +++ b/compiler/forget/crates/build-hir/src/build.rs @@ -102,7 +102,7 @@ fn lower_statement<'a>( Statement::EmptyStatement(_) => { // no-op } - _ => todo!(), + _ => todo!("Lower {stmt:#?}"), } Ok(()) } @@ -148,7 +148,7 @@ fn lower_expression<'a>( ExpressionLike::SpreadElement(_) => { panic!("SpreadElement may not appear in normal expression position") } - _ => todo!(), + _ => todo!("Lower expr {expr:#?}"), } } @@ -197,7 +197,7 @@ fn lower_primitive<'a>( LiteralValue::Null => PrimitiveValue::Null, LiteralValue::Number(value) => PrimitiveValue::Number(f64::from(value).into()), LiteralValue::String(s) => PrimitiveValue::String(String::from_str_in(&s, &env.allocator)), - _ => todo!(), + _ => todo!("Lower literal {literal:#?}"), } } diff --git a/compiler/forget/crates/build-hir/src/builder.rs b/compiler/forget/crates/build-hir/src/builder.rs index ebb68a4c00..05abb1ab14 100644 --- a/compiler/forget/crates/build-hir/src/builder.rs +++ b/compiler/forget/crates/build-hir/src/builder.rs @@ -58,12 +58,25 @@ impl<'a> Builder<'a> { blocks: self.completed, }; + assert!(hir.blocks.len() > 0, "initial block count"); reverse_postorder_blocks(&mut hir); + assert!(hir.blocks.len() > 0, "after reverse_postorder_blocks"); remove_unreachable_for_updates(&mut hir); + assert!(hir.blocks.len() > 0, "after remove_unreachable_for_updates"); remove_unreachable_fallthroughs(&mut hir); + assert!( + hir.blocks.len() > 0, + "after remove_unreachable_fallthroughs" + ); remove_unreachable_do_while_statements(&mut hir); + assert!( + hir.blocks.len() > 0, + "after remove_unreachable_do_while_statements" + ); mark_instruction_ids(&mut hir)?; + assert!(hir.blocks.len() > 0, "after mark_instruction_ids"); mark_predecessors(&mut hir); + assert!(hir.blocks.len() > 0, "after mark_predecessors"); Ok(hir) } @@ -166,6 +179,7 @@ fn reverse_postorder_blocks<'a>(hir: &mut HIR<'a>) { } TerminalValue::ReturnTerminal(..) => { /* no-op */ } } + postorder.push(block_id); } visit(hir.entry, &hir, &mut visited, &mut postorder); @@ -241,7 +255,9 @@ fn mark_instruction_ids<'a>(hir: &mut HIR<'a>) -> Result<(), Diagnostic> { let mut visited = HashSet::<(usize, usize)>::new(); for (block_ix, block) in hir.blocks.values_mut().enumerate() { for (instr_ix, instr) in block.instructions.iter_mut().enumerate() { - invariant(!visited.insert((block_ix, instr_ix)), || ())?; + invariant(visited.insert((block_ix, instr_ix)), || { + format!("Expected bb{block_ix} i{instr_ix} not to have been visited yet") + })?; instr.id = id_gen.next(); } block.terminal.id = id_gen.next(); @@ -275,12 +291,13 @@ fn mark_predecessors<'a>(hir: &mut HIR<'a>) { visit(hir.entry, None, hir, &mut visited); } -fn invariant(cond: bool, _f: F) -> Result<(), Diagnostic> +fn invariant(cond: bool, f: F) -> Result<(), Diagnostic> where - F: FnOnce() -> Diagnostic, + F: FnOnce() -> String, { if !cond { - panic!("Oops invariant failed"); + let msg = f(); + panic!("Invariant: {msg}"); } Ok(()) } diff --git a/compiler/forget/crates/estree-swc/Cargo.toml b/compiler/forget/crates/estree-swc/Cargo.toml index a995421b9a..46585a8a04 100644 --- a/compiler/forget/crates/estree-swc/Cargo.toml +++ b/compiler/forget/crates/estree-swc/Cargo.toml @@ -6,6 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -swc_ecma_ast = { version = "0.106.6", features = ["serde", "serde-impl"] } estree = { path = "../estree" } -swc_common = "0.31.16" +swc = "0.264.8" +swc_core = { version = "0.79.9", features = ["swc_ecma_visit", "__ecma_transforms", "swc_ecma_ast", "swc_common", "swc", "swc_ecma_parser", "__ecma", "__common", "ecma_ast", "__visit", "__parser"] } diff --git a/compiler/forget/crates/estree-swc/src/lib.rs b/compiler/forget/crates/estree-swc/src/lib.rs index 8f065cf6d4..688790838b 100644 --- a/compiler/forget/crates/estree-swc/src/lib.rs +++ b/compiler/forget/crates/estree-swc/src/lib.rs @@ -1,12 +1,49 @@ -use std::num::NonZeroU32; +use std::{io::stderr, num::NonZeroU32, sync::Arc}; -use swc_common::{source_map::Pos, Span}; -use swc_ecma_ast::{ - AssignOp, BinaryOp, BlockStmt, Decl, Expr, Ident, Lit, ModuleItem, Pat, PatOrExpr, Program, - Stmt, UnaryOp, VarDeclKind, VarDeclOrExpr, +use swc::Compiler; +use swc_core::common::errors::Handler; +use swc_core::common::source_map::Pos; +use swc_core::common::{FileName, FilePathMapping, Mark, SourceMap, Span, GLOBALS}; +use swc_core::ecma::ast::{ + AssignOp, BinaryOp, BlockStmt, Decl, EsVersion, Expr, Ident, Lit, ModuleItem, Pat, PatOrExpr, + Program, Stmt, UnaryOp, VarDeclKind, VarDeclOrExpr, }; +use swc_core::ecma::parser::Syntax; +use swc_core::ecma::transforms::base::resolver; +use swc_core::ecma::visit::FoldWith; -pub fn convert_program(program: &Program) -> estree::Program { +/// Parses source text into an estree::Program via SWC, internally performing the parsing +/// and SWC -> ESTree conversion. +pub fn parse(source: &str, file: &str) -> Result> { + GLOBALS.set(&Default::default(), || { + let cm = Arc::new(SourceMap::new(FilePathMapping::empty())); + let c = Compiler::new(cm); + let fm = + c.cm.new_source_file(FileName::Real(file.into()), source.to_string()); + + let handler = Handler::with_emitter_writer(Box::new(stderr()), Some(c.cm.clone())); + + let comments = c.comments().clone(); + let module = c.parse_js( + fm.clone(), + &handler, + EsVersion::Es5, + Syntax::Typescript(Default::default()), + swc::config::IsModule::Bool(true), + Some(&comments), + )?; + + let module = c.run_transform(&handler, false, || { + let unresolved_mark = Mark::new(); + let top_level_mark = Mark::new(); + module.fold_with(&mut resolver(unresolved_mark, top_level_mark, true)) + }); + + Ok(convert_program(&module)) + }) +} + +fn convert_program(program: &Program) -> estree::Program { let mut program_items: Vec; match program { Program::Module(program) => { diff --git a/compiler/forget/crates/fixtures/Cargo.toml b/compiler/forget/crates/fixtures/Cargo.toml new file mode 100644 index 0000000000..0587df6654 --- /dev/null +++ b/compiler/forget/crates/fixtures/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "fixtures" +version = "0.1.0" +edition = "2021" +publish = false + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +insta = "1.30.0" +estree = { path = "../estree" } +estree-swc = { path = "../estree-swc" } +hir = { path = "../hir" } +build-hir = { path = "../build-hir" } +bumpalo = { version = "3.13.0", features = ["collections"] } diff --git a/compiler/forget/crates/fixtures/README.md b/compiler/forget/crates/fixtures/README.md new file mode 100644 index 0000000000..b930e96f56 --- /dev/null +++ b/compiler/forget/crates/fixtures/README.md @@ -0,0 +1,3 @@ +# fixtures + +This crate is for tests only, and runs the suite of compiler fixture tests. \ No newline at end of file diff --git a/compiler/forget/crates/fixtures/src/lib.rs b/compiler/forget/crates/fixtures/src/lib.rs new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/compiler/forget/crates/fixtures/src/lib.rs @@ -0,0 +1 @@ + diff --git a/compiler/forget/crates/fixtures/tests/fixtures/simple.js b/compiler/forget/crates/fixtures/tests/fixtures/simple.js new file mode 100644 index 0000000000..f4c4c26753 --- /dev/null +++ b/compiler/forget/crates/fixtures/tests/fixtures/simple.js @@ -0,0 +1,4 @@ +function test() { + [true, false, null, 1, 3.14, "hello world!"]; + return 2; +} diff --git a/compiler/forget/crates/fixtures/tests/fixtures_test.rs b/compiler/forget/crates/fixtures/tests/fixtures_test.rs new file mode 100644 index 0000000000..5271f09bdc --- /dev/null +++ b/compiler/forget/crates/fixtures/tests/fixtures_test.rs @@ -0,0 +1,36 @@ +use build_hir::build; +use bumpalo::Bump; +use estree::{ModuleItem, Statement}; +use estree_swc::parse; +use hir::{Environment, Registry}; +use insta::{assert_snapshot, glob}; + +#[test] +fn fixtures() { + glob!("fixtures/**.js", |path| { + let input = std::fs::read_to_string(path).unwrap(); + let ast = parse(&input, path.to_str().unwrap()).unwrap(); + + let mut output = Vec::new(); + + for item in ast.body { + if let ModuleItem::Statement(stmt) = item { + if let Statement::FunctionDeclaration(fun) = *stmt { + let allocator = Bump::new(); + let environment = allocator.alloc(Environment::new( + &allocator, + hir::Features { + validate_frozen_lambdas: true, + }, + Registry, + )); + let hir = build(&environment, *fun).unwrap(); + output.push(format!("{hir:#?}")); + } + } + } + + let joined = output.join("\n\n"); + assert_snapshot!(format!("Input:\n{input}\n\nOutput:\n{joined}")); + }); +} diff --git a/compiler/forget/crates/fixtures/tests/snapshots/fixtures_test__fixtures.snap b/compiler/forget/crates/fixtures/tests/snapshots/fixtures_test__fixtures.snap new file mode 100644 index 0000000000..ad2940ad98 --- /dev/null +++ b/compiler/forget/crates/fixtures/tests/snapshots/fixtures_test__fixtures.snap @@ -0,0 +1,560 @@ +--- +source: crates/fixtures/tests/fixtures_test.rs +expression: "format!(\"Input:\\n{input}\\n\\nOutput:\\n{joined}\")" +input_file: crates/fixtures/tests/fixtures/simple.js +--- +Input: +function test() { + [true, false, null, 1, 3.14, "hello world!"]; + return 2; +} + + +Output: +Function { + body: HIR { + entry: BlockId( + 0, + ), + blocks: { + BlockId( + 0, + ): BasicBlock { + id: BlockId( + 0, + ), + kind: Block, + instructions: [ + Instruction { + id: InstructionId( + 0, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 0, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 0, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Boolean( + true, + ), + }, + ), + }, + Instruction { + id: InstructionId( + 1, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 1, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 1, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Boolean( + false, + ), + }, + ), + }, + Instruction { + id: InstructionId( + 2, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 2, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 2, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Null, + }, + ), + }, + Instruction { + id: InstructionId( + 3, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 3, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 3, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Number( + Number( + 4607182418800017408, + ), + ), + }, + ), + }, + Instruction { + id: InstructionId( + 4, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 4, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 4, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Number( + Number( + 4614253070214989087, + ), + ), + }, + ), + }, + Instruction { + id: InstructionId( + 5, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 5, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 5, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: String( + "hello world!", + ), + }, + ), + }, + Instruction { + id: InstructionId( + 6, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 6, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 6, + ), + ), + }, + }, + }, + effect: None, + }, + value: Array( + Array { + elements: [ + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 0, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 0, + ), + ), + }, + }, + }, + effect: None, + }, + ), + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 1, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 1, + ), + ), + }, + }, + }, + effect: None, + }, + ), + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 2, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 2, + ), + ), + }, + }, + }, + effect: None, + }, + ), + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 3, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 3, + ), + ), + }, + }, + }, + effect: None, + }, + ), + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 4, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 4, + ), + ), + }, + }, + }, + effect: None, + }, + ), + Place( + Place { + identifier: Identifier { + id: IdentifierId( + 5, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 5, + ), + ), + }, + }, + }, + effect: None, + }, + ), + ], + }, + ), + }, + Instruction { + id: InstructionId( + 7, + ), + lvalue: Place { + identifier: Identifier { + id: IdentifierId( + 7, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 7, + ), + ), + }, + }, + }, + effect: None, + }, + value: Primitive( + Primitive { + value: Number( + Number( + 4611686018427387904, + ), + ), + }, + ), + }, + ], + terminal: Terminal { + id: InstructionId( + 8, + ), + value: ReturnTerminal( + ReturnTerminal { + value: Place { + identifier: Identifier { + id: IdentifierId( + 7, + ), + name: None, + data: RefCell { + value: IdentifierData { + mutable_range: MutableRange { + start: InstructionId( + 0, + ), + end: InstructionId( + 0, + ), + }, + scope: None, + type_: Var( + TypeVarId( + 7, + ), + ), + }, + }, + }, + effect: None, + }, + }, + ), + }, + predecessors: {}, + }, + }, + }, + is_async: false, + is_generator: false, +} diff --git a/compiler/forget/crates/hir/src/basic_block.rs b/compiler/forget/crates/hir/src/basic_block.rs index 81d3028f80..c7afbc9128 100644 --- a/compiler/forget/crates/hir/src/basic_block.rs +++ b/compiler/forget/crates/hir/src/basic_block.rs @@ -8,6 +8,7 @@ use crate::{id_types::BlockId, Instruction, Terminal}; /// continue. /// /// [1] Assuming no exceptions are thrown. +#[derive(Debug)] pub struct BasicBlock<'a> { /// The identifier for the block pub id: BlockId, @@ -28,6 +29,7 @@ pub struct BasicBlock<'a> { pub predecessors: HashSet, } +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum BlockKind { Block, Value, diff --git a/compiler/forget/crates/hir/src/function.rs b/compiler/forget/crates/hir/src/function.rs index c9085f3209..ad78ff5660 100644 --- a/compiler/forget/crates/hir/src/function.rs +++ b/compiler/forget/crates/hir/src/function.rs @@ -3,6 +3,7 @@ use indexmap::IndexMap; use crate::{BasicBlock, BlockId}; /// Represents either a React function or a function expression +#[derive(Debug)] pub struct Function<'a> { pub body: HIR<'a>, pub is_async: bool, @@ -13,6 +14,7 @@ pub struct Function<'a> { /// Blocks are stored in reverse postorder (predecessors before successors) /// so that compiler passes can complete forward data flow analysis in a /// single pass over the CFG in the case where there are no loops. +#[derive(Debug)] pub struct HIR<'a> { /// The id of the first block pub entry: BlockId, diff --git a/compiler/forget/crates/hir/src/id_types.rs b/compiler/forget/crates/hir/src/id_types.rs index 172fe4e8af..9c3a355d87 100644 --- a/compiler/forget/crates/hir/src/id_types.rs +++ b/compiler/forget/crates/hir/src/id_types.rs @@ -39,6 +39,7 @@ impl TypeVarId { /// /// TODO: rename to more clearly indicate that this is for sequencing /// and to reflect that it is applied to terminals as well +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)] pub struct InstructionId(pub(crate) u32); pub struct InstructionIdGenerator(u32); @@ -56,10 +57,13 @@ impl InstructionIdGenerator { } /// Uniquely identifies a reactive scope +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)] pub struct ScopeId(pub(crate) u32); /// Uniquely identifiers a builtin function type in the type registry +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)] pub struct FunctionId(pub(crate) u32); /// Uniquely identifiers a builtin object type in the type registry +#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Hash, Debug)] pub struct ObjectId(pub(crate) u32); diff --git a/compiler/forget/crates/hir/src/instruction.rs b/compiler/forget/crates/hir/src/instruction.rs index c1fd83af61..683aea1af8 100644 --- a/compiler/forget/crates/hir/src/instruction.rs +++ b/compiler/forget/crates/hir/src/instruction.rs @@ -4,12 +4,14 @@ use bumpalo::collections::{String, Vec}; use crate::{IdentifierId, InstructionId, ScopeId, Type}; +#[derive(Debug)] pub struct Instruction<'a> { pub id: InstructionId, pub lvalue: Place<'a>, pub value: InstructionValue<'a>, } +#[derive(Debug)] pub enum InstructionValue<'a> { Array(Array<'a>), // Await(Await<'a>), @@ -46,19 +48,23 @@ pub enum InstructionValue<'a> { // Unsupported(Unsupported<'a>), } +#[derive(Debug)] pub struct Array<'a> { pub elements: Vec<'a, ArrayElement<'a>>, } +#[derive(Debug)] pub enum ArrayElement<'a> { Place(Place<'a>), Spread(Place<'a>), } +#[derive(Debug)] pub struct Primitive<'a> { pub value: PrimitiveValue<'a>, } +#[derive(Debug)] pub enum PrimitiveValue<'a> { Boolean(bool), Null, @@ -84,38 +90,45 @@ impl From for f64 { } } +#[derive(Debug)] pub struct LoadLocal<'a> { pub place: Place<'a>, } +#[derive(Debug)] pub struct LoadContext<'a> { pub place: Place<'a>, } +#[derive(Debug)] pub struct DeclareLocal<'a> { pub lvalue: LValue<'a>, } +#[derive(Debug)] pub struct DeclareContext<'a> { pub lvalue: LValue<'a>, // note: kind must be InstructionKind::Let } +#[derive(Debug)] pub struct StoreLocal<'a> { pub lvalue: LValue<'a>, pub value: Place<'a>, } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Place<'a> { pub identifier: Identifier<'a>, pub effect: Option, } +#[derive(Debug)] pub struct LValue<'a> { pub place: Place<'a>, pub kind: InstructionKind, } +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum InstructionKind { /// `const` declaration Const, @@ -127,7 +140,7 @@ pub enum InstructionKind { Reassign, } -#[derive(Clone, Copy, PartialEq, Eq, Debug)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum Effect { /// This reference freezes the value (corresponds to a place where codegen should emit a freeze instruction) Freeze, @@ -163,7 +176,7 @@ impl Effect { } } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct Identifier<'a> { /// Uniquely identifiers this identifier pub id: IdentifierId, @@ -172,6 +185,7 @@ pub struct Identifier<'a> { pub data: Rc>, } +#[derive(Debug)] pub struct IdentifierData { pub mutable_range: MutableRange, @@ -185,6 +199,7 @@ pub struct IdentifierData { /// /// Start is inclusive, end is exclusive (ie end is the "first" instruction /// for which the value is not mutable). +#[derive(Clone, Debug)] pub struct MutableRange { /// start of the range, inclusive. pub start: InstructionId, @@ -208,6 +223,7 @@ impl Default for MutableRange { } } +#[derive(Clone, Debug)] pub struct ReactiveScope { pub id: ScopeId, pub range: MutableRange, diff --git a/compiler/forget/crates/hir/src/terminal.rs b/compiler/forget/crates/hir/src/terminal.rs index 17bcd168d4..2be31a59ca 100644 --- a/compiler/forget/crates/hir/src/terminal.rs +++ b/compiler/forget/crates/hir/src/terminal.rs @@ -2,11 +2,13 @@ use crate::{instruction::Place, BlockId, InstructionId}; /// Terminals represent statements or expressions that affect control flow, /// such as for-of, if-else, return, logical (??), ternaries (?:), etc. +#[derive(Debug)] pub struct Terminal<'a> { pub id: InstructionId, pub value: TerminalValue<'a>, } +#[derive(Debug)] pub enum TerminalValue<'a> { // BranchTerminal(BranchTerminal), DoWhileTerminal(DoWhileTerminal), @@ -69,23 +71,26 @@ impl<'a> TerminalValue<'a> { } } +#[derive(Debug)] pub struct GotoTerminal { pub block: BlockId, pub kind: GotoKind, } -#[derive(Clone, Copy)] +#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub enum GotoKind { Break, Continue, } +#[derive(Debug)] pub struct DoWhileTerminal { pub body: BlockId, pub test: BlockId, pub fallthrough: BlockId, } +#[derive(Debug)] pub struct IfTerminal<'a> { pub test: Place<'a>, pub consequent: BlockId, @@ -93,10 +98,12 @@ pub struct IfTerminal<'a> { pub fallthrough: Option, } +#[derive(Debug)] pub struct ReturnTerminal<'a> { pub value: Place<'a>, } +#[derive(Debug)] pub struct ForTerminal { pub init: BlockId, pub test: BlockId, diff --git a/compiler/forget/crates/hir/src/types.rs b/compiler/forget/crates/hir/src/types.rs index a8d6846c25..324bf6318e 100644 --- a/compiler/forget/crates/hir/src/types.rs +++ b/compiler/forget/crates/hir/src/types.rs @@ -1,5 +1,6 @@ use crate::{FunctionId, ObjectId, TypeVarId}; +#[derive(Debug)] pub enum Type { Builtin(BuiltinType), // Phi(Box), @@ -8,6 +9,7 @@ pub enum Type { // Prop(Box), } +#[derive(Debug)] pub enum BuiltinType { Primitive, Function(Option), diff --git a/compiler/forget/rust-toolchain.toml b/compiler/forget/rust-toolchain.toml new file mode 100644 index 0000000000..244f68889b --- /dev/null +++ b/compiler/forget/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +# Sigh, because SWC +channel = "nightly" \ No newline at end of file