diff --git a/Cargo.lock b/Cargo.lock index 02a11f591..ce6ec78e7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,9 +25,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.91" +version = "1.0.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" +checksum = "4c95c10ba0b00a02636238b814946408b1322d5ac4760326e6fb8ec956d85775" [[package]] name = "atty" @@ -81,7 +81,7 @@ dependencies = [ "bitflags 1.3.2", "strsim", "textwrap", - "unicode-width", + "unicode-width 0.1.14", "vec_map", ] @@ -93,9 +93,9 @@ checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" [[package]] name = "cranelift-bitset" -version = "0.113.0" +version = "0.114.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ab25ef3be935a80680e393183e1f94ef507e93a24a8369494d2c6818aedb3e3" +checksum = "005884e3649c3e5ff2dc79e8a94b138f11569cc08a91244a292714d2a86e9156" dependencies = [ "serde", "serde_derive", @@ -103,9 +103,9 @@ dependencies = [ [[package]] name = "cranelift-entity" -version = "0.113.0" +version = "0.114.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d770e6605eccee15b49decdd82cd26f2b6404767802471459ea49c57379a98" +checksum = "305399fd781a2953ac78c1396f02ff53144f39c33eb7fc7789cf4e8936d13a96" dependencies = [ "cranelift-bitset", "serde", @@ -178,9 +178,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.0" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +checksum = "3a9bfc1af68b1726ea47d3d5109de126281def866b33970e10fbab11b5dafab3" dependencies = [ "foldhash", ] @@ -222,7 +222,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "serde", ] @@ -237,28 +237,28 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.11" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +checksum = "540654e97a3f4470a492cd30ff187bc95d89557a903a2bbf112e2fae98104ef2" [[package]] name = "jco" -version = "1.7.2" +version = "1.8.1" dependencies = [ "anyhow", ] [[package]] name = "js-component-bindgen" -version = "1.7.2" +version = "1.8.1" dependencies = [ "anyhow", "base64", "heck 0.5.0", "log", "semver", - "wasm-encoder 0.218.0", - "wasmparser 0.218.0", + "wasm-encoder 0.219.1", + "wasmparser 0.219.1", "wasmtime-environ", "wit-bindgen-core", "wit-component", @@ -267,7 +267,7 @@ dependencies = [ [[package]] name = "js-component-bindgen-component" -version = "1.7.2" +version = "1.8.1" dependencies = [ "anyhow", "js-component-bindgen", @@ -290,9 +290,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.161" +version = "0.2.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "433bfe06b8c75da9b2e3fbea6e5329ff87748f0b144ef75306e674c3f6f7c13f" [[package]] name = "log" @@ -323,7 +323,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "crc32fast", - "hashbrown 0.15.0", + "hashbrown 0.15.1", "indexmap", "memchr", ] @@ -363,7 +363,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64d1ec885c64d0457d564db4ec299b2dae3f9c02808b8ad9c3a089c591b18033" dependencies = [ "proc-macro2", - "syn 2.0.85", + "syn 2.0.89", ] [[package]] @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -425,29 +425,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "6513c1ad0b11a9376da888e3e0baa0077f1aed55c17f50e7b2397136129fb88f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.215" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.89", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.133" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "c7fceb2473b9166b2294ef05efcb65a3db80803f0b03ef86a5fc88a2b85ee377" dependencies = [ "itoa", "memchr", @@ -466,9 +466,9 @@ dependencies = [ [[package]] name = "spdx" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47317bbaf63785b53861e1ae2d11b80d6b624211d42cb20efcd210ee6f8a14bc" +checksum = "bae30cc7bfe3656d60ee99bf6836f472b0c53dddcbf335e253329abb16e535a2" dependencies = [ "smallvec", ] @@ -516,9 +516,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" dependencies = [ "proc-macro2", "quote", @@ -546,14 +546,14 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" dependencies = [ - "unicode-width", + "unicode-width 0.1.14", ] [[package]] name = "unicode-ident" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83" [[package]] name = "unicode-segmentation" @@ -567,6 +567,12 @@ version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "unicode-xid" version = "0.2.6" @@ -587,29 +593,29 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wasm-encoder" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22b896fa8ceb71091ace9bcb81e853f54043183a1c9667cf93422c40252ffa0a" +checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" dependencies = [ "leb128", - "wasmparser 0.218.0", + "wasmparser 0.219.1", ] [[package]] name = "wasm-encoder" -version = "0.219.1" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29cbbd772edcb8e7d524a82ee8cef8dd046fc14033796a754c3ad246d019fa54" +checksum = "ebf48234b389415b226a4daef6562933d38c7b28a8b8f64c5c4130dad1561ab7" dependencies = [ "leb128", - "wasmparser 0.219.1", + "wasmparser 0.220.0", ] [[package]] name = "wasm-metadata" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa5eeb071abe8a2132fdd5565dabffee70775ee8c24fc7e300ac43f51f4a8a91" +checksum = "2af5a8e37a5e996861e1813f8de30911c47609c9ff51a7284f7dbd754dc3a9f3" dependencies = [ "anyhow", "indexmap", @@ -617,8 +623,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.218.0", - "wasmparser 0.218.0", + "wasm-encoder 0.219.1", + "wasmparser 0.219.1", ] [[package]] @@ -626,9 +632,9 @@ name = "wasm-tools-js" version = "0.1.0" dependencies = [ "anyhow", - "wasm-encoder 0.218.0", + "wasm-encoder 0.219.1", "wasm-metadata", - "wasmparser 0.218.0", + "wasmparser 0.219.1", "wasmprinter", "wat", "wit-bindgen", @@ -638,9 +644,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09e46c7fceceaa72b2dd1a8a137ea7fd8f93dfaa69806010a709918e496c5dc" +checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" dependencies = [ "ahash", "bitflags 2.6.0", @@ -652,9 +658,9 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.219.1" +version = "0.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c771866898879073c53b565a6c7b49953795159836714ac56a5befb581227c5" +checksum = "e246c2772ce3ebc83f89a2d4487ac5794cad6c309b2071818a88c7db7c36d87b" dependencies = [ "bitflags 2.6.0", "indexmap", @@ -662,26 +668,26 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ace089155491837b75f474bf47c99073246d1b737393fe722d6dee311595ddc" +checksum = "228cdc1f30c27816da225d239ce4231f28941147d34713dee8f1fff7cb330e54" dependencies = [ "anyhow", "termcolor", - "wasmparser 0.218.0", + "wasmparser 0.219.1", ] [[package]] name = "wasmtime-component-util" -version = "26.0.0" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfe3c27d64af5f584014db9381c081223d27a57e1dce2f6280bbafea37575619" +checksum = "4a6db4f3ee18c699629eabb9c64e77efe5a93a5137f098db7cab295037ba41c2" [[package]] name = "wasmtime-environ" -version = "26.0.0" +version = "27.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3444c1759d5b906ff76a3cab073dd92135bdd06e5d1f46635ec40a58207d314" +checksum = "c25bfeaa16432d59a0706e2463d315ef4c9ebcfaf5605670b99d46373bdf9f27" dependencies = [ "anyhow", "cranelift-bitset", @@ -696,30 +702,30 @@ dependencies = [ "serde_derive", "smallvec", "target-lexicon", - "wasm-encoder 0.218.0", - "wasmparser 0.218.0", + "wasm-encoder 0.219.1", + "wasmparser 0.219.1", "wasmprinter", "wasmtime-component-util", ] [[package]] name = "wast" -version = "219.0.1" +version = "220.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f79a9d9df79986a68689a6b40bcc8d5d40d807487b235bebc2ac69a242b54a1" +checksum = "4e708c8de08751fd66e70961a32bae9d71901f14a70871e181cb8461a3bb3165" dependencies = [ "bumpalo", "leb128", "memchr", - "unicode-width", - "wasm-encoder 0.219.1", + "unicode-width 0.2.0", + "wasm-encoder 0.220.0", ] [[package]] name = "wat" -version = "1.219.1" +version = "1.220.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bc3cf014fb336883a411cd662f987abf6a1d2a27f2f0008616a0070bbf6bd0d" +checksum = "de4f1d7d59614ba690541360102b995c4eb1b9ed373701d5102cc1a968b1c5a3" dependencies = [ "wast", ] @@ -851,9 +857,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "wit-bindgen" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcf26778671a2327bd237a32c6f2d1d9bb0ec077e482b0839552b00d4566544" +checksum = "7e11ad55616555605a60a8b2d1d89e006c2076f46c465c892cc2c153b20d4b30" dependencies = [ "wit-bindgen-rt", "wit-bindgen-rust-macro", @@ -861,9 +867,9 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b885a00e1c428fd12b7b7c4bccc4bad8b2a3ca0abe8eaf1e0f90adabb4c7ac7" +checksum = "163cee59d3d5ceec0b256735f3ab0dccac434afb0ec38c406276de9c5a11e906" dependencies = [ "anyhow", "heck 0.5.0", @@ -872,24 +878,24 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +checksum = "744845cde309b8fa32408d6fb67456449278c66ea4dcd96de29797b302721f02" dependencies = [ "bitflags 2.6.0", ] [[package]] name = "wit-bindgen-rust" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542608877814a54f6bea6b24dcbe249a2e293d67d709f4f8ec578d06b1c00730" +checksum = "f6919521fc7807f927a739181db93100ca7ed03c29509b84d5f96b27b2e49a9a" dependencies = [ "anyhow", "heck 0.5.0", "indexmap", "prettyplease", - "syn 2.0.85", + "syn 2.0.89", "wasm-metadata", "wit-bindgen-core", "wit-component", @@ -897,24 +903,24 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.33.0" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d462025f670fff96606ddbfe62500255b4fe3de7298cd9cbabb2de3d567183" +checksum = "c967731fc5d50244d7241ecfc9302a8929db508eea3c601fbc5371b196ba38a5" dependencies = [ "anyhow", "prettyplease", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.89", "wit-bindgen-core", "wit-bindgen-rust", ] [[package]] name = "wit-component" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa53aa7e6bf2b3e8ccaffbcc963fbdb672a603dc0af393a481b6cec24c266406" +checksum = "ad1673163c0cb14a6a19ddbf44dd4efe6f015ec1ebb8156710ac32501f19fba2" dependencies = [ "anyhow", "bitflags 2.6.0", @@ -923,9 +929,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.218.0", + "wasm-encoder 0.219.1", "wasm-metadata", - "wasmparser 0.218.0", + "wasmparser 0.219.1", "wat", "wit-parser", ] @@ -943,9 +949,9 @@ dependencies = [ [[package]] name = "wit-parser" -version = "0.218.0" +version = "0.219.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d3d1066ab761b115f97fef2b191090faabcb0f37b555b758d3caf42d4ed9e55" +checksum = "4a86f669283257e8e424b9a4fc3518e3ade0b95deb9fbc0f93a1876be3eda598" dependencies = [ "anyhow", "id-arena", @@ -956,23 +962,23 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.218.0", + "wasmparser 0.219.1", ] [[package]] name = "xshell" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db0ab86eae739efd1b054a8d3d16041914030ac4e01cd1dca0cf252fd8b6437" +checksum = "9e7290c623014758632efe00737145b6867b66292c42167f2ec381eb566a373d" dependencies = [ "xshell-macros", ] [[package]] name = "xshell-macros" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d422e8e38ec76e2f06ee439ccc765e9c6a9638b9e7c9f2e8255e4d41e8bd852" +checksum = "32ac00cd3f8ec9c1d33fb3e7958a82df6989c42d747bd326c822b1d625283547" [[package]] name = "xtask" @@ -1012,5 +1018,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.89", ] diff --git a/Cargo.toml b/Cargo.toml index 02a64cc40..7b72b3ef8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ resolver = "2" [workspace.package] edition = "2021" -version = "1.7.2" +version = "1.8.1" [profile.release] codegen-units = 1 @@ -41,19 +41,19 @@ log = "0.4.22" semver = "1.0.23" js-component-bindgen = { path = "./crates/js-component-bindgen" } structopt = "0.3.26" -wasm-encoder = "0.218.0" -wasm-metadata = "0.218.0" -wasmparser = "0.218.0" -wasmprinter = "0.218.0" -wasmtime-environ = { version = "26.0.0", features = [ +wasm-encoder = "0.219.1" +wasm-metadata = "0.219.1" +wasmparser = "0.219.1" +wasmprinter = "0.219.1" +wasmtime-environ = { version = "27.0.0", features = [ "component-model", "compile", ] } wat = "1.218.0" -wit-bindgen = "0.33.0" -wit-bindgen-core = "0.33.0" -wit-component = { version = "0.218.0", features = ["dummy-module"] } -wit-parser = "0.218.0" +wit-bindgen = "0.34.0" +wit-bindgen-core = "0.34.0" +wit-component = { version = "0.219.1", features = ["dummy-module"] } +wit-parser = "0.219.1" xshell = "0.2.6" [dev-dependencies] diff --git a/crates/js-component-bindgen/src/core.rs b/crates/js-component-bindgen/src/core.rs index b01583830..4f4736085 100644 --- a/crates/js-component-bindgen/src/core.rs +++ b/crates/js-component-bindgen/src/core.rs @@ -218,9 +218,6 @@ impl Augmenter<'_> { // records various bits of information about the module within `self`. for payload in Parser::new(0).parse_all(self.translation.wasm) { match payload? { - Payload::Version { .. } => {} - Payload::End(_) => {} - Payload::TypeSection(s) => { for grp in s.into_iter_err_on_gc_types() { self.types.push(grp?); @@ -246,29 +243,22 @@ impl Augmenter<'_> { self.imports.push(i); } } - Payload::ExportSection(s) => { for e in s { let e = e?; self.exports.push(e); } } - Payload::FunctionSection(s) => { for ty in s { let ty = ty?; self.local_func_tys.push(ty); } } - - Payload::CodeSectionStart { .. } => {} Payload::CodeSectionEntry(body) => { self.local_funcs.push(body); } - // Ignore all custom sections for now - Payload::CustomSection(_) => {} - // NB: these sections are theoretically possible to handle but // are not required at this time. Payload::DataCountSection { .. } @@ -297,6 +287,8 @@ impl Augmenter<'_> { | Payload::ComponentTypeSection(_) => { bail!("component section found in module using multiple memories") } + + _ => {} } } diff --git a/crates/js-component-bindgen/src/esm_bindgen.rs b/crates/js-component-bindgen/src/esm_bindgen.rs index 9f2b61430..249a70998 100644 --- a/crates/js-component-bindgen/src/esm_bindgen.rs +++ b/crates/js-component-bindgen/src/esm_bindgen.rs @@ -44,10 +44,14 @@ impl EsmBindgen { } iface = match iface.get_mut(&path[i]).unwrap() { ImportBinding::Interface(iface) => iface, - ImportBinding::Local(_) => panic!( - "Imported interface {} cannot be both a function and an interface", - &path[0..i].join(".") - ), + ImportBinding::Local(local) => { + panic!( + "Internal bindgen error: Import '{}' cannot be both an interface '{}' and a function '{}'", + &path[0..i + 1].join("."), + &path[i + 1..].join("."), + &local[0], + ); + } }; } if let Some(ref mut existing) = iface.get_mut(&path[path.len() - 1]) { diff --git a/crates/js-component-bindgen/src/function_bindgen.rs b/crates/js-component-bindgen/src/function_bindgen.rs index 3d0687ad7..514a2ed46 100644 --- a/crates/js-component-bindgen/src/function_bindgen.rs +++ b/crates/js-component-bindgen/src/function_bindgen.rs @@ -1131,7 +1131,7 @@ impl Bindgen for FunctionBindgen<'_> { uwriteln!( self.src, "for (const rsc of {cur_resource_borrows}) {{ - rsc[{symbol_resource_handle}] = null; + rsc[{symbol_resource_handle}] = undefined; }} {cur_resource_borrows} = [];" ); @@ -1141,7 +1141,7 @@ impl Bindgen for FunctionBindgen<'_> { "for (const {{ rsc, drop }} of {cur_resource_borrows}) {{ if (rsc[{symbol_resource_handle}]) {{ drop(rsc[{symbol_resource_handle}]); - delete rsc[{symbol_resource_handle}]; + rsc[{symbol_resource_handle}] = undefined; }} }} {cur_resource_borrows} = [];" @@ -1263,7 +1263,7 @@ impl Bindgen for FunctionBindgen<'_> { finalizationRegistry{tid}.unregister({rsc}); {rsc_table_remove}(handleTable{tid}, {handle}); {rsc}[{symbol_dispose}] = {empty_func}; - {rsc}[{symbol_resource_handle}] = null; + {rsc}[{symbol_resource_handle}] = undefined; {dtor}(handleTable{tid}[({handle} << 1) + 1] & ~{rsc_flag}); }}}});" ); @@ -1396,7 +1396,7 @@ impl Bindgen for FunctionBindgen<'_> { }} finalizationRegistry{tid}.unregister({op}); {op}[{symbol_dispose}] = {empty_func}; - {op}[{symbol_resource_handle}] = null;", + {op}[{symbol_resource_handle}] = undefined;", ); } else { // When expecting a borrow, the JS resource provided will always be an own diff --git a/crates/js-component-bindgen/src/transpile_bindgen.rs b/crates/js-component-bindgen/src/transpile_bindgen.rs index 085a42f0c..7f13c6997 100644 --- a/crates/js-component-bindgen/src/transpile_bindgen.rs +++ b/crates/js-component-bindgen/src/transpile_bindgen.rs @@ -1076,9 +1076,6 @@ impl<'a> Instantiator<'a, '_> { let (import_name, _) = &self.component.import_types[*import_index]; let world_key = &self.imports[import_name]; - // nested interfaces only currently possible through mapping - let (import_specifier, maybe_iface_member) = map_import(&self.gen.opts.map, import_name); - let (func, func_name, iface_name) = match &self.resolve.worlds[self.world].imports[world_key] { WorldItem::Function(func) => { @@ -1098,6 +1095,29 @@ impl<'a> Instantiator<'a, '_> { WorldItem::Type(_) => unreachable!(), }; + // nested interfaces only currently possible through mapping + let (import_specifier, maybe_iface_member) = map_import( + &self.gen.opts.map, + if iface_name.is_some() { + import_name + } else { + match func.kind { + FunctionKind::Method(_) => { + let stripped = import_name.strip_prefix("[method]").unwrap(); + &stripped[0..stripped.find(".").unwrap()] + } + FunctionKind::Static(_) => { + let stripped = import_name.strip_prefix("[static]").unwrap(); + &stripped[0..stripped.find(".").unwrap()] + } + FunctionKind::Constructor(_) => { + import_name.strip_prefix("[constructor]").unwrap() + } + FunctionKind::Freestanding => import_name, + } + }, + ); + let mut resource_map = ResourceMap::new(); self.create_resource_fn_map(func, func_ty, &mut resource_map); @@ -1323,6 +1343,10 @@ impl<'a> Instantiator<'a, '_> { local_name, ); } + } else if let Some(iface_member) = iface_member { + self.gen + .esm_bindgen + .add_import_binding(&[import_specifier, iface_member.into()], local_name); } else if let Some(import_binding) = import_binding { self.gen .esm_bindgen @@ -1385,8 +1409,8 @@ impl<'a> Instantiator<'a, '_> { wit_parser::TypeOwner::Interface(iface) => { match &self.resolve.interfaces[iface].name { Some(name) => (WorldKey::Interface(iface), Some(name.as_str())), - None => ( - self.resolve.worlds[self.world] + None => { + let key = self.resolve.worlds[self.world] .imports .iter() .find(|&(_, item)| match item { @@ -1394,10 +1418,15 @@ impl<'a> Instantiator<'a, '_> { _ => false, }) .unwrap() - .0 - .clone(), - None, - ), + .0; + ( + key.clone(), + match key { + WorldKey::Name(ref name) => Some(name.as_str()), + WorldKey::Interface(_) => None, + }, + ) + } } } wit_parser::TypeOwner::None => unimplemented!(), @@ -1416,7 +1445,11 @@ impl<'a> Instantiator<'a, '_> { import_specifier, iface_name, maybe_iface_member.as_deref(), - Some(resource_name), + if iface_name.is_some() { + Some(resource_name) + } else { + None + }, local_name_str.to_string(), ); diff --git a/crates/js-component-bindgen/src/ts_bindgen.rs b/crates/js-component-bindgen/src/ts_bindgen.rs index 8bd22994e..bd250fc92 100644 --- a/crates/js-component-bindgen/src/ts_bindgen.rs +++ b/crates/js-component-bindgen/src/ts_bindgen.rs @@ -155,7 +155,7 @@ pub fn ts_bindgen( TypeDefKind::Future(_) => todo!("generate for future"), TypeDefKind::Stream(_) => todo!("generate for stream"), TypeDefKind::Unknown => unreachable!(), - TypeDefKind::Resource => todo!(), + TypeDefKind::Resource => {} TypeDefKind::Handle(_) => todo!(), } let output = gen.finish(); diff --git a/crates/wasm-tools-component/src/lib.rs b/crates/wasm-tools-component/src/lib.rs index 64fb4e8f9..75bedcc36 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; +use wit_parser::{Mangling, Resolve}; use exports::local::wasm_tools::tools::{ EmbedOpts, EnabledFeatureSet, Guest, ModuleMetaType, ModuleMetadata, ProducersFields, @@ -122,7 +122,7 @@ impl Guest for WasmToolsJs { .. } ) { - wit_component::dummy_module(&resolve, world) + wit_component::dummy_module(&resolve, world, Mangling::Standard32) } else { if binary.is_none() { return Err( diff --git a/examples/components/string-reverse-upper/README.md b/examples/components/string-reverse-upper/README.md index 810b6fb97..dbf04f24d 100644 --- a/examples/components/string-reverse-upper/README.md +++ b/examples/components/string-reverse-upper/README.md @@ -42,7 +42,7 @@ world revup { ## Dependencies -First, install required dependencies: +First, install required project-level dependencies: ```console npm install @@ -51,6 +51,11 @@ npm install > [!NOTE] > As this is a regular NodeJS project, you can use your package manager of choice (e.g. `yarn`, `pnpm`) +Along with projet related dependencies, since this is a *compound* component (this component is composed with another), +we'll need to install the [WebAssembly Composition tool (`wac`)][wac], which we will use later to compose components. + +[wac]: https://github.com/bytecodealliance/wac + ## Building the WebAssembly binary (pre-composition) Then, build the component with `jco`: @@ -97,6 +102,9 @@ The component we will be composing with our as-of-yet incomplete binary *must* s npm run compose ``` +> [!WARN] +> This step is the one that uses [`wac`][wac] -- ensure it's installed! + Running the command above will produce a `string-reverse-upper.wasm` file (this time, that is *complete*). After running component composition, there will be a component with all its imports satisfied, called `string-reverse-upper.composed.wasm`. diff --git a/lib/wasi_snapshot_preview1.command.wasm b/lib/wasi_snapshot_preview1.command.wasm index 61cb60a1c..645dbd06a 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 c91abe378..f65b51ee3 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 78e8db91e..7fde14c77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "@bytecodealliance/jco", - "version": "1.7.2", + "version": "1.8.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@bytecodealliance/jco", - "version": "1.7.2", + "version": "1.8.1", "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/componentize-js": "^0.15.0", "@bytecodealliance/preview2-shim": "^0.17.1", "binaryen": "^120.0.0", "chalk-template": "^1", @@ -61,30 +61,30 @@ } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz", - "integrity": "sha512-Y53lxcHEQz5k4PwqBY3+q6Y+TmFSu5mWhd+2dyURE7mk0GDaFYKRDoATCoXxD8Dvq/HgNPrDSE2X7AJIjPMtYQ==", + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.0.tgz", + "integrity": "sha512-NyMsXJi4LxeGGYwmZR5c8Zq69scTgTmaXUOXeC4IDvDoLNz5qZdBqC8gjZnsqvRq69QFM2Hd3Xweb5P5AyEOGA==", "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.7.1", - "@bytecodealliance/weval": "^0.3.2", + "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.7.1.tgz", - "integrity": "sha512-rw8tPBkEm/OG3jx7hiz2VcTwYXQY0hKN+/krR6b0FppemXmd58jWKG8KYS4C01RcM6n1By1qCpWTXOt3A6MeWQ==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.8.1.tgz", + "integrity": "sha512-mYjE7lrSWEzFD6lAVA4skm9/6DvorFjuO5DHoxzwWlJ2hKyO/d9t0Wx1V0nT5L1s7+98ZtVSB1emYLNMebpMdA==", "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.13.0", - "@bytecodealliance/preview2-shim": "^0.17.0", + "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/preview2-shim": "^0.17.1", "binaryen": "^120.0.0", "chalk-template": "^1", "commander": "^12", @@ -97,14 +97,14 @@ } }, "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/componentize-js": { - "version": "0.13.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.13.1.tgz", - "integrity": "sha512-a5kq/iXIgnW0Tws3m/nm9xb7CtcT4jllhmzUDZua3/LGs4ZWGoQQwxfqTHB/r7cL6aXhy0wUoiTNvVJ8sLPzbw==", + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz", + "integrity": "sha512-Y53lxcHEQz5k4PwqBY3+q6Y+TmFSu5mWhd+2dyURE7mk0GDaFYKRDoATCoXxD8Dvq/HgNPrDSE2X7AJIjPMtYQ==", "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.7.0", + "@bytecodealliance/jco": "^1.7.1", "@bytecodealliance/weval": "^0.3.2", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" @@ -115,9 +115,9 @@ "link": true }, "node_modules/@bytecodealliance/weval": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.3.2.tgz", - "integrity": "sha512-yH28sdq0Y0Oc29LbbWCEx2PvRFi0D7CEhWdNHPovl/L7thzlNlFWCRcOLanB0XgXQ5rygTpVVBFH0/50tWMg2w==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.3.3.tgz", + "integrity": "sha512-hrQI47O1l3ilFscixu0uuSJTj5tbQW0QmCATQWWNW0E8wJxbKH4yo8y57O5gqpRSKk/T+da1sH/GJNrnGHTFNA==", "license": "Apache-2.0", "dependencies": { "@napi-rs/lzma": "^1.1.2", @@ -306,9 +306,9 @@ } }, "node_modules/@eslint/config-array": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.18.0.tgz", - "integrity": "sha512-fTxvnS1sRMu3+JjXwJG0j/i4RT9u4qJ+lqS/yCGap4lH4zZGzQ7tu+xZqQmcMZq5OBZDL4QRxQzRjkWcGt8IVw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.19.0.tgz", + "integrity": "sha512-zdHg2FPIFNKPdcHWtiNT+jEFCHYVplAXRDlQDyqy0zGx/q2parwh7brGJSiTxRk/TSMkbM//zt/f5CHgyTyaSQ==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -345,9 +345,9 @@ } }, "node_modules/@eslint/core": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.7.0.tgz", - "integrity": "sha512-xp5Jirz5DyPYlPiKat8jaq0EmYvDXKKpzTbxXMpT9eqlRJkRKIz9AGMdlvYjih+im+QlhWrpvVjl8IPC/lHlUw==", + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.9.0.tgz", + "integrity": "sha512-7ATR9F0e4W85D/0w7cU0SNj7qkAexMG+bAHEZOjo9akvGuhHE2m7umzWzfnpa0XAg5Kxc1BWmtPMV67jJ+9VUg==", "dev": true, "license": "Apache-2.0", "engines": { @@ -355,9 +355,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.1.0.tgz", - "integrity": "sha512-4Bfj15dVJdoy3RfZmmo86RK1Fwzn6SstsvK9JS+BaVKqC6QQQQyXekNaC+g+LKNgkQ+2VhGAzm6hO40AhMR3zQ==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.2.0.tgz", + "integrity": "sha512-grOjVNN8P3hjJn/eIETF1wwd12DdnwFDoyceUJLYYdkpbwq3nLi+4fqrTAONx7XDALqlL220wC/RHSC/QTI/0w==", "dev": true, "license": "MIT", "dependencies": { @@ -403,9 +403,9 @@ } }, "node_modules/@eslint/js": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.14.0.tgz", - "integrity": "sha512-pFoEtFWCPyDOl+C6Ift+wC7Ro89otjigCf5vcuWqWgqNSQbRrpjSvdeE6ofLz4dHmyxD5f7gIdGT4+p36L6Twg==", + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.15.0.tgz", + "integrity": "sha512-tMTqrY+EzbXmKJR5ToI8lxu7jaN5EdmrBFJpQk5JmSlyLsx6o4t27r883K5xsLuCYCpfKBCGswMSWXsM+jB7lg==", "dev": true, "license": "MIT", "engines": { @@ -423,9 +423,9 @@ } }, "node_modules/@eslint/plugin-kit": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.2.tgz", - "integrity": "sha512-CXtq5nR4Su+2I47WPOlWud98Y5Lv8Kyxp2ukhgFx/eW6Blm18VXJO5WuQylPugRo8nbluoi6GvvxBLqHcvqUUw==", + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.2.3.tgz", + "integrity": "sha512-2b/g5hRmpbb1o4GnTZax9N9m0FXzz9OV42ZzI4rDDMDuHUqigAiQCEWChBWCY4ztAGVRjoWT19v0yMmc5/L5kA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -488,9 +488,9 @@ } }, "node_modules/@humanwhocodes/retry": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.0.tgz", - "integrity": "sha512-xnRgu9DxZbkWak/te3fcytNyp8MTbuiZIaueg2rgEvBuN55n04nwLYLU9TX/VVlusc9L2ZNXi99nUFNkHXtr5g==", + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.1.tgz", + "integrity": "sha512-c7hNEllBlenFTHBky65mhq8WD2kbN9Q6gk0bTk8lSBvc554jpXSkST1iePudpt7+A/AQvuHs9EMqjHDXMY1lrA==", "dev": true, "license": "Apache-2.0", "engines": { @@ -914,13 +914,13 @@ } }, "node_modules/@puppeteer/browsers": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.0.tgz", - "integrity": "sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g==", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.1.tgz", + "integrity": "sha512-0kdAbmic3J09I6dT8e9vE2JOCSt13wHCW5x/ly8TSt2bDtuIWe2TgLZZDHdcziw9AVCzflMAXCrVyRIhIs44Ng==", "dev": true, "license": "Apache-2.0", "dependencies": { - "debug": "^4.3.6", + "debug": "^4.3.7", "extract-zip": "^2.0.1", "progress": "^2.0.3", "proxy-agent": "^6.4.0", @@ -1057,9 +1057,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.17.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.5.tgz", - "integrity": "sha512-n8FYY/pRxu496441gIcAQFZPKXbhsd6VZygcq+PTSZ75eMh/Ke0hCAROdUa21qiFqKNsPPYic46yXDO1JGiPBQ==", + "version": "20.17.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.6.tgz", + "integrity": "sha512-VEI7OdvK2wP7XHnsuXbAJnEpEkF6NjSN45QJlL4VGqZSXsnicpesdTWsg9RISeSdYd3yeRj/y3k5KGjUXYnFwQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1078,17 +1078,17 @@ } }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.12.2.tgz", - "integrity": "sha512-gQxbxM8mcxBwaEmWdtLCIGLfixBMHhQjBqR8sVWNTPpcj45WlYL2IObS/DNMLH1DBP0n8qz+aiiLTGfopPEebw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.15.0.tgz", + "integrity": "sha512-+zkm9AR1Ds9uLWN3fkoeXgFppaQ+uEVtfOV62dDmsy9QCNqlRHWNEck4yarvRNrvRcHQLGfqBNui3cimoz8XAg==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.12.2", - "@typescript-eslint/type-utils": "8.12.2", - "@typescript-eslint/utils": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2", + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/type-utils": "8.15.0", + "@typescript-eslint/utils": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "graphemer": "^1.4.0", "ignore": "^5.3.1", "natural-compare": "^1.4.0", @@ -1112,16 +1112,16 @@ } }, "node_modules/@typescript-eslint/parser": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.12.2.tgz", - "integrity": "sha512-MrvlXNfGPLH3Z+r7Tk+Z5moZAc0dzdVjTgUgwsdGweH7lydysQsnSww3nAmsq8blFuRD5VRlAr9YdEFw3e6PBw==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.15.0.tgz", + "integrity": "sha512-7n59qFpghG4uazrF9qtGKBZXn7Oz4sOMm8dwNWDQY96Xlm2oX67eipqcblDj+oY1lLCbf1oltMZFpUso66Kl1A==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/scope-manager": "8.12.2", - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/typescript-estree": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2", + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/typescript-estree": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4" }, "engines": { @@ -1141,14 +1141,14 @@ } }, "node_modules/@typescript-eslint/scope-manager": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.12.2.tgz", - "integrity": "sha512-gPLpLtrj9aMHOvxJkSbDBmbRuYdtiEbnvO25bCMza3DhMjTQw0u7Y1M+YR5JPbMsXXnSPuCf5hfq0nEkQDL/JQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.15.0.tgz", + "integrity": "sha512-QRGy8ADi4J7ii95xz4UoiymmmMd/zuy9azCaamnZ3FM8T5fZcex8UfJcjkiEZjJSztKfEBe3dZ5T/5RHAmw2mA==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2" + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1159,14 +1159,14 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.12.2.tgz", - "integrity": "sha512-bwuU4TAogPI+1q/IJSKuD4shBLc/d2vGcRT588q+jzayQyjVK2X6v/fbR4InY2U2sgf8MEvVCqEWUzYzgBNcGQ==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.15.0.tgz", + "integrity": "sha512-UU6uwXDoI3JGSXmcdnP5d8Fffa2KayOhUUqr/AiBnG1Gl7+7ut/oyagVeSkh7bxQ0zSXV9ptRh/4N15nkCqnpw==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "8.12.2", - "@typescript-eslint/utils": "8.12.2", + "@typescript-eslint/typescript-estree": "8.15.0", + "@typescript-eslint/utils": "8.15.0", "debug": "^4.3.4", "ts-api-utils": "^1.3.0" }, @@ -1177,6 +1177,9 @@ "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0" + }, "peerDependenciesMeta": { "typescript": { "optional": true @@ -1184,9 +1187,9 @@ } }, "node_modules/@typescript-eslint/types": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.12.2.tgz", - "integrity": "sha512-VwDwMF1SZ7wPBUZwmMdnDJ6sIFk4K4s+ALKLP6aIQsISkPv8jhiw65sAK6SuWODN/ix+m+HgbYDkH+zLjrzvOA==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.15.0.tgz", + "integrity": "sha512-n3Gt8Y/KyJNe0S3yDCD2RVKrHBC4gTUcLTebVBXacPy091E6tNspFLKRXlk3hwT4G55nfr1n2AdFqi/XMxzmPQ==", "dev": true, "license": "MIT", "engines": { @@ -1198,14 +1201,14 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.12.2.tgz", - "integrity": "sha512-mME5MDwGe30Pq9zKPvyduyU86PH7aixwqYR2grTglAdB+AN8xXQ1vFGpYaUSJ5o5P/5znsSBeNcs5g5/2aQwow==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.15.0.tgz", + "integrity": "sha512-1eMp2JgNec/niZsR7ioFBlsh/Fk0oJbhaqO0jRyQBMgkz7RrFfkqF9lYYmBoGBaSiLnu8TAPQTwoTUiSTUW9dg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/visitor-keys": "8.12.2", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/visitor-keys": "8.15.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", @@ -1227,16 +1230,16 @@ } }, "node_modules/@typescript-eslint/utils": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.12.2.tgz", - "integrity": "sha512-UTTuDIX3fkfAz6iSVa5rTuSfWIYZ6ATtEocQ/umkRSyC9O919lbZ8dcH7mysshrCdrAM03skJOEYaBugxN+M6A==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.15.0.tgz", + "integrity": "sha512-k82RI9yGhr0QM3Dnq+egEpz9qB6Un+WLYhmoNcvl8ltMEededhh7otBVVIDDsEEttauwdY/hQoSsOv13lxrFzQ==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", - "@typescript-eslint/scope-manager": "8.12.2", - "@typescript-eslint/types": "8.12.2", - "@typescript-eslint/typescript-estree": "8.12.2" + "@typescript-eslint/scope-manager": "8.15.0", + "@typescript-eslint/types": "8.15.0", + "@typescript-eslint/typescript-estree": "8.15.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1247,17 +1250,22 @@ }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "8.12.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.12.2.tgz", - "integrity": "sha512-PChz8UaKQAVNHghsHcPyx1OMHoFRUEA7rJSK/mDhdq85bk+PLsUHUBqTQTFt18VJZbmxBovM65fezlheQRsSDA==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.15.0.tgz", + "integrity": "sha512-h8vYOulWec9LhpwfAdZf2bjr8xIp0KNKnpgqSz0qqYYKAW/QZKw3ktRndbiAtUz4acH4QLQavwZBYCc0wulA/Q==", "dev": true, "license": "MIT", "dependencies": { - "@typescript-eslint/types": "8.12.2", - "eslint-visitor-keys": "^3.4.3" + "@typescript-eslint/types": "8.15.0", + "eslint-visitor-keys": "^4.2.0" }, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" @@ -1267,6 +1275,19 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.0.tgz", + "integrity": "sha512-UyLnSehNt62FFhSwjZlHmeokpRK59rcz29j+F1/aDgbkbRTk7wIc9XzdoasMUbRNKDM0qQt/+BJ4BrpFeABemw==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/acorn": { "version": "8.14.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", @@ -1446,9 +1467,9 @@ } }, "node_modules/bare-stream": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.3.2.tgz", - "integrity": "sha512-EFZHSIBkDgSHIwj2l2QZfP4U5OcD4xFAOwhSb/vlr9PIqyGJGvB/nfClJbcnh3EY4jtPE4zsb5ztae96bVF79A==", + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.4.0.tgz", + "integrity": "sha512-sd96/aZ8LjF1uJbEHzIo1LrERPKRFPEy1nZ1eOILftBxrVsFDAQkimHIIq87xrHcubzjNeETsD9PwN0wp+vLiQ==", "dev": true, "license": "Apache-2.0", "optional": true, @@ -1874,9 +1895,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -2048,9 +2069,9 @@ } }, "node_modules/devtools-protocol": { - "version": "0.0.1354347", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1354347.tgz", - "integrity": "sha512-BlmkSqV0V84E2WnEnoPnwyix57rQxAM5SKJjf4TbYOCGLAWtz8CDH8RIaGOjPgPCXo2Mce3kxSY497OySidY3Q==", + "version": "0.0.1367902", + "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1367902.tgz", + "integrity": "sha512-XxtPuC3PGakY6PD7dG66/o8KwJ/LkH2/EKe19Dcw58w53dv4/vSQEkn/SzuyhHE2q4zPgCkxQBxus3VV4ql+Pg==", "dev": true, "license": "BSD-3-Clause" }, @@ -2151,27 +2172,27 @@ } }, "node_modules/eslint": { - "version": "9.14.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.14.0.tgz", - "integrity": "sha512-c2FHsVBr87lnUtjP4Yhvk4yEhKrQavGafRA/Se1ouse8PfbfC/Qh9Mxa00yWsZRlqeUB9raXip0aiiUZkgnr9g==", + "version": "9.15.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.15.0.tgz", + "integrity": "sha512-7CrWySmIibCgT1Os28lUU6upBshZ+GxybLOrmRzi08kS8MBuO8QA7pXEgYgY5W8vK3e74xv0lpjo9DbaGU9Rkw==", "dev": true, "license": "MIT", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", - "@eslint/config-array": "^0.18.0", - "@eslint/core": "^0.7.0", - "@eslint/eslintrc": "^3.1.0", - "@eslint/js": "9.14.0", - "@eslint/plugin-kit": "^0.2.0", + "@eslint/config-array": "^0.19.0", + "@eslint/core": "^0.9.0", + "@eslint/eslintrc": "^3.2.0", + "@eslint/js": "9.15.0", + "@eslint/plugin-kit": "^0.2.3", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", - "@humanwhocodes/retry": "^0.4.0", + "@humanwhocodes/retry": "^0.4.1", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", - "cross-spawn": "^7.0.2", + "cross-spawn": "^7.0.5", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.2.0", @@ -2190,8 +2211,7 @@ "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.3", - "text-table": "^0.2.0" + "optionator": "^0.9.3" }, "bin": { "eslint": "bin/eslint.js" @@ -2590,9 +2610,9 @@ } }, "node_modules/flatted": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.1.tgz", - "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.2.tgz", + "integrity": "sha512-AiwGJM8YcNOaobumgtng+6NHuOqC3A7MixFeDafM3X9cIUM+xUXoS5Vfgf+OihAYe20fxqNM9yPBXJzRtZ/4eA==", "dev": true, "license": "ISC" }, @@ -3762,18 +3782,18 @@ } }, "node_modules/puppeteer": { - "version": "23.6.1", - "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.6.1.tgz", - "integrity": "sha512-8+ALGQgwXd3P/tGcuSsxTPGDaOQIjcDIm04I5hpWZv/PiN5q8bQNHRUyfYrifT+flnM9aTWCP7tLEzuB6SlIgA==", + "version": "23.9.0", + "resolved": "https://registry.npmjs.org/puppeteer/-/puppeteer-23.9.0.tgz", + "integrity": "sha512-WfB8jGwFV+qrD9dcJJVvWPFJBU6kxeu2wxJz9WooDGfM3vIiKLgzImEDBxUQnCBK/2cXB3d4dV6gs/LLpgfLDg==", "dev": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.4.0", + "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "cosmiconfig": "^9.0.0", - "devtools-protocol": "0.0.1354347", - "puppeteer-core": "23.6.1", + "devtools-protocol": "0.0.1367902", + "puppeteer-core": "23.9.0", "typed-query-selector": "^2.12.0" }, "bin": { @@ -3784,16 +3804,16 @@ } }, "node_modules/puppeteer-core": { - "version": "23.6.1", - "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.6.1.tgz", - "integrity": "sha512-DoNLAzQfGklPauEn33N4h9cM9GubJSINEn+AUMwAXwW159Y9JLk5y34Jsbv4c7kG8P0puOYWV9leu2siMZ/QpQ==", + "version": "23.9.0", + "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-23.9.0.tgz", + "integrity": "sha512-hLVrav2HYMVdK0YILtfJwtnkBAwNOztUdR4aJ5YKDvgsbtagNr6urUJk9HyjRA9e+PaLI3jzJ0wM7A4jSZ7Qxw==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@puppeteer/browsers": "2.4.0", + "@puppeteer/browsers": "2.4.1", "chromium-bidi": "0.8.0", "debug": "^4.3.7", - "devtools-protocol": "0.0.1354347", + "devtools-protocol": "0.0.1367902", "typed-query-selector": "^2.12.0", "ws": "^8.18.0" }, @@ -4121,9 +4141,9 @@ } }, "node_modules/streamx": { - "version": "2.20.1", - "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.1.tgz", - "integrity": "sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==", + "version": "2.20.2", + "resolved": "https://registry.npmjs.org/streamx/-/streamx-2.20.2.tgz", + "integrity": "sha512-aDGDLU+j9tJcUdPGOaHmVF1u/hhI+CsGkT02V3OKlHDV7IukOI+nTWAGkiZEKCO35rWN1wIr4tS7YFr1f4qSvA==", "dev": true, "license": "MIT", "dependencies": { @@ -4296,13 +4316,6 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/text-table": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "license": "MIT" - }, "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -4369,9 +4382,9 @@ "license": "MIT" }, "node_modules/typescript": { - "version": "5.6.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz", - "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "license": "Apache-2.0", "bin": { diff --git a/package.json b/package.json index e20b1f070..556a28d02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bytecodealliance/jco", - "version": "1.7.2", + "version": "1.8.1", "description": "JavaScript tooling for working with WebAssembly Components", "author": "Guy Bedford", "bin": { @@ -24,7 +24,7 @@ }, "type": "module", "dependencies": { - "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/componentize-js": "^0.15.0", "@bytecodealliance/preview2-shim": "^0.17.1", "binaryen": "^120.0.0", "chalk-template": "^1", diff --git a/src/jco.js b/src/jco.js index b4b78ca92..99ef7cde6 100755 --- a/src/jco.js +++ b/src/jco.js @@ -11,7 +11,7 @@ program .name('jco') .description(c`{bold jco - WebAssembly JS Component Tools}\n JS Component Transpilation Bindgen & Wasm Tools for JS`) .usage(' [options]') - .version('1.7.2'); + .version('1.8.1'); function myParseInt(value) { return parseInt(value, 10); diff --git a/submodules/WASI-Virt b/submodules/WASI-Virt index 8900d799f..4ea3e769b 160000 --- a/submodules/WASI-Virt +++ b/submodules/WASI-Virt @@ -1 +1 @@ -Subproject commit 8900d799fa38a43ad5f55d446e8acf6df1a53adb +Subproject commit 4ea3e769b396df1f894b65a8095904846c6f3ca3 diff --git a/submodules/wasm-tools b/submodules/wasm-tools index c9218cf2f..8f17e78ac 160000 --- a/submodules/wasm-tools +++ b/submodules/wasm-tools @@ -1 +1 @@ -Subproject commit c9218cf2f439ff38bdb6fbf172fcc237b971ea03 +Subproject commit 8f17e78ac927c8af60a46f81e2ee0e22d96c743b diff --git a/submodules/wasmtime b/submodules/wasmtime index e01f9508f..d9a6d5a9e 160000 --- a/submodules/wasmtime +++ b/submodules/wasmtime @@ -1 +1 @@ -Subproject commit e01f9508f71ef176de2e517672fcc440ce9ff478 +Subproject commit d9a6d5a9edb07e1893725d89c71ec2795b1cf9a8 diff --git a/submodules/wit-bindgen b/submodules/wit-bindgen index 20d33b525..d92b53b26 160000 --- a/submodules/wit-bindgen +++ b/submodules/wit-bindgen @@ -1 +1 @@ -Subproject commit 20d33b525e766451a621f57a48d5d2cbe7f779fd +Subproject commit d92b53b261433e946c144349298d079b14f1dbc1 diff --git a/test/api.js b/test/api.js index ee9197842..57e9d4f0c 100644 --- a/test/api.js +++ b/test/api.js @@ -148,13 +148,13 @@ export async function apiTest(_fixtures) { const meta = await metadataShow(newComponent); deepStrictEqual(meta[0].metaType, { tag: "component", - val: 4, + val: 5, }); deepStrictEqual(meta[1].producers, [ [ "processed-by", [ - ["wit-component", "0.218.0"], + ["wit-component", "0.219.1"], ["dummy-gen", "test"], ], ], @@ -189,13 +189,13 @@ export async function apiTest(_fixtures) { const meta = await metadataShow(newComponent); deepStrictEqual(meta[0].metaType, { tag: "component", - val: 1, + val: 2, }); deepStrictEqual(meta[1].producers, [ [ "processed-by", [ - ["wit-component", "0.218.0"], + ["wit-component", "0.219.1"], ["dummy-gen", "test"], ], ], diff --git a/test/cli.js b/test/cli.js index 07277d97e..de4632f92 100644 --- a/test/cli.js +++ b/test/cli.js @@ -455,12 +455,12 @@ export async function cliTest(_fixtures) { ); strictEqual(stderr, ""); const meta = JSON.parse(stdout); - deepStrictEqual(meta[0].metaType, { tag: "component", val: 4 }); + deepStrictEqual(meta[0].metaType, { tag: "component", val: 5 }); deepStrictEqual(meta[1].producers, [ [ "processed-by", [ - ["wit-component", "0.218.0"], + ["wit-component", "0.219.1"], ["dummy-gen", "test"], ], ], diff --git a/test/codegen.js b/test/codegen.js index 7e5911b38..994da28a4 100644 --- a/test/codegen.js +++ b/test/codegen.js @@ -26,27 +26,23 @@ export async function readFlags (fixture) { export async function codegenTest (fixtures) { suite(`Transpiler codegen`, () => { for (const fixture of fixtures) { - const name = fixture.replace(/(\.component)?\.(wasm|wat)$/, ''); + const testName = fixture.replace(/(\.component)?\.(wasm|wat)$/, ''); - for (const testFile of (readdirSync('test/runtime/')).filter(testFile => testFile.startsWith(`${name}.`))) { - const testName= testFile.replace(/\.ts$/, ''); + test(`${testName} transpile`, async () => { + const flags = await readFlags(`test/runtime/${testName}.ts`); + var { stderr } = await exec(jcoPath, 'transpile', `test/fixtures/components/${fixture}`, '--name', testName, ...flags, '-o', `test/output/${testName}`); + strictEqual(stderr, ''); + }); - test(`${testName} transpile`, async () => { - const flags = await readFlags(`test/runtime/${testFile}`); - var { stderr } = await exec(jcoPath, 'transpile', `test/fixtures/components/${fixture}`, '--name', testName, ...flags, '-o', `test/output/${testName}`); - strictEqual(stderr, ''); - }); + test(`${testName} lint`, async () => { + const flags = await readFlags(`test/runtime/${testName}.ts`); - test(`${testName} lint`, async () => { - const flags = await readFlags(`test/runtime/${testFile}`); + if (flags.includes('--js')) + return; - if (flags.includes('--js')) - return; - - var { stderr } = await exec(eslintPath, `test/output/${testName}/${testName}.js`, '-c', 'test/eslintrc.cjs'); - strictEqual(stderr, ''); - }); - } + var { stderr } = await exec(eslintPath, `test/output/${testName}/${testName}.js`, '-c', 'test/eslintrc.cjs'); + strictEqual(stderr, ''); + }); } }); diff --git a/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm b/test/fixtures/components/borrowing-duplicate-if-necessary.component.wasm index f9e2cabcd..b4b890403 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 05ff43ad3..bb70fb7ab 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 18cb52573..176e94185 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 6b395f795..a92cf44fb 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 b5edd5b6a..9f828b594 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 e332bd036..50b6a3205 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 6182615e3..07c9d7832 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 2edd5befd..391e6f8a8 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/options.component.wasm b/test/fixtures/components/options.component.wasm index df0b58f36..2b022c7b8 100644 Binary files a/test/fixtures/components/options.component.wasm and b/test/fixtures/components/options.component.wasm differ diff --git a/test/fixtures/components/other-dependencies.component.wasm b/test/fixtures/components/other-dependencies.component.wasm index fb55ccc50..72f17be81 100644 Binary files a/test/fixtures/components/other-dependencies.component.wasm and b/test/fixtures/components/other-dependencies.component.wasm differ diff --git a/test/fixtures/components/owning.component.wasm b/test/fixtures/components/owning.component.wasm index d4efade1c..3b575fcd6 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 3560ee9e4..213d4d1d8 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/resource-borrow-simple.component.wasm b/test/fixtures/components/resource-borrow-simple.component.wasm deleted file mode 100644 index b7c1b2d58..000000000 Binary files a/test/fixtures/components/resource-borrow-simple.component.wasm and /dev/null differ diff --git a/test/fixtures/components/resource-import-and-export.component.wasm b/test/fixtures/components/resource-import-and-export.component.wasm index 3ec3d6879..958ab3dca 100644 Binary files a/test/fixtures/components/resource-import-and-export.component.wasm and b/test/fixtures/components/resource-import-and-export.component.wasm differ diff --git a/test/fixtures/components/resource_aggregates.component.wasm b/test/fixtures/components/resource_aggregates.component.wasm index 850677a8c..564295cf3 100644 Binary files a/test/fixtures/components/resource_aggregates.component.wasm and b/test/fixtures/components/resource_aggregates.component.wasm differ diff --git a/test/fixtures/components/resource_alias.component.wasm b/test/fixtures/components/resource_alias.component.wasm index 1dafc240f..b7c354a4c 100644 Binary files a/test/fixtures/components/resource_alias.component.wasm and b/test/fixtures/components/resource_alias.component.wasm differ diff --git a/test/fixtures/components/resource_alias_redux.component.wasm b/test/fixtures/components/resource_alias_redux.component.wasm index d2a32aad6..af69ad23f 100644 Binary files a/test/fixtures/components/resource_alias_redux.component.wasm and b/test/fixtures/components/resource_alias_redux.component.wasm differ diff --git a/test/fixtures/components/resource_borrow_export.component.wasm b/test/fixtures/components/resource_borrow_export.component.wasm index 8bccb6cc7..43315dce3 100644 Binary files a/test/fixtures/components/resource_borrow_export.component.wasm and b/test/fixtures/components/resource_borrow_export.component.wasm differ diff --git a/test/fixtures/components/resource_borrow_import.component.wasm b/test/fixtures/components/resource_borrow_import.component.wasm index 573740540..d6b53fe55 100644 Binary files a/test/fixtures/components/resource_borrow_import.component.wasm and b/test/fixtures/components/resource_borrow_import.component.wasm differ diff --git a/test/fixtures/components/resource_borrow_in_record.component.wasm b/test/fixtures/components/resource_borrow_in_record.component.wasm index 895f11c21..ee40d572a 100644 Binary files a/test/fixtures/components/resource_borrow_in_record.component.wasm and b/test/fixtures/components/resource_borrow_in_record.component.wasm differ diff --git a/test/fixtures/components/resource_borrow_simple.component.wasm b/test/fixtures/components/resource_borrow_simple.component.wasm index 32110409d..002fc0b2a 100644 Binary files a/test/fixtures/components/resource_borrow_simple.component.wasm and b/test/fixtures/components/resource_borrow_simple.component.wasm differ diff --git a/test/fixtures/components/resource_floats.component.wasm b/test/fixtures/components/resource_floats.component.wasm index f429640e5..7be36ba95 100644 Binary files a/test/fixtures/components/resource_floats.component.wasm and b/test/fixtures/components/resource_floats.component.wasm differ diff --git a/test/fixtures/components/resource_import_and_export.component.wasm b/test/fixtures/components/resource_import_and_export.component.wasm index 9ef96fa8e..169437ec8 100644 Binary files a/test/fixtures/components/resource_import_and_export.component.wasm and b/test/fixtures/components/resource_import_and_export.component.wasm differ diff --git a/test/fixtures/components/resource_into_inner.component.wasm b/test/fixtures/components/resource_into_inner.component.wasm index d592d556b..e2ad6c17b 100644 Binary files a/test/fixtures/components/resource_into_inner.component.wasm and b/test/fixtures/components/resource_into_inner.component.wasm differ diff --git a/test/fixtures/components/resource_with_lists.component.wasm b/test/fixtures/components/resource_with_lists.component.wasm index 7b1c4ab53..3ef09bedc 100644 Binary files a/test/fixtures/components/resource_with_lists.component.wasm and b/test/fixtures/components/resource_with_lists.component.wasm differ diff --git a/test/fixtures/components/resources.component.wasm b/test/fixtures/components/resources.component.wasm index b16da4ec7..58d5453ad 100644 Binary files a/test/fixtures/components/resources.component.wasm and b/test/fixtures/components/resources.component.wasm differ diff --git a/test/fixtures/components/results.component.wasm b/test/fixtures/components/results.component.wasm index e511fa592..7583f8804 100644 Binary files a/test/fixtures/components/results.component.wasm and b/test/fixtures/components/results.component.wasm differ diff --git a/test/fixtures/components/rust_xcrate.component.wasm b/test/fixtures/components/rust_xcrate.component.wasm index f468741d7..a5229f25a 100644 Binary files a/test/fixtures/components/rust_xcrate.component.wasm and b/test/fixtures/components/rust_xcrate.component.wasm differ diff --git a/test/fixtures/components/smoke.component.wasm b/test/fixtures/components/smoke.component.wasm index d6b2bd4ec..51ef235b2 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 ffb07172b..3f6e6f7dc 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/type_section_suffix.component.wasm b/test/fixtures/components/type_section_suffix.component.wasm index d6a72b8cf..33df31622 100644 Binary files a/test/fixtures/components/type_section_suffix.component.wasm and b/test/fixtures/components/type_section_suffix.component.wasm differ diff --git a/test/fixtures/components/variants.component.wasm b/test/fixtures/components/variants.component.wasm index 82af0cdb0..e437cdb10 100644 Binary files a/test/fixtures/components/variants.component.wasm and b/test/fixtures/components/variants.component.wasm differ diff --git a/test/fixtures/components/versions.component.wasm b/test/fixtures/components/versions.component.wasm index ac646eca6..898edcf19 100644 Binary files a/test/fixtures/components/versions.component.wasm and b/test/fixtures/components/versions.component.wasm differ diff --git a/test/fixtures/env-allow.composed.wasm b/test/fixtures/env-allow.composed.wasm index a88c61a40..a14801de9 100644 Binary files a/test/fixtures/env-allow.composed.wasm and b/test/fixtures/env-allow.composed.wasm differ diff --git a/test/fixtures/stdio.composed.wasm b/test/fixtures/stdio.composed.wasm index 6824b167d..50e79ea10 100644 Binary files a/test/fixtures/stdio.composed.wasm and b/test/fixtures/stdio.composed.wasm differ diff --git a/test/runtime/resource_borrow_simple.ts b/test/runtime/resource_borrow_simple.ts new file mode 100644 index 000000000..523678652 --- /dev/null +++ b/test/runtime/resource_borrow_simple.ts @@ -0,0 +1,57 @@ +// Flags: --map testwasi=../helpers.js --map r=../resource_borrow_simple.js#R test=../resource_borrow_simple.js#test + +// @ts-nocheck +import * as assert from "assert"; + +/* +WIT definition (for reference): + +package root:component; + +world root { + import wasi:cli/environment@0.2.0; + import wasi:cli/exit@0.2.0; + import wasi:io/error@0.2.0; + import wasi:io/streams@0.2.0; + import wasi:cli/stdin@0.2.0; + import wasi:cli/stdout@0.2.0; + import wasi:cli/stderr@0.2.0; + import wasi:clocks/wall-clock@0.2.0; + import wasi:filesystem/types@0.2.0; + import wasi:filesystem/preopens@0.2.0; + import test: func(r: borrow); + + resource r { + constructor(); + } + + export test-imports: func(); +} +*/ + +// Imports +let constructed = false; +export class R { + constructor() { + constructed = true; + } +} + +let tested = false; +export function test(r) { + assert.ok(r instanceof R); + tested = true; +} + +export async function run() { + const wasm = await import( + "../output/resource_borrow_simple/resource_borrow_simple.js" + ); + + wasm.testImports(); + assert.ok(constructed); + assert.ok(tested); +} + +// TLA cycle avoidance +setTimeout(run); diff --git a/test/tsconfig.json b/test/tsconfig.json index 0470c46a0..9d7bf1341 100644 --- a/test/tsconfig.json +++ b/test/tsconfig.json @@ -1,5 +1,11 @@ { "include": ["runtime/*.ts"], + "TODO": "why are these runtime tests excluded?", + "exclude": [ + "runtime/strings.async+js.ts", + "runtime/strings.sync+js.ts", + "runtime/strings.sync.ts" + ], "compilerOptions": { "outDir": "output", "module": "nodenext",