From 05ff80b14da14debcc24f9cb9788b0f6be495738 Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Fri, 15 May 2026 10:20:36 +0900 Subject: [PATCH 1/3] chore(deps): update js-component-bindgen --- Cargo.lock | 900 ++++++------------ Cargo.toml | 35 +- .../src/bindgen.rs | 106 ++- .../src/splice.rs | 222 ++--- .../src/stub_wasi.rs | 50 +- 5 files changed, 524 insertions(+), 789 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fcc90796..93f8a83f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,12 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "anstream" version = "0.6.18" @@ -60,27 +54,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.97" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" - -[[package]] -name = "auditable-serde" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c7bf8143dfc3c0258df908843e169b5cc5fcf76c7718bd66135ef4a9cd558c5" -dependencies = [ - "semver", - "serde", - "serde_json", - "topological-sort", -] - -[[package]] -name = "autocfg" -version = "1.4.0" +version = "1.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" [[package]] name = "base64" @@ -94,6 +70,40 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bon" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f47dbe92550676ee653353c310dfb9cf6ba17ee70396e1f7cf0a2020ad49b2fe" +dependencies = [ + "bon-macros", + "rustversion", +] + +[[package]] +name = "bon-macros" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "519bd3116aeeb42d5372c29d982d16d0170d3d4a5ed85fc7dd91642ffff3c67c" +dependencies = [ + "darling", + "ident_case", + "prettyplease", + "proc-macro2", + "quote", + "rustversion", + "syn", +] + [[package]] name = "bumpalo" version = "3.17.0" @@ -148,9 +158,12 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cobs" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror", +] [[package]] name = "colorchoice" @@ -158,25 +171,46 @@ version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cranelift-bforest" +version = "0.130.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5996f01a686b2349cdb379083ec5ad3e8cb8767fb2d495d3a4f2ee4163a18d" +dependencies = [ + "cranelift-entity", + "wasmtime-internal-core", +] + [[package]] name = "cranelift-bitset" -version = "0.118.0" +version = "0.130.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b265bed7c51e1921fdae6419791d31af77d33662ee56d7b0fa0704dc8d231cab" +checksum = "523fea83273f6a985520f57788809a4de2165794d9ab00fb1254fceb4f5aa00c" dependencies = [ "serde", "serde_derive", + "wasmtime-internal-core", ] [[package]] name = "cranelift-entity" -version = "0.118.0" +version = "0.130.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2c67d95507c51b4a1ff3f3555fe4bfec36b9e13c1b684ccc602736f5d5f4a2" +checksum = "6038b3147c7982f4951150d5f96c7c06c1e7214b99d4b4a98607aadf8ded89d1" dependencies = [ "cranelift-bitset", "serde", "serde_derive", + "wasmtime-internal-core", ] [[package]] @@ -189,193 +223,130 @@ dependencies = [ ] [[package]] -name = "displaydoc" -version = "0.2.5" +name = "crypto-common" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ - "proc-macro2", - "quote", - "syn", + "generic-array", + "typenum", ] [[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "equivalent" -version = "1.0.2" +name = "darling" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" - -[[package]] -name = "errno" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" +checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d" dependencies = [ - "libc", - "windows-sys", + "darling_core", + "darling_macro", ] [[package]] -name = "fastrand" -version = "2.3.0" +name = "darling_core" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" - -[[package]] -name = "flate2" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" +checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0" dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "foldhash" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", ] [[package]] -name = "futures" -version = "0.3.31" +name = "darling_macro" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d" dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", + "darling_core", + "quote", + "syn", ] [[package]] -name = "futures-channel" -version = "0.3.31" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "futures-core", - "futures-sink", + "block-buffer", + "crypto-common", ] [[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" +name = "embedded-io" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" [[package]] -name = "futures-io" -version = "0.3.31" +name = "embedded-io" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" [[package]] -name = "futures-macro" -version = "0.3.31" +name = "equivalent" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] -name = "futures-sink" -version = "0.3.31" +name = "fnv" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] -name = "futures-task" -version = "0.3.31" +name = "foldhash" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" [[package]] -name = "futures-util" -version = "0.3.31" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", + "typenum", + "version_check", ] [[package]] -name = "getrandom" -version = "0.3.1" +name = "gimli" +version = "0.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +checksum = "0bf7f043f89559805f8c7cacc432749b2fa0d0a0a9ee46ce47164ed5ba7f126c" dependencies = [ - "cfg-if", - "libc", - "wasi", - "windows-targets", + "fnv", + "hashbrown 0.16.1", + "indexmap", ] [[package]] -name = "gimli" -version = "0.31.1" +name = "hashbrown" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" dependencies = [ - "indexmap", + "foldhash", + "serde", + "serde_core", ] [[package]] name = "hashbrown" -version = "0.15.2" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" dependencies = [ "foldhash", "serde", + "serde_core", ] [[package]] @@ -384,160 +355,28 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "id-arena" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" +checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954" [[package]] -name = "idna" -version = "1.0.3" +name = "ident_case" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" -dependencies = [ - "icu_normalizer", - "icu_properties", -] +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "indexmap" -version = "2.8.0" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" +checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.17.1", "serde", + "serde_core", ] [[package]] @@ -554,17 +393,18 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-component-bindgen" -version = "1.11.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a4e7f0ba445896fbec0f2294c213c889bd0e73ed65b11e00662c6cb70e6156d" +checksum = "a7349a16becdbbf9f4ba40666e267a283c1e5347fc5d24bc47f07cdbceb7cbac" dependencies = [ "anyhow", "base64", + "bon", "heck", "log", "semver", - "wasm-encoder 0.227.1", - "wasmparser 0.227.1", + "wasm-encoder 0.245.1", + "wasmparser 0.245.1", "wasmtime-environ", "wit-bindgen-core", "wit-component", @@ -584,22 +424,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] -name = "linux-raw-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9" - -[[package]] -name = "litemap" -version = "0.7.5" +name = "libm" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" [[package]] name = "log" -version = "0.4.26" +version = "0.4.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "memchr" @@ -607,23 +441,14 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "miniz_oxide" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" -dependencies = [ - "adler2", -] - [[package]] name = "object" -version = "0.36.7" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +checksum = "271638cd5fa9cca89c4c304675ca658efc4e64a66c716b7cfe1afb4b9611dbbc" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.16.1", "indexmap", "memchr", ] @@ -635,28 +460,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad" [[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "postcard" -version = "1.1.1" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a2601f67cc9dba8edd8c4870b15f71a6a2dc196daec8c83f72b59dff628a8" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" dependencies = [ "cobs", "embedded-io 0.4.0", @@ -708,17 +521,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] -name = "rustix" -version = "1.0.2" +name = "rustversion" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" -dependencies = [ - "bitflags", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] name = "ryu" @@ -728,27 +534,38 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "semver" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" dependencies = [ "serde", + "serde_core", ] [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -768,32 +585,25 @@ dependencies = [ ] [[package]] -name = "slab" -version = "0.4.9" +name = "sha2" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" dependencies = [ - "autocfg", + "cfg-if", + "cpufeatures", + "digest", ] [[package]] name = "smallvec" -version = "1.14.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ "serde", ] -[[package]] -name = "spdx" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58b69356da67e2fc1f542c71ea7e654a361a79c938e4424392ecf4fa065d2193" -dependencies = [ - "smallvec", -] - [[package]] name = "spidermonkey-embedding-splicer" version = "0.1.0" @@ -804,8 +614,8 @@ dependencies = [ "js-component-bindgen", "rand", "serde_json", - "wasm-encoder 0.227.1", - "wasmparser 0.239.0", + "wasm-encoder 0.245.1", + "wasmparser 0.245.1", "wirm", "wit-bindgen", "wit-bindgen-core", @@ -820,12 +630,6 @@ dependencies = [ "spidermonkey-embedding-splicer", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "strsim" version = "0.11.1" @@ -843,17 +647,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "target-lexicon" version = "0.13.2" @@ -861,43 +654,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] -name = "tempfile" -version = "3.18.0" +name = "termcolor" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c317e0a526ee6120d8dabad239c8dadca62b24b6f168914bbbc8e2fb1f0e567" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ - "cfg-if", - "fastrand", - "getrandom", - "once_cell", - "rustix", - "windows-sys", + "winapi-util", ] [[package]] -name = "termcolor" -version = "1.4.1" +name = "thiserror" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "winapi-util", + "thiserror-impl", ] [[package]] -name = "tinystr" -version = "0.7.6" +name = "thiserror-impl" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ - "displaydoc", - "zerovec", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "topological-sort" -version = "0.2.2" +name = "typenum" +version = "1.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea68304e134ecd095ac6c3574494fc62b909f416c4fca77e440530221e549d3d" +checksum = "40ce102ab67701b8526c123c1bab5cbe42d7040ccfd0f64af1a385808d2f43de" [[package]] name = "unicode-ident" @@ -917,29 +706,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - [[package]] name = "utf8parse" version = "0.2.2" @@ -947,71 +713,61 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] -name = "wasi" -version = "0.13.3+wasi-0.2.2" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" -dependencies = [ - "wit-bindgen-rt 0.33.0", -] +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasm-encoder" -version = "0.226.0" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d81b727619aec227dce83e7f7420d4e56c79acd044642a356ea045b98d4e13" +checksum = "3f9dca005e69bf015e45577e415b9af8c67e8ee3c0e38b5b0add5aa92581ed5c" dependencies = [ "leb128fmt", - "wasmparser 0.226.0", + "wasmparser 0.245.1", ] [[package]] name = "wasm-encoder" -version = "0.227.1" +version = "0.247.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80bb72f02e7fbf07183443b27b0f3d4144abf8c114189f2e088ed95b696a7822" +checksum = "30b6733b8b91d010a6ac5b0fb237dc46a19650bc4c67db66857e2e787d437204" dependencies = [ "leb128fmt", - "wasmparser 0.227.1", + "wasmparser 0.247.0", ] [[package]] name = "wasm-encoder" -version = "0.239.0" +version = "0.248.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be00faa2b4950c76fe618c409d2c3ea5a3c9422013e079482d78544bb2d184c" +checksum = "ac92cf547bc18d27ecc521015c08c353b4f18b84ab388bb6d1b6b682c620d9b6" dependencies = [ "leb128fmt", - "wasmparser 0.239.0", + "wasmparser 0.248.0", ] [[package]] name = "wasm-metadata" -version = "0.227.1" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce1ef0faabbbba6674e97a56bee857ccddf942785a336c8b47b42373c922a91d" +checksum = "da55e60097e8b37b475a0fa35c3420dd71d9eb7bd66109978ab55faf56a57efb" dependencies = [ "anyhow", - "auditable-serde", - "flate2", "indexmap", - "serde", - "serde_derive", - "serde_json", - "spdx", - "url", - "wasm-encoder 0.227.1", - "wasmparser 0.227.1", + "wasm-encoder 0.245.1", + "wasmparser 0.245.1", ] [[package]] name = "wasmparser" -version = "0.226.0" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc28600dcb2ba68d7e5f1c3ba4195c2bddc918c0243fd702d0b6dbd05689b681" +checksum = "4f08c9adee0428b7bddf3890fc27e015ac4b761cc608c822667102b8bfd6995e" dependencies = [ "bitflags", - "hashbrown", + "hashbrown 0.16.1", "indexmap", "semver", "serde", @@ -1019,56 +775,50 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.227.1" +version = "0.247.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f51cad774fb3c9461ab9bccc9c62dfb7388397b5deda31bf40e8108ccd678b2" +checksum = "8e6fb4c2bee46c5ea4d40f8cdb5c131725cd976718ec56f1c8e82fbde5fa2a80" dependencies = [ "bitflags", - "hashbrown", + "hashbrown 0.17.1", "indexmap", "semver", + "serde", ] [[package]] name = "wasmparser" -version = "0.239.0" +version = "0.248.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9d90bb93e764f6beabf1d02028c70a2156a6583e63ac4218dd07ef733368b0" +checksum = "aa4439c5eee9df71ee0c6efb37f63b1fcb1fec38f85f5142c54e7ed05d33091a" dependencies = [ "bitflags", - "hashbrown", "indexmap", - "semver", - "serde", ] [[package]] name = "wasmprinter" -version = "0.226.0" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "753a0516fa6c01756ee861f36878dfd9875f273aea9409d9ea390a333c5bcdc2" +checksum = "5f41517a3716fbb8ccf46daa9c1325f760fcbff5168e75c7392288e410b91ac8" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.226.0", + "wasmparser 0.245.1", ] -[[package]] -name = "wasmtime-component-util" -version = "31.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f292ef5eb2cf3d414c2bde59c7fa0feeba799c8db9a8c5a656ad1d1a1d05e10b" - [[package]] name = "wasmtime-environ" -version = "31.0.0" +version = "43.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b6b4bf08e371edf262cccb62de10e214bd4aaafaa069f1cd49c9c1c3a5ae8e4" +checksum = "4172382dcc785c31d0e862c6780a18f5dd437914d22c4691351f965ef751c821" dependencies = [ "anyhow", + "cranelift-bforest", "cranelift-bitset", "cranelift-entity", "gimli", + "hashbrown 0.16.1", "indexmap", "log", "object", @@ -1076,32 +826,51 @@ dependencies = [ "semver", "serde", "serde_derive", + "sha2", "smallvec", "target-lexicon", - "wasm-encoder 0.226.0", - "wasmparser 0.226.0", + "wasm-encoder 0.245.1", + "wasmparser 0.245.1", "wasmprinter", - "wasmtime-component-util", + "wasmtime-internal-component-util", + "wasmtime-internal-core", +] + +[[package]] +name = "wasmtime-internal-component-util" +version = "43.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "935d9ab293ba27d1ec9aa7bc1b3a43993dbe961af2a8f23f90a11e1331b4c13f" + +[[package]] +name = "wasmtime-internal-core" +version = "43.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a3820b174f477d2a7083209d1ad5353fcdb11eaea434b2137b8681029460dd3" +dependencies = [ + "hashbrown 0.16.1", + "libm", + "serde", ] [[package]] name = "wast" -version = "227.0.1" +version = "248.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c14e5042b16c9d267da3b9b0f4529870455178415286312c25c34dfc1b2816" +checksum = "acc54622ed5a5cddafcdf152043f9d4aed54d4a653d686b7dfe874809fca99d7" dependencies = [ "bumpalo", "leb128fmt", "memchr", "unicode-width", - "wasm-encoder 0.227.1", + "wasm-encoder 0.248.0", ] [[package]] name = "wat" -version = "1.227.1" +version = "1.248.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d394d5bef7006ff63338d481ca10f1af76601e65ebdf5ed33d29302994e9cc" +checksum = "d75cd9e510603909748e6ebab89f27cd04472c1d9d85a3c88a7a6fc51a1a7934" dependencies = [ "wast", ] @@ -1190,63 +959,42 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "wirm" -version = "2.1.0" +version = "4.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14732cb9a0eaf9ec52ecd36b9394ade5c16eea5405d160d8829f0199d97d507d" +checksum = "3398cfb47e9ac60f209294450b58f9577ba3019e299da09e9b1efeeba726930a" dependencies = [ "log", - "serde_json", - "tempfile", - "wasm-encoder 0.239.0", - "wasmparser 0.239.0", + "paste", + "wasm-encoder 0.247.0", + "wasmparser 0.247.0", ] [[package]] name = "wit-bindgen" -version = "0.41.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10fb6648689b3929d56bbc7eb1acf70c9a42a29eb5358c67c10f54dbd5d695de" +checksum = "2bb00254d5051d69730ee32580b7373592f10ad786757c372f0f2c7b61f86a2c" dependencies = [ - "wit-bindgen-rt 0.41.0", + "bitflags", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.41.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92fa781d4f2ff6d3f27f3cc9b74a73327b31ca0dc4a3ef25a0ce2983e0e5af9b" +checksum = "99cdef5ccf0b0e9bf30868d6f9c5ed116c84ae95f84ba29d2216d3e922de3963" dependencies = [ "anyhow", "heck", "wit-parser", ] -[[package]] -name = "wit-bindgen-rt" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" -dependencies = [ - "bitflags", -] - -[[package]] -name = "wit-bindgen-rt" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4db52a11d4dfb0a59f194c064055794ee6564eb1ced88c25da2cf76e50c5621" -dependencies = [ - "bitflags", - "futures", - "once_cell", -] - [[package]] name = "wit-bindgen-rust" -version = "0.41.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d0809dc5ba19e2e98661bf32fc0addc5a3ca5bf3a6a7083aa6ba484085ff3ce" +checksum = "e76541e2f37ac1729db85765729daa0f3c2b5975d66699114d107525f6d6c8d5" dependencies = [ "anyhow", "heck", @@ -1260,9 +1008,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.41.0" +version = "0.54.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad19eec017904e04c60719592a803ee5da76cb51c81e3f6fbf9457f59db49799" +checksum = "a284e17b2bc808c72ba008f6694626fa76bcac608b3d1ed0880f9add3f558f8e" dependencies = [ "anyhow", "prettyplease", @@ -1275,9 +1023,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.227.1" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "635c3adc595422cbf2341a17fb73a319669cc8d33deed3a48368a841df86b676" +checksum = "4894f10d2d5cbc17c77e91f86a1e48e191a788da4425293b55c98b44ba3fcac9" dependencies = [ "anyhow", "bitflags", @@ -1286,20 +1034,21 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.227.1", + "wasm-encoder 0.245.1", "wasm-metadata", - "wasmparser 0.227.1", + "wasmparser 0.245.1", "wat", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.227.1" +version = "0.245.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddf445ed5157046e4baf56f9138c124a0824d4d1657e7204d71886ad8ce2fc11" +checksum = "330698718e82983499419494dd1e3d7811a457a9bf9f69734e8c5f07a2547929" dependencies = [ "anyhow", + "hashbrown 0.16.1", "id-arena", "indexmap", "log", @@ -1308,84 +1057,5 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.227.1", -] - -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "wasmparser 0.245.1", ] diff --git a/Cargo.toml b/Cargo.toml index b4e2a349..4ccbcb4d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = [ "crates/splicer-component","crates/spidermonkey-embedding-splicer"] +members = ["crates/splicer-component", "crates/spidermonkey-embedding-splicer"] exclude = ["StarlingMonkey/crates/rust-url"] resolver = "2" @@ -13,20 +13,25 @@ too_many_arguments = 'allow' [workspace.dependencies] anyhow = { version = "1.0.95", default-features = false } heck = { version = "0.5", default-features = false } -js-component-bindgen = { version = "1.11.0" } -wirm = { version = "2.1.0", default-features = false } rand = { version = "0.8", default-features = false } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -wasm-encoder = { version = "0.227.1", features = [ "component-model", "std" ] } -wasmparser = { version = "0.239.0", features = ["features", - "component-model", - "hash-collections", - "serde", - "simd" , - "std", - "validate", +wirm = { version = "4.0.6", default-features = false } + +wasm-encoder = { version = "0.245.1", features = ["component-model", "std"] } +wasmparser = { version = "0.245.1", features = [ + "features", + "component-model", + "hash-collections", + "serde", + "simd", + "std", + "validate", ] } -wit-bindgen = { version = "0.41.0", features = [ "macros", "async", "realloc" ] } -wit-bindgen-core = { version = "0.41.0", default-features = false } -wit-component = { version = "0.227.1", features = ["dummy-module"] } -wit-parser = { version = "0.227.1", features = [ "decoding", "serde"] } +wit-component = { version = "0.245.1", features = ["dummy-module"] } +wit-parser = { version = "0.245.1", features = ["decoding", "serde"] } + +wit-bindgen = { version = "0.54.0", features = ["macros", "async", "realloc"] } +wit-bindgen-core = { version = "0.54.0", default-features = false } + +js-component-bindgen = { version = "1.19.0" } + diff --git a/crates/spidermonkey-embedding-splicer/src/bindgen.rs b/crates/spidermonkey-embedding-splicer/src/bindgen.rs index 872c1b57..ae8f983f 100644 --- a/crates/spidermonkey-embedding-splicer/src/bindgen.rs +++ b/crates/spidermonkey-embedding-splicer/src/bindgen.rs @@ -3,10 +3,11 @@ use std::fmt::Write; use anyhow::Result; use heck::*; +use js_component_bindgen::TranspileOpts; use js_component_bindgen::function_bindgen::{ ErrHandling, FunctionBindgen, ResourceData, ResourceMap, ResourceTable, }; -use js_component_bindgen::intrinsics::{Intrinsic, render_intrinsics}; +use js_component_bindgen::intrinsics::{Intrinsic, RenderIntrinsicsArgs, render_intrinsics}; use js_component_bindgen::names::LocalNames; use js_component_bindgen::source::Source; use wit_bindgen_core::abi::{self, LiftLower}; @@ -160,9 +161,10 @@ pub fn componentize_bindgen( bindgen.sizes.fill(resolve); - bindgen - .local_names - .exclude_globals(Intrinsic::get_global_names()); + let globals = Intrinsic::get_global_names() + .into_iter() + .collect::>(); + bindgen.local_names.exclude_globals(&globals); bindgen.imports_bindgen(); @@ -247,6 +249,7 @@ pub fn componentize_bindgen( if let WorldItem::Interface { id: iface_id, stability: _, + .. } = export { let iface = &resolve.interfaces[*iface_id]; @@ -297,6 +300,7 @@ pub fn componentize_bindgen( WorldItem::Interface { id: iface_id, stability: _, + .. } => { let iface = &resolve.interfaces[*iface_id]; for ty_id in iface.types.values() { @@ -307,7 +311,7 @@ pub fn componentize_bindgen( } } WorldItem::Function(_) => {} - WorldItem::Type(id) => { + WorldItem::Type { id, .. } => { let ty = &resolve.types[*id]; if ty.kind == TypeDefKind::Resource { imported_resource_modules.insert(*id, key_name.clone()); @@ -376,7 +380,13 @@ pub fn componentize_bindgen( .concat(), ); - let js_intrinsics = render_intrinsics(&mut bindgen.all_intrinsics, false, true); + let transpile_opts = TranspileOpts::default(); + let render_args = RenderIntrinsicsArgs::builder() + .intrinsics(&mut bindgen.all_intrinsics) + .instantiation_occurred(true) + .transpile_opts(&transpile_opts) + .build(); + let js_intrinsics = render_intrinsics(render_args); output.push_str(&js_intrinsics); output.push_str(&bindgen.src); @@ -424,7 +434,9 @@ impl JsBindgen<'_> { func.name.to_lower_camel_case(), ); } - WorldItem::Interface { id, stability: _ } => { + WorldItem::Interface { + id, stability: _, .. + } => { let iface = &self.resolve.interfaces[*id]; for id in iface.types.values() { if let TypeDefKind::Resource = &self.resolve.types[*id].kind { @@ -490,7 +502,7 @@ impl JsBindgen<'_> { } // ignore type exports for now - WorldItem::Type(_) => {} + WorldItem::Type { .. } => {} } } Ok(()) @@ -561,6 +573,7 @@ impl JsBindgen<'_> { WorldItem::Interface { id: i, stability: _, + .. } => { let iface = &self.resolve.interfaces[*i]; for id in iface.types.values() { @@ -606,7 +619,7 @@ impl JsBindgen<'_> { } } } - WorldItem::Type(id) => { + WorldItem::Type { id, .. } => { let ty = &self.resolve.types[*id]; if ty.kind == TypeDefKind::Resource { self.resource_directions @@ -699,6 +712,9 @@ impl JsBindgen<'_> { FunctionKind::AsyncStatic(_id) => todo!(), }; + // All imports are sync + let requires_async_porcelain = false; + // imports are canonicalized as exports because // the function bindgen as currently written still makes this assumption self.bindgen( @@ -714,6 +730,8 @@ impl JsBindgen<'_> { StringEncoding::UTF8, func, AbiVariant::GuestExport, + &iface_name, + requires_async_porcelain, ); self.src.push_str("\n"); @@ -753,7 +771,7 @@ impl JsBindgen<'_> { fn create_resource_map(&self, func: &Function) -> ResourceMap { let mut resource_map = BTreeMap::new(); - for (_, ty) in func.params.iter() { + for wit_parser::Param { ty, .. } in func.params.iter() { self.iter_resources(ty, &mut resource_map); } if let Some(ty) = func.result { @@ -800,6 +818,7 @@ impl JsBindgen<'_> { data: ResourceData::Guest { resource_name: ty.name.clone().unwrap(), prefix, + extra: None, }, }, ); @@ -845,6 +864,8 @@ impl JsBindgen<'_> { string_encoding: StringEncoding, func: &Function, abi: AbiVariant, + iface_name: &Option, + requires_async_porcelain: bool, ) { self.src.push_str("("); let mut params = Vec::new(); @@ -878,32 +899,37 @@ impl JsBindgen<'_> { ErrHandling::None }; - let mut f = FunctionBindgen { - is_async: false, - tracing_prefix: None, - intrinsics: &mut self.all_intrinsics, - valid_lifting_optimization: true, - sizes: &self.sizes, - err, - block_storage: Vec::new(), - blocks: Vec::new(), - callee, - memory: Some(&self.memory), - realloc: Some(&self.realloc), - tmp: 0, - params, - post_return: None, - encoding: match string_encoding { + let tracing_prefix = String::new(); + let mut f = FunctionBindgen::builder() + .is_async(false) + .tracing_prefix(&tracing_prefix) + .intrinsics(&mut self.all_intrinsics) + .valid_lifting_optimization(true) + .sizes(&self.sizes) + .err(err) + .block_storage(Vec::new()) + .blocks(Vec::new()) + .callee(callee) + .memory(&self.memory) + .realloc(&self.realloc) + .tmp(0) + .params(params) + .encoding(match string_encoding { StringEncoding::UTF8 => StringEncoding::UTF8, StringEncoding::UTF16 => todo!("UTF16 encoding"), StringEncoding::CompactUTF16 => todo!("Compact UTF16 encoding"), - }, - src: Source::default(), - resource_map: &resource_map, - cur_resource_borrows: false, - resolve: self.resolve, - callee_resource_dynamic: false, - }; + }) + .src(Source::default()) + .resource_map(&resource_map) + .clear_resource_borrows(false) + .resolve(self.resolve) + .callee_resource_dynamic(false) + .asmjs(false) + .requires_async_porcelain(requires_async_porcelain) + .tracing_enabled(false) + .maybe_iface_name(iface_name.as_deref()) + .build(); + abi::call( self.resolve, abi, @@ -918,6 +944,7 @@ impl JsBindgen<'_> { &mut f, false, ); + self.src.push_str(&f.src); self.src.push_str("}"); } @@ -965,12 +992,23 @@ impl JsBindgen<'_> { // the function bindgen as currently written still makes this assumption let sig = self.resolve.wasm_signature(AbiVariant::GuestImport, func); + // We treat all functions as requiring async porcelain to + // allow for use of `fetch()` + // + // Requiring async porcelain is distinct from a "real" + // P3 async export, in that the callee is *not* expected to follow + // the async ABI, but instead essentially be treated like an async + // JS function. + let requires_async_porcelain = true; + self.bindgen( sig.params.len(), - &format!("await {callee}"), + &callee, string_encoding, func, AbiVariant::GuestImport, + &iface_name, + requires_async_porcelain, ); self.src.push_str("\n"); diff --git a/crates/spidermonkey-embedding-splicer/src/splice.rs b/crates/spidermonkey-embedding-splicer/src/splice.rs index 0c70bf5c..feb5da0c 100644 --- a/crates/spidermonkey-embedding-splicer/src/splice.rs +++ b/crates/spidermonkey-embedding-splicer/src/splice.rs @@ -1,10 +1,7 @@ use std::path::PathBuf; -use anyhow::Result; +use anyhow::{Context as _, Result}; use wasm_encoder::{Encode, Section}; -use wasmparser::ExternalKind; -use wasmparser::MemArg; -use wasmparser::Operator; use wirm::ir::function::{FunctionBuilder, FunctionModifier}; use wirm::ir::id::{ExportsID, FunctionID, GlobalID, LocalID}; use wirm::ir::module::Module; @@ -12,6 +9,8 @@ use wirm::ir::module::module_globals::GlobalKind; use wirm::ir::types::{BlockType, ElementItems, InitInstr, InstrumentationMode, Value}; use wirm::module_builder::AddLocal; use wirm::opcode::{Inject, InjectAt}; +use wirm::wasmparser::MemArg; +use wirm::wasmparser::Operator; use wirm::{DataType, Opcode}; use wit_component::StringEncoding; use wit_component::metadata::{Bindgen, decode}; @@ -23,14 +22,7 @@ use crate::wit::exports::local::spidermonkey_embedding_splicer::splicer::{ }; use crate::{bindgen, map_core_fn, parse_wit, splice}; -// Returns -// pub struct SpliceResult { -// pub wasm: _rt::Vec::, -// pub js_bindings: _rt::String, -// pub exports: _rt::Vec::<(_rt::String, CoreFn,)>, -// pub import_wrappers: _rt::Vec::<(_rt::String, _rt::String,)>, -// pub imports: _rt::Vec::<(_rt::String, _rt::String, u32,)>, -// } +/// Splice bindings into a given JS engine WebAssembly binary pub fn splice_bindings( engine: Vec, features: Vec, @@ -55,71 +47,74 @@ pub fn splice_bindings( }; let world = resolve - .select_world(id, world_name.as_deref()) + .select_world(&[id], world_name.as_deref()) .map_err(|e| e.to_string())?; let mut wasm_bytes = wit_component::dummy_module(&resolve, world, wit_parser::ManglingAndAbi::Standard32); - // merge the engine world with the target world, retaining the engine producers - - let (engine_world, producers) = if let Ok(( + // Merge the engine world with the target world, retaining the engine producers + let Ok(( _, Bindgen { resolve: mut engine_resolve, - world: engine_world, + world: engine_world_id, metadata: _, producers, }, )) = decode(&engine) - { - // we disable the engine run and incoming handler as we recreate these exports - // when needed, so remove these from the world before initiating the merge - let maybe_run = engine_resolve.worlds[engine_world] + else { + unreachable!("failed to decode engine"); + }; + + // we disable the engine run and incoming handler as we recreate these exports + // when needed, so remove these from the world before initiating the merge + let maybe_run = engine_resolve.worlds[engine_world_id] + .exports + .iter() + .find(|(key, _)| { + engine_resolve + .name_world_key(key) + .starts_with("wasi:cli/run@0.2") + }) + .map(|(key, _)| key.clone()); + if let Some(run) = maybe_run { + engine_resolve.worlds[engine_world_id] .exports - .iter() - .find(|(key, _)| { - engine_resolve - .name_world_key(key) - .starts_with("wasi:cli/run@0.2") - }) - .map(|(key, _)| key.clone()); - if let Some(run) = maybe_run { - engine_resolve.worlds[engine_world] - .exports - .shift_remove(&run) - .unwrap(); - } - let maybe_serve = engine_resolve.worlds[engine_world] + .shift_remove(&run) + .unwrap(); + } + let maybe_serve = engine_resolve.worlds[engine_world_id] + .exports + .iter() + .find(|(key, _)| { + engine_resolve + .name_world_key(key) + .starts_with("wasi:http/incoming-handler@0.2.") + }) + .map(|(key, _)| key.clone()); + + if let Some(serve) = maybe_serve { + engine_resolve.worlds[engine_world_id] .exports - .iter() - .find(|(key, _)| { - engine_resolve - .name_world_key(key) - .starts_with("wasi:http/incoming-handler@0.2.") - }) - .map(|(key, _)| key.clone()); - - if let Some(serve) = maybe_serve { - engine_resolve.worlds[engine_world] - .exports - .shift_remove(&serve) - .unwrap(); - } - let map = resolve - .merge(engine_resolve) - .expect("unable to merge with engine world"); - let engine_world = map.map_world(engine_world, None).unwrap(); - (engine_world, producers) - } else { - unreachable!(); - }; + .shift_remove(&serve) + .unwrap(); + } + + let engine_world_span = engine_resolve.worlds[engine_world_id].span.clone(); + + let map = resolve + .merge(engine_resolve) + .expect("unable to merge with engine world"); + + let engine_world_id = map.map_world(engine_world_id, engine_world_span).unwrap(); let componentized = bindgen::componentize_bindgen(&resolve, world, &features).map_err(|err| err.to_string())?; + let mut clone_maps = wit_parser::CloneMaps::default(); resolve - .merge_worlds(engine_world, world) + .merge_worlds(engine_world_id, world, &mut clone_maps) .expect("unable to merge with engine world"); let encoded = @@ -344,7 +339,7 @@ pub fn splice( features: Vec, debug: bool, ) -> Result> { - let mut module = Module::parse(&engine, false).unwrap(); + let mut module = Module::parse(&engine, false, false).unwrap(); // since StarlingMonkey implements CLI Run and incoming handler, // we override them only if the guest content exports those functions @@ -361,16 +356,7 @@ pub fn splice( ); } - // we reencode the WASI world component data, so strip it out from the - // custom section - let maybe_component_section_id = module - .custom_sections - .get_id("component-type:bindings".to_string()); - if let Some(component_section_id) = maybe_component_section_id { - module.custom_sections.delete(component_section_id); - } - - // extract the native instructions from sample functions + // Extract the native instructions from sample functions // then inline the imported functions and main import gating function // (erasing sample functions in the process) synthesize_import_functions(&mut module, &imports, debug)?; @@ -378,7 +364,11 @@ pub fn splice( // create the exported functions as wrappers around the "cabi_call" function synthesize_export_functions(&mut module, &exports)?; - Ok(module.encode()) + let encoded = module + .encode() + .context("failed to encode module during splice")?; + + Ok(encoded) } fn remove_if_exported_by_js( @@ -413,7 +403,7 @@ fn get_export_fid(module: &Module, expt_id: &ExportsID) -> FunctionID { let expt = module.exports.get_by_id(*expt_id).unwrap(); match expt.kind { - ExternalKind::Func => FunctionID::from(expt.index), + wirm::wasmparser::ExternalKind::Func => FunctionID::from(expt.index), _ => panic!("Missing coreabi_get_import"), } } @@ -439,26 +429,37 @@ fn synthesize_import_functions( let memory = 0; - let main_tid = module.tables.main_function().unwrap(); + let main_tid = module + .tables + .main_function() + .context("failed to retreive main function tid")? + .context("missing tid")?; let import_fn_table_start_idx = module.tables.get(main_tid).unwrap().initial as i32; let cabi_realloc_fid = get_export_fid(module, &cabi_realloc.unwrap()); let fid = get_export_fid(module, &coreabi_sample_ids[0]); - let coreabi_sample_i32 = module.functions.get(fid).unwrap_local(); + let coreabi_sample_i32 = module + .functions + .get(fid) + .unwrap_local() + .context("missing coreabi_sample_i32 function")?; let _coreabi_sample_i64 = module .functions .get(get_export_fid(module, &coreabi_sample_ids[1])) - .unwrap_local(); + .unwrap_local() + .context("missing coreabi_sample_i64 function")?; let _coreabi_sample_f32 = module .functions .get(get_export_fid(module, &coreabi_sample_ids[2])) - .unwrap_local(); + .unwrap_local() + .context("missing coreabi_sample_f32 function")?; let _coreabi_sample_f64 = module .functions .get(get_export_fid(module, &coreabi_sample_ids[3])) - .unwrap_local(); + .unwrap_local() + .context("missing coreabi_sample_f64 function")?; // These functions retrieve the corresponding type // from a JS::HandleValue @@ -471,7 +472,7 @@ fn synthesize_import_functions( .unwrap(); // Sets the return value on args from the stack - let args_ret_i32: Vec = vec![ + let args_ret_i32: Vec = vec![ Operator::I64ExtendI32U, Operator::I64Const { value: -545460846592, @@ -492,7 +493,7 @@ fn synthesize_import_functions( let coreabi_to_bigint64 = module .exports .get_export_id_by_name("coreabi_to_bigint64".to_string()) - .unwrap(); + .context("failed to get export id by name")?; // create the import functions // All JS wrapper function bindings have the same type, the @@ -584,7 +585,7 @@ fn synthesize_import_functions( func.i32_add(); match arg { CoreTy::I32 => { - func.i64_load(MemArg { + func.i64_load(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -597,7 +598,7 @@ fn synthesize_import_functions( } CoreTy::F32 => { // isInt: (r.asRawBits() >> 32) == 0xFFFFFF81 - func.i64_load(MemArg { + func.i64_load(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -605,13 +606,13 @@ fn synthesize_import_functions( }); func.local_tee(tmp_local); func.i64_const(32); - func.i64_shr_unsigned(); + func.i64_shr_u(); func.i64_const(0xFFFFFF81); func.i64_eq(); func.if_stmt(BlockType::Type(DataType::F32)); func.local_get(tmp_local); func.i32_wrap_i64(); - func.f32_convert_i32s(); + func.f32_convert_i32_s(); func.else_stmt(); func.local_get(tmp_local); func.f64_reinterpret_i64(); @@ -620,7 +621,7 @@ fn synthesize_import_functions( } CoreTy::F64 => { // isInt: (r.asRawBits() >> 32) == 0xFFFFFF81 - func.i64_load(MemArg { + func.i64_load(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -628,13 +629,13 @@ fn synthesize_import_functions( }); func.local_tee(tmp_local); func.i64_const(32); - func.i64_shr_unsigned(); + func.i64_shr_u(); func.i64_const(0xFFFFFF81); func.i64_eq(); func.if_stmt(BlockType::Type(DataType::F64)); func.local_get(tmp_local); func.i32_wrap_i64(); - func.f64_convert_i32s(); + func.f64_convert_i32_s(); func.else_stmt(); func.local_get(tmp_local); func.f64_reinterpret_i64(); @@ -683,10 +684,10 @@ fn synthesize_import_functions( }), Some(CoreTy::I64) => { func.call(get_export_fid(module, &coreabi_to_bigint64)); - func.i64_extend_i32u(); + func.i64_extend_i32_u(); func.i64_const(-511101108224); func.i64_or(); - func.i64_store(MemArg { + func.i64_store(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -695,7 +696,7 @@ fn synthesize_import_functions( } Some(CoreTy::F32) => { func.f64_promote_f32(); - func.f64_store(MemArg { + func.f64_store(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -703,7 +704,7 @@ fn synthesize_import_functions( }); } Some(CoreTy::F64) => { - func.f64_store(MemArg { + func.f64_store(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -720,7 +721,10 @@ fn synthesize_import_functions( } // extend the main table to include indices for generated imported functions - let table = module.tables.get_mut(main_tid); + let table = module + .tables + .get_mut(main_tid) + .context("failed to retrieve mutable table by tid")?; table.initial += imports.len() as u64; table.maximum = Some(table.maximum.unwrap() + imports.len() as u64); @@ -749,6 +753,7 @@ fn synthesize_import_functions( .get(coreabi_get_import_fid) .kind() .unwrap_local() + .context("missing function for coreabi_get_import_fid")? .args; let arg_idx = args[0]; @@ -771,7 +776,7 @@ fn synthesize_import_functions( builder.inject_at( 0, InstrumentationMode::Before, - Operator::LocalSet { + wirm::wasmparser::Operator::LocalSet { local_index: *idx_local, }, ); @@ -784,7 +789,7 @@ fn synthesize_import_functions( { let ops_ro = builder.body.instructions.get_ops(); for (idx, op) in ops_ro.iter().enumerate() { - if let Operator::I32Const { value } = op { + if let wirm::wasmparser::Operator::I32Const { value } = op { // we specifically need the const "around" 3393 // which is the coreabi_sample_i32 table offset if *value < 1000 || *value > 5000 { @@ -795,7 +800,8 @@ fn synthesize_import_functions( // in the base computation. let mut base = *value; if idx > 0 - && let Operator::GlobalGet { global_index } = &ops_ro[idx - 1] + && let wirm::wasmparser::Operator::GlobalGet { global_index } = + &ops_ro[idx - 1] && let GlobalKind::Local(local_global) = module.globals.get_kind(GlobalID(*global_index)) && let [InitInstr::Value(Value::I32(v))] = @@ -813,25 +819,25 @@ fn synthesize_import_functions( builder.inject_at( table_instr_idx, InstrumentationMode::Before, - Operator::LocalGet { + wirm::wasmparser::Operator::LocalGet { local_index: *idx_local, }, ); builder.inject_at( table_instr_idx + 1, InstrumentationMode::Before, - Operator::I32Add, + wirm::wasmparser::Operator::I32Add, ); if delta != 0 { + builder.body.instructions.add_instr( + table_instr_idx, + wirm::wasmparser::Operator::I32Const { value: delta }, + ); builder .body .instructions - .add_instr(table_instr_idx, Operator::I32Const { value: delta }); - builder - .body - .instructions - .add_instr(table_instr_idx, Operator::I32Add); + .add_instr(table_instr_idx, wirm::wasmparser::Operator::I32Add); } } @@ -942,7 +948,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] func.local_get(args[idx]); match param { CoreTy::I32 => { - func.i32_store(MemArg { + func.i32_store(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset, @@ -951,7 +957,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 4; } CoreTy::I64 => { - func.i64_store(MemArg { + func.i64_store(wirm::wasmparser::MemArg { align: 3, offset, memory, @@ -960,7 +966,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 8; } CoreTy::F32 => { - func.f32_store(MemArg { + func.f32_store(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset, @@ -969,7 +975,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 4; } CoreTy::F64 => { - func.f64_store(MemArg { + func.f64_store(wirm::wasmparser::MemArg { align: 3, offset, memory, @@ -997,7 +1003,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] // value type from the retptr match expt_sig.ret.unwrap() { CoreTy::I32 => { - func.i32_load(MemArg { + func.i32_load(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset: 0, @@ -1005,7 +1011,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::I64 => { - func.i64_load(MemArg { + func.i64_load(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -1013,7 +1019,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::F32 => { - func.f32_load(MemArg { + func.f32_load(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset: 0, @@ -1021,7 +1027,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::F64 => { - func.f64_load(MemArg { + func.f64_load(wirm::wasmparser::MemArg { align: 3, offset: 0, memory, diff --git a/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs b/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs index 535b15c1..e7364091 100644 --- a/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs +++ b/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs @@ -2,8 +2,7 @@ use std::collections::HashSet; use std::path::PathBuf; use std::time::{SystemTime, UNIX_EPOCH}; -use anyhow::{Result, bail}; -use wasmparser::{MemArg, TypeRef}; +use anyhow::{Context as _, Result, bail}; use wirm::ir::function::FunctionBuilder; use wirm::ir::id::{FunctionID, LocalID}; use wirm::ir::module::module_functions::FuncKind; @@ -32,7 +31,7 @@ where continue; }; - let TypeRef::Func(_) = module.imports.get(iid).ty else { + let wirm::wasmparser::TypeRef::Func(_) = module.imports.get(iid).ty else { bail!("'{full_import}#{name}' is not a function.") }; let fid: FunctionID = FunctionID(*iid); @@ -44,10 +43,17 @@ where }; let ty = module.types.get(ty_id).unwrap(); - let mut builder = FunctionBuilder::new(ty.params().as_slice(), ty.results().as_slice()); + let mut builder = FunctionBuilder::new( + ty.params() + .with_context(|| format!("failed to retrieve params for '{full_import}#{name}'"))? + .as_slice(), + ty.results() + .with_context(|| format!("failed to retrieve results for '{full_import}#{name}'"))? + .as_slice(), + ); let _args = stub(&mut builder)?; - builder.replace_import_in_module(module, iid); + builder.replace_import_in_module(module, iid)?; return Ok(Some(fid)); } @@ -68,7 +74,7 @@ where return Ok(None); }; - let TypeRef::Func(_) = module.imports.get(iid).ty else { + let wirm::wasmparser::TypeRef::Func(_) = module.imports.get(iid).ty else { bail!("'{import}#{name}' is not a function.") }; let fid: FunctionID = FunctionID(*iid); @@ -80,11 +86,18 @@ where }; let ty = module.types.get(ty_id).unwrap(); - let (params, results) = (ty.params().to_vec(), ty.results().to_vec()); + let (params, results) = ( + ty.params() + .with_context(|| format!("failed to retrieve params for '{import}#{name}'"))? + .to_vec(), + ty.results() + .with_context(|| format!("failed to retrieve results for '{import}#{name}'"))? + .to_vec(), + ); let mut builder = FunctionBuilder::new(params.as_slice(), results.as_slice()); let _args = stub(&mut builder)?; - builder.replace_import_in_module(module, iid); + builder.replace_import_in_module(module, iid)?; Ok(Some(fid)) } @@ -111,7 +124,7 @@ pub fn stub_wasi( parse_wit(PathBuf::from(wit_path.unwrap()))? }; - let world = resolve.select_world(ids, world_name.as_deref())?; + let world = resolve.select_world(&[ids], world_name.as_deref())?; let target_world = &resolve.worlds[world]; let mut target_world_imports = HashSet::new(); @@ -120,7 +133,7 @@ pub fn stub_wasi( target_world_imports.insert(resolve.name_canonicalized_world_key(key)); } - let mut module = Module::parse(wasm.as_slice(), false).unwrap(); + let mut module = Module::parse(wasm.as_slice(), false, false).unwrap(); stub_preview1(&mut module)?; @@ -169,7 +182,10 @@ pub fn stub_wasi( } stub_sockets(&mut module, &target_world_imports)?; - Ok(module.encode()) + let encoded = module + .encode() + .context("failed to encode module during stub")?; + Ok(encoded) } fn target_world_requires_io(target_world_imports: &HashSet) -> bool { @@ -242,7 +258,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.local_get(num_bytes); body.i32_wrap_i64(); body.i32_const(3); - body.i32_shr_unsigned(); + body.i32_shr_u(); body.i32_const(3); body.i32_shl(); body.i32_const(8); @@ -253,7 +269,7 @@ fn stub_random(module: &mut Module) -> Result<()> { // *retptr = outptr // *retptr + 1 = len - body.i32_store(MemArg { + body.i32_store(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset: 0, @@ -263,7 +279,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.local_get(retptr); body.local_get(num_bytes); body.i32_wrap_i64(); - body.i32_store(MemArg { + body.i32_store(wirm::wasmparser::MemArg { align: 2, max_align: 0, offset: 4, @@ -278,7 +294,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.loop_stmt(BlockType::Empty); body.local_get(curptr); body.call(random_u64); - body.i64_store(MemArg { + body.i64_store(wirm::wasmparser::MemArg { align: 3, max_align: 0, offset: 0, @@ -292,7 +308,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.i32_sub(); body.local_get(num_bytes); body.i32_wrap_i64(); - body.i32_lt_unsigned(); + body.i32_lt_u(); body.br_if(0); body.end(); // This is for the loop Ok(vec![num_bytes, retptr]) @@ -335,7 +351,7 @@ fn stub_clocks(module: &mut Module) -> Result<()> { body.local_get(time_ptr); body.local_get(time_ptr); body.i64_const(i64::try_from(unix_time.as_nanos())?); - body.i64_store(MemArg { + body.i64_store(wirm::wasmparser::MemArg { align: 3, offset: 0, max_align: 0, From bdb5c2915779865520f3460385ec5d31dfd099c4 Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Sat, 16 May 2026 09:36:40 +0900 Subject: [PATCH 2/3] chore: update wirm to 5.0.0 This updates wirm to 5.0.0 to re-enable the custom section deleting functionality --- Cargo.lock | 4 +- Cargo.toml | 2 +- .../src/bindgen.rs | 3 +- .../src/splice.rs | 65 ++++++++++--------- .../src/stub_wasi.rs | 13 ++-- package-lock.json | 4 +- 6 files changed, 50 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93f8a83f..b32af0ed 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -959,9 +959,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "wirm" -version = "4.0.6" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3398cfb47e9ac60f209294450b58f9577ba3019e299da09e9b1efeeba726930a" +checksum = "8da24f7393e7008c1b2102f4d69340d388a6687a0e687a77fedaa440dbec1286" dependencies = [ "log", "paste", diff --git a/Cargo.toml b/Cargo.toml index 4ccbcb4d..5ea08336 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ anyhow = { version = "1.0.95", default-features = false } heck = { version = "0.5", default-features = false } rand = { version = "0.8", default-features = false } serde_json = { version = "1.0", default-features = false, features = ["alloc"] } -wirm = { version = "4.0.6", default-features = false } +wirm = { version = "5.0.0", default-features = false } wasm-encoder = { version = "0.245.1", features = ["component-model", "std"] } wasmparser = { version = "0.245.1", features = [ diff --git a/crates/spidermonkey-embedding-splicer/src/bindgen.rs b/crates/spidermonkey-embedding-splicer/src/bindgen.rs index ae8f983f..b5148d5e 100644 --- a/crates/spidermonkey-embedding-splicer/src/bindgen.rs +++ b/crates/spidermonkey-embedding-splicer/src/bindgen.rs @@ -17,6 +17,7 @@ use wit_bindgen_core::wit_parser::{ WorldId, WorldItem, }; use wit_component::StringEncoding; +use wit_parser::Param; use wit_parser::abi::WasmType; use wit_parser::abi::{AbiVariant, WasmSignature}; @@ -771,7 +772,7 @@ impl JsBindgen<'_> { fn create_resource_map(&self, func: &Function) -> ResourceMap { let mut resource_map = BTreeMap::new(); - for wit_parser::Param { ty, .. } in func.params.iter() { + for Param { ty, .. } in func.params.iter() { self.iter_resources(ty, &mut resource_map); } if let Some(ty) = func.result { diff --git a/crates/spidermonkey-embedding-splicer/src/splice.rs b/crates/spidermonkey-embedding-splicer/src/splice.rs index feb5da0c..63592041 100644 --- a/crates/spidermonkey-embedding-splicer/src/splice.rs +++ b/crates/spidermonkey-embedding-splicer/src/splice.rs @@ -9,8 +9,7 @@ use wirm::ir::module::module_globals::GlobalKind; use wirm::ir::types::{BlockType, ElementItems, InitInstr, InstrumentationMode, Value}; use wirm::module_builder::AddLocal; use wirm::opcode::{Inject, InjectAt}; -use wirm::wasmparser::MemArg; -use wirm::wasmparser::Operator; +use wirm::wasmparser::{ExternalKind, MemArg, Operator}; use wirm::{DataType, Opcode}; use wit_component::StringEncoding; use wit_component::metadata::{Bindgen, decode}; @@ -356,6 +355,15 @@ pub fn splice( ); } + // we reencode the WASI world component data, so strip it out from the + // custom section + let maybe_component_section_id = module + .custom_sections + .get_id("component-type:bindings".to_string()); + if let Some(component_section_id) = maybe_component_section_id { + module.delete_custom_section(component_section_id); + } + // Extract the native instructions from sample functions // then inline the imported functions and main import gating function // (erasing sample functions in the process) @@ -403,7 +411,7 @@ fn get_export_fid(module: &Module, expt_id: &ExportsID) -> FunctionID { let expt = module.exports.get_by_id(*expt_id).unwrap(); match expt.kind { - wirm::wasmparser::ExternalKind::Func => FunctionID::from(expt.index), + ExternalKind::Func => FunctionID::from(expt.index), _ => panic!("Missing coreabi_get_import"), } } @@ -472,7 +480,7 @@ fn synthesize_import_functions( .unwrap(); // Sets the return value on args from the stack - let args_ret_i32: Vec = vec![ + let args_ret_i32: Vec = vec![ Operator::I64ExtendI32U, Operator::I64Const { value: -545460846592, @@ -585,7 +593,7 @@ fn synthesize_import_functions( func.i32_add(); match arg { CoreTy::I32 => { - func.i64_load(wirm::wasmparser::MemArg { + func.i64_load(MemArg { align: 3, max_align: 0, offset: 0, @@ -598,7 +606,7 @@ fn synthesize_import_functions( } CoreTy::F32 => { // isInt: (r.asRawBits() >> 32) == 0xFFFFFF81 - func.i64_load(wirm::wasmparser::MemArg { + func.i64_load(MemArg { align: 3, max_align: 0, offset: 0, @@ -621,7 +629,7 @@ fn synthesize_import_functions( } CoreTy::F64 => { // isInt: (r.asRawBits() >> 32) == 0xFFFFFF81 - func.i64_load(wirm::wasmparser::MemArg { + func.i64_load(MemArg { align: 3, max_align: 0, offset: 0, @@ -687,7 +695,7 @@ fn synthesize_import_functions( func.i64_extend_i32_u(); func.i64_const(-511101108224); func.i64_or(); - func.i64_store(wirm::wasmparser::MemArg { + func.i64_store(MemArg { align: 3, max_align: 0, offset: 0, @@ -696,7 +704,7 @@ fn synthesize_import_functions( } Some(CoreTy::F32) => { func.f64_promote_f32(); - func.f64_store(wirm::wasmparser::MemArg { + func.f64_store(MemArg { align: 3, max_align: 0, offset: 0, @@ -704,7 +712,7 @@ fn synthesize_import_functions( }); } Some(CoreTy::F64) => { - func.f64_store(wirm::wasmparser::MemArg { + func.f64_store(MemArg { align: 3, max_align: 0, offset: 0, @@ -776,7 +784,7 @@ fn synthesize_import_functions( builder.inject_at( 0, InstrumentationMode::Before, - wirm::wasmparser::Operator::LocalSet { + Operator::LocalSet { local_index: *idx_local, }, ); @@ -789,7 +797,7 @@ fn synthesize_import_functions( { let ops_ro = builder.body.instructions.get_ops(); for (idx, op) in ops_ro.iter().enumerate() { - if let wirm::wasmparser::Operator::I32Const { value } = op { + if let Operator::I32Const { value } = op { // we specifically need the const "around" 3393 // which is the coreabi_sample_i32 table offset if *value < 1000 || *value > 5000 { @@ -800,8 +808,7 @@ fn synthesize_import_functions( // in the base computation. let mut base = *value; if idx > 0 - && let wirm::wasmparser::Operator::GlobalGet { global_index } = - &ops_ro[idx - 1] + && let Operator::GlobalGet { global_index } = &ops_ro[idx - 1] && let GlobalKind::Local(local_global) = module.globals.get_kind(GlobalID(*global_index)) && let [InitInstr::Value(Value::I32(v))] = @@ -819,25 +826,25 @@ fn synthesize_import_functions( builder.inject_at( table_instr_idx, InstrumentationMode::Before, - wirm::wasmparser::Operator::LocalGet { + Operator::LocalGet { local_index: *idx_local, }, ); builder.inject_at( table_instr_idx + 1, InstrumentationMode::Before, - wirm::wasmparser::Operator::I32Add, + Operator::I32Add, ); if delta != 0 { - builder.body.instructions.add_instr( - table_instr_idx, - wirm::wasmparser::Operator::I32Const { value: delta }, - ); builder .body .instructions - .add_instr(table_instr_idx, wirm::wasmparser::Operator::I32Add); + .add_instr(table_instr_idx, Operator::I32Const { value: delta }); + builder + .body + .instructions + .add_instr(table_instr_idx, Operator::I32Add); } } @@ -948,7 +955,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] func.local_get(args[idx]); match param { CoreTy::I32 => { - func.i32_store(wirm::wasmparser::MemArg { + func.i32_store(MemArg { align: 2, max_align: 0, offset, @@ -957,7 +964,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 4; } CoreTy::I64 => { - func.i64_store(wirm::wasmparser::MemArg { + func.i64_store(MemArg { align: 3, offset, memory, @@ -966,7 +973,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 8; } CoreTy::F32 => { - func.f32_store(wirm::wasmparser::MemArg { + func.f32_store(MemArg { align: 2, max_align: 0, offset, @@ -975,7 +982,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] offset += 4; } CoreTy::F64 => { - func.f64_store(wirm::wasmparser::MemArg { + func.f64_store(MemArg { align: 3, offset, memory, @@ -1003,7 +1010,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] // value type from the retptr match expt_sig.ret.unwrap() { CoreTy::I32 => { - func.i32_load(wirm::wasmparser::MemArg { + func.i32_load(MemArg { align: 2, max_align: 0, offset: 0, @@ -1011,7 +1018,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::I64 => { - func.i64_load(wirm::wasmparser::MemArg { + func.i64_load(MemArg { align: 3, max_align: 0, offset: 0, @@ -1019,7 +1026,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::F32 => { - func.f32_load(wirm::wasmparser::MemArg { + func.f32_load(MemArg { align: 2, max_align: 0, offset: 0, @@ -1027,7 +1034,7 @@ fn synthesize_export_functions(module: &mut Module, exports: &[(String, CoreFn)] }); } CoreTy::F64 => { - func.f64_load(wirm::wasmparser::MemArg { + func.f64_load(MemArg { align: 3, offset: 0, memory, diff --git a/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs b/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs index e7364091..9dcb7bf0 100644 --- a/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs +++ b/crates/spidermonkey-embedding-splicer/src/stub_wasi.rs @@ -8,6 +8,7 @@ use wirm::ir::id::{FunctionID, LocalID}; use wirm::ir::module::module_functions::FuncKind; use wirm::ir::types::{BlockType, InitExpr, Value}; use wirm::module_builder::AddLocal; +use wirm::wasmparser::{MemArg, TypeRef}; use wirm::{DataType, InitInstr, Module, Opcode}; use wit_parser::Resolve; @@ -31,7 +32,7 @@ where continue; }; - let wirm::wasmparser::TypeRef::Func(_) = module.imports.get(iid).ty else { + let TypeRef::Func(_) = module.imports.get(iid).ty else { bail!("'{full_import}#{name}' is not a function.") }; let fid: FunctionID = FunctionID(*iid); @@ -74,7 +75,7 @@ where return Ok(None); }; - let wirm::wasmparser::TypeRef::Func(_) = module.imports.get(iid).ty else { + let TypeRef::Func(_) = module.imports.get(iid).ty else { bail!("'{import}#{name}' is not a function.") }; let fid: FunctionID = FunctionID(*iid); @@ -269,7 +270,7 @@ fn stub_random(module: &mut Module) -> Result<()> { // *retptr = outptr // *retptr + 1 = len - body.i32_store(wirm::wasmparser::MemArg { + body.i32_store(MemArg { align: 2, max_align: 0, offset: 0, @@ -279,7 +280,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.local_get(retptr); body.local_get(num_bytes); body.i32_wrap_i64(); - body.i32_store(wirm::wasmparser::MemArg { + body.i32_store(MemArg { align: 2, max_align: 0, offset: 4, @@ -294,7 +295,7 @@ fn stub_random(module: &mut Module) -> Result<()> { body.loop_stmt(BlockType::Empty); body.local_get(curptr); body.call(random_u64); - body.i64_store(wirm::wasmparser::MemArg { + body.i64_store(MemArg { align: 3, max_align: 0, offset: 0, @@ -351,7 +352,7 @@ fn stub_clocks(module: &mut Module) -> Result<()> { body.local_get(time_ptr); body.local_get(time_ptr); body.i64_const(i64::try_from(unix_time.as_nanos())?); - body.i64_store(wirm::wasmparser::MemArg { + body.i64_store(MemArg { align: 3, offset: 0, max_align: 0, diff --git a/package-lock.json b/package-lock.json index b8af5540..5ad607e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@bytecodealliance/componentize-js", - "version": "0.20.0-rc.0", + "version": "0.20.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bytecodealliance/componentize-js", - "version": "0.20.0-rc.0", + "version": "0.20.0", "workspaces": [ "." ], From f1d07f973036ac5578f9f7201a7ca6572043c6ab Mon Sep 17 00:00:00 2001 From: Victor Adossi Date: Mon, 18 May 2026 23:53:02 +0900 Subject: [PATCH 3/3] test: increase CI timeout --- test/vitest.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vitest.ts b/test/vitest.ts index 65fc3b8a..2933196d 100644 --- a/test/vitest.ts +++ b/test/vitest.ts @@ -6,7 +6,7 @@ import { defineConfig } from 'vitest/config'; * * This issues primarily happen in CI and not locally on a sufficiently powerful machine. */ -const TIMEOUT_MS = process.env.CI ? 240_000 : 120_000; +const TIMEOUT_MS = process.env.CI ? 480_000 : 120_000; const REPORTERS = process.env.GITHUB_ACTIONS ? ['verbose', 'github-actions']