diff --git a/Cargo.lock b/Cargo.lock index 1e577f817..f9b03e5ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "once_cell", @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "atty" @@ -46,6 +46,15 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -58,6 +67,12 @@ version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +[[package]] +name = "bumpalo" +version = "3.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c764d619ca78fccbf3069b37bd7af92577f044bb15236036662d79b6559f25b7" + [[package]] name = "cfg-if" version = "1.0.0" @@ -81,9 +96,9 @@ dependencies = [ [[package]] name = "cranelift-entity" -version = "0.104.0" +version = "0.105.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177b6f94ae8de6348eb45bf977c79ab9e3c40fc3ac8cb7ed8109560ea39bee7d" +checksum = "dfd988176a86d6985dd75ac0762033b36d134c4af8b806b605e8542c489fe1c2" dependencies = [ "serde", "serde_derive", @@ -91,9 +106,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -171,9 +186,9 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown", @@ -203,10 +218,10 @@ dependencies = [ "base64", "heck 0.4.1", "indexmap", - "wasm-encoder 0.40.0", + "wasm-encoder 0.200.0", "wasmtime-environ", "wit-bindgen-core", - "wit-component 0.20.0", + "wit-component", "wit-parser", ] @@ -235,9 +250,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "log" @@ -359,41 +374,41 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa", "ryu", @@ -464,9 +479,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "74f1bdc9872430ce9b75da68329d1c1746faf50ffac5f19e02b71e37ff881ffb" dependencies = [ "proc-macro2", "quote", @@ -500,22 +515,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] [[package]] @@ -526,9 +541,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" @@ -556,27 +571,27 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "wasm-encoder" -version = "0.38.1" +version = "0.41.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.40.0" +version = "0.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d162eb64168969ae90e8668ca0593b0e47667e315aa08e717a9c9574d700d826" +checksum = "b9e3fb0c8fbddd78aa6095b850dfeedbc7506cf5f81e633f69cf8f2333ab84b9" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.16" +version = "0.10.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b313e616ef69d1b4c64155451439db26d1923e8bbc13d451ec24cf14579632e" +checksum = "18ebaa7bd0f9e7a5e5dd29b9a998acf21c4abed74265524dd7e85934597bfb10" dependencies = [ "anyhow", "indexmap", @@ -584,8 +599,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.40.0", - "wasmparser 0.120.0", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", ] [[package]] @@ -593,31 +608,32 @@ name = "wasm-tools-js" version = "0.1.0" dependencies = [ "anyhow", - "wasm-encoder 0.40.0", + "wasm-encoder 0.200.0", "wasm-metadata", - "wasmparser 0.120.0", - "wasmprinter", + "wasmparser 0.200.0", + "wasmprinter 0.200.0", "wat", "wit-bindgen", - "wit-component 0.20.0", + "wit-component", "wit-parser", ] [[package]] name = "wasmparser" -version = "0.118.1" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ + "bitflags 2.4.2", "indexmap", "semver", ] [[package]] name = "wasmparser" -version = "0.120.0" +version = "0.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9148127f39cbffe43efee8d5442b16ecdba21567785268daa1ec9e134389705" +checksum = "a03f65ac876612140c57ff6c3b8fe4990067cce97c2cfdb07368a3cc3354b062" dependencies = [ "bitflags 2.4.2", "indexmap", @@ -626,27 +642,38 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.2.77" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" +dependencies = [ + "anyhow", + "wasmparser 0.121.2", +] + +[[package]] +name = "wasmprinter" +version = "0.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8389a95eb0b3165fea0537a6988960cc23a33d9be650e63fc3d63065fe20dcb" +checksum = "2bd153b0dce4e727565ccb3bd41b0bd2b62b2b9b6b1057d1cdb7fe8e0f3e06ab" dependencies = [ "anyhow", - "wasmparser 0.120.0", + "wasmparser 0.200.0", ] [[package]] name = "wasmtime-component-util" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0a160c0c44369aa4bee6d311a8e4366943bab1651040cc8b0fcec2c9eb8906" +checksum = "46cfc42a79a53273366298c0388b77e7217ae21e5bda86696c15c9634ac967e5" [[package]] name = "wasmtime-environ" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a056b041fdea604f0972e2fae97958e7748d629a55180228348baefdfc217" +checksum = "e33dc65ef6dc1044219e75b60c4c2813d287653a2f82b940105554dcdbf36226" dependencies = [ "anyhow", + "bincode", "cranelift-entity", "gimli", "indexmap", @@ -656,43 +683,44 @@ dependencies = [ "serde_derive", "target-lexicon", "thiserror", - "wasm-encoder 0.38.1", - "wasmparser 0.118.1", - "wasmprinter", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", + "wasmprinter 0.2.80", "wasmtime-component-util", "wasmtime-types", ] [[package]] name = "wasmtime-types" -version = "17.0.0" +version = "18.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b35a95cdc1433729085beab42c0a5c742b431f25b17c40d7718e46df63d5ffc7" +checksum = "33873067c517b4ba7e944cfffce1c30a7cc5e74008f69ac4c08e9608b71c9b63" dependencies = [ "cranelift-entity", "serde", "serde_derive", "thiserror", - "wasmparser 0.118.1", + "wasmparser 0.121.2", ] [[package]] name = "wast" -version = "70.0.1" +version = "200.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5d415036fe747a32b30c76c8bd6c73f69b7705fb7ebca5f16e852eef0c95802" +checksum = "d1810d14e6b03ebb8fb05eef4009ad5749c989b65197d83bce7de7172ed91366" dependencies = [ + "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.40.0", + "wasm-encoder 0.200.0", ] [[package]] name = "wat" -version = "1.0.84" +version = "1.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8241f34599d413d2243a21015ab43aef68bfb32a0e447c54eef8d423525ca15e" +checksum = "776cbd10e217f83869beaa3f40e312bb9e91d5eee29bbf6f560db1261b6a4c3d" dependencies = [ "wast", ] @@ -721,9 +749,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "wit-bindgen" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b76f1d099678b4f69402a421e888bbe71bf20320c2f3f3565d0e7484dbe5bc20" +checksum = "5408d742fcdf418b766f23b2393f0f4d9b10b72b7cd96d9525626943593e8cc0" dependencies = [ "bitflags 2.4.2", "wit-bindgen-rust-macro", @@ -731,67 +759,46 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75d55e1a488af2981fb0edac80d8d20a51ac36897a1bdef4abde33c29c1b6d0d" +checksum = "7146725463d08ccf9c6c5357a7a6c1fff96185d95d6e84e7c75c92e5b1273c93" dependencies = [ "anyhow", - "wit-component 0.18.2", "wit-parser", ] [[package]] name = "wit-bindgen-rust" -version = "0.16.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01ff9cae7bf5736750d94d91eb8a49f5e3a04aff1d1a3218287d9b2964510f8" +checksum = "eb5fefcf93ff2ea03c8fe9b9db2caee3096103c0e3cd62ed54f6f9493aa6b405" dependencies = [ "anyhow", "heck 0.4.1", "wasm-metadata", "wit-bindgen-core", - "wit-component 0.18.2", + "wit-component", ] [[package]] name = "wit-bindgen-rust-macro" -version = "0.16.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804a98e2538393d47aa7da65a7348116d6ff403b426665152b70a168c0146d49" +checksum = "ce4059a1adc671e4457f457cb638ed2f766a1a462bb7daa3b638c6fb1fda156e" dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", "wit-bindgen-core", "wit-bindgen-rust", - "wit-component 0.18.2", -] - -[[package]] -name = "wit-component" -version = "0.18.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a35a2a9992898c9d27f1664001860595a4bc99d32dd3599d547412e17d7e2" -dependencies = [ - "anyhow", - "bitflags 2.4.2", - "indexmap", - "log", - "serde", - "serde_derive", - "serde_json", - "wasm-encoder 0.38.1", - "wasm-metadata", - "wasmparser 0.118.1", - "wit-parser", ] [[package]] name = "wit-component" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fa6229817f3a3e4a7fafe02e063b5dc64b73b286fb0e0c14addbc0d47809c9b" +checksum = "be60cd1b2ff7919305301d0c27528d4867bd793afe890ba3837743da9655d91b" dependencies = [ "anyhow", "bitflags 2.4.2", @@ -800,18 +807,18 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.40.0", + "wasm-encoder 0.41.2", "wasm-metadata", - "wasmparser 0.120.0", + "wasmparser 0.121.2", "wat", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" +checksum = "1ee4ad7310367bf272507c0c8e0c74a80b4ed586b833f7c7ca0b7588f686f11a" dependencies = [ "anyhow", "id-arena", @@ -822,6 +829,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", + "wasmparser 0.121.2", ] [[package]] @@ -846,7 +854,7 @@ dependencies = [ "anyhow", "js-component-bindgen", "structopt", - "wit-component 0.20.0", + "wit-component", "xshell", ] @@ -867,5 +875,5 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.50", ] diff --git a/Cargo.toml b/Cargo.toml index 2d2d7ca39..994887de5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,16 +41,16 @@ indexmap = "2.1" js-component-bindgen = { path = "./crates/js-component-bindgen" } structopt = "0.3.26" tempdir = "0.3.7" -wasm-encoder = "0.40.0" -wasm-metadata = "0.10.16" -wasmparser = "0.120.0" -wasmprinter = "0.2.77" -wasmtime-environ = { version = "17.0.0", features = ["component-model"] } -wat = "1.0.84" -wit-bindgen = "0.16.0" -wit-bindgen-core = "0.16.0" -wit-component = { version = "0.20.0", features = ["dummy-module"] } -wit-parser = "0.13.1" +wasm-encoder = "0.200.0" +wasm-metadata = "0.10.20" +wasmparser = "0.200.0" +wasmprinter = "0.200.0" +wasmtime-environ = { version = "18.0.0", features = ["component-model"] } +wat = "1.200.0" +wit-bindgen = "0.18.0" +wit-bindgen-core = "0.18.0" +wit-component = { version = "0.21.0", features = ["dummy-module"] } +wit-parser = "0.14.0" xshell = "0.2.5" [dev-dependencies] diff --git a/crates/js-component-bindgen-component/src/lib.rs b/crates/js-component-bindgen-component/src/lib.rs index 872fcfe8b..67ce3ddea 100644 --- a/crates/js-component-bindgen-component/src/lib.rs +++ b/crates/js-component-bindgen-component/src/lib.rs @@ -90,7 +90,7 @@ impl Guest for JsComponentBindgenComponent { wasmtime_environ::component::Export::LiftedFunction { .. } => { ExportType::Function } - wasmtime_environ::component::Export::Instance(_) => { + wasmtime_environ::component::Export::Instance { .. } => { ExportType::Instance } _ => panic!("Unexpected export type"), diff --git a/crates/js-component-bindgen/src/core.rs b/crates/js-component-bindgen/src/core.rs index 899b79a8b..b279443d7 100644 --- a/crates/js-component-bindgen/src/core.rs +++ b/crates/js-component-bindgen/src/core.rs @@ -45,6 +45,9 @@ use wasmtime_environ::component::CoreDef; use wasmtime_environ::wasmparser; use wasmtime_environ::{EntityIndex, MemoryIndex, ModuleTranslation, PrimaryMap}; +fn unimplemented_try_table() -> wasm_encoder::Instruction<'static> { + unimplemented!() +} pub enum Translation<'a> { Normal(ModuleTranslation<'a>), Augmented { @@ -711,6 +714,7 @@ macro_rules! define_translate { (mk F32Const $v:ident) => (F32Const(f32::from_bits($v.bits()))); (mk F64Const $v:ident) => (F64Const(f64::from_bits($v.bits()))); (mk V128Const $v:ident) => (V128Const($v.i128())); + (mk TryTable $v:ident) => (unimplemented_try_table()); (mk MemoryGrow $($x:tt)*) => ({ if true { unimplemented!() } Nop }); @@ -753,6 +757,17 @@ macro_rules! define_translate { $arg.targets().map(|i| i.unwrap()).collect::>().into(), $arg.default(), )); + (map $self:ident $arg:ident try_table) => {$arg}; + (map $self:ident $arg:ident struct_type_index) => {$self.remap(Item::Type, $arg).unwrap()}; + (map $self:ident $arg:ident field_index) => {$arg}; + (map $self:ident $arg:ident array_type_index) => {$self.remap(Item::Type, $arg).unwrap()}; + (map $self:ident $arg:ident array_size) => {$arg}; + (map $self:ident $arg:ident array_data_index) => ($self.remap(Item::Data, $arg).unwrap()); + (map $self:ident $arg:ident array_elem_index) => ($self.remap(Item::Element, $arg).unwrap()); + (map $self:ident $arg:ident array_type_index_dst) => ($self.remap(Item::Type, $arg).unwrap()); + (map $self:ident $arg:ident array_type_index_src) => ($self.remap(Item::Type, $arg).unwrap()); + (map $self:ident $arg:ident from_ref_type) => ($self.refty(&$arg).unwrap()); + (map $self:ident $arg:ident to_ref_type) => ($self.refty(&$arg).unwrap()); } impl<'a> VisitOperator<'a> for Translator<'_, 'a> { @@ -761,7 +776,26 @@ impl<'a> VisitOperator<'a> for Translator<'_, 'a> { wasmparser::for_each_operator!(define_translate); } +#[derive(Debug, Hash, Eq, PartialEq, Copy, Clone)] +pub enum Item { + // Function, + // Table, + // Memory, + // Tag, + // Global, + Type, + Data, + Element, +} + impl Translator<'_, '_> { + fn remap(&mut self, item: Item, idx: u32) -> Result { + let _ = item; + Ok(idx) + } + fn refty(&mut self, _ty: &wasmparser::RefType) -> Result { + unimplemented!() + } fn blockty(&self, ty: wasmparser::BlockType) -> wasm_encoder::BlockType { match ty { wasmparser::BlockType::Empty => wasm_encoder::BlockType::Empty, diff --git a/crates/js-component-bindgen/src/lib.rs b/crates/js-component-bindgen/src/lib.rs index 160c9e877..c6173d0fd 100644 --- a/crates/js-component-bindgen/src/lib.rs +++ b/crates/js-component-bindgen/src/lib.rs @@ -113,7 +113,7 @@ pub fn transpile(component: &[u8], opts: TranspileOpts) -> Result Result>()?; - let types = types.finish(); + let types = types.finish(&PrimaryMap::new(), Vec::new(), Vec::new()); // Insert all core wasm modules into the generated `Files` which will // end up getting used in the `generate_instantiate` method. @@ -142,7 +142,7 @@ pub fn transpile(component: &[u8], opts: TranspileOpts) -> Result)> = Vec::new(); diff --git a/crates/js-component-bindgen/src/transpile_bindgen.rs b/crates/js-component-bindgen/src/transpile_bindgen.rs index 2207ef243..75556d49c 100644 --- a/crates/js-component-bindgen/src/transpile_bindgen.rs +++ b/crates/js-component-bindgen/src/transpile_bindgen.rs @@ -451,11 +451,11 @@ impl<'a> Instantiator<'a, '_> { match item { WorldItem::Interface(iface) => { let iface = &self.resolve.interfaces[*iface]; - let Export::Instance(instance) = &export else { + let Export::Instance { exports, .. } = &export else { unreachable!() }; for (ty_name, ty) in &iface.types { - match instance.get(ty_name).unwrap() { + match exports.get(ty_name).unwrap() { Export::Type(TypeDef::Resource(resource)) => { self.connect_resources(*ty, *resource, true); } @@ -466,7 +466,7 @@ impl<'a> Instantiator<'a, '_> { } } for (func_name, func) in &iface.functions { - let Export::LiftedFunction { ty, .. } = instance.get(func_name).unwrap() + let Export::LiftedFunction { ty, .. } = exports.get(func_name).unwrap() else { unreachable!() }; @@ -1539,12 +1539,12 @@ impl<'a> Instantiator<'a, '_> { ); } } - Export::Instance(iface) => { + Export::Instance { exports, .. } => { let id = match item { WorldItem::Interface(id) => *id, WorldItem::Function(_) | WorldItem::Type(_) => unreachable!(), }; - for (func_name, export) in iface { + for (func_name, export) in exports { let (def, options, _) = match export { Export::LiftedFunction { func, options, ty } => (func, options, ty), Export::Type(_) => continue, // ignored @@ -1566,7 +1566,7 @@ impl<'a> Instantiator<'a, '_> { } .to_string(); - self.export_bindgen(&local_name, def, options, func, export_name, true); + self.export_bindgen(&local_name, &def, &options, func, export_name, true); if let FunctionKind::Constructor(ty) | FunctionKind::Method(ty) @@ -1594,7 +1594,7 @@ impl<'a> Instantiator<'a, '_> { // This can't be tested at this time so leave it unimplemented Export::ModuleStatic(_) => unimplemented!(), - Export::ModuleImport(_) => unimplemented!(), + Export::ModuleImport { .. } => unimplemented!(), } } self.gen.esm_bindgen.populate_export_aliases(); diff --git a/test/api.js b/test/api.js index 3fde314bc..98345d0f2 100644 --- a/test/api.js +++ b/test/api.js @@ -145,7 +145,7 @@ export async function apiTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.20.0"], + ["wit-component", "0.21.0"], ["dummy-gen", "test"], ], ], @@ -186,7 +186,7 @@ export async function apiTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.20.0"], + ["wit-component", "0.21.0"], ["dummy-gen", "test"], ], ], diff --git a/test/cli.js b/test/cli.js index ce4203c2e..ad647168a 100644 --- a/test/cli.js +++ b/test/cli.js @@ -362,7 +362,7 @@ export async function cliTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.20.0"], + ["wit-component", "0.21.0"], ["dummy-gen", "test"], ], ],