From c4f84e8a88a9d186f05bccf84ce201658ec4c94c Mon Sep 17 00:00:00 2001 From: roadup Date: Sun, 4 Feb 2024 09:26:13 +0800 Subject: [PATCH] print js error in console.log --- Cargo.lock | 2000 ++++-------------------- Cargo.toml | 20 +- bootstrap/main.ts | 21 +- src/{runner => builtin}/console.rs | 19 +- src/{runner => builtin}/edon_fs.rs | 0 src/{runner => builtin}/mod.rs | 0 src/{runner => builtin}/modules.rs | 0 src/{runner => builtin}/set_timeout.rs | 0 src/compile.rs | 169 +- src/compile_oxc.rs | 98 ++ src/compile_swc.rs | 131 ++ src/graph.rs | 23 +- src/main.rs | 4 +- src/runtime/asynchronous.rs | 52 +- src/runtime/init.rs | 10 +- src/runtime/mod.rs | 13 +- src/runtime/static_fn.rs | 19 +- test/test.ts | 20 +- test/test1.ts | 12 +- test/welcome.ts | 1 + 20 files changed, 711 insertions(+), 1901 deletions(-) rename src/{runner => builtin}/console.rs (92%) rename src/{runner => builtin}/edon_fs.rs (100%) rename src/{runner => builtin}/mod.rs (100%) rename src/{runner => builtin}/modules.rs (100%) rename src/{runner => builtin}/set_timeout.rs (100%) create mode 100644 src/compile_oxc.rs create mode 100644 src/compile_swc.rs create mode 100644 test/welcome.ts diff --git a/Cargo.lock b/Cargo.lock index 55ed203..10f3f32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # 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" @@ -27,20 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "ahash" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" -dependencies = [ - "cfg-if", - "getrandom", - "once_cell", - "serde", - "version_check", - "zerocopy", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -72,22 +48,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[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.6" +name = "assert-unchecked" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3e3e06ec6ac7d893a0db7127d91063ad7d9da8988f8a1a256f03729e6eec026" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.48", -] +checksum = "7330592adf847ee2e3513587b4db2db410a0d751378654e7e993d9adcbe5c795" [[package]] name = "async-stream" @@ -122,29 +86,6 @@ dependencies = [ "syn 2.0.48", ] -[[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 = "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" @@ -217,15 +158,6 @@ version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c79fed4cdb43e993fcdadc7e58a09fd0e3e649c4436fa11da71c9f1f3ee7feb9" -[[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" @@ -234,39 +166,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" - -[[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.13.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33066f72a558361eeb1077b0aff0f1dce1ac75bdc20b38a642f155f767b2824" -dependencies = [ - "ahash", - "anyhow", - "chrono", - "either", - "itertools 0.10.5", - "nom", - "once_cell", - "quote", - "serde", - "serde_json", - "string_cache", - "string_cache_codegen", - "thiserror", -] +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bumpalo" @@ -286,6 +188,15 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" +[[package]] +name = "castaway" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a17ed5635fc8536268e5d4de1e22e81ac34419e5f052d4d51f4e01dcc263fcc" +dependencies = [ + "rustversion", +] + [[package]] name = "cc" version = "1.0.83" @@ -325,6 +236,19 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "compact_str" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f86b9c4c00838774a6d902ef931eff7470720c51d90c2e32cfe15dc304737b3f" +dependencies = [ + "castaway", + "cfg-if", + "itoa", + "ryu", + "static_assertions", +] + [[package]] name = "console-api" version = "0.6.0" @@ -384,15 +308,6 @@ version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" -[[package]] -name = "cpufeatures" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" -dependencies = [ - "libc", -] - [[package]] name = "crc32fast" version = "1.3.2" @@ -411,41 +326,12 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" -[[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.5.3" @@ -459,22 +345,6 @@ dependencies = [ "parking_lot_core", ] -[[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 = "derive_more" version = "0.99.17" @@ -484,20 +354,10 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn 1.0.109", ] -[[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 = "edon" version = "0.1.0" @@ -509,6 +369,13 @@ dependencies = [ "env_logger", "futures", "log", + "oxc_allocator", + "oxc_ast", + "oxc_codegen", + "oxc_parser", + "oxc_semantic", + "oxc_span", + "oxc_transformer", "queues", "quote", "regex", @@ -516,12 +383,6 @@ dependencies = [ "reqwest", "serde_json", "serde_v8", - "swc", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms_module", - "swc_ecma_visit", "tokio", "tracing", "url", @@ -624,17 +485,6 @@ 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.48", -] - [[package]] name = "fslock" version = "0.1.8" @@ -734,16 +584,6 @@ dependencies = [ "slab", ] -[[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" @@ -773,7 +613,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.1.0", + "indexmap 2.2.2", "slab", "tokio", "tokio-util", @@ -786,15 +626,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.14.3" @@ -814,15 +645,6 @@ dependencies = [ "num-traits", ] -[[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.3" @@ -838,19 +660,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[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 = "http" version = "0.2.11" @@ -974,10 +783,10 @@ dependencies = [ ] [[package]] -name = "if_chain" -version = "1.0.2" +name = "index_vec" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" +checksum = "74086667896a940438f2118212f313abba4aff3831fef6f4b17d02add5c8bb60" [[package]] name = "indexmap" @@ -991,13 +800,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", "hashbrown 0.14.3", - "serde", ] [[package]] @@ -1006,25 +814,13 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" -[[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.48", -] - [[package]] name = "is-terminal" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi", "rustix", "windows-sys 0.52.0", ] @@ -1037,18 +833,18 @@ checksum = "616cde7c720bb2bb5824a224687d8f77bfd38922027f01d825cd7453be5099fb" [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -1068,15 +864,6 @@ 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" version = "1.4.0" @@ -1111,15 +898,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[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 = "matchers" version = "0.1.0" @@ -1143,12 +921,11 @@ checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "miette" -version = "4.7.1" +version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c90329e44f9208b55f45711f9558cec15d7ef8295cc65ecd6d4188ae8edc58c" +checksum = "59bb584eaeeab6bd0226ccf3509a69d7936d148cf3d036ad350abe35e8c6856e" dependencies = [ - "atty", - "backtrace", + "is-terminal", "miette-derive", "once_cell", "owo-colors", @@ -1163,13 +940,13 @@ dependencies = [ [[package]] name = "miette-derive" -version = "4.7.1" +version = "5.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b5bc45b761bcf1b5e6e6c4128cd93b84c218721a8d9b894aa0aff4ed180174c" +checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -1222,12 +999,6 @@ dependencies = [ "tempfile", ] -[[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" @@ -1238,15 +1009,6 @@ dependencies = [ "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.4" @@ -1257,7 +1019,6 @@ dependencies = [ "num-integer", "num-traits", "rand", - "serde", ] [[package]] @@ -1285,7 +1046,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.3", + "hermit-abi", "libc", ] @@ -1310,7 +1071,7 @@ version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -1355,74 +1116,196 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" [[package]] -name = "parking_lot" -version = "0.12.1" +name = "oxc_allocator" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "13747d4dc2ed0f6102d0372fc186351cec62531fe07ec327756f9176b7ae3435" dependencies = [ - "lock_api", - "parking_lot_core", + "bumpalo", + "serde", ] [[package]] -name = "parking_lot_core" -version = "0.9.9" +name = "oxc_ast" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "e40fa5a539ef2796e6722c70a2200bf1a34344d475505de34215b2d7a652fce3" dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.48.5", + "bitflags 2.4.2", + "num-bigint", + "num-traits", + "oxc_allocator", + "oxc_index", + "oxc_span", + "oxc_syntax", ] [[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" +name = "oxc_codegen" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "97788f1487bb8324024ba824151c8beb56fdcdbe99f0d1c96ce16d6938b876e3" +dependencies = [ + "bitflags 2.4.2", + "num-bigint", + "oxc_allocator", + "oxc_ast", + "oxc_span", + "oxc_syntax", +] [[package]] -name = "percent-encoding" -version = "2.3.1" +name = "oxc_diagnostics" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +checksum = "4af962f55db6a89001ac7271050ace381ae9855af99cfbaa17119ba4a784badb" +dependencies = [ + "is-terminal", + "miette", + "owo-colors", + "textwrap", + "thiserror", + "unicode-width", +] [[package]] -name = "petgraph" -version = "0.6.4" +name = "oxc_index" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "9f6d07da75b08f9f3bc892e35a95d1b8ed0f1dd2bf0d5c4038e5fbfb17d75e47" dependencies = [ - "fixedbitset", - "indexmap 2.1.0", + "index_vec", + "static_assertions", ] [[package]] -name = "phf" -version = "0.11.2" +name = "oxc_parser" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" +checksum = "c7e709b2b30211728f0ffb2275649b6d82372f7c1aabb173cf2768efd8e94874" dependencies = [ - "phf_macros", - "phf_shared 0.11.2", + "assert-unchecked", + "bitflags 2.4.2", + "num-bigint", + "oxc_allocator", + "oxc_ast", + "oxc_diagnostics", + "oxc_index", + "oxc_span", + "oxc_syntax", + "rustc-hash", ] [[package]] -name = "phf_generator" -version = "0.10.0" +name = "oxc_semantic" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +checksum = "8b397e3d3f6846e9428ab387815583f88e0128cad9d61826faca5abb47d7c734" dependencies = [ - "phf_shared 0.10.0", - "rand", + "indexmap 2.2.2", + "itertools 0.12.1", + "oxc_allocator", + "oxc_ast", + "oxc_diagnostics", + "oxc_index", + "oxc_span", + "oxc_syntax", + "petgraph", + "phf", + "rustc-hash", +] + +[[package]] +name = "oxc_span" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a68147bd10e6438a04075ff7a6cfdcb928da7aecf28e6ea1aaa44713670cca69" +dependencies = [ + "compact_str", + "miette", +] + +[[package]] +name = "oxc_syntax" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f1036225932c7425cc426488bbd9de04c78bf34afaa89f9ad26a673c58c6041" +dependencies = [ + "bitflags 2.4.2", + "dashmap", + "indexmap 2.2.2", + "oxc_index", + "oxc_span", + "phf", + "rustc-hash", + "unicode-id-start", +] + +[[package]] +name = "oxc_transformer" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266508b58b3f9c0697a6b9317176276096775a38f59d4cdd3b5c9a6a6aae7798" +dependencies = [ + "bitflags 2.4.2", + "oxc_allocator", + "oxc_ast", + "oxc_diagnostics", + "oxc_semantic", + "oxc_span", + "oxc_syntax", + "phf", + "rustc-hash", + "serde", +] + +[[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 = "petgraph" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +dependencies = [ + "fixedbitset", + "indexmap 2.2.2", +] + +[[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]] @@ -1431,7 +1314,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" dependencies = [ - "phf_shared 0.11.2", + "phf_shared", "rand", ] @@ -1441,22 +1324,13 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" dependencies = [ - "phf_generator 0.11.2", - "phf_shared 0.11.2", + "phf_generator", + "phf_shared", "proc-macro2", "quote", "syn 2.0.48", ] -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - [[package]] name = "phf_shared" version = "0.11.2" @@ -1504,71 +1378,12 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" -[[package]] -name = "pmutil" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "ppv-lite86" version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "preset_env_base" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff96707a8ddcf6230b2249554d5dc78bbe93cfe28af5ef880174a0f2e63d0d53" -dependencies = [ - "ahash", - "anyhow", - "browserslist-rs", - "dashmap", - "from_variant", - "once_cell", - "semver 1.0.21", - "serde", - "st-map", - "tracing", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.76" @@ -1610,15 +1425,6 @@ dependencies = [ "prost", ] -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - [[package]] name = "queues" version = "1.1.0" @@ -1634,12 +1440,6 @@ 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" @@ -1670,26 +1470,6 @@ dependencies = [ "getrandom", ] -[[package]] -name = "rayon" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -1784,1290 +1564,244 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", -] - -[[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 = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.21", -] - -[[package]] -name = "rustix" -version = "0.38.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" -dependencies = [ - "bitflags 2.4.1", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[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.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" - -[[package]] -name = "ryu-js" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4950d85bc52415f8432144c97c4791bd0c4f7954de32a7270ee9cccd3c22b12b" - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - -[[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 = "security-framework" -version = "2.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[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.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" -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.195" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.195" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "serde_json" -version = "1.0.111" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_v8" -version = "0.154.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3748eaed607f7dd2b5800100e5fe7c6babe9941492974d55d0bd08775f66ebbd" -dependencies = [ - "bytes", - "derive_more", - "num-bigint", - "serde", - "smallvec", - "thiserror", - "v8", -] - -[[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 = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "signal-hook-registry" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" -dependencies = [ - "libc", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[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 = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[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 0.2.3", - "serde", - "serde_json", - "unicode-id", - "url", -] - -[[package]] -name = "st-map" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8a5c4e5cc839409346495370b2df67489cafd7fa83616d0547a9697a6a89a1" -dependencies = [ - "arrayvec", - "static-map-macro", -] - -[[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-map-macro" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf483ea7e0e3a03d1b91687895814425149ad77facd3e2b6839dde26da98454" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", - "serde", -] - -[[package]] -name = "string_cache_codegen" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb30289b722be4ff74a408c3cc27edeaad656e06cb1fe8fa9231fa59c728988" -dependencies = [ - "phf_generator 0.10.0", - "phf_shared 0.10.0", - "proc-macro2", - "quote", -] - -[[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.48", -] - -[[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.270.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df31dd9488814df8b8c2e0ed34d24c21a3622efb14f6babd29d9f7ff1e9ddf34" -dependencies = [ - "anyhow", - "base64", - "dashmap", - "either", - "indexmap 2.1.0", - "jsonc-parser", - "lru", - "once_cell", - "parking_lot", - "pathdiff", - "regex", - "rustc-hash", - "serde", - "serde_json", - "sourcemap", - "swc_atoms", - "swc_cached", - "swc_common", - "swc_compiler_base", - "swc_config", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_ext_transforms", - "swc_ecma_lints", - "swc_ecma_loader", - "swc_ecma_minifier", - "swc_ecma_parser", - "swc_ecma_preset_env", - "swc_ecma_transforms", - "swc_ecma_transforms_base", - "swc_ecma_transforms_compat", - "swc_ecma_transforms_optimization", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_error_reporters", - "swc_node_comments", - "swc_timer", - "swc_visit", - "tracing", - "url", -] - -[[package]] -name = "swc_atoms" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d538eaaa6f085161d088a04cf0a3a5a52c5a7f2b3bd9b83f73f058b0ed357c0" -dependencies = [ - "hstr", - "once_cell", - "rustc-hash", - "serde", -] - -[[package]] -name = "swc_cached" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b357b80879f6c4f4f34879d02eeae63aafc7730293e6eda3686f990d160486" -dependencies = [ - "ahash", - "anyhow", - "dashmap", - "once_cell", - "regex", - "serde", -] - -[[package]] -name = "swc_common" -version = "0.33.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b3ae36feceded27f0178dc9dabb49399830847ffb7f866af01798844de8f973" -dependencies = [ - "ahash", - "ast_node", - "atty", - "better_scoped_tls", - "cfg-if", - "either", - "from_variant", - "new_debug_unreachable", - "num-bigint", - "once_cell", - "parking_lot", - "rustc-hash", - "serde", - "siphasher", - "sourcemap", - "swc_atoms", - "swc_eq_ignore_macros", - "swc_visit", - "termcolor", - "tracing", - "unicode-width", - "url", -] - -[[package]] -name = "swc_compiler_base" -version = "0.4.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f2ef1d6ccbeb79c4fdce7abfc12194e291bf202fa61ab02c245b9a2811fb67" -dependencies = [ - "anyhow", - "base64", - "pathdiff", - "serde", - "sourcemap", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_codegen", - "swc_ecma_minifier", - "swc_ecma_parser", - "swc_ecma_visit", - "swc_timer", -] - -[[package]] -name = "swc_config" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "112884e66b60e614c0f416138b91b8b82b7fea6ed0ecc5e26bad4726c57a6c99" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_json", - "swc_config_macro", -] - -[[package]] -name = "swc_config_macro" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b2574f75082322a27d990116cd2a24de52945fc94172b24ca0b3e9e2a6ceb6b" -dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.48", -] - -[[package]] -name = "swc_ecma_ast" -version = "0.110.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79401a45da704f4fb2552c5bf86ee2198e8636b121cb81f8036848a300edd53b" -dependencies = [ - "bitflags 2.4.1", - "is-macro", - "num-bigint", - "phf", - "scoped-tls", - "serde", - "string_enum", - "swc_atoms", - "swc_common", - "unicode-id", -] - -[[package]] -name = "swc_ecma_codegen" -version = "0.146.54" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99b61ca275e3663238b71c4b5da8e6fb745bde9989ef37d94984dfc81fc6d009" -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.48", -] - -[[package]] -name = "swc_ecma_compat_bugfixes" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa7d64d6eecbc9bff025ced6cc38070eea3d515b2fd0c1b8610fcc349ad042fe" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_es2015", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_common" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b0a57bd134c03dd545263ee41824a8cb06af1553016dccf8ac1ad8cbbb940c3" -dependencies = [ - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", -] - -[[package]] -name = "swc_ecma_compat_es2015" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c13a791f0d457db7077e6487bd36f4b1b01f4c40a12fbbb5b7b312942638bf5" -dependencies = [ - "arrayvec", - "indexmap 2.1.0", - "is-macro", - "serde", - "serde_derive", - "smallvec", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2016" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0708c1ae05f82d4e19da2f02a5b093e4e50d581e9bfac527f4aa7693bd791cf7" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2017" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3701ee2c0321f79258a2acc3633b875af7770cd0173e17a0615d9e707ba32ac" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2018" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "def1e23336a20ca46d297685c2f5c60703eb2d7aea0b8996fefa577be3fad508" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2019" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72dd4288e3dfbba53a72410daf190d84d7601f91300e6c524ddea1f0708f2495" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2020" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f654fe803d73320c723ba25e88b4b561fd1d53ad59ad8622f209fe03f6849b3b" -dependencies = [ - "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_es2022", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2021" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a33089b3b121acadc052ca636905c1dd465db3cc94fa456c26eacc65d5074db" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es2022" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe2a334c1ed213b0a58adb09518c63c63229afad705e5ab027e2fd0f3ff20bd" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_compat_common", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_compat_es3" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b2f3ac54636b7690f17adc9430318d83bf8423635ca848bbb9f9c045e01e377" -dependencies = [ - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", -] - -[[package]] -name = "swc_ecma_ext_transforms" -version = "0.111.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e728d14119048a95e023c3c5c0ad5ddddb1f405bfef3bd55f81dc5fc3c9e95a" -dependencies = [ - "phf", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", + "winreg", ] [[package]] -name = "swc_ecma_lints" -version = "0.90.10" +name = "rustc-demangle" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5afe579c82fe80a24e8c815fa19e7f1126c8114db0985f211c985d5b4db4137e" -dependencies = [ - "auto_impl", - "dashmap", - "parking_lot", - "rayon", - "regex", - "serde", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", -] +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "swc_ecma_loader" -version = "0.45.13" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5713ab3429530c10bdf167170ebbde75b046c8003558459e4de5aaec62ce0f1" -dependencies = [ - "anyhow", - "dashmap", - "lru", - "normpath", - "once_cell", - "parking_lot", - "path-clean", - "pathdiff", - "serde", - "serde_json", - "swc_cached", - "swc_common", - "tracing", -] +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] -name = "swc_ecma_minifier" -version = "0.190.17" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35dae1f624247350378a02bbbbe408844e6ebfe8b8cd4558d9544f55b5a47b2d" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "arrayvec", - "indexmap 2.1.0", - "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", - "swc_ecma_codegen", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_optimization", - "swc_ecma_usage_analyzer", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_timer", - "tracing", + "semver", ] [[package]] -name = "swc_ecma_parser" -version = "0.141.37" +name = "rustix" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4d17401dd95048a6a62b777d533c0999dabdd531ef9d667e22f8ae2a2a0d294" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "either", - "new_debug_unreachable", - "num-bigint", - "num-traits", - "phf", - "serde", - "smallvec", - "smartstring", - "stacker", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "tracing", - "typed-arena", + "bitflags 2.4.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", ] [[package]] -name = "swc_ecma_preset_env" -version = "0.204.16" +name = "rustversion" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3ee3f7f6ea6f89e9a3dcd31e7bea57d920a27accb2fea0a6e630de761c85b46" -dependencies = [ - "anyhow", - "dashmap", - "indexmap 2.1.0", - "once_cell", - "preset_env_base", - "rustc-hash", - "semver 1.0.21", - "serde", - "serde_json", - "st-map", - "string_enum", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms", - "swc_ecma_utils", - "swc_ecma_visit", -] +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] -name = "swc_ecma_transforms" -version = "0.227.16" +name = "ryu" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0833d31ded8a6bba267a0ba1d1d7757bff4fa3da8a8bcd87afa0d7d47714d8aa" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "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", - "swc_ecma_visit", -] +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] -name = "swc_ecma_transforms_base" -version = "0.135.11" +name = "schannel" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d4ab26ec124b03e47f54d4daade8e9a9dcd66d3a4ca3cd47045f138d267a60e" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "better_scoped_tls", - "bitflags 2.4.1", - "indexmap 2.1.0", - "once_cell", - "phf", - "rustc-hash", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_utils", - "swc_ecma_visit", - "tracing", + "windows-sys 0.52.0", ] [[package]] -name = "swc_ecma_transforms_classes" -version = "0.124.11" +name = "scopeguard" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fe4376c024fa04394cafb8faecafb4623722b92dbbe46532258cc0a6b569d9c" -dependencies = [ - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", -] +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] -name = "swc_ecma_transforms_compat" -version = "0.161.15" +name = "security-framework" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea31f8cba739cdae66984d81f54103a6061faa651747d4a854558ca7c2288fa8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ - "arrayvec", - "indexmap 2.1.0", - "is-macro", - "num-bigint", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_compat_bugfixes", - "swc_ecma_compat_common", - "swc_ecma_compat_es2015", - "swc_ecma_compat_es2016", - "swc_ecma_compat_es2017", - "swc_ecma_compat_es2018", - "swc_ecma_compat_es2019", - "swc_ecma_compat_es2020", - "swc_ecma_compat_es2021", - "swc_ecma_compat_es2022", - "swc_ecma_compat_es3", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_trace_macro", - "tracing", + "bitflags 1.3.2", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", ] [[package]] -name = "swc_ecma_transforms_macros" -version = "0.5.4" +name = "security-framework-sys" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17e309b88f337da54ef7fe4c5b99c2c522927071f797ee6c9fb8b6bf2d100481" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.48", + "core-foundation-sys", + "libc", ] [[package]] -name = "swc_ecma_transforms_module" -version = "0.178.16" +name = "semver" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5b9c407ed6f9617d6c7513e83382b2d07c1b67264fab7f1fc50330eda0a3310" -dependencies = [ - "Inflector", - "anyhow", - "bitflags 2.4.1", - "indexmap 2.1.0", - "is-macro", - "path-clean", - "pathdiff", - "regex", - "serde", - "swc_atoms", - "swc_cached", - "swc_common", - "swc_ecma_ast", - "swc_ecma_loader", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_utils", - "swc_ecma_visit", - "tracing", -] +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] -name = "swc_ecma_transforms_optimization" -version = "0.196.15" +name = "serde" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ebaa4ec855cc01b32029c5cbc54f94062136738dc1bc59f11dcdb4c74e05f3" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ - "dashmap", - "indexmap 2.1.0", - "once_cell", - "petgraph", - "rustc-hash", - "serde_json", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_fast_graph", - "tracing", + "serde_derive", ] [[package]] -name = "swc_ecma_transforms_proposal" -version = "0.169.15" +name = "serde_derive" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aa4244af10e6c17e94ccacd84fc970a237c26d806aab48d4c80abf0fe2e3ab6" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ - "either", - "rustc-hash", - "serde", - "smallvec", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_classes", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", + "proc-macro2", + "quote", + "syn 2.0.48", ] [[package]] -name = "swc_ecma_transforms_react" -version = "0.181.16" +name = "serde_json" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc61d9dc84fe81574ae6c9de2df01871e96f765c578bd72ceb3efb0b50d8fd90" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ - "base64", - "dashmap", - "indexmap 2.1.0", - "once_cell", + "itoa", + "ryu", "serde", - "sha-1", - "string_enum", - "swc_atoms", - "swc_common", - "swc_config", - "swc_ecma_ast", - "swc_ecma_parser", - "swc_ecma_transforms_base", - "swc_ecma_transforms_macros", - "swc_ecma_utils", - "swc_ecma_visit", ] [[package]] -name = "swc_ecma_transforms_typescript" -version = "0.186.15" +name = "serde_urlencoded" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe72535a7100c70676c3de0450c897a03d99baefd50d84e3f9dd04c4da2f77ec" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" dependencies = [ - "ryu-js", + "form_urlencoded", + "itoa", + "ryu", "serde", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_transforms_base", - "swc_ecma_transforms_react", - "swc_ecma_utils", - "swc_ecma_visit", ] [[package]] -name = "swc_ecma_usage_analyzer" -version = "0.21.5" +name = "serde_v8" +version = "0.154.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf6ae5dd022ac6f39034896dd94eaeb590bf1fc6ab6e4f302fc9cdd8569e9b7" +checksum = "3748eaed607f7dd2b5800100e5fe7c6babe9941492974d55d0bd08775f66ebbd" dependencies = [ - "indexmap 2.1.0", - "rustc-hash", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_utils", - "swc_ecma_visit", - "swc_timer", - "tracing", + "bytes", + "derive_more", + "num-bigint", + "serde", + "smallvec", + "thiserror", + "v8", ] [[package]] -name = "swc_ecma_utils" -version = "0.125.4" +name = "sharded-slab" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cead1083e46b0f072a82938f16d366014468f7510350957765bb4d013496890" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ - "indexmap 2.1.0", - "num_cpus", - "once_cell", - "rustc-hash", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_ecma_visit", - "tracing", - "unicode-id", + "lazy_static", ] [[package]] -name = "swc_ecma_visit" -version = "0.96.17" +name = "signal-hook-registry" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1d0100c383fb08b6f34911ab6f925950416a5d14404c1cd520d59fb8dfbb3bf" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ - "num-bigint", - "swc_atoms", - "swc_common", - "swc_ecma_ast", - "swc_visit", - "tracing", + "libc", ] [[package]] -name = "swc_eq_ignore_macros" -version = "0.1.3" +name = "siphasher" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "695a1d8b461033d32429b5befbf0ad4d7a2c4d6ba9cd5ba4e0645c615839e8e4" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] -name = "swc_error_reporters" -version = "0.17.12" +name = "slab" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e00fa7c3009268d8ab2ca69d22ac3c3fe777297215fa128bc0ef42dcdf230ab" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ - "anyhow", - "miette", - "once_cell", - "parking_lot", - "swc_common", + "autocfg", ] [[package]] -name = "swc_fast_graph" -version = "0.21.13" +name = "smallvec" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acfc056067a0fbfe26a4763c1eb246e813fdbe6b376415d07915e96e15481b6" -dependencies = [ - "indexmap 2.1.0", - "petgraph", - "rustc-hash", - "swc_common", -] +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] -name = "swc_macros_common" -version = "0.3.9" +name = "smawk" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50176cfc1cbc8bb22f41c6fe9d1ec53fbe057001219b5954961b8ad0f336fce9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] -name = "swc_node_comments" -version = "0.20.12" +name = "socket2" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86a67c8fb9735b17b2cdf7b5dd539dc1625f73d05c794566b98e65be39cee5b1" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ - "dashmap", - "swc_atoms", - "swc_common", + "libc", + "windows-sys 0.48.0", ] [[package]] -name = "swc_timer" -version = "0.21.14" +name = "static_assertions" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b37010da5874d241c9e11ef020b8e4473f3af4e5d2e19219e92d99c04f12e0c6" -dependencies = [ - "tracing", -] +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] -name = "swc_trace_macro" -version = "0.1.3" +name = "supports-color" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff9719b6085dd2824fd61938a881937be14b08f95e2d27c64c825a9f65e052ba" +checksum = "d6398cde53adc3c4557306a96ce67b302968513830a77a95b2b17305d9719a89" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", + "is-terminal", + "is_ci", ] [[package]] -name = "swc_visit" -version = "0.5.8" +name = "supports-hyperlinks" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b27078d8571abe23aa52ef608dd1df89096a37d867cf691cbb4f4c392322b7c9" +checksum = "f84231692eb0d4d41e4cdd0cabfdd2e6cd9e255e65f80c9aa7c98dd502b4233d" dependencies = [ - "either", - "swc_visit_macros", + "is-terminal", ] [[package]] -name = "swc_visit_macros" -version = "0.5.9" +name = "supports-unicode" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8bb05975506741555ea4d10c3a3bdb0e2357cd58e1a4a4332b8ebb4b44c34d" +checksum = "f850c19edd184a205e883199a261ed44471c81e39bd95b1357f5febbef00e77a" dependencies = [ - "Inflector", - "pmutil", - "proc-macro2", - "quote", - "swc_macros_common", - "syn 2.0.48", + "is-terminal", ] [[package]] @@ -3153,9 +1887,9 @@ dependencies = [ [[package]] name = "textwrap" -version = "0.15.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b3e525a49ec206798b40326a44121291b530c963cfb01018f63e135bac543d" +checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb" dependencies = [ "smawk", "unicode-linebreak", @@ -3395,18 +2129,6 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[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.14" @@ -3414,10 +2136,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] -name = "unicode-id" -version = "0.3.4" +name = "unicode-id-start" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1b6def86329695390197b82c1e244a54a131ceb66c996f2088a3876e2ae083f" +checksum = "b8f73150333cb58412db36f2aca8f2875b013049705cc77b94ded70a1ab1f5da" [[package]] name = "unicode-ident" @@ -3457,12 +2179,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "uuid" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e395fcf16a7a3d8127ec99782007af141946b4795001f876d54fb0d55978560" - [[package]] name = "v8" version = "0.82.0" @@ -3487,12 +2203,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - [[package]] name = "want" version = "0.3.1" @@ -3777,23 +2487,3 @@ dependencies = [ "cfg-if", "windows-sys 0.48.0", ] - -[[package]] -name = "zerocopy" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.48", -] diff --git a/Cargo.toml b/Cargo.toml index 0b3809d..6e0749f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,16 +20,24 @@ relative-path = "1.9.2" reqwest = { version = "0.11.23", features = ["blocking"] } serde_json = "1.0.111" serde_v8 = "0.154.0" -swc = "0.270.20" -swc_common = { version = "0.33.12", features = ["tty-emitter"] } -swc_ecma_ast = "0.110.17" -swc_ecma_parser = "0.141.37" -swc_ecma_visit = "0.96.17" -swc_ecma_transforms_module = "0.178.16" +# swc = "0.270.20" +# swc_common = { version = "0.33.12", features = ["tty-emitter"] } +# swc_ecma_ast = "0.110.17" +# swc_ecma_parser = "0.141.37" +# swc_ecma_visit = "0.96.17" +# swc_ecma_transforms_module = "0.178.16" url = "2.5.0" v8 = "0.82.0" anyhow = "1.0.79" tracing = "0.1.40" +# oxc +oxc_allocator = "^0.6.0" +oxc_codegen = "^0.6.0" +oxc_parser = "^0.6.0" +oxc_transformer = "^0.6.0" +oxc_span= "^0.6.0" +oxc_ast = "^0.6.0" +oxc_semantic = "^0.6.0" [dependencies.tokio] features = ["full"] diff --git a/bootstrap/main.ts b/bootstrap/main.ts index 6bd995a..e8dc264 100644 --- a/bootstrap/main.ts +++ b/bootstrap/main.ts @@ -3,24 +3,23 @@ interface RuntimeData { count: number } -var runtimeData: RuntimeData = { - asyncHandle: [], - count: 0, -} - export default async function bootstrap(entry: string) { + var runtime: RuntimeData = { + asyncHandle: [], + count: 0, + } //@ts-ignore globalThis.setTimeout = (fn: Function, delay: number, ...arg: any[]) => { - runtimeData.asyncHandle[runtimeData.count] = () => { + runtime.asyncHandle[runtime.count] = () => { fn(...arg) } - this.timer.send(runtimeData.count, delay) - runtimeData.count++ + this.timer.send(runtime.count, delay) + runtime.count++ } globalThis.exec = (id: number) => { - if (runtimeData.asyncHandle[id]) { - let fn = runtimeData.asyncHandle[id] - delete runtimeData.asyncHandle[id] + if (runtime.asyncHandle[id]) { + let fn = runtime.asyncHandle[id] + delete runtime.asyncHandle[id] fn() } } diff --git a/src/runner/console.rs b/src/builtin/console.rs similarity index 92% rename from src/runner/console.rs rename to src/builtin/console.rs index c6989b1..6c8d137 100644 --- a/src/runner/console.rs +++ b/src/builtin/console.rs @@ -80,10 +80,20 @@ pub fn console_format( } if v.is_object() { let obj = v8::Local::::try_from(*v).unwrap(); + + if v.is_native_error() { + let stack = v8::String::new(scope, "stack").unwrap(); + let stack = obj + .get(scope, stack.into()) + .unwrap() + .to_rust_string_lossy(scope); + return format!("{stack}"); + } + let names = obj .get_own_property_names(scope, Default::default()) .unwrap(); - // let prototype = obj.get_prototype(scope).unwrap(); + let mut fmt = (0..names.length()) .map(|index| { let name = names.get_index(scope, index).unwrap(); @@ -114,7 +124,7 @@ pub fn console_format( format!("") } -pub fn console_log( +pub fn log( scope: &mut v8::HandleScope, args: v8::FunctionCallbackArguments, mut _rv: v8::ReturnValue, @@ -128,8 +138,5 @@ pub fn console_log( .collect::>() .join(" "); - println!( - "{} {result}", - format!("{}", Utc::now().format("%Y-%m-%d %H:%M:%S%.3f")).color("gray") - ); + println!("{result}"); } diff --git a/src/runner/edon_fs.rs b/src/builtin/edon_fs.rs similarity index 100% rename from src/runner/edon_fs.rs rename to src/builtin/edon_fs.rs diff --git a/src/runner/mod.rs b/src/builtin/mod.rs similarity index 100% rename from src/runner/mod.rs rename to src/builtin/mod.rs diff --git a/src/runner/modules.rs b/src/builtin/modules.rs similarity index 100% rename from src/runner/modules.rs rename to src/builtin/modules.rs diff --git a/src/runner/set_timeout.rs b/src/builtin/set_timeout.rs similarity index 100% rename from src/runner/set_timeout.rs rename to src/builtin/set_timeout.rs diff --git a/src/compile.rs b/src/compile.rs index 6484ee2..d5d591c 100644 --- a/src/compile.rs +++ b/src/compile.rs @@ -1,68 +1,11 @@ -use std::{path::PathBuf, sync::Arc}; -use swc::{ - config::{Config, JscConfig, ModuleConfig, Options, SourceMapsConfig}, - Compiler, -}; -use swc_common::{ - errors::{ColorConfig, Handler}, - FileName, SourceMap, GLOBALS, -}; -use swc_ecma_ast::{CallExpr, Callee, EsVersion, Expr, Lit, ModuleDecl}; -use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; -use swc_ecma_visit::{Visit, VisitWith}; -use v8::Isolate; - use crate::{ + compile_oxc, graph::resolve, runtime::{ModuleInstance, Runtime}, }; - -struct ImportParser { - sync_imports: Vec, - async_imports: Vec, -} - -impl ImportParser { - pub fn new() -> Self { - Self { - sync_imports: vec![], - async_imports: vec![], - } - } -} - -impl Visit for ImportParser { - fn visit_call_expr(&mut self, call_expr: &CallExpr) { - if !matches!(call_expr.callee, Callee::Import(_)) { - return; - } - if !call_expr.args.is_empty() { - let arg = &call_expr.args[0]; - if let Expr::Lit(Lit::Str(v)) = &*arg.expr { - self.async_imports.push(v.value.to_string()); - } - } - } - fn visit_module_decl(&mut self, module_decl: &ModuleDecl) { - match module_decl { - ModuleDecl::Import(import) => { - if import.type_only { - return; - } - self.sync_imports.push(import.src.value.to_string()); - } - ModuleDecl::ExportNamed(export) => { - if let Some(src) = &export.src { - self.sync_imports.push(src.value.to_string()); - } - } - ModuleDecl::ExportAll(export) => { - self.sync_imports.push(export.src.value.to_string()); - } - _ => {} - } - } -} +use anyhow::anyhow; +use std::{io::Result, path::PathBuf, sync::Arc}; +use v8::Isolate; #[derive(Debug)] pub struct ModuleDependency { @@ -138,7 +81,7 @@ impl ModuleDependency { let tc_scope = &mut v8::TryCatch::new(scope); module - .instantiate_module(tc_scope, Runtime::resolve) + .instantiate_module(tc_scope, Runtime::resolve_module_callback) .unwrap(); let expose = &module.get_module_namespace(); let v8_module = v8::Global::new(tc_scope, module); @@ -153,6 +96,7 @@ impl ModuleDependency { }, ); } + pub fn evaluate(&self, isolate: &mut Isolate) { let state_rc = Runtime::state(isolate); let graph_rc = Runtime::graph(isolate); @@ -160,7 +104,10 @@ impl ModuleDependency { self.deps.iter().for_each(|url| { let graph = graph_rc.borrow(); let table = graph.table.borrow(); - let dep = table.get(url).unwrap(); + let url = resolve(url, &self.filename); + let dep = table + .get(&url) + .expect(&format!("table get failure `{url}`")); dep.evaluate(isolate); }); @@ -187,94 +134,8 @@ impl ModuleDependency { } } -pub fn compile(file_name: &str, source: &str) -> ModuleDependency { - let cm = Arc::::default(); - let handler = Arc::new(Handler::with_tty_emitter( - ColorConfig::Auto, - true, - false, - Some(cm.clone()), - )); - let compiler = Compiler::new(cm.clone()); - - let fm = cm.new_source_file( - match url::Url::parse(file_name) { - Ok(url) => FileName::Url(url), - Err(_) => FileName::Real(PathBuf::from(file_name)), - }, - source.to_string(), - ); - - let lexer = Lexer::new( - Syntax::Typescript(Default::default()), - EsVersion::latest(), - StringInput::from(&*fm), - None, - ); - let mut parser = Parser::new_from(lexer); - - for err in parser.take_errors() { - err.into_diagnostic(&handler).emit(); - } - - let parsed = parser - .parse_module() - .map_err(|e| e.into_diagnostic(&handler).emit()) - .expect(&format!("parse {file_name} fail")); - - let mut import_parser = ImportParser::new(); - parsed.visit_with(&mut import_parser); - - let result = GLOBALS.set(&Default::default(), || { - compiler.run(|| { - compiler - .process_js_file( - fm, - &handler, - &Options { - config: Config { - jsc: JscConfig { - target: Some(EsVersion::Es2022), - syntax: Some(Syntax::Typescript(Default::default())), - ..Default::default() - }, - module: Some(ModuleConfig::Es6( - swc_ecma_transforms_module::EsModuleConfig { - resolve_fully: true, - }, - )), - source_maps: Some(SourceMapsConfig::Bool(false)), - ..Default::default() - }, - ..Default::default() - }, - ) - .expect("compiler error") - }) - }); - - // let filename = path.file_name().unwrap().to_str().unwrap(); - // let mut file = fs::OpenOptions::new() - // .write(true) - // .truncate(true) - // .create(true) - // .open(PathBuf::from(format!("output/{filename}.js"))) - // .unwrap(); - - // if let Some(map) = &result.map { - // fs::write( - // PathBuf::from(format!("output/{filename}.js.map")), - // map.as_bytes(), - // ) - // .unwrap(); - // } - ModuleDependency { - deps: import_parser.sync_imports, - async_deps: import_parser.async_imports, - specifier: vec![], - source: result.code, - map: result.map, - filename: file_name.to_string(), - is_main: false, - } -} +pub use compile_oxc::compile; +// pub fn compile(file_name: &str, source_text: &str) -> anyhow::Result { +// return compile_oxc::compile(file_name, source_text); +// // return compile_swc::compile(file_name, source_text); +// } diff --git a/src/compile_oxc.rs b/src/compile_oxc.rs new file mode 100644 index 0000000..3d0c34f --- /dev/null +++ b/src/compile_oxc.rs @@ -0,0 +1,98 @@ +use anyhow::anyhow; +use oxc_allocator::Allocator; +use oxc_ast::{AstKind, Visit}; +use oxc_codegen::{Codegen, CodegenOptions}; +use oxc_semantic::SemanticBuilder; +use oxc_span::{GetSpan, SourceType}; +use oxc_transformer::{TransformOptions, TransformTarget, Transformer}; +use tracing::Instrument; + +use crate::compile::ModuleDependency; + +#[derive(Debug, Default)] +struct ImportParser { + sync_imports: Vec, + async_imports: Vec, +} + +impl<'a> oxc_ast::Visit<'a> for ImportParser { + fn visit_import_declaration(&mut self, decl: &oxc_ast::ast::ImportDeclaration<'a>) { + let kind = AstKind::ImportDeclaration(self.alloc(decl)); + self.enter_node(kind); + if let Some(specifiers) = &decl.specifiers { + for specifer in specifiers { + self.visit_import_declaration_specifier(specifer); + } + } + self.sync_imports.push(decl.source.value.to_string()); + self.leave_node(kind); + } + + fn visit_import_declaration_specifier( + &mut self, + specifier: &oxc_ast::ast::ImportDeclarationSpecifier, + ) { + use oxc_ast::ast::ImportDeclarationSpecifier; + match specifier { + ImportDeclarationSpecifier::ImportSpecifier(import_specifer) => { + println!("ImportDeclarationSpecifier: {:?}", import_specifer.span); + } + ImportDeclarationSpecifier::ImportDefaultSpecifier(import_specfier) => { + println!("ImportDeclarationSpecifier: {:?}", import_specfier.span); + } + ImportDeclarationSpecifier::ImportNamespaceSpecifier(import_specifer) => { + println!("ImportDeclarationSpecifier: {:?}", import_specifer.span); + } + } + } + fn visit_import_expression(&mut self, expr: &oxc_ast::ast::ImportExpression<'a>) { + let kind = AstKind::ImportExpression(self.alloc(expr)); + self.enter_node(kind); + if let oxc_ast::ast::Expression::StringLiteral(v) = &expr.source { + self.async_imports.push(v.value.to_string()) + } + self.leave_node(kind); + } +} + +pub fn compile(file_name: &str, source_text: &str) -> anyhow::Result { + let allo = Allocator::default(); + let source_type = oxc_span::SourceType::from_path(file_name).unwrap(); + + let ret = oxc_parser::Parser::new(&allo, &source_text, source_type).parse(); + + if !ret.errors.is_empty() { + for error in ret.errors { + let error = error.with_source_code(source_text.to_string()); + println!("{error:?}"); + } + return Err(anyhow!("compile error")); + } + + let mut pass = ImportParser::default(); + pass.visit_program(&ret.program); + + let semantic = SemanticBuilder::new(&source_text, source_type) + .with_trivias(ret.trivias) + .build(&ret.program) + .semantic; + + let program = allo.alloc(ret.program); + let transform_options = TransformOptions::default(); + + Transformer::new(&allo, source_type, semantic, transform_options) + .build(program) + .unwrap(); + + let code = Codegen::::new(source_text.len(), CodegenOptions).build(program); + + Ok(ModuleDependency { + deps: pass.sync_imports, + async_deps: pass.async_imports, + specifier: vec![], + source: code, + map: None, + filename: file_name.to_string(), + is_main: false, + }) +} diff --git a/src/compile_swc.rs b/src/compile_swc.rs new file mode 100644 index 0000000..684c991 --- /dev/null +++ b/src/compile_swc.rs @@ -0,0 +1,131 @@ +use swc::{ + config::{Config, JscConfig, ModuleConfig, Options, SourceMapsConfig}, + Compiler, +}; +use swc_common::{ + errors::{ColorConfig, Handler}, + FileName, SourceMap, GLOBALS, +}; +use swc_ecma_ast::{CallExpr, Callee, EsVersion, Expr, Lit, ModuleDecl}; +use swc_ecma_parser::{lexer::Lexer, Parser, StringInput, Syntax}; +use swc_ecma_visit::{Visit, VisitWith}; + +#[derive(Default, Debug)] +struct ImportParser { + sync_imports: Vec, + async_imports: Vec, +} + +impl Visit for ImportParser { + fn visit_call_expr(&mut self, call_expr: &CallExpr) { + if !matches!(call_expr.callee, Callee::Import(_)) { + return; + } + if !call_expr.args.is_empty() { + let arg = &call_expr.args[0]; + if let Expr::Lit(Lit::Str(v)) = &*arg.expr { + self.async_imports.push(v.value.to_string()); + } + } + } + fn visit_module_decl(&mut self, module_decl: &ModuleDecl) { + match module_decl { + ModuleDecl::Import(import) => { + if import.type_only { + return; + } + self.sync_imports.push(import.src.value.to_string()); + } + ModuleDecl::ExportNamed(export) => { + if let Some(src) = &export.src { + self.sync_imports.push(src.value.to_string()); + } + } + ModuleDecl::ExportAll(export) => { + self.sync_imports.push(export.src.value.to_string()); + } + _ => {} + } + } +} +pub fn compile(file_name: &str, source_text: &str) -> anyhow::Result { + return compile_oxc::compile(file_name, source_text); + + let cm = Arc::::default(); + let handler = Arc::new(Handler::with_tty_emitter( + ColorConfig::Auto, + true, + false, + Some(cm.clone()), + )); + let compiler = Compiler::new(cm.clone()); + + let fm = cm.new_source_file( + match url::Url::parse(file_name) { + Ok(url) => FileName::Url(url), + Err(_) => FileName::Real(PathBuf::from(file_name)), + }, + source_text.to_string(), + ); + + let lexer = Lexer::new( + Syntax::Typescript(Default::default()), + EsVersion::latest(), + StringInput::from(&*fm), + None, + ); + let mut parser = Parser::new_from(lexer); + + for err in parser.take_errors() { + err.into_diagnostic(&handler).emit(); + } + + let parsed = parser + .parse_module() + .map_err(|e| e.into_diagnostic(&handler).emit()) + .map_err(|e| anyhow!("parse {file_name} fail"))?; + // .expect(&format!("parse {file_name} fail")); + + let mut import_parser = ImportParser::default(); + parsed.visit_with(&mut import_parser); + + let config = Config { + jsc: JscConfig { + target: Some(EsVersion::Es2022), + syntax: Some(Syntax::Typescript(Default::default())), + ..Default::default() + }, + module: Some(ModuleConfig::Es6( + swc_ecma_transforms_module::EsModuleConfig { + resolve_fully: true, + }, + )), + source_maps: Some(SourceMapsConfig::Bool(false)), + ..Default::default() + }; + let result = GLOBALS.set(&Default::default(), || { + compiler.run(|| { + compiler + .process_js_file( + fm, + &handler, + &Options { + config, + ..Default::default() + }, + ) + // .map_err(|e| anyhow!("compiler error")) + .expect("compiler error") + }) + }); + + Ok(ModuleDependency { + deps: import_parser.sync_imports, + async_deps: import_parser.async_imports, + specifier: vec![], + source: result.code, + map: result.map, + filename: file_name.to_string(), + is_main: false, + }) +} diff --git a/src/graph.rs b/src/graph.rs index 3c3be5f..dec6a82 100644 --- a/src/graph.rs +++ b/src/graph.rs @@ -37,7 +37,7 @@ pub async fn load(filename: &String) -> anyhow::Result { let now = Local::now().timestamp_millis(); let data = reqwest::get(filename).await?; let data = data.text().await?; - let data = compile(filename, &data); + let data = compile(filename, &data)?; println!( "{} {}", "Downland ".green(), @@ -50,8 +50,7 @@ pub async fn load(filename: &String) -> anyhow::Result { return Ok(data); }; let data = tokio::fs::read(&filename).await?; - let data = compile(filename, &String::from_utf8_lossy(&data).to_string()); - return Ok(data); + compile(filename, &String::from_utf8_lossy(&data).to_string()) } #[derive(Debug)] @@ -63,26 +62,26 @@ impl DependencyGraph { dep.append(entry, base).await?; Ok(dep) } - pub async fn append(&mut self, entry: &String, base: &String) -> anyhow::Result<()> { + pub async fn append(&mut self, source: &String, base: &String) -> anyhow::Result<()> { // - let mut preload = queue![(entry.clone(), base.clone())]; + let mut preload = queue![(source.clone(), base.clone())]; let table = &mut self.0; - while let Ok((entry, base)) = preload.remove() { - let url = resolve(&entry, &base); + while let Ok((source, base)) = preload.remove() { + let url = resolve(&source, &base); let dep = load(&url).await?; let base = dep.filename.clone(); - for specifier in &dep.deps { - if table.get(specifier).is_none() { - preload.add((specifier.clone(), base.clone())).unwrap(); + for source in &dep.deps { + if table.get(source).is_none() { + preload.add((source.clone(), base.clone())).unwrap(); } } table.insert(dep.filename.clone(), dep); } Ok(()) } - pub fn get(&self, specifier: &String) -> Option<&ModuleDependency> { - self.0.get(specifier) + pub fn get(&self, source: &String) -> Option<&ModuleDependency> { + self.0.get(source) } } diff --git a/src/main.rs b/src/main.rs index 6f28f5b..f9cc960 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,8 +1,10 @@ use std::env; mod compile; mod graph; -mod runner; +mod builtin; mod runtime; +mod compile_oxc; +// mod compile_swc; use graph::resolve; use graph::DependencyGraph; diff --git a/src/runtime/asynchronous.rs b/src/runtime/asynchronous.rs index 5cedf15..ed94b53 100644 --- a/src/runtime/asynchronous.rs +++ b/src/runtime/asynchronous.rs @@ -1,25 +1,27 @@ +use anyhow::anyhow; use std::task::Poll; - use v8::Isolate; use super::Runtime; #[derive(Debug, PartialEq)] pub enum AsynchronousKind { - Operation(u32), Import((String, v8::Global)), + Operation(u32), } impl AsynchronousKind { pub fn exec(&self, isolate: &mut Isolate) -> Poll<()> { - match self { + match match self { AsynchronousKind::Operation(id) => Self::operation(isolate, id.clone()), - AsynchronousKind::Import((specifier, resolver)) => { - Self::import(isolate, specifier, resolver) - } + AsynchronousKind::Import((source, resolver)) => Self::import(isolate, source, resolver), + } { + Ok(v) => v, + Err(e) => panic!("error {}", e), } } - fn operation(isolate: &mut Isolate, id: u32) -> Poll<()> { + + fn operation(isolate: &mut Isolate, id: u32) -> anyhow::Result> { let state_rc = Runtime::state(isolate); let context = { @@ -41,15 +43,23 @@ impl AsynchronousKind { false, ); let source = v8::String::new(scope, &format!("globalThis.exec({id});")).unwrap(); - let script = v8::Script::compile(scope, source, Some(&origin)).unwrap(); - script.run(scope).unwrap(); - return Poll::Ready(()); + let tc_scope = &mut v8::TryCatch::new(scope); + let script = v8::Script::compile(tc_scope, source, Some(&origin)) + .ok_or(anyhow!("compile script failure"))?; + script + .run(tc_scope) + .ok_or(anyhow!("run script failure {}", id))?; + + if tc_scope.has_caught() { + panic!("exec error"); + } + return Ok(Poll::Ready(())); } fn import( isolate: &mut Isolate, - specifier: &String, + source: &String, resolver: &v8::Global, - ) -> Poll<()> { + ) -> anyhow::Result> { let state_rc = Runtime::state(isolate); let graph_rc = Runtime::graph(isolate); @@ -61,17 +71,17 @@ impl AsynchronousKind { if { let graph = graph_rc.borrow(); let table = graph.table.borrow(); - table.get(specifier).is_none() + table.get(source).is_none() } { let base = format!(""); - let _ = futures::executor::block_on(Runtime::import(isolate, specifier, &base)); + let _ = futures::executor::block_on(Runtime::import(isolate, source, &base)); }; let graph = graph_rc.borrow(); let table = graph.table.borrow(); let dep = table - .get(specifier) - .expect(&format!("specifier `{}` not found", specifier)); + .get(source) + .ok_or(anyhow!("source `{}` not found", source))?; if dep.initialize(isolate).is_some() { dep.evaluate(isolate); @@ -83,13 +93,19 @@ impl AsynchronousKind { let graph = graph_rc.borrow(); let module = graph.module.borrow(); - if let Some(instance) = module.get(specifier) { + if let Some(instance) = module.get(source) { let expose = v8::Local::new(tc_scope, &instance.expose); let obj = expose.to_object(tc_scope).unwrap(); resolver.resolve(tc_scope, obj.into()); }; }; - return Poll::Ready(()); + let module = graph.module.borrow(); + if module.get(source).is_none() { + let t = table.get(source).unwrap(); + t.initialize(isolate); + } + + return Ok(Poll::Ready(())); } } diff --git a/src/runtime/init.rs b/src/runtime/init.rs index b56b33f..cbd773b 100644 --- a/src/runtime/init.rs +++ b/src/runtime/init.rs @@ -1,4 +1,4 @@ -use crate::runner::console::console_log; +use crate::builtin::console::log; use super::Runtime; @@ -14,10 +14,10 @@ impl Runtime { let console_object = v8::Object::new(scope); global.set(scope, console_key.into(), console_object.into()); - Self::set_func(scope, console_object, "log", console_log); - Self::set_func(scope, console_object, "info", console_log); - Self::set_func(scope, console_object, "error", console_log); - Self::set_func(scope, console_object, "warn", console_log); + Self::set_func(scope, console_object, "log", log); + Self::set_func(scope, console_object, "info", log); + Self::set_func(scope, console_object, "error", log); + Self::set_func(scope, console_object, "warn", log); scope.escape(context) } diff --git a/src/runtime/mod.rs b/src/runtime/mod.rs index 887be50..3fe1fae 100644 --- a/src/runtime/mod.rs +++ b/src/runtime/mod.rs @@ -110,18 +110,18 @@ impl Runtime { state } - fn bootstrap(&mut self, entry: &String) { + fn bootstrap(&mut self, entry: &String) -> anyhow::Result<()> { let isolate = self.isolate.as_mut(); let state_rc = Self::state(isolate); let graph_rc = Self::graph(isolate); // bootstrap.js let mut bootstrap_js = PathBuf::new(); - bootstrap_js.push("bootstrap.js"); + bootstrap_js.push("bootstrap.ts"); let dependency = compile::compile( &bootstrap_js.to_string_lossy().to_string(), &include_str!("../../bootstrap/main.ts").to_string(), - ); + )?; dependency.initialize(isolate); dependency.evaluate(isolate); @@ -153,10 +153,11 @@ impl Runtime { let entry = v8::String::new(tc_scope, &entry).unwrap(); fun.call(tc_scope, this.into(), &[entry.into()]); + Ok(()) } pub async fn run(&mut self, entry: &String) -> anyhow::Result<()> { - self.bootstrap(entry); + self.bootstrap(entry)?; let isolate = self.isolate.as_mut(); let state_rc = Self::state(isolate); @@ -185,11 +186,11 @@ impl Runtime { } } - async fn import(isolate: &mut Isolate, entry: &String, base: &String) -> anyhow::Result<()> { + async fn import(isolate: &mut Isolate, source: &String, base: &String) -> anyhow::Result<()> { let graph_rc = Self::graph(isolate); let graph = graph_rc.borrow(); let mut table = graph.table.borrow_mut(); - table.append(entry, base).await + table.append(source, base).await } } diff --git a/src/runtime/static_fn.rs b/src/runtime/static_fn.rs index 34f0d71..a8a719f 100644 --- a/src/runtime/static_fn.rs +++ b/src/runtime/static_fn.rs @@ -1,12 +1,12 @@ use super::{asynchronous::AsynchronousKind, Runtime}; -use crate::{graph::resolve, runner::console::console_format}; +use crate::{graph::resolve, builtin::console::console_format}; use std::{task::Poll, time::Duration}; use url::Url; impl Runtime { - pub fn resolve<'s>( + pub fn resolve_module_callback<'s>( context: v8::Local<'s, v8::Context>, - source: v8::Local<'s, v8::String>, + specifier: v8::Local<'s, v8::String>, _import_assertions: v8::Local<'s, v8::FixedArray>, referrer: v8::Local<'s, v8::Module>, ) -> Option> { @@ -16,7 +16,7 @@ impl Runtime { let state = graph_rc.borrow(); - let source = source.to_rust_string_lossy(scope); + let source = specifier.to_rust_string_lossy(scope); let url = if source.starts_with("http") { let url = Url::parse(&source).expect(format!("parse url failed: {}", source).as_str()); @@ -28,7 +28,8 @@ impl Runtime { let hash = state.hash.borrow(); let url = hash.get(&module_id).unwrap(); - url.clone() + resolve(&source, url) + // url.clone() }; let module = state.module.borrow(); @@ -44,12 +45,12 @@ impl Runtime { scope: &mut v8::HandleScope<'a>, _host_defined_options: v8::Local<'a, v8::Data>, resource: v8::Local<'a, v8::Value>, - specifier: v8::Local<'a, v8::String>, + source: v8::Local<'a, v8::String>, _import_assertions: v8::Local<'a, v8::FixedArray>, ) -> Option> { let state_rc = Self::state(scope); let resource = resource.to_rust_string_lossy(scope).to_string(); - let specifier = specifier.to_rust_string_lossy(scope).to_string(); + let source = source.to_rust_string_lossy(scope).to_string(); let resolver = v8::PromiseResolver::new(scope).unwrap(); let promise = resolver.get_promise(scope); @@ -59,7 +60,7 @@ impl Runtime { state.pending_ops.push(Box::pin(async move { Poll::Ready(AsynchronousKind::Import(( - resolve(&specifier, &resource), + resolve(&source, &resource), resolver, ))) })); @@ -82,7 +83,7 @@ impl Runtime { pub fn timer_send( scope: &mut v8::HandleScope, info: v8::FunctionCallbackArguments, - mut rv: v8::ReturnValue, + rv: v8::ReturnValue, ) { let state_rc = Runtime::state(scope); let id = info diff --git a/test/test.ts b/test/test.ts index eeb377b..8c1be76 100644 --- a/test/test.ts +++ b/test/test.ts @@ -1,12 +1,10 @@ -import "https://deno.land/std@0.182.0/examples/welcome.ts"; -import "https://deno.land/std@0.182.0/examples/welcome.ts"; +// import "https://deno.land/std@0.182.0/examples/welcome.ts"; +// import "https://deno.land/std@0.182.0/examples/welcome.ts"; +import "./welcome.ts" -const res = await import("./test1.ts"); -console.log("res", res); -try { - const text = await res.json(); - console.log("🚀 text", text); - test.copy(); -} catch (err) { - console.error("err => ", err); -} +// const res = await import("./test1.ts"); +// console.log("res", res); +// const text = await res.json(); +// console.log("🚀 text", text); +// test.copy(); +// import("./welcome.ts") diff --git a/test/test1.ts b/test/test1.ts index f7daaa7..99c0d57 100644 --- a/test/test1.ts +++ b/test/test1.ts @@ -2,20 +2,18 @@ setTimeout( (...arg: number[]) => { console.log("Hello Timeout", ...arg); }, - 1000, + 100, 1, 2, - 3, + 3 ); -console.log("Welcome Timeout!"); + setTimeout((...arg: number[]) => { - console.log("Timeout 2", ...arg, /^bin$/g); -}, 100); + console.log("Timeout 2", /^bin$/g); +}, 10); export default { copy() { console.log("1121"); }, }; - -export function* x() {} diff --git a/test/welcome.ts b/test/welcome.ts new file mode 100644 index 0000000..998c238 --- /dev/null +++ b/test/welcome.ts @@ -0,0 +1 @@ +console.log("Welcome edon!");