diff --git a/.changeset/calm-crabs-lie.md b/.changeset/calm-crabs-lie.md deleted file mode 100644 index 084e5bde5ddb..000000000000 --- a/.changeset/calm-crabs-lie.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -swc_common: major ---- - -perf(es/plugin): Make `analyze_source_file` lazy, again diff --git a/.changeset/eleven-ducks-perform.md b/.changeset/eleven-ducks-perform.md deleted file mode 100644 index 2a1a293805f1..000000000000 --- a/.changeset/eleven-ducks-perform.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -ast_node: major -swc_atoms: major -swc_allocator: major -swc_common: major ---- - -feat(plugin): Bump `rkyv` to `v0.8.8` diff --git a/.changeset/many-cats-clap.md b/.changeset/many-cats-clap.md deleted file mode 100644 index 4b58c5ad352a..000000000000 --- a/.changeset/many-cats-clap.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -swc_plugin_proxy: major -swc_plugin_runner: major ---- - -feat(plugin): Update `wasmer` to `v5` diff --git a/Cargo.lock b/Cargo.lock index 0cbe70eb5d76..f4d6799a2f07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,14 +28,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] -name = "aes" -version = "0.8.4" +name = "ahash" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", + "getrandom", + "once_cell", + "version_check", ] [[package]] @@ -154,9 +154,9 @@ checksum = "70033777eb8b5124a81a1889416543dddef2de240019b674c81285a2635a7e1e" [[package]] name = "anyhow" -version = "1.0.93" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -216,7 +216,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -227,7 +227,7 @@ checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -258,7 +258,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -319,26 +319,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" -dependencies = [ - "bitflags 2.6.0", - "cexpr", - "clang-sys", - "itertools 0.13.0", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.87", -] - [[package]] name = "binding_macros" version = "5.0.0" @@ -410,7 +390,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fdf0ca73de70c3da94e4194e4a01fe732378f55d47cf4c0588caab22a0dbfa14" dependencies = [ - "ahash", + "ahash 0.8.11", "chrono", "either", "indexmap 2.5.0", @@ -448,20 +428,8 @@ version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ - "bytecheck_derive 0.6.12", - "ptr_meta 0.1.4", - "simdutf8", -] - -[[package]] -name = "bytecheck" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c8f430744b23b54ad15161fcbc22d82a29b73eacbe425fea23ec822600bc6f" -dependencies = [ - "bytecheck_derive 0.8.0", - "ptr_meta 0.3.0", - "rancor", + "bytecheck_derive", + "ptr_meta", "simdutf8", ] @@ -476,17 +444,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "bytecheck_derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523363cbe1df49b68215efdf500b103ac3b0fb4836aed6d15689a076eadb8fff" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "byteorder" version = "1.5.0" @@ -495,9 +452,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" dependencies = [ "serde", ] @@ -511,27 +468,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bzip2" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" -dependencies = [ - "bzip2-sys", - "libc", -] - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "camino" version = "1.1.9" @@ -576,20 +512,9 @@ version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57b6a275aa2903740dc87da01c62040406b8812552e97129a63ea8850a17c6e6" dependencies = [ - "jobserver", - "libc", "shlex", ] -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - [[package]] name = "cfg-if" version = "1.0.0" @@ -643,27 +568,6 @@ dependencies = [ "half", ] -[[package]] -name = "cipher" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" -dependencies = [ - "crypto-common", - "inout", -] - -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - [[package]] name = "clap" version = "3.2.25" @@ -726,7 +630,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -744,15 +648,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" -[[package]] -name = "cmake" -version = "0.1.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb1e43aa7fd152b1f968787f7dbcdeb306d1867ff373c69955211876c053f91a" -dependencies = [ - "cc", -] - [[package]] name = "codspeed" version = "2.6.0" @@ -879,15 +774,15 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "corosensei" -version = "0.2.1" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad067b451c08956709f8762dba86e049c124ea52858e3ab8d076ba2892caa437" +checksum = "80128832c58ea9cbd041d2a759ec449224487b2c1e400453d99d244eead87a8e" dependencies = [ "autocfg", "cfg-if", "libc", "scopeguard", - "windows-sys 0.59.0", + "windows-sys 0.33.0", ] [[package]] @@ -901,80 +796,74 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.110.2" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305d51c180ebdc46ef61bc60c54ae6512db3bc9a05842a1f1e762e45977019ab" +checksum = "2a2ab4512dfd3a6f4be184403a195f76e81a8a9f9e6c898e19d2dc3ce20e0115" dependencies = [ "cranelift-entity", ] -[[package]] -name = "cranelift-bitset" -version = "0.110.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "690d8ae6c73748e5ce3d8fe59034dceadb8823e6c8994ba324141c5eae909b0e" - [[package]] name = "cranelift-codegen" -version = "0.110.2" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7ca95e831c18d1356da783765c344207cbdffea91e13e47fa9327dbb2e0719" +checksum = "98b022ed2a5913a38839dfbafe6cf135342661293b08049843362df4301261dc" dependencies = [ + "arrayvec", "bumpalo", "cranelift-bforest", - "cranelift-bitset", "cranelift-codegen-meta", "cranelift-codegen-shared", - "cranelift-control", + "cranelift-egraph", "cranelift-entity", "cranelift-isle", - "gimli 0.28.1", - "hashbrown 0.14.5", + "gimli 0.26.2", "log", "regalloc2", - "rustc-hash", "smallvec", "target-lexicon", ] [[package]] name = "cranelift-codegen-meta" -version = "0.110.3" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0a2d2ab65e6cbf91f81781d8da65ec2005510f18300eff21a99526ed6785863" +checksum = "639307b45434ad112a98f8300c0f0ab085cbefcd767efcdef9ef19d4c0756e74" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.110.3" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efcff860573cf3db9ae98fbd949240d78b319df686cc306872e7fab60e9c84d7" +checksum = "278e52e29c53fcf32431ef08406c295699a70306d05a0715c5b1bf50e33a9ab7" [[package]] -name = "cranelift-control" -version = "0.110.3" +name = "cranelift-egraph" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d70e5b75c2d5541ef80a99966ccd97aaa54d2a6af19ea31759a28538e1685a" +checksum = "624b54323b06e675293939311943ba82d323bb340468ce1889be5da7932c8d73" dependencies = [ - "arbitrary", + "cranelift-entity", + "fxhash", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "log", + "smallvec", ] [[package]] name = "cranelift-entity" -version = "0.110.2" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a48cb0a194c9ba82fec35a1e492055388d89b2e3c03dee9dcf2488892be8004d" -dependencies = [ - "cranelift-bitset", -] +checksum = "9a59bcbca89c3f1b70b93ab3cbba5e5e0cbf3e63dadb23c7525cb142e21a9d4c" [[package]] name = "cranelift-frontend" -version = "0.110.2" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8327afc6c1c05f4be62fefce5b439fa83521c65363a322e86ea32c85e7ceaf64" +checksum = "0d70abacb8cfef3dc8ff7e8836e9c1d70f7967dfdac824a4cd5e30223415aca6" dependencies = [ "cranelift-codegen", "log", @@ -984,9 +873,9 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.110.2" +version = "0.91.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b08621c00321efcfa3eee6a3179adc009e21ea8d24ca7adc3c326184bc3f48" +checksum = "393bc73c451830ff8dbb3a07f61843d6cb41a084f9996319917c0b291ed785bb" [[package]] name = "crc" @@ -994,16 +883,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" dependencies = [ - "crc-catalog 1.1.1", -] - -[[package]] -name = "crc" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" -dependencies = [ - "crc-catalog 2.4.0", + "crc-catalog", ] [[package]] @@ -1012,12 +892,6 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" -[[package]] -name = "crc-catalog" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" - [[package]] name = "crc32fast" version = "1.4.2" @@ -1135,7 +1009,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" dependencies = [ "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1183,7 +1057,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1205,7 +1079,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1279,12 +1153,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "deflate64" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da692b8d1080ea3045efaab14434d40468c3d8657e42abddfffca87b428f4c1b" - [[package]] name = "deranged" version = "0.3.11" @@ -1313,7 +1181,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1355,7 +1223,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1375,7 +1243,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "206868b8242f27cecce124c19fd88157fbd0dd334df2587f36417bafbc85097b" dependencies = [ "derive_builder_core 0.20.0", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1416,18 +1284,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", ] [[package]] @@ -1516,7 +1372,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1537,9 +1393,9 @@ dependencies = [ [[package]] name = "fallible-iterator" -version = "0.3.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" @@ -1567,9 +1423,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.34" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", "miniz_oxide", @@ -1611,7 +1467,7 @@ version = "2.0.0" dependencies = [ "proc-macro2", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1682,7 +1538,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -1715,6 +1571,15 @@ dependencies = [ "slab", ] +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + [[package]] name = "generate-code" version = "0.1.0" @@ -1724,7 +1589,7 @@ dependencies = [ "clap 4.5.9", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", "walkdir", ] @@ -1765,12 +1630,12 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", - "indexmap 2.5.0", + "indexmap 1.9.3", "stable_deref_trait", ] @@ -1853,6 +1718,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] [[package]] name = "hashbrown" @@ -1860,7 +1728,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.11", ] [[package]] @@ -1869,7 +1737,7 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ - "ahash", + "ahash 0.8.11", "allocator-api2", ] @@ -1928,15 +1796,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "hstr" version = "0.2.12" @@ -2013,7 +1872,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio", "tower-service", "tracing", @@ -2123,29 +1982,6 @@ dependencies = [ "serde", ] -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "insta" -version = "1.41.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e9ffc4d4892617c50a928c52b2961cb5174b6fc6ebf252b2fac9d21955c48b8" -dependencies = [ - "console", - "lazy_static", - "linked-hash-map", - "regex", - "serde", - "similar", -] - [[package]] name = "io-lifetimes" version = "1.0.11" @@ -2172,7 +2008,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -2195,15 +2031,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.13.0" @@ -2219,15 +2046,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.72" @@ -2363,9 +2181,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.162" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d287de67fe55fd7e1581fe933d965a5a9477b38e949cfa9f8574ef01506398" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" @@ -2398,16 +2216,6 @@ dependencies = [ "redox_syscall", ] -[[package]] -name = "libyml" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3302702afa434ffa30847a83305f0a69d6abd74293b6554c18ec85c7ef30c980" -dependencies = [ - "anyhow", - "version_check", -] - [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2451,12 +2259,6 @@ dependencies = [ "scopeguard", ] -[[package]] -name = "lockfree-object-pool" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" - [[package]] name = "log" version = "0.4.22" @@ -2481,27 +2283,6 @@ dependencies = [ "twox-hash", ] -[[package]] -name = "lzma-rs" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e" -dependencies = [ - "byteorder", - "crc 3.2.1", -] - -[[package]] -name = "lzma-sys" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - [[package]] name = "mach2" version = "0.4.2" @@ -2532,6 +2313,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "memmap2" version = "0.6.2" @@ -2572,7 +2362,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -2605,6 +2395,18 @@ dependencies = [ "adler2", ] +[[package]] +name = "mio" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys 0.48.0", +] + [[package]] name = "mio" version = "1.0.2" @@ -2613,7 +2415,6 @@ checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi 0.3.9", "libc", - "log", "wasi", "windows-sys 0.52.0", ] @@ -2624,26 +2425,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7843ec2de400bcbc6a6328c958dc38e5359da6e93e72e37bc5246bf1ae776389" -[[package]] -name = "munge" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64142d38c84badf60abf06ff9bd80ad2174306a5b11bd4706535090a30a419df" -dependencies = [ - "munge_macro", -] - -[[package]] -name = "munge_macro" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bb5c1d8184f13f7d0ccbeeca0def2f9a181bce2624302793005f5ca8aa62e5e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "napi" version = "2.16.13" @@ -2670,7 +2451,7 @@ dependencies = [ "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -2685,7 +2466,7 @@ dependencies = [ "quote", "regex", "semver 1.0.23", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -2910,7 +2691,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -3014,16 +2795,6 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest", - "hmac", -] - [[package]] name = "percent-encoding" version = "2.3.1" @@ -3070,7 +2841,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -3099,7 +2870,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -3194,7 +2965,7 @@ dependencies = [ name = "preset_env_base" version = "1.0.0" dependencies = [ - "ahash", + "ahash 0.8.11", "anyhow", "browserslist-rs", "dashmap 5.5.3", @@ -3216,16 +2987,6 @@ dependencies = [ "yansi", ] -[[package]] -name = "prettyplease" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" -dependencies = [ - "proc-macro2", - "syn 2.0.87", -] - [[package]] name = "proc-macro-crate" version = "1.3.1" @@ -3260,28 +3021,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "proc-macro-error-attr2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" -dependencies = [ - "proc-macro2", - "quote", -] - -[[package]] -name = "proc-macro-error2" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" -dependencies = [ - "proc-macro-error-attr2", - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "proc-macro2" version = "1.0.86" @@ -3306,16 +3045,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0738ccf7ea06b608c10564b31debd4f5bc5e197fc8bfe088f68ae5ce81e7a4f1" dependencies = [ - "ptr_meta_derive 0.1.4", -] - -[[package]] -name = "ptr_meta" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9e76f66d3f9606f44e45598d155cb13ecf09f4a28199e48daf8c8fc937ea90" -dependencies = [ - "ptr_meta_derive 0.3.0", + "ptr_meta_derive", ] [[package]] @@ -3329,17 +3059,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ptr_meta_derive" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca414edb151b4c8d125c12566ab0d74dc9cdba36fb80eb7b848c15f495fd32d1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - [[package]] name = "pulldown-cmark" version = "0.8.0" @@ -3372,15 +3091,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce082a9940a7ace2ad4a8b7d0b1eac6aa378895f18be598230c5f2284ac05426" -[[package]] -name = "rancor" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5f7161924b9d1cea0e4cabc97c372cea92b5f927fc13c6bca67157a0ad947" -dependencies = [ - "ptr_meta 0.3.0", -] - [[package]] name = "rand" version = "0.8.5" @@ -3442,13 +3152,12 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.9.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c" dependencies = [ - "hashbrown 0.13.2", + "fxhash", "log", - "rustc-hash", "slice-group-by", "smallvec", ] @@ -3517,11 +3226,11 @@ checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc" [[package]] name = "rend" -version = "0.5.2" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35e8a6bf28cd121053a66aa2e6a2e3eaffad4a60012179f0e864aa5ffeff215" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ - "bytecheck 0.8.0", + "bytecheck", ] [[package]] @@ -3570,49 +3279,34 @@ dependencies = [ "winreg", ] -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - [[package]] name = "rkyv" -version = "0.8.8" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "395027076c569819ea6035ee62e664f5e03d74e281744f55261dd1afd939212b" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ - "bytecheck 0.8.0", + "bitvec", + "bytecheck", "bytes", - "hashbrown 0.14.5", - "indexmap 2.5.0", - "munge", - "ptr_meta 0.3.0", - "rancor", + "hashbrown 0.12.3", + "indexmap 1.9.3", + "ptr_meta", "rend", "rkyv_derive", + "seahash", "tinyvec", "uuid", ] [[package]] name = "rkyv_derive" -version = "0.8.8" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cb82b74b4810f07e460852c32f522e979787691b0b7b7439fe473e49d49b2f" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 1.0.109", ] [[package]] @@ -3672,21 +3366,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.23.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - [[package]] name = "rustls-pemfile" version = "1.0.4" @@ -3696,23 +3375,6 @@ dependencies = [ "base64 0.21.7", ] -[[package]] -name = "rustls-pki-types" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" - -[[package]] -name = "rustls-webpki" -version = "0.102.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - [[package]] name = "rustversion" version = "1.0.17" @@ -3784,7 +3446,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -3799,6 +3461,12 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "seahash" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" + [[package]] name = "security-framework" version = "2.9.2" @@ -3854,9 +3522,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.214" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] @@ -3874,13 +3542,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -3891,14 +3559,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" dependencies = [ "itoa", "memchr", @@ -3928,18 +3596,16 @@ dependencies = [ ] [[package]] -name = "serde_yml" -version = "0.0.12" +name = "serde_yaml" +version = "0.9.34+deprecated" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59e2dd588bf1597a252c3b920e0143eb99b0f76e4e082f4c92ce34fbc9e71ddd" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" dependencies = [ "indexmap 2.5.0", "itoa", - "libyml", - "memchr", "ryu", "serde", - "version_check", + "unsafe-libyaml", ] [[package]] @@ -3980,7 +3646,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6c99835bad52957e7aa241d3975ed17c1e5f8c92026377d117a606f36b84b16" dependencies = [ "bytes", - "memmap2", + "memmap2 0.6.2", ] [[package]] @@ -4004,24 +3670,12 @@ dependencies = [ "outref", ] -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - [[package]] name = "simdutf8" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" -[[package]] -name = "similar" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" - [[package]] name = "siphasher" version = "0.3.11" @@ -4077,6 +3731,16 @@ dependencies = [ "managed", ] +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "socket2" version = "0.5.7" @@ -4141,7 +3805,7 @@ dependencies = [ "cfg-if", "libc", "psm", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4152,7 +3816,7 @@ checksum = "9cf483ea7e0e3a03d1b91687895814425149ad77facd3e2b6839dde26da98454" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -4169,7 +3833,7 @@ dependencies = [ "quote", "serde", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -4184,12 +3848,6 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - [[package]] name = "swc" version = "5.0.2" @@ -4271,8 +3929,7 @@ dependencies = [ "codspeed-criterion-compat", "criterion", "hashbrown 0.14.5", - "ptr_meta 0.3.0", - "rancor", + "ptr_meta", "rkyv", "rustc-hash", "serde", @@ -4285,10 +3942,9 @@ name = "swc_atoms" version = "2.0.0" dependencies = [ "arbitrary", - "bytecheck 0.8.0", + "bytecheck", "hstr", "once_cell", - "rancor", "rkyv", "rustc-hash", "serde", @@ -4299,7 +3955,7 @@ name = "swc_bundler" version = "5.0.0" dependencies = [ "anyhow", - "crc 2.1.0", + "crc", "dashmap 5.5.3", "hex", "indexmap 2.5.0", @@ -4341,7 +3997,7 @@ dependencies = [ name = "swc_cached" version = "1.0.0" dependencies = [ - "ahash", + "ahash 0.8.11", "anyhow", "dashmap 5.5.3", "once_cell", @@ -4376,12 +4032,12 @@ dependencies = [ name = "swc_common" version = "4.0.0" dependencies = [ - "ahash", + "ahash 0.8.11", "anyhow", "arbitrary", "ast_node", "better_scoped_tls", - "bytecheck 0.8.0", + "bytecheck", "cfg-if", "codspeed-criterion-compat", "criterion", @@ -4391,7 +4047,6 @@ dependencies = [ "num-bigint", "once_cell", "parking_lot", - "rancor", "rayon", "rkyv", "rustc-hash", @@ -4455,7 +4110,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -4532,9 +4187,7 @@ dependencies = [ name = "swc_css_ast" version = "4.0.1" dependencies = [ - "bytecheck 0.8.0", "is-macro", - "rancor", "rkyv", "serde", "string_enum", @@ -4567,7 +4220,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -4708,11 +4361,10 @@ version = "4.0.1" dependencies = [ "arbitrary", "bitflags 2.6.0", - "bytecheck 0.8.0", + "bytecheck", "is-macro", "num-bigint", "phf", - "rancor", "rkyv", "scoped-tls", "serde", @@ -4757,7 +4409,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5128,7 +4780,7 @@ dependencies = [ "swc_ecma_ast", "swc_ecma_parser", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5253,7 +4905,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5487,7 +5139,7 @@ version = "1.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5516,7 +5168,7 @@ dependencies = [ name = "swc_estree_compat" version = "5.0.0" dependencies = [ - "ahash", + "ahash 0.8.11", "anyhow", "codspeed-criterion-compat", "copyless", @@ -5595,7 +5247,6 @@ dependencies = [ name = "swc_html_ast" version = "4.0.1" dependencies = [ - "bytecheck 0.8.0", "is-macro", "rkyv", "serde", @@ -5628,7 +5279,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5707,7 +5358,7 @@ version = "1.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5781,7 +5432,7 @@ version = "1.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5789,8 +5440,6 @@ name = "swc_plugin_proxy" version = "4.0.0" dependencies = [ "better_scoped_tls", - "bytecheck 0.8.0", - "rancor", "rkyv", "swc_common", "swc_ecma_ast", @@ -5850,7 +5499,7 @@ version = "2.0.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5933,7 +5582,7 @@ dependencies = [ "proc-macro2", "quote", "swc_macros_common", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -5973,9 +5622,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.87" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25aa4ce346d03a6dcd68dd8b4010bcb74e54e62c90c573f394c46eae99aba32d" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -6017,9 +5666,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tar" -version = "0.4.43" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c65998313f8e17d0d553d28f91a0df93e4dbbbf770279c7bc21ca0f09ea1a1f6" +checksum = "cb797dad5fb5b76fcf519e702f4a589483b5ef06567f160c392832c1f5e44909" dependencies = [ "filetime", "libc", @@ -6119,7 +5768,7 @@ dependencies = [ "quote", "regex", "relative-path", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -6136,22 +5785,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.69" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.69" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -6260,9 +5909,9 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio", + "mio 1.0.2", "pin-project-lite", - "socket2", + "socket2 0.5.7", "tokio-macros", "windows-sys 0.52.0", ] @@ -6275,7 +5924,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -6385,7 +6034,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] @@ -6553,26 +6202,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "ureq" -version = "2.10.1" +name = "unsafe-libyaml" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b74fc6b57825be3373f7054754755f03ac3a8f5d70015ccad699ba2029956f4a" -dependencies = [ - "base64 0.22.1", - "flate2", - "log", - "once_cell", - "rustls", - "rustls-pki-types", - "url", - "webpki-roots", -] +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" [[package]] name = "url" @@ -6652,9 +6285,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "virtual-fs" -version = "0.19.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d2456ec960b74e5b0423159c70dd9796da1445de462013fe03eefd2545b631" +checksum = "e60ef133d8336b201a1618252518d81f9e9d30fbe27449dab706699a549216bc" dependencies = [ "anyhow", "async-trait", @@ -6676,38 +6309,37 @@ dependencies = [ "thiserror", "tokio", "tracing", - "wasmer-package", "webc", ] [[package]] name = "virtual-mio" -version = "0.5.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f0b403de1e0c2195895ee51b04defec3afbe6a4d3c169efd24f97b37d144fe" +checksum = "ff8026c9d7575dc9afd8a0907357acb7aa55ec262097fbccae5da42f67773b3c" dependencies = [ "async-trait", "bytes", "derivative", "futures", - "mio", + "mio 0.8.11", "serde", - "socket2", + "socket2 0.4.10", "thiserror", "tracing", ] [[package]] name = "virtual-net" -version = "0.11.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262fd9c0f59cc34501804c9f29dc20e1f0f0c354f86eb35b7305b20c25526ce6" +checksum = "05d9551aa47efdb28093f79845d40858baf5075e4b4a09c7d9c8a0edd42f942b" dependencies = [ "anyhow", "async-trait", - "base64 0.22.1", + "base64 0.21.7", "bincode", - "bytecheck 0.6.12", + "bytecheck", "bytes", "derivative", "futures-util", @@ -6849,7 +6481,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", "wasm-bindgen-shared", ] @@ -6883,7 +6515,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6896,23 +6528,21 @@ checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-encoder" -version = "0.216.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04c23aebea22c8a75833ae08ed31ccc020835b12a41999e58c31464271b94a88" +checksum = "1ba64e81215916eaeb48fee292f29401d69235d62d8b8fd92a7b2844ec5ae5f7" dependencies = [ "leb128", ] [[package]] name = "wasmer" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c8343224a7b75315dce065e68d01413a49a39279905a298ec984c098c3e828c" +checksum = "4b28d4251f96ece14460328c56ee0525edcf4bbb08748cfd87fef3580ae4d403" dependencies = [ - "bindgen", "bytes", "cfg-if", - "cmake", "derivative", "indexmap 1.9.3", "js-sys", @@ -6921,11 +6551,9 @@ dependencies = [ "serde", "serde-wasm-bindgen", "shared-buffer", - "tar", "target-lexicon", "thiserror", "tracing", - "ureq", "wasm-bindgen", "wasmer-compiler", "wasmer-compiler-cranelift", @@ -6935,15 +6563,13 @@ dependencies = [ "wasmparser", "wat", "windows-sys 0.59.0", - "xz", - "zip", ] [[package]] name = "wasmer-cache" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63e07d30dda84df3d40cf29987f96b044f89f9d54b6e40ff464414dcbc33b1f" +checksum = "c3b1f3ef1d5a81b101513a125b3aede723a6f0991cb1c85d1fcc252aa4ced011" dependencies = [ "blake3", "hex", @@ -6953,9 +6579,9 @@ dependencies = [ [[package]] name = "wasmer-compiler" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe8a13cd4d33ed840c07f0da5097e33239f57a922bede0e8adfd3791905f0200" +checksum = "009b8417d51dbca8ac9a640ea999cc924fc59040a81245ecd0e092cb7c45dc10" dependencies = [ "backtrace", "bytes", @@ -6965,7 +6591,7 @@ dependencies = [ "lazy_static", "leb128", "libc", - "memmap2", + "memmap2 0.5.10", "more-asserts", "region", "rkyv", @@ -6982,15 +6608,14 @@ dependencies = [ [[package]] name = "wasmer-compiler-cranelift" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c9017a0bc5fa75a3f78e1702cf379fac91d945d54a68498fa5e92c323b1881b" +checksum = "2445c6fb03824979448293e91d8a6daf0cdf66e8d996f31ef270e0d2cc3ea1f3" dependencies = [ "cranelift-codegen", "cranelift-entity", "cranelift-frontend", - "gimli 0.28.1", - "itertools 0.12.1", + "gimli 0.26.2", "more-asserts", "rayon", "smallvec", @@ -7002,9 +6627,9 @@ dependencies = [ [[package]] name = "wasmer-config" -version = "0.10.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d97272c1042e20957be5f7e4a42f28ae5367c32a79ae953339335a55512e3" +checksum = "644b7e3547bd7e796d92220f60bf57734914254c6cee56607e80177a3e8a28da" dependencies = [ "anyhow", "bytesize", @@ -7016,7 +6641,7 @@ dependencies = [ "semver 1.0.23", "serde", "serde_json", - "serde_yml", + "serde_yaml", "thiserror", "toml", "url", @@ -7024,11 +6649,11 @@ dependencies = [ [[package]] name = "wasmer-derive" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9338002b7f3e913236c03d31234d5a2c8cb7f994891c4f56eebaf3628b19b1ae" +checksum = "02592d86ac19fb09c972e72edeb3e57ac5c569eac7e77b919b165da014e8c139" dependencies = [ - "proc-macro-error2", + "proc-macro-error", "proc-macro2", "quote", "syn 1.0.109", @@ -7036,15 +6661,15 @@ dependencies = [ [[package]] name = "wasmer-journal" -version = "0.13.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3700ea2174a90df200c8f066407b2653a65bcd7a1f4ced8e57675d93f1c80dfb" +checksum = "3045807a8a70da47eb06cb55aad673d5774f87f26ee11b7758d63c54b67bc5f4" dependencies = [ "anyhow", "async-trait", - "base64 0.22.1", + "base64 0.21.7", "bincode", - "bytecheck 0.6.12", + "bytecheck", "bytes", "derivative", "lz4_flex", @@ -7060,44 +6685,18 @@ dependencies = [ "wasmer-wasix-types", ] -[[package]] -name = "wasmer-package" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98d05a5cd47f324ed784481d79351e12a02ad3289148dfa72432aa5d394634b8" -dependencies = [ - "anyhow", - "bytes", - "cfg-if", - "ciborium", - "flate2", - "insta", - "semver 1.0.23", - "serde", - "serde_json", - "sha2", - "shared-buffer", - "tar", - "tempfile", - "thiserror", - "toml", - "url", - "wasmer-config", - "webc", -] - [[package]] name = "wasmer-types" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3988f25124ca94b82a937e665ffae3c47bb4883d55762fcada8bbf0adc602748" +checksum = "3d22a00f1a90e9e66d5427853f41e76d8ab89e03eb3034debd11933607fef56a" dependencies = [ - "bytecheck 0.6.12", + "bytecheck", "enum-iterator", "enumset", "getrandom", "hex", - "indexmap 2.5.0", + "indexmap 1.9.3", "more-asserts", "rkyv", "serde", @@ -7109,9 +6708,9 @@ dependencies = [ [[package]] name = "wasmer-vm" -version = "5.0.1" +version = "4.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818d6e2a6431158d56a1be30323b7707dc4fd4c99e18648b8662b0684d8aac7c" +checksum = "87d88e8355157cd730fb81e33c3b4d6849fd44c26d32bf78820638e1d935967b" dependencies = [ "backtrace", "cc", @@ -7122,7 +6721,7 @@ dependencies = [ "derivative", "enum-iterator", "fnv", - "indexmap 2.5.0", + "indexmap 1.9.3", "lazy_static", "libc", "mach2", @@ -7137,17 +6736,17 @@ dependencies = [ [[package]] name = "wasmer-wasix" -version = "0.31.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db676d4da6ded91ebfe5ad5aa2948cd51104de9f91001eb67c01d4ce5a2aecb4" +checksum = "dbfe427dbe359e037e1e33ff13b3a5473706e5679df2dbb0e71b5b46c9bb6ce3" dependencies = [ - "ahash", + "ahash 0.8.11", "anyhow", "async-trait", - "base64 0.22.1", + "base64 0.21.7", "bincode", "blake3", - "bytecheck 0.6.12", + "bytecheck", "bytes", "cfg-if", "chrono", @@ -7176,7 +6775,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "serde_yml", + "serde_yaml", "sha2", "shared-buffer", "tempfile", @@ -7198,7 +6797,6 @@ dependencies = [ "wasmer", "wasmer-config", "wasmer-journal", - "wasmer-package", "wasmer-types", "wasmer-wasix-types", "web-sys", @@ -7210,9 +6808,9 @@ dependencies = [ [[package]] name = "wasmer-wasix-types" -version = "0.31.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "550fc6aafb24871aeedfbe8e115703942f439aad2f4bea2e8b3d5f4bc79c0e6e" +checksum = "9b9304c02de27468ea4154a31f8758343717d03a29d2a620bc652e8217baab75" dependencies = [ "anyhow", "bitflags 1.3.2", @@ -7234,24 +6832,21 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.216.0" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcdee6bea3619d311fb4b299721e89a986c3470f804b6d534340e412589028e3" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ - "ahash", "bitflags 2.6.0", - "hashbrown 0.14.5", "indexmap 2.5.0", "semver 1.0.23", ] [[package]] name = "wast" -version = "216.0.0" +version = "64.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7eb1f2eecd913fdde0dc6c3439d0f24530a98ac6db6cb3d14d92a5328554a08" +checksum = "a259b226fd6910225aa7baeba82f9d9933b6d00f2ce1b49b80fa4214328237cc" dependencies = [ - "bumpalo", "leb128", "memchr", "unicode-width", @@ -7260,9 +6855,9 @@ dependencies = [ [[package]] name = "wat" -version = "1.216.0" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac0409090fb5154f95fb5ba3235675fd9e579e731524d63b6a2f653e1280c82a" +checksum = "53253d920ab413fca1c7dc2161d601c79b4fdf631d0ba51dd4343bf9b556c3f6" dependencies = [ "wast", ] @@ -7279,9 +6874,9 @@ dependencies = [ [[package]] name = "webc" -version = "7.0.0-rc.2" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6893cbe58d5b97a0daa2dd77055d621db1c8b94fe0f2bbd719c8de747226ea6" +checksum = "d6cf1915e27168c1ed82f7f0d03f60317648f257fecaf4256a1904428d8e4ccd" dependencies = [ "anyhow", "base64 0.22.1", @@ -7289,6 +6884,7 @@ dependencies = [ "cfg-if", "ciborium", "document-features", + "flate2", "ignore", "indexmap 1.9.3", "leb128", @@ -7297,21 +6893,17 @@ dependencies = [ "once_cell", "path-clean 1.0.1", "rand", + "semver 1.0.23", "serde", "serde_json", "sha2", "shared-buffer", + "tar", + "tempfile", "thiserror", + "toml", "url", -] - -[[package]] -name = "webpki-roots" -version = "0.26.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" -dependencies = [ - "rustls-pki-types", + "wasmer-config", ] [[package]] @@ -7360,6 +6952,19 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-sys" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43dbb096663629518eb1dfa72d80243ca5a6aca764cae62a2df70af760a9be75" +dependencies = [ + "windows_aarch64_msvc 0.33.0", + "windows_i686_gnu 0.33.0", + "windows_i686_msvc 0.33.0", + "windows_x86_64_gnu 0.33.0", + "windows_x86_64_msvc 0.33.0", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -7430,6 +7035,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd761fd3eb9ab8cc1ed81e56e567f02dd82c4c837e48ac3b2181b9ffc5060807" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -7442,6 +7053,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_i686_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab0cf703a96bab2dc0c02c0fa748491294bf9b7feb27e1f4f96340f208ada0e" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -7460,6 +7077,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cfdbe89cc9ad7ce618ba34abc34bbb6c36d99e96cae2245b7943cd75ee773d0" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -7472,6 +7095,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_x86_64_gnu" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4dd9b0c0e9ece7bb22e84d70d01b71c6d6248b81a3c60d11869451b4cb24784" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -7496,6 +7125,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff1e4aa646495048ec7f3ffddc411e1d829c026a2ec62b39da15c1055e406eaa" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -7578,24 +7213,6 @@ version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" -[[package]] -name = "xz" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c887690ff2a2e233e8e49633461521f98ec57fbff9d59a884c9a4f04ec1da34" -dependencies = [ - "xz2", -] - -[[package]] -name = "xz2" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" -dependencies = [ - "lzma-sys", -] - [[package]] name = "yansi" version = "0.5.1" @@ -7620,96 +7237,11 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.87", + "syn 2.0.77", ] [[package]] name = "zeroize" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.87", -] - -[[package]] -name = "zip" -version = "2.2.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" -dependencies = [ - "aes", - "arbitrary", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "deflate64", - "displaydoc", - "flate2", - "hmac", - "indexmap 2.5.0", - "lzma-rs", - "memchr", - "pbkdf2", - "rand", - "sha1", - "thiserror", - "time", - "zeroize", - "zopfli", - "zstd", -] - -[[package]] -name = "zopfli" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946" -dependencies = [ - "bumpalo", - "crc32fast", - "lockfree-object-pool", - "log", - "once_cell", - "simd-adler32", -] - -[[package]] -name = "zstd" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", -] +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index ad9d00b88977..55e61801ead9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,9 +38,8 @@ resolver = "2" [workspace.dependencies] # bytecheck version should be in sync with rkyv version. Do not bump individually. - bytecheck = "0.8.0" - rancor = "0.1.0" - rkyv = "0.8.8" + bytecheck = "0.6.10" + rkyv = "=0.7.45" Inflector = "0.11.4" @@ -104,7 +103,7 @@ resolver = "2" phf = "0.11.2" pretty_assertions = "1.3" proc-macro2 = "1.0.24" - ptr_meta = "0.3.0" + ptr_meta = "0.1.4" quote = "1.0.7" radix_fmt = "1.0.0" rayon = "1.7.0" @@ -143,12 +142,12 @@ resolver = "2" unicode-width = "0.1.4" url = "2.4.0" vergen = { version = "9.0.0", default-features = false } - virtual-fs = { version = "0.19.0", default-features = false } + virtual-fs = { version = "0.16.0", default-features = false } walkdir = "2.4.0" wasm-bindgen = "0.2.91" wasm-bindgen-futures = "0.4.41" - wasmer = { version = "5.0.1", default-features = false } - wasmer-wasix = { version = "0.31.0", default-features = false } + wasmer = { version = "4.3.7", default-features = false } + wasmer-wasix = { version = "0.27.0", default-features = false } [profile.release] lto = true diff --git a/crates/ast_node/src/lib.rs b/crates/ast_node/src/lib.rs index bc58300dc4ea..5f6662a098e3 100644 --- a/crates/ast_node/src/lib.rs +++ b/crates/ast_node/src/lib.rs @@ -137,7 +137,9 @@ struct AddAttr; impl VisitMut for AddAttr { fn visit_field_mut(&mut self, f: &mut Field) { f.attrs - .push(parse_quote!(#[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))])); + .push(parse_quote!(#[cfg_attr(feature = "__rkyv", omit_bounds)])); + f.attrs + .push(parse_quote!(#[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))])); } } @@ -202,23 +204,14 @@ pub fn ast_node( feature = "rkyv-impl", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source)) - )] - #[cfg_attr(feature = "rkyv-impl", repr(u32))] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) - )] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(bytecheck(bounds( - __C: rkyv::validation::ArchiveContext, - __C::Error: rkyv::rancor::Source - ))) - )] + #[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] + #[cfg_attr(feature = "rkyv-impl", archive_attr(check_bytes( + bound = "__C: rkyv::validation::ArchiveContext, <__C as rkyv::Fallible>::Error: std::error::Error" + )))] + #[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] + #[cfg_attr(feature = "rkyv-impl", archive( + bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer") + ))] #[cfg_attr( feature = "serde-impl", serde(untagged) @@ -274,23 +267,14 @@ pub fn ast_node( feature = "rkyv-impl", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source)) - )] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(bytecheck(bounds( - __C: rkyv::validation::ArchiveContext, - __C::Error: rkyv::rancor::Source - ))) - )] - #[cfg_attr(feature = "rkyv-impl", repr(C))] - #[cfg_attr( - feature = "rkyv-impl", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) - )] + #[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] + #[cfg_attr(feature = "rkyv-impl", archive_attr(check_bytes( + bound = "__C: rkyv::validation::ArchiveContext, <__C as rkyv::Fallible>::Error: std::error::Error" + )))] + #[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] + #[cfg_attr(feature = "rkyv-impl", archive( + bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer") + ))] #serde_tag #[cfg_attr( feature = "serde-impl", diff --git a/crates/swc_allocator/Cargo.toml b/crates/swc_allocator/Cargo.toml index 9b1a97ec3719..109cd21f5a96 100644 --- a/crates/swc_allocator/Cargo.toml +++ b/crates/swc_allocator/Cargo.toml @@ -14,9 +14,9 @@ version = "1.0.0" [features] -default = ["scoped", "rkyv"] +default = ["scoped"] nightly = ["bumpalo/allocator_api", "hashbrown/nightly"] -rkyv = ["dep:rkyv", "dep:rancor"] +rkyv = ["dep:rkyv"] scoped = ["nightly"] serde = ["dep:serde"] @@ -28,7 +28,6 @@ bumpalo = { workspace = true, features = [ ] } hashbrown = { workspace = true } ptr_meta = { workspace = true } -rancor = { workspace = true, optional = true } rkyv = { workspace = true, optional = true } rustc-hash = { workspace = true } serde = { workspace = true, optional = true } diff --git a/crates/swc_allocator/src/boxed/rkyv.rs b/crates/swc_allocator/src/boxed/rkyv.rs index cc999802e8f4..2c55abf28d37 100644 --- a/crates/swc_allocator/src/boxed/rkyv.rs +++ b/crates/swc_allocator/src/boxed/rkyv.rs @@ -1,55 +1,46 @@ use std::{alloc, cmp}; -use rancor::{Fallible, ResultExt, Source}; use rkyv::{ boxed::{ArchivedBox, BoxResolver}, - traits::{ArchivePointee, LayoutRaw}, - Archive, ArchiveUnsized, Deserialize, DeserializeUnsized, Place, Serialize, SerializeUnsized, + Archive, ArchivePointee, ArchiveUnsized, Deserialize, DeserializeUnsized, Fallible, Serialize, + SerializeUnsized, }; use super::Box; impl Archive for Box { type Archived = ArchivedBox; - type Resolver = BoxResolver; + type Resolver = BoxResolver; #[inline] - fn resolve(&self, resolver: Self::Resolver, out: Place) { - ArchivedBox::resolve_from_ref(self.as_ref(), resolver, out); + unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) { + ArchivedBox::resolve_from_ref(self.as_ref(), pos, resolver, out); } } impl + ?Sized, S: Fallible + ?Sized> Serialize for Box { - fn serialize( - &self, - serializer: &mut S, - ) -> Result::Error> { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result { ArchivedBox::serialize_from_ref(self.as_ref(), serializer) } } impl Deserialize, D> for ArchivedBox where - T: ArchiveUnsized + LayoutRaw + ?Sized, + T: ArchiveUnsized + ?Sized, T::Archived: DeserializeUnsized, D: Fallible + ?Sized, - D::Error: Source, { + #[inline] fn deserialize(&self, deserializer: &mut D) -> Result, D::Error> { - let metadata = self.get().deserialize_metadata(); - let layout = T::layout_raw(metadata).into_error()?; - let data_address = if layout.size() > 0 { - unsafe { alloc::alloc(layout) } - } else { - polyfill::dangling(&layout).as_ptr() - }; - - let out = ptr_meta::from_raw_parts_mut(data_address.cast(), metadata); - unsafe { - self.get().deserialize_unsized(deserializer, out)?; + let data_address = self + .get() + .deserialize_unsized(deserializer, |layout| alloc::alloc(layout))?; + let metadata = self.get().deserialize_metadata(deserializer)?; + let ptr = ptr_meta::from_raw_parts_mut(data_address, metadata); + Ok(Box::from_raw(ptr)) } - unsafe { Ok(Box::from_raw(out)) } } } @@ -66,19 +57,3 @@ impl + ?Sized, U: ?Sized> PartialOrd> f self.get().partial_cmp(other.as_ref()) } } - -mod polyfill { - - use core::{alloc::Layout, ptr::NonNull}; - - pub fn dangling(layout: &Layout) -> NonNull { - #[cfg(miri)] - { - layout.dangling() - } - #[cfg(not(miri))] - unsafe { - NonNull::new_unchecked(layout.align() as *mut u8) - } - } -} diff --git a/crates/swc_allocator/src/vec/rkyv.rs b/crates/swc_allocator/src/vec/rkyv.rs index 20f2761abfcd..edad89668fda 100644 --- a/crates/swc_allocator/src/vec/rkyv.rs +++ b/crates/swc_allocator/src/vec/rkyv.rs @@ -1,72 +1,42 @@ -use std::alloc; - -use rancor::{Fallible, ResultExt, Source}; -use rkyv::{ - ser::{Allocator, Writer}, - traits::LayoutRaw, - vec::ArchivedVec, - Archive, Deserialize, DeserializeUnsized, -}; +use rkyv::{vec::ArchivedVec, DeserializeUnsized}; use super::Vec; use crate::boxed::Box; -impl Archive for Vec +impl rkyv::Archive for Vec where - T: Archive, + T: rkyv::Archive, { - type Archived = ArchivedVec; + type Archived = rkyv::vec::ArchivedVec; type Resolver = rkyv::vec::VecResolver; - fn resolve(&self, resolver: Self::Resolver, out: rkyv::Place) { - ArchivedVec::resolve_from_slice(self, resolver, out); + unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) { + rkyv::vec::ArchivedVec::resolve_from_slice(self, pos, resolver, out); } } -impl, S: Fallible + Allocator + Writer + ?Sized> rkyv::Serialize - for Vec +impl, S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer + ?Sized> + rkyv::Serialize for Vec { - fn serialize( - &self, - serializer: &mut S, - ) -> Result::Error> { + #[inline] + fn serialize(&self, serializer: &mut S) -> Result { ArchivedVec::::serialize_from_slice(self, serializer) } } -impl Deserialize, D> for ArchivedVec +impl rkyv::Deserialize, D> + for ArchivedVec where - [T::Archived]: DeserializeUnsized<[T], D>, - D::Error: Source, + [T::Archived]: rkyv::DeserializeUnsized<[T], D>, { - fn deserialize(&self, deserializer: &mut D) -> Result, ::Error> { - let metadata = self.as_slice().deserialize_metadata(); - let layout = <[T] as LayoutRaw>::layout_raw(metadata).into_error()?; - let data_address = if layout.size() > 0 { - unsafe { alloc::alloc(layout) } - } else { - polyfill::dangling(&layout).as_ptr() - }; - let out = ptr_meta::from_raw_parts_mut(data_address.cast(), metadata); - unsafe { - self.as_slice().deserialize_unsized(deserializer, out)?; - } - unsafe { Ok(Box::<[T]>::from_raw(out).into()) } - } -} - -mod polyfill { - - use core::{alloc::Layout, ptr::NonNull}; - - pub fn dangling(layout: &Layout) -> NonNull { - #[cfg(miri)] - { - layout.dangling() - } - #[cfg(not(miri))] + #[inline] + fn deserialize(&self, deserializer: &mut D) -> Result, D::Error> { unsafe { - NonNull::new_unchecked(layout.align() as *mut u8) + let data_address = + (**self).deserialize_unsized(deserializer, |layout| std::alloc::alloc(layout))?; + let metadata = self.as_slice().deserialize_metadata(deserializer)?; + let ptr = ptr_meta::from_raw_parts_mut(data_address, metadata); + Ok(Box::<[T]>::from_raw(ptr).into()) } } } diff --git a/crates/swc_atoms/Cargo.toml b/crates/swc_atoms/Cargo.toml index 314d97512f1e..e36340e4612a 100644 --- a/crates/swc_atoms/Cargo.toml +++ b/crates/swc_atoms/Cargo.toml @@ -13,7 +13,7 @@ bench = false [features] __rkyv = [] -rkyv-impl = ["__rkyv", "rkyv", "bytecheck", "rancor"] +rkyv-impl = ["__rkyv", "rkyv", "bytecheck"] [dependencies] # bytecheck version should be in sync with rkyv version. Do not bump individually. @@ -21,7 +21,6 @@ arbitrary = { workspace = true, optional = true } bytecheck = { workspace = true, optional = true } hstr = { workspace = true } once_cell = { workspace = true } -rancor = { workspace = true, optional = true } -rkyv = { workspace = true, optional = true } rustc-hash = { workspace = true } serde = { workspace = true } +rkyv = { workspace = true, features = ["validation"], optional = true } diff --git a/crates/swc_atoms/src/lib.rs b/crates/swc_atoms/src/lib.rs index 1ed9365a6ca1..82f688bac6a2 100644 --- a/crates/swc_atoms/src/lib.rs +++ b/crates/swc_atoms/src/lib.rs @@ -28,7 +28,7 @@ pub use self::{atom as js_word, Atom as JsWord}; /// /// See [tendril] for more details. #[derive(Clone, Default, PartialEq, Eq, Hash)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "rkyv-impl", derive(rkyv::bytecheck::CheckBytes))] #[cfg_attr(feature = "rkyv-impl", repr(C))] pub struct Atom(hstr::Atom); @@ -199,17 +199,14 @@ impl rkyv::Archive for Atom { type Resolver = rkyv::string::StringResolver; #[allow(clippy::unit_arg)] - fn resolve(&self, resolver: Self::Resolver, out: rkyv::Place) { - rkyv::string::ArchivedString::resolve_from_str(self, resolver, out) + unsafe fn resolve(&self, pos: usize, resolver: Self::Resolver, out: *mut Self::Archived) { + rkyv::string::ArchivedString::resolve_from_str(self, pos, resolver, out) } } /// NOT A PUBLIC API #[cfg(feature = "rkyv-impl")] -impl rkyv::Serialize for Atom -where - ::Error: rancor::Source, -{ +impl rkyv::Serialize for Atom { fn serialize(&self, serializer: &mut S) -> Result { String::serialize(&self.to_string(), serializer) } @@ -219,9 +216,9 @@ where #[cfg(feature = "rkyv-impl")] impl rkyv::Deserialize for rkyv::string::ArchivedString where - D: ?Sized + rancor::Fallible, + D: ?Sized + rkyv::Fallible, { - fn deserialize(&self, deserializer: &mut D) -> Result::Error> { + fn deserialize(&self, deserializer: &mut D) -> Result::Error> { let s: String = self.deserialize(deserializer)?; Ok(Atom::new(s)) diff --git a/crates/swc_common/Cargo.toml b/crates/swc_common/Cargo.toml index ad3c360f733e..d132edbce218 100644 --- a/crates/swc_common/Cargo.toml +++ b/crates/swc_common/Cargo.toml @@ -34,29 +34,29 @@ plugin_transform_schema_vtest = [] tty-emitter = ["termcolor"] __rkyv = [] -rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "bytecheck", "rancor"] +rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "bytecheck"] [dependencies] -ahash = { workspace = true, optional = true } -anyhow = { workspace = true, optional = true } -arbitrary = { workspace = true, features = ["derive"], optional = true } -bytecheck = { workspace = true, optional = true } -cfg-if = { workspace = true } -either = { workspace = true } +ahash = { workspace = true, optional = true } +anyhow = { workspace = true, optional = true } +arbitrary = { workspace = true, features = ["derive"], optional = true } +# bytecheck version should be in sync with rkyv version. Do not bump individually. +bytecheck = { workspace = true, optional = true } +cfg-if = { workspace = true } +either = { workspace = true } new_debug_unreachable = { workspace = true } -num-bigint = { workspace = true } -once_cell = { workspace = true } -parking_lot = { workspace = true, optional = true } -rancor = { workspace = true, optional = true } -rkyv = { workspace = true, optional = true } -rustc-hash = { workspace = true } -serde = { workspace = true, features = ["derive"] } -siphasher = { workspace = true } -sourcemap = { workspace = true, optional = true } -termcolor = { workspace = true, optional = true } -tracing = { workspace = true } -unicode-width = { workspace = true } -url = { workspace = true } +num-bigint = { workspace = true } +once_cell = { workspace = true } +parking_lot = { workspace = true, optional = true } +rkyv = { workspace = true, features = ["validation"], optional = true } +rustc-hash = { workspace = true } +serde = { workspace = true, features = ["derive"] } +siphasher = { workspace = true } +sourcemap = { workspace = true, optional = true } +termcolor = { workspace = true, optional = true } +tracing = { workspace = true } +unicode-width = { workspace = true } +url = { workspace = true } ast_node = { version = "2.0.0", path = "../ast_node" } better_scoped_tls = { version = "1.0.0", path = "../better_scoped_tls" } diff --git a/crates/swc_common/src/cache.rs b/crates/swc_common/src/cache.rs deleted file mode 100644 index d943cb3479d7..000000000000 --- a/crates/swc_common/src/cache.rs +++ /dev/null @@ -1,116 +0,0 @@ -use std::ops::Deref; - -use once_cell::sync::OnceCell; - -/// Wrapper for [OnceCell] with support for [rkyv]. -#[derive(Clone, Debug)] -pub struct CacheCell(OnceCell); - -impl Deref for CacheCell { - type Target = OnceCell; - - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl CacheCell { - pub fn new() -> Self { - Self(OnceCell::new()) - } -} - -impl From for CacheCell { - fn from(value: T) -> Self { - Self(OnceCell::from(value)) - } -} - -impl Default for CacheCell { - fn default() -> Self { - Self::new() - } -} - -#[cfg(feature = "rkyv-impl")] -mod rkyv_impl { - use std::hint::unreachable_unchecked; - - use rancor::Fallible; - use rkyv::{ - munge::munge, option::ArchivedOption, traits::NoUndef, Archive, Deserialize, Place, - Serialize, - }; - - use super::*; - - #[allow(dead_code)] - #[repr(u8)] - enum ArchivedOptionTag { - None, - Some, - } - - // SAFETY: `ArchivedOptionTag` is `repr(u8)` and so always consists of a single - // well-defined byte. - unsafe impl NoUndef for ArchivedOptionTag {} - - #[repr(C)] - struct ArchivedOptionVariantNone(ArchivedOptionTag); - - #[repr(C)] - struct ArchivedOptionVariantSome(ArchivedOptionTag, T); - - impl Archive for CacheCell { - type Archived = ArchivedOption; - type Resolver = Option; - - fn resolve(&self, resolver: Self::Resolver, out: Place) { - match resolver { - None => { - let out = unsafe { out.cast_unchecked::() }; - munge!(let ArchivedOptionVariantNone(tag) = out); - tag.write(ArchivedOptionTag::None); - } - Some(resolver) => { - let out = - unsafe { out.cast_unchecked::>() }; - munge!(let ArchivedOptionVariantSome(tag, out_value) = out); - tag.write(ArchivedOptionTag::Some); - - let value = if let Some(value) = self.get() { - value - } else { - unsafe { - unreachable_unchecked(); - } - }; - - value.resolve(resolver, out_value); - } - } - } - } - - impl, S: Fallible + ?Sized> Serialize for CacheCell { - fn serialize(&self, serializer: &mut S) -> Result { - self.get() - .map(|value| value.serialize(serializer)) - .transpose() - } - } - - impl Deserialize, D> for ArchivedOption - where - T: Archive, - T::Archived: Deserialize, - D: Fallible + ?Sized, - { - fn deserialize(&self, deserializer: &mut D) -> Result, D::Error> { - Ok(match self { - ArchivedOption::Some(value) => CacheCell::from(value.deserialize(deserializer)?), - ArchivedOption::None => CacheCell::new(), - }) - } - } -} diff --git a/crates/swc_common/src/comments.rs b/crates/swc_common/src/comments.rs index 762bfa633c01..4364381904f9 100644 --- a/crates/swc_common/src/comments.rs +++ b/crates/swc_common/src/comments.rs @@ -634,8 +634,8 @@ impl SingleThreadedComments { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct Comment { pub kind: CommentKind, pub span: Span, @@ -654,8 +654,7 @@ impl Spanned for Comment { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] pub enum CommentKind { Line = 0, Block = 1, diff --git a/crates/swc_common/src/errors/diagnostic.rs b/crates/swc_common/src/errors/diagnostic.rs index 7f5a262ed187..5bed0f239e0e 100644 --- a/crates/swc_common/src/errors/diagnostic.rs +++ b/crates/swc_common/src/errors/diagnostic.rs @@ -22,8 +22,8 @@ use crate::syntax_pos::{MultiSpan, Span}; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct Message(pub String, pub Style); #[must_use] @@ -36,8 +36,8 @@ pub struct Message(pub String, pub Style); any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct Diagnostic { pub level: Level, pub message: Vec, @@ -56,8 +56,8 @@ pub struct Diagnostic { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum DiagnosticId { Error(String), Lint(String), @@ -73,8 +73,8 @@ pub enum DiagnosticId { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct SubDiagnostic { pub level: Level, pub message: Vec, diff --git a/crates/swc_common/src/errors/mod.rs b/crates/swc_common/src/errors/mod.rs index 13f40dd23fa4..43a6e979aad0 100644 --- a/crates/swc_common/src/errors/mod.rs +++ b/crates/swc_common/src/errors/mod.rs @@ -50,8 +50,8 @@ mod styled_buffer; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum Applicability { MachineApplicable, HasPlaceholders, @@ -68,8 +68,8 @@ pub enum Applicability { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct CodeSuggestion { /// Each substitute can have multiple variants due to multiple /// applicable suggestions @@ -121,8 +121,8 @@ pub struct CodeSuggestion { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct Substitution { pub parts: Vec, } @@ -136,8 +136,8 @@ pub struct Substitution { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct SubstitutionPart { pub span: Span, pub snippet: String, @@ -885,8 +885,8 @@ impl Handler { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum Level { Bug, Fatal, diff --git a/crates/swc_common/src/errors/snippet.rs b/crates/swc_common/src/errors/snippet.rs index 706bb9a9f487..7eb6e85f22ae 100644 --- a/crates/swc_common/src/errors/snippet.rs +++ b/crates/swc_common/src/errors/snippet.rs @@ -184,8 +184,8 @@ pub struct StyledString { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum Style { MainHeaderMsg, HeaderMsg, diff --git a/crates/swc_common/src/lib.rs b/crates/swc_common/src/lib.rs index 7f8e8e07fa92..ba0b27e7a868 100644 --- a/crates/swc_common/src/lib.rs +++ b/crates/swc_common/src/lib.rs @@ -51,13 +51,14 @@ pub use self::{ source_map::{FileLines, FileLoader, FilePathMapping, SourceMap, SpanSnippetError}, syntax_pos::LineCol, }; +#[doc(hidden)] +pub mod private; /// A trait for ast nodes. pub trait AstNode: Debug + PartialEq + Clone + Spanned { const TYPE: &'static str; } -pub mod cache; pub mod collections; pub mod comments; mod eq; @@ -67,8 +68,6 @@ pub mod iter; pub mod pass; pub mod plugin; mod pos; -#[doc(hidden)] -pub mod private; mod rustc_data_structures; pub mod serializer; pub mod source_map; diff --git a/crates/swc_common/src/plugin/diagnostics.rs b/crates/swc_common/src/plugin/diagnostics.rs index e64c9ae094ef..5e72903e9f54 100644 --- a/crates/swc_common/src/plugin/diagnostics.rs +++ b/crates/swc_common/src/plugin/diagnostics.rs @@ -7,8 +7,8 @@ any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct PluginCorePkgDiagnostics { pub pkg_version: String, pub git_sha: String, diff --git a/crates/swc_common/src/plugin/serialized.rs b/crates/swc_common/src/plugin/serialized.rs index 8361b6f75e0a..6f2b677edf27 100644 --- a/crates/swc_common/src/plugin/serialized.rs +++ b/crates/swc_common/src/plugin/serialized.rs @@ -1,6 +1,8 @@ use std::any::type_name; use anyhow::Error; +#[cfg(feature = "__rkyv")] +use rkyv::Deserialize; #[derive(Debug, Clone, PartialEq, Eq)] #[non_exhaustive] @@ -8,8 +10,8 @@ use anyhow::Error; feature = "__plugin", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "__plugin", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "__plugin", repr(u32))] +#[cfg_attr(feature = "__plugin", archive(check_bytes))] +#[cfg_attr(feature = "__plugin", archive_attr(repr(u32)))] /// Enum for possible errors while running transform via plugin. /// /// This error indicates internal operation failure either in plugin_runner @@ -37,7 +39,7 @@ pub enum PluginError { /// format struct contains: it is strict implementation detail which can /// change anytime. pub struct PluginSerializedBytes { - pub(crate) field: rkyv::util::AlignedVec, + pub(crate) field: rkyv::AlignedVec, } #[cfg(feature = "__plugin")] @@ -48,7 +50,7 @@ impl PluginSerializedBytes { */ #[tracing::instrument(level = "info", skip_all)] pub fn from_slice(bytes: &[u8]) -> PluginSerializedBytes { - let mut field = rkyv::util::AlignedVec::new(); + let mut field = rkyv::AlignedVec::new(); field.extend_from_slice(bytes); PluginSerializedBytes { field } } @@ -59,7 +61,6 @@ impl PluginSerializedBytes { * This is sort of mimic TryFrom behavior, since we can't use generic * to implement TryFrom trait */ - /* #[tracing::instrument(level = "info", skip_all)] pub fn try_serialize(t: &VersionedSerializable) -> Result where @@ -77,26 +78,6 @@ impl PluginSerializedBytes { } }) } - */ - - #[tracing::instrument(level = "info", skip_all)] - pub fn try_serialize(t: &VersionedSerializable) -> Result - where - W: for<'a> rkyv::Serialize< - rancor::Strategy< - rkyv::ser::Serializer< - rkyv::util::AlignedVec, - rkyv::ser::allocator::ArenaHandle<'a>, - rkyv::ser::sharing::Share, - >, - rancor::Error, - >, - >, - { - rkyv::to_bytes::(t) - .map(|field| PluginSerializedBytes { field }) - .map_err(|err| err.into()) - } /* * Internal fn to constructs an instance from raw bytes ptr. @@ -121,35 +102,6 @@ impl PluginSerializedBytes { (self.field.as_ptr(), self.field.len()) } - #[tracing::instrument(level = "info", skip_all)] - pub fn deserialize(&self) -> Result, Error> - where - W: rkyv::Archive, - W::Archived: rkyv::Deserialize>, - for<'a> W::Archived: bytecheck::CheckBytes< - rancor::Strategy< - rkyv::validation::Validator< - rkyv::validation::archive::ArchiveValidator<'a>, - rkyv::validation::shared::SharedValidator, - >, - rancor::Error, - >, - >, - { - use anyhow::Context; - - let archived = - rkyv::access::(&self.field[..]).map_err(|err| { - anyhow::format_err!("wasm plugin bytecheck failed {:?}", err.to_string()) - })?; - - let deserialized = rkyv::deserialize(archived) - .with_context(|| format!("failed to deserialize `{}`", type_name::()))?; - - Ok(VersionedSerializable(deserialized)) - } - - /* #[tracing::instrument(level = "info", skip_all)] pub fn deserialize(&self) -> Result, Error> where @@ -167,7 +119,7 @@ impl PluginSerializedBytes { archived .deserialize(&mut rkyv::de::deserializers::SharedDeserializeMap::new()) .with_context(|| format!("failed to deserialize `{}`", type_name::())) - } */ + } } /// A wrapper type for the structures to be passed into plugins @@ -182,7 +134,8 @@ impl PluginSerializedBytes { derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[repr(transparent)] -#[cfg_attr(feature = "__plugin", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "__plugin", archive(check_bytes))] +#[cfg_attr(feature = "__plugin", archive_attr(repr(transparent)))] #[derive(Debug)] pub struct VersionedSerializable( // [NOTE]: https://github.com/rkyv/rkyv/issues/373#issuecomment-1546360897 diff --git a/crates/swc_common/src/source_map.rs b/crates/swc_common/src/source_map.rs index ef89f797b847..12b38bf261cb 100644 --- a/crates/swc_common/src/source_map.rs +++ b/crates/swc_common/src/source_map.rs @@ -316,11 +316,10 @@ impl SourceMap { let line_info = self.lookup_line_with(fm, pos); match line_info { Ok(SourceFileAndLine { sf: f, line: a }) => { - let analysis = f.analyze(); let chpos = self.bytepos_to_file_charpos_with(&f, pos); let line = a + 1; // Line numbers start at 1 - let linebpos = f.analyze().lines[a]; + let linebpos = f.lines[a]; assert!( pos >= linebpos, "{}: bpos = {:?}; linebpos = {:?};", @@ -333,17 +332,16 @@ impl SourceMap { let col = chpos - linechpos; let col_display = { - let start_width_idx = analysis + let start_width_idx = f .non_narrow_chars .binary_search_by_key(&linebpos, |x| x.pos()) .unwrap_or_else(|x| x); - let end_width_idx = analysis + let end_width_idx = f .non_narrow_chars .binary_search_by_key(&pos, |x| x.pos()) .unwrap_or_else(|x| x); let special_chars = end_width_idx - start_width_idx; - let non_narrow: usize = analysis.non_narrow_chars - [start_width_idx..end_width_idx] + let non_narrow: usize = f.non_narrow_chars[start_width_idx..end_width_idx] .iter() .map(|x| x.width()) .sum(); @@ -369,15 +367,14 @@ impl SourceMap { }) } Err(f) => { - let analysis = f.analyze(); let chpos = self.bytepos_to_file_charpos(pos)?; let col_display = { - let end_width_idx = analysis + let end_width_idx = f .non_narrow_chars .binary_search_by_key(&pos, |x| x.pos()) .unwrap_or_else(|x| x); - let non_narrow: usize = analysis.non_narrow_chars[0..end_width_idx] + let non_narrow: usize = f.non_narrow_chars[0..end_width_idx] .iter() .map(|x| x.width()) .sum(); @@ -1031,11 +1028,11 @@ impl SourceMap { ) -> u32 { let mut total_extra_bytes = state.total_extra_bytes; let mut index = state.mbc_index; - let analysis = file.analyze(); + if bpos >= state.pos { - let range = index..analysis.multibyte_chars.len(); + let range = index..file.multibyte_chars.len(); for i in range { - let mbc = &analysis.multibyte_chars[i]; + let mbc = &file.multibyte_chars[i]; debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos >= bpos { break; @@ -1055,7 +1052,7 @@ impl SourceMap { } else { let range = 0..index; for i in range.rev() { - let mbc = &analysis.multibyte_chars[i]; + let mbc = &file.multibyte_chars[i]; debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos < bpos { break; @@ -1325,8 +1322,7 @@ impl SourceMap { None => continue, }; - let analysis = f.analyze(); - let linebpos = analysis.lines[line as usize]; + let linebpos = f.lines[line as usize]; debug_assert!( pos >= linebpos, "{}: bpos = {:?}; linebpos = {:?};", diff --git a/crates/swc_common/src/syntax_pos.rs b/crates/swc_common/src/syntax_pos.rs index 4039f5a15cc3..4ab1870cb6d2 100644 --- a/crates/swc_common/src/syntax_pos.rs +++ b/crates/swc_common/src/syntax_pos.rs @@ -16,7 +16,7 @@ use url::Url; use self::hygiene::MarkData; pub use self::hygiene::{Mark, SyntaxContext}; -use crate::{cache::CacheCell, rustc_data_structures::stable_hasher::StableHasher, sync::Lrc}; +use crate::{rustc_data_structures::stable_hasher::StableHasher, sync::Lrc}; mod analyze_source_file; pub mod hygiene; @@ -36,14 +36,14 @@ pub mod hygiene; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct Span { #[serde(rename = "start")] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] pub lo: BytePos, #[serde(rename = "end")] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] pub hi: BytePos, } @@ -141,17 +141,11 @@ better_scoped_tls::scoped_tls!( any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[derive(Debug, Eq, PartialEq, Clone, Ord, PartialOrd, Hash)] pub enum FileName { - Real( - #[cfg_attr( - any(feature = "rkyv-impl"), - rkyv(with = crate::source_map::EncodePathBuf) - )] - PathBuf, - ), + Real(#[cfg_attr(any(feature = "rkyv-impl"), with(crate::source_map::EncodePathBuf))] PathBuf), /// A macro. This includes the full name of the macro, so that there are no /// clashes. Macros(String), @@ -162,7 +156,7 @@ pub enum FileName { /// Hack in src/libsyntax/parse.rs MacroExpansion, ProcMacroSourceCode, - Url(#[cfg_attr(any(feature = "rkyv-impl"), rkyv(with = crate::source_map::EncodeUrl))] Url), + Url(#[cfg_attr(any(feature = "rkyv-impl"), with(crate::source_map::EncodeUrl))] Url), Internal(String), /// Custom sources for explicit parser calls from plugins and drivers Custom(String), @@ -179,7 +173,7 @@ pub enum FileName { /// version accepts errors #[cfg(feature = "rkyv-impl")] #[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "rkyv-impl", derive(rkyv::bytecheck::CheckBytes))] #[cfg_attr(feature = "rkyv-impl", repr(C))] pub struct EncodePathBuf; @@ -189,18 +183,22 @@ impl rkyv::with::ArchiveWith for EncodePathBuf { type Resolver = rkyv::string::StringResolver; #[inline] - fn resolve_with(field: &PathBuf, resolver: Self::Resolver, out: rkyv::Place) { + unsafe fn resolve_with( + field: &PathBuf, + pos: usize, + resolver: Self::Resolver, + out: *mut Self::Archived, + ) { // It's safe to unwrap here because if the OsString wasn't valid UTF-8 it would // have failed to serialize - rkyv::string::ArchivedString::resolve_from_str(field.to_str().unwrap(), resolver, out); + rkyv::string::ArchivedString::resolve_from_str(field.to_str().unwrap(), pos, resolver, out); } } #[cfg(feature = "rkyv-impl")] impl rkyv::with::SerializeWith for EncodePathBuf where - S: ?Sized + rancor::Fallible + rkyv::ser::Writer, - S::Error: rancor::Source, + S: ?Sized + rkyv::ser::Serializer, { #[inline] fn serialize_with(field: &PathBuf, serializer: &mut S) -> Result { @@ -212,7 +210,7 @@ where #[cfg(feature = "rkyv-impl")] impl rkyv::with::DeserializeWith for EncodePathBuf where - D: ?Sized + rancor::Fallible, + D: ?Sized + rkyv::Fallible, { #[inline] fn deserialize_with( @@ -226,7 +224,7 @@ where /// A wrapper that attempts to convert a Url to and from String. #[cfg(feature = "rkyv-impl")] #[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "rkyv-impl", derive(rkyv::bytecheck::CheckBytes))] #[cfg_attr(feature = "rkyv-impl", repr(C))] pub struct EncodeUrl; @@ -236,16 +234,20 @@ impl rkyv::with::ArchiveWith for EncodeUrl { type Resolver = rkyv::string::StringResolver; #[inline] - fn resolve_with(field: &Url, resolver: Self::Resolver, out: rkyv::Place) { - rkyv::string::ArchivedString::resolve_from_str(field.as_str(), resolver, out); + unsafe fn resolve_with( + field: &Url, + pos: usize, + resolver: Self::Resolver, + out: *mut Self::Archived, + ) { + rkyv::string::ArchivedString::resolve_from_str(field.as_str(), pos, resolver, out); } } #[cfg(feature = "rkyv-impl")] impl rkyv::with::SerializeWith for EncodeUrl where - S: ?Sized + rancor::Fallible + rkyv::ser::Writer, - S::Error: rancor::Source, + S: ?Sized + rkyv::ser::Serializer, { #[inline] fn serialize_with(field: &Url, serializer: &mut S) -> Result { @@ -257,7 +259,7 @@ where #[cfg(feature = "rkyv-impl")] impl rkyv::with::DeserializeWith, Url, D> for EncodeUrl where - D: ?Sized + rancor::Fallible, + D: ?Sized + rkyv::Fallible, { #[inline] fn deserialize_with(field: &rkyv::string::ArchivedString, _: &mut D) -> Result { @@ -335,8 +337,8 @@ impl FileName { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct PrimarySpanLabel(pub Span, pub String); /// A collection of spans. Spans have two orthogonal attributes: @@ -354,8 +356,8 @@ pub struct PrimarySpanLabel(pub Span, pub String); any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct MultiSpan { primary_spans: Vec, span_labels: Vec, @@ -650,8 +652,8 @@ pub const NO_EXPANSION: SyntaxContext = SyntaxContext::empty(); any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub struct MultiByteChar { /// The absolute offset of the character in the SourceMap @@ -680,8 +682,8 @@ impl MultiByteChar { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum NonNarrowChar { /// Represents a zero-width character @@ -748,7 +750,7 @@ impl Sub for NonNarrowChar { #[doc(hidden)] #[cfg(feature = "rkyv-impl")] #[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "rkyv-impl", derive(rkyv::bytecheck::CheckBytes))] #[cfg_attr(feature = "rkyv-impl", repr(C))] pub struct EncodeArcString; @@ -757,21 +759,21 @@ impl rkyv::with::ArchiveWith> for EncodeArcString { type Archived = rkyv::Archived; type Resolver = rkyv::Resolver; - fn resolve_with( + unsafe fn resolve_with( field: &Lrc, + pos: usize, resolver: Self::Resolver, - out: rkyv::Place, + out: *mut Self::Archived, ) { let s = field.to_string(); - rkyv::Archive::resolve(&s, resolver, out); + rkyv::Archive::resolve(&s, pos, resolver, out); } } #[cfg(feature = "rkyv-impl")] impl rkyv::with::SerializeWith, S> for EncodeArcString where - S: ?Sized + rancor::Fallible + rkyv::ser::Writer, - S::Error: rancor::Source, + S: ?Sized + rkyv::ser::Serializer, { fn serialize_with(field: &Lrc, serializer: &mut S) -> Result { rkyv::string::ArchivedString::serialize_from_str(field, serializer) @@ -781,7 +783,7 @@ where #[cfg(feature = "rkyv-impl")] impl rkyv::with::DeserializeWith, Lrc, D> for EncodeArcString where - D: ?Sized + rancor::Fallible, + D: ?Sized + rkyv::Fallible, { fn deserialize_with( field: &rkyv::Archived, @@ -800,8 +802,8 @@ where any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[derive(Clone)] pub struct SourceFile { /// The name of the file that the source came from. Source that doesn't @@ -817,7 +819,7 @@ pub struct SourceFile { /// Indicates which crate this `SourceFile` was imported from. pub crate_of_origin: u32, /// The complete source code - #[cfg_attr(any(feature = "rkyv-impl"), rkyv(with = EncodeArcString))] + #[cfg_attr(any(feature = "rkyv-impl"), with(EncodeArcString))] pub src: Lrc, /// The source code's hash pub src_hash: u128, @@ -825,26 +827,14 @@ pub struct SourceFile { pub start_pos: BytePos, /// The end position of this source in the `SourceMap` pub end_pos: BytePos, - /// A hash of the filename, used for speeding up the incr. comp. hashing. - pub name_hash: u128, - - lazy: CacheCell, -} - -#[cfg_attr( - any(feature = "rkyv-impl"), - derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) -)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] -#[derive(Clone)] -pub struct SourceFileAnalysis { /// Locations of lines beginnings in the source code pub lines: Vec, /// Locations of multi-byte characters in the source code pub multibyte_chars: Vec, /// Width of characters that are not narrow in the source code pub non_narrow_chars: Vec, + /// A hash of the filename, used for speeding up the incr. comp. hashing. + pub name_hash: u128, } impl fmt::Debug for SourceFile { @@ -898,6 +888,9 @@ impl SourceFile { }; let end_pos = start_pos.to_usize() + src.len(); + let (lines, multibyte_chars, non_narrow_chars) = + analyze_source_file::analyze_source_file(&src[..], start_pos); + SourceFile { name, name_was_remapped, @@ -907,16 +900,17 @@ impl SourceFile { src_hash, start_pos, end_pos: SmallPos::from_usize(end_pos), + lines, + multibyte_chars, + non_narrow_chars, name_hash, - lazy: CacheCell::new(), } } /// Return the BytePos of the beginning of the current line. pub fn line_begin_pos(&self, pos: BytePos) -> BytePos { let line_index = self.lookup_line(pos).unwrap(); - let analysis = self.analyze(); - analysis.lines[line_index] + self.lines[line_index] } /// Get a line from the list of pre-computed line-beginnings. @@ -934,8 +928,7 @@ impl SourceFile { } let begin = { - let analysis = self.analyze(); - let line = analysis.lines.get(line_number)?; + let line = self.lines.get(line_number)?; let begin: BytePos = *line - self.start_pos; begin.to_usize() }; @@ -952,8 +945,7 @@ impl SourceFile { } pub fn count_lines(&self) -> usize { - let analysis = self.analyze(); - analysis.lines.len() + self.lines.len() } /// Find the line containing the given position. The return value is the @@ -961,13 +953,12 @@ impl SourceFile { /// number. If the `source_file` is empty or the position is located before /// the first line, `None` is returned. pub fn lookup_line(&self, pos: BytePos) -> Option { - let analysis = self.analyze(); - if analysis.lines.is_empty() { + if self.lines.is_empty() { return None; } - let line_index = lookup_line(&analysis.lines, pos); - assert!(line_index < analysis.lines.len() as isize); + let line_index = lookup_line(&self.lines[..], pos); + assert!(line_index < self.lines.len() as isize); if line_index >= 0 { Some(line_index as usize) } else { @@ -980,13 +971,11 @@ impl SourceFile { return (self.start_pos, self.end_pos); } - let analysis = self.analyze(); - - assert!(line_index < analysis.lines.len()); - if line_index == (analysis.lines.len() - 1) { - (analysis.lines[line_index], self.end_pos) + assert!(line_index < self.lines.len()); + if line_index == (self.lines.len() - 1) { + (self.lines[line_index], self.end_pos) } else { - (analysis.lines[line_index], analysis.lines[line_index + 1]) + (self.lines[line_index], self.lines[line_index + 1]) } } @@ -994,18 +983,6 @@ impl SourceFile { pub fn contains(&self, byte_pos: BytePos) -> bool { byte_pos >= self.start_pos && byte_pos <= self.end_pos } - - pub fn analyze(&self) -> &SourceFileAnalysis { - self.lazy.get_or_init(|| { - let (lines, multibyte_chars, non_narrow_chars) = - analyze_source_file::analyze_source_file(&self.src[..], self.start_pos); - SourceFileAnalysis { - lines, - multibyte_chars, - non_narrow_chars, - } - }) - } } /// Remove utf-8 BOM if any. @@ -1047,9 +1024,9 @@ pub trait SmallPos { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] -pub struct BytePos(#[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] pub u32); +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] +pub struct BytePos(#[cfg_attr(feature = "__rkyv", omit_bounds)] pub u32); impl BytePos { /// Dummy position. This is reserved for synthesized spans. @@ -1087,8 +1064,8 @@ impl BytePos { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)] pub struct CharPos(pub usize); @@ -1203,8 +1180,8 @@ pub struct Loc { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Debug, Clone) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct PartialLoc { pub source_file: Option>, pub line: usize, @@ -1234,8 +1211,8 @@ pub struct SourceFileAndLine { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[derive(Debug)] pub struct SourceFileAndBytePos { pub sf: Lrc, @@ -1247,8 +1224,8 @@ pub struct SourceFileAndBytePos { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct LineInfo { /// Index of line, starting from 0. pub line_index: usize, @@ -1287,8 +1264,8 @@ pub struct FileLines { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Debug, Clone) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct PartialFileLines { pub file: Option>, pub lines: Vec, @@ -1308,8 +1285,8 @@ pub type PartialFileLinesResult = Result>; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum SpanLinesError { IllFormedSpan(Span), DistinctSources(DistinctSources), @@ -1320,8 +1297,8 @@ pub enum SpanLinesError { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum SpanSnippetError { DummyBytePos, IllFormedSpan(Span), @@ -1340,8 +1317,8 @@ pub enum SpanSnippetError { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum SourceMapLookupError { NoFileFor(BytePos), } @@ -1351,8 +1328,8 @@ pub enum SourceMapLookupError { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct FilePos(pub Lrc, pub BytePos); #[derive(Clone, PartialEq, Eq, Debug)] @@ -1360,8 +1337,8 @@ pub struct FilePos(pub Lrc, pub BytePos); any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct DistinctSources { pub begin: FilePos, pub end: FilePos, @@ -1372,8 +1349,8 @@ pub struct DistinctSources { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct MalformedSourceMapPositions { pub name: Lrc, pub source_len: usize, diff --git a/crates/swc_common/src/syntax_pos/hygiene.rs b/crates/swc_common/src/syntax_pos/hygiene.rs index 5fb3bba233fd..59f6218b84e8 100644 --- a/crates/swc_common/src/syntax_pos/hygiene.rs +++ b/crates/swc_common/src/syntax_pos/hygiene.rs @@ -34,9 +34,9 @@ use crate::{collections::AHashMap, EqIgnoreSpan}; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] -pub struct SyntaxContext(#[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] u32); +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] +pub struct SyntaxContext(#[cfg_attr(feature = "__rkyv", omit_bounds)] u32); #[cfg(feature = "arbitrary")] #[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))] @@ -86,8 +86,8 @@ pub(crate) struct MarkData { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct MutableMarkContext(pub u32, pub u32, pub u32); // List of proxy calls injected by the host in the plugin's runtime context. diff --git a/crates/swc_common/tests/attr_interop.rs b/crates/swc_common/tests/attr_interop.rs index 84be81e5b082..79bda1819ec1 100644 --- a/crates/swc_common/tests/attr_interop.rs +++ b/crates/swc_common/tests/attr_interop.rs @@ -19,24 +19,19 @@ pub struct Tuple(#[span] HasSpan, usize, usize); derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - feature = "rkyv-impl", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) -)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr( - feature = "rkyv-impl", - rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source)) + any(feature = "rkyv-impl"), + archive(bound(serialize = "__S: rkyv::ser::Serializer + rkyv::ser::ScratchSpace")) )] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] #[cfg_attr( feature = "rkyv-impl", - bytecheck(bounds( - __C: rkyv::validation::ArchiveContext - )) + archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \ + rkyv::Fallible>::Error: std::error::Error")) )] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct HasSpan { - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))] pub span: Span, } diff --git a/crates/swc_css_ast/Cargo.toml b/crates/swc_css_ast/Cargo.toml index 059c0224cde6..9e221d7fb0b1 100644 --- a/crates/swc_css_ast/Cargo.toml +++ b/crates/swc_css_ast/Cargo.toml @@ -12,26 +12,17 @@ version = "4.0.1" bench = false [features] -__rkyv = [] -default = [] -rkyv-impl = [ - "__rkyv", - "rkyv", - "swc_atoms/rkyv-impl", - "swc_common/rkyv-impl", - "bytecheck", - "rancor", -] +__rkyv = [] +default = [] +rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] serde-impl = ["serde"] [dependencies] -bytecheck = { workspace = true, optional = true } is-macro = { workspace = true } -rancor = { workspace = true, optional = true } serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.0", path = "../string_enum/" } swc_atoms = { version = "2.0.0", path = "../swc_atoms" } swc_common = { version = "4.0.0", path = "../swc_common" } -rkyv = { workspace = true, optional = true } +rkyv = { workspace = true, features = ["validation"], optional = true } diff --git a/crates/swc_css_ast/src/at_rule.rs b/crates/swc_css_ast/src/at_rule.rs index 062c200b41b0..8d5125d0f251 100644 --- a/crates/swc_css_ast/src/at_rule.rs +++ b/crates/swc_css_ast/src/at_rule.rs @@ -449,13 +449,12 @@ pub struct MediaFeatureBoolean { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] -//#[cfg_attr( -// feature = "rkyv", -// archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + -// rkyv::ser::Serializer")) -//)] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] +#[cfg_attr( + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) +)] pub enum MediaFeatureRangeComparison { /// `<` Lt, @@ -776,13 +775,12 @@ pub struct SizeFeatureBoolean { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] -//#[cfg_attr( -// feature = "rkyv", -// archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + -// rkyv::ser::Serializer")) -//)] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] +#[cfg_attr( + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) +)] pub enum SizeFeatureRangeComparison { /// `<` Lt, diff --git a/crates/swc_css_ast/src/selector.rs b/crates/swc_css_ast/src/selector.rs index 4854ac390c29..6217fdb8d90f 100644 --- a/crates/swc_css_ast/src/selector.rs +++ b/crates/swc_css_ast/src/selector.rs @@ -125,11 +125,10 @@ pub struct Combinator { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] pub enum CombinatorValue { /// ` ` Descendant, @@ -263,13 +262,12 @@ pub struct AttributeSelector { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] -//#[cfg_attr( -// feature = "rkyv", -// archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + -// rkyv::ser::Serializer")) -//)] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] +#[cfg_attr( + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) +)] pub enum AttributeSelectorMatcherValue { /// `=` Equals, diff --git a/crates/swc_css_ast/src/token.rs b/crates/swc_css_ast/src/token.rs index b366083d422f..23848b84cac0 100644 --- a/crates/swc_css_ast/src/token.rs +++ b/crates/swc_css_ast/src/token.rs @@ -31,8 +31,8 @@ impl Take for TokenAndSpan { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] pub struct UrlKeyValue(pub Atom, pub Atom); #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, Is, EqIgnoreSpan)] @@ -40,12 +40,11 @@ pub struct UrlKeyValue(pub Atom, pub Atom); feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] #[cfg_attr(feature = "serde-impl", derive(Serialize, Deserialize))] pub enum NumberType { @@ -60,8 +59,8 @@ pub enum NumberType { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(C))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(C)))] #[cfg_attr(feature = "serde-impl", derive(Serialize, Deserialize))] pub struct DimensionToken { pub value: f64, @@ -79,12 +78,11 @@ pub struct DimensionToken { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum Token { diff --git a/crates/swc_css_ast/src/value.rs b/crates/swc_css_ast/src/value.rs index 97a155478f83..bf2130982df4 100644 --- a/crates/swc_css_ast/src/value.rs +++ b/crates/swc_css_ast/src/value.rs @@ -121,11 +121,10 @@ impl EqIgnoreSpan for Str { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] pub enum DelimiterValue { /// `,` Comma, @@ -398,11 +397,10 @@ pub struct Ratio { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr(feature = "rkyv", archive_attr(repr(u32)))] pub enum BinOp { /// `+` Add, @@ -505,11 +503,10 @@ pub struct CalcOperator { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum CalcOperatorType { /// `+` Add, diff --git a/crates/swc_ecma_ast/Cargo.toml b/crates/swc_ecma_ast/Cargo.toml index 7c3d4625dd4d..b71d30758ab4 100644 --- a/crates/swc_ecma_ast/Cargo.toml +++ b/crates/swc_ecma_ast/Cargo.toml @@ -23,21 +23,20 @@ rkyv-impl = [ "__rkyv", "rkyv", "bytecheck", - "rancor", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl", ] serde-impl = ["serde"] [dependencies] -arbitrary = { workspace = true, features = ["derive"], optional = true } -bitflags = { workspace = true } +arbitrary = { workspace = true, features = ["derive"], optional = true } +bitflags = { workspace = true } +# bytecheck version should be in sync with rkyv version. Do not bump individually. bytecheck = { workspace = true, optional = true } is-macro = { workspace = true } num-bigint = { workspace = true, features = ["serde"] } phf = { workspace = true, features = ["macros"] } -rancor = { workspace = true, optional = true } -rkyv = { workspace = true, optional = true } +rkyv = { workspace = true, features = ["validation"], optional = true } scoped-tls = { workspace = true } serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.0", path = "../string_enum" } diff --git a/crates/swc_ecma_ast/src/class.rs b/crates/swc_ecma_ast/src/class.rs index a5f21a5204cb..cd533be85018 100644 --- a/crates/swc_ecma_ast/src/class.rs +++ b/crates/swc_ecma_ast/src/class.rs @@ -259,8 +259,8 @@ pub struct Decorator { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum MethodKind { #[default] diff --git a/crates/swc_ecma_ast/src/decl.rs b/crates/swc_ecma_ast/src/decl.rs index 722ef16887c2..af6d89e7ab84 100644 --- a/crates/swc_ecma_ast/src/decl.rs +++ b/crates/swc_ecma_ast/src/decl.rs @@ -172,8 +172,8 @@ impl Take for VarDecl { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum VarDeclKind { /// `var` #[default] diff --git a/crates/swc_ecma_ast/src/expr.rs b/crates/swc_ecma_ast/src/expr.rs index 421cee36f080..9e1f06a87175 100644 --- a/crates/swc_ecma_ast/src/expr.rs +++ b/crates/swc_ecma_ast/src/expr.rs @@ -1077,8 +1077,8 @@ pub struct MetaPropExpr { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum MetaPropKind { /// `new.target` NewTarget, @@ -1271,29 +1271,25 @@ impl Take for Import { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] #[cfg_attr( feature = "rkyv-impl", - rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source)) + archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \ + rkyv::Fallible>::Error: std::error::Error")) )] -#[cfg_attr( - feature = "rkyv-impl", - rkyv(bytecheck(bounds( - __C: rkyv::validation::ArchiveContext, - __C::Error: rkyv::rancor::Source - ))) - )] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub struct ExprOrSpread { #[cfg_attr(feature = "serde-impl", serde(default))] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))] pub spread: Option, #[cfg_attr(feature = "serde-impl", serde(rename = "expression"))] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))] pub expr: Box, } diff --git a/crates/swc_ecma_ast/src/ident.rs b/crates/swc_ecma_ast/src/ident.rs index 82f287d8f3fb..432b91895a31 100644 --- a/crates/swc_ecma_ast/src/ident.rs +++ b/crates/swc_ecma_ast/src/ident.rs @@ -20,30 +20,26 @@ use crate::{typescript::TsTypeAnn, Expr}; derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] #[cfg_attr( - feature = "rkyv-impl", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) -)] -#[cfg_attr( - feature = "rkyv-impl", - rkyv(deserialize_bounds(__D::Error: rkyv::rancor::Source)) + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] #[cfg_attr( feature = "rkyv-impl", - rkyv(bytecheck(bounds( - __C: rkyv::validation::ArchiveContext, - __C::Error: rkyv::rancor::Source - ))) + archive_attr(check_bytes(bound = "__C: rkyv::validation::ArchiveContext, <__C as \ + rkyv::Fallible>::Error: std::error::Error")) )] -#[cfg_attr(feature = "rkyv-impl", repr(C))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(C)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub struct BindingIdent { #[cfg_attr(feature = "serde-impl", serde(flatten))] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))] pub id: Ident, #[cfg_attr(feature = "serde-impl", serde(default, rename = "typeAnnotation"))] - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] + #[cfg_attr(feature = "__rkyv", archive_attr(omit_bounds))] pub type_ann: Option>, } @@ -169,10 +165,10 @@ bridge_from!(BindingIdent, Ident, Id); #[ast_node("Identifier")] #[derive(Eq, Hash, Default)] pub struct Ident { - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] pub span: Span, - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] pub ctxt: SyntaxContext, #[cfg_attr(feature = "serde-impl", serde(rename = "value"))] @@ -386,7 +382,7 @@ impl Ident { #[derive(Eq, Hash, Default, EqIgnoreSpan)] #[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub struct IdentName { - #[cfg_attr(feature = "__rkyv", rkyv(omit_bounds))] + #[cfg_attr(feature = "__rkyv", omit_bounds)] pub span: Span, #[cfg_attr(feature = "serde-impl", serde(rename = "value"))] diff --git a/crates/swc_ecma_ast/src/lit.rs b/crates/swc_ecma_ast/src/lit.rs index bc2d6181cf81..9df499510689 100644 --- a/crates/swc_ecma_ast/src/lit.rs +++ b/crates/swc_ecma_ast/src/lit.rs @@ -79,7 +79,7 @@ impl Lit { #[derive(Eq, Hash)] pub struct BigInt { pub span: Span, - #[cfg_attr(any(feature = "rkyv-impl"), rkyv(with = EncodeBigInt))] + #[cfg_attr(any(feature = "rkyv-impl"), with(EncodeBigInt))] pub value: Box, /// Use `None` value only for transformations to avoid recalculate @@ -95,7 +95,7 @@ impl EqIgnoreSpan for BigInt { #[cfg(feature = "rkyv-impl")] #[derive(Debug, Clone, Copy)] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] +#[cfg_attr(feature = "rkyv-impl", derive(rkyv::bytecheck::CheckBytes))] #[cfg_attr(feature = "rkyv-impl", repr(C))] pub struct EncodeBigInt; @@ -104,23 +104,23 @@ impl rkyv::with::ArchiveWith> for EncodeBigInt { type Archived = rkyv::Archived; type Resolver = rkyv::Resolver; - fn resolve_with( + unsafe fn resolve_with( field: &Box, + pos: usize, resolver: Self::Resolver, - out: rkyv::Place, + out: *mut Self::Archived, ) { use rkyv::Archive; let s = field.to_string(); - s.resolve(resolver, out); + s.resolve(pos, resolver, out); } } #[cfg(feature = "rkyv-impl")] impl rkyv::with::SerializeWith, S> for EncodeBigInt where - S: ?Sized + rancor::Fallible + rkyv::ser::Writer, - S::Error: rancor::Source, + S: ?Sized + rkyv::ser::Serializer, { fn serialize_with( field: &Box, @@ -134,7 +134,7 @@ where #[cfg(feature = "rkyv-impl")] impl rkyv::with::DeserializeWith, Box, D> for EncodeBigInt where - D: ?Sized + rancor::Fallible, + D: ?Sized + rkyv::Fallible, { fn deserialize_with( field: &rkyv::Archived, diff --git a/crates/swc_ecma_ast/src/module_decl.rs b/crates/swc_ecma_ast/src/module_decl.rs index ec9443adf4e0..df23cd837afd 100644 --- a/crates/swc_ecma_ast/src/module_decl.rs +++ b/crates/swc_ecma_ast/src/module_decl.rs @@ -138,8 +138,8 @@ pub struct ImportDecl { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum ImportPhase { #[default] diff --git a/crates/swc_ecma_ast/src/operators.rs b/crates/swc_ecma_ast/src/operators.rs index 16623ea00cae..f64efc54a3af 100644 --- a/crates/swc_ecma_ast/src/operators.rs +++ b/crates/swc_ecma_ast/src/operators.rs @@ -7,8 +7,8 @@ use swc_common::EqIgnoreSpan; any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum BinaryOp { /// `==` #[default] @@ -119,8 +119,8 @@ impl BinaryOp { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum AssignOp { /// `=` #[default] @@ -195,8 +195,8 @@ impl AssignOp { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum UpdateOp { /// `++` #[default] @@ -211,8 +211,8 @@ pub enum UpdateOp { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum UnaryOp { /// `-` Minus, diff --git a/crates/swc_ecma_ast/src/typescript.rs b/crates/swc_ecma_ast/src/typescript.rs index 534e5eb860c5..59ec642a7c81 100644 --- a/crates/swc_ecma_ast/src/typescript.rs +++ b/crates/swc_ecma_ast/src/typescript.rs @@ -387,8 +387,8 @@ pub struct TsKeywordType { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum TsKeywordTypeKind { #[cfg_attr(feature = "serde-impl", serde(rename = "any"))] @@ -671,8 +671,8 @@ pub struct TsTypeOperator { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum TsTypeOperatorOp { /// `keyof` KeyOf, @@ -699,8 +699,8 @@ pub struct TsIndexedAccessType { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] pub enum TruePlusMinus { True, Plus, @@ -1073,8 +1073,8 @@ pub struct TsSatisfiesExpr { any(feature = "rkyv-impl"), derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv-impl", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv-impl", repr(u32))] +#[cfg_attr(feature = "rkyv-impl", archive(check_bytes))] +#[cfg_attr(feature = "rkyv-impl", archive_attr(repr(u32)))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum Accessibility { #[cfg_attr(feature = "serde-impl", serde(rename = "public"))] diff --git a/crates/swc_error_reporters/src/lib.rs b/crates/swc_error_reporters/src/lib.rs index ff378249eb50..4297233473cc 100644 --- a/crates/swc_error_reporters/src/lib.rs +++ b/crates/swc_error_reporters/src/lib.rs @@ -131,7 +131,7 @@ impl SourceCode for MietteSourceCode<'_> { } let loc = self.0.lookup_char_pos(span.lo()); - let line_count = loc.file.analyze().lines.len(); + let line_count = loc.file.lines.len(); let name = if self.1.skip_filename { None diff --git a/crates/swc_estree_compat/src/swcify/ctx.rs b/crates/swc_estree_compat/src/swcify/ctx.rs index af9c9b8f3da4..b707b2c98067 100644 --- a/crates/swc_estree_compat/src/swcify/ctx.rs +++ b/crates/swc_estree_compat/src/swcify/ctx.rs @@ -12,7 +12,7 @@ pub struct Context { impl Context { fn locate_line_col(&self, loc: LineCol) -> BytePos { - if let Some(&line_start) = self.fm.analyze().lines.get(loc.line) { + if let Some(&line_start) = self.fm.lines.get(loc.line) { line_start + BytePos(loc.column as _) } else { BytePos(0) diff --git a/crates/swc_html_ast/Cargo.toml b/crates/swc_html_ast/Cargo.toml index 57384c5f7621..fa875627cf91 100644 --- a/crates/swc_html_ast/Cargo.toml +++ b/crates/swc_html_ast/Cargo.toml @@ -15,21 +15,14 @@ version = "4.0.1" bench = false [features] -__rkyv = [] -rkyv-impl = [ - "__rkyv", - "rkyv", - "swc_atoms/rkyv-impl", - "swc_common/rkyv-impl", - "bytecheck", -] +__rkyv = [] +rkyv-impl = ["__rkyv", "rkyv", "swc_atoms/rkyv-impl", "swc_common/rkyv-impl"] serde-impl = ["serde"] [dependencies] -bytecheck = { workspace = true, optional = true } -is-macro = { workspace = true } -rkyv = { workspace = true, optional = true } -serde = { workspace = true, features = ["derive"], optional = true } +is-macro = { workspace = true } +rkyv = { workspace = true, features = ["validation"], optional = true } +serde = { workspace = true, features = ["derive"], optional = true } string_enum = { version = "1.0.0", path = "../string_enum/" } swc_atoms = { version = "2.0.0", path = "../swc_atoms" } diff --git a/crates/swc_html_ast/src/base.rs b/crates/swc_html_ast/src/base.rs index 7bbb4f7a816a..624b02c96327 100644 --- a/crates/swc_html_ast/src/base.rs +++ b/crates/swc_html_ast/src/base.rs @@ -23,13 +23,11 @@ pub struct DocumentFragment { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -//#[cfg_attr( -// feature = "rkyv", -// archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + -// rkyv::ser::Serializer")) -//)] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr( + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) +)] pub enum DocumentMode { /// `no-quirks` NoQuirks, @@ -78,13 +76,11 @@ impl EqIgnoreSpan for DocumentType { feature = "rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -//#[cfg_attr( -// feature = "rkyv", -// archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + -// rkyv::ser::Serializer")) -//)] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] +#[cfg_attr( + feature = "rkyv", + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) +)] pub enum Namespace { /// `http://www.w3.org/1999/xhtml` HTML, diff --git a/crates/swc_html_ast/src/token.rs b/crates/swc_html_ast/src/token.rs index 56a08195a0ad..fae47a43f7d2 100644 --- a/crates/swc_html_ast/src/token.rs +++ b/crates/swc_html_ast/src/token.rs @@ -27,11 +27,9 @@ pub struct AttributeToken { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum Raw { Same, @@ -45,11 +43,9 @@ pub enum Raw { )] #[cfg_attr( feature = "rkyv", - rkyv(serialize_bounds(__S: rkyv::ser::Writer + rkyv::ser::Allocator, - __S::Error: rkyv::rancor::Source)) + archive(bound(serialize = "__S: rkyv::ser::ScratchSpace + rkyv::ser::Serializer")) )] -#[cfg_attr(feature = "rkyv", derive(bytecheck::CheckBytes))] -#[cfg_attr(feature = "rkyv", repr(u32))] +#[cfg_attr(feature = "rkyv", archive(check_bytes))] #[cfg_attr(feature = "serde-impl", derive(serde::Serialize, serde::Deserialize))] pub enum Token { Doctype { diff --git a/crates/swc_plugin_proxy/Cargo.toml b/crates/swc_plugin_proxy/Cargo.toml index d28355b2ee7f..554bf0e81b11 100644 --- a/crates/swc_plugin_proxy/Cargo.toml +++ b/crates/swc_plugin_proxy/Cargo.toml @@ -12,7 +12,7 @@ bench = false [features] __rkyv = [] -rkyv-impl = ["__rkyv", "rkyv", "bytecheck", "rancor"] +rkyv-impl = ["__rkyv", "rkyv"] __plugin_mode = [] __plugin_rt = [] @@ -22,10 +22,8 @@ plugin-rt = ["__plugin_rt", "swc_common/plugin-base", "rkyv-impl"] [dependencies] -bytecheck = { workspace = true, optional = true } -rancor = { workspace = true, optional = true } -rkyv = { workspace = true, optional = true } -tracing = { workspace = true } +rkyv = { workspace = true, features = ["validation"], optional = true } +tracing = { workspace = true } better_scoped_tls = { version = "1.0.0", path = "../better_scoped_tls" } swc_common = { version = "4.0.0", path = "../swc_common" } diff --git a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs index 78759222fdcf..353ebe97e0d3 100644 --- a/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs +++ b/crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs @@ -48,16 +48,7 @@ impl PluginCommentsProxy { #[cfg_attr(not(target_arch = "wasm32"), allow(unused))] fn allocate_comments_buffer_to_host(&self, value: T) where - T: for<'a> rkyv::Serialize< - rancor::Strategy< - rkyv::ser::Serializer< - rkyv::util::AlignedVec, - rkyv::ser::allocator::ArenaHandle<'a>, - rkyv::ser::sharing::Share, - >, - rancor::Error, - >, - >, + T: rkyv::Serialize>, { #[cfg(target_arch = "wasm32")] { diff --git a/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs b/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs index 63b003e4f1a6..386b3fd25600 100644 --- a/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs +++ b/crates/swc_plugin_proxy/src/memory_interop/read_returned_result_from_host.rs @@ -7,7 +7,8 @@ use swc_common::plugin::serialized::PluginSerializedBytes; feature = "__rkyv", derive(rkyv::Archive, rkyv::Serialize, rkyv::Deserialize) )] -#[cfg_attr(feature = "__rkyv", repr(C))] +#[cfg_attr(feature = "__rkyv", archive(check_bytes))] +#[cfg_attr(feature = "__rkyv", archive_attr(repr(C)))] pub struct AllocatedBytesPtr(pub u32, pub u32); #[cfg(target_arch = "wasm32")] @@ -91,16 +92,8 @@ pub fn read_returned_result_from_host(f: F) -> Option where F: FnOnce(u32) -> u32, R: rkyv::Archive, - R::Archived: rkyv::Deserialize>, - for<'a> R::Archived: bytecheck::CheckBytes< - rancor::Strategy< - rkyv::validation::Validator< - rkyv::validation::archive::ArchiveValidator<'a>, - rkyv::validation::shared::SharedValidator, - >, - rancor::Error, - >, - >, + R::Archived: rkyv::Deserialize + + for<'a> rkyv::CheckBytes>, { let allocated_returned_value_ptr = read_returned_result_from_host_inner(f); diff --git a/crates/swc_plugin_runner/Cargo.toml b/crates/swc_plugin_runner/Cargo.toml index ff141e8285b9..5d3d69f504d0 100644 --- a/crates/swc_plugin_runner/Cargo.toml +++ b/crates/swc_plugin_runner/Cargo.toml @@ -71,8 +71,8 @@ swc_ecma_ast = { version = "4.0.1", path = "../swc_ecma_ast", optional = true } swc_plugin_proxy = { version = "4.0.0", path = "../swc_plugin_proxy" } [target.'cfg(not(target_arch = "wasm32"))'.dependencies] -wasmer-cache = { version = "5.0.1", optional = true } -wasmer-compiler-cranelift = { version = "5.0.1", default-features = false } +wasmer-cache = { version = "4.3.7", optional = true } +wasmer-compiler-cranelift = { version = "4.3.7", default-features = false } [dev-dependencies] codspeed-criterion-compat = { workspace = true }