diff --git a/Cargo.lock b/Cargo.lock index 00f8d3047..7e4f4166d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,12 +91,23 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "cranelift-bitset" +version = "0.110.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38a1dfc50dca188a15d938867c4400589530bcb0138f7022aae6d059d1d8c309" +dependencies = [ + "serde", + "serde_derive", +] + [[package]] name = "cranelift-entity" -version = "0.109.0" +version = "0.110.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8cfdc315e5d18997093e040a8d234bea1ac1e118a716d3e30f40d449e78207b" +checksum = "ea62eb109baec2247e1a6fa7b74c0f584b1e76e289cfd7017385b4b031fc8450" dependencies = [ + "cranelift-bitset", "serde", "serde_derive", ] @@ -223,7 +234,7 @@ dependencies = [ "anyhow", "base64", "heck 0.5.0", - "wasm-encoder 0.209.1", + "wasm-encoder 0.212.0", "wasmparser", "wasmtime-environ", "wit-bindgen-core", @@ -284,9 +295,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.1" +version = "0.36.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" +checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e" dependencies = [ "crc32fast", "hashbrown", @@ -321,6 +332,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "prettyplease" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" +dependencies = [ + "proc-macro2", + "syn 2.0.72", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -395,7 +416,7 @@ checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.72", ] [[package]] @@ -470,9 +491,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.71" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b146dcf730474b4bcd16c311627b31ede9ab149045db4d6088b3becaea046462" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -485,6 +506,15 @@ version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4873307b7c257eddcb50c9bedf158eb669578359fb28428bef438fec8e6ba7c2" +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "textwrap" version = "0.11.0" @@ -526,17 +556,18 @@ checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasm-encoder" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" dependencies = [ "leb128", + "wasmparser", ] [[package]] @@ -550,9 +581,9 @@ dependencies = [ [[package]] name = "wasm-metadata" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d32029ce424f6d3c2b39b4419fb45a0e2d84fb0751e0c0a32b7ce8bd5d97f46" +checksum = "8a1849fac257fd76c43268555e73d74848c8dff23975c238c2cbad61cffe5045" dependencies = [ "anyhow", "indexmap", @@ -560,7 +591,7 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.209.1", + "wasm-encoder 0.212.0", "wasmparser", ] @@ -569,7 +600,7 @@ name = "wasm-tools-js" version = "0.1.0" dependencies = [ "anyhow", - "wasm-encoder 0.209.1", + "wasm-encoder 0.212.0", "wasm-metadata", "wasmparser", "wasmprinter", @@ -581,9 +612,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" dependencies = [ "ahash", "bitflags 2.6.0", @@ -595,37 +626,40 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceca8ae6eaa8c7c87b33c25c53bdf299f8c2a764aee1179402ff7652ef3a6859" +checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" dependencies = [ "anyhow", + "termcolor", "wasmparser", ] [[package]] name = "wasmtime-component-util" -version = "22.0.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d2912c53d9054984b380dfbd7579f9c3681b2a73b903a56bd71a1c4f175f1e" +checksum = "2bd9555175ad59d13fd353c2a6d9bc92f47f3496fc2b92e84eaa9e6edf048f3c" [[package]] name = "wasmtime-environ" -version = "22.0.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f444e900e848b884d8a8a2949b6f5b92af642a3e663ff8fbe78731143a55be61" +checksum = "9e52faba13550fed76d5ffe75ec7cada73109b9324c4dabcaf18b3165107010d" dependencies = [ "anyhow", + "cranelift-bitset", "cranelift-entity", "gimli", "indexmap", "log", "object", "postcard", + "semver", "serde", "serde_derive", "target-lexicon", - "wasm-encoder 0.209.1", + "wasm-encoder 0.212.0", "wasmparser", "wasmprinter", "wasmtime-component-util", @@ -634,10 +668,11 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "22.0.0" +version = "23.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "412463e9000e14cf6856be48628d2213c20c153e29ffc22b036980c892ea6964" +checksum = "44a0fba5f60b030c635abafdcaf2e9ad883163676bd02a0f0ebaed9393453f28" dependencies = [ + "anyhow", "cranelift-entity", "serde", "serde_derive", @@ -704,17 +739,99 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +dependencies = [ + "windows-sys", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "wit-bindgen" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a84376ff4f74ed07674a1157c0bd19e6627ab01fc90952a27ccefb52a24530f0" +checksum = "fabce76bbb8938536c437da0c3e1d4dda9065453f72a68f797c0cb3d67356a28" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -722,9 +839,9 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d4706efb67fadfbbde77955b299b111dd096e6776d8c6561d92f6147941880" +checksum = "1b43fbdd3497c471bbfb6973b1fb9ffe6949f158248cb43171d6f1cf3de7eaa3" dependencies = [ "anyhow", "heck 0.5.0", @@ -733,22 +850,24 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c7526379ace8709ee9ab9f2bb50f112d95581063a59ef3097d9c10153886c9" +checksum = "75956ff0a04a87ca0526b07199ce3b9baee899f2e4723b5b63aa296ab172ec52" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "wit-bindgen-rust" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514295193d1a2f42e6a948cd7d9fd81e2b8fadc319667dcf19fd7aceaf2113a2" +checksum = "bf509c4ef97b18ec0218741c8318706ac30ff16bc1731f990319a42bbbcfe8e3" dependencies = [ "anyhow", "heck 0.5.0", "indexmap", + "prettyplease", + "syn 2.0.72", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -756,23 +875,24 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0409a3356ca02599aff78f717968fd7f12df4bf879f325e2a97b45c84c90fff" +checksum = "88d6f2e025e38395d71fc1bf064e581b2ad275ce322d6f8d87ddc5e76a7b8c42" dependencies = [ "anyhow", + "prettyplease", "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.72", "wit-bindgen-core", "wit-bindgen-rust", ] [[package]] name = "wit-component" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bb5b039f9cb03425e1d5a6e54b441ca4ca1b1d4fa6a0924db67a55168f99" +checksum = "8ed5b0f9fc3d6424787d2a49e1142bf954ae4f26ee891992c144f0cfd68c4b7f" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -781,7 +901,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.209.1", + "wasm-encoder 0.212.0", "wasm-metadata", "wasmparser", "wat", @@ -801,9 +921,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.209.1" +version = "0.212.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269" +checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" dependencies = [ "anyhow", "id-arena", @@ -870,5 +990,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.71", + "syn 2.0.72", ] diff --git a/Cargo.toml b/Cargo.toml index 34660f423..8ec675c51 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,19 +39,19 @@ base64 = "0.22.1" heck = "0.5.0" js-component-bindgen = { path = "./crates/js-component-bindgen" } structopt = "0.3.26" -wasm-encoder = "0.209.1" -wasm-metadata = "0.209.1" -wasmparser = "0.209.1" -wasmprinter = "0.209.1" -wasmtime-environ = { version = "22.0.0", features = [ +wasm-encoder = "0.212.0" +wasm-metadata = "0.212.0" +wasmparser = "0.212.0" +wasmprinter = "0.212.0" +wasmtime-environ = { version = "23.0.1", features = [ "component-model", "compile", ] } -wat = "1.209.1" -wit-bindgen = "0.26.0" -wit-bindgen-core = "0.26.0" -wit-component = { version = "0.209.1", features = ["dummy-module"] } -wit-parser = "0.209.1" +wat = "1.212.0" +wit-bindgen = "0.27.0" +wit-bindgen-core = "0.27.0" +wit-component = { version = "0.212.0", features = ["dummy-module"] } +wit-parser = "0.212.0" xshell = "0.2.6" [dev-dependencies] diff --git a/crates/js-component-bindgen-component/src/lib.rs b/crates/js-component-bindgen-component/src/lib.rs index 729167482..636dc2e31 100644 --- a/crates/js-component-bindgen-component/src/lib.rs +++ b/crates/js-component-bindgen-component/src/lib.rs @@ -1,11 +1,7 @@ use std::path::PathBuf; -use anyhow::{Context, Result}; -use js_component_bindgen::{ - generate_types, - source::wit_parser::{Resolve, UnresolvedPackage}, - transpile, -}; +use anyhow::Result; +use js_component_bindgen::{generate_types, source::wit_parser::Resolve, transpile}; /// Calls [`write!`] with the passed arguments and unwraps the result. /// @@ -117,26 +113,16 @@ impl Guest for JsComponentBindgenComponent { opts: TypeGenerationOptions, ) -> Result)>, String> { let mut resolve = Resolve::default(); - let id = match opts.wit { - Wit::Source(source) => { - let pkg = UnresolvedPackage::parse(&PathBuf::from(format!("{name}.wit")), &source) - .map_err(|e| e.to_string())?; - resolve.push(pkg).map_err(|e| e.to_string())? - } + let ids = match opts.wit { + Wit::Source(source) => resolve + .push_str(format!("{name}.wit"), &source) + .map_err(|e| e.to_string())?, Wit::Path(path) => { let path = PathBuf::from(path); if path.is_dir() { resolve.push_dir(&path).map_err(|e| e.to_string())?.0 } else { - let contents = std::fs::read(&path) - .with_context(|| format!("failed to read file {path:?}")) - .map_err(|e| e.to_string())?; - let text = match std::str::from_utf8(&contents) { - Ok(s) => s, - Err(_) => return Err("input file is not valid utf-8".into()), - }; - let pkg = UnresolvedPackage::parse(&path, text).map_err(|e| e.to_string())?; - resolve.push(pkg).map_err(|e| e.to_string())? + resolve.push_file(&path).map_err(|e| e.to_string())? } } Wit::Binary(_) => todo!(), @@ -144,7 +130,7 @@ impl Guest for JsComponentBindgenComponent { let world_string = opts.world.map(|world| world.to_string()); let world = resolve - .select_world(id, world_string.as_deref()) + .select_world(&ids, world_string.as_deref()) .map_err(|e| e.to_string())?; let opts = js_component_bindgen::TranspileOpts { diff --git a/crates/js-component-bindgen/src/core.rs b/crates/js-component-bindgen/src/core.rs index 732ff5c42..e02949a0b 100644 --- a/crates/js-component-bindgen/src/core.rs +++ b/crates/js-component-bindgen/src/core.rs @@ -79,7 +79,6 @@ pub enum AugmentedOp { I64Store, F32Store, F64Store, - MemorySize, } @@ -533,7 +532,7 @@ macro_rules! define_visit { (augment $self:ident I32Store16 $memarg:ident) => { $self.0.augment_op($memarg.memory, AugmentedOp::I32Store16); }; - (augment $self:ident MemorySize $mem:ident $byte:ident) => { + (augment $self:ident MemorySize $mem:ident) => { $self.0.augment_op($mem, AugmentedOp::MemorySize); }; @@ -672,7 +671,7 @@ macro_rules! define_translate { (translate $self:ident F64Store $memarg:ident) => {{ $self.augment(AugmentedOp::F64Store, F64Store, $memarg) }}; - (translate $self:ident MemorySize $mem:ident $byte:ident) => {{ + (translate $self:ident MemorySize $mem:ident) => {{ if $mem < 1 { $self.func.instruction(&MemorySize($mem)); } else { @@ -707,7 +706,7 @@ macro_rules! define_translate { CallIndirect { ty: $ty, table: $table } }); (mk ReturnCallIndirect $ty:ident $table:ident) => ( - ReturnCallIndirect { ty: $ty, table: $table } + ReturnCallIndirect { type_index: $ty, table_index: $table } ); (mk I32Const $v:ident) => (I32Const($v)); (mk I64Const $v:ident) => (I64Const($v)); diff --git a/crates/js-component-bindgen/src/lib.rs b/crates/js-component-bindgen/src/lib.rs index a04194a51..eef83e704 100644 --- a/crates/js-component-bindgen/src/lib.rs +++ b/crates/js-component-bindgen/src/lib.rs @@ -14,8 +14,7 @@ use anyhow::Result; use transpile_bindgen::transpile_bindgen; use anyhow::{bail, Context}; -use wasmtime_environ::component::Export; -use wasmtime_environ::component::{ComponentTypesBuilder, StaticModuleIndex}; +use wasmtime_environ::component::{ComponentTypesBuilder, Export, StaticModuleIndex}; use wasmtime_environ::wasmparser::Validator; use wasmtime_environ::{PrimaryMap, ScopeVec, Tunables}; use wit_component::DecodedWasm; @@ -81,7 +80,7 @@ pub fn generate_types( /// Outputs the file map and import and export metadata for the Transpilation #[cfg(feature = "transpile-bindgen")] pub fn transpile(component: &[u8], opts: TranspileOpts) -> Result { - use wasmtime_environ::component::Translator; + use wasmtime_environ::component::{Component, Translator}; let name = opts.name.clone(); let mut files = files::Files::default(); @@ -96,7 +95,7 @@ pub fn transpile(component: &[u8], opts: TranspileOpts) -> Result bail!("unexpected wit package as input"), + DecodedWasm::WitPackages(_, _) => bail!("unexpected wit package as input"), DecodedWasm::Component(resolve, world_id) => (resolve, world_id), }; @@ -128,7 +127,8 @@ pub fn transpile(component: &[u8], opts: TranspileOpts) -> Result>()?; - let types = types.finish(&PrimaryMap::new(), Vec::new(), Vec::new()); + let mut wasmtime_component = Component::default(); + let types = types.finish(&mut wasmtime_component); // Insert all core wasm modules into the generated `Files` which will // end up getting used in the `generate_instantiate` method. diff --git a/crates/js-component-bindgen/src/transpile_bindgen.rs b/crates/js-component-bindgen/src/transpile_bindgen.rs index 107e1a386..2e01fca9e 100644 --- a/crates/js-component-bindgen/src/transpile_bindgen.rs +++ b/crates/js-component-bindgen/src/transpile_bindgen.rs @@ -14,8 +14,7 @@ use std::cell::RefCell; use std::collections::{BTreeMap, BTreeSet, HashMap}; use std::fmt::Write; use std::mem; -use wasmparser::collections::IndexMap; -use wasmtime_environ::component::Transcode; +use wasmtime_environ::component::{ExportIndex, NameMap, NameMapNoIntern, Transcode}; use wasmtime_environ::{ component, component::{ @@ -192,11 +191,22 @@ pub fn transpile_bindgen( .iter() .map(|(export_name, canon_export_name)| { let export = if canon_export_name.contains(':') { - &instantiator.component.exports[*canon_export_name] + instantiator + .component + .exports + .get(canon_export_name, &NameMapNoIntern) + .unwrap() } else { - &instantiator.component.exports[&canon_export_name.to_kebab_case()] + instantiator + .component + .exports + .get(&canon_export_name.to_kebab_case(), &NameMapNoIntern) + .unwrap() }; - (export_name.to_string(), export.clone()) + ( + export_name.to_string(), + instantiator.component.export_items[*export].clone(), + ) }) .collect(); @@ -502,12 +512,13 @@ impl<'a> Instantiator<'a, '_> { self.exports_resource_types = self.imports_resource_types.clone(); for (key, item) in &self.resolve.worlds[self.world].exports { let name = &self.resolve.name_world_key(key); - let (_, export) = self + let (_, export_idx) = self .component .exports - .iter() + .raw_iter() .find(|(expt_name, _)| *expt_name == name) .unwrap(); + let export = &self.component.export_items[*export_idx]; match item { WorldItem::Interface { id, stability: _ } => { let iface = &self.resolve.interfaces[*id]; @@ -515,10 +526,12 @@ impl<'a> Instantiator<'a, '_> { unreachable!() }; for (ty_name, ty) in &iface.types { - match exports.get(ty_name).unwrap() { + match self.component.export_items + [*exports.get(ty_name, &NameMapNoIntern).unwrap()] + { Export::Type(TypeDef::Resource(resource)) => { let ty = crate::dealias(self.resolve, *ty); - let resource_idx = self.types[*resource].ty; + let resource_idx = self.types[resource].ty; self.exports_resource_types.insert(ty, resource_idx); } Export::Type(_) => {} @@ -1740,8 +1753,9 @@ impl<'a> Instantiator<'a, '_> { format!("exports{i}{}", maybe_quote_member(name)) } - fn exports(&mut self, exports: &IndexMap) { - for (export_name, export) in exports.iter() { + fn exports(&mut self, exports: &NameMap) { + for (export_name, export_idx) in exports.raw_iter() { + let export = &self.component.export_items[*export_idx]; let world_key = &self.exports[export_name]; let item = &self.resolve.worlds[self.world].exports[world_key]; let mut resource_map = ResourceMap::new(); @@ -1802,7 +1816,8 @@ impl<'a> Instantiator<'a, '_> { WorldItem::Interface { id, stability: _ } => *id, WorldItem::Function(_) | WorldItem::Type(_) => unreachable!(), }; - for (func_name, export) in exports { + for (func_name, export_idx) in exports.raw_iter() { + let export = &self.component.export_items[*export_idx]; let (def, options, func_ty) = match export { Export::LiftedFunction { func, options, ty } => (func, options, ty), Export::Type(_) => continue, // ignored @@ -1862,8 +1877,7 @@ impl<'a> Instantiator<'a, '_> { Export::Type(_) => {} // This can't be tested at this time so leave it unimplemented - Export::ModuleStatic(_) => unimplemented!(), - Export::ModuleImport { .. } => unimplemented!(), + Export::ModuleStatic { .. } | Export::ModuleImport { .. } => unimplemented!(), } } self.gen.esm_bindgen.populate_export_aliases(); diff --git a/crates/js-component-bindgen/src/ts_bindgen.rs b/crates/js-component-bindgen/src/ts_bindgen.rs index d42ec79c6..4333f6be3 100644 --- a/crates/js-component-bindgen/src/ts_bindgen.rs +++ b/crates/js-component-bindgen/src/ts_bindgen.rs @@ -426,16 +426,27 @@ impl TsBindgen { let local_name = local_name.to_upper_camel_case(); if !local_exists { - uwriteln!( - self.src, - "import {{ {} }} from './{}.js';", - if camel == local_name { - camel.to_string() - } else { - format!("{camel} as {local_name}") - }, - &file_name[0..file_name.len() - 5] - ); + // TypeScript doesn't work with empty namespaces, so we don't import in this case, + // just define them as empty. + let is_empty_interface = resolve.interfaces[id].functions.len() == 0 + && resolve.interfaces[id] + .types + .iter() + .all(|(_, ty)| !matches!(resolve.types[*ty].kind, TypeDefKind::Resource)); + if is_empty_interface { + uwriteln!(self.src, "declare const {local_name}: {{}};"); + } else { + uwriteln!( + self.src, + "import {{ {} }} from './{}.js';", + if camel == local_name { + camel.to_string() + } else { + format!("{camel} as {local_name}") + }, + &file_name[0..file_name.len() - 5] + ); + } } if iface_exists { @@ -445,6 +456,7 @@ impl TsBindgen { let mut gen = self.ts_interface(resolve, false); uwriteln!(gen.src, "export namespace {camel} {{"); + for (_, func) in resolve.interfaces[id].functions.iter() { gen.ts_func(func, false, true); } @@ -459,6 +471,7 @@ impl TsBindgen { } } } + uwriteln!(gen.src, "}}"); gen.types(id); diff --git a/crates/wasm-tools-component/src/lib.rs b/crates/wasm-tools-component/src/lib.rs index ca4878f2b..b8ca53521 100644 --- a/crates/wasm-tools-component/src/lib.rs +++ b/crates/wasm-tools-component/src/lib.rs @@ -4,7 +4,7 @@ use std::path::PathBuf; use wasm_encoder::{Encode, Section}; use wasm_metadata::Producers; use wit_component::{ComponentEncoder, DecodedWasm, WitPrinter}; -use wit_parser::{Resolve, UnresolvedPackage}; +use wit_parser::Resolve; use exports::local::wasm_tools::tools::{ EmbedOpts, Guest, ModuleMetaType, ModuleMetadata, ProducersFields, StringEncoding, @@ -58,12 +58,12 @@ impl Guest for WasmToolsJs { // let world = decode_world("component", &binary); let doc = match &decoded { - DecodedWasm::WitPackage(_resolve, _pkg) => panic!("Unexpected wit package"), + DecodedWasm::WitPackages(_resolve, _pkg) => panic!("Unexpected wit package"), DecodedWasm::Component(resolve, world) => resolve.worlds[*world].package.unwrap(), }; let output = WitPrinter::default() - .print(decoded.resolve(), doc) + .print(decoded.resolve(), &[doc]) .map_err(|e| format!("Unable to print wit\n${:?}", e))?; Ok(output) @@ -74,15 +74,15 @@ impl Guest for WasmToolsJs { let mut resolve = Resolve::default(); - let id = if let Some(wit_source) = &embed_opts.wit_source { + let ids = if let Some(wit_source) = &embed_opts.wit_source { let path = PathBuf::from("component.wit"); - let pkg = UnresolvedPackage::parse(&path, wit_source).map_err(|e| e.to_string())?; - resolve.push(pkg).map_err(|e| e.to_string())? + resolve + .push_str(&path, wit_source) + .map_err(|e| e.to_string())? } else { let wit_path = &PathBuf::from(embed_opts.wit_path.as_ref().unwrap()); if metadata(wit_path).unwrap().is_file() { - let pkg = UnresolvedPackage::parse_file(wit_path).map_err(|e| e.to_string())?; - resolve.push(pkg).map_err(|e| e.to_string())? + resolve.push_file(wit_path).map_err(|e| e.to_string())? } else { resolve.push_dir(wit_path).map_err(|e| e.to_string())?.0 } @@ -90,7 +90,7 @@ impl Guest for WasmToolsJs { let world_string = embed_opts.world.as_ref().map(|world| world.to_string()); let world = resolve - .select_world(id, world_string.as_deref()) + .select_world(&ids, world_string.as_deref()) .map_err(|e| e.to_string())?; let string_encoding = match &embed_opts.string_encoding { diff --git a/lib/wasi_snapshot_preview1.command.wasm b/lib/wasi_snapshot_preview1.command.wasm index d95abfaad..725429c23 100644 Binary files a/lib/wasi_snapshot_preview1.command.wasm and b/lib/wasi_snapshot_preview1.command.wasm differ diff --git a/lib/wasi_snapshot_preview1.reactor.wasm b/lib/wasi_snapshot_preview1.reactor.wasm index c822f8fa9..61be7cfce 100644 Binary files a/lib/wasi_snapshot_preview1.reactor.wasm and b/lib/wasi_snapshot_preview1.reactor.wasm differ diff --git a/package-lock.json b/package-lock.json index 45801ef19..baf3dd2fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ ], "dependencies": { "@bytecodealliance/preview2-shim": "^0.16.4", - "binaryen": "^116.0.0", + "binaryen": "^118.0.0", "chalk-template": "^1", "commander": "^12", "mkdirp": "^3", @@ -25,15 +25,15 @@ }, "devDependencies": { "@bytecodealliance/componentize-js": "^0.9.0", - "@types/node": "^18.11.17", - "@typescript-eslint/eslint-plugin": "^5.41.0", - "@typescript-eslint/parser": "^5.41.0", - "eslint": "^8.30.0", + "@types/node": "^20.14.12", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "eslint": "^8.56.0", "mime": "^4.0.4", - "mocha": "^10.2.0", - "puppeteer": "^22.13.0", + "mocha": "^10.7.0", + "puppeteer": "^22.14.0", "terser": "^5.16.1", - "typescript": "^5.3.3" + "typescript": "^5.5.4" } }, "node_modules/@babel/code-frame": { @@ -179,6 +179,16 @@ "jco": "src/jco.js" } }, + "node_modules/@bytecodealliance/jco/node_modules/binaryen": { + "version": "116.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-116.0.0.tgz", + "integrity": "sha512-Hp0dXC6Cb/rTwWEoUS2BRghObE7g/S9umKtxuTDt3f61G6fNTE/YVew/ezyy3IdHcLx3f17qfh6LwETgCfvWkQ==", + "dev": true, + "bin": { + "wasm-opt": "bin/wasm-opt", + "wasm2js": "bin/wasm2js" + } + }, "node_modules/@bytecodealliance/preview2-shim": { "resolved": "packages/preview2-shim", "link": true @@ -346,6 +356,28 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/eslintrc/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@eslint/eslintrc/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@eslint/js": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", @@ -370,6 +402,28 @@ "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/config-array/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/@humanwhocodes/config-array/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -484,16 +538,16 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.2.4.tgz", - "integrity": "sha512-BdG2qiI1dn89OTUUsx2GZSpUzW+DRffR1wlMJyKxVHYrhnKoELSDxDd+2XImUkuWPEKk76H5FcM/gPFrEK1Tfw==", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.3.0.tgz", + "integrity": "sha512-ioXoq9gPxkss4MYhD+SFaU9p1IHFUX0ILAWFPyjGaBdjLsYAlZw6j1iLA0N/m12uVHLFDfSYNF7EQccjinIMDA==", "dev": true, "dependencies": { "debug": "^4.3.5", "extract-zip": "^2.0.1", "progress": "^2.0.3", "proxy-agent": "^6.4.0", - "semver": "^7.6.2", + "semver": "^7.6.3", "tar-fs": "^3.0.6", "unbzip2-stream": "^1.4.3", "yargs": "^17.7.2" @@ -572,27 +626,15 @@ "integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==", "dev": true }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "node_modules/@types/node": { - "version": "18.19.40", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.40.tgz", - "integrity": "sha512-MIxieZHrm4Ee8XArBIc+Or9HINt2StOmCbgRcXGSJl8q14svRvkZPe7LJq9HKtTI1SK3wU8b91TjntUm7T69Pg==", + "version": "20.14.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.12.tgz", + "integrity": "sha512-r7wNXakLeSsGT0H1AU863vS2wa5wBOK4bWMjZz2wj+8nBx+m5PeIn0k8AloSLpRuiwdRQZwarZqHE4FNArPuJQ==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, - "node_modules/@types/semver": { - "version": "7.5.8", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", - "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", - "dev": true - }, "node_modules/@types/yauzl": { "version": "2.10.3", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz", @@ -604,32 +646,31 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", - "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.17.0.tgz", + "integrity": "sha512-pyiDhEuLM3PuANxH7uNYan1AaFs5XE0zw1hq69JBvGvE7gSuEoQl1ydtEe/XQeoC3GQxLXyOVa5kNOATgM638A==", "dev": true, "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.62.0", - "@typescript-eslint/type-utils": "5.62.0", - "@typescript-eslint/utils": "5.62.0", - "debug": "^4.3.4", + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.17.0", + "@typescript-eslint/type-utils": "7.17.0", + "@typescript-eslint/utils": "7.17.0", + "@typescript-eslint/visitor-keys": "7.17.0", "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -638,25 +679,26 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", - "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.17.0.tgz", + "integrity": "sha512-puiYfGeg5Ydop8eusb/Hy1k7QmOU6X3nvsqCgzrB2K4qMavK//21+PzNE8qeECgNOIoertJPUC1SpegHDI515A==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.62.0", - "@typescript-eslint/types": "5.62.0", - "@typescript-eslint/typescript-estree": "5.62.0", + "@typescript-eslint/scope-manager": "7.17.0", + "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/typescript-estree": "7.17.0", + "@typescript-eslint/visitor-keys": "7.17.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -665,16 +707,16 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", - "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.17.0.tgz", + "integrity": "sha512-0P2jTTqyxWp9HiKLu/Vemr2Rg1Xb5B7uHItdVZ6iAenXmPo4SZ86yOPCJwMqpCyaMiEHTNqizHfsbmCFT1x9SA==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.62.0", - "@typescript-eslint/visitor-keys": "5.62.0" + "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/visitor-keys": "7.17.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -682,25 +724,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", - "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.17.0.tgz", + "integrity": "sha512-XD3aaBt+orgkM/7Cei0XNEm1vwUxQ958AOLALzPlbPqb8C1G8PZK85tND7Jpe69Wualri81PLU+Zc48GVKIMMA==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.62.0", - "@typescript-eslint/utils": "5.62.0", + "@typescript-eslint/typescript-estree": "7.17.0", + "@typescript-eslint/utils": "7.17.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -709,12 +751,12 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", - "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.17.0.tgz", + "integrity": "sha512-a29Ir0EbyKTKHnZWbNsrc/gqfIBqYPwj3F2M+jWE/9bqfEHg0AMtXzkbUkOG6QgEScxh2+Pz9OXe11jHDnHR7A==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -722,21 +764,22 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.62.0.tgz", - "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.17.0.tgz", + "integrity": "sha512-72I3TGq93t2GoSBWI093wmKo0n6/b7O4j9o8U+f65TVD0FS6bI2180X5eGEr8MA8PhKMvYe9myZJquUT2JkCZw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.62.0", - "@typescript-eslint/visitor-keys": "5.62.0", + "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/visitor-keys": "7.17.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -749,42 +792,38 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.62.0.tgz", - "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.17.0.tgz", + "integrity": "sha512-r+JFlm5NdB+JXc7aWWZ3fKSm1gn0pkswEwIYsrGPdsT2GjsRATAKXiNtp3vgAAO1xZhX8alIOEQnNMl3kbTgJw==", "dev": true, "dependencies": { - "@eslint-community/eslint-utils": "^4.2.0", - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.62.0", - "@typescript-eslint/types": "5.62.0", - "@typescript-eslint/typescript-estree": "5.62.0", - "eslint-scope": "^5.1.1", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.17.0", + "@typescript-eslint/types": "7.17.0", + "@typescript-eslint/typescript-estree": "7.17.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.62.0.tgz", - "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "version": "7.17.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.17.0.tgz", + "integrity": "sha512-RVGC9UhPOCsfCdI9pU++K4nD7to+jTcMIbXTSOcrLqUEW6gF2pU1UUbYJKc9cvcRSK1UDeMJ7pdMxf4bhMpV/A==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.62.0", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "7.17.0", + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", @@ -1019,22 +1058,28 @@ } }, "node_modules/binaryen": { - "version": "116.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-116.0.0.tgz", - "integrity": "sha512-Hp0dXC6Cb/rTwWEoUS2BRghObE7g/S9umKtxuTDt3f61G6fNTE/YVew/ezyy3IdHcLx3f17qfh6LwETgCfvWkQ==", + "version": "118.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-118.0.0.tgz", + "integrity": "sha512-KzekjPjpLE1zk29BKQSHNWLSHPYAfa80lcsIi5bDnev8vyfDyiMCVFPjaplhfXIKs7LI3r1RPyhoAj4qsRQwwg==", "bin": { + "wasm-as": "bin/wasm-as", + "wasm-ctor-eval": "bin/wasm-ctor-eval", + "wasm-dis": "bin/wasm-dis", + "wasm-merge": "bin/wasm-merge", + "wasm-metadce": "bin/wasm-metadce", "wasm-opt": "bin/wasm-opt", + "wasm-reduce": "bin/wasm-reduce", + "wasm-shell": "bin/wasm-shell", "wasm2js": "bin/wasm2js" } }, "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", "dev": true, "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" + "balanced-match": "^1.0.0" } }, "node_modules/braces": { @@ -1177,9 +1222,9 @@ } }, "node_modules/chromium-bidi": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.1.tgz", - "integrity": "sha512-kSxJRj0VgtUKz6nmzc2JPfyfJGzwzt65u7PqhPHtgGQUZLF5oG+ST6l6e5ONfStUMAlhSutFCjaGKllXZa16jA==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-0.6.2.tgz", + "integrity": "sha512-4WVBa6ijmUTVr9cZD4eicQD8Mdy/HCX3bzEIYYpmk0glqYLoWH+LqQEvV9RpDRzoQSbY1KJHloYXbDMXMbDPhg==", "dev": true, "dependencies": { "mitt": "3.0.1", @@ -1377,9 +1422,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1299070", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1299070.tgz", - "integrity": "sha512-+qtL3eX50qsJ7c+qVyagqi7AWMoQCBGNfoyJZMwm/NSXVqLYbuitrWEEIzxfUmTNy7//Xe8yhMmQ+elj3uAqSg==", + "version": "0.0.1312386", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1312386.tgz", + "integrity": "sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==", "dev": true }, "node_modules/diff": { @@ -1495,15 +1540,6 @@ "source-map": "~0.6.1" } }, - "node_modules/escodegen/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/eslint": { "version": "8.57.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", @@ -1560,16 +1596,19 @@ } }, "node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", "dev": true, "dependencies": { "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "estraverse": "^5.2.0" }, "engines": { - "node": ">=8.0.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, "node_modules/eslint-visitor-keys": { @@ -1584,6 +1623,16 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/eslint/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/eslint/node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -1600,29 +1649,16 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/eslint/node_modules/eslint-scope": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", - "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "node_modules/eslint/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^5.2.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "brace-expansion": "^1.1.7" }, - "funding": { - "url": "https://opencollective.com/eslint" - } - }, - "node_modules/eslint/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, "engines": { - "node": ">=4.0" + "node": "*" } }, "node_modules/eslint/node_modules/supports-color": { @@ -1679,15 +1715,6 @@ "node": ">=0.10" } }, - "node_modules/esquery/node_modules/estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", @@ -1700,7 +1727,7 @@ "node": ">=4.0" } }, - "node_modules/esrecurse/node_modules/estraverse": { + "node_modules/estraverse": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", @@ -1709,15 +1736,6 @@ "node": ">=4.0" } }, - "node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -2002,15 +2020,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/glob/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -2510,15 +2519,18 @@ } }, "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", "dev": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/mitt": { @@ -2542,9 +2554,9 @@ } }, "node_modules/mocha": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.6.0.tgz", - "integrity": "sha512-hxjt4+EEB0SA0ZDygSS015t65lJw/I2yRCS3Ae+SJ5FrbzrXgfYwJr96f0OvIXdj7h4lv/vLCrH3rkiuizFSvw==", + "version": "10.7.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.7.0.tgz", + "integrity": "sha512-v8/rBWr2VO5YkspYINnvu81inSz2y3ODJrhO175/Exzor1RcEZZkizgE2A+w/CAXXoESS8Kys5E62dOHGHzULA==", "dev": true, "dependencies": { "ansi-colors": "^4.1.3", @@ -2576,15 +2588,6 @@ "node": ">= 14.0.0" } }, - "node_modules/mocha/node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/mocha/node_modules/minimatch": { "version": "5.1.6", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", @@ -2615,12 +2618,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/netmask": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz", @@ -2978,16 +2975,16 @@ } }, "node_modules/puppeteer": { - "version": "22.13.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.13.1.tgz", - "integrity": "sha512-PwXLDQK5u83Fm5A7TGMq+9BR7iHDJ8a3h21PSsh/E6VfhxiKYkU7+tvGZNSCap6k3pCNDd9oNteVBEctcBalmQ==", + "version": "22.14.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-22.14.0.tgz", + "integrity": "sha512-MGTR6/pM8zmWbTdazb6FKnwIihzsSEXBPH49mFFU96DNZpQOevCAZMnjBZGlZRGRzRK6aADCavR6SQtrbv5dQw==", "dev": true, "hasInstallScript": true, "dependencies": { - "@puppeteer/browsers": "2.2.4", + "@puppeteer/browsers": "2.3.0", "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1299070", - "puppeteer-core": "22.13.1" + "devtools-protocol": "0.0.1312386", + "puppeteer-core": "22.14.0" }, "bin": { "puppeteer": "lib/esm/puppeteer/node/cli.js" @@ -2997,15 +2994,15 @@ } }, "node_modules/puppeteer-core": { - "version": "22.13.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.13.1.tgz", - "integrity": "sha512-NmhnASYp51QPRCAf9n0OPxuPMmzkKd8+2sB9Q+BjwwCG25gz6iuNc3LQDWa+cH2tyivmJppLhNNFt6Q3HmoOpw==", + "version": "22.14.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-22.14.0.tgz", + "integrity": "sha512-rl4tOY5LcA3e374GAlsGGHc05HL3eGNf5rZ+uxkl6id9zVZKcwcp1Z+Nd6byb6WPiPeecT/dwz8f/iUm+AZQSw==", "dev": true, "dependencies": { - "@puppeteer/browsers": "2.2.4", - "chromium-bidi": "0.6.1", + "@puppeteer/browsers": "2.3.0", + "chromium-bidi": "0.6.2", "debug": "^4.3.5", - "devtools-protocol": "0.0.1299070", + "devtools-protocol": "0.0.1312386", "ws": "^8.18.0" }, "engines": { @@ -3118,6 +3115,16 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, "node_modules/rimraf/node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -3139,6 +3146,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -3488,31 +3507,22 @@ "node": ">=8.0" } }, - "node_modules/tslib": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", - "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", - "dev": true - }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, "engines": { - "node": ">= 6" + "node": ">=16" }, "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + "typescript": ">=4.2.0" } }, - "node_modules/tsutils/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "dev": true }, "node_modules/type-check": { @@ -3540,9 +3550,9 @@ } }, "node_modules/typescript": { - "version": "5.5.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.3.tgz", - "integrity": "sha512-/hreyEujaB0w76zKo6717l3L0o/qEUtRgdvUBvlkhoWeOVMjMuHNHk0BRBzikzuGDqNmPQbg5ifMEqsHLiIUcQ==", + "version": "5.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", + "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -3789,6 +3799,7 @@ } }, "packages/preview2-shim": { + "name": "@bytecodealliance/preview2-shim", "version": "0.16.4", "license": "(Apache-2.0 WITH LLVM-exception)", "devDependencies": { diff --git a/package.json b/package.json index 498a26461..540fec42f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "type": "module", "dependencies": { "@bytecodealliance/preview2-shim": "^0.16.4", - "binaryen": "^116.0.0", + "binaryen": "^118.0.0", "chalk-template": "^1", "commander": "^12", "mkdirp": "^3", @@ -34,15 +34,15 @@ }, "devDependencies": { "@bytecodealliance/componentize-js": "^0.9.0", - "@types/node": "^18.11.17", - "@typescript-eslint/eslint-plugin": "^5.41.0", - "@typescript-eslint/parser": "^5.41.0", - "eslint": "^8.30.0", + "@types/node": "^20.14.12", + "@typescript-eslint/eslint-plugin": "^7.17.0", + "@typescript-eslint/parser": "^7.17.0", + "eslint": "^8.56.0", "mime": "^4.0.4", - "mocha": "^10.2.0", - "puppeteer": "^22.13.0", + "mocha": "^10.7.0", + "puppeteer": "^22.14.0", "terser": "^5.16.1", - "typescript": "^5.3.3" + "typescript": "^5.5.4" }, "repository": { "type": "git", diff --git a/submodules/WASI-Virt b/submodules/WASI-Virt index 02de7b495..3da2d1810 160000 --- a/submodules/WASI-Virt +++ b/submodules/WASI-Virt @@ -1 +1 @@ -Subproject commit 02de7b495eba3f1bf786bf17cf2236b7277be7b0 +Subproject commit 3da2d1810db33278acaabf3c9191c952f6483a97 diff --git a/submodules/wasm-tools b/submodules/wasm-tools index 1cf71f9a9..fafea31f7 160000 --- a/submodules/wasm-tools +++ b/submodules/wasm-tools @@ -1 +1 @@ -Subproject commit 1cf71f9a9bbb4706e1e5d21ad2a12586a3911199 +Subproject commit fafea31f7f0250c051ca22ca346997bccc1ccdfb diff --git a/submodules/wit-bindgen b/submodules/wit-bindgen index 3452d7807..0977e2540 160000 --- a/submodules/wit-bindgen +++ b/submodules/wit-bindgen @@ -1 +1 @@ -Subproject commit 3452d7807716cd37b5400e2dced55651d13f65f9 +Subproject commit 0977e254014581e4f65de07b7b2df1d47c2e913b diff --git a/test/api.js b/test/api.js index 48ce96fc3..51794c9ec 100644 --- a/test/api.js +++ b/test/api.js @@ -24,7 +24,7 @@ export async function apiTest(fixtures) { `test/fixtures/components/${name}.component.wasm` ); const { files, imports, exports } = await transpile(component, { name }); - strictEqual(imports.length, 2); + strictEqual(imports.length, 4); strictEqual(exports.length, 3); deepStrictEqual(exports[0], ["test", "instance"]); ok(files[name + ".js"]); @@ -43,10 +43,10 @@ export async function apiTest(fixtures) { optimize: true, base64Cutoff: 0, }); - strictEqual(imports.length, 2); + strictEqual(imports.length, 4); strictEqual(exports.length, 3); deepStrictEqual(exports[0], ["test", "instance"]); - ok(files[name + ".js"].length < 11_000); + ok(files[name + ".js"].length < 28_000); }); test("Transpile to JS", async () => { @@ -56,7 +56,7 @@ export async function apiTest(fixtures) { ); const { files, imports, exports } = await transpile(component, { map: { - "test*": "./*.js", + "test:flavorful/*": "./*.js", }, name, validLiftingOptimization: true, @@ -64,14 +64,13 @@ export async function apiTest(fixtures) { base64Cutoff: 0, js: true, }); - strictEqual(imports.length, 2); + strictEqual(imports.length, 4); strictEqual(exports.length, 3); deepStrictEqual(exports[0], ["test", "instance"]); deepStrictEqual(exports[1], ["test:flavorful/test", "instance"]); deepStrictEqual(exports[2], ["testImports", "function"]); const source = Buffer.from(files[name + ".js"]).toString(); - ok(source.includes("./wasi.js")); - ok(source.includes("testwasi")); + ok(source.includes("./test.js")); ok(source.includes("FUNCTION_TABLE")); for (let i = 0; i < 2; i++) ok(source.includes(exports[i][0])); }); @@ -87,7 +86,7 @@ export async function apiTest(fixtures) { "test:flavorful/*": "#*import", }, }); - strictEqual(imports.length, 2); + strictEqual(imports.length, 4); strictEqual(imports[0], "#testimport"); const source = Buffer.from(files[name + ".js"]).toString(); ok(source.includes("'#testimport'")); @@ -155,7 +154,7 @@ export async function apiTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.209.1"], + ["wit-component", "0.212.0"], ["dummy-gen", "test"], ], ], @@ -196,7 +195,7 @@ export async function apiTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.209.1"], + ["wit-component", "0.212.0"], ["dummy-gen", "test"], ], ], diff --git a/test/cli.js b/test/cli.js index 365f5195b..e735b2f9c 100644 --- a/test/cli.js +++ b/test/cli.js @@ -228,7 +228,7 @@ export async function cliTest(fixtures) { "--name", name, "--map", - "testwasi=./wasi.js", + "test:flavorful/test=./flavorful.js", "--valid-lifting-optimization", "--tla-compat", "--js", @@ -238,8 +238,7 @@ export async function cliTest(fixtures) { ); strictEqual(stderr, ""); const source = await readFile(`${outDir}/${name}.js`, "utf8"); - ok(source.includes("./wasi.js")); - ok(source.includes("testwasi")); + ok(source.includes("./flavorful.js")); ok(source.includes("FUNCTION_TABLE")); ok(source.includes("export {\n $init")); }); @@ -413,7 +412,7 @@ export async function cliTest(fixtures) { [ "processed-by", [ - ["wit-component", "0.209.1"], + ["wit-component", "0.212.0"], ["dummy-gen", "test"], ], ], diff --git a/test/fixtures/component-gen/import-fn.wit b/test/fixtures/component-gen/import-fn.wit index 9e578765d..ac7bb5c24 100644 --- a/test/fixtures/component-gen/import-fn.wit +++ b/test/fixtures/component-gen/import-fn.wit @@ -1,4 +1,4 @@ -package example:protocol +package example:protocol; world my-world { record point { @@ -6,9 +6,9 @@ world my-world { y: s32, } - import print: func(msg: string) - import import-point: func(pnt: point) -> point + import print: func(msg: string); + import import-point: func(pnt: point) -> point; - export run: func() - export move-point: func(pnt: point) -> point + export run: func(); + export move-point: func(pnt: point) -> point; } diff --git a/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm b/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm index 4a290862b..080bb16cd 100644 Binary files a/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm and b/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm differ diff --git a/test/fixtures/components/borrowing.component.wasm b/test/fixtures/components/borrowing.component.wasm index 750046bbd..079b9c6c2 100644 Binary files a/test/fixtures/components/borrowing.component.wasm and b/test/fixtures/components/borrowing.component.wasm differ diff --git a/test/fixtures/components/flavorful.component.wasm b/test/fixtures/components/flavorful.component.wasm index 9caaf83fb..81707edca 100644 Binary files a/test/fixtures/components/flavorful.component.wasm and b/test/fixtures/components/flavorful.component.wasm differ diff --git a/test/fixtures/components/import-fn.component.wasm b/test/fixtures/components/import-fn.component.wasm index 72d087456..ec0f4bf18 100644 Binary files a/test/fixtures/components/import-fn.component.wasm and b/test/fixtures/components/import-fn.component.wasm differ diff --git a/test/fixtures/components/lists.component.wasm b/test/fixtures/components/lists.component.wasm index d698bb770..b31035f18 100644 Binary files a/test/fixtures/components/lists.component.wasm and b/test/fixtures/components/lists.component.wasm differ diff --git a/test/fixtures/components/many-arguments.component.wasm b/test/fixtures/components/many-arguments.component.wasm index 6fd4a5deb..ee1359b7a 100644 Binary files a/test/fixtures/components/many-arguments.component.wasm and b/test/fixtures/components/many-arguments.component.wasm differ diff --git a/test/fixtures/components/many_arguments.component.wasm b/test/fixtures/components/many_arguments.component.wasm index d1036288e..24bd58aea 100644 Binary files a/test/fixtures/components/many_arguments.component.wasm and b/test/fixtures/components/many_arguments.component.wasm differ diff --git a/test/fixtures/components/numbers.component.wasm b/test/fixtures/components/numbers.component.wasm index 0c4353d35..a4c4eec3c 100644 Binary files a/test/fixtures/components/numbers.component.wasm and b/test/fixtures/components/numbers.component.wasm differ diff --git a/test/fixtures/components/owning.component.wasm b/test/fixtures/components/owning.component.wasm index d9c1a7c7b..e3d6371a0 100644 Binary files a/test/fixtures/components/owning.component.wasm and b/test/fixtures/components/owning.component.wasm differ diff --git a/test/fixtures/components/records.component.wasm b/test/fixtures/components/records.component.wasm index 7d21b2982..38eed41e1 100644 Binary files a/test/fixtures/components/records.component.wasm and b/test/fixtures/components/records.component.wasm differ diff --git a/test/fixtures/components/smoke.component.wasm b/test/fixtures/components/smoke.component.wasm index a716f81b7..c967df4f6 100644 Binary files a/test/fixtures/components/smoke.component.wasm and b/test/fixtures/components/smoke.component.wasm differ diff --git a/test/fixtures/components/strings.component.wasm b/test/fixtures/components/strings.component.wasm index 3ee01a8f8..938f0d895 100644 Binary files a/test/fixtures/components/strings.component.wasm and b/test/fixtures/components/strings.component.wasm differ diff --git a/test/fixtures/components/variants.component.wasm b/test/fixtures/components/variants.component.wasm index ab9c269a8..c62e673fa 100644 Binary files a/test/fixtures/components/variants.component.wasm and b/test/fixtures/components/variants.component.wasm differ diff --git a/test/fixtures/wit/deps/flavorful/flavorful.wit b/test/fixtures/wit/deps/flavorful/flavorful.wit index 570cc588a..920346d88 100644 --- a/test/fixtures/wit/deps/flavorful/flavorful.wit +++ b/test/fixtures/wit/deps/flavorful/flavorful.wit @@ -28,10 +28,10 @@ interface test { type list-typedef = string; type list-typedef2 = list; type list-typedef3 = list; - list-typedefs: func(a: list-typedef, c: list-typedef3) -> (a: list-typedef2, b: list-typedef3); + list-typedefs: func(a: list-typedef, c: list-typedef3) -> tuple; list-of-variants: func(a: list, b: list, c: list) - -> (a: list, b: list, c: list); + -> tuple, list, list>; } world flavorful { diff --git a/test/runtime/helpers.ts b/test/runtime/helpers.ts index a045fb7c2..749f1a153 100644 --- a/test/runtime/helpers.ts +++ b/test/runtime/helpers.ts @@ -32,3 +32,39 @@ export function log (bytes: Uint8Array) { export function logErr (bytes: Uint8Array) { stderr.write(bytes); } + +export const wasi = { + 'wasi:cli/stderr': { + getStderr () { + + } + }, + 'wasi:cli/stdin': { + getStdin () { + + } + }, + 'wasi:cli/stdout': { + getStdout () { + + } + }, + 'wasi:filesystem/preopens': { + getDirectores () { + + } + }, + 'wasi:filesystem/types': { + Descriptor: class Descriptor {}, + filsystemErrorCode () { + return 0; + } + }, + 'wasi:io/error': { + Error: class WasiError {} + }, + 'wasi:io/streams': { + InputStream: class InputStream {}, + OutputStream: class OutputStream {} + } +}; diff --git a/test/runtime/lists.ts b/test/runtime/lists.ts index 9da869ce9..f32a69a81 100644 --- a/test/runtime/lists.ts +++ b/test/runtime/lists.ts @@ -1,5 +1,6 @@ // Flags: --instantiation +// @ts-ignore import * as helpers from "./helpers.js"; import { instantiate } from "../output/lists/lists.js"; @@ -7,8 +8,9 @@ import { instantiate } from "../output/lists/lists.js"; import * as assert from 'assert'; async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:lists/test': { emptyListParam(a) { assert.deepStrictEqual(Array.from(a), []); diff --git a/test/runtime/many-arguments.ts b/test/runtime/many-arguments.ts index a7f0d4c47..05f3f5db5 100644 --- a/test/runtime/many-arguments.ts +++ b/test/runtime/many-arguments.ts @@ -14,8 +14,9 @@ function assert(x: boolean) { } async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, imports: { manyArguments( a1, diff --git a/test/runtime/numbers.ts b/test/runtime/numbers.ts index d26b3ebe9..800683e35 100644 --- a/test/runtime/numbers.ts +++ b/test/runtime/numbers.ts @@ -29,8 +29,9 @@ world root { async function run() { let scalar = 0; + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:numbers/test': { roundtripU8(x) { return x; }, roundtripS8(x) { return x; }, @@ -40,8 +41,8 @@ async function run() { roundtripS32(x) { return x; }, roundtripU64(x) { return x; }, roundtripS64(x) { return x; }, - roundtripFloat32(x) { return x; }, - roundtripFloat64(x) { return x; }, + roundtripF32(x) { return x; }, + roundtripF64(x) { return x; }, roundtripChar(x) { return x; }, setScalar(x) { scalar = x; }, getScalar() { return scalar; }, @@ -80,15 +81,15 @@ async function run() { strictEqual(wasm.test.roundtripS64((1n << 63n) - 1n), (1n << 63n) - 1n); strictEqual(wasm.test.roundtripS64(-(1n << 63n)), -(1n << 63n)); - strictEqual(wasm.test.roundtripFloat32(1), 1); - strictEqual(wasm.test.roundtripFloat32(Infinity), Infinity); - strictEqual(wasm.test.roundtripFloat32(-Infinity), -Infinity); - assert(Number.isNaN(wasm.test.roundtripFloat32(NaN))); + strictEqual(wasm.test.roundtripF32(1), 1); + strictEqual(wasm.test.roundtripF32(Infinity), Infinity); + strictEqual(wasm.test.roundtripF32(-Infinity), -Infinity); + assert(Number.isNaN(wasm.test.roundtripF32(NaN))); - strictEqual(wasm.test.roundtripFloat64(1), 1); - strictEqual(wasm.test.roundtripFloat64(Infinity), Infinity); - strictEqual(wasm.test.roundtripFloat64(-Infinity), -Infinity); - assert(Number.isNaN(wasm.test.roundtripFloat64(NaN))); + strictEqual(wasm.test.roundtripF64(1), 1); + strictEqual(wasm.test.roundtripF64(Infinity), Infinity); + strictEqual(wasm.test.roundtripF64(-Infinity), -Infinity); + assert(Number.isNaN(wasm.test.roundtripF64(NaN))); strictEqual(wasm.test.roundtripChar('a'), 'a'); strictEqual(wasm.test.roundtripChar(' '), ' '); diff --git a/test/runtime/records.ts b/test/runtime/records.ts index 747eae776..22804f9f8 100644 --- a/test/runtime/records.ts +++ b/test/runtime/records.ts @@ -6,14 +6,15 @@ import { instantiate, ImportObject } from "../output/records/records.js"; import * as assert from 'node:assert'; async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:records/test': { multipleResults() { return [4, 5]; }, swapTuple([a, b]) { return [b, a]; }, roundtripFlags1(x) { return x; }, roundtripFlags2(x) { return x; }, - roundtripFlags3(r0, r1, r2, r3) { return [r0, r1, r2, r3]; }, + roundtripFlags3(r0, r1, r2) { return [r0, r1, r2]; }, roundtripRecord1(x) { return x; }, tuple1([x]) { return [x]; }, } diff --git a/test/runtime/strings.async+js.ts b/test/runtime/strings.async+js.ts index 058fcea35..792a902b0 100644 --- a/test/runtime/strings.async+js.ts +++ b/test/runtime/strings.async+js.ts @@ -7,8 +7,9 @@ import { instantiate } from '../output/strings.async+js/strings.async+js.js'; import * as assert from 'assert'; async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:strings/imports': { takeBasic(s: string) { assert.strictEqual(s, 'latin utf16'); diff --git a/test/runtime/strings.sync+js.ts b/test/runtime/strings.sync+js.ts index 4b2765dc8..114e364c4 100644 --- a/test/runtime/strings.sync+js.ts +++ b/test/runtime/strings.sync+js.ts @@ -7,8 +7,9 @@ import { instantiate } from '../output/strings.sync+js/strings.sync+js.js'; import * as assert from 'assert'; function run() { + // @ts-ignore const wasm = instantiate(helpers.loadWasmSync, { - testwasi: helpers, + ...helpers.wasi, 'test:strings/imports': { takeBasic(s: string) { assert.strictEqual(s, 'latin utf16'); diff --git a/test/runtime/strings.sync.ts b/test/runtime/strings.sync.ts index 55eaf7f51..53407bf14 100644 --- a/test/runtime/strings.sync.ts +++ b/test/runtime/strings.sync.ts @@ -7,8 +7,8 @@ import { instantiate } from '../output/strings.sync/strings.sync.js'; import * as assert from 'assert'; function run() { + // @ts-ignore const wasm = instantiate(helpers.loadWasmSync, { - testwasi: helpers, 'test:strings/imports': { takeBasic(s: string) { assert.strictEqual(s, 'latin utf16'); diff --git a/test/runtime/strings.ts b/test/runtime/strings.ts index 579b1c226..8bc19aa9d 100644 --- a/test/runtime/strings.ts +++ b/test/runtime/strings.ts @@ -7,8 +7,9 @@ import { instantiate } from '../output/strings/strings.js'; import * as assert from 'assert'; async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:strings/imports': { takeBasic(s: string) { assert.strictEqual(s, 'latin utf16'); diff --git a/test/runtime/variants.ts b/test/runtime/variants.ts index a45a260aa..384b93f1e 100644 --- a/test/runtime/variants.ts +++ b/test/runtime/variants.ts @@ -6,8 +6,9 @@ import { instantiate } from "../output/variants/variants.js"; import * as assert from 'assert'; async function run() { + // @ts-ignore const wasm = await instantiate(helpers.loadWasm, { - testwasi: helpers, + ...helpers.wasi, 'test:variants/test': { roundtripOption(x) { return x; }, roundtripResult(x) { diff --git a/update-tests.sh b/update-tests.sh index 0ed2746ad..68efdcce1 100755 --- a/update-tests.sh +++ b/update-tests.sh @@ -1,9 +1,6 @@ #!/bin/bash set -ex -# update dependencies -git submodule foreach git pull origin main -git submodule update --init --recursive cd submodules/wit-bindgen # build tests @@ -13,8 +10,8 @@ cargo test -p wit-bindgen-cli --no-default-features -F rust -F c for t in target/runtime-tests/*/rust.wasm do name="$(basename $(dirname $t))" - echo "cp $t ../test/fixtures/components/${name}.component.wasm" - cp $t ../test/fixtures/components/${name}.component.wasm + echo "cp $t ../../test/fixtures/components/${name}.component.wasm" + cp $t ../../test/fixtures/components/${name}.component.wasm done # copy over the C-based wit-bindgen tests to our repo. @@ -23,12 +20,12 @@ for t in target/runtime-tests/*/c-*/*.component.wasm do name="$(basename $(dirname $t))" name=${name:2} - echo "cp $t ../test/fixtures/components/${name}.component.wasm" + echo "cp $t ../../test/fixtures/components/${name}.component.wasm" cp $t ../../test/fixtures/components/${name}.component.wasm done # copy flavorful wit case -cp tests/runtime/flavorful/world.wit ../../test/fixtures/wit/flavorful.wit +cp tests/runtime/flavorful/world.wit ../../test/fixtures/wit/deps/flavorful/flavorful.wit cd ../.. # convert the js test fixtures into a wasm component diff --git a/xtask/src/generate/wasi_types.rs b/xtask/src/generate/wasi_types.rs index f4942d06c..9fe7cc396 100644 --- a/xtask/src/generate/wasi_types.rs +++ b/xtask/src/generate/wasi_types.rs @@ -23,7 +23,7 @@ pub(crate) fn run() -> Result<()> { .unwrap() .1; - let world = resolve.select_world(preview2, Some(world_name))?; + let world = resolve.select_world(&[preview2], Some(world_name))?; let opts = js_component_bindgen::TranspileOpts { name: "component".to_string(),