diff --git a/.gitignore b/.gitignore index 6aa44ff1..faf250de 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,3 @@ target/ /shared example/package-lock.json example/hello.component.wasm -/test/wit/deps \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 74e24641..06652f81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,9 +15,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "autocfg" @@ -27,9 +27,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bitflags" @@ -39,9 +39,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.1.0" +version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70beb79cbb5ce9c4f8e20849978f34225931f665bb49efa6982875a4d5facb3" +checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" [[package]] name = "cfg-if" @@ -51,9 +51,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "cranelift-entity" -version = "0.95.1" +version = "0.97.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40099d38061b37e505e63f89bab52199037a72b931ad4868d9089ff7268660b0" +checksum = "d6565198b5684367371e2b946ceca721eb36965e75e3592fad12fc2e15f65d7b" dependencies = [ "serde", ] @@ -75,18 +75,18 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] [[package]] name = "gimli" -version = "0.27.2" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" dependencies = [ "fallible-iterator", "indexmap", @@ -134,9 +134,9 @@ checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -156,14 +156,13 @@ dependencies = [ [[package]] name = "js-component-bindgen" version = "0.1.0" -source = "git+https://github.com/bytecodealliance/jco?rev=e56500595f8e25a7d1761e727df0c1cac46c211d#e56500595f8e25a7d1761e727df0c1cac46c211d" +source = "git+https://github.com/bytecodealliance/jco?rev=e93527eb3f8566271d1ccb67608693117433d390#e93527eb3f8566271d1ccb67608693117433d390" dependencies = [ "anyhow", "base64", "heck 0.4.1", "indexmap", "wasmtime-environ", - "wit-bindgen", "wit-component", "wit-parser", ] @@ -176,12 +175,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -191,9 +187,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "object" -version = "0.30.3" +version = "0.30.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +checksum = "03b4680b86d9cfafba8fc491dc9b6df26b68cf40e9e6cd73909194759a63c385" dependencies = [ "crc32fast", "hashbrown 0.13.2", @@ -203,21 +199,21 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -235,31 +231,37 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] +[[package]] +name = "semver" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" + [[package]] name = "serde" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -270,8 +272,8 @@ dependencies = [ "heck 0.4.1", "js-component-bindgen", "walrus", - "wasm-encoder 0.27.0", - "wasmparser 0.105.0", + "wasm-encoder", + "wasmparser 0.107.0", "wasmtime-environ", "wit-bindgen", "wit-component", @@ -297,9 +299,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", @@ -308,9 +310,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.6" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae9980cab1db3fceee2f6c6f643d5d8de2997c58ee8d25fb0cc8a9e9e7348e5" +checksum = "1b1c7f239eb94671427157bd93b3694320f3668d4e1eff08c7285366fd777fac" [[package]] name = "thiserror" @@ -329,7 +331,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.18", ] [[package]] @@ -364,9 +366,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -397,9 +399,9 @@ checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -440,33 +442,24 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.25.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eff853c4f09eec94d76af527eddad4e9de13b11d6286a1ef7134bc30135a2b7" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.27.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e77053dc709db790691d3732cfc458adc5acc881dec524965c608effdcd9c581" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.6.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27e6532071b112df81d756fabafab8cc882b84ae3d6ce9b90f3d90c80e4abe05" +checksum = "36e5156581ff4a302405c44ca7c85347563ca431d15f1a773f12c9c7b9a6cdc9" dependencies = [ "anyhow", "indexmap", "serde", - "wasm-encoder 0.27.0", - "wasmparser 0.105.0", + "wasm-encoder", + "wasmparser 0.107.0", ] [[package]] @@ -477,55 +470,35 @@ checksum = "5fe3d5405e9ea6c1317a656d6e0820912d8b7b3607823a7596117c8f666daf6f" [[package]] name = "wasmparser" -version = "0.102.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48134de3d7598219ab9eaf6b91b15d8e50d31da76b8519fe4ecfcec2cf35104b" -dependencies = [ - "indexmap", - "url", -] - -[[package]] -name = "wasmparser" -version = "0.103.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c437373cac5ea84f1113d648d51f71751ffbe3d90c00ae67618cf20d0b5ee7b" -dependencies = [ - "indexmap", - "url", -] - -[[package]] -name = "wasmparser" -version = "0.105.0" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83be9e0b3f9570dc1979a33ae7b89d032c73211564232b99976553e5c155ec32" +checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" dependencies = [ "indexmap", - "url", + "semver", ] [[package]] name = "wasmprinter" -version = "0.2.55" +version = "0.2.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51befda9d7eefac615a2ef75f42d2f2bd243cdabaa141a8ea0f9ffa3fc79ccf4" +checksum = "cc960b30b84abca377768f3c62cff3a1c74db8c0f6759ed581827da0bd3a3fed" dependencies = [ "anyhow", - "wasmparser 0.103.0", + "wasmparser 0.107.0", ] [[package]] name = "wasmtime-component-util" -version = "8.0.1" +version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74e02ca7a4a3c69d72b88f26f0192e333958df6892415ac9ab84dcc42c9000c2" +checksum = "f20a5135ec5ef01080e674979b02d6fa5eebaa2b0c2d6660513ee9956a1bf624" [[package]] name = "wasmtime-environ" -version = "8.0.1" +version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a990198cee4197423045235bf89d3359e69bd2ea031005f4c2d901125955c949" +checksum = "41f9e58e0ee7d43ff13e75375c726b16bce022db798d3a099a65eeaa7d7a544b" dependencies = [ "anyhow", "cranelift-entity", @@ -536,8 +509,8 @@ dependencies = [ "serde", "target-lexicon", "thiserror", - "wasm-encoder 0.25.0", - "wasmparser 0.102.0", + "wasm-encoder", + "wasmparser 0.107.0", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -545,50 +518,50 @@ dependencies = [ [[package]] name = "wasmtime-types" -version = "8.0.1" +version = "10.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f6fffd2a1011887d57f07654dd112791e872e3ff4a2e626aee8059ee17f06f" +checksum = "dcbb7c138f797192f46afdd3ec16f85ef007c3bb45fa8e5174031f17b0be4c4a" dependencies = [ "cranelift-entity", "serde", "thiserror", - "wasmparser 0.102.0", + "wasmparser 0.107.0", ] [[package]] name = "wast" -version = "58.0.0" +version = "60.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372eecae2d10a5091c2005b32377d7ecd6feecdf2c05838056d02d8b4f07c429" +checksum = "bd06cc744b536e30387e72a48fdd492105b9c938bb4f415c39c616a7a0a697ad" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.27.0", + "wasm-encoder", ] [[package]] name = "wat" -version = "1.0.64" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d47446190e112ab1579ab40b3ad7e319d859d74e5134683f04e9f0747bf4173" +checksum = "5abe520f0ab205366e9ac7d3e6b2fc71de44e32a2b58f2ec871b6b575bdcea3b" dependencies = [ "wast", ] [[package]] name = "wit-bindgen" -version = "0.6.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=c1eb6ba2ffe303574219a3787aa1187d70d877ec#c1eb6ba2ffe303574219a3787aa1187d70d877ec" +version = "0.7.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=e69cf5db8754f829637e25491c560ec0d9728852#e69cf5db8754f829637e25491c560ec0d9728852" dependencies = [ - "bitflags 2.1.0", + "bitflags 2.3.2", "wit-bindgen-rust-macro", ] [[package]] name = "wit-bindgen-core" -version = "0.6.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=c1eb6ba2ffe303574219a3787aa1187d70d877ec#c1eb6ba2ffe303574219a3787aa1187d70d877ec" +version = "0.7.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=e69cf5db8754f829637e25491c560ec0d9728852#e69cf5db8754f829637e25491c560ec0d9728852" dependencies = [ "anyhow", "wit-component", @@ -597,8 +570,8 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" -version = "0.6.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=c1eb6ba2ffe303574219a3787aa1187d70d877ec#c1eb6ba2ffe303574219a3787aa1187d70d877ec" +version = "0.7.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=e69cf5db8754f829637e25491c560ec0d9728852#e69cf5db8754f829637e25491c560ec0d9728852" dependencies = [ "heck 0.4.1", "wasm-metadata", @@ -609,8 +582,8 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-lib" -version = "0.6.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=c1eb6ba2ffe303574219a3787aa1187d70d877ec#c1eb6ba2ffe303574219a3787aa1187d70d877ec" +version = "0.7.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=e69cf5db8754f829637e25491c560ec0d9728852#e69cf5db8754f829637e25491c560ec0d9728852" dependencies = [ "heck 0.4.1", "wit-bindgen-core", @@ -618,12 +591,12 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.6.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=c1eb6ba2ffe303574219a3787aa1187d70d877ec#c1eb6ba2ffe303574219a3787aa1187d70d877ec" +version = "0.7.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=e69cf5db8754f829637e25491c560ec0d9728852#e69cf5db8754f829637e25491c560ec0d9728852" dependencies = [ "anyhow", "proc-macro2", - "syn 2.0.15", + "syn 2.0.18", "wit-bindgen-core", "wit-bindgen-rust", "wit-component", @@ -631,33 +604,33 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3cc435c15009f80d5e114d0dd3792959171f1fc28be2418e0f570d83b925a33" +checksum = "7cbd4c7f8f400327c482c88571f373844b7889e61460650d650fc5881bb3575c" dependencies = [ "anyhow", "bitflags 1.3.2", "indexmap", "log", - "url", - "wasm-encoder 0.27.0", + "wasm-encoder", "wasm-metadata", - "wasmparser 0.105.0", + "wasmparser 0.107.0", "wat", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca2581061573ef6d1754983d7a9b3ed5871ef859d52708ea9a0f5af32919172" +checksum = "6daec9f093dbaea0e94043eeb92ece327bbbe70c86b1f41aca9bbfefd7f050f0" dependencies = [ "anyhow", "id-arena", "indexmap", "log", "pulldown-cmark", + "semver", "unicode-xid", "url", ] diff --git a/Cargo.toml b/Cargo.toml index 2b70475e..d3533edd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,14 +17,13 @@ bitflags = "1.3.2" heck = { version = "0.4", features = ["unicode"] } pulldown-cmark = { version = "0.8", default-features = false } env_logger = "0.10.0" -js-component-bindgen = { git = "https://github.com/bytecodealliance/jco", no-default-features = ["transpile-bindgen"], rev = "e56500595f8e25a7d1761e727df0c1cac46c211d" } +js-component-bindgen = { git = "https://github.com/bytecodealliance/jco", rev = "e93527eb3f8566271d1ccb67608693117433d390", no-default-features = ["transpile-bindgen"] } walrus = "0.19.0" -wasmtime = { version = "8.0.1", features = ["component-model"] } -wasmtime-environ = "8.0.1" -wasmprinter = "0.2.57" -wasmparser = "0.105.0" -wasm-encoder = "0.27.0" -wat = "1.0.64" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "c1eb6ba2ffe303574219a3787aa1187d70d877ec" } -wit-component = { version = "0.9.0", features = ['dummy-module'] } -wit-parser = { version = "0.7.1" } +wasmtime-environ = { version = "10.0.1", features = ["component-model"] } +wasmprinter = "0.2.59" +wasmparser = "0.107.0" +wasm-encoder = "0.29.0" +wat = "1.0.66" +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "e69cf5db8754f829637e25491c560ec0d9728852" } +wit-component = { version = "0.11.0", features = ['dummy-module'] } +wit-parser = "0.8.0" diff --git a/Makefile b/Makefile index 53d516e8..cb6a1208 100644 --- a/Makefile +++ b/Makefile @@ -43,10 +43,10 @@ INCLUDES := -I $(JSCR_SRC) OBJS := $(patsubst spidermonkey_embedding/%.cpp,obj/%.o,$(wildcard spidermonkey_embedding/**/*.cpp)) $(patsubst spidermonkey_embedding/%.cpp,obj/%.o,$(wildcard spidermonkey_embedding/*.cpp)) -all: lib/spidermonkey-embedding-splicer.js lib/spidermonkey_embedding.wasm test/wit/deps +all: lib/spidermonkey-embedding-splicer.js lib/spidermonkey_embedding.wasm lib/spidermonkey-embedding-splicer.js: target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit | obj - $(JCO) new target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm -o obj/spidermonkey-embedding-splicer.wasm --adapt wasi_snapshot_preview1=node_modules/@bytecodealliance/jco/wasi_preview1_component_adapter.reactor.wasm + $(JCO) new target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm -o obj/spidermonkey-embedding-splicer.wasm --adapt wasi_snapshot_preview1=node_modules/@bytecodealliance/jco/lib/wasi_snapshot_preview1.reactor.wasm $(JCO) transpile -q --name spidermonkey-embedding-splicer obj/spidermonkey-embedding-splicer.wasm -o lib -- -O1 target/wasm32-wasi/release/spidermonkey_embedding_splicer.wasm: crates/spidermonkey-embedding-splicer/Cargo.toml crates/spidermonkey-embedding-splicer/src/lib.rs @@ -59,10 +59,6 @@ lib/spidermonkey_embedding.wasm: $(OBJS) | $(SM_SRC) PATH="$(FSM_SRC)/scripts:$$PATH" $(WASI_CXX) $(CXX_FLAGS) $(CXX_OPT) $(DEFINES) $(LD_FLAGS) -o $@ $^ shared/*.a $(wildcard $(SM_SRC)/lib/*.a) $(wildcard $(SM_SRC)/lib/*.o) $(WASM_OPT) --strip-debug $@ -o $@ -O3 -test/wit/deps: preview2-prototyping - mkdir -p $@ - cp -r preview2-prototyping/wit/deps/* $@ - obj/%.o: spidermonkey_embedding/%.cpp Makefile | $(SM_SRC) obj obj/builtins $(WASI_CXX) $(CXX_FLAGS) -O2 $(DEFINES) $(INCLUDES) -I $(SM_SRC)/include -MMD -MP -c -o $@ $< diff --git a/crates/spidermonkey-embedding-splicer/src/bindgen.rs b/crates/spidermonkey-embedding-splicer/src/bindgen.rs index 8f94b4fd..bff90384 100644 --- a/crates/spidermonkey-embedding-splicer/src/bindgen.rs +++ b/crates/spidermonkey-embedding-splicer/src/bindgen.rs @@ -2,6 +2,7 @@ use crate::{uwrite, uwriteln}; use heck::*; use js_component_bindgen::function_bindgen::{ErrHandling, FunctionBindgen}; use js_component_bindgen::intrinsics::{render_intrinsics, Intrinsic}; +use js_component_bindgen::names::LocalNames; use js_component_bindgen::source::Source; use std::collections::{BTreeMap, BTreeSet}; use std::fmt::Write; @@ -28,6 +29,9 @@ struct JsBindgen<'a> { /// List of all intrinsics emitted to `src` so far. all_intrinsics: BTreeSet, + esm_bindgen: EsmBindgen, + local_names: LocalNames, + resolve: &'a Resolve, world: WorldId, sizes: SizeAlign, @@ -66,47 +70,6 @@ pub struct Componentization { pub import_wrappers: Vec<(String, String)>, } -// TODO: bring back these validations of imports -// including using the flattened bindings -// if export_bindings.len() > 0 { -// // error handling -// js_bindings.push_str(&format!( -// "class BindingsError extends Error {{ -// constructor (interfaceName, interfaceType) {{ -// super(`Export \"${{interfaceName}}\" ${{interfaceType}} not exported as expected by the world for \"{source_name}\".`); -// }} -// }}\n" -// )); -// let mut seen_ifaces = HashSet::new(); -// for binding in &export_bindings { -// let expt_name_camel = binding.export_name.to_lower_camel_case(); -// if let Some(name) = &binding.member_name { -// let name_camel = name.to_lower_camel_case(); -// if !seen_ifaces.contains(&expt_name_camel) { -// seen_ifaces.insert(expt_name_camel.to_string()); -// js_bindings.push_str(&format!( -// "if (typeof source_mod['{expt_name_camel}'] !== 'object') throw new BindingsError('{expt_name_camel}', 'object');\n" -// )); -// } -// js_bindings.push_str(&format!( -// "if (typeof source_mod['{expt_name_camel}']['{name_camel}'] !== 'function') throw new BindingsError('{expt_name_camel}.{name_camel}', 'function');\n" -// )); -// let lifting_name = &binding.lifting_name; -// js_bindings.push_str(&format!( -// "const {lifting_name} = source_mod.{expt_name_camel}.{name_camel};\n" -// )); -// } else { -// js_bindings.push_str(&format!( -// "if (typeof source_mod['{expt_name_camel}'] !== 'function') throw new BindingsError('{expt_name_camel}', 'function');\n" -// )); -// let lifting_name = &binding.lifting_name; -// js_bindings.push_str(&format!( -// "const {lifting_name} = source_mod.{expt_name_camel};\n" -// )); -// } -// } -// } - pub fn componentize_bindgen( component: &Component, resolve: &Resolve, @@ -115,6 +78,8 @@ pub fn componentize_bindgen( ) -> Componentization { let mut bindgen = JsBindgen { src: Source::default(), + esm_bindgen: EsmBindgen::default(), + local_names: LocalNames::default(), all_intrinsics: BTreeSet::new(), resolve, world: id, @@ -128,7 +93,12 @@ pub fn componentize_bindgen( bindgen.sizes.fill(resolve); + bindgen + .local_names + .exclude_intrinsics(Intrinsic::get_all_names()); + bindgen.exports_bindgen(); + bindgen.esm_bindgen.populate_export_aliases(); bindgen.imports_bindgen(); @@ -144,7 +114,13 @@ pub fn componentize_bindgen( let impt_list = imports.get_mut(specifier).unwrap(); // this import binding order matters - let binding_name = js_canon_name(item.iface_name.as_ref(), &item.name, ""); + let binding_name = match &item.iface_name { + Some(iface_name) => { + let iface_camel_name = iface_name.to_lower_camel_case(); + format!("{iface_camel_name}${}", item.name.to_lower_camel_case()) + } + None => item.name.to_lower_camel_case(), + }; import_bindings.push(binding_name); impt_list.push(item); @@ -160,7 +136,13 @@ pub fn componentize_bindgen( .. } in impt_list.iter() { - let binding_name = js_canon_name(iface_name.as_ref(), &name, ""); + let binding_name = match &iface_name { + Some(iface_name) => { + let iface_camel_name = iface_name.to_lower_camel_case(); + format!("{iface_camel_name}${}", name.to_lower_camel_case()) + } + None => name.to_lower_camel_case(), + }; let binding_camel = name.to_lower_camel_case(); if *iface { specifier_list.push(format!("import_{binding_name} as {binding_camel}")); @@ -205,6 +187,13 @@ pub fn componentize_bindgen( .join(""), ); + bindgen.esm_bindgen.render_export_imports( + &mut output, + "$source_mod", + &mut bindgen.local_names, + name, + ); + let js_intrinsics = render_intrinsics(&mut bindgen.all_intrinsics, false, true); output.push_str(&js_intrinsics); output.push_str(&bindgen.src); @@ -219,8 +208,22 @@ pub fn componentize_bindgen( impl JsBindgen<'_> { fn exports_bindgen(&mut self) { + // populate reverse map from import names to world items + let mut exports = BTreeMap::new(); + for (key, _) in &self.resolve.worlds[self.world].exports { + let name = match key { + WorldKey::Name(name) => name.to_string(), + WorldKey::Interface(iface) => match self.resolve.id_of(*iface) { + Some(name) => name.to_string(), + None => continue, + }, + }; + exports.insert(name, key.clone()); + } + for (name, export) in &self.component.exports { - let item = &self.resolve.worlds[self.world].exports[name]; + let world_key = &exports[name]; + let item = &self.resolve.worlds[self.world].exports[world_key]; match export { Export::LiftedFunction { ty: _, @@ -231,13 +234,18 @@ impl JsBindgen<'_> { WorldItem::Function(f) => f, WorldItem::Interface(_) | WorldItem::Type(_) => unreachable!(), }; - let callee = js_canon_name(None, &func.name, "$source_mod."); + let local_name = self.local_names.create_once(&func.name).to_string(); + self.esm_bindgen.add_export_binding( + None, + local_name.to_string(), + func.name.to_lower_camel_case(), + ); self.export_bindgen( false, name.into(), None, func.name.to_string(), - &callee, + &local_name, options, func, ); @@ -254,19 +262,25 @@ impl JsBindgen<'_> { _ => unreachable!(), }; let iface = &self.resolve.interfaces[id]; - let name_camel = name.to_lower_camel_case(); let func = &iface.functions[func_name]; - let callee = - js_canon_name(None, &func.name, &format!("$source_mod.{name_camel}.")); + let local_name = self + .local_names + .create_once(&format!("{name}-{func_name}")) + .to_string(); self.export_bindgen( true, name.into(), iface.name.to_owned(), func.name.to_string(), - &callee, + &local_name, options, func, ); + self.esm_bindgen.add_export_binding( + Some(name), + local_name, + func.name.to_lower_camel_case(), + ); } } @@ -280,40 +294,56 @@ impl JsBindgen<'_> { } fn imports_bindgen(&mut self) { + // populate reverse map from import names to world items + let mut imports = BTreeMap::new(); + for (key, _) in &self.resolve.worlds[self.world].imports { + let name = match key { + WorldKey::Name(name) => name.to_string(), + WorldKey::Interface(iface) => match self.resolve.id_of(*iface) { + Some(name) => name.to_string(), + None => continue, + }, + }; + imports.insert(name, key.clone()); + } for init in self.component.initializers.iter() { if let GlobalInitializer::LowerImport(import) = init { let (import_index, path) = &self.component.imports[import.import]; let (import_name, _import_ty) = &self.component.import_types[*import_index]; + let import_key = &imports[import_name]; let (func, iface, iface_name, name, callee_name) = - match &self.resolve.worlds[self.world].imports[import_name.as_str()] { + match &self.resolve.worlds[self.world].imports[import_key] { WorldItem::Function(f) => { assert_eq!(path.len(), 0); - let fname = &f.name; - ( - f, - false, - None, - fname.to_string(), - js_canon_name(None, &fname, "$import_"), - ) + let binding_name = format!("$import_{}", f.name.to_lower_camel_case()); + (f, false, None, f.name.to_string(), binding_name) } WorldItem::Interface(i) => { assert_eq!(path.len(), 1); let iface = &self.resolve.interfaces[*i]; let f = &iface.functions[&path[0]]; + let binding_name = match &iface.name { + Some(iface_name) => format!( + "$import_{}${}", + iface_name.to_lower_camel_case(), + f.name.to_lower_camel_case() + ), + None => format!("$import_{}", import_name.to_lower_camel_case()), + }; let fname = &f.name; - ( - f, - true, - iface.name.clone(), - fname.to_string(), - js_canon_name(iface.name.as_ref(), &fname, "$import_"), - ) + (f, true, iface.name.clone(), fname.to_string(), binding_name) } WorldItem::Type(_) => unreachable!(), }; - let binding_name = js_canon_name(iface_name.as_ref(), &name, "import_"); + let binding_name = match &iface_name { + Some(iface_name) => format!( + "import_{}${}", + iface_name.to_lower_camel_case(), + name.to_lower_camel_case() + ), + None => format!("import_{}", name.to_lower_camel_case()), + }; // imports are canonicalized as exports because // the function bindgen as currently written still makes this assumption @@ -418,7 +448,14 @@ impl JsBindgen<'_> { options: &CanonicalOptions, func: &Function, ) { - let binding_name = js_canon_name(iface_name.as_ref(), &fn_name, "export_"); + let binding_name = match &iface_name { + Some(iface_name) => format!( + "export_{}${}", + iface_name.to_lower_camel_case(), + fn_name.to_lower_camel_case() + ), + None => format!("export_{}", fn_name.to_lower_camel_case()), + }; uwrite!(self.src, "\nexport function {binding_name}"); // exports are canonicalized as imports because @@ -484,13 +521,173 @@ impl JsBindgen<'_> { } } -fn js_canon_name(iface: Option<&String>, name: &str, prefix: &str) -> String { - let camel_name = name.to_lower_camel_case(); - match iface { - Some(iface_name) => { - let iface_camel_name = iface_name.to_lower_camel_case(); - format!("{prefix}{iface_camel_name}${camel_name}") +type LocalName = String; + +enum Binding { + Interface(BTreeMap), + Local(LocalName), +} + +#[derive(Default)] +struct EsmBindgen { + exports: BTreeMap, + export_aliases: BTreeMap, +} + +impl EsmBindgen { + /// add an exported function binding, optionally on an interface id or kebab name + pub fn add_export_binding( + &mut self, + iface_id_or_kebab: Option<&str>, + local_name: String, + func_name: String, + ) { + let mut iface = &mut self.exports; + if let Some(iface_id_or_kebab) = iface_id_or_kebab { + // convert kebab names to camel case, leave ids as-is + let iface_id_or_kebab = if iface_id_or_kebab.contains(':') { + iface_id_or_kebab.to_string() + } else { + iface_id_or_kebab.to_lower_camel_case() + }; + if !iface.contains_key(&iface_id_or_kebab) { + iface.insert( + iface_id_or_kebab.to_string(), + Binding::Interface(BTreeMap::new()), + ); + } + iface = match iface.get_mut(&iface_id_or_kebab).unwrap() { + Binding::Interface(iface) => iface, + Binding::Local(_) => panic!( + "Exported interface {} cannot be both a function and an interface", + iface_id_or_kebab + ), + }; + } + iface.insert(func_name, Binding::Local(local_name)); + } + + /// once all exports have been created, aliases can be populated for interface + /// names that do not collide with kebab names or other interface names + pub fn populate_export_aliases(&mut self) { + for expt_name in self.exports.keys() { + if let Some(path_idx) = expt_name.rfind('/') { + let alias = &expt_name[path_idx + 1..].to_lower_camel_case(); + if !self.exports.contains_key(alias) + && !self.export_aliases.values().any(|_alias| alias == _alias) + { + self.export_aliases + .insert(expt_name.to_string(), alias.to_string()); + } + } + } + } + + pub fn render_export_imports( + &mut self, + output: &mut Source, + imports_object: &str, + _local_names: &mut LocalNames, + source_name: &str, + ) { + // TODO: bring back these validations of imports + // including using the flattened bindings + if self.exports.len() > 0 { + // error handling + uwriteln!(output, " + class BindingsError extends Error {{ + constructor (path, type, helpContext, help) {{ + super(`\"{source_name}\" source does not export a \"${{path}}\" ${{type}} as expected by the world.${{ + help ? `\\n\\n Try defining it${{helpContext}}:\\n\\n${{' ' + help.split('\\n').map(ln => ` ${{ln}}`).join('\\n')}}\n` : '' + }}`); + }} + }} + function getInterfaceExport (mod, exportNameOrAlias, exportId) {{ + if (typeof mod[exportId] === 'object') + return mod[exportId]; + if (exportNameOrAlias && typeof mod[exportNameOrAlias] === 'object') + return mod[exportNameOrAlias]; + if (!exportNameOrAlias) + throw new BindingsError(exportId, 'interface', ' by its qualified interface name', `const obj = {{}};\n\nexport {{ obj as '${{exportId}}' }}\n`); + else + throw new BindingsError(exportNameOrAlias, 'interface', exportId && exportNameOrAlias ? ' by its alias' : ' by name', `export const ${{exportNameOrAlias}} = {{}};`); + }} + function verifyInterfaceFn (fn, exportName, ifaceProp, interfaceExportAlias) {{ + if (typeof fn !== 'function') {{ + if (!interfaceExportAlias) + throw new BindingsError(exportName, `${{ifaceProp}} function`, ' on the exported interface object', `const obj = {{\n\t${{ifaceProp}} () {{\n\n}}\n}};\n\nexport {{ obj as '${{exportName}}' }}\n`); + else + throw new BindingsError(exportName, `${{ifaceProp}} function`, ` on the interface alias \"${{interfaceExportAlias}}\"`, `export const ${{interfaceExportAlias}} = {{\n\t${{ifaceProp}} () {{\n\n}}\n}};`); + }} + }} + "); + } + for (export_name, binding) in &self.exports { + match binding { + Binding::Interface(bindings) => { + uwrite!(output, "const "); + uwrite!(output, "{{"); + let mut first = true; + for (external_name, import) in bindings { + if first { + output.push_str(" "); + first = false; + } else { + output.push_str(", "); + } + let local_name = match import { + Binding::Interface(_) => panic!("Nested interfaces unsupported"), + Binding::Local(local_name) => local_name, + }; + if external_name == local_name { + uwrite!(output, "{external_name}"); + } else { + uwrite!(output, "{external_name}: {local_name}"); + } + } + if !first { + output.push_str(" "); + } + if let Some(alias) = self.export_aliases.get(export_name) { + // aliased namespace id + uwriteln!( + output, + "}} = getInterfaceExport({imports_object}, '{alias}', '{export_name}');", + ); + } else if export_name.contains(':') { + // ID case without alias (different error messaging) + uwriteln!( + output, + "}} = getInterfaceExport({imports_object}, null, '{export_name}');", + ); + } else { + // kebab name interface + uwriteln!( + output, + "}} = getInterfaceExport({imports_object}, '{export_name}', null);", + ); + } + // After defining all the local bindings, verify them throwing errors as necessary + for (external_name, import) in bindings { + let local_name = match import { + Binding::Interface(_) => panic!("Nested interfaces unsupported"), + Binding::Local(local_name) => local_name, + }; + if let Some(alias) = self.export_aliases.get(export_name) { + uwriteln!(output, "verifyInterfaceFn({local_name}, '{export_name}', '{external_name}', '{alias}');"); + } else { + uwriteln!(output, "verifyInterfaceFn({local_name}, '{export_name}', '{external_name}', null);"); + }; + } + } + Binding::Local(local_name) => { + uwriteln!(output, " + const {local_name} = {imports_object}.{export_name}; + if (typeof {local_name} !== 'function') + throw new BindingsError('{export_name}', 'function', '', `export function {export_name} () {{}};\n`); + "); + } + } } - None => format!("{prefix}{camel_name}"), } } diff --git a/crates/spidermonkey-embedding-splicer/src/lib.rs b/crates/spidermonkey-embedding-splicer/src/lib.rs index 1e149972..242b7c87 100644 --- a/crates/spidermonkey-embedding-splicer/src/lib.rs +++ b/crates/spidermonkey-embedding-splicer/src/lib.rs @@ -16,10 +16,9 @@ use wit_parser::{self, PackageId, Resolve, UnresolvedPackage}; wit_bindgen::generate!("spidermonkey-embedding-splicer"); -use exports::*; -struct SpidermonkeyEmbeddingSplicer; +struct SpidermonkeyEmbeddingSplicerComponent; -export_spidermonkey_embedding_splicer!(SpidermonkeyEmbeddingSplicer); +export_spidermonkey_embedding_splicer!(SpidermonkeyEmbeddingSplicerComponent); /// Calls [`write!`] with the passed arguments and unwraps the result. /// @@ -88,12 +87,12 @@ fn parse_wit(path: &Path) -> Result<(Resolve, PackageId)> { Err(_) => bail!("input file is not valid utf-8"), }; let pkg = UnresolvedPackage::parse(&path, text)?; - resolve.push(pkg, &Default::default())? + resolve.push(pkg)? }; Ok((resolve, id)) } -impl exports::Exports for SpidermonkeyEmbeddingSplicer { +impl SpidermonkeyEmbeddingSplicer for SpidermonkeyEmbeddingSplicerComponent { fn splice_bindings( source_name: Option, engine: Vec, @@ -108,13 +107,11 @@ impl exports::Exports for SpidermonkeyEmbeddingSplicer { let path = PathBuf::from("component.wit"); let pkg = UnresolvedPackage::parse(&path, &wit_source).map_err(|e| e.to_string())?; - let id = resolve - .push(pkg, &Default::default()) - .map_err(|e| e.to_string())?; + let id = resolve.push(pkg).map_err(|e| e.to_string())?; (resolve, id) } else { - parse_wit(&PathBuf::from(wit_path.unwrap())).map_err(|e| e.to_string())? + parse_wit(&PathBuf::from(wit_path.unwrap())).map_err(|e| format!("{:?}", e))? }; let world = resolve diff --git a/crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit b/crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit index 7e76b42e..9dfaf1a3 100644 --- a/crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit +++ b/crates/spidermonkey-embedding-splicer/wit/spidermonkey-embedding-splicer.wit @@ -1,28 +1,28 @@ -default world spidermonkey-embedding-splicer { - export exports: interface { - enum core-ty { - i32, - i64, - f32, - f64 - } +package local:spidermonkey-embedding-splicer - record core-fn { - params: list, - ret: option, - retptr: bool, - retsize: u32, - paramptr: bool, - } +world spidermonkey-embedding-splicer { + enum core-ty { + i32, + i64, + f32, + f64 + } - record splice-result { - wasm: list, - js-bindings: string, - exports: list>, - import-wrappers: list>, - imports: list>, - } + record core-fn { + params: list, + ret: option, + retptr: bool, + retsize: u32, + paramptr: bool, + } - splice-bindings: func(source-name: option, spidermonkey-engine: list, wit-world: option, wit-path: option, world-name: option) -> result + record splice-result { + wasm: list, + js-bindings: string, + exports: list>, + import-wrappers: list>, + imports: list>, } + + export splice-bindings: func(source-name: option, spidermonkey-engine: list, wit-world: option, wit-path: option, world-name: option) -> result } diff --git a/example/Cargo.lock b/example/Cargo.lock index c5602bc8..3b76011f 100644 --- a/example/Cargo.lock +++ b/example/Cargo.lock @@ -113,7 +113,7 @@ dependencies = [ "log", "parking", "polling", - "rustix 0.37.19", + "rustix", "slab", "socket2", "waker-fn", @@ -205,6 +205,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbe3c979c178231552ecba20214a8272df4e09f232a87aef4320cf06539aded" + [[package]] name = "block-buffer" version = "0.10.4" @@ -250,18 +256,7 @@ dependencies = [ "cap-primitives", "cap-std", "io-lifetimes", - "windows-sys 0.48.0", -] - -[[package]] -name = "cap-net-ext" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a428be95851cc1c76cf9dbb6db1d0f779578037ec20dcf7d1b114fc46f40a611" -dependencies = [ - "cap-primitives", - "cap-std", - "rustix 0.37.19", + "windows-sys", ] [[package]] @@ -276,8 +271,8 @@ dependencies = [ "io-lifetimes", "ipnet", "maybe-owned", - "rustix 0.37.19", - "windows-sys 0.48.0", + "rustix", + "windows-sys", "winx", ] @@ -300,7 +295,7 @@ dependencies = [ "cap-primitives", "io-extras", "io-lifetimes", - "rustix 0.37.19", + "rustix", ] [[package]] @@ -311,7 +306,7 @@ checksum = "2a74e04cd32787bfa3a911af745b0fd5d99d4c3fc16c64449e1622c06fa27c8e" dependencies = [ "cap-primitives", "once_cell", - "rustix 0.37.19", + "rustix", "winx", ] @@ -359,16 +354,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c289b8eac3a97329a524e953b5fd68a8416ca629e1a37287f12d9e0760aadbc" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7bf07ba80f53fa7f7dc97b11087ea867f7ae4621cfca21a909eca92c0b96c7d9" dependencies = [ "bumpalo", "cranelift-bforest", @@ -387,37 +384,42 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40a7ca088173130c5c033e944756e3e441fbf3f637f32b4f6eb70252580c6dd4" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0114095ec7d2fbd658ed100bd007006360bc2530f57c6eee3d3838869140dbf9" [[package]] name = "cranelift-control" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d56031683a55a949977e756d21826eb17a1f346143a1badc0e120a15615cd38" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6565198b5684367371e2b946ceca721eb36965e75e3592fad12fc2e15f65d7b" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25f28cc44847c8b98cb921e6bfc0f7b228f4d27519376fea724d181da91709a6" dependencies = [ "cranelift-codegen", "log", @@ -427,13 +429,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80b658177e72178c438f7de5d6645c56d97af38e17fcb0b500459007b4e05cc5" [[package]] name = "cranelift-native" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf1c7de7221e6afcc5e13ced3b218faab3bc65b47eac67400046a05418aecd6a" dependencies = [ "cranelift-codegen", "libc", @@ -442,8 +446,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.96.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.97.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76b0d28ebe8edb6b503630c489aa4669f1e2d13b97bec7271a0fcb0e159be3ad" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -451,7 +456,7 @@ dependencies = [ "itertools", "log", "smallvec", - "wasmparser 0.103.0", + "wasmparser", "wasmtime-types", ] @@ -527,6 +532,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "debugid" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" +dependencies = [ + "uuid", +] + [[package]] name = "digest" version = "0.10.6" @@ -614,7 +628,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -655,15 +669,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ae6b3d9530211fb3b12a95374b8b0823be812f53d09e18c5675c0146b09642" dependencies = [ "cfg-if", - "rustix 0.37.19", - "windows-sys 0.48.0", + "rustix", + "windows-sys", ] [[package]] name = "file-per-thread-logger" -version = "0.1.6" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f2e425d9790201ba4af4630191feac6dcc98765b118d4d18e91d23c2353866" +checksum = "8a3cc21c33af89af0930c8cae4ade5e6fdc17b5d2c97b3d2e2edb67a1cf683f3" dependencies = [ "env_logger", "log", @@ -685,8 +699,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7833d0f115a013d51c55950a3b09d30e4b057be9961b709acb9b5b17a1108861" dependencies = [ "io-lifetimes", - "rustix 0.37.19", - "windows-sys 0.48.0", + "rustix", + "windows-sys", ] [[package]] @@ -734,6 +748,19 @@ dependencies = [ "byteorder", ] +[[package]] +name = "fxprof-processed-profile" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" +dependencies = [ + "bitflags 2.3.2", + "debugid", + "fxhash", + "serde", + "serde_json", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -863,7 +890,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fde93d48f0d9277f977a333eca8313695ddd5301dc96f7e02aeddcb0dd99096f" dependencies = [ "io-lifetimes", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -874,7 +901,7 @@ checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -891,8 +918,8 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.19", - "windows-sys 0.48.0", + "rustix", + "windows-sys", ] [[package]] @@ -969,12 +996,6 @@ version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" -[[package]] -name = "linux-raw-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" - [[package]] name = "linux-raw-sys" version = "0.3.7" @@ -1018,7 +1039,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" dependencies = [ - "rustix 0.37.19", + "rustix", ] [[package]] @@ -1101,13 +1122,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" dependencies = [ "autocfg", - "bitflags", + "bitflags 1.3.2", "cfg-if", "concurrent-queue", "libc", "log", "pin-project-lite", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1140,7 +1161,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffade02495f22453cd593159ea2f59827aae7f53fa8323f756799b670881dcf8" dependencies = [ - "bitflags", + "bitflags 1.3.2", "memchr", "unicase", ] @@ -1212,7 +1233,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1228,12 +1249,13 @@ dependencies = [ [[package]] name = "regalloc2" -version = "0.6.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80535183cae11b149d618fbd3c37e38d7cda589d82d7769e196ca9a9042d7621" +checksum = "12513beb38dd35aab3ac5f5b89fd0330159a0dc21d5309d75073011bbc8032b0" dependencies = [ - "fxhash", + "hashbrown 0.13.2", "log", + "rustc-hash", "slice-group-by", "smallvec", ] @@ -1262,18 +1284,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "rustix" -version = "0.36.13" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a38f9520be93aba504e8ca974197f46158de5dcaa9fa04b57c57cd6a679d658" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustix" @@ -1281,22 +1295,34 @@ version = "0.37.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "itoa", "libc", - "linux-raw-sys 0.3.7", + "linux-raw-sys", "once_cell", - "windows-sys 0.48.0", + "windows-sys", ] +[[package]] +name = "ryu" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "semver" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" + [[package]] name = "serde" version = "1.0.162" @@ -1317,6 +1343,17 @@ dependencies = [ "syn 2.0.15", ] +[[package]] +name = "serde_json" +version = "1.0.97" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf3bf93142acad5821c99197022e170842cdbc1c30482b98750c688c640842a" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.10.6" @@ -1368,6 +1405,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -1402,13 +1445,13 @@ version = "0.25.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "928ebd55ab758962e230f51ca63735c5b283f26292297c81404289cda5d78631" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cap-fs-ext", "cap-std", "fd-lock", "io-lifetimes", - "rustix 0.37.19", - "windows-sys 0.48.0", + "rustix", + "windows-sys", "winx", ] @@ -1563,6 +1606,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "uuid" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa2982af2eec27de306107c027578ff7f423d65f7250e40ce0fea8f45248b81" + [[package]] name = "value-bag" version = "1.0.0-alpha.9" @@ -1592,26 +1641,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] -name = "wasi-common" -version = "0.0.0" -source = "git+https://github.com/bytecodealliance/preview2-prototyping?rev=5be99d645c177198b9f5e4d76561669796f7b379#5be99d645c177198b9f5e4d76561669796f7b379" +name = "wasi-cap-std-sync" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291862f1014dd7e674f93b263d57399de4dd1907ea37e74cf7d36454536ba2f0" dependencies = [ "anyhow", "async-trait", - "bitflags", "cap-fs-ext", "cap-rand", "cap-std", "cap-time-ext", "fs-set-times", "io-extras", - "rustix 0.37.19", + "io-lifetimes", + "is-terminal", + "once_cell", + "rustix", "system-interface", + "tracing", + "wasi-common", + "windows-sys", +] + +[[package]] +name = "wasi-common" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b422ae2403cae9ca603864272a402cf5001dd6fef8632e090e00c4fb475741b" +dependencies = [ + "anyhow", + "bitflags 1.3.2", + "cap-rand", + "cap-std", + "io-extras", + "log", + "rustix", "thiserror", "tracing", "wasmtime", "wiggle", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] @@ -1682,62 +1752,46 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-encoder" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eff853c4f09eec94d76af527eddad4e9de13b11d6286a1ef7134bc30135a2b7" -dependencies = [ - "leb128", -] - -[[package]] -name = "wasm-encoder" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d05d0b6fcd0aeb98adf16e7975331b3c17222aa815148f5b976370ce589d80ef" +checksum = "18c41dbd92eaebf3612a39be316540b8377c871cb9bde6b064af962984912881" dependencies = [ "leb128", ] [[package]] name = "wasmparser" -version = "0.103.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c437373cac5ea84f1113d648d51f71751ffbe3d90c00ae67618cf20d0b5ee7b" -dependencies = [ - "indexmap", - "url", -] - -[[package]] -name = "wasmparser" -version = "0.104.0" +version = "0.107.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a396af81a7c56ad976131d6a35e4b693b78a1ea0357843bd436b4577e254a7d" +checksum = "29e3ac9b780c7dda0cac7a52a5d6d2d6707cc6e3451c9db209b6c758f40d7acb" dependencies = [ "indexmap", - "url", + "semver", ] [[package]] name = "wasmprinter" -version = "0.2.56" +version = "0.2.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "731da2505d5437cd5d6feb09457835f76186be13be7677fe00781ae99d5bbe8a" +checksum = "cc960b30b84abca377768f3c62cff3a1c74db8c0f6759ed581827da0bd3a3fed" dependencies = [ "anyhow", - "wasmparser 0.104.0", + "wasmparser", ] [[package]] name = "wasmtime" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd02b992d828b91efaf2a7499b21205fe4ab3002e401e3fe0f227aaeb4001d93" dependencies = [ "anyhow", "async-trait", "bincode", + "bumpalo", "cfg-if", "encoding_rs", + "fxprof-processed-profile", "indexmap", "libc", "log", @@ -1747,8 +1801,9 @@ dependencies = [ "psm", "rayon", "serde", + "serde_json", "target-lexicon", - "wasmparser 0.103.0", + "wasmparser", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -1759,21 +1814,23 @@ dependencies = [ "wasmtime-runtime", "wasmtime-winch", "wat", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "wasmtime-asm-macros" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284466ef356ce2d909bc0ad470b60c4d0df5df2de9084457e118131b3c779b92" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "efc78cfe1a758d1336f447a47af6ec05e0df2c03c93440d70faf80e17fbb001e" dependencies = [ "anyhow", "base64", @@ -1781,18 +1838,19 @@ dependencies = [ "directories-next", "file-per-thread-logger", "log", - "rustix 0.36.13", + "rustix", "serde", "sha2", "toml", - "windows-sys 0.45.0", + "windows-sys", "zstd", ] [[package]] name = "wasmtime-component-macro" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e916103436a6d84faa4c2083e2e98612a323c2cc6147ec419124f67c764c9c" dependencies = [ "anyhow", "proc-macro2", @@ -1805,13 +1863,15 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f20a5135ec5ef01080e674979b02d6fa5eebaa2b0c2d6660513ee9956a1bf624" [[package]] name = "wasmtime-cranelift" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1aa99cbf3f8edb5ad8408ba380f5ab481528ecd8a5053acf758e006d6727fd" dependencies = [ "anyhow", "cranelift-codegen", @@ -1825,15 +1885,16 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser 0.103.0", + "wasmparser", "wasmtime-cranelift-shared", "wasmtime-environ", ] [[package]] name = "wasmtime-cranelift-shared" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cce31fd55978601acc103acbb8a26f81c89a6eae12d3a1c59f34151dfa609484" dependencies = [ "anyhow", "cranelift-codegen", @@ -1847,8 +1908,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41f9e58e0ee7d43ff13e75375c726b16bce022db798d3a099a65eeaa7d7a544b" dependencies = [ "anyhow", "cranelift-entity", @@ -1859,8 +1921,8 @@ dependencies = [ "serde", "target-lexicon", "thiserror", - "wasm-encoder 0.25.0", - "wasmparser 0.103.0", + "wasm-encoder", + "wasmparser", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -1868,20 +1930,22 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14309cbdf2c395258b124a24757c727403070c0465a28bcc780c4f82f4bca5ff" dependencies = [ "cc", "cfg-if", - "rustix 0.36.13", + "rustix", "wasmtime-asm-macros", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "wasmtime-jit" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0f2eaeb01bb67266416507829bd8e0bb60278444e4cbd048e280833ebeaa02" dependencies = [ "addr2line", "anyhow", @@ -1893,39 +1957,43 @@ dependencies = [ "log", "object", "rustc-demangle", + "rustix", "serde", "target-lexicon", "wasmtime-environ", "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "wasmtime-jit-debug" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f42e59d62542bfb73ce30672db7eaf4084a60b434b688ac4f05b287d497de082" dependencies = [ "object", "once_cell", - "rustix 0.36.13", + "rustix", ] [[package]] name = "wasmtime-jit-icache-coherence" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b49ceb7e2105a8ebe5614d7bbab6f6ef137a284e371633af60b34925493081f" dependencies = [ "cfg-if", "libc", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] name = "wasmtime-runtime" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a5de4762421b0b2b19e02111ca403632852b53e506e03b4b227ffb0fbfa63c2" dependencies = [ "anyhow", "cc", @@ -1939,12 +2007,13 @@ dependencies = [ "memoffset", "paste", "rand", - "rustix 0.36.13", + "rustix", + "sptr", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -1954,87 +2023,71 @@ dependencies = [ "anyhow", "async-std", "cap-std", - "wasi-common", "wasmtime", - "wasmtime-wasi-sockets", - "wasmtime-wasi-sockets-sync", + "wasmtime-wasi", ] [[package]] name = "wasmtime-types" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcbb7c138f797192f46afdd3ec16f85ef007c3bb45fa8e5174031f17b0be4c4a" dependencies = [ "cranelift-entity", "serde", "thiserror", - "wasmparser 0.103.0", -] - -[[package]] -name = "wasmtime-wasi-sockets" -version = "0.1.0" -source = "git+https://github.com/bytecodealliance/preview2-prototyping?rev=5be99d645c177198b9f5e4d76561669796f7b379#5be99d645c177198b9f5e4d76561669796f7b379" -dependencies = [ - "anyhow", - "async-trait", - "bitflags", - "cap-net-ext", - "cap-std", - "ipnet", - "rustix 0.37.19", - "tracing", - "wasi-common", - "wasmtime", + "wasmparser", ] [[package]] -name = "wasmtime-wasi-sockets-sync" -version = "0.1.0" -source = "git+https://github.com/bytecodealliance/preview2-prototyping?rev=5be99d645c177198b9f5e4d76561669796f7b379#5be99d645c177198b9f5e4d76561669796f7b379" +name = "wasmtime-wasi" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01686e859249d4dffe3d7ce9957ae35bcf4161709dfafd165ee136bd54d179f1" dependencies = [ "anyhow", "async-trait", + "bitflags 1.3.2", "cap-fs-ext", - "cap-net-ext", "cap-rand", "cap-std", "cap-time-ext", "fs-set-times", "io-extras", - "io-lifetimes", - "ipnet", - "is-terminal", - "once_cell", - "rustix 0.37.19", + "libc", + "rustix", "system-interface", + "thiserror", "tracing", + "wasi-cap-std-sync", "wasi-common", - "wasmtime-wasi-sockets", - "windows-sys 0.48.0", + "wasmtime", + "wiggle", + "windows-sys", ] [[package]] name = "wasmtime-winch" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60160d8f7d2b301790730dac8ff25156c61d4fed79481e7074c21dd1283cfe2f" dependencies = [ "anyhow", "cranelift-codegen", "gimli", "object", "target-lexicon", - "wasmparser 0.103.0", + "wasmparser", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", - "winch-environ", ] [[package]] name = "wasmtime-wit-bindgen" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3334b0466a4d340de345cda83474d1d2c429770c3d667877971407672bc618a" dependencies = [ "anyhow", "heck", @@ -2052,23 +2105,23 @@ dependencies = [ [[package]] name = "wast" -version = "57.0.0" +version = "60.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eb0f5ed17ac4421193c7477da05892c2edafd67f9639e3c11a82086416662dc" +checksum = "bd06cc744b536e30387e72a48fdd492105b9c938bb4f415c39c616a7a0a697ad" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder 0.26.0", + "wasm-encoder", ] [[package]] name = "wat" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab9ab0d87337c3be2bb6fc5cd331c4ba9fd6bcb4ee85048a0dd59ed9ecf92e53" +checksum = "5abe520f0ab205366e9ac7d3e6b2fc71de44e32a2b58f2ec871b6b575bdcea3b" dependencies = [ - "wast 57.0.0", + "wast 60.0.0", ] [[package]] @@ -2083,23 +2136,24 @@ dependencies = [ [[package]] name = "wiggle" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea93d31f59f2b2fa4196990b684771500072d385eaac12587c63db2bc185d705" dependencies = [ "anyhow", "async-trait", - "bitflags", + "bitflags 1.3.2", "thiserror", "tracing", "wasmtime", "wiggle-macro", - "witx", ] [[package]] name = "wiggle-generate" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df96ee6bea595fabf0346c08c553f684b08e88fad6fdb125e6efde047024f7b" dependencies = [ "anyhow", "heck", @@ -2112,8 +2166,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "9.0.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "10.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8649011a011ecca6197c4db6ee630735062ba20595ea56ce58529b3b1c20aa2f" dependencies = [ "proc-macro2", "quote", @@ -2154,8 +2209,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "0.7.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525fdd0d4e82d1bd3083bd87e8ca8014abfbdc5bf290d1d5371dac440d351e89" dependencies = [ "anyhow", "cranelift-codegen", @@ -2163,26 +2219,8 @@ dependencies = [ "regalloc2", "smallvec", "target-lexicon", - "wasmparser 0.103.0", -] - -[[package]] -name = "winch-environ" -version = "0.7.0" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" -dependencies = [ - "wasmparser 0.103.0", + "wasmparser", "wasmtime-environ", - "winch-codegen", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", ] [[package]] @@ -2191,22 +2229,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -2215,93 +2238,51 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" @@ -2314,22 +2295,23 @@ version = "0.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c52a121f0fbf9320d5f2a9a5d82f6cb7557eda5e8b47fc3e7f359ec866ae960" dependencies = [ - "bitflags", + "bitflags 1.3.2", "io-lifetimes", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "wit-parser" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca2581061573ef6d1754983d7a9b3ed5871ef859d52708ea9a0f5af32919172" +checksum = "6daec9f093dbaea0e94043eeb92ece327bbbe70c86b1f41aca9bbfefd7f050f0" dependencies = [ "anyhow", "id-arena", "indexmap", "log", "pulldown-cmark", + "semver", "unicode-xid", "url", ] @@ -2337,7 +2319,8 @@ dependencies = [ [[package]] name = "witx" version = "0.9.1" -source = "git+https://github.com/bytecodealliance/wasmtime?rev=299131ae2d6655c49138bfab2c4469650763ef3b#299131ae2d6655c49138bfab2c4469650763ef3b" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e366f27a5cabcddb2706a78296a40b8fcc451e1a6aba2fc1d94b4a01bdaaef4b" dependencies = [ "anyhow", "log", diff --git a/example/Cargo.toml b/example/Cargo.toml index 7e9ff6d2..8e16428a 100644 --- a/example/Cargo.toml +++ b/example/Cargo.toml @@ -11,7 +11,5 @@ edition = "2021" anyhow = "1.0.65" async-std = { version = "1.12.0", features = ["attributes"] } cap-std = "1.0.12" -wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", features = ["component-model"], rev = "299131ae2d6655c49138bfab2c4469650763ef3b" } -wasi-common = { git = "https://github.com/bytecodealliance/preview2-prototyping", rev = "5be99d645c177198b9f5e4d76561669796f7b379" } -wasmtime-wasi-sockets = { git = "https://github.com/bytecodealliance/preview2-prototyping", rev = "5be99d645c177198b9f5e4d76561669796f7b379" } -wasmtime-wasi-sockets-sync = { git = "https://github.com/bytecodealliance/preview2-prototyping", rev = "5be99d645c177198b9f5e4d76561669796f7b379" } +wasmtime = { version = "10.0.1", features = ["component-model"] } +wasmtime-wasi = "10.0.1" diff --git a/example/hello.wit b/example/hello.wit index d48ef61f..30df7c64 100644 --- a/example/hello.wit +++ b/example/hello.wit @@ -1,3 +1,5 @@ -default world hello { +package local:hello + +world hello { export hello: func(name: string) -> string -} \ No newline at end of file +} diff --git a/example/src/main.rs b/example/src/main.rs index 8b1c594e..31f61acd 100644 --- a/example/src/main.rs +++ b/example/src/main.rs @@ -1,11 +1,9 @@ use anyhow::Result; -use wasi_common::{wasi, Table, WasiCtx, WasiCtxBuilder, WasiView}; use wasmtime::{ component::{Component, Linker}, Config, Engine, Store, WasmBacktraceDetails, }; -use wasmtime_wasi_sockets::{WasiSocketsCtx, WasiSocketsView}; -use wasmtime_wasi_sockets_sync::WasiSocketsCtxBuilder; +use wasmtime_wasi::preview2::{WasiCtxBuilder, Table, WasiCtx, WasiView, wasi}; wasmtime::component::bindgen!({ world: "hello", @@ -33,7 +31,6 @@ async fn main() -> Result<()> { struct CommandCtx { table: Table, wasi: WasiCtx, - sockets: WasiSocketsCtx, } impl WasiView for CommandCtx { fn table(&self) -> &Table { @@ -49,32 +46,13 @@ async fn main() -> Result<()> { &mut self.wasi } } - let sockets = WasiSocketsCtxBuilder::new() - .inherit_network(cap_std::ambient_authority()) - .build(); - impl WasiSocketsView for CommandCtx { - fn table(&self) -> &Table { - &self.table - } - fn table_mut(&mut self) -> &mut Table { - &mut self.table - } - fn ctx(&self) -> &WasiSocketsCtx { - &self.sockets - } - fn ctx_mut(&mut self) -> &mut WasiSocketsCtx { - &mut self.sockets - } - } wasi::command::add_to_linker(&mut linker)?; - wasmtime_wasi_sockets::add_to_linker(&mut linker)?; let mut store = Store::new( &engine, CommandCtx { table, wasi, - sockets, }, ); diff --git a/lib/spidermonkey-embedding-splicer.core.wasm b/lib/spidermonkey-embedding-splicer.core.wasm index 62256837..38cdf8f3 100644 Binary files a/lib/spidermonkey-embedding-splicer.core.wasm and b/lib/spidermonkey-embedding-splicer.core.wasm differ diff --git a/lib/spidermonkey-embedding-splicer.d.ts b/lib/spidermonkey-embedding-splicer.d.ts index 346c605f..589d63a9 100644 --- a/lib/spidermonkey-embedding-splicer.d.ts +++ b/lib/spidermonkey-embedding-splicer.d.ts @@ -1,9 +1,37 @@ -import { WallClock as WallClockImports } from './imports/wall-clock'; -import { Streams as StreamsImports } from './imports/streams'; -import { Filesystem as FilesystemImports } from './imports/filesystem'; -import { Random as RandomImports } from './imports/random'; -import { Environment as EnvironmentImports } from './imports/environment'; -import { Preopens as PreopensImports } from './imports/preopens'; -import { Exit as ExitImports } from './imports/exit'; -import { Exports as ExportsExports } from './exports/exports'; -'exports': typeof ExportsExports, +/** +* # Variants +* +* ## `"i32"` +* +* ## `"i64"` +* +* ## `"f32"` +* +* ## `"f64"` +*/ +export type CoreTy = 'i32' | 'i64' | 'f32' | 'f64'; +export interface CoreFn { + params: CoreTy[], + ret?: CoreTy, + retptr: boolean, + retsize: number, + paramptr: boolean, +} +export interface SpliceResult { + wasm: Uint8Array, + jsBindings: string, + exports: [string, CoreFn][], + importWrappers: [string, string][], + imports: [string, string, number][], +} +import { ImportsEnvironment } from './imports/environment'; +import { ImportsExit } from './imports/exit'; +import { ImportsPreopens } from './imports/preopens'; +import { ImportsStderr } from './imports/stderr'; +import { ImportsStdin } from './imports/stdin'; +import { ImportsStdout } from './imports/stdout'; +import { ImportsWallClock } from './imports/wall-clock'; +import { ImportsFilesystem } from './imports/filesystem'; +import { ImportsStreams } from './imports/streams'; +import { ImportsRandom } from './imports/random'; +export function spliceBindings(sourceName: string | null, spidermonkeyEngine: Uint8Array | ArrayBuffer, witWorld: string | null, witPath: string | null, worldName: string | null): SpliceResult; diff --git a/lib/spidermonkey-embedding-splicer.js b/lib/spidermonkey-embedding-splicer.js index 55ac22f3..f3b93ffb 100644 --- a/lib/spidermonkey-embedding-splicer.js +++ b/lib/spidermonkey-embedding-splicer.js @@ -1,9 +1,31 @@ -import { exit as lowering5Callee } from '@bytecodealliance/preview2-shim/exit'; -import { getStdio as lowering8Callee, getDirectories as lowering9Callee } from '@bytecodealliance/preview2-shim/preopens'; -import { dropInputStream as lowering6Callee, dropOutputStream as lowering7Callee, read as lowering18Callee, blockingRead as lowering19Callee, write as lowering20Callee, blockingWrite as lowering21Callee } from '@bytecodealliance/preview2-shim/streams'; -import { getRandomBytes as lowering16Callee } from '@bytecodealliance/preview2-shim/random'; -import { dropDirectoryEntryStream as lowering0Callee, readViaStream as lowering1Callee, writeViaStream as lowering2Callee, appendViaStream as lowering3Callee, dropDescriptor as lowering4Callee, getType as lowering10Callee, readDirectory as lowering11Callee, stat as lowering12Callee, statAt as lowering13Callee, openAt as lowering14Callee, readDirectoryEntry as lowering15Callee } from '@bytecodealliance/preview2-shim/filesystem'; -import { getEnvironment as lowering17Callee } from '@bytecodealliance/preview2-shim/environment'; +import { environment, exit as exit$1, preopens, stderr, stdin, stdout } from '@bytecodealliance/preview2-shim/cli-base'; +import { filesystem } from '@bytecodealliance/preview2-shim/filesystem'; +import { streams } from '@bytecodealliance/preview2-shim/io'; +import { random } from '@bytecodealliance/preview2-shim/random'; +const { getEnvironment } = environment; +const { exit } = exit$1; +const { getDirectories } = preopens; +const { getStderr } = stderr; +const { getStdin } = stdin; +const { getStdout } = stdout; +const { appendViaStream, + dropDescriptor, + dropDirectoryEntryStream, + getType, + openAt, + readDirectory, + readDirectoryEntry, + readViaStream, + stat, + statAt, + writeViaStream } = filesystem; +const { blockingRead, + blockingWrite, + dropInputStream, + dropOutputStream, + read, + write } = streams; +const { getRandomBytes } = random; const base64Compile = str => WebAssembly.compile(typeof Buffer !== 'undefined' ? Buffer.from(str, 'base64') : Uint8Array.from(atob(str), b => b.charCodeAt(0))); @@ -81,29 +103,14 @@ let exports0; let exports1; function lowering0(arg0) { - lowering0Callee(arg0 >>> 0); + dropDirectoryEntryStream(arg0 >>> 0); } -function lowering1(arg0, arg1) { - const ret = lowering1Callee(arg0 >>> 0, BigInt.asUintN(64, arg1)); - return toUint32(ret); -} - -function lowering2(arg0, arg1) { - const ret = lowering2Callee(arg0 >>> 0, BigInt.asUintN(64, arg1)); - return toUint32(ret); -} - -function lowering3(arg0) { - const ret = lowering3Callee(arg0 >>> 0); - return toUint32(ret); +function lowering1(arg0) { + dropDescriptor(arg0 >>> 0); } -function lowering4(arg0) { - lowering4Callee(arg0 >>> 0); -} - -function lowering5(arg0) { +function lowering2(arg0) { let variant0; switch (arg0) { case 0: { @@ -121,53 +128,618 @@ function lowering5(arg0) { break; } default: { - throw new TypeError('invalid variant discriminant for expected'); + throw new TypeError('invalid variant discriminant for expected'); + } + } + exit(variant0); +} + +function lowering3() { + const ret = getStderr(); + return toUint32(ret); +} + +function lowering4() { + const ret = getStdin(); + return toUint32(ret); +} + +function lowering5() { + const ret = getStdout(); + return toUint32(ret); +} + +function lowering6(arg0) { + dropInputStream(arg0 >>> 0); +} + +function lowering7(arg0) { + dropOutputStream(arg0 >>> 0); +} +let exports2; +let memory0; +let realloc0; + +function lowering8(arg0) { + const ret = getDirectories(); + const vec2 = ret; + const len2 = vec2.length; + const result2 = realloc0(0, 0, 4, len2 * 12); + for (let i = 0; i < vec2.length; i++) { + const e = vec2[i]; + const base = result2 + i * 12;const [tuple0_0, tuple0_1] = e; + dataView(memory0).setInt32(base + 0, toUint32(tuple0_0), true); + const ptr1 = utf8Encode(tuple0_1, realloc0, memory0); + const len1 = utf8EncodedLen; + dataView(memory0).setInt32(base + 8, len1, true); + dataView(memory0).setInt32(base + 4, ptr1, true); + } + dataView(memory0).setInt32(arg0 + 4, len2, true); + dataView(memory0).setInt32(arg0 + 0, result2, true); +} + +function lowering9(arg0, arg1, arg2) { + let ret; + try { + ret = { tag: 'ok', val: readViaStream(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; + } catch (e) { + ret = { tag: 'err', val: getErrorPayload(e) }; + } + const variant1 = ret; + switch (variant1.tag) { + case 'ok': { + const e = variant1.val; + dataView(memory0).setInt8(arg2 + 0, 0, true); + dataView(memory0).setInt32(arg2 + 4, toUint32(e), true); + break; + } + case 'err': { + const e = variant1.val; + dataView(memory0).setInt8(arg2 + 0, 1, true); + const val0 = e; + let enum0; + switch (val0) { + case 'access': { + enum0 = 0; + break; + } + case 'would-block': { + enum0 = 1; + break; + } + case 'already': { + enum0 = 2; + break; + } + case 'bad-descriptor': { + enum0 = 3; + break; + } + case 'busy': { + enum0 = 4; + break; + } + case 'deadlock': { + enum0 = 5; + break; + } + case 'quota': { + enum0 = 6; + break; + } + case 'exist': { + enum0 = 7; + break; + } + case 'file-too-large': { + enum0 = 8; + break; + } + case 'illegal-byte-sequence': { + enum0 = 9; + break; + } + case 'in-progress': { + enum0 = 10; + break; + } + case 'interrupted': { + enum0 = 11; + break; + } + case 'invalid': { + enum0 = 12; + break; + } + case 'io': { + enum0 = 13; + break; + } + case 'is-directory': { + enum0 = 14; + break; + } + case 'loop': { + enum0 = 15; + break; + } + case 'too-many-links': { + enum0 = 16; + break; + } + case 'message-size': { + enum0 = 17; + break; + } + case 'name-too-long': { + enum0 = 18; + break; + } + case 'no-device': { + enum0 = 19; + break; + } + case 'no-entry': { + enum0 = 20; + break; + } + case 'no-lock': { + enum0 = 21; + break; + } + case 'insufficient-memory': { + enum0 = 22; + break; + } + case 'insufficient-space': { + enum0 = 23; + break; + } + case 'not-directory': { + enum0 = 24; + break; + } + case 'not-empty': { + enum0 = 25; + break; + } + case 'not-recoverable': { + enum0 = 26; + break; + } + case 'unsupported': { + enum0 = 27; + break; + } + case 'no-tty': { + enum0 = 28; + break; + } + case 'no-such-device': { + enum0 = 29; + break; + } + case 'overflow': { + enum0 = 30; + break; + } + case 'not-permitted': { + enum0 = 31; + break; + } + case 'pipe': { + enum0 = 32; + break; + } + case 'read-only': { + enum0 = 33; + break; + } + case 'invalid-seek': { + enum0 = 34; + break; + } + case 'text-file-busy': { + enum0 = 35; + break; + } + case 'cross-device': { + enum0 = 36; + break; + } + default: { + if ((e) instanceof Error) { + console.error(e); + } + + throw new TypeError(`"${val0}" is not one of the cases of error-code`); + } + } + dataView(memory0).setInt8(arg2 + 4, enum0, true); + break; + } + default: { + throw new TypeError('invalid variant specified for result'); + } + } +} + +function lowering10(arg0, arg1, arg2) { + let ret; + try { + ret = { tag: 'ok', val: writeViaStream(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; + } catch (e) { + ret = { tag: 'err', val: getErrorPayload(e) }; + } + const variant1 = ret; + switch (variant1.tag) { + case 'ok': { + const e = variant1.val; + dataView(memory0).setInt8(arg2 + 0, 0, true); + dataView(memory0).setInt32(arg2 + 4, toUint32(e), true); + break; + } + case 'err': { + const e = variant1.val; + dataView(memory0).setInt8(arg2 + 0, 1, true); + const val0 = e; + let enum0; + switch (val0) { + case 'access': { + enum0 = 0; + break; + } + case 'would-block': { + enum0 = 1; + break; + } + case 'already': { + enum0 = 2; + break; + } + case 'bad-descriptor': { + enum0 = 3; + break; + } + case 'busy': { + enum0 = 4; + break; + } + case 'deadlock': { + enum0 = 5; + break; + } + case 'quota': { + enum0 = 6; + break; + } + case 'exist': { + enum0 = 7; + break; + } + case 'file-too-large': { + enum0 = 8; + break; + } + case 'illegal-byte-sequence': { + enum0 = 9; + break; + } + case 'in-progress': { + enum0 = 10; + break; + } + case 'interrupted': { + enum0 = 11; + break; + } + case 'invalid': { + enum0 = 12; + break; + } + case 'io': { + enum0 = 13; + break; + } + case 'is-directory': { + enum0 = 14; + break; + } + case 'loop': { + enum0 = 15; + break; + } + case 'too-many-links': { + enum0 = 16; + break; + } + case 'message-size': { + enum0 = 17; + break; + } + case 'name-too-long': { + enum0 = 18; + break; + } + case 'no-device': { + enum0 = 19; + break; + } + case 'no-entry': { + enum0 = 20; + break; + } + case 'no-lock': { + enum0 = 21; + break; + } + case 'insufficient-memory': { + enum0 = 22; + break; + } + case 'insufficient-space': { + enum0 = 23; + break; + } + case 'not-directory': { + enum0 = 24; + break; + } + case 'not-empty': { + enum0 = 25; + break; + } + case 'not-recoverable': { + enum0 = 26; + break; + } + case 'unsupported': { + enum0 = 27; + break; + } + case 'no-tty': { + enum0 = 28; + break; + } + case 'no-such-device': { + enum0 = 29; + break; + } + case 'overflow': { + enum0 = 30; + break; + } + case 'not-permitted': { + enum0 = 31; + break; + } + case 'pipe': { + enum0 = 32; + break; + } + case 'read-only': { + enum0 = 33; + break; + } + case 'invalid-seek': { + enum0 = 34; + break; + } + case 'text-file-busy': { + enum0 = 35; + break; + } + case 'cross-device': { + enum0 = 36; + break; + } + default: { + if ((e) instanceof Error) { + console.error(e); + } + + throw new TypeError(`"${val0}" is not one of the cases of error-code`); + } + } + dataView(memory0).setInt8(arg2 + 4, enum0, true); + break; + } + default: { + throw new TypeError('invalid variant specified for result'); + } + } +} + +function lowering11(arg0, arg1) { + let ret; + try { + ret = { tag: 'ok', val: appendViaStream(arg0 >>> 0) }; + } catch (e) { + ret = { tag: 'err', val: getErrorPayload(e) }; + } + const variant1 = ret; + switch (variant1.tag) { + case 'ok': { + const e = variant1.val; + dataView(memory0).setInt8(arg1 + 0, 0, true); + dataView(memory0).setInt32(arg1 + 4, toUint32(e), true); + break; + } + case 'err': { + const e = variant1.val; + dataView(memory0).setInt8(arg1 + 0, 1, true); + const val0 = e; + let enum0; + switch (val0) { + case 'access': { + enum0 = 0; + break; + } + case 'would-block': { + enum0 = 1; + break; + } + case 'already': { + enum0 = 2; + break; + } + case 'bad-descriptor': { + enum0 = 3; + break; + } + case 'busy': { + enum0 = 4; + break; + } + case 'deadlock': { + enum0 = 5; + break; + } + case 'quota': { + enum0 = 6; + break; + } + case 'exist': { + enum0 = 7; + break; + } + case 'file-too-large': { + enum0 = 8; + break; + } + case 'illegal-byte-sequence': { + enum0 = 9; + break; + } + case 'in-progress': { + enum0 = 10; + break; + } + case 'interrupted': { + enum0 = 11; + break; + } + case 'invalid': { + enum0 = 12; + break; + } + case 'io': { + enum0 = 13; + break; + } + case 'is-directory': { + enum0 = 14; + break; + } + case 'loop': { + enum0 = 15; + break; + } + case 'too-many-links': { + enum0 = 16; + break; + } + case 'message-size': { + enum0 = 17; + break; + } + case 'name-too-long': { + enum0 = 18; + break; + } + case 'no-device': { + enum0 = 19; + break; + } + case 'no-entry': { + enum0 = 20; + break; + } + case 'no-lock': { + enum0 = 21; + break; + } + case 'insufficient-memory': { + enum0 = 22; + break; + } + case 'insufficient-space': { + enum0 = 23; + break; + } + case 'not-directory': { + enum0 = 24; + break; + } + case 'not-empty': { + enum0 = 25; + break; + } + case 'not-recoverable': { + enum0 = 26; + break; + } + case 'unsupported': { + enum0 = 27; + break; + } + case 'no-tty': { + enum0 = 28; + break; + } + case 'no-such-device': { + enum0 = 29; + break; + } + case 'overflow': { + enum0 = 30; + break; + } + case 'not-permitted': { + enum0 = 31; + break; + } + case 'pipe': { + enum0 = 32; + break; + } + case 'read-only': { + enum0 = 33; + break; + } + case 'invalid-seek': { + enum0 = 34; + break; + } + case 'text-file-busy': { + enum0 = 35; + break; + } + case 'cross-device': { + enum0 = 36; + break; + } + default: { + if ((e) instanceof Error) { + console.error(e); + } + + throw new TypeError(`"${val0}" is not one of the cases of error-code`); + } + } + dataView(memory0).setInt8(arg1 + 4, enum0, true); + break; + } + default: { + throw new TypeError('invalid variant specified for result'); } } - lowering5Callee(variant0); -} - -function lowering6(arg0) { - lowering6Callee(arg0 >>> 0); -} - -function lowering7(arg0) { - lowering7Callee(arg0 >>> 0); -} -let exports2; -let memory0; - -function lowering8(arg0) { - const ret = lowering8Callee(); - const {stdin: v0_0, stdout: v0_1, stderr: v0_2 } = ret; - dataView(memory0).setInt32(arg0 + 0, toUint32(v0_0), true); - dataView(memory0).setInt32(arg0 + 4, toUint32(v0_1), true); - dataView(memory0).setInt32(arg0 + 8, toUint32(v0_2), true); -} -let realloc0; - -function lowering9(arg0) { - const ret = lowering9Callee(); - const vec2 = ret; - const len2 = vec2.length; - const result2 = realloc0(0, 0, 4, len2 * 12); - for (let i = 0; i < vec2.length; i++) { - const e = vec2[i]; - const base = result2 + i * 12;const [tuple0_0, tuple0_1] = e; - dataView(memory0).setInt32(base + 0, toUint32(tuple0_0), true); - const ptr1 = utf8Encode(tuple0_1, realloc0, memory0); - const len1 = utf8EncodedLen; - dataView(memory0).setInt32(base + 8, len1, true); - dataView(memory0).setInt32(base + 4, ptr1, true); - } - dataView(memory0).setInt32(arg0 + 4, len2, true); - dataView(memory0).setInt32(arg0 + 0, result2, true); } -function lowering10(arg0, arg1) { +function lowering12(arg0, arg1) { let ret; try { - ret = { tag: 'ok', val: lowering10Callee(arg0 >>> 0) }; + ret = { tag: 'ok', val: getType(arg0 >>> 0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -393,10 +965,10 @@ function lowering10(arg0, arg1) { } } -function lowering11(arg0, arg1) { +function lowering13(arg0, arg1) { let ret; try { - ret = { tag: 'ok', val: lowering11Callee(arg0 >>> 0) }; + ret = { tag: 'ok', val: readDirectory(arg0 >>> 0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -579,10 +1151,10 @@ function lowering11(arg0, arg1) { } } -function lowering12(arg0, arg1) { +function lowering14(arg0, arg1) { let ret; try { - ret = { tag: 'ok', val: lowering12Callee(arg0 >>> 0) }; + ret = { tag: 'ok', val: stat(arg0 >>> 0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -822,7 +1394,7 @@ function lowering12(arg0, arg1) { } } -function lowering13(arg0, arg1, arg2, arg3, arg4) { +function lowering15(arg0, arg1, arg2, arg3, arg4) { if ((arg1 & 4294967294) !== 0) { throw new TypeError('flags have extraneous bits set'); } @@ -834,7 +1406,7 @@ function lowering13(arg0, arg1, arg2, arg3, arg4) { const result1 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr1, len1)); let ret; try { - ret = { tag: 'ok', val: lowering13Callee(arg0 >>> 0, flags0, result1) }; + ret = { tag: 'ok', val: statAt(arg0 >>> 0, flags0, result1) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1074,7 +1646,7 @@ function lowering13(arg0, arg1, arg2, arg3, arg4) { } } -function lowering14(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { +function lowering16(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { if ((arg1 & 4294967294) !== 0) { throw new TypeError('flags have extraneous bits set'); } @@ -1109,12 +1681,12 @@ function lowering14(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { } const flags4 = { readable: Boolean(arg6 & 1), - writeable: Boolean(arg6 & 2), + writable: Boolean(arg6 & 2), executable: Boolean(arg6 & 4), }; let ret; try { - ret = { tag: 'ok', val: lowering14Callee(arg0 >>> 0, flags0, result1, flags2, flags3, flags4) }; + ret = { tag: 'ok', val: openAt(arg0 >>> 0, flags0, result1, flags2, flags3, flags4) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1297,10 +1869,10 @@ function lowering14(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) { } } -function lowering15(arg0, arg1) { +function lowering17(arg0, arg1) { let ret; try { - ret = { tag: 'ok', val: lowering15Callee(arg0 >>> 0) }; + ret = { tag: 'ok', val: readDirectoryEntry(arg0 >>> 0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1546,8 +2118,8 @@ function lowering15(arg0, arg1) { } } -function lowering16(arg0, arg1) { - const ret = lowering16Callee(BigInt.asUintN(64, arg0)); +function lowering18(arg0, arg1) { + const ret = getRandomBytes(BigInt.asUintN(64, arg0)); const val0 = ret; const len0 = val0.byteLength; const ptr0 = realloc0(0, 0, 1, len0 * 1); @@ -1557,8 +2129,8 @@ function lowering16(arg0, arg1) { dataView(memory0).setInt32(arg1 + 0, ptr0, true); } -function lowering17(arg0) { - const ret = lowering17Callee(); +function lowering19(arg0) { + const ret = getEnvironment(); const vec3 = ret; const len3 = vec3.length; const result3 = realloc0(0, 0, 4, len3 * 16); @@ -1578,10 +2150,10 @@ function lowering17(arg0) { dataView(memory0).setInt32(arg0 + 0, result3, true); } -function lowering18(arg0, arg1, arg2) { +function lowering20(arg0, arg1, arg2) { let ret; try { - ret = { tag: 'ok', val: lowering18Callee(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; + ret = { tag: 'ok', val: read(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1613,10 +2185,10 @@ function lowering18(arg0, arg1, arg2) { } } -function lowering19(arg0, arg1, arg2) { +function lowering21(arg0, arg1, arg2) { let ret; try { - ret = { tag: 'ok', val: lowering19Callee(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; + ret = { tag: 'ok', val: blockingRead(arg0 >>> 0, BigInt.asUintN(64, arg1)) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1648,13 +2220,13 @@ function lowering19(arg0, arg1, arg2) { } } -function lowering20(arg0, arg1, arg2, arg3) { +function lowering22(arg0, arg1, arg2, arg3) { const ptr0 = arg1; const len0 = arg2; const result0 = new Uint8Array(memory0.buffer.slice(ptr0, ptr0 + len0 * 1)); let ret; try { - ret = { tag: 'ok', val: lowering20Callee(arg0 >>> 0, result0) }; + ret = { tag: 'ok', val: write(arg0 >>> 0, result0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1678,13 +2250,13 @@ function lowering20(arg0, arg1, arg2, arg3) { } } -function lowering21(arg0, arg1, arg2, arg3) { +function lowering23(arg0, arg1, arg2, arg3) { const ptr0 = arg1; const len0 = arg2; const result0 = new Uint8Array(memory0.buffer.slice(ptr0, ptr0 + len0 * 1)); let ret; try { - ret = { tag: 'ok', val: lowering21Callee(arg0 >>> 0, result0) }; + ret = { tag: 'ok', val: blockingWrite(arg0 >>> 0, result0) }; } catch (e) { ret = { tag: 'err', val: getErrorPayload(e) }; } @@ -1710,255 +2282,251 @@ function lowering21(arg0, arg1, arg2, arg3) { let exports3; let realloc1; let postReturn0; -const exports = { - spliceBindings(arg0, arg1, arg2, arg3, arg4) { - const variant1 = arg0; - let variant1_0; - let variant1_1; - let variant1_2; - if (variant1 === null || variant1=== undefined) { - variant1_0 = 0; - variant1_1 = 0; - variant1_2 = 0; - } else { - const e = variant1; - const ptr0 = utf8Encode(e, realloc1, memory0); - const len0 = utf8EncodedLen; - variant1_0 = 1; - variant1_1 = ptr0; - variant1_2 = len0; - } - const val2 = arg1; - const len2 = val2.byteLength; - const ptr2 = realloc1(0, 0, 1, len2 * 1); - const src2 = new Uint8Array(val2.buffer || val2, val2.byteOffset, len2 * 1); - (new Uint8Array(memory0.buffer, ptr2, len2 * 1)).set(src2); - const variant4 = arg2; - let variant4_0; - let variant4_1; - let variant4_2; - if (variant4 === null || variant4=== undefined) { - variant4_0 = 0; - variant4_1 = 0; - variant4_2 = 0; - } else { - const e = variant4; - const ptr3 = utf8Encode(e, realloc1, memory0); - const len3 = utf8EncodedLen; - variant4_0 = 1; - variant4_1 = ptr3; - variant4_2 = len3; - } - const variant6 = arg3; - let variant6_0; - let variant6_1; - let variant6_2; - if (variant6 === null || variant6=== undefined) { - variant6_0 = 0; - variant6_1 = 0; - variant6_2 = 0; - } else { - const e = variant6; - const ptr5 = utf8Encode(e, realloc1, memory0); - const len5 = utf8EncodedLen; - variant6_0 = 1; - variant6_1 = ptr5; - variant6_2 = len5; - } - const variant8 = arg4; - let variant8_0; - let variant8_1; - let variant8_2; - if (variant8 === null || variant8=== undefined) { - variant8_0 = 0; - variant8_1 = 0; - variant8_2 = 0; - } else { - const e = variant8; - const ptr7 = utf8Encode(e, realloc1, memory0); - const len7 = utf8EncodedLen; - variant8_0 = 1; - variant8_1 = ptr7; - variant8_2 = len7; - } - const ret = exports1['exports#splice-bindings'](variant1_0, variant1_1, variant1_2, ptr2, len2, variant4_0, variant4_1, variant4_2, variant6_0, variant6_1, variant6_2, variant8_0, variant8_1, variant8_2); - let variant26; - switch (dataView(memory0).getUint8(ret + 0, true)) { - case 0: { - const ptr9 = dataView(memory0).getInt32(ret + 4, true); - const len9 = dataView(memory0).getInt32(ret + 8, true); - const result9 = new Uint8Array(memory0.buffer.slice(ptr9, ptr9 + len9 * 1)); - const ptr10 = dataView(memory0).getInt32(ret + 12, true); - const len10 = dataView(memory0).getInt32(ret + 16, true); - const result10 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr10, len10)); - const len18 = dataView(memory0).getInt32(ret + 24, true); - const base18 = dataView(memory0).getInt32(ret + 20, true); - const result18 = []; - for (let i = 0; i < len18; i++) { - const base = base18 + i * 28; - const ptr11 = dataView(memory0).getInt32(base + 0, true); - const len11 = dataView(memory0).getInt32(base + 4, true); - const result11 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr11, len11)); - const len13 = dataView(memory0).getInt32(base + 12, true); - const base13 = dataView(memory0).getInt32(base + 8, true); - const result13 = []; - for (let i = 0; i < len13; i++) { - const base = base13 + i * 1; - let enum12; - switch (dataView(memory0).getUint8(base + 0, true)) { + +function spliceBindings(arg0, arg1, arg2, arg3, arg4) { + const variant1 = arg0; + let variant1_0; + let variant1_1; + let variant1_2; + if (variant1 === null || variant1=== undefined) { + variant1_0 = 0; + variant1_1 = 0; + variant1_2 = 0; + } else { + const e = variant1; + const ptr0 = utf8Encode(e, realloc1, memory0); + const len0 = utf8EncodedLen; + variant1_0 = 1; + variant1_1 = ptr0; + variant1_2 = len0; + } + const val2 = arg1; + const len2 = val2.byteLength; + const ptr2 = realloc1(0, 0, 1, len2 * 1); + const src2 = new Uint8Array(val2.buffer || val2, val2.byteOffset, len2 * 1); + (new Uint8Array(memory0.buffer, ptr2, len2 * 1)).set(src2); + const variant4 = arg2; + let variant4_0; + let variant4_1; + let variant4_2; + if (variant4 === null || variant4=== undefined) { + variant4_0 = 0; + variant4_1 = 0; + variant4_2 = 0; + } else { + const e = variant4; + const ptr3 = utf8Encode(e, realloc1, memory0); + const len3 = utf8EncodedLen; + variant4_0 = 1; + variant4_1 = ptr3; + variant4_2 = len3; + } + const variant6 = arg3; + let variant6_0; + let variant6_1; + let variant6_2; + if (variant6 === null || variant6=== undefined) { + variant6_0 = 0; + variant6_1 = 0; + variant6_2 = 0; + } else { + const e = variant6; + const ptr5 = utf8Encode(e, realloc1, memory0); + const len5 = utf8EncodedLen; + variant6_0 = 1; + variant6_1 = ptr5; + variant6_2 = len5; + } + const variant8 = arg4; + let variant8_0; + let variant8_1; + let variant8_2; + if (variant8 === null || variant8=== undefined) { + variant8_0 = 0; + variant8_1 = 0; + variant8_2 = 0; + } else { + const e = variant8; + const ptr7 = utf8Encode(e, realloc1, memory0); + const len7 = utf8EncodedLen; + variant8_0 = 1; + variant8_1 = ptr7; + variant8_2 = len7; + } + const ret = exports1['splice-bindings'](variant1_0, variant1_1, variant1_2, ptr2, len2, variant4_0, variant4_1, variant4_2, variant6_0, variant6_1, variant6_2, variant8_0, variant8_1, variant8_2); + let variant26; + switch (dataView(memory0).getUint8(ret + 0, true)) { + case 0: { + const ptr9 = dataView(memory0).getInt32(ret + 4, true); + const len9 = dataView(memory0).getInt32(ret + 8, true); + const result9 = new Uint8Array(memory0.buffer.slice(ptr9, ptr9 + len9 * 1)); + const ptr10 = dataView(memory0).getInt32(ret + 12, true); + const len10 = dataView(memory0).getInt32(ret + 16, true); + const result10 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr10, len10)); + const len18 = dataView(memory0).getInt32(ret + 24, true); + const base18 = dataView(memory0).getInt32(ret + 20, true); + const result18 = []; + for (let i = 0; i < len18; i++) { + const base = base18 + i * 28; + const ptr11 = dataView(memory0).getInt32(base + 0, true); + const len11 = dataView(memory0).getInt32(base + 4, true); + const result11 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr11, len11)); + const len13 = dataView(memory0).getInt32(base + 12, true); + const base13 = dataView(memory0).getInt32(base + 8, true); + const result13 = []; + for (let i = 0; i < len13; i++) { + const base = base13 + i * 1; + let enum12; + switch (dataView(memory0).getUint8(base + 0, true)) { + case 0: { + enum12 = 'i32'; + break; + } + case 1: { + enum12 = 'i64'; + break; + } + case 2: { + enum12 = 'f32'; + break; + } + case 3: { + enum12 = 'f64'; + break; + } + default: { + throw new TypeError('invalid discriminant specified for CoreTy'); + } + } + result13.push(enum12); + } + let variant15; + switch (dataView(memory0).getUint8(base + 16, true)) { + case 0: { + variant15 = null; + break; + } + case 1: { + let enum14; + switch (dataView(memory0).getUint8(base + 17, true)) { case 0: { - enum12 = 'i32'; + enum14 = 'i32'; break; } case 1: { - enum12 = 'i64'; + enum14 = 'i64'; break; } case 2: { - enum12 = 'f32'; + enum14 = 'f32'; break; } case 3: { - enum12 = 'f64'; + enum14 = 'f64'; break; } default: { throw new TypeError('invalid discriminant specified for CoreTy'); } } - result13.push(enum12); - } - let variant15; - switch (dataView(memory0).getUint8(base + 16, true)) { - case 0: { - variant15 = null; - break; - } - case 1: { - let enum14; - switch (dataView(memory0).getUint8(base + 17, true)) { - case 0: { - enum14 = 'i32'; - break; - } - case 1: { - enum14 = 'i64'; - break; - } - case 2: { - enum14 = 'f32'; - break; - } - case 3: { - enum14 = 'f64'; - break; - } - default: { - throw new TypeError('invalid discriminant specified for CoreTy'); - } - } - variant15 = enum14; - break; - } - default: { - throw new TypeError('invalid variant discriminant for option'); - } + variant15 = enum14; + break; } - const bool16 = dataView(memory0).getUint8(base + 18, true); - const bool17 = dataView(memory0).getUint8(base + 24, true); - result18.push([result11, { - params: result13, - ret: variant15, - retptr: bool16 == 0 ? false : (bool16 == 1 ? true : throwInvalidBool()), - retsize: dataView(memory0).getInt32(base + 20, true) >>> 0, - paramptr: bool17 == 0 ? false : (bool17 == 1 ? true : throwInvalidBool()), - }]); - } - const len21 = dataView(memory0).getInt32(ret + 32, true); - const base21 = dataView(memory0).getInt32(ret + 28, true); - const result21 = []; - for (let i = 0; i < len21; i++) { - const base = base21 + i * 16; - const ptr19 = dataView(memory0).getInt32(base + 0, true); - const len19 = dataView(memory0).getInt32(base + 4, true); - const result19 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr19, len19)); - const ptr20 = dataView(memory0).getInt32(base + 8, true); - const len20 = dataView(memory0).getInt32(base + 12, true); - const result20 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr20, len20)); - result21.push([result19, result20]); - } - const len24 = dataView(memory0).getInt32(ret + 40, true); - const base24 = dataView(memory0).getInt32(ret + 36, true); - const result24 = []; - for (let i = 0; i < len24; i++) { - const base = base24 + i * 20; - const ptr22 = dataView(memory0).getInt32(base + 0, true); - const len22 = dataView(memory0).getInt32(base + 4, true); - const result22 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr22, len22)); - const ptr23 = dataView(memory0).getInt32(base + 8, true); - const len23 = dataView(memory0).getInt32(base + 12, true); - const result23 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr23, len23)); - result24.push([result22, result23, dataView(memory0).getInt32(base + 16, true) >>> 0]); - } - variant26= { - tag: 'ok', - val: { - wasm: result9, - jsBindings: result10, - exports: result18, - importWrappers: result21, - imports: result24, + default: { + throw new TypeError('invalid variant discriminant for option'); } - }; - break; + } + const bool16 = dataView(memory0).getUint8(base + 18, true); + const bool17 = dataView(memory0).getUint8(base + 24, true); + result18.push([result11, { + params: result13, + ret: variant15, + retptr: bool16 == 0 ? false : (bool16 == 1 ? true : throwInvalidBool()), + retsize: dataView(memory0).getInt32(base + 20, true) >>> 0, + paramptr: bool17 == 0 ? false : (bool17 == 1 ? true : throwInvalidBool()), + }]); } - case 1: { - const ptr25 = dataView(memory0).getInt32(ret + 4, true); - const len25 = dataView(memory0).getInt32(ret + 8, true); - const result25 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr25, len25)); - variant26= { - tag: 'err', - val: result25 - }; - break; + const len21 = dataView(memory0).getInt32(ret + 32, true); + const base21 = dataView(memory0).getInt32(ret + 28, true); + const result21 = []; + for (let i = 0; i < len21; i++) { + const base = base21 + i * 16; + const ptr19 = dataView(memory0).getInt32(base + 0, true); + const len19 = dataView(memory0).getInt32(base + 4, true); + const result19 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr19, len19)); + const ptr20 = dataView(memory0).getInt32(base + 8, true); + const len20 = dataView(memory0).getInt32(base + 12, true); + const result20 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr20, len20)); + result21.push([result19, result20]); } - default: { - throw new TypeError('invalid variant discriminant for expected'); + const len24 = dataView(memory0).getInt32(ret + 40, true); + const base24 = dataView(memory0).getInt32(ret + 36, true); + const result24 = []; + for (let i = 0; i < len24; i++) { + const base = base24 + i * 20; + const ptr22 = dataView(memory0).getInt32(base + 0, true); + const len22 = dataView(memory0).getInt32(base + 4, true); + const result22 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr22, len22)); + const ptr23 = dataView(memory0).getInt32(base + 8, true); + const len23 = dataView(memory0).getInt32(base + 12, true); + const result23 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr23, len23)); + result24.push([result22, result23, dataView(memory0).getInt32(base + 16, true) >>> 0]); } + variant26= { + tag: 'ok', + val: { + wasm: result9, + jsBindings: result10, + exports: result18, + importWrappers: result21, + imports: result24, + } + }; + break; + } + case 1: { + const ptr25 = dataView(memory0).getInt32(ret + 4, true); + const len25 = dataView(memory0).getInt32(ret + 8, true); + const result25 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr25, len25)); + variant26= { + tag: 'err', + val: result25 + }; + break; } - postReturn0(ret); - if (variant26.tag === 'err') { - throw new ComponentError(variant26.val); + default: { + throw new TypeError('invalid variant discriminant for expected'); } - return variant26.val; - }, - -}; - -export { exports } + } + postReturn0(ret); + if (variant26.tag === 'err') { + throw new ComponentError(variant26.val); + } + return variant26.val; +} const $init = (async() => { const module0 = fetchCompile(new URL('./spidermonkey-embedding-splicer.core.wasm', import.meta.url)); const module1 = fetchCompile(new URL('./spidermonkey-embedding-splicer.core2.wasm', import.meta.url)); - const module2 = base64Compile('AGFzbQEAAAABbA9gAX8AYAJ/fwBgBX9/f39/AGAIf39/f39/f38AYAJ+fwBgA39+fwBgBH9/f38AYAJ/fwF/YAR/f39/AX9gBX9/f35/AX9gBX9/f39/AX9gCX9/f39/fn5/fwF/YAF/AX9gA39/fwF/YAF/AAMcGwAAAQEBAgMBBAAFBQYGBwgJCAoLBwcHDAcNDgQFAXABGxsHiQEcATAAAAExAAEBMgACATMAAwE0AAQBNQAFATYABgE3AAcBOAAIATkACQIxMAAKAjExAAsCMTIADAIxMwANAjE0AA4CMTUADwIxNgAQAjE3ABECMTgAEgIxOQATAjIwABQCMjEAFQIyMgAWAjIzABcCMjQAGAIyNQAZAjI2ABoIJGltcG9ydHMBAAr9AhsJACAAQQARAAALCQAgAEEBEQAACwsAIAAgAUECEQEACwsAIAAgAUEDEQEACwsAIAAgAUEEEQEACxEAIAAgASACIAMgBEEFEQIACxcAIAAgASACIAMgBCAFIAYgB0EGEQMACwsAIAAgAUEHEQEACwsAIAAgAUEIEQQACwkAIABBCREAAAsNACAAIAEgAkEKEQUACw0AIAAgASACQQsRBQALDwAgACABIAIgA0EMEQYACw8AIAAgASACIANBDREGAAsLACAAIAFBDhEHAAsPACAAIAEgAiADQQ8RCAALEQAgACABIAIgAyAEQRARCQALDwAgACABIAIgA0EREQgACxEAIAAgASACIAMgBEESEQoACxkAIAAgASACIAMgBCAFIAYgByAIQRMRCwALCwAgACABQRQRBwALCwAgACABQRURBwALCwAgACABQRYRBwALCQAgAEEXEQwACwsAIAAgAUEYEQcACw0AIAAgASACQRkRDQALCQAgAEEaEQ4ACwAtCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BTAuOS4wAIMIBG5hbWUAExJ3aXQtY29tcG9uZW50OnNoaW0B5gcbABtpbmRpcmVjdC1wcmVvcGVucy1nZXQtc3RkaW8BIWluZGlyZWN0LXByZW9wZW5zLWdldC1kaXJlY3RvcmllcwIcaW5kaXJlY3QtZmlsZXN5c3RlbS1nZXQtdHlwZQMiaW5kaXJlY3QtZmlsZXN5c3RlbS1yZWFkLWRpcmVjdG9yeQQYaW5kaXJlY3QtZmlsZXN5c3RlbS1zdGF0BRtpbmRpcmVjdC1maWxlc3lzdGVtLXN0YXQtYXQGG2luZGlyZWN0LWZpbGVzeXN0ZW0tb3Blbi1hdAcoaW5kaXJlY3QtZmlsZXN5c3RlbS1yZWFkLWRpcmVjdG9yeS1lbnRyeQggaW5kaXJlY3QtcmFuZG9tLWdldC1yYW5kb20tYnl0ZXMJJGluZGlyZWN0LWVudmlyb25tZW50LWdldC1lbnZpcm9ubWVudAoVaW5kaXJlY3Qtc3RyZWFtcy1yZWFkCx5pbmRpcmVjdC1zdHJlYW1zLWJsb2NraW5nLXJlYWQMFmluZGlyZWN0LXN0cmVhbXMtd3JpdGUNH2luZGlyZWN0LXN0cmVhbXMtYmxvY2tpbmctd3JpdGUOLGFkYXB0LXdhc2lfc25hcHNob3RfcHJldmlldzEtZmRfZmlsZXN0YXRfZ2V0DyRhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWZkX3JlYWQQJ2FkYXB0LXdhc2lfc25hcHNob3RfcHJldmlldzEtZmRfcmVhZGRpchElYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF93cml0ZRIuYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1wYXRoX2ZpbGVzdGF0X2dldBMmYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1wYXRoX29wZW4UJ2FkYXB0LXdhc2lfc25hcHNob3RfcHJldmlldzEtcmFuZG9tX2dldBUoYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1lbnZpcm9uX2dldBYuYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1lbnZpcm9uX3NpemVzX2dldBclYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF9jbG9zZRgrYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF9wcmVzdGF0X2dldBkwYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF9wcmVzdGF0X2Rpcl9uYW1lGiZhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLXByb2NfZXhpdA'); - const module3 = base64Compile('AGFzbQEAAAABbA9gAX8AYAJ/fwBgBX9/f39/AGAIf39/f39/f38AYAJ+fwBgA39+fwBgBH9/f38AYAJ/fwF/YAR/f39/AX9gBX9/f35/AX9gBX9/f39/AX9gCX9/f39/fn5/fwF/YAF/AX9gA39/fwF/YAF/AAKoARwAATAAAAABMQAAAAEyAAEAATMAAQABNAABAAE1AAIAATYAAwABNwABAAE4AAQAATkAAAACMTAABQACMTEABQACMTIABgACMTMABgACMTQABwACMTUACAACMTYACQACMTcACAACMTgACgACMTkACwACMjAABwACMjEABwACMjIABwACMjMADAACMjQABwACMjUADQACMjYADgAIJGltcG9ydHMBcAEbGwkhAQBBAAsbAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaAC0JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQFMC45LjAAHARuYW1lABUUd2l0LWNvbXBvbmVudDpmaXh1cHM'); + const module2 = base64Compile('AGFzbQEAAAABbA9gAX8AYAN/fn8AYAJ/fwBgBX9/f39/AGAIf39/f39/f38AYAJ+fwBgBH9/f38AYAJ/fwF/YAR/f39/AX9gBX9/f35/AX9gBX9/f39/AX9gCX9/f39/fn5/fwF/YAF/AX9gA39/fwF/YAF/AAMeHQABAQICAgIDBAIFAAEBBgYHCAkICgsHBwcMBw0OBAUBcAEdHQeTAR4BMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwIJGltcG9ydHMBAAqbAx0JACAAQQARAAALDQAgACABIAJBAREBAAsNACAAIAEgAkECEQEACwsAIAAgAUEDEQIACwsAIAAgAUEEEQIACwsAIAAgAUEFEQIACwsAIAAgAUEGEQIACxEAIAAgASACIAMgBEEHEQMACxcAIAAgASACIAMgBCAFIAYgB0EIEQQACwsAIAAgAUEJEQIACwsAIAAgAUEKEQUACwkAIABBCxEAAAsNACAAIAEgAkEMEQEACw0AIAAgASACQQ0RAQALDwAgACABIAIgA0EOEQYACw8AIAAgASACIANBDxEGAAsLACAAIAFBEBEHAAsPACAAIAEgAiADQRERCAALEQAgACABIAIgAyAEQRIRCQALDwAgACABIAIgA0ETEQgACxEAIAAgASACIAMgBEEUEQoACxkAIAAgASACIAMgBCAFIAYgByAIQRURCwALCwAgACABQRYRBwALCwAgACABQRcRBwALCwAgACABQRgRBwALCQAgAEEZEQwACwsAIAAgAUEaEQcACw0AIAAgASACQRsRDQALCQAgAEEcEQ4ACwAuCXByb2R1Y2VycwEMcHJvY2Vzc2VkLWJ5AQ13aXQtY29tcG9uZW50BjAuMTEuMACwCgRuYW1lABMSd2l0LWNvbXBvbmVudDpzaGltAZMKHQAvaW5kaXJlY3Qtd2FzaTpjbGktYmFzZS9wcmVvcGVucy1nZXQtZGlyZWN0b3JpZXMBM2luZGlyZWN0LXdhc2k6ZmlsZXN5c3RlbS9maWxlc3lzdGVtLXJlYWQtdmlhLXN0cmVhbQI0aW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0td3JpdGUtdmlhLXN0cmVhbQM1aW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0tYXBwZW5kLXZpYS1zdHJlYW0ELGluZGlyZWN0LXdhc2k6ZmlsZXN5c3RlbS9maWxlc3lzdGVtLWdldC10eXBlBTJpbmRpcmVjdC13YXNpOmZpbGVzeXN0ZW0vZmlsZXN5c3RlbS1yZWFkLWRpcmVjdG9yeQYoaW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0tc3RhdAcraW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0tc3RhdC1hdAgraW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0tb3Blbi1hdAk4aW5kaXJlY3Qtd2FzaTpmaWxlc3lzdGVtL2ZpbGVzeXN0ZW0tcmVhZC1kaXJlY3RvcnktZW50cnkKLGluZGlyZWN0LXdhc2k6cmFuZG9tL3JhbmRvbS1nZXQtcmFuZG9tLWJ5dGVzCzJpbmRpcmVjdC13YXNpOmNsaS1iYXNlL2Vudmlyb25tZW50LWdldC1lbnZpcm9ubWVudAwdaW5kaXJlY3Qtd2FzaTppby9zdHJlYW1zLXJlYWQNJmluZGlyZWN0LXdhc2k6aW8vc3RyZWFtcy1ibG9ja2luZy1yZWFkDh5pbmRpcmVjdC13YXNpOmlvL3N0cmVhbXMtd3JpdGUPJ2luZGlyZWN0LXdhc2k6aW8vc3RyZWFtcy1ibG9ja2luZy13cml0ZRAsYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF9maWxlc3RhdF9nZXQRJGFkYXB0LXdhc2lfc25hcHNob3RfcHJldmlldzEtZmRfcmVhZBInYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1mZF9yZWFkZGlyEyVhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWZkX3dyaXRlFC5hZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLXBhdGhfZmlsZXN0YXRfZ2V0FSZhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLXBhdGhfb3BlbhYnYWRhcHQtd2FzaV9zbmFwc2hvdF9wcmV2aWV3MS1yYW5kb21fZ2V0FyhhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWVudmlyb25fZ2V0GC5hZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWVudmlyb25fc2l6ZXNfZ2V0GSVhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWZkX2Nsb3NlGithZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWZkX3ByZXN0YXRfZ2V0GzBhZGFwdC13YXNpX3NuYXBzaG90X3ByZXZpZXcxLWZkX3ByZXN0YXRfZGlyX25hbWUcJmFkYXB0LXdhc2lfc25hcHNob3RfcHJldmlldzEtcHJvY19leGl0'); + const module3 = base64Compile('AGFzbQEAAAABbA9gAX8AYAN/fn8AYAJ/fwBgBX9/f39/AGAIf39/f39/f38AYAJ+fwBgBH9/f38AYAJ/fwF/YAR/f39/AX9gBX9/f35/AX9gBX9/f39/AX9gCX9/f39/fn5/fwF/YAF/AX9gA39/fwF/YAF/AAK0AR4AATAAAAABMQABAAEyAAEAATMAAgABNAACAAE1AAIAATYAAgABNwADAAE4AAQAATkAAgACMTAABQACMTEAAAACMTIAAQACMTMAAQACMTQABgACMTUABgACMTYABwACMTcACAACMTgACQACMTkACAACMjAACgACMjEACwACMjIABwACMjMABwACMjQABwACMjUADAACMjYABwACMjcADQACMjgADgAIJGltcG9ydHMBcAEdHQkjAQBBAAsdAAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwALglwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAYwLjExLjAAHARuYW1lABUUd2l0LWNvbXBvbmVudDpmaXh1cHM'); Promise.all([module0, module1, module2, module3]).catch(() => {}); ({ exports: exports0 } = await instantiateCore(await module2)); ({ exports: exports1 } = await instantiateCore(await module0, { wasi_snapshot_preview1: { - environ_get: exports0['21'], - environ_sizes_get: exports0['22'], - fd_close: exports0['23'], - fd_filestat_get: exports0['14'], - fd_prestat_dir_name: exports0['25'], - fd_prestat_get: exports0['24'], - fd_read: exports0['15'], - fd_readdir: exports0['16'], - fd_write: exports0['17'], - path_filestat_get: exports0['18'], - path_open: exports0['19'], - proc_exit: exports0['26'], - random_get: exports0['20'], + environ_get: exports0['23'], + environ_sizes_get: exports0['24'], + fd_close: exports0['25'], + fd_filestat_get: exports0['16'], + fd_prestat_dir_name: exports0['27'], + fd_prestat_get: exports0['26'], + fd_read: exports0['17'], + fd_readdir: exports0['18'], + fd_write: exports0['19'], + path_filestat_get: exports0['20'], + path_open: exports0['21'], + proc_exit: exports0['28'], + random_get: exports0['22'], }, })); ({ exports: exports2 } = await instantiateCore(await module1, { @@ -1968,39 +2536,47 @@ const $init = (async() => { env: { memory: exports1.memory, }, - environment: { - 'get-environment': exports0['9'], + 'wasi:cli-base/environment': { + 'get-environment': exports0['11'], }, - exit: { - exit: lowering5, + 'wasi:cli-base/exit': { + exit: lowering2, }, - filesystem: { - 'append-via-stream': lowering3, - 'drop-descriptor': lowering4, - 'drop-directory-entry-stream': lowering0, - 'get-type': exports0['2'], - 'open-at': exports0['6'], - 'read-directory': exports0['3'], - 'read-directory-entry': exports0['7'], - 'read-via-stream': lowering1, - stat: exports0['4'], - 'stat-at': exports0['5'], - 'write-via-stream': lowering2, + 'wasi:cli-base/preopens': { + 'get-directories': exports0['0'], + }, + 'wasi:cli-base/stderr': { + 'get-stderr': lowering3, }, - preopens: { - 'get-directories': exports0['1'], - 'get-stdio': exports0['0'], + 'wasi:cli-base/stdin': { + 'get-stdin': lowering4, }, - random: { - 'get-random-bytes': exports0['8'], + 'wasi:cli-base/stdout': { + 'get-stdout': lowering5, }, - streams: { - 'blocking-read': exports0['11'], - 'blocking-write': exports0['13'], + 'wasi:filesystem/filesystem': { + 'append-via-stream': exports0['3'], + 'drop-descriptor': lowering1, + 'drop-directory-entry-stream': lowering0, + 'get-type': exports0['4'], + 'open-at': exports0['8'], + 'read-directory': exports0['5'], + 'read-directory-entry': exports0['9'], + 'read-via-stream': exports0['1'], + stat: exports0['6'], + 'stat-at': exports0['7'], + 'write-via-stream': exports0['2'], + }, + 'wasi:io/streams': { + 'blocking-read': exports0['13'], + 'blocking-write': exports0['15'], 'drop-input-stream': lowering6, 'drop-output-stream': lowering7, - read: exports0['10'], - write: exports0['12'], + read: exports0['12'], + write: exports0['14'], + }, + 'wasi:random/random': { + 'get-random-bytes': exports0['10'], }, })); memory0 = exports1.memory; @@ -2014,20 +2590,22 @@ const $init = (async() => { '11': lowering19, '12': lowering20, '13': lowering21, - '14': exports2.fd_filestat_get, - '15': exports2.fd_read, - '16': exports2.fd_readdir, - '17': exports2.fd_write, - '18': exports2.path_filestat_get, - '19': exports2.path_open, + '14': lowering22, + '15': lowering23, + '16': exports2.fd_filestat_get, + '17': exports2.fd_read, + '18': exports2.fd_readdir, + '19': exports2.fd_write, '2': lowering10, - '20': exports2.random_get, - '21': exports2.environ_get, - '22': exports2.environ_sizes_get, - '23': exports2.fd_close, - '24': exports2.fd_prestat_get, - '25': exports2.fd_prestat_dir_name, - '26': exports2.proc_exit, + '20': exports2.path_filestat_get, + '21': exports2.path_open, + '22': exports2.random_get, + '23': exports2.environ_get, + '24': exports2.environ_sizes_get, + '25': exports2.fd_close, + '26': exports2.fd_prestat_get, + '27': exports2.fd_prestat_dir_name, + '28': exports2.proc_exit, '3': lowering11, '4': lowering12, '5': lowering13, @@ -2038,7 +2616,9 @@ const $init = (async() => { }, })); realloc1 = exports1.cabi_realloc; - postReturn0 = exports1['cabi_post_exports#splice-bindings']; + postReturn0 = exports1['cabi_post_splice-bindings']; })(); await $init; + +export { spliceBindings } \ No newline at end of file diff --git a/lib/spidermonkey_embedding.wasm b/lib/spidermonkey_embedding.wasm deleted file mode 100755 index 27783c79..00000000 Binary files a/lib/spidermonkey_embedding.wasm and /dev/null differ diff --git a/package-lock.json b/package-lock.json index 49133fbd..508f195f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,7 +1,7 @@ { "name": "@bytecodealliance/componentize-js", "version": "0.0.7", - "lockfileVersion": 2, + "lockfileVersion": 3, "requires": true, "packages": { "": { @@ -11,45 +11,44 @@ "." ], "dependencies": { - "@bytecodealliance/jco": "^0.7.0", - "@bytecodealliance/wizer": "^1.6.1-beta.4" + "@bytecodealliance/jco": "^0.9.2", + "@bytecodealliance/wizer": "^3.0.1" }, "devDependencies": { - "@bytecodealliance/preview2-shim": "0.0.8", + "@bytecodealliance/preview2-shim": "0.0.10", "mocha": "^10.2.0" } }, - "example": { - "extraneous": true, - "devDependencies": { - "@bytecodealliance/componentize-js": "*", - "@bytecodealliance/jco": "*" - } - }, "node_modules/@bytecodealliance/componentize-js": { "resolved": "", "link": true }, "node_modules/@bytecodealliance/jco": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.7.0.tgz", - "integrity": "sha512-YPqmvNHfcmDUMz2TC7LEYramGiKhMLjbHaZ2kqEtOrAOSOiFmkDXAyJLHp7j8QzBbotOhZDrvdKrAGlxiQZigQ==", + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.9.2.tgz", + "integrity": "sha512-tYxTSdPoGVI3/QrsvnQpwsWDozRmLYRmbVop0uc3Yd0ZxyiYvtOxmCtWWiWzODwrFoL2eYFzAyJWw+Y7hc11+g==", "dependencies": { - "@bytecodealliance/preview2-shim": "0.0.8" + "@bytecodealliance/preview2-shim": "0.0.10", + "binaryen": "^111.0.0", + "chalk-template": "^0.4.0", + "commander": "^9.4.1", + "mkdirp": "^1.0.4", + "ora": "^6.1.2", + "terser": "^5.16.1" }, "bin": { - "jco": "cli.mjs" + "jco": "src/jco.js" } }, "node_modules/@bytecodealliance/preview2-shim": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.8.tgz", - "integrity": "sha512-yeY8wHpCBlRlHCU4YzvGn41z3UV9svDE7Z3OkEyU5TbzJiy1S9mMB3R43d2YE/f6rPLRZyE141TDDyPf6zdcWQ==" + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.10.tgz", + "integrity": "sha512-h6Kx6fYYKYLPzuTZiJhvdTEpBDngZUqMAAaNWK2afZjYGl05KL1Arc5IhMyY77DIRi346gT8qfPodvV3oGQnBQ==" }, "node_modules/@bytecodealliance/wizer": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-1.6.1-beta.4.tgz", - "integrity": "sha512-afgV4lyYVMBN/9/yNDgYGTn92D7VrqS0yTZ3WZgDyDTiOWjmSuQimEiX+VzCiYjF9GXsKwzCY1FEOu1pY2Evgw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-3.0.1.tgz", + "integrity": "sha512-f0NBiBHCNBkbFHTPRbA7aKf/t4KyNhi2KvSqw3QzCgi8wFF/uLZ0dhejj93rbiKO/iwWbmU7v9K3SVkW81mcjQ==", "bin": { "wizer": "wizer.js" }, @@ -57,16 +56,18 @@ "node": ">=16" }, "optionalDependencies": { - "@bytecodealliance/wizer-darwin-arm64": "1.6.1-beta.4", - "@bytecodealliance/wizer-darwin-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-linux-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-win32-x64": "1.6.1-beta.4" + "@bytecodealliance/wizer-darwin-arm64": "3.0.1", + "@bytecodealliance/wizer-darwin-x64": "3.0.1", + "@bytecodealliance/wizer-linux-arm64": "3.0.1", + "@bytecodealliance/wizer-linux-s390x": "3.0.1", + "@bytecodealliance/wizer-linux-x64": "3.0.1", + "@bytecodealliance/wizer-win32-x64": "3.0.1" } }, "node_modules/@bytecodealliance/wizer-darwin-arm64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-1.6.1-beta.4.tgz", - "integrity": "sha512-NyleEH0GKBqS0DCuKceY3a2ZxF/aNzYa68swbKKljSFh6uo/3Cqr/U5/SuTxval6/VwtZ1eEzRPaLbLlUE5r4w==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-3.0.1.tgz", + "integrity": "sha512-/8KYSajyhO9koAE3qQhYfC6belZheJw9X3XqW7hrizTpj6n4z4OJFhhqwJmiYFUUsPtC7OxcXMFFPbTuSQPBcw==", "cpu": [ "arm64" ], @@ -79,9 +80,9 @@ } }, "node_modules/@bytecodealliance/wizer-darwin-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-2s8HPLrttAyYUJNHQlLVi3rDGlnk9IzEJTbw0DApfpVnCZZ1aTLt6MXTIBeOYo9si5Q4cqyDHT5bAoNZvJTk9A==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-3.0.1.tgz", + "integrity": "sha512-bMReultN/r+W/BRXV0F+28U5dZwbQT/ZO0k4icZlhUhrv5/wpQJix7Z/ZvBnVQ+/JHb0QDUpFk2/zCtgkRXP6Q==", "cpu": [ "x64" ], @@ -93,10 +94,40 @@ "wizer-darwin-x64": "wizer" } }, + "node_modules/@bytecodealliance/wizer-linux-arm64": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-arm64/-/wizer-linux-arm64-3.0.1.tgz", + "integrity": "sha512-35ZhAeYxWK3bTqqgwysbBWlGlrlMNKNng3ZITQV2PAtafpE7aCeqywl7VAS4lLRG5eTb7wxNgN7zf8d3wiIFTQ==", + "cpu": [ + "arm64" + ], + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-arm64": "wizer" + } + }, + "node_modules/@bytecodealliance/wizer-linux-s390x": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-s390x/-/wizer-linux-s390x-3.0.1.tgz", + "integrity": "sha512-Smvy9mguEMtX0lupDLTPshXUzAHeOhgscr1bhGNjeCCLD1sd8rIjBvWV19Wtra0BL1zTuU2EPOHjR/4k8WoyDg==", + "cpu": [ + "s390x" + ], + "optional": true, + "os": [ + "linux" + ], + "bin": { + "wizer-linux-s390x": "wizer" + } + }, "node_modules/@bytecodealliance/wizer-linux-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-S+oYRGGveuPLtiI6V7SQpZHhw43asLArC+fGrJRQ3OsHs8aj/IVusRLVYgWfKw1HtZm9iIWrjH9WYO6BWak4eQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-3.0.1.tgz", + "integrity": "sha512-uUue78xl7iwndsGgTsagHLTLyLBVHhwzuywiwHt1xw8y0X0O8REKRLBoB7+LdM+pttDPdFtKJgbTFL4UPAA7Yw==", "cpu": [ "x64" ], @@ -109,9 +140,9 @@ } }, "node_modules/@bytecodealliance/wizer-win32-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-NxqrLqFnaMyldkN7lBVS+Em23f84/RKrHjBXt9WnZK2RtJjvwoCXr+so6+qfj4f1K9BhIZ8UaBfYwqPvtLOcZQ==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-3.0.1.tgz", + "integrity": "sha512-ycd38sx1UTZpHZwh8IfH/4N3n0OQUB8awxkUSLXf9PolEd088YbxoPB3noHy4E+L2oYN7KZMrg9517pX0z2RhQ==", "cpu": [ "x64" ], @@ -123,6 +154,74 @@ "wizer-win32-x64": "wizer" } }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", + "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/source-map": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.3.tgz", + "integrity": "sha512-b+fsZXeLYi9fEULmfBrhxn4IrPlINf8fiNarzTof004v3lFdntdwa9PF7vFJqm3mg7s+ScJMxXaE3Acp1irZcg==", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.18", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz", + "integrity": "sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==", + "dependencies": { + "@jridgewell/resolve-uri": "3.1.0", + "@jridgewell/sourcemap-codec": "1.4.14" + } + }, + "node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.14", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", + "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==" + }, + "node_modules/acorn": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz", + "integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -133,19 +232,20 @@ } }, "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" } }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -181,6 +281,25 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -190,6 +309,25 @@ "node": ">=8" } }, + "node_modules/binaryen": { + "version": "111.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-111.0.0.tgz", + "integrity": "sha512-PEXOSHFO85aj1aP4t+KGzvxQ00qXbjCysWlsDjlGkP1e9owNiYdpEkLej21Ax8LDD7xJ01rEmJDqZ/JPoW2GXw==", + "bin": { + "wasm-opt": "bin/wasm-opt", + "wasm2js": "bin/wasm2js" + } + }, + "node_modules/bl": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/bl/-/bl-5.1.0.tgz", + "integrity": "sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==", + "dependencies": { + "buffer": "^6.0.3", + "inherits": "^2.0.4", + "readable-stream": "^3.4.0" + } + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -217,6 +355,34 @@ "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==" + }, "node_modules/camelcase": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", @@ -233,7 +399,6 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" @@ -245,16 +410,18 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, + "node_modules/chalk-template": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-0.4.0.tgz", + "integrity": "sha512-/ghrgmhfY8RaSdeo43hNXxpoHAtxdbskUHjPpfqUWGttFgycUhYPGx3YZBCnUCvOa7Doivn1IZec3DEGFoMgLg==", "dependencies": { - "has-flag": "^4.0.0" + "chalk": "^4.1.2" }, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/chalk-template?sponsor=1" } }, "node_modules/chokidar": { @@ -284,6 +451,31 @@ "fsevents": "~2.3.2" } }, + "node_modules/cli-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", + "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", + "dependencies": { + "restore-cursor": "^4.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cli-spinners": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.0.tgz", + "integrity": "sha512-4/aL9X3Wh0yiMQlE+eeRhWP6vclO3QRtw1JHKIT0FFUs5FjpFmESqtMvYZ0+lbzBw900b95mS0hohy+qn2VK/g==", + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/cliui": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", @@ -295,11 +487,39 @@ "wrap-ansi": "^7.0.0" } }, + "node_modules/cliui/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cliui/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==", + "engines": { + "node": ">=0.8" + } + }, "node_modules/color-convert": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -310,8 +530,15 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/commander": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz", + "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==", + "engines": { + "node": "^12.20.0 || >=14" + } }, "node_modules/concat-map": { "version": "0.0.1", @@ -354,6 +581,17 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/defaults": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", + "integrity": "sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -514,7 +752,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, "engines": { "node": ">=8" } @@ -528,6 +765,25 @@ "he": "bin/he" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -541,8 +797,7 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/is-binary-path": { "version": "2.1.0", @@ -586,6 +841,17 @@ "node": ">=0.10.0" } }, + "node_modules/is-interactive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", + "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-number": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", @@ -659,6 +925,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "engines": { + "node": ">=6" + } + }, "node_modules/minimatch": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", @@ -671,6 +945,17 @@ "node": ">=10" } }, + "node_modules/mkdirp": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", + "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/mocha": { "version": "10.2.0", "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", @@ -711,6 +996,21 @@ "url": "https://opencollective.com/mochajs" } }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -747,6 +1047,79 @@ "wrappy": "1" } }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/ora/-/ora-6.3.1.tgz", + "integrity": "sha512-ERAyNnZOfqM+Ao3RAvIXkYh5joP220yf59gVe2X/cI6SiCxIdi4c9HZKZD8R6q/RDXEje1THBju6iExiSsgJaQ==", + "dependencies": { + "chalk": "^5.0.0", + "cli-cursor": "^4.0.0", + "cli-spinners": "^2.6.1", + "is-interactive": "^2.0.0", + "is-unicode-supported": "^1.1.0", + "log-symbols": "^5.1.0", + "stdin-discarder": "^0.1.0", + "strip-ansi": "^7.0.1", + "wcwidth": "^1.0.1" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/chalk": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.2.0.tgz", + "integrity": "sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/ora/node_modules/is-unicode-supported": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", + "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ora/node_modules/log-symbols": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-5.1.0.tgz", + "integrity": "sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==", + "dependencies": { + "chalk": "^5.0.0", + "is-unicode-supported": "^1.1.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -816,6 +1189,19 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -837,11 +1223,25 @@ "node": ">=0.10.0" } }, + "node_modules/restore-cursor": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", + "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, "funding": [ { "type": "github", @@ -866,6 +1266,50 @@ "randombytes": "^2.1.0" } }, + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" + }, + "node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/stdin-discarder": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.1.0.tgz", + "integrity": "sha512-xhV7w8S+bUwlPTb4bAOUQhv8/cSS5offJuX8GQGq32ONF0ZtDWKfkdomM3HMRA+LhX6um/FZ0COqlwsjD53LeQ==", + "dependencies": { + "bl": "^5.0.0" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -880,7 +1324,16 @@ "node": ">=8" } }, - "node_modules/strip-ansi": { + "node_modules/string-width/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/string-width/node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", @@ -892,6 +1345,20 @@ "node": ">=8" } }, + "node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -905,20 +1372,38 @@ } }, "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dependencies": { "has-flag": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=8" + } + }, + "node_modules/terser": { + "version": "5.18.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.18.1.tgz", + "integrity": "sha512-j1n0Ao919h/Ai5r43VAnfV/7azUYW43GPxK7qSATzrsERfW7+y2QW9Cp9ufnRF5CQUWbnLSo7UJokSWCqg4tsQ==", + "dependencies": { + "@jridgewell/source-map": "^0.3.3", + "acorn": "^8.8.2", + "commander": "^2.20.0", + "source-map-support": "~0.5.20" }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" + "bin": { + "terser": "bin/terser" + }, + "engines": { + "node": ">=10" } }, + "node_modules/terser/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -931,6 +1416,19 @@ "node": ">=8.0" } }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==", + "dependencies": { + "defaults": "^1.0.3" + } + }, "node_modules/workerpool": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", @@ -954,6 +1452,27 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -1023,1393 +1542,5 @@ "url": "https://github.com/sponsors/sindresorhus" } } - }, - "dependencies": { - "@bytecodealliance/componentize-js": { - "version": "file:", - "requires": { - "@bytecodealliance/componentize-js": "file:", - "@bytecodealliance/jco": "^0.7.0", - "@bytecodealliance/preview2-shim": "0.0.8", - "@bytecodealliance/wizer": "^1.6.1-beta.4", - "mocha": "^10.2.0" - }, - "dependencies": { - "@bytecodealliance/jco": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.7.0.tgz", - "integrity": "sha512-YPqmvNHfcmDUMz2TC7LEYramGiKhMLjbHaZ2kqEtOrAOSOiFmkDXAyJLHp7j8QzBbotOhZDrvdKrAGlxiQZigQ==", - "requires": { - "@bytecodealliance/preview2-shim": "0.0.8" - } - }, - "@bytecodealliance/preview2-shim": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.8.tgz", - "integrity": "sha512-yeY8wHpCBlRlHCU4YzvGn41z3UV9svDE7Z3OkEyU5TbzJiy1S9mMB3R43d2YE/f6rPLRZyE141TDDyPf6zdcWQ==" - }, - "@bytecodealliance/wizer": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-1.6.1-beta.4.tgz", - "integrity": "sha512-afgV4lyYVMBN/9/yNDgYGTn92D7VrqS0yTZ3WZgDyDTiOWjmSuQimEiX+VzCiYjF9GXsKwzCY1FEOu1pY2Evgw==", - "requires": { - "@bytecodealliance/wizer-darwin-arm64": "1.6.1-beta.4", - "@bytecodealliance/wizer-darwin-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-linux-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-win32-x64": "1.6.1-beta.4" - } - }, - "@bytecodealliance/wizer-darwin-arm64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-1.6.1-beta.4.tgz", - "integrity": "sha512-NyleEH0GKBqS0DCuKceY3a2ZxF/aNzYa68swbKKljSFh6uo/3Cqr/U5/SuTxval6/VwtZ1eEzRPaLbLlUE5r4w==", - "optional": true - }, - "@bytecodealliance/wizer-darwin-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-2s8HPLrttAyYUJNHQlLVi3rDGlnk9IzEJTbw0DApfpVnCZZ1aTLt6MXTIBeOYo9si5Q4cqyDHT5bAoNZvJTk9A==", - "optional": true - }, - "@bytecodealliance/wizer-linux-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-S+oYRGGveuPLtiI6V7SQpZHhw43asLArC+fGrJRQ3OsHs8aj/IVusRLVYgWfKw1HtZm9iIWrjH9WYO6BWak4eQ==", - "optional": true - }, - "@bytecodealliance/wizer-win32-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-NxqrLqFnaMyldkN7lBVS+Em23f84/RKrHjBXt9WnZK2RtJjvwoCXr+so6+qfj4f1K9BhIZ8UaBfYwqPvtLOcZQ==", - "optional": true - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "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, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "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, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, - "minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } - } - }, - "@bytecodealliance/jco": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-0.7.0.tgz", - "integrity": "sha512-YPqmvNHfcmDUMz2TC7LEYramGiKhMLjbHaZ2kqEtOrAOSOiFmkDXAyJLHp7j8QzBbotOhZDrvdKrAGlxiQZigQ==", - "requires": { - "@bytecodealliance/preview2-shim": "0.0.8" - } - }, - "@bytecodealliance/preview2-shim": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.0.8.tgz", - "integrity": "sha512-yeY8wHpCBlRlHCU4YzvGn41z3UV9svDE7Z3OkEyU5TbzJiy1S9mMB3R43d2YE/f6rPLRZyE141TDDyPf6zdcWQ==" - }, - "@bytecodealliance/wizer": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer/-/wizer-1.6.1-beta.4.tgz", - "integrity": "sha512-afgV4lyYVMBN/9/yNDgYGTn92D7VrqS0yTZ3WZgDyDTiOWjmSuQimEiX+VzCiYjF9GXsKwzCY1FEOu1pY2Evgw==", - "requires": { - "@bytecodealliance/wizer-darwin-arm64": "1.6.1-beta.4", - "@bytecodealliance/wizer-darwin-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-linux-x64": "1.6.1-beta.4", - "@bytecodealliance/wizer-win32-x64": "1.6.1-beta.4" - } - }, - "@bytecodealliance/wizer-darwin-arm64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-arm64/-/wizer-darwin-arm64-1.6.1-beta.4.tgz", - "integrity": "sha512-NyleEH0GKBqS0DCuKceY3a2ZxF/aNzYa68swbKKljSFh6uo/3Cqr/U5/SuTxval6/VwtZ1eEzRPaLbLlUE5r4w==", - "optional": true - }, - "@bytecodealliance/wizer-darwin-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-darwin-x64/-/wizer-darwin-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-2s8HPLrttAyYUJNHQlLVi3rDGlnk9IzEJTbw0DApfpVnCZZ1aTLt6MXTIBeOYo9si5Q4cqyDHT5bAoNZvJTk9A==", - "optional": true - }, - "@bytecodealliance/wizer-linux-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-linux-x64/-/wizer-linux-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-S+oYRGGveuPLtiI6V7SQpZHhw43asLArC+fGrJRQ3OsHs8aj/IVusRLVYgWfKw1HtZm9iIWrjH9WYO6BWak4eQ==", - "optional": true - }, - "@bytecodealliance/wizer-win32-x64": { - "version": "1.6.1-beta.4", - "resolved": "https://registry.npmjs.org/@bytecodealliance/wizer-win32-x64/-/wizer-win32-x64-1.6.1-beta.4.tgz", - "integrity": "sha512-NxqrLqFnaMyldkN7lBVS+Em23f84/RKrHjBXt9WnZK2RtJjvwoCXr+so6+qfj4f1K9BhIZ8UaBfYwqPvtLOcZQ==", - "optional": true - }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, - "ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true - }, - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "anymatch": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", - "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "dev": true, - "requires": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - } - }, - "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "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, - "requires": { - "balanced-match": "^1.0.0" - } - }, - "braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "requires": { - "fill-range": "^7.0.1" - } - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } - } - }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } - }, - "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "requires": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, - "requires": { - "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true - }, - "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true - }, - "emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true - }, - "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true - }, - "fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "requires": { - "to-regex-range": "^5.0.1" - } - }, - "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "requires": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - } - }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "optional": true - }, - "get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true - }, - "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "dependencies": { - "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, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - } - } - }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true - }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - }, - "is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true - }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true - }, - "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "requires": { - "argparse": "^2.0.1" - } - }, - "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "requires": { - "p-locate": "^5.0.0" - } - }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - } - }, - "minimatch": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.0.1.tgz", - "integrity": "sha512-nLDxIFRyhDblz3qMuq+SoRZED4+miJ/G+tdDrjkkkRnjAsBexeGpgjLEQ0blJy7rHhR2b93rhQY4SvyWu9v03g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, - "mocha": { - "version": "10.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-10.2.0.tgz", - "integrity": "sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==", - "dev": true, - "requires": { - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.4", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "5.0.1", - "ms": "2.1.3", - "nanoid": "3.3.3", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "workerpool": "6.2.1", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "nanoid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.3.tgz", - "integrity": "sha512-p1sjXuopFs0xg+fPASzQ28agW1oHD7xDsd9Xkf3T15H3c/cifrFHVwrh74PdoklAPi+i7MdRsE47vm2r6JoB+w==", - "dev": true - }, - "normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - }, - "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "requires": { - "p-limit": "^3.0.2" - } - }, - "path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true - }, - "picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "requires": { - "picomatch": "^2.2.1" - } - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true - }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "requires": { - "randombytes": "^2.1.0" - } - }, - "string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "requires": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - } - }, - "strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "requires": { - "ansi-regex": "^5.0.1" - } - }, - "strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true - }, - "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - }, - "to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "requires": { - "is-number": "^7.0.0" - } - }, - "workerpool": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", - "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==", - "dev": true - }, - "wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "requires": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, - "y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true - }, - "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "requires": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - } - }, - "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true - }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - } } } diff --git a/package.json b/package.json index 464e101e..d44dd1c0 100644 --- a/package.json +++ b/package.json @@ -5,12 +5,12 @@ "type": "module", "exports": "./src/componentize.js", "devDependencies": { - "@bytecodealliance/preview2-shim": "0.0.8", + "@bytecodealliance/preview2-shim": "0.0.10", "mocha": "^10.2.0" }, "dependencies": { - "@bytecodealliance/jco": "^0.7.0", - "@bytecodealliance/wizer": "^1.6.1-beta.4" + "@bytecodealliance/jco": "^0.9.2", + "@bytecodealliance/wizer": "^3.0.1" }, "scripts": { "build": "cargo build --release --target wasm32-wasi && make -j", diff --git a/spidermonkey_embedding/spidermonkey_embedding.cpp b/spidermonkey_embedding/spidermonkey_embedding.cpp index c063c7b6..2df44f35 100644 --- a/spidermonkey_embedding/spidermonkey_embedding.cpp +++ b/spidermonkey_embedding/spidermonkey_embedding.cpp @@ -345,7 +345,7 @@ static JSObject *EmbeddingResolveHook(JSContext *cx, { if (R.import_wrappers.find(filename) == R.import_wrappers.end()) { - fprintf(stderr, "Import '%s' in '%s' is not defined as a world import. Only component-defined imports can be used.\n", filename.c_str(), R.source_name.c_str()); + fprintf(stderr, "Import '%s' in %s is not defined as a world import. Only component-defined imports can be used.\n", filename.c_str(), R.source_name.c_str()); R.init_err = Runtime::InitError::SourceLink; return nullptr; } diff --git a/src/componentize.js b/src/componentize.js index 35ba68c7..4f272a56 100644 --- a/src/componentize.js +++ b/src/componentize.js @@ -4,12 +4,10 @@ import { spawnSync } from "node:child_process"; import { tmpdir } from "node:os"; import { resolve, join } from "node:path"; import { readFile, unlink, writeFile } from "node:fs/promises"; -import { exports } from "../lib/spidermonkey-embedding-splicer.js"; +import { spliceBindings } from "../lib/spidermonkey-embedding-splicer.js"; import { fileURLToPath } from "node:url"; const { version } = JSON.parse(await readFile(new URL('../package.json', import.meta.url), 'utf8')); -const { spliceBindings } = exports; - export async function componentize( jsSource, witWorld, @@ -227,55 +225,58 @@ export async function componentize( case INIT_OK: break; case INIT_JSINIT: - err = `Error building JS: JS environment could not be initialized`; + err = `JS environment could not be initialized`; break; case INIT_INTRINSICS: - err = `Error building JS: JS intrinsics could not be defined`; + err = `JS intrinsics could not be defined`; break; case INIT_CUSTOM_INTRINSICS: - err = `Error building JS: Platform intrinsics could not be defined`; + err = `Platform intrinsics could not be defined`; break; case INIT_SOURCE_STDIN: - err = `Error building JS: Unable to populate source code into Wasm`; + err = `Unable to populate source code into Wasm`; break; case INIT_SOURCE_COMPILE: - err = `Error: Unable to compile JS source code`; + err = `Unable to compile JS source code`; break; case INIT_BINDINGS_COMPILE: - err = `Error: Unable to compile JS bindings code`; + err = `Unable to compile JS bindings code`; break; case INIT_IMPORT_WRAPPER_COMPILE: - err = `Error building JS: Unable to compile the dependency wrapper code`; + err = `Unable to compile the dependency wrapper code`; break; case INIT_SOURCE_LINK: - err = `Error building JS: Unable to link the source code`; + err = `Unable to link the source code. Imports should be:\n\n ${Object.entries(imports.reduce((impts, [specifier, impt]) => { + (impts[specifier] = impts[specifier] || []).push(impt.split('-').map((x, i) => i === 0 ? x : x[0].toUpperCase() + x.slice(1)).join('')); + return impts; + }, {})).map(([specifier, impts]) => `import { ${impts.join(', ')} } from "${specifier}";`).join('\n . ')}\n`; break; case INIT_SOURCE_EXEC: - err = `Error building JS: Unable to execute the JS source code`; + err = `Unable to execute the JS source code`; break; case INIT_BINDINGS_EXEC: - err = `Error building JS: Unable to execute the JS bindings code`; + err = `Unable to execute the JS bindings code`; break; case INIT_FN_LIST: - err = `Error building JS: Unable to extract expected exports list`; + err = `Unable to extract expected exports list`; break; case INIT_MEM_BUFFER: - err = `Error building JS: Unable to initialize JS binding memory buffer`; + err = `Unable to initialize JS binding memory buffer`; break; case INIT_REALLOC_FN: - err = `Error building JS: Unable to create JS binding realloc function`; + err = `Unable to create JS binding realloc function`; break; case INIT_MEM_BINDINGS: - err = `Error: Unable to initialize JS bindings.`; + err = `Unable to initialize JS bindings.`; break; case INIT_PROMISE_REJECTIONS: - err = `Error: Unable to initialize promise rejection handler`; + err = `Unable to initialize promise rejection handler`; break; case INIT_IMPORT_FN: - err = `Error: Unable to initialize imported bindings`; + err = `Unable to initialize imported bindings`; break; case INIT_TYPE_PARSE: - err = `Error: Unable to parse the core ABI export types`; + err = `Unable to parse the core ABI export types`; break; default: err = `Unknown error - ${status}`; diff --git a/test/cases/args/world.wit b/test/cases/args/world.wit index 66686530..20492c3b 100644 --- a/test/cases/args/world.wit +++ b/test/cases/args/world.wit @@ -1,4 +1,6 @@ -default world count { +package local:count + +world count { export exports: interface { count-a: func(str: string) -> u32 } diff --git a/test/cases/char/imports.js b/test/cases/char/chars.js similarity index 100% rename from test/cases/char/imports.js rename to test/cases/char/chars.js diff --git a/test/cases/char/source.d.ts b/test/cases/char/source.d.ts new file mode 100644 index 00000000..9091d0f6 --- /dev/null +++ b/test/cases/char/source.d.ts @@ -0,0 +1,8 @@ +declare module 'char' { + interface chars { + takeChar: (c: string) => void; + returnChar: () => string; + } + export const chars: chars; +} + diff --git a/test/cases/char/source.js b/test/cases/char/source.js index 219b4df5..37b3505b 100644 --- a/test/cases/char/source.js +++ b/test/cases/char/source.js @@ -1,6 +1,6 @@ -import { takeChar, returnChar } from 'imports'; +import { takeChar, returnChar } from 'local:char/chars'; -export const exports = { +export const chars = { takeChar (x) { takeChar(x); }, diff --git a/test/cases/char/test.js b/test/cases/char/test.js index d74d5c56..460dee6d 100644 --- a/test/cases/char/test.js +++ b/test/cases/char/test.js @@ -1,6 +1,6 @@ import { strictEqual } from 'node:assert'; export function test (instance) { - instance.exports.takeChar('p'); - strictEqual(instance.exports.returnChar(), 'p'); + instance.chars.takeChar('p'); + strictEqual(instance.chars.returnChar(), 'p'); } diff --git a/test/cases/char/world.wit b/test/cases/char/world.wit index 48a29cac..e8aab5b5 100644 --- a/test/cases/char/world.wit +++ b/test/cases/char/world.wit @@ -1,3 +1,5 @@ +package local:%char + interface chars { /// A function that returns a character return-char: func() -> char @@ -5,7 +7,7 @@ interface chars { take-char: func(x: char) } -default world the-world { - import imports: self.chars - export exports: self.chars +world the-world { + export chars + import chars } diff --git a/test/cases/conventions/imports.js b/test/cases/conventions/conventions.js similarity index 100% rename from test/cases/conventions/imports.js rename to test/cases/conventions/conventions.js diff --git a/test/cases/conventions/source.js b/test/cases/conventions/source.js index bd49bc2f..f318a9b3 100644 --- a/test/cases/conventions/source.js +++ b/test/cases/conventions/source.js @@ -1,7 +1,7 @@ -import { foo } from 'imports'; +import { foo } from 'local:conventions/conventions'; -export const exports = { +export const conventions = { foo (x) { foo(x); } -}; +}; \ No newline at end of file diff --git a/test/cases/conventions/test.js b/test/cases/conventions/test.js index 663894f8..aa8fb6a6 100644 --- a/test/cases/conventions/test.js +++ b/test/cases/conventions/test.js @@ -5,7 +5,7 @@ export function test (instance) { howFastAreYouGoing: 999, iAmGoingExtremelySlow: 999999n }; - strictEqual(instance.exports.foo(val), undefined); + strictEqual(instance.conventions.foo(val), undefined); // checks roundtripping deepStrictEqual(globalThis.x, val); } diff --git a/test/cases/conventions/world.wit b/test/cases/conventions/world.wit index 61e6671e..0aa0beb5 100644 --- a/test/cases/conventions/world.wit +++ b/test/cases/conventions/world.wit @@ -1,3 +1,5 @@ +package local:conventions + // hello 🐱 world interface conventions { @@ -32,7 +34,7 @@ interface conventions { // %bool: func() } -default world the-world { - import imports: self.conventions - export exports: self.conventions +world the-world { + import conventions + export conventions } diff --git a/test/cases/empty/world.wit b/test/cases/empty/world.wit index 1f99081f..eafcfebc 100644 --- a/test/cases/empty/world.wit +++ b/test/cases/empty/world.wit @@ -1 +1,3 @@ -default world empty {} +package local:empty + +world empty {} diff --git a/test/cases/flags/import-flags.js b/test/cases/flags/flags.js similarity index 100% rename from test/cases/flags/import-flags.js rename to test/cases/flags/flags.js diff --git a/test/cases/flags/source.js b/test/cases/flags/source.js index bc7691be..9c97b38f 100644 --- a/test/cases/flags/source.js +++ b/test/cases/flags/source.js @@ -6,9 +6,9 @@ import { roundtripFlag16, roundtripFlag32, roundtripFlag64 -} from 'import-flags'; +} from 'local:flags/flags'; -export const exportFlags = { +export const flags = { roundtripFlag1 (f) { return roundtripFlag1(f); }, diff --git a/test/cases/flags/test.js b/test/cases/flags/test.js index 6810695a..8e60af95 100644 --- a/test/cases/flags/test.js +++ b/test/cases/flags/test.js @@ -1,20 +1,20 @@ import { deepStrictEqual } from "node:assert"; export function test(instance) { - deepStrictEqual(instance.exportFlags.roundtripFlag1({ b0: false }), { + deepStrictEqual(instance.flags.roundtripFlag1({ b0: false }), { b0: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag2({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag2({ b0: true }), { b0: true, b1: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag4({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag4({ b0: true }), { b0: true, b1: false, b2: false, b3: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag8({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag8({ b0: true }), { b0: true, b1: false, b2: false, @@ -24,7 +24,7 @@ export function test(instance) { b6: false, b7: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag16({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag16({ b0: true }), { b0: true, b1: false, b2: false, @@ -42,7 +42,7 @@ export function test(instance) { b14: false, b15: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag32({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag32({ b0: true }), { b0: true, b1: false, b2: false, @@ -76,7 +76,7 @@ export function test(instance) { b30: false, b31: true, }); - deepStrictEqual(instance.exportFlags.roundtripFlag64({ b0: true }), { + deepStrictEqual(instance.flags.roundtripFlag64({ b0: true }), { b0: true, b1: false, b2: false, diff --git a/test/cases/flags/world.wit b/test/cases/flags/world.wit index b5a2fa2d..8feac920 100644 --- a/test/cases/flags/world.wit +++ b/test/cases/flags/world.wit @@ -1,4 +1,6 @@ -interface flegs { +package local:%flags + +interface %flags { flags flag1 { b0, } @@ -47,7 +49,7 @@ interface flegs { roundtrip-flag64: func(x: flag64) -> flag64 } -default world the-flags { - import import-flags: self.flegs - export export-flags: self.flegs +world the-flags { + import %flags + export %flags } diff --git a/test/cases/flavorful/source.js b/test/cases/flavorful/source.js index a550fee8..d5af8dd7 100644 --- a/test/cases/flavorful/source.js +++ b/test/cases/flavorful/source.js @@ -9,9 +9,9 @@ import { errnoResult, listTypedefs, listOfVariants, -} from "imports"; +} from "local:flavorful/test"; -export const exports = { +export const test = { fListInRecord1(a) { fListInRecord1(a); }, diff --git a/test/cases/flavorful/test.js b/test/cases/flavorful/test.js index cda11c5a..4f70e73d 100644 --- a/test/cases/flavorful/test.js +++ b/test/cases/flavorful/test.js @@ -1,25 +1,25 @@ import { strictEqual, deepStrictEqual, ok } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.fListInRecord1({ a: 'a' }), undefined); - deepStrictEqual(instance.exports.fListInRecord2(), { a: 'a' }); + strictEqual(instance.test.fListInRecord1({ a: 'a' }), undefined); + deepStrictEqual(instance.test.fListInRecord2(), { a: 'a' }); - deepStrictEqual(instance.exports.fListInRecord3({ a: 'b' }), { a: 'ba' }); - deepStrictEqual(instance.exports.fListInRecord4({ a: 'c' }), { a: 'ca' }); + deepStrictEqual(instance.test.fListInRecord3({ a: 'b' }), { a: 'ba' }); + deepStrictEqual(instance.test.fListInRecord4({ a: 'c' }), { a: 'ca' }); - strictEqual(instance.exports.fListInVariant1(null, { tag: 'ok' }, { tag: 0, val: 'test' }), undefined); - deepStrictEqual(JSON.parse(instance.exports.fListInVariant2()), [null, { tag: 'ok'}, { tag: 0, val: 'test' }]); + strictEqual(instance.test.fListInVariant1(null, { tag: 'ok' }, { tag: 0, val: 'test' }), undefined); + deepStrictEqual(JSON.parse(instance.test.fListInVariant2()), [null, { tag: 'ok'}, { tag: 0, val: 'test' }]); - strictEqual(instance.exports.fListInVariant3('test'), 'test'); + strictEqual(instance.test.fListInVariant3('test'), 'test'); try { - instance.exports.errnoResult(); + instance.test.errnoResult(); ok(false); } catch (e) { strictEqual(e.payload, 'b'); } - deepStrictEqual(instance.exports.listTypedefs('test', ['some', 'strings']), [new Uint8Array([1, 2, 3]), ['test', 'some', 'strings']]); - deepStrictEqual(instance.exports.listOfVariants([], [], []), [[false], [], []]); + deepStrictEqual(instance.test.listTypedefs('test', ['some', 'strings']), [new Uint8Array([1, 2, 3]), ['test', 'some', 'strings']]); + deepStrictEqual(instance.test.listOfVariants([], [], []), [[false], [], []]); } diff --git a/test/cases/flavorful/world.wit b/test/cases/flavorful/world.wit index ed2e86c4..62cadc82 100644 --- a/test/cases/flavorful/world.wit +++ b/test/cases/flavorful/world.wit @@ -1,3 +1,5 @@ +package local:flavorful + interface test { record list-in-record1 { a: string } record list-in-record2 { a: string } @@ -33,9 +35,9 @@ interface test { -> (a: list, b: list, c: list) } -default world flavorful { - import imports: self.test - export exports: self.test +world flavorful { + import test + export test export test-imports: func() } diff --git a/test/cases/floats/imports.js b/test/cases/floats/floats.js similarity index 100% rename from test/cases/floats/imports.js rename to test/cases/floats/floats.js diff --git a/test/cases/floats/source.js b/test/cases/floats/source.js index c8a950e2..0137cd50 100644 --- a/test/cases/floats/source.js +++ b/test/cases/floats/source.js @@ -1,6 +1,6 @@ -import { float32Param, float64Param, float32Result, float64Result } from 'imports'; +import { float32Param, float64Param, float32Result, float64Result } from 'local:floats/floats'; -export const exports = { +export const floats = { float32Param (x) { return float32Param(x); }, diff --git a/test/cases/floats/test.js b/test/cases/floats/test.js index a9b0691c..cf5bb855 100644 --- a/test/cases/floats/test.js +++ b/test/cases/floats/test.js @@ -1,8 +1,8 @@ import { strictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.float32Param(1.5), undefined); - strictEqual(instance.exports.float64Param(1.51111111111111), undefined); - strictEqual(instance.exports.float32Result(), 1.5); - strictEqual(instance.exports.float64Result(), 1.51111111111111); + strictEqual(instance.floats.float32Param(1.5), undefined); + strictEqual(instance.floats.float64Param(1.51111111111111), undefined); + strictEqual(instance.floats.float32Result(), 1.5); + strictEqual(instance.floats.float64Result(), 1.51111111111111); } diff --git a/test/cases/floats/world.wit b/test/cases/floats/world.wit index 4a0c67ce..e0e8df42 100644 --- a/test/cases/floats/world.wit +++ b/test/cases/floats/world.wit @@ -1,3 +1,5 @@ +package local:floats + interface floats { float32-param: func(x: float32) float64-param: func(x: float64) @@ -5,7 +7,7 @@ interface floats { float64-result: func() -> float64 } -default world the-world { - import imports: self.floats - export exports: self.floats +world the-world { + import floats + export floats } diff --git a/test/cases/hello/world.wit b/test/cases/hello/world.wit index 6c3062e6..0b2b438a 100644 --- a/test/cases/hello/world.wit +++ b/test/cases/hello/world.wit @@ -1,4 +1,6 @@ -default world hello { +package local:hello + +world hello { import get-num: interface { get-num: func(text: string) -> string } diff --git a/test/cases/import-func/world.wit b/test/cases/import-func/world.wit index a49a9267..91dae2ba 100644 --- a/test/cases/import-func/world.wit +++ b/test/cases/import-func/world.wit @@ -1,4 +1,6 @@ -default world foo { +package local:import-func + +world foo { import foo: func() import foo1: func() -> string import foo2: func(x: string) diff --git a/test/cases/integers/imports.js b/test/cases/integers/integers.js similarity index 100% rename from test/cases/integers/imports.js rename to test/cases/integers/integers.js diff --git a/test/cases/integers/source.js b/test/cases/integers/source.js index f007515d..7d083649 100644 --- a/test/cases/integers/source.js +++ b/test/cases/integers/source.js @@ -1,6 +1,6 @@ -import { a1, a2, a3, a4, a5, a6, a7, a8, a9, r1, r2, r3, r4, r5, r6, r7, r8, pairRet } from 'imports'; +import { a1, a2, a3, a4, a5, a6, a7, a8, a9, r1, r2, r3, r4, r5, r6, r7, r8, pairRet } from 'local:integers/integers'; -export const exports = { +export const integers = { a1 (x) { a1(x) }, diff --git a/test/cases/integers/test.js b/test/cases/integers/test.js index b9b1322f..0326d878 100644 --- a/test/cases/integers/test.js +++ b/test/cases/integers/test.js @@ -1,30 +1,30 @@ import { strictEqual, deepStrictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.a1(5), undefined); - strictEqual(instance.exports.r1(), 5); + strictEqual(instance.integers.a1(5), undefined); + strictEqual(instance.integers.r1(), 5); - strictEqual(instance.exports.a2(-5), undefined); - strictEqual(instance.exports.r2(), -5); + strictEqual(instance.integers.a2(-5), undefined); + strictEqual(instance.integers.r2(), -5); - strictEqual(instance.exports.a3(100), undefined); - strictEqual(instance.exports.r3(), 100); + strictEqual(instance.integers.a3(100), undefined); + strictEqual(instance.integers.r3(), 100); - strictEqual(instance.exports.a4(-100), undefined); - strictEqual(instance.exports.r4(), -100); + strictEqual(instance.integers.a4(-100), undefined); + strictEqual(instance.integers.r4(), -100); - strictEqual(instance.exports.a5(5000), undefined); - strictEqual(instance.exports.r5(), 5000); + strictEqual(instance.integers.a5(5000), undefined); + strictEqual(instance.integers.r5(), 5000); - strictEqual(instance.exports.a6(-5000), undefined); - strictEqual(instance.exports.r6(), -5000); + strictEqual(instance.integers.a6(-5000), undefined); + strictEqual(instance.integers.r6(), -5000); - strictEqual(instance.exports.a7(500000n), undefined); - strictEqual(instance.exports.r7(), 500000n); + strictEqual(instance.integers.a7(500000n), undefined); + strictEqual(instance.integers.r7(), 500000n); // TODO: negative bigints - // strictEqual(instance.exports.a8(-500000n), undefined); - // strictEqual(instance.exports.r8(), -500000n); + // strictEqual(instance.integers.a8(-500000n), undefined); + // strictEqual(instance.integers.r8(), -500000n); - // deepStrictEqual(instance.exports.pairRet(), [-999, 1]); + // deepStrictEqual(instance.integers.pairRet(), [-999, 1]); } diff --git a/test/cases/integers/world.wit b/test/cases/integers/world.wit index bfad2728..91840263 100644 --- a/test/cases/integers/world.wit +++ b/test/cases/integers/world.wit @@ -1,3 +1,5 @@ +package local:integers + interface integers { a1: func(x: u8) a2: func(x: s8) @@ -32,7 +34,7 @@ interface integers { pair-ret: func() -> tuple } -default world the-world { - import imports: self.integers - export exports: self.integers +world the-world { + import integers + export integers } diff --git a/test/cases/keywords/imports.js b/test/cases/keywords/keywords.js similarity index 100% rename from test/cases/keywords/imports.js rename to test/cases/keywords/keywords.js diff --git a/test/cases/keywords/source.js b/test/cases/keywords/source.js index f4520fc4..9043ff21 100644 --- a/test/cases/keywords/source.js +++ b/test/cases/keywords/source.js @@ -1,6 +1,6 @@ -import { 'type' as x } from 'imports'; +import { 'type' as x } from 'local:keywords/keywords'; -export const exports = { +export const keywords = { 'type' (t) { return x(t); } diff --git a/test/cases/keywords/test.js b/test/cases/keywords/test.js index 71ae7559..a274cfc3 100644 --- a/test/cases/keywords/test.js +++ b/test/cases/keywords/test.js @@ -1,5 +1,5 @@ import { deepStrictEqual } from 'node:assert'; export function test (instance) { - deepStrictEqual(instance.exports['type'](5), [6, 5]); + deepStrictEqual(instance.keywords['type'](5), [6, 5]); } diff --git a/test/cases/keywords/world.wit b/test/cases/keywords/world.wit index eda6c550..1184188c 100644 --- a/test/cases/keywords/world.wit +++ b/test/cases/keywords/world.wit @@ -1,8 +1,10 @@ +package local:keywords + interface keywords { %type: func(%type: u32) -> (%type: u32, %flags: s32) } -default world the-world { - import imports: self.keywords - export exports: self.keywords +world the-world { + import keywords + export keywords } diff --git a/test/cases/lists/import-lists.js b/test/cases/lists/lists.js similarity index 100% rename from test/cases/lists/import-lists.js rename to test/cases/lists/lists.js diff --git a/test/cases/lists/source.js b/test/cases/lists/source.js index 19cbd1ab..47aa911b 100644 --- a/test/cases/lists/source.js +++ b/test/cases/lists/source.js @@ -1,6 +1,6 @@ -import * as m from 'import-lists'; +import * as m from 'local:lists/lists'; -export const exportLists = { +export const lists = { listU8Param (x) { // console.log('list'); // console.log(x); diff --git a/test/cases/lists/test.js b/test/cases/lists/test.js index e8278240..e4e5aa7c 100644 --- a/test/cases/lists/test.js +++ b/test/cases/lists/test.js @@ -1,5 +1,5 @@ import { strictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exportLists.listU8Param(new Uint8Array([1,2,3])), undefined); + strictEqual(instance.lists.listU8Param(new Uint8Array([1,2,3])), undefined); } diff --git a/test/cases/lists/world.wit b/test/cases/lists/world.wit index 19b94606..fe5c1eae 100644 --- a/test/cases/lists/world.wit +++ b/test/cases/lists/world.wit @@ -1,3 +1,5 @@ +package local:lists + interface lists { list-u8-param: func(x: list) list-u16-param: func(x: list) @@ -77,7 +79,7 @@ interface lists { load-store-everything: func(a: load-store-all-sizes) -> load-store-all-sizes } -default world the-lists { - import import-lists: self.lists - export export-lists: self.lists +world the-lists { + import lists + export lists } diff --git a/test/cases/many-arguments/imports.js b/test/cases/many-arguments/manyarg.js similarity index 100% rename from test/cases/many-arguments/imports.js rename to test/cases/many-arguments/manyarg.js diff --git a/test/cases/many-arguments/source.js b/test/cases/many-arguments/source.js index c8479de6..d23587df 100644 --- a/test/cases/many-arguments/source.js +++ b/test/cases/many-arguments/source.js @@ -1,6 +1,6 @@ -import { manyArgs, bigArgument } from 'imports'; +import { manyArgs, bigArgument } from 'local:many-arguments/manyarg'; -export const exports = { +export const manyarg = { manyArgs (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16) { return manyArgs(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16); }, diff --git a/test/cases/many-arguments/test.js b/test/cases/many-arguments/test.js index c82012d6..790da4f8 100644 --- a/test/cases/many-arguments/test.js +++ b/test/cases/many-arguments/test.js @@ -19,7 +19,7 @@ export function test(instance) { 15n, 16n, ]; - strictEqual(instance.exports.manyArgs(...args), undefined); + strictEqual(instance.manyarg.manyArgs(...args), undefined); deepStrictEqual(globalThis.args, args); const struct = { a1: '1n', @@ -43,6 +43,6 @@ export function test(instance) { a19: '19n', a20: '20n', }; - strictEqual(instance.exports.bigArgument(struct), undefined); + strictEqual(instance.manyarg.bigArgument(struct), undefined); deepStrictEqual(globalThis.struct, struct); } diff --git a/test/cases/many-arguments/world.wit b/test/cases/many-arguments/world.wit index a5b67b21..95668a6a 100644 --- a/test/cases/many-arguments/world.wit +++ b/test/cases/many-arguments/world.wit @@ -1,3 +1,5 @@ +package local:many-arguments + interface manyarg { many-args: func( a1: u64, @@ -44,7 +46,7 @@ interface manyarg { big-argument: func(x: big-struct) } -default world the-world { - import imports: self.manyarg - export exports: self.manyarg +world the-world { + import manyarg + export manyarg } diff --git a/test/cases/multi-return/imports.js b/test/cases/multi-return/multi-return.js similarity index 100% rename from test/cases/multi-return/imports.js rename to test/cases/multi-return/multi-return.js diff --git a/test/cases/multi-return/source.js b/test/cases/multi-return/source.js index de89f274..0b80a465 100644 --- a/test/cases/multi-return/source.js +++ b/test/cases/multi-return/source.js @@ -1,6 +1,6 @@ -import { mra, mrb, mrc, mrd, mre } from 'imports'; +import { mra, mrb, mrc, mrd, mre } from 'local:multi-return/multi-return'; -export const exports = { +export const multiReturn = { mra () { return mra(); }, diff --git a/test/cases/multi-return/test.js b/test/cases/multi-return/test.js index 981e97c1..cba5e1d5 100644 --- a/test/cases/multi-return/test.js +++ b/test/cases/multi-return/test.js @@ -1,9 +1,9 @@ import { strictEqual, deepStrictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.mra(), undefined); - deepStrictEqual(instance.exports.mrb(), undefined); - strictEqual(instance.exports.mrc(), 23); - deepStrictEqual(instance.exports.mrd(), 44); - deepStrictEqual(instance.exports.mre(), [1, 1.5]); + strictEqual(instance.multiReturn.mra(), undefined); + deepStrictEqual(instance.multiReturn.mrb(), undefined); + strictEqual(instance.multiReturn.mrc(), 23); + deepStrictEqual(instance.multiReturn.mrd(), 44); + deepStrictEqual(instance.multiReturn.mre(), [1, 1.5]); } diff --git a/test/cases/multi-return/world.wit b/test/cases/multi-return/world.wit index 716e77a6..2f4ee8e9 100644 --- a/test/cases/multi-return/world.wit +++ b/test/cases/multi-return/world.wit @@ -1,3 +1,5 @@ +package local:multi-return + interface multi-return { mra: func() mrb: func() -> () @@ -6,7 +8,7 @@ interface multi-return { mre: func() -> (a: u32, b: float32) } -default world the-world { - import imports: self.multi-return - export exports: self.multi-return +world the-world { + import multi-return + export multi-return } diff --git a/test/cases/records/imports.js b/test/cases/records/records.js similarity index 100% rename from test/cases/records/imports.js rename to test/cases/records/records.js diff --git a/test/cases/records/source.js b/test/cases/records/source.js index d9401a01..3087c261 100644 --- a/test/cases/records/source.js +++ b/test/cases/records/source.js @@ -10,9 +10,9 @@ import { aggregateArg, aggregateResult, typedefInout, -} from "imports"; +} from "local:records/records"; -export const exports = { +export const records = { tupleArg(x) { tupleArg(x); }, diff --git a/test/cases/records/test.js b/test/cases/records/test.js index 3b189fa7..882ec406 100644 --- a/test/cases/records/test.js +++ b/test/cases/records/test.js @@ -1,66 +1,6 @@ import { deepStrictEqual, strictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.tupleArg(['z', 23]), undefined); - deepStrictEqual(instance.exports.tupleResult(), ['z', 23]); + strictEqual(instance.records.tupleArg(['z', 23]), undefined); + deepStrictEqual(instance.records.tupleResult(), ['z', 23]); } - -// interface records { -// tuple-arg: func(x: tuple) -// tuple-result: func() -> tuple - -// record empty {} - -// empty-arg: func(x: empty) -// empty-result: func() -> empty - -// /// A record containing two scalar fields -// /// that both have the same type -// record scalars { -// /// The first field, named a -// a: u32, -// /// The second field, named b -// b: u32, -// } - -// scalar-arg: func(x: scalars) -// scalar-result: func() -> scalars - -// /// A record that is really just flags -// /// All of the fields are bool -// record really-flags { -// a: bool, -// b: bool, -// c: bool, -// d: bool, -// e: bool, -// f: bool, -// g: bool, -// h: bool, -// i: bool, -// } - -// flags-arg: func(x: really-flags) -// flags-result: func() -> really-flags - -// record aggregates { -// a: scalars, -// b: u32, -// c: empty, -// d: string, -// e: really-flags, -// } - -// aggregate-arg: func(x: aggregates) -// aggregate-result: func() -> aggregates - -// type tuple-typedef = tuple -// type int-typedef = s32 -// type tuple-typedef2 = tuple -// typedef-inout: func(e: tuple-typedef2) -> s32 -// } - -// default world the-world { -// import imports: self.records -// export exports: self.records -// } diff --git a/test/cases/records/world.wit b/test/cases/records/world.wit index 39d5e816..3d4588ff 100644 --- a/test/cases/records/world.wit +++ b/test/cases/records/world.wit @@ -1,3 +1,5 @@ +package local:records + interface records { tuple-arg: func(x: tuple) tuple-result: func() -> tuple @@ -53,7 +55,7 @@ interface records { typedef-inout: func(e: tuple-typedef2) -> s32 } -default world the-world { - import imports: self.records - export exports: self.records +world the-world { + import records + export records } diff --git a/test/cases/rename-interface/other-name.js b/test/cases/rename-interface/other-name.js new file mode 100644 index 00000000..0d1c41b1 --- /dev/null +++ b/test/cases/rename-interface/other-name.js @@ -0,0 +1,3 @@ +export function a () { + +} \ No newline at end of file diff --git a/test/cases/rename-interface/source.js b/test/cases/rename-interface/source.js index 06871a7f..4b4279b6 100644 --- a/test/cases/rename-interface/source.js +++ b/test/cases/rename-interface/source.js @@ -1,3 +1,2 @@ import { a } from 'other-name'; - diff --git a/test/cases/rename-interface/world.wit b/test/cases/rename-interface/world.wit index af8b3c1c..3bfd5493 100644 --- a/test/cases/rename-interface/world.wit +++ b/test/cases/rename-interface/world.wit @@ -1,11 +1,13 @@ +package local:rename-interface + interface foo { record bar {} } -default world the-world { - import different-name: self.foo +world the-world { + import foo import other-name: interface { - use self.foo.{bar} + use foo.{bar} a: func() -> bar } diff --git a/test/cases/simple-functions/imports.js b/test/cases/simple-functions/simple.js similarity index 100% rename from test/cases/simple-functions/imports.js rename to test/cases/simple-functions/simple.js diff --git a/test/cases/simple-functions/source.js b/test/cases/simple-functions/source.js index af5dc2e2..506f07a1 100644 --- a/test/cases/simple-functions/source.js +++ b/test/cases/simple-functions/source.js @@ -1,6 +1,6 @@ -import { f1, f2, f3, f4, f5, f6 } from 'imports'; +import { f1, f2, f3, f4, f5, f6 } from 'local:simple-functions/simple'; -export const exports = { +export const simple = { f1 () { f1(); }, diff --git a/test/cases/simple-functions/test.js b/test/cases/simple-functions/test.js index 190ca697..098da592 100644 --- a/test/cases/simple-functions/test.js +++ b/test/cases/simple-functions/test.js @@ -1,10 +1,10 @@ import { strictEqual, deepStrictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.f1(), undefined); - strictEqual(instance.exports.f2(1), undefined); - strictEqual(instance.exports.f3(2, 3), undefined); - strictEqual(instance.exports.f4(), 11); - deepStrictEqual(instance.exports.f5(), [11, 13]); - deepStrictEqual(instance.exports.f6(1, 2, 3), [12, 13, 14]); + strictEqual(instance.simple.f1(), undefined); + strictEqual(instance.simple.f2(1), undefined); + strictEqual(instance.simple.f3(2, 3), undefined); + strictEqual(instance.simple.f4(), 11); + deepStrictEqual(instance.simple.f5(), [11, 13]); + deepStrictEqual(instance.simple.f6(1, 2, 3), [12, 13, 14]); } diff --git a/test/cases/simple-functions/world.wit b/test/cases/simple-functions/world.wit index cdb11837..c1d2b331 100644 --- a/test/cases/simple-functions/world.wit +++ b/test/cases/simple-functions/world.wit @@ -1,3 +1,5 @@ +package local:simple-functions + interface simple { f1: func() f2: func(a: u32) @@ -9,7 +11,7 @@ interface simple { f6: func(a: u32, b: u32, c: u32) -> tuple } -default world the-world { - import imports: self.simple - export exports: self.simple +world the-world { + import simple + export simple } diff --git a/test/cases/simple-lists/imports.js b/test/cases/simple-lists/simple-lists.js similarity index 100% rename from test/cases/simple-lists/imports.js rename to test/cases/simple-lists/simple-lists.js diff --git a/test/cases/simple-lists/source.js b/test/cases/simple-lists/source.js index 0be36581..e6c4cd61 100644 --- a/test/cases/simple-lists/source.js +++ b/test/cases/simple-lists/source.js @@ -1,6 +1,6 @@ -import { simpleList1, simpleList2, simpleList4 } from 'imports'; +import { simpleList1, simpleList2, simpleList4 } from 'local:simple-lists/simple-lists'; -export const exports = { +export const simpleLists = { simpleList1 (list) { simpleList1(list); }, diff --git a/test/cases/simple-lists/test.js b/test/cases/simple-lists/test.js index 785a7382..4c846a32 100644 --- a/test/cases/simple-lists/test.js +++ b/test/cases/simple-lists/test.js @@ -2,12 +2,12 @@ import { strictEqual, deepStrictEqual } from "node:assert"; export function test(instance) { strictEqual( - instance.exports.simpleList1(new Uint32Array([1, 2, 3])), + instance.simpleLists.simpleList1(new Uint32Array([1, 2, 3])), undefined ); - deepStrictEqual(instance.exports.simpleList2(), new Uint32Array([1, 2, 3])); + deepStrictEqual(instance.simpleLists.simpleList2(), new Uint32Array([1, 2, 3])); deepStrictEqual( - instance.exports.simpleList4([ + instance.simpleLists.simpleList4([ new Uint32Array([1, 2, 3]), new Uint32Array([2, 3, 4]), ]), diff --git a/test/cases/simple-lists/world.wit b/test/cases/simple-lists/world.wit index c664c0c8..d2e65568 100644 --- a/test/cases/simple-lists/world.wit +++ b/test/cases/simple-lists/world.wit @@ -1,3 +1,5 @@ +package local:simple-lists + interface simple-lists { simple-list1: func(l: list) simple-list2: func() -> list @@ -6,7 +8,7 @@ interface simple-lists { simple-list4: func(l: list>) -> list> } -default world my-world { - import imports: self.simple-lists - export exports: self.simple-lists +world my-world { + import simple-lists + export simple-lists } diff --git a/test/cases/small-anonymous/imports.js b/test/cases/small-anonymous/anon.js similarity index 100% rename from test/cases/small-anonymous/imports.js rename to test/cases/small-anonymous/anon.js diff --git a/test/cases/small-anonymous/source.js b/test/cases/small-anonymous/source.js index e8ddd6da..0e7c1896 100644 --- a/test/cases/small-anonymous/source.js +++ b/test/cases/small-anonymous/source.js @@ -1,8 +1,8 @@ -import { optionTest } from 'imports'; +import { optionTest } from 'local:small-anonymous/anon'; let run = 0; -export const exports = { +export const anon = { optionTest () { switch (++run) { case 1: throw 'failure'; diff --git a/test/cases/small-anonymous/test.js b/test/cases/small-anonymous/test.js index 4a7278ec..35aca921 100644 --- a/test/cases/small-anonymous/test.js +++ b/test/cases/small-anonymous/test.js @@ -2,17 +2,17 @@ import { strictEqual, ok } from 'node:assert'; export function test (instance) { try { - instance.exports.optionTest(); + instance.anon.optionTest(); ok(false); } catch (e) { strictEqual(e.payload, 'failure'); } try { - instance.exports.optionTest(); + instance.anon.optionTest(); ok(false); } catch (e) { strictEqual(e.payload, 'success'); } - strictEqual(instance.exports.optionTest(), 'outer'); - strictEqual(instance.exports.optionTest(), 'yay'); + strictEqual(instance.anon.optionTest(), 'outer'); + strictEqual(instance.anon.optionTest(), 'yay'); } diff --git a/test/cases/small-anonymous/world.wit b/test/cases/small-anonymous/world.wit index 96436091..8fee5d27 100644 --- a/test/cases/small-anonymous/world.wit +++ b/test/cases/small-anonymous/world.wit @@ -1,3 +1,5 @@ +package local:small-anonymous + interface anon { enum error { success, @@ -7,7 +9,7 @@ interface anon { option-test: func() -> result, error> } -default world the-world { - import imports: self.anon - export exports: self.anon +world the-world { + import anon + export anon } diff --git a/test/cases/smoke-default/world.wit b/test/cases/smoke-default/world.wit index 0d269359..7194bf0f 100644 --- a/test/cases/smoke-default/world.wit +++ b/test/cases/smoke-default/world.wit @@ -1,3 +1,5 @@ -default world the-world { +package local:smoke-default + +world the-world { export y: func() } diff --git a/test/cases/smoke-export/world.wit b/test/cases/smoke-export/world.wit index cefdc198..d419d4a6 100644 --- a/test/cases/smoke-export/world.wit +++ b/test/cases/smoke-export/world.wit @@ -1,4 +1,6 @@ -default world the-world { +package local:smoke-export + +world the-world { export the-name: interface { y: func() } diff --git a/test/cases/smoke/world.wit b/test/cases/smoke/world.wit index 6d8e80cc..bf10e45a 100644 --- a/test/cases/smoke/world.wit +++ b/test/cases/smoke/world.wit @@ -1,4 +1,6 @@ -default world the-world { +package local:smoke + +world the-world { import imports: interface { y: func() } diff --git a/test/cases/strings/source.js b/test/cases/strings/source.js index 5b1f5a40..1d6aa8d8 100644 --- a/test/cases/strings/source.js +++ b/test/cases/strings/source.js @@ -1,6 +1,6 @@ -import { a, b, c } from 'imports'; +import { a, b, c } from 'local:strings/strings'; -export const exports = { +export const strings = { a (x) { return a(x); }, diff --git a/test/cases/strings/imports.js b/test/cases/strings/strings.js similarity index 100% rename from test/cases/strings/imports.js rename to test/cases/strings/strings.js diff --git a/test/cases/strings/test.js b/test/cases/strings/test.js index 2d0b5434..0f97780f 100644 --- a/test/cases/strings/test.js +++ b/test/cases/strings/test.js @@ -1,15 +1,15 @@ import { strictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.a('test'), undefined); - strictEqual(instance.exports.b(), 'test'); - strictEqual(instance.exports.c('😀', '😀'), '😀😀'); + strictEqual(instance.strings.a('test'), undefined); + strictEqual(instance.strings.b(), 'test'); + strictEqual(instance.strings.c('😀', '😀'), '😀😀'); let longString = ''; const len = Math.floor(Math.random() * 10000); for (let i = 0; i < len; i++) { longString += 'long string\n'; } - strictEqual(instance.exports.a(longString), undefined); - strictEqual(instance.exports.b(), longString); + strictEqual(instance.strings.a(longString), undefined); + strictEqual(instance.strings.b(), longString); } diff --git a/test/cases/strings/world.wit b/test/cases/strings/world.wit index 7fc18855..e8c582bb 100644 --- a/test/cases/strings/world.wit +++ b/test/cases/strings/world.wit @@ -1,10 +1,12 @@ +package local:strings + interface strings { a: func(x: string) b: func() -> string c: func(a: string, b: string) -> string } -default world the-world { - import imports: self.strings - export exports: self.strings +world the-world { + import strings + export strings } diff --git a/test/cases/unions/source.js b/test/cases/unions/source.js index 1340fbd3..24232006 100644 --- a/test/cases/unions/source.js +++ b/test/cases/unions/source.js @@ -9,9 +9,9 @@ import { identifyDuplicated, addOneDistinguishableNum, identifyDistinguishableNum, -} from "import-unions"; +} from "local:unions/unions"; -export const exportUnions = { +export const unions = { addOneInteger(num) { return addOneInteger(num); }, diff --git a/test/cases/unions/test.js b/test/cases/unions/test.js index ab65a19a..d0ddf27d 100644 --- a/test/cases/unions/test.js +++ b/test/cases/unions/test.js @@ -1,7 +1,7 @@ -import { strictEqual, deepStrictEqual } from 'node:assert'; +import { deepStrictEqual } from 'node:assert'; export function test (instance) { - deepStrictEqual(instance.exportUnions.addOneInteger({ tag: 1, val: 23 }), { tag: 1, val: 24 }); - deepStrictEqual(instance.exportUnions.addOneFloat({ tag: 1, val: 23 }), { tag: 1, val: 24.5 }); - deepStrictEqual(instance.exportUnions.replaceFirstChar({ tag: 1, val: 'test' }, 'z'), { tag: 1, val: 'zest' }); + deepStrictEqual(instance.unions.addOneInteger({ tag: 1, val: 23 }), { tag: 1, val: 24 }); + deepStrictEqual(instance.unions.addOneFloat({ tag: 1, val: 23 }), { tag: 1, val: 24.5 }); + deepStrictEqual(instance.unions.replaceFirstChar({ tag: 1, val: 'test' }, 'z'), { tag: 1, val: 'zest' }); } diff --git a/test/cases/unions/import-unions.js b/test/cases/unions/unions.js similarity index 100% rename from test/cases/unions/import-unions.js rename to test/cases/unions/unions.js diff --git a/test/cases/unions/world.wit b/test/cases/unions/world.wit index 07e0f380..361eed3e 100644 --- a/test/cases/unions/world.wit +++ b/test/cases/unions/world.wit @@ -1,3 +1,5 @@ +package local:unions + interface unions { /// A union of all of the integral types union all-integers { @@ -58,7 +60,7 @@ interface unions { identify-distinguishable-num: func(num: distinguishable-num) -> u8 } -default world the-unions { - import import-unions: self.unions - export export-unions: self.unions +world the-unions { + import unions + export unions } diff --git a/test/cases/use-across-interfaces/bar.js b/test/cases/use-across-interfaces/bar.js new file mode 100644 index 00000000..e3f1129b --- /dev/null +++ b/test/cases/use-across-interfaces/bar.js @@ -0,0 +1,3 @@ +export function x () { + +} diff --git a/test/cases/use-across-interfaces/baz.js b/test/cases/use-across-interfaces/baz.js new file mode 100644 index 00000000..e3f1129b --- /dev/null +++ b/test/cases/use-across-interfaces/baz.js @@ -0,0 +1,3 @@ +export function x () { + +} diff --git a/test/cases/use-across-interfaces/foo.js b/test/cases/use-across-interfaces/foo.js new file mode 100644 index 00000000..e3f1129b --- /dev/null +++ b/test/cases/use-across-interfaces/foo.js @@ -0,0 +1,3 @@ +export function x () { + +} diff --git a/test/cases/use-across-interfaces/source.js b/test/cases/use-across-interfaces/source.js index e319bd54..3e38d428 100644 --- a/test/cases/use-across-interfaces/source.js +++ b/test/cases/use-across-interfaces/source.js @@ -1,3 +1,3 @@ -import { x as fooX } from 'foo'; -import { x as barX } from 'bar'; +import { x as fooX } from 'local:use-across-interfaces/foo'; +import { x as barX } from 'local:use-across-interfaces/bar'; import { x as bazX } from 'baz'; diff --git a/test/cases/use-across-interfaces/world.wit b/test/cases/use-across-interfaces/world.wit index 82150950..fce8f180 100644 --- a/test/cases/use-across-interfaces/world.wit +++ b/test/cases/use-across-interfaces/world.wit @@ -1,18 +1,20 @@ +package local:use-across-interfaces + interface foo { record a {} x: func() -> a } interface bar { - use self.foo.{a} + use foo.{a} x: func() -> a } -default world baz { - import foo: self.foo - import bar: self.bar +world baz { + import foo + import bar import baz: interface { - use self.foo.{a} + use foo.{a} x: func() -> a } } diff --git a/test/cases/variants/source.js b/test/cases/variants/source.js index e6b2b3cd..fe9b3f74 100644 --- a/test/cases/variants/source.js +++ b/test/cases/variants/source.js @@ -23,9 +23,9 @@ import { isCloneReturn, returnNamedOption, returnNamedResult, -} from "imports"; +} from "local:variants/variants"; -export const exports = { +export const variants = { e1Arg(x) { e1Arg(x); }, diff --git a/test/cases/variants/test.js b/test/cases/variants/test.js index f368c329..c3b00101 100644 --- a/test/cases/variants/test.js +++ b/test/cases/variants/test.js @@ -1,9 +1,9 @@ import { strictEqual, deepStrictEqual } from 'node:assert'; export function test (instance) { - strictEqual(instance.exports.e1Arg('a'), undefined); - deepStrictEqual(instance.exports.e1Result(), 'a'); + strictEqual(instance.variants.e1Arg('a'), undefined); + deepStrictEqual(instance.variants.e1Result(), 'a'); - strictEqual(instance.exports.u1Arg({ tag: 0, val: 23 }), undefined); - deepStrictEqual(instance.exports.u1Result(), { tag: 0, val: 23 }); + strictEqual(instance.variants.u1Arg({ tag: 0, val: 23 }), undefined); + deepStrictEqual(instance.variants.u1Result(), { tag: 0, val: 23 }); } diff --git a/test/cases/variants/imports.js b/test/cases/variants/variants.js similarity index 100% rename from test/cases/variants/imports.js rename to test/cases/variants/variants.js diff --git a/test/cases/variants/world.wit b/test/cases/variants/world.wit index 590675dc..9266cbb8 100644 --- a/test/cases/variants/world.wit +++ b/test/cases/variants/world.wit @@ -1,3 +1,5 @@ +package local:variants + interface variants { enum e1 { a, @@ -139,7 +141,7 @@ interface variants { return-named-result: func() -> (a: result) } -default world my-world { - import imports: self.variants - export exports: self.variants +world my-world { + import variants + export variants } diff --git a/test/cases/wall-clock/source.js b/test/cases/wall-clock/source.js index 69a5776f..c442f19f 100644 --- a/test/cases/wall-clock/source.js +++ b/test/cases/wall-clock/source.js @@ -1,4 +1,4 @@ -import { now } from 'wall-clock-t'; +import { now } from 'local:wall-clock/wall-clock-t'; export function test () { return `NOW: ${now().seconds}`; diff --git a/test/cases/wall-clock/world.wit b/test/cases/wall-clock/world.wit index 73dde8eb..3e040ca7 100644 --- a/test/cases/wall-clock/world.wit +++ b/test/cases/wall-clock/world.wit @@ -1,3 +1,5 @@ +package local:wall-clock + interface random-t { get-random-bytes: func(len: u64) -> list get-random-u64: func() -> u64 @@ -13,9 +15,9 @@ interface wall-clock-t { now: func() -> datetime } -default world wall-clock-world { - import wall-clock-t: self.wall-clock-t - import random-t: self.random-t +world wall-clock-world { + import wall-clock-t + import random-t export test: func() -> string } diff --git a/test/test.js b/test/test.js index 012a3c3b..b3288ff8 100644 --- a/test/test.js +++ b/test/test.js @@ -1,5 +1,5 @@ import { componentize } from '@bytecodealliance/componentize-js'; -import { transpile, componentEmbed } from '@bytecodealliance/jco'; +import { transpile } from '@bytecodealliance/jco'; import { readFile, readdir, mkdir, writeFile } from 'node:fs/promises'; import { spawn } from 'node:child_process'; import { fileURLToPath } from 'node:url'; @@ -16,7 +16,8 @@ suite('Builtins', () => { const { source, test: runTest } = await import(`./builtins/${filename}`); const { component } = await componentize(source, ` - default world runworld { + package local:runworld + world runworld { export run: func() -> () } `, { @@ -62,10 +63,10 @@ suite('Builtins', () => { const bindingsCases = await readdir(new URL('./cases', import.meta.url)); suite('Bindings', () => { for (const name of bindingsCases) { - if (name === 'use-across-interfaces' || name === 'rename-interface') { - test.skip(name, () => {}); - continue; - } + // if (name === 'use-across-interfaces' || name === 'rename-interface') { + // test.skip(name, () => {}); + // continue; + // } test(name, async () => { const source = await readFile(new URL(`./cases/${name}/source.js`, import.meta.url), 'utf8'); const world = await readFile(new URL(`./cases/${name}/world.wit`, import.meta.url), 'utf8'); @@ -77,9 +78,21 @@ suite('Bindings', () => { sourceName: `${name}.js`, }); - const map = {}; + const map = { + 'wasi:cli-base/*': '@bytecodealliance/preview2-shim/cli-base#*', + 'wasi:clocks/*': '@bytecodealliance/preview2-shim/clocks#*', + 'wasi:filesystem/*': '@bytecodealliance/preview2-shim/filesystem#*', + 'wasi:http/*': '@bytecodealliance/preview2-shim/http#*', + 'wasi:io/*': '@bytecodealliance/preview2-shim/io#*', + 'wasi:logging/*': '@bytecodealliance/preview2-shim/logging#*', + 'wasi:poll/*': '@bytecodealliance/preview2-shim/poll#*', + 'wasi:random/*': '@bytecodealliance/preview2-shim/random#*', + 'wasi:sockets/*': '@bytecodealliance/preview2-shim/sockets#*' + }; for (const [impt] of imports) { - map[impt] = `../../cases/${name}/${impt}.js`; + let importName = impt.split('/').pop(); + if (importName === 'test') importName = 'imports'; + map[impt] = `../../cases/${name}/${importName}.js`; } const { files } = await transpile(component, { name, map, wasiShim: true }); @@ -109,8 +122,8 @@ suite('Bindings', () => { suite('WASI', () => { test('basic app', async () => { const { component } = await componentize(` - import { now } from 'wall-clock'; - import { getRandomBytes } from 'random'; + import { now } from 'wasi:clocks/wall-clock'; + import { getRandomBytes } from 'wasi:random/random'; export function test () { return \`NOW: \${now().seconds}, RANDOM: \${getRandomBytes(2n)}\`; diff --git a/test/wit/deps/clocks/monotonic-clock.wit b/test/wit/deps/clocks/monotonic-clock.wit new file mode 100644 index 00000000..50eb4de1 --- /dev/null +++ b/test/wit/deps/clocks/monotonic-clock.wit @@ -0,0 +1,34 @@ +package wasi:clocks + +/// WASI Monotonic Clock is a clock API intended to let users measure elapsed +/// time. +/// +/// It is intended to be portable at least between Unix-family platforms and +/// Windows. +/// +/// A monotonic clock is a clock which has an unspecified initial value, and +/// successive reads of the clock will produce non-decreasing values. +/// +/// It is intended for measuring elapsed time. +interface monotonic-clock { + use wasi:poll/poll.{pollable} + + /// A timestamp in nanoseconds. + type instant = u64 + + /// Read the current value of the clock. + /// + /// The clock is monotonic, therefore calling this function repeatedly will + /// produce a sequence of non-decreasing values. + now: func() -> instant + + /// Query the resolution of the clock. + resolution: func() -> instant + + /// Create a `pollable` which will resolve once the specified time has been + /// reached. + subscribe: func( + when: instant, + absolute: bool + ) -> pollable +} diff --git a/test/wit/deps/clocks/timezone.wit b/test/wit/deps/clocks/timezone.wit new file mode 100644 index 00000000..2b685566 --- /dev/null +++ b/test/wit/deps/clocks/timezone.wit @@ -0,0 +1,63 @@ +package wasi:clocks + +interface timezone { + use wall-clock.{datetime} + + /// A timezone. + /// + /// In timezones that recognize daylight saving time, also known as daylight + /// time and summer time, the information returned from the functions varies + /// over time to reflect these adjustments. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type timezone = u32 + + /// Return information needed to display the given `datetime`. This includes + /// the UTC offset, the time zone name, and a flag indicating whether + /// daylight saving time is active. + /// + /// If the timezone cannot be determined for the given `datetime`, return a + /// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight + /// saving time. + display: func(this: timezone, when: datetime) -> timezone-display + + /// The same as `display`, but only return the UTC offset. + utc-offset: func(this: timezone, when: datetime) -> s32 + + /// Dispose of the specified input-stream, after which it may no longer + /// be used. + drop-timezone: func(this: timezone) + + /// Information useful for displaying the timezone of a specific `datetime`. + /// + /// This information may vary within a single `timezone` to reflect daylight + /// saving time adjustments. + record timezone-display { + /// The number of seconds difference between UTC time and the local + /// time of the timezone. + /// + /// The returned value will always be less than 86400 which is the + /// number of seconds in a day (24*60*60). + /// + /// In implementations that do not expose an actual time zone, this + /// should return 0. + utc-offset: s32, + + /// The abbreviated name of the timezone to display to a user. The name + /// `UTC` indicates Coordinated Universal Time. Otherwise, this should + /// reference local standards for the name of the time zone. + /// + /// In implementations that do not expose an actual time zone, this + /// should be the string `UTC`. + /// + /// In time zones that do not have an applicable name, a formatted + /// representation of the UTC offset may be returned, such as `-04:00`. + name: string, + + /// Whether daylight saving time is active. + /// + /// In implementations that do not expose an actual time zone, this + /// should return false. + in-daylight-saving-time: bool, + } +} diff --git a/test/wit/deps/clocks/wall-clock.wit b/test/wit/deps/clocks/wall-clock.wit new file mode 100644 index 00000000..6137724f --- /dev/null +++ b/test/wit/deps/clocks/wall-clock.wit @@ -0,0 +1,43 @@ +package wasi:clocks + +/// WASI Wall Clock is a clock API intended to let users query the current +/// time. The name "wall" makes an analogy to a "clock on the wall", which +/// is not necessarily monotonic as it may be reset. +/// +/// It is intended to be portable at least between Unix-family platforms and +/// Windows. +/// +/// A wall clock is a clock which measures the date and time according to +/// some external reference. +/// +/// External references may be reset, so this clock is not necessarily +/// monotonic, making it unsuitable for measuring elapsed time. +/// +/// It is intended for reporting the current date and time for humans. +interface wall-clock { + /// A time and date in seconds plus nanoseconds. + record datetime { + seconds: u64, + nanoseconds: u32, + } + + /// Read the current value of the clock. + /// + /// This clock is not monotonic, therefore calling this function repeatedly + /// will not necessarily produce a sequence of non-decreasing values. + /// + /// The returned timestamps represent the number of seconds since + /// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch], + /// also known as [Unix Time]. + /// + /// The nanoseconds field of the output is always less than 1000000000. + /// + /// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16 + /// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time + now: func() -> datetime + + /// Query the resolution of the clock. + /// + /// The nanoseconds field of the output is always less than 1000000000. + resolution: func() -> datetime +} diff --git a/test/wit/deps/filesystem/filesystem.wit b/test/wit/deps/filesystem/filesystem.wit new file mode 100644 index 00000000..930f3756 --- /dev/null +++ b/test/wit/deps/filesystem/filesystem.wit @@ -0,0 +1,782 @@ +package wasi:filesystem + +/// WASI filesystem is a filesystem API primarily intended to let users run WASI +/// programs that access their files on their existing filesystems, without +/// significant overhead. +/// +/// It is intended to be roughly portable between Unix-family platforms and +/// Windows, though it does not hide many of the major differences. +/// +/// Paths are passed as interface-type `string`s, meaning they must consist of +/// a sequence of Unicode Scalar Values (USVs). Some filesystems may contain +/// paths which are not accessible by this API. +/// +/// The directory separator in WASI is always the forward-slash (`/`). +/// +/// All paths in WASI are relative paths, and are interpreted relative to a +/// `descriptor` referring to a base directory. If a `path` argument to any WASI +/// function starts with `/`, or if any step of resolving a `path`, including +/// `..` and symbolic link steps, reaches a directory outside of the base +/// directory, or reaches a symlink to an absolute or rooted path in the +/// underlying filesystem, the function fails with `error-code::not-permitted`. +interface filesystem { + use wasi:io/streams.{input-stream, output-stream} + use wasi:clocks/wall-clock.{datetime} + + /// File size or length of a region within a file. + type filesize = u64 + + /// The type of a filesystem object referenced by a descriptor. + /// + /// Note: This was called `filetype` in earlier versions of WASI. + enum descriptor-type { + /// The type of the descriptor or file is unknown or is different from + /// any of the other types specified. + unknown, + /// The descriptor refers to a block device inode. + block-device, + /// The descriptor refers to a character device inode. + character-device, + /// The descriptor refers to a directory inode. + directory, + /// The descriptor refers to a named pipe. + fifo, + /// The file refers to a symbolic link inode. + symbolic-link, + /// The descriptor refers to a regular file inode. + regular-file, + /// The descriptor refers to a socket. + socket, + } + + /// Descriptor flags. + /// + /// Note: This was called `fdflags` in earlier versions of WASI. + flags descriptor-flags { + /// Read mode: Data can be read. + read, + /// Write mode: Data can be written to. + write, + /// Request that writes be performed according to synchronized I/O file + /// integrity completion. The data stored in the file and the file's + /// metadata are synchronized. This is similar to `O_SYNC` in POSIX. + /// + /// The precise semantics of this operation have not yet been defined for + /// WASI. At this time, it should be interpreted as a request, and not a + /// requirement. + file-integrity-sync, + /// Request that writes be performed according to synchronized I/O data + /// integrity completion. Only the data stored in the file is + /// synchronized. This is similar to `O_DSYNC` in POSIX. + /// + /// The precise semantics of this operation have not yet been defined for + /// WASI. At this time, it should be interpreted as a request, and not a + /// requirement. + data-integrity-sync, + /// Requests that reads be performed at the same level of integrety + /// requested for writes. This is similar to `O_RSYNC` in POSIX. + /// + /// The precise semantics of this operation have not yet been defined for + /// WASI. At this time, it should be interpreted as a request, and not a + /// requirement. + requested-write-sync, + /// Mutating directories mode: Directory contents may be mutated. + /// + /// When this flag is unset on a descriptor, operations using the + /// descriptor which would create, rename, delete, modify the data or + /// metadata of filesystem objects, or obtain another handle which + /// would permit any of those, shall fail with `error-code::read-only` if + /// they would otherwise succeed. + /// + /// This may only be set on directories. + mutate-directory, + } + + /// File attributes. + /// + /// Note: This was called `filestat` in earlier versions of WASI. + record descriptor-stat { + /// Device ID of device containing the file. + device: device, + /// File serial number. + inode: inode, + /// File type. + %type: descriptor-type, + /// Number of hard links to the file. + link-count: link-count, + /// For regular files, the file size in bytes. For symbolic links, the + /// length in bytes of the pathname contained in the symbolic link. + size: filesize, + /// Last data access timestamp. + data-access-timestamp: datetime, + /// Last data modification timestamp. + data-modification-timestamp: datetime, + /// Last file status change timestamp. + status-change-timestamp: datetime, + } + + /// Flags determining the method of how paths are resolved. + flags path-flags { + /// As long as the resolved path corresponds to a symbolic link, it is + /// expanded. + symlink-follow, + } + + /// Open flags used by `open-at`. + flags open-flags { + /// Create file if it does not exist, similar to `O_CREAT` in POSIX. + create, + /// Fail if not a directory, similar to `O_DIRECTORY` in POSIX. + directory, + /// Fail if file already exists, similar to `O_EXCL` in POSIX. + exclusive, + /// Truncate file to size 0, similar to `O_TRUNC` in POSIX. + truncate, + } + + /// Permissions mode used by `open-at`, `change-file-permissions-at`, and + /// similar. + flags modes { + /// True if the resource is considered readable by the containing + /// filesystem. + readable, + /// True if the resource is considered writable by the containing + /// filesystem. + writable, + /// True if the resource is considered executable by the containing + /// filesystem. This does not apply to directories. + executable, + } + + /// Access type used by `access-at`. + variant access-type { + /// Test for readability, writeability, or executability. + access(modes), + + /// Test whether the path exists. + exists, + } + + /// Number of hard links to an inode. + type link-count = u64 + + /// Identifier for a device containing a file system. Can be used in + /// combination with `inode` to uniquely identify a file or directory in + /// the filesystem. + type device = u64 + + /// Filesystem object serial number that is unique within its file system. + type inode = u64 + + /// When setting a timestamp, this gives the value to set it to. + variant new-timestamp { + /// Leave the timestamp set to its previous value. + no-change, + /// Set the timestamp to the current time of the system clock associated + /// with the filesystem. + now, + /// Set the timestamp to the given value. + timestamp(datetime), + } + + /// A directory entry. + record directory-entry { + /// The serial number of the object referred to by this directory entry. + /// May be none if the inode value is not known. + /// + /// When this is none, libc implementations might do an extra `stat-at` + /// call to retrieve the inode number to fill their `d_ino` fields, so + /// implementations which can set this to a non-none value should do so. + inode: option, + + /// The type of the file referred to by this directory entry. + %type: descriptor-type, + + /// The name of the object. + name: string, + } + + /// Error codes returned by functions, similar to `errno` in POSIX. + /// Not all of these error codes are returned by the functions provided by this + /// API; some are used in higher-level library layers, and others are provided + /// merely for alignment with POSIX. + enum error-code { + /// Permission denied, similar to `EACCES` in POSIX. + access, + /// Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX. + would-block, + /// Connection already in progress, similar to `EALREADY` in POSIX. + already, + /// Bad descriptor, similar to `EBADF` in POSIX. + bad-descriptor, + /// Device or resource busy, similar to `EBUSY` in POSIX. + busy, + /// Resource deadlock would occur, similar to `EDEADLK` in POSIX. + deadlock, + /// Storage quota exceeded, similar to `EDQUOT` in POSIX. + quota, + /// File exists, similar to `EEXIST` in POSIX. + exist, + /// File too large, similar to `EFBIG` in POSIX. + file-too-large, + /// Illegal byte sequence, similar to `EILSEQ` in POSIX. + illegal-byte-sequence, + /// Operation in progress, similar to `EINPROGRESS` in POSIX. + in-progress, + /// Interrupted function, similar to `EINTR` in POSIX. + interrupted, + /// Invalid argument, similar to `EINVAL` in POSIX. + invalid, + /// I/O error, similar to `EIO` in POSIX. + io, + /// Is a directory, similar to `EISDIR` in POSIX. + is-directory, + /// Too many levels of symbolic links, similar to `ELOOP` in POSIX. + loop, + /// Too many links, similar to `EMLINK` in POSIX. + too-many-links, + /// Message too large, similar to `EMSGSIZE` in POSIX. + message-size, + /// Filename too long, similar to `ENAMETOOLONG` in POSIX. + name-too-long, + /// No such device, similar to `ENODEV` in POSIX. + no-device, + /// No such file or directory, similar to `ENOENT` in POSIX. + no-entry, + /// No locks available, similar to `ENOLCK` in POSIX. + no-lock, + /// Not enough space, similar to `ENOMEM` in POSIX. + insufficient-memory, + /// No space left on device, similar to `ENOSPC` in POSIX. + insufficient-space, + /// Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX. + not-directory, + /// Directory not empty, similar to `ENOTEMPTY` in POSIX. + not-empty, + /// State not recoverable, similar to `ENOTRECOVERABLE` in POSIX. + not-recoverable, + /// Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX. + unsupported, + /// Inappropriate I/O control operation, similar to `ENOTTY` in POSIX. + no-tty, + /// No such device or address, similar to `ENXIO` in POSIX. + no-such-device, + /// Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX. + overflow, + /// Operation not permitted, similar to `EPERM` in POSIX. + not-permitted, + /// Broken pipe, similar to `EPIPE` in POSIX. + pipe, + /// Read-only file system, similar to `EROFS` in POSIX. + read-only, + /// Invalid seek, similar to `ESPIPE` in POSIX. + invalid-seek, + /// Text file busy, similar to `ETXTBSY` in POSIX. + text-file-busy, + /// Cross-device link, similar to `EXDEV` in POSIX. + cross-device, + } + + /// File or memory access pattern advisory information. + enum advice { + /// The application has no advice to give on its behavior with respect + /// to the specified data. + normal, + /// The application expects to access the specified data sequentially + /// from lower offsets to higher offsets. + sequential, + /// The application expects to access the specified data in a random + /// order. + random, + /// The application expects to access the specified data in the near + /// future. + will-need, + /// The application expects that it will not access the specified data + /// in the near future. + dont-need, + /// The application expects to access the specified data once and then + /// not reuse it thereafter. + no-reuse, + } + + /// A descriptor is a reference to a filesystem object, which may be a file, + /// directory, named pipe, special file, or other object on which filesystem + /// calls may be made. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type descriptor = u32 + + /// Return a stream for reading from a file. + /// + /// Multiple read, write, and append streams may be active on the same open + /// file and they do not interfere with each other. + /// + /// Note: This allows using `wasi:io/streams.read`, which is similar to `read` in POSIX. + read-via-stream: func( + this: descriptor, + /// The offset within the file at which to start reading. + offset: filesize, + ) -> result + + /// Return a stream for writing to a file. + /// + /// Note: This allows using `wasi:io/streams.write`, which is similar to `write` in + /// POSIX. + write-via-stream: func( + this: descriptor, + /// The offset within the file at which to start writing. + offset: filesize, + ) -> result + + /// Return a stream for appending to a file. + /// + /// Note: This allows using `wasi:io/streams.write`, which is similar to `write` with + /// `O_APPEND` in in POSIX. + append-via-stream: func( + this: descriptor, + ) -> result + + /// Provide file advisory information on a descriptor. + /// + /// This is similar to `posix_fadvise` in POSIX. + advise: func( + this: descriptor, + /// The offset within the file to which the advisory applies. + offset: filesize, + /// The length of the region to which the advisory applies. + length: filesize, + /// The advice. + advice: advice + ) -> result<_, error-code> + + /// Synchronize the data of a file to disk. + /// + /// This function succeeds with no effect if the file descriptor is not + /// opened for writing. + /// + /// Note: This is similar to `fdatasync` in POSIX. + sync-data: func(this: descriptor) -> result<_, error-code> + + /// Get flags associated with a descriptor. + /// + /// Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX. + /// + /// Note: This returns the value that was the `fs_flags` value returned + /// from `fdstat_get` in earlier versions of WASI. + get-flags: func(this: descriptor) -> result + + /// Get the dynamic type of a descriptor. + /// + /// Note: This returns the same value as the `type` field of the `fd-stat` + /// returned by `stat`, `stat-at` and similar. + /// + /// Note: This returns similar flags to the `st_mode & S_IFMT` value provided + /// by `fstat` in POSIX. + /// + /// Note: This returns the value that was the `fs_filetype` value returned + /// from `fdstat_get` in earlier versions of WASI. + get-type: func(this: descriptor) -> result + + /// Adjust the size of an open file. If this increases the file's size, the + /// extra bytes are filled with zeros. + /// + /// Note: This was called `fd_filestat_set_size` in earlier versions of WASI. + set-size: func(this: descriptor, size: filesize) -> result<_, error-code> + + /// Adjust the timestamps of an open file or directory. + /// + /// Note: This is similar to `futimens` in POSIX. + /// + /// Note: This was called `fd_filestat_set_times` in earlier versions of WASI. + set-times: func( + this: descriptor, + /// The desired values of the data access timestamp. + data-access-timestamp: new-timestamp, + /// The desired values of the data modification timestamp. + data-modification-timestamp: new-timestamp, + ) -> result<_, error-code> + + /// Read from a descriptor, without using and updating the descriptor's offset. + /// + /// This function returns a list of bytes containing the data that was + /// read, along with a bool which, when true, indicates that the end of the + /// file was reached. The returned list will contain up to `length` bytes; it + /// may return fewer than requested, if the end of the file is reached or + /// if the I/O operation is interrupted. + /// + /// In the future, this may change to return a `stream`. + /// + /// Note: This is similar to `pread` in POSIX. + read: func( + this: descriptor, + /// The maximum number of bytes to read. + length: filesize, + /// The offset within the file at which to read. + offset: filesize, + ) -> result, bool>, error-code> + + /// Write to a descriptor, without using and updating the descriptor's offset. + /// + /// It is valid to write past the end of a file; the file is extended to the + /// extent of the write, with bytes between the previous end and the start of + /// the write set to zero. + /// + /// In the future, this may change to take a `stream`. + /// + /// Note: This is similar to `pwrite` in POSIX. + write: func( + this: descriptor, + /// Data to write + buffer: list, + /// The offset within the file at which to write. + offset: filesize, + ) -> result + + /// Read directory entries from a directory. + /// + /// On filesystems where directories contain entries referring to themselves + /// and their parents, often named `.` and `..` respectively, these entries + /// are omitted. + /// + /// This always returns a new stream which starts at the beginning of the + /// directory. Multiple streams may be active on the same directory, and they + /// do not interfere with each other. + read-directory: func( + this: descriptor + ) -> result + + /// Synchronize the data and metadata of a file to disk. + /// + /// This function succeeds with no effect if the file descriptor is not + /// opened for writing. + /// + /// Note: This is similar to `fsync` in POSIX. + sync: func(this: descriptor) -> result<_, error-code> + + /// Create a directory. + /// + /// Note: This is similar to `mkdirat` in POSIX. + create-directory-at: func( + this: descriptor, + /// The relative path at which to create the directory. + path: string, + ) -> result<_, error-code> + + /// Return the attributes of an open file or directory. + /// + /// Note: This is similar to `fstat` in POSIX. + /// + /// Note: This was called `fd_filestat_get` in earlier versions of WASI. + stat: func(this: descriptor) -> result + + /// Return the attributes of a file or directory. + /// + /// Note: This is similar to `fstatat` in POSIX. + /// + /// Note: This was called `path_filestat_get` in earlier versions of WASI. + stat-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path of the file or directory to inspect. + path: string, + ) -> result + + /// Adjust the timestamps of a file or directory. + /// + /// Note: This is similar to `utimensat` in POSIX. + /// + /// Note: This was called `path_filestat_set_times` in earlier versions of + /// WASI. + set-times-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path of the file or directory to operate on. + path: string, + /// The desired values of the data access timestamp. + data-access-timestamp: new-timestamp, + /// The desired values of the data modification timestamp. + data-modification-timestamp: new-timestamp, + ) -> result<_, error-code> + + /// Create a hard link. + /// + /// Note: This is similar to `linkat` in POSIX. + link-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + old-path-flags: path-flags, + /// The relative source path from which to link. + old-path: string, + /// The base directory for `new-path`. + new-descriptor: descriptor, + /// The relative destination path at which to create the hard link. + new-path: string, + ) -> result<_, error-code> + + /// Open a file or directory. + /// + /// The returned descriptor is not guaranteed to be the lowest-numbered + /// descriptor not currently open/ it is randomized to prevent applications + /// from depending on making assumptions about indexes, since this is + /// error-prone in multi-threaded contexts. The returned descriptor is + /// guaranteed to be less than 2**31. + /// + /// If `flags` contains `descriptor-flags::mutate-directory`, and the base + /// descriptor doesn't have `descriptor-flags::mutate-directory` set, + /// `open-at` fails with `error-code::read-only`. + /// + /// If `flags` contains `write` or `mutate-directory`, or `open-flags` + /// contains `truncate` or `create`, and the base descriptor doesn't have + /// `descriptor-flags::mutate-directory` set, `open-at` fails with + /// `error-code::read-only`. + /// + /// Note: This is similar to `openat` in POSIX. + open-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path of the object to open. + path: string, + /// The method by which to open the file. + open-flags: open-flags, + /// Flags to use for the resulting descriptor. + %flags: descriptor-flags, + /// Permissions to use when creating a new file. + modes: modes + ) -> result + + /// Read the contents of a symbolic link. + /// + /// If the contents contain an absolute or rooted path in the underlying + /// filesystem, this function fails with `error-code::not-permitted`. + /// + /// Note: This is similar to `readlinkat` in POSIX. + readlink-at: func( + this: descriptor, + /// The relative path of the symbolic link from which to read. + path: string, + ) -> result + + /// Remove a directory. + /// + /// Return `error-code::not-empty` if the directory is not empty. + /// + /// Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX. + remove-directory-at: func( + this: descriptor, + /// The relative path to a directory to remove. + path: string, + ) -> result<_, error-code> + + /// Rename a filesystem object. + /// + /// Note: This is similar to `renameat` in POSIX. + rename-at: func( + this: descriptor, + /// The relative source path of the file or directory to rename. + old-path: string, + /// The base directory for `new-path`. + new-descriptor: descriptor, + /// The relative destination path to which to rename the file or directory. + new-path: string, + ) -> result<_, error-code> + + /// Create a symbolic link (also known as a "symlink"). + /// + /// If `old-path` starts with `/`, the function fails with + /// `error-code::not-permitted`. + /// + /// Note: This is similar to `symlinkat` in POSIX. + symlink-at: func( + this: descriptor, + /// The contents of the symbolic link. + old-path: string, + /// The relative destination path at which to create the symbolic link. + new-path: string, + ) -> result<_, error-code> + + /// Check accessibility of a filesystem path. + /// + /// Check whether the given filesystem path names an object which is + /// readable, writable, or executable, or whether it exists. + /// + /// This does not a guarantee that subsequent accesses will succeed, as + /// filesystem permissions may be modified asynchronously by external + /// entities. + /// + /// Note: This is similar to `faccessat` with the `AT_EACCESS` flag in POSIX. + access-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path to check. + path: string, + /// The type of check to perform. + %type: access-type + ) -> result<_, error-code> + + /// Unlink a filesystem object that is not a directory. + /// + /// Return `error-code::is-directory` if the path refers to a directory. + /// Note: This is similar to `unlinkat(fd, path, 0)` in POSIX. + unlink-file-at: func( + this: descriptor, + /// The relative path to a file to unlink. + path: string, + ) -> result<_, error-code> + + /// Change the permissions of a filesystem object that is not a directory. + /// + /// Note that the ultimate meanings of these permissions is + /// filesystem-specific. + /// + /// Note: This is similar to `fchmodat` in POSIX. + change-file-permissions-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path to operate on. + path: string, + /// The new permissions for the filesystem object. + modes: modes, + ) -> result<_, error-code> + + /// Change the permissions of a directory. + /// + /// Note that the ultimate meanings of these permissions is + /// filesystem-specific. + /// + /// Unlike in POSIX, the `executable` flag is not reinterpreted as a "search" + /// flag. `read` on a directory implies readability and searchability, and + /// `execute` is not valid for directories. + /// + /// Note: This is similar to `fchmodat` in POSIX. + change-directory-permissions-at: func( + this: descriptor, + /// Flags determining the method of how the path is resolved. + path-flags: path-flags, + /// The relative path to operate on. + path: string, + /// The new permissions for the directory. + modes: modes, + ) -> result<_, error-code> + + /// Request a shared advisory lock for an open file. + /// + /// This requests a *shared* lock; more than one shared lock can be held for + /// a file at the same time. + /// + /// If the open file has an exclusive lock, this function downgrades the lock + /// to a shared lock. If it has a shared lock, this function has no effect. + /// + /// This requests an *advisory* lock, meaning that the file could be accessed + /// by other programs that don't hold the lock. + /// + /// It is unspecified how shared locks interact with locks acquired by + /// non-WASI programs. + /// + /// This function blocks until the lock can be acquired. + /// + /// Not all filesystems support locking; on filesystems which don't support + /// locking, this function returns `error-code::unsupported`. + /// + /// Note: This is similar to `flock(fd, LOCK_SH)` in Unix. + lock-shared: func(this: descriptor) -> result<_, error-code> + + /// Request an exclusive advisory lock for an open file. + /// + /// This requests an *exclusive* lock; no other locks may be held for the + /// file while an exclusive lock is held. + /// + /// If the open file has a shared lock and there are no exclusive locks held + /// for the file, this function upgrades the lock to an exclusive lock. If the + /// open file already has an exclusive lock, this function has no effect. + /// + /// This requests an *advisory* lock, meaning that the file could be accessed + /// by other programs that don't hold the lock. + /// + /// It is unspecified whether this function succeeds if the file descriptor + /// is not opened for writing. It is unspecified how exclusive locks interact + /// with locks acquired by non-WASI programs. + /// + /// This function blocks until the lock can be acquired. + /// + /// Not all filesystems support locking; on filesystems which don't support + /// locking, this function returns `error-code::unsupported`. + /// + /// Note: This is similar to `flock(fd, LOCK_EX)` in Unix. + lock-exclusive: func(this: descriptor) -> result<_, error-code> + + /// Request a shared advisory lock for an open file. + /// + /// This requests a *shared* lock; more than one shared lock can be held for + /// a file at the same time. + /// + /// If the open file has an exclusive lock, this function downgrades the lock + /// to a shared lock. If it has a shared lock, this function has no effect. + /// + /// This requests an *advisory* lock, meaning that the file could be accessed + /// by other programs that don't hold the lock. + /// + /// It is unspecified how shared locks interact with locks acquired by + /// non-WASI programs. + /// + /// This function returns `error-code::would-block` if the lock cannot be + /// acquired. + /// + /// Not all filesystems support locking; on filesystems which don't support + /// locking, this function returns `error-code::unsupported`. + /// + /// Note: This is similar to `flock(fd, LOCK_SH | LOCK_NB)` in Unix. + try-lock-shared: func(this: descriptor) -> result<_, error-code> + + /// Request an exclusive advisory lock for an open file. + /// + /// This requests an *exclusive* lock; no other locks may be held for the + /// file while an exclusive lock is held. + /// + /// If the open file has a shared lock and there are no exclusive locks held + /// for the file, this function upgrades the lock to an exclusive lock. If the + /// open file already has an exclusive lock, this function has no effect. + /// + /// This requests an *advisory* lock, meaning that the file could be accessed + /// by other programs that don't hold the lock. + /// + /// It is unspecified whether this function succeeds if the file descriptor + /// is not opened for writing. It is unspecified how exclusive locks interact + /// with locks acquired by non-WASI programs. + /// + /// This function returns `error-code::would-block` if the lock cannot be + /// acquired. + /// + /// Not all filesystems support locking; on filesystems which don't support + /// locking, this function returns `error-code::unsupported`. + /// + /// Note: This is similar to `flock(fd, LOCK_EX | LOCK_NB)` in Unix. + try-lock-exclusive: func(this: descriptor) -> result<_, error-code> + + /// Release a shared or exclusive lock on an open file. + /// + /// Note: This is similar to `flock(fd, LOCK_UN)` in Unix. + unlock: func(this: descriptor) -> result<_, error-code> + + /// Dispose of the specified `descriptor`, after which it may no longer + /// be used. + drop-descriptor: func(this: descriptor) + + /// A stream of directory entries. + /// + /// This [represents a stream of `dir-entry`](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Streams). + type directory-entry-stream = u32 + + /// Read a single directory entry from a `directory-entry-stream`. + read-directory-entry: func( + this: directory-entry-stream + ) -> result, error-code> + + /// Dispose of the specified `directory-entry-stream`, after which it may no longer + /// be used. + drop-directory-entry-stream: func(this: directory-entry-stream) +} diff --git a/test/wit/deps/http/incoming-handler.wit b/test/wit/deps/http/incoming-handler.wit new file mode 100644 index 00000000..d0e27046 --- /dev/null +++ b/test/wit/deps/http/incoming-handler.wit @@ -0,0 +1,24 @@ +// The `wasi:http/incoming-handler` interface is meant to be exported by +// components and called by the host in response to a new incoming HTTP +// response. +// +// NOTE: in Preview3, this interface will be merged with +// `wasi:http/outgoing-handler` into a single `wasi:http/handler` interface +// that takes a `request` parameter and returns a `response` result. +// +interface incoming-handler { + use types.{incoming-request, response-outparam} + + // The `handle` function takes an outparam instead of returning its response + // so that the component may stream its response while streaming any other + // request or response bodies. The callee MUST write a response to the + // `response-out` and then finish the response before returning. The `handle` + // function is allowed to continue execution after finishing the response's + // output stream. While this post-response execution is taken off the + // critical path, since there is no return value, there is no way to report + // its success or failure. + handle: func( + request: incoming-request, + response-out: response-outparam + ) +} diff --git a/test/wit/deps/http/outgoing-handler.wit b/test/wit/deps/http/outgoing-handler.wit new file mode 100644 index 00000000..06c8e469 --- /dev/null +++ b/test/wit/deps/http/outgoing-handler.wit @@ -0,0 +1,18 @@ +// The `wasi:http/outgoing-handler` interface is meant to be imported by +// components and implemented by the host. +// +// NOTE: in Preview3, this interface will be merged with +// `wasi:http/outgoing-handler` into a single `wasi:http/handler` interface +// that takes a `request` parameter and returns a `response` result. +// +interface outgoing-handler { + use types.{outgoing-request, request-options, future-incoming-response} + + // The parameter and result types of the `handle` function allow the caller + // to concurrently stream the bodies of the outgoing request and the incoming + // response. + handle: func( + request: outgoing-request, + options: option + ) -> future-incoming-response +} diff --git a/test/wit/deps/http/types.wit b/test/wit/deps/http/types.wit new file mode 100644 index 00000000..ee4227f4 --- /dev/null +++ b/test/wit/deps/http/types.wit @@ -0,0 +1,159 @@ +package wasi:http + +// The `wasi:http/types` interface is meant to be imported by components to +// define the HTTP resource types and operations used by the component's +// imported and exported interfaces. +interface types { + use wasi:io/streams.{input-stream, output-stream} + use wasi:poll/poll.{pollable} + + // This type corresponds to HTTP standard Methods. + variant method { + get, + head, + post, + put, + delete, + connect, + options, + trace, + patch, + other(string) + } + + // This type corresponds to HTTP standard Related Schemes. + variant scheme { + HTTP, + HTTPS, + other(string) + } + + // TODO: perhaps better align with HTTP semantics? + // This type enumerates the different kinds of errors that may occur when + // initially returning a response. + variant error { + invalid-url(string), + timeout-error(string), + protocol-error(string), + unexpected-error(string) + } + + // This following block defines the `fields` resource which corresponds to + // HTTP standard Fields. Soon, when resource types are added, the `type + // fields = u32` type alias can be replaced by a proper `resource fields` + // definition containing all the functions using the method syntactic sugar. + type fields = u32 + drop-fields: func(fields: fields) + new-fields: func(entries: list>) -> fields + fields-get: func(fields: fields, name: string) -> list + fields-set: func(fields: fields, name: string, value: list) + fields-delete: func(fields: fields, name: string) + fields-append: func(fields: fields, name: string, value: string) + fields-entries: func(fields: fields) -> list> + fields-clone: func(fields: fields) -> fields + + type headers = fields + type trailers = fields + + // The following block defines stream types which corresponds to the HTTP + // standard Contents and Trailers. With Preview3, all of these fields can be + // replaced by a stream>. In the interim, we need to + // build on separate resource types defined by `wasi:io/streams`. The + // `finish-` functions emulate the stream's result value and MUST be called + // exactly once after the final read/write from/to the stream before dropping + // the stream. + type incoming-stream = input-stream + type outgoing-stream = output-stream + finish-incoming-stream: func(s: incoming-stream) -> option + finish-outgoing-stream: func(s: outgoing-stream, trailers: option) + + // The following block defines the `incoming-request` and `outgoing-request` + // resource types that correspond to HTTP standard Requests. Soon, when + // resource types are added, the `u32` type aliases can be replaced by + // proper `resource` type definitions containing all the functions as + // methods. Later, Preview2 will allow both types to be merged together into + // a single `request` type (that uses the single `stream` type mentioned + // above). The `consume` and `write` methods may only be called once (and + // return failure thereafter). + type incoming-request = u32 + type outgoing-request = u32 + drop-incoming-request: func(request: incoming-request) + drop-outgoing-request: func(request: outgoing-request) + incoming-request-method: func(request: incoming-request) -> method + incoming-request-path: func(request: incoming-request) -> string + incoming-request-query: func(request: incoming-request) -> string + incoming-request-scheme: func(request: incoming-request) -> option + incoming-request-authority: func(request: incoming-request) -> string + incoming-request-headers: func(request: incoming-request) -> headers + incoming-request-consume: func(request: incoming-request) -> result + new-outgoing-request: func( + method: method, + path: string, + query: string, + scheme: option, + authority: string, + headers: headers + ) -> outgoing-request + outgoing-request-write: func(request: outgoing-request) -> result + + // Additional optional parameters that can be set when making a request. + record request-options { + // The following timeouts are specific to the HTTP protocol and work + // independently of the overall timeouts passed to `io.poll.poll-oneoff`. + + // The timeout for the initial connect. + connect-timeout-ms: option, + + // The timeout for receiving the first byte of the response body. + first-byte-timeout-ms: option, + + // The timeout for receiving the next chunk of bytes in the response body + // stream. + between-bytes-timeout-ms: option + } + + // The following block defines a special resource type used by the + // `wasi:http/incoming-handler` interface. When resource types are added, this + // block can be replaced by a proper `resource response-outparam { ... }` + // definition. Later, with Preview3, the need for an outparam goes away entirely + // (the `wasi:http/handler` interface used for both incoming and outgoing can + // simply return a `stream`). + type response-outparam = u32 + drop-response-outparam: func(response: response-outparam) + set-response-outparam: func(response: result) -> result + + // This type corresponds to the HTTP standard Status Code. + type status-code = u16 + + // The following block defines the `incoming-response` and `outgoing-response` + // resource types that correspond to HTTP standard Responses. Soon, when + // resource types are added, the `u32` type aliases can be replaced by proper + // `resource` type definitions containing all the functions as methods. Later, + // Preview2 will allow both types to be merged together into a single `response` + // type (that uses the single `stream` type mentioned above). The `consume` and + // `write` methods may only be called once (and return failure thereafter). + type incoming-response = u32 + type outgoing-response = u32 + drop-incoming-response: func(response: incoming-response) + drop-outgoing-response: func(response: outgoing-response) + incoming-response-status: func(response: incoming-response) -> status-code + incoming-response-headers: func(response: incoming-response) -> headers + incoming-response-consume: func(response: incoming-response) -> result + new-outgoing-response: func( + status-code: status-code, + headers: headers + ) -> outgoing-response + outgoing-response-write: func(response: outgoing-response) -> result + + // The following block defines a special resource type used by the + // `wasi:http/outgoing-handler` interface to emulate + // `future>` in advance of Preview3. Given a + // `future-incoming-response`, the client can call the non-blocking `get` + // method to get the result if it is available. If the result is not available, + // the client can call `listen` to get a `pollable` that can be passed to + // `io.poll.poll-oneoff`. + type future-incoming-response = u32 + drop-future-incoming-response: func(f: future-incoming-response) + future-incoming-response-get: func(f: future-incoming-response) -> option> + listen-to-future-incoming-response: func(f: future-incoming-response) -> pollable +} diff --git a/test/wit/deps/io/streams.wit b/test/wit/deps/io/streams.wit new file mode 100644 index 00000000..008e36cf --- /dev/null +++ b/test/wit/deps/io/streams.wit @@ -0,0 +1,215 @@ +package wasi:io + +/// WASI I/O is an I/O abstraction API which is currently focused on providing +/// stream types. +/// +/// In the future, the component model is expected to add built-in stream types; +/// when it does, they are expected to subsume this API. +interface streams { + use wasi:poll/poll.{pollable} + + /// An error type returned from a stream operation. Currently this + /// doesn't provide any additional information. + record stream-error {} + + /// An input bytestream. In the future, this will be replaced by handle + /// types. + /// + /// This conceptually represents a `stream`. It's temporary + /// scaffolding until component-model's async features are ready. + /// + /// `input-stream`s are *non-blocking* to the extent practical on underlying + /// platforms. I/O operations always return promptly; if fewer bytes are + /// promptly available than requested, they return the number of bytes promptly + /// available, which could even be zero. To wait for data to be available, + /// use the `subscribe-to-input-stream` function to obtain a `pollable` which + /// can be polled for using `wasi_poll`. + /// + /// And at present, it is a `u32` instead of being an actual handle, until + /// the wit-bindgen implementation of handles and resources is ready. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type input-stream = u32 + + /// Read bytes from a stream. + /// + /// This function returns a list of bytes containing the data that was + /// read, along with a bool which, when true, indicates that the end of the + /// stream was reached. The returned list will contain up to `len` bytes; it + /// may return fewer than requested, but not more. + /// + /// Once a stream has reached the end, subsequent calls to read or + /// `skip` will always report end-of-stream rather than producing more + /// data. + /// + /// If `len` is 0, it represents a request to read 0 bytes, which should + /// always succeed, assuming the stream hasn't reached its end yet, and + /// return an empty list. + /// + /// The len here is a `u64`, but some callees may not be able to allocate + /// a buffer as large as that would imply. + /// FIXME: describe what happens if allocation fails. + read: func( + this: input-stream, + /// The maximum number of bytes to read + len: u64 + ) -> result, bool>, stream-error> + + /// Read bytes from a stream, with blocking. + /// + /// This is similar to `read`, except that it blocks until at least one + /// byte can be read. + blocking-read: func( + this: input-stream, + /// The maximum number of bytes to read + len: u64 + ) -> result, bool>, stream-error> + + /// Skip bytes from a stream. + /// + /// This is similar to the `read` function, but avoids copying the + /// bytes into the instance. + /// + /// Once a stream has reached the end, subsequent calls to read or + /// `skip` will always report end-of-stream rather than producing more + /// data. + /// + /// This function returns the number of bytes skipped, along with a bool + /// indicating whether the end of the stream was reached. The returned + /// value will be at most `len`; it may be less. + skip: func( + this: input-stream, + /// The maximum number of bytes to skip. + len: u64, + ) -> result, stream-error> + + /// Skip bytes from a stream, with blocking. + /// + /// This is similar to `skip`, except that it blocks until at least one + /// byte can be consumed. + blocking-skip: func( + this: input-stream, + /// The maximum number of bytes to skip. + len: u64, + ) -> result, stream-error> + + /// Create a `pollable` which will resolve once either the specified stream + /// has bytes available to read or the other end of the stream has been + /// closed. + subscribe-to-input-stream: func(this: input-stream) -> pollable + + /// Dispose of the specified `input-stream`, after which it may no longer + /// be used. + drop-input-stream: func(this: input-stream) + + /// An output bytestream. In the future, this will be replaced by handle + /// types. + /// + /// This conceptually represents a `stream`. It's temporary + /// scaffolding until component-model's async features are ready. + /// + /// `output-stream`s are *non-blocking* to the extent practical on + /// underlying platforms. Except where specified otherwise, I/O operations also + /// always return promptly, after the number of bytes that can be written + /// promptly, which could even be zero. To wait for the stream to be ready to + /// accept data, the `subscribe-to-output-stream` function to obtain a + /// `pollable` which can be polled for using `wasi_poll`. + /// + /// And at present, it is a `u32` instead of being an actual handle, until + /// the wit-bindgen implementation of handles and resources is ready. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type output-stream = u32 + + /// Write bytes to a stream. + /// + /// This function returns a `u64` indicating the number of bytes from + /// `buf` that were written; it may be less than the full list. + write: func( + this: output-stream, + /// Data to write + buf: list + ) -> result + + /// Write bytes to a stream, with blocking. + /// + /// This is similar to `write`, except that it blocks until at least one + /// byte can be written. + blocking-write: func( + this: output-stream, + /// Data to write + buf: list + ) -> result + + /// Write multiple zero bytes to a stream. + /// + /// This function returns a `u64` indicating the number of zero bytes + /// that were written; it may be less than `len`. + write-zeroes: func( + this: output-stream, + /// The number of zero bytes to write + len: u64 + ) -> result + + /// Write multiple zero bytes to a stream, with blocking. + /// + /// This is similar to `write-zeroes`, except that it blocks until at least + /// one byte can be written. + blocking-write-zeroes: func( + this: output-stream, + /// The number of zero bytes to write + len: u64 + ) -> result + + /// Read from one stream and write to another. + /// + /// This function returns the number of bytes transferred; it may be less + /// than `len`. + /// + /// Unlike other I/O functions, this function blocks until all the data + /// read from the input stream has been written to the output stream. + splice: func( + this: output-stream, + /// The stream to read from + src: input-stream, + /// The number of bytes to splice + len: u64, + ) -> result, stream-error> + + /// Read from one stream and write to another, with blocking. + /// + /// This is similar to `splice`, except that it blocks until at least + /// one byte can be read. + blocking-splice: func( + this: output-stream, + /// The stream to read from + src: input-stream, + /// The number of bytes to splice + len: u64, + ) -> result, stream-error> + + /// Forward the entire contents of an input stream to an output stream. + /// + /// This function repeatedly reads from the input stream and writes + /// the data to the output stream, until the end of the input stream + /// is reached, or an error is encountered. + /// + /// Unlike other I/O functions, this function blocks until the end + /// of the input stream is seen and all the data has been written to + /// the output stream. + /// + /// This function returns the number of bytes transferred. + forward: func( + this: output-stream, + /// The stream to read from + src: input-stream + ) -> result + + /// Create a `pollable` which will resolve once either the specified stream + /// is ready to accept bytes or the other end of the stream has been closed. + subscribe-to-output-stream: func(this: output-stream) -> pollable + + /// Dispose of the specified `output-stream`, after which it may no longer + /// be used. + drop-output-stream: func(this: output-stream) +} diff --git a/test/wit/deps/logging/handler.wit b/test/wit/deps/logging/handler.wit new file mode 100644 index 00000000..e6b077be --- /dev/null +++ b/test/wit/deps/logging/handler.wit @@ -0,0 +1,34 @@ +package wasi:logging + +/// WASI Logging is a logging API intended to let users emit log messages with +/// simple priority levels and context values. +interface handler { + /// A log level, describing a kind of message. + enum level { + /// Describes messages about the values of variables and the flow of + /// control within a program. + trace, + + /// Describes messages likely to be of interest to someone debugging a + /// program. + debug, + + /// Describes messages likely to be of interest to someone monitoring a + /// program. + info, + + /// Describes messages indicating hazardous situations. + warn, + + /// Describes messages indicating serious errors. + error, + } + + /// Emit a log message. + /// + /// A log message has a `level` describing what kind of message is being + /// sent, a context, which is an uninterpreted string meant to help + /// consumers group similar messages, and a string containing the message + /// text. + log: func(level: level, context: string, message: string) +} diff --git a/test/wit/deps/poll/poll.wit b/test/wit/deps/poll/poll.wit new file mode 100644 index 00000000..cf5d8779 --- /dev/null +++ b/test/wit/deps/poll/poll.wit @@ -0,0 +1,41 @@ +package wasi:poll + +/// A poll API intended to let users wait for I/O events on multiple handles +/// at once. +interface poll { + /// A "pollable" handle. + /// + /// This is conceptually represents a `stream<_, _>`, or in other words, + /// a stream that one can wait on, repeatedly, but which does not itself + /// produce any data. It's temporary scaffolding until component-model's + /// async features are ready. + /// + /// And at present, it is a `u32` instead of being an actual handle, until + /// the wit-bindgen implementation of handles and resources is ready. + /// + /// `pollable` lifetimes are not automatically managed. Users must ensure + /// that they do not outlive the resource they reference. + /// + /// This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources). + type pollable = u32 + + /// Dispose of the specified `pollable`, after which it may no longer + /// be used. + drop-pollable: func(this: pollable) + + /// Poll for completion on a set of pollables. + /// + /// The "oneoff" in the name refers to the fact that this function must do a + /// linear scan through the entire list of subscriptions, which may be + /// inefficient if the number is large and the same subscriptions are used + /// many times. In the future, this is expected to be obsoleted by the + /// component model async proposal, which will include a scalable waiting + /// facility. + /// + /// Note that the return type would ideally be `list`, but that would + /// be more difficult to polyfill given the current state of `wit-bindgen`. + /// See + /// for details. For now, we use zero to mean "not ready" and non-zero to + /// mean "ready". + poll-oneoff: func(in: list) -> list +} diff --git a/test/wit/deps/random/insecure-seed.wit b/test/wit/deps/random/insecure-seed.wit new file mode 100644 index 00000000..ff2ff65d --- /dev/null +++ b/test/wit/deps/random/insecure-seed.wit @@ -0,0 +1,24 @@ +/// The insecure-seed interface for seeding hash-map DoS resistance. +/// +/// It is intended to be portable at least between Unix-family platforms and +/// Windows. +interface insecure-seed { + /// Return a 128-bit value that may contain a pseudo-random value. + /// + /// The returned value is not required to be computed from a CSPRNG, and may + /// even be entirely deterministic. Host implementations are encouraged to + /// provide pseudo-random values to any program exposed to + /// attacker-controlled content, to enable DoS protection built into many + /// languages' hash-map implementations. + /// + /// This function is intended to only be called once, by a source language + /// to initialize Denial Of Service (DoS) protection in its hash-map + /// implementation. + /// + /// # Expected future evolution + /// + /// This will likely be changed to a value import, to prevent it from being + /// called multiple times and potentially used for purposes other than DoS + /// protection. + insecure-seed: func() -> tuple +} diff --git a/test/wit/deps/random/insecure.wit b/test/wit/deps/random/insecure.wit new file mode 100644 index 00000000..ff082682 --- /dev/null +++ b/test/wit/deps/random/insecure.wit @@ -0,0 +1,21 @@ +/// The insecure interface for insecure pseudo-random numbers. +/// +/// It is intended to be portable at least between Unix-family platforms and +/// Windows. +interface insecure { + /// Return `len` insecure pseudo-random bytes. + /// + /// This function is not cryptographically secure. Do not use it for + /// anything related to security. + /// + /// There are no requirements on the values of the returned bytes, however + /// implementations are encouraged to return evenly distributed values with + /// a long period. + get-insecure-random-bytes: func(len: u64) -> list + + /// Return an insecure pseudo-random `u64` value. + /// + /// This function returns the same type of pseudo-random data as + /// `get-insecure-random-bytes`, represented as a `u64`. + get-insecure-random-u64: func() -> u64 +} diff --git a/test/wit/deps/random/random.wit b/test/wit/deps/random/random.wit new file mode 100644 index 00000000..f2bd6358 --- /dev/null +++ b/test/wit/deps/random/random.wit @@ -0,0 +1,25 @@ +package wasi:random + +/// WASI Random is a random data API. +/// +/// It is intended to be portable at least between Unix-family platforms and +/// Windows. +interface random { + /// Return `len` cryptographically-secure pseudo-random bytes. + /// + /// This function must produce data from an adequately seeded + /// cryptographically-secure pseudo-random number generator (CSPRNG), so it + /// must not block, from the perspective of the calling program, and the + /// returned data is always unpredictable. + /// + /// This function must always return fresh pseudo-random data. Deterministic + /// environments must omit this function, rather than implementing it with + /// deterministic data. + get-random-bytes: func(len: u64) -> list + + /// Return a cryptographically-secure pseudo-random `u64` value. + /// + /// This function returns the same type of pseudo-random data as + /// `get-random-bytes`, represented as a `u64`. + get-random-u64: func() -> u64 +} diff --git a/test/wit/deps/sockets/instance-network.wit b/test/wit/deps/sockets/instance-network.wit new file mode 100644 index 00000000..d911a29c --- /dev/null +++ b/test/wit/deps/sockets/instance-network.wit @@ -0,0 +1,9 @@ + +/// This interface provides a value-export of the default network handle.. +interface instance-network { + use network.{network} + + /// Get a handle to the default network. + instance-network: func() -> network + +} diff --git a/test/wit/deps/sockets/ip-name-lookup.wit b/test/wit/deps/sockets/ip-name-lookup.wit new file mode 100644 index 00000000..6c64b461 --- /dev/null +++ b/test/wit/deps/sockets/ip-name-lookup.wit @@ -0,0 +1,69 @@ + +interface ip-name-lookup { + use wasi:poll/poll.{pollable} + use network.{network, error-code, ip-address, ip-address-family} + + + /// Resolve an internet host name to a list of IP addresses. + /// + /// See the wasi-socket proposal README.md for a comparison with getaddrinfo. + /// + /// # Parameters + /// - `name`: The name to look up. IP addresses are not allowed. Unicode domain names are automatically converted + /// to ASCII using IDNA encoding. + /// - `address-family`: If provided, limit the results to addresses of this specific address family. + /// - `include-unavailable`: When set to true, this function will also return addresses of which the runtime + /// thinks (or knows) can't be connected to at the moment. For example, this will return IPv6 addresses on + /// systems without an active IPv6 interface. Notes: + /// - Even when no public IPv6 interfaces are present or active, names like "localhost" can still resolve to an IPv6 address. + /// - Whatever is "available" or "unavailable" is volatile and can change everytime a network cable is unplugged. + /// + /// This function never blocks. It either immediately fails or immediately returns successfully with a `resolve-address-stream` + /// that can be used to (asynchronously) fetch the results. + /// + /// At the moment, the stream never completes successfully with 0 items. Ie. the first call + /// to `resolve-next-address` never returns `ok(none)`. This may change in the future. + /// + /// # Typical errors + /// - `invalid-name`: `name` is a syntactically invalid domain name. + /// - `invalid-name`: `name` is an IP address. + /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAI_FAMILY) + /// + /// # References: + /// - + /// - + /// - + /// - + resolve-addresses: func(network: network, name: string, address-family: option, include-unavailable: bool) -> result + + + + type resolve-address-stream = u32 + + /// Returns the next address from the resolver. + /// + /// This function should be called multiple times. On each call, it will + /// return the next address in connection order preference. If all + /// addresses have been exhausted, this function returns `none`. + /// After which, you should release the stream with `drop-resolve-address-stream`. + /// + /// This function never returns IPv4-mapped IPv6 addresses. + /// + /// # Typical errors + /// - `name-unresolvable`: Name does not exist or has no suitable associated IP addresses. (EAI_NONAME, EAI_NODATA, EAI_ADDRFAMILY) + /// - `temporary-resolver-failure`: A temporary failure in name resolution occurred. (EAI_AGAIN) + /// - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL) + /// - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN) + resolve-next-address: func(this: resolve-address-stream) -> result, error-code> + + /// Dispose of the specified `resolve-address-stream`, after which it may no longer be used. + /// + /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. + drop-resolve-address-stream: func(this: resolve-address-stream) + + /// Create a `pollable` which will resolve once the stream is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func(this: resolve-address-stream) -> pollable +} diff --git a/test/wit/deps/sockets/network.wit b/test/wit/deps/sockets/network.wit new file mode 100644 index 00000000..c370214c --- /dev/null +++ b/test/wit/deps/sockets/network.wit @@ -0,0 +1,187 @@ +package wasi:sockets + +interface network { + /// An opaque resource that represents access to (a subset of) the network. + /// This enables context-based security for networking. + /// There is no need for this to map 1:1 to a physical network interface. + /// + /// FYI, In the future this will be replaced by handle types. + type network = u32 + + /// Dispose of the specified `network`, after which it may no longer be used. + /// + /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. + drop-network: func(this: network) + + + /// Error codes. + /// + /// In theory, every API can return any error code. + /// In practice, API's typically only return the errors documented per API + /// combined with a couple of errors that are always possible: + /// - `unknown` + /// - `access-denied` + /// - `not-supported` + /// - `out-of-memory` + /// + /// See each individual API for what the POSIX equivalents are. They sometimes differ per API. + enum error-code { + // ### GENERAL ERRORS ### + + /// Unknown error + unknown, + + /// Access denied. + /// + /// POSIX equivalent: EACCES, EPERM + access-denied, + + /// The operation is not supported. + /// + /// POSIX equivalent: EOPNOTSUPP + not-supported, + + /// Not enough memory to complete the operation. + /// + /// POSIX equivalent: ENOMEM, ENOBUFS, EAI_MEMORY + out-of-memory, + + /// The operation timed out before it could finish completely. + timeout, + + /// This operation is incompatible with another asynchronous operation that is already in progress. + concurrency-conflict, + + /// Trying to finish an asynchronous operation that: + /// - has not been started yet, or: + /// - was already finished by a previous `finish-*` call. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + not-in-progress, + + /// The operation has been aborted because it could not be completed immediately. + /// + /// Note: this is scheduled to be removed when `future`s are natively supported. + would-block, + + + // ### IP ERRORS ### + + /// The specified address-family is not supported. + address-family-not-supported, + + /// An IPv4 address was passed to an IPv6 resource, or vice versa. + address-family-mismatch, + + /// The socket address is not a valid remote address. E.g. the IP address is set to INADDR_ANY, or the port is set to 0. + invalid-remote-address, + + /// The operation is only supported on IPv4 resources. + ipv4-only-operation, + + /// The operation is only supported on IPv6 resources. + ipv6-only-operation, + + + + // ### TCP & UDP SOCKET ERRORS ### + + /// A new socket resource could not be created because of a system limit. + new-socket-limit, + + /// The socket is already attached to another network. + already-attached, + + /// The socket is already bound. + already-bound, + + /// The socket is already in the Connection state. + already-connected, + + /// The socket is not bound to any local address. + not-bound, + + /// The socket is not in the Connection state. + not-connected, + + /// A bind operation failed because the provided address is not an address that the `network` can bind to. + address-not-bindable, + + /// A bind operation failed because the provided address is already in use. + address-in-use, + + /// A bind operation failed because there are no ephemeral ports available. + ephemeral-ports-exhausted, + + /// The remote address is not reachable + remote-unreachable, + + + // ### TCP SOCKET ERRORS ### + + /// The socket is already in the Listener state. + already-listening, + + /// The socket is already in the Listener state. + not-listening, + + /// The connection was forcefully rejected + connection-refused, + + /// The connection was reset. + connection-reset, + + + // ### UDP SOCKET ERRORS ### + datagram-too-large, + + + // ### NAME LOOKUP ERRORS ### + + /// The provided name is a syntactically invalid domain name. + invalid-name, + + /// Name does not exist or has no suitable associated IP addresses. + name-unresolvable, + + /// A temporary failure in name resolution occurred. + temporary-resolver-failure, + + /// A permanent failure in name resolution occurred. + permanent-resolver-failure, + } + + enum ip-address-family { + /// Similar to `AF_INET` in POSIX. + ipv4, + + /// Similar to `AF_INET6` in POSIX. + ipv6, + } + + type ipv4-address = tuple + type ipv6-address = tuple + + variant ip-address { + ipv4(ipv4-address), + ipv6(ipv6-address), + } + + record ipv4-socket-address { + port: u16, // sin_port + address: ipv4-address, // sin_addr + } + + record ipv6-socket-address { + port: u16, // sin6_port + flow-info: u32, // sin6_flowinfo + address: ipv6-address, // sin6_addr + scope-id: u32, // sin6_scope_id + } + + variant ip-socket-address { + ipv4(ipv4-socket-address), + ipv6(ipv6-socket-address), + } + +} diff --git a/test/wit/deps/sockets/tcp-create-socket.wit b/test/wit/deps/sockets/tcp-create-socket.wit new file mode 100644 index 00000000..f467d285 --- /dev/null +++ b/test/wit/deps/sockets/tcp-create-socket.wit @@ -0,0 +1,27 @@ + +interface tcp-create-socket { + use network.{network, error-code, ip-address-family} + use tcp.{tcp-socket} + + /// Create a new TCP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`listen`/`connect` + /// is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The host does not support TCP sockets. (EOPNOTSUPP) + /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References + /// - + /// - + /// - + /// - + create-tcp-socket: func(address-family: ip-address-family) -> result +} diff --git a/test/wit/deps/sockets/tcp.wit b/test/wit/deps/sockets/tcp.wit new file mode 100644 index 00000000..7ed46a69 --- /dev/null +++ b/test/wit/deps/sockets/tcp.wit @@ -0,0 +1,255 @@ + +interface tcp { + use wasi:io/streams.{input-stream, output-stream} + use wasi:poll/poll.{pollable} + use network.{network, error-code, ip-socket-address, ip-address-family} + + /// A TCP socket handle. + type tcp-socket = u32 + + + enum shutdown-type { + /// Similar to `SHUT_RD` in POSIX. + receive, + + /// Similar to `SHUT_WR` in POSIX. + send, + + /// Similar to `SHUT_RDWR` in POSIX. + both, + } + + + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the TCP/UDP port is zero, the socket will be bound to a random free port. + /// + /// When a socket is not explicitly bound, the first invocation to a listen or connect operation will + /// implicitly bind the socket. + /// + /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. + /// + /// # Typical `start` errors + /// - `address-family-mismatch`: The `local-address` has the wrong address family. (EINVAL) + /// - `already-bound`: The socket is already bound. (EINVAL) + /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + /// + /// # Typical `finish` errors + /// - `ephemeral-ports-exhausted`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(this: tcp-socket, network: network, local-address: ip-socket-address) -> result<_, error-code> + finish-bind: func(this: tcp-socket) -> result<_, error-code> + + /// Connect to a remote endpoint. + /// + /// On success: + /// - the socket is transitioned into the Connection state + /// - a pair of streams is returned that can be used to read & write to the connection + /// + /// # Typical `start` errors + /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EADDRNOTAVAIL on Windows) + /// - `invalid-remote-address`: The port in `remote-address` is set to 0. (EADDRNOTAVAIL on Windows) + /// - `already-attached`: The socket is already attached to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. + /// - `already-connected`: The socket is already in the Connection state. (EISCONN) + /// - `already-listening`: The socket is already in the Listener state. (EOPNOTSUPP, EINVAL on Windows) + /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + /// + /// # Typical `finish` errors + /// - `timeout`: Connection timed out. (ETIMEDOUT) + /// - `connection-refused`: The connection was forcefully rejected. (ECONNREFUSED) + /// - `connection-reset`: The connection was reset. (ECONNRESET) + /// - `remote-unreachable`: The remote address is not reachable. (EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN) + /// - `ephemeral-ports-exhausted`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `not-in-progress`: A `connect` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + start-connect: func(this: tcp-socket, network: network, remote-address: ip-socket-address) -> result<_, error-code> + finish-connect: func(this: tcp-socket) -> result, error-code> + + /// Start listening for new connections. + /// + /// Transitions the socket into the Listener state. + /// + /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. + /// + /// # Typical `start` errors + /// - `already-attached`: The socket is already attached to a different network. The `network` passed to `listen` must be identical to the one passed to `bind`. + /// - `already-connected`: The socket is already in the Connection state. (EISCONN, EINVAL on BSD) + /// - `already-listening`: The socket is already in the Listener state. + /// - `concurrency-conflict`: Another `bind`, `connect` or `listen` operation is already in progress. (EINVAL on BSD) + /// + /// # Typical `finish` errors + /// - `ephemeral-ports-exhausted`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE) + /// - `not-in-progress`: A `listen` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + start-listen: func(this: tcp-socket, network: network) -> result<_, error-code> + finish-listen: func(this: tcp-socket) -> result<_, error-code> + + /// Accept a new client socket. + /// + /// The returned socket is bound and in the Connection state. + /// + /// On success, this function returns the newly accepted client socket along with + /// a pair of streams that can be used to read & write to the connection. + /// + /// # Typical errors + /// - `not-listening`: Socket is not in the Listener state. (EINVAL) + /// - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN) + /// + /// Host implementations must skip over transient errors returned by the native accept syscall. + /// + /// # References + /// - + /// - + /// - + /// - + accept: func(this: tcp-socket) -> result, error-code> + + /// Get the bound local address. + /// + /// # Typical errors + /// - `not-bound`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func(this: tcp-socket) -> result + + /// Get the bound remote address. + /// + /// # Typical errors + /// - `not-connected`: The socket is not connected to a remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func(this: tcp-socket) -> result + + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func(this: tcp-socket) -> ip-address-family + + /// Whether IPv4 compatibility (dual-stack) mode is disabled or not. + /// + /// Equivalent to the IPV6_V6ONLY socket option. + /// + /// # Typical errors + /// - `ipv6-only-operation`: (get/set) `this` socket is an IPv4 socket. + /// - `already-bound`: (set) The socket is already bound. + /// - `not-supported`: (set) Host does not support dual-stack sockets. (Implementations are not required to.) + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + ipv6-only: func(this: tcp-socket) -> result + set-ipv6-only: func(this: tcp-socket, value: bool) -> result<_, error-code> + + /// Hints the desired listen queue size. Implementations are free to ignore this. + /// + /// # Typical errors + /// - `already-connected`: (set) The socket is already in the Connection state. + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + set-listen-backlog-size: func(this: tcp-socket, value: u64) -> result<_, error-code> + + /// Equivalent to the SO_KEEPALIVE socket option. + /// + /// # Typical errors + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + keep-alive: func(this: tcp-socket) -> result + set-keep-alive: func(this: tcp-socket, value: bool) -> result<_, error-code> + + /// Equivalent to the TCP_NODELAY socket option. + /// + /// # Typical errors + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + no-delay: func(this: tcp-socket) -> result + set-no-delay: func(this: tcp-socket, value: bool) -> result<_, error-code> + + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// # Typical errors + /// - `already-connected`: (set) The socket is already in the Connection state. + /// - `already-listening`: (set) The socket is already in the Listener state. + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + unicast-hop-limit: func(this: tcp-socket) -> result + set-unicast-hop-limit: func(this: tcp-socket, value: u8) -> result<_, error-code> + + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// Note #1: an implementation may choose to cap or round the buffer size when setting the value. + /// In other words, after setting a value, reading the same setting back may return a different value. + /// + /// Note #2: there is not necessarily a direct relationship between the kernel buffer size and the bytes of + /// actual data to be sent/received by the application, because the kernel might also use the buffer space + /// for internal metadata structures. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `already-connected`: (set) The socket is already in the Connection state. + /// - `already-listening`: (set) The socket is already in the Listener state. + /// - `concurrency-conflict`: (set) A `bind`, `connect` or `listen` operation is already in progress. (EALREADY) + receive-buffer-size: func(this: tcp-socket) -> result + set-receive-buffer-size: func(this: tcp-socket, value: u64) -> result<_, error-code> + send-buffer-size: func(this: tcp-socket) -> result + set-send-buffer-size: func(this: tcp-socket, value: u64) -> result<_, error-code> + + /// Create a `pollable` which will resolve once the socket is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func(this: tcp-socket) -> pollable + + /// Initiate a graceful shutdown. + /// + /// - receive: the socket is not expecting to receive any more data from the peer. All subsequent read + /// operations on the `input-stream` associated with this socket will return an End Of Stream indication. + /// Any data still in the receive queue at time of calling `shutdown` will be discarded. + /// - send: the socket is not expecting to send any more data to the peer. All subsequent write + /// operations on the `output-stream` associated with this socket will return an error. + /// - both: same effect as receive & send combined. + /// + /// The shutdown function does not close (drop) the socket. + /// + /// # Typical errors + /// - `not-connected`: The socket is not in the Connection state. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + shutdown: func(this: tcp-socket, shutdown-type: shutdown-type) -> result<_, error-code> + + /// Dispose of the specified `tcp-socket`, after which it may no longer be used. + /// + /// Similar to the POSIX `close` function. + /// + /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. + drop-tcp-socket: func(this: tcp-socket) +} diff --git a/test/wit/deps/sockets/udp-create-socket.wit b/test/wit/deps/sockets/udp-create-socket.wit new file mode 100644 index 00000000..1cfbd7f0 --- /dev/null +++ b/test/wit/deps/sockets/udp-create-socket.wit @@ -0,0 +1,27 @@ + +interface udp-create-socket { + use network.{network, error-code, ip-address-family} + use udp.{udp-socket} + + /// Create a new UDP socket. + /// + /// Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX. + /// + /// This function does not require a network capability handle. This is considered to be safe because + /// at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect` is called, + /// the socket is effectively an in-memory configuration object, unable to communicate with the outside world. + /// + /// All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations. + /// + /// # Typical errors + /// - `not-supported`: The host does not support UDP sockets. (EOPNOTSUPP) + /// - `address-family-not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT) + /// - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE) + /// + /// # References: + /// - + /// - + /// - + /// - + create-udp-socket: func(address-family: ip-address-family) -> result +} diff --git a/test/wit/deps/sockets/udp.wit b/test/wit/deps/sockets/udp.wit new file mode 100644 index 00000000..9dd4573b --- /dev/null +++ b/test/wit/deps/sockets/udp.wit @@ -0,0 +1,211 @@ + +interface udp { + use wasi:poll/poll.{pollable} + use network.{network, error-code, ip-socket-address, ip-address-family} + + + /// A UDP socket handle. + type udp-socket = u32 + + + record datagram { + data: list, // Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes. + remote-address: ip-socket-address, + + /// Possible future additions: + /// local-address: ip-socket-address, // IP_PKTINFO / IP_RECVDSTADDR / IPV6_PKTINFO + /// local-interface: u32, // IP_PKTINFO / IP_RECVIF + /// ttl: u8, // IP_RECVTTL + /// dscp: u6, // IP_RECVTOS + /// ecn: u2, // IP_RECVTOS + } + + + + /// Bind the socket to a specific network on the provided IP address and port. + /// + /// If the IP address is zero (`0.0.0.0` in IPv4, `::` in IPv6), it is left to the implementation to decide which + /// network interface(s) to bind to. + /// If the TCP/UDP port is zero, the socket will be bound to a random free port. + /// + /// When a socket is not explicitly bound, the first invocation to connect will implicitly bind the socket. + /// + /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. + /// + /// # Typical `start` errors + /// - `address-family-mismatch`: The `local-address` has the wrong address family. (EINVAL) + /// - `already-bound`: The socket is already bound. (EINVAL) + /// - `concurrency-conflict`: Another `bind` or `connect` operation is already in progress. (EALREADY) + /// + /// # Typical `finish` errors + /// - `ephemeral-ports-exhausted`: No ephemeral ports available. (EADDRINUSE, ENOBUFS on Windows) + /// - `address-in-use`: Address is already in use. (EADDRINUSE) + /// - `address-not-bindable`: `local-address` is not an address that the `network` can bind to. (EADDRNOTAVAIL) + /// - `not-in-progress`: A `bind` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + start-bind: func(this: udp-socket, network: network, local-address: ip-socket-address) -> result<_, error-code> + finish-bind: func(this: udp-socket) -> result<_, error-code> + + /// Set the destination address. + /// + /// The local-address is updated based on the best network path to `remote-address`. + /// + /// When a destination address is set: + /// - all receive operations will only return datagrams sent from the provided `remote-address`. + /// - the `send` function can only be used to send to this destination. + /// + /// Note that this function does not generate any network traffic and the peer is not aware of this "connection". + /// + /// Unlike in POSIX, this function is async. This enables interactive WASI hosts to inject permission prompts. + /// + /// # Typical `start` errors + /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-remote-address`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `already-attached`: The socket is already bound to a different network. The `network` passed to `connect` must be identical to the one passed to `bind`. + /// - `concurrency-conflict`: Another `bind` or `connect` operation is already in progress. (EALREADY) + /// + /// # Typical `finish` errors + /// - `ephemeral-ports-exhausted`: Tried to perform an implicit bind, but there were no ephemeral ports available. (EADDRINUSE, EADDRNOTAVAIL on Linux, EAGAIN on BSD) + /// - `not-in-progress`: A `connect` operation is not in progress. + /// - `would-block`: Can't finish the operation, it is still in progress. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + start-connect: func(this: udp-socket, network: network, remote-address: ip-socket-address) -> result<_, error-code> + finish-connect: func(this: udp-socket) -> result<_, error-code> + + /// Receive a message. + /// + /// Returns: + /// - The sender address of the datagram + /// - The number of bytes read. + /// + /// # Typical errors + /// - `not-bound`: The socket is not bound to any local address. (EINVAL) + /// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN) + /// - `would-block`: There is no pending data available to be read at the moment. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + receive: func(this: udp-socket) -> result + + /// Send a message to a specific destination address. + /// + /// The remote address option is required. To send a message to the "connected" peer, + /// call `remote-address` to get their address. + /// + /// # Typical errors + /// - `address-family-mismatch`: The `remote-address` has the wrong address family. (EAFNOSUPPORT) + /// - `invalid-remote-address`: The IP address in `remote-address` is set to INADDR_ANY (`0.0.0.0` / `::`). (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `invalid-remote-address`: The port in `remote-address` is set to 0. (EDESTADDRREQ, EADDRNOTAVAIL) + /// - `already-connected`: The socket is in "connected" mode and the `datagram.remote-address` does not match the address passed to `connect`. (EISCONN) + /// - `not-bound`: The socket is not bound to any local address. Unlike POSIX, this function does not perform an implicit bind. + /// - `remote-unreachable`: The remote address is not reachable. (ECONNREFUSED, ECONNRESET, ENETRESET on Windows, EHOSTUNREACH, EHOSTDOWN, ENETUNREACH, ENETDOWN) + /// - `datagram-too-large`: The datagram is too large. (EMSGSIZE) + /// - `would-block`: The send buffer is currently full. (EWOULDBLOCK, EAGAIN) + /// + /// # References + /// - + /// - + /// - + /// - + /// - + /// - + /// - + send: func(this: udp-socket, datagram: datagram) -> result<_, error-code> + + /// Get the current bound address. + /// + /// # Typical errors + /// - `not-bound`: The socket is not bound to any local address. + /// + /// # References + /// - + /// - + /// - + /// - + local-address: func(this: udp-socket) -> result + + /// Get the address set with `connect`. + /// + /// # Typical errors + /// - `not-connected`: The socket is not connected to a remote address. (ENOTCONN) + /// + /// # References + /// - + /// - + /// - + /// - + remote-address: func(this: udp-socket) -> result + + /// Whether this is a IPv4 or IPv6 socket. + /// + /// Equivalent to the SO_DOMAIN socket option. + address-family: func(this: udp-socket) -> ip-address-family + + /// Whether IPv4 compatibility (dual-stack) mode is disabled or not. + /// + /// Equivalent to the IPV6_V6ONLY socket option. + /// + /// # Typical errors + /// - `ipv6-only-operation`: (get/set) `this` socket is an IPv4 socket. + /// - `already-bound`: (set) The socket is already bound. + /// - `not-supported`: (set) Host does not support dual-stack sockets. (Implementations are not required to.) + /// - `concurrency-conflict`: (set) Another `bind` or `connect` operation is already in progress. (EALREADY) + ipv6-only: func(this: udp-socket) -> result + set-ipv6-only: func(this: udp-socket, value: bool) -> result<_, error-code> + + /// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options. + /// + /// # Typical errors + /// - `concurrency-conflict`: (set) Another `bind` or `connect` operation is already in progress. (EALREADY) + unicast-hop-limit: func(this: udp-socket) -> result + set-unicast-hop-limit: func(this: udp-socket, value: u8) -> result<_, error-code> + + /// The kernel buffer space reserved for sends/receives on this socket. + /// + /// Note #1: an implementation may choose to cap or round the buffer size when setting the value. + /// In other words, after setting a value, reading the same setting back may return a different value. + /// + /// Note #2: there is not necessarily a direct relationship between the kernel buffer size and the bytes of + /// actual data to be sent/received by the application, because the kernel might also use the buffer space + /// for internal metadata structures. + /// + /// Fails when this socket is in the Listening state. + /// + /// Equivalent to the SO_RCVBUF and SO_SNDBUF socket options. + /// + /// # Typical errors + /// - `concurrency-conflict`: (set) Another `bind` or `connect` operation is already in progress. (EALREADY) + receive-buffer-size: func(this: udp-socket) -> result + set-receive-buffer-size: func(this: udp-socket, value: u64) -> result<_, error-code> + send-buffer-size: func(this: udp-socket) -> result + set-send-buffer-size: func(this: udp-socket, value: u64) -> result<_, error-code> + + /// Create a `pollable` which will resolve once the socket is ready for I/O. + /// + /// Note: this function is here for WASI Preview2 only. + /// It's planned to be removed when `future` is natively supported in Preview3. + subscribe: func(this: udp-socket) -> pollable + + /// Dispose of the specified `udp-socket`, after which it may no longer be used. + /// + /// Note: this function is scheduled to be removed when Resources are natively supported in Wit. + drop-udp-socket: func(this: udp-socket) +} diff --git a/test/wit/deps/wasi-cli-base/environment.wit b/test/wit/deps/wasi-cli-base/environment.wit new file mode 100644 index 00000000..4c97c85d --- /dev/null +++ b/test/wit/deps/wasi-cli-base/environment.wit @@ -0,0 +1,16 @@ +package wasi:cli-base + +interface environment { + /// Get the POSIX-style environment variables. + /// + /// Each environment variable is provided as a pair of string variable names + /// and string value. + /// + /// Morally, these are a value import, but until value imports are available + /// in the component model, this import function should return the same + /// values each time it is called. + get-environment: func() -> list> + + /// Get the POSIX-style arguments to the program. + get-arguments: func() -> list +} diff --git a/test/wit/deps/wasi-cli-base/exit.wit b/test/wit/deps/wasi-cli-base/exit.wit new file mode 100644 index 00000000..66835aa7 --- /dev/null +++ b/test/wit/deps/wasi-cli-base/exit.wit @@ -0,0 +1,4 @@ +interface exit { + /// Exit the curerent instance and any linked instances. + exit: func(status: result) +} diff --git a/test/wit/deps/wasi-cli-base/preopens.wit b/test/wit/deps/wasi-cli-base/preopens.wit new file mode 100644 index 00000000..f268f6b0 --- /dev/null +++ b/test/wit/deps/wasi-cli-base/preopens.wit @@ -0,0 +1,7 @@ +interface preopens { + use wasi:filesystem/filesystem.{descriptor} + use wasi:io/streams.{input-stream, output-stream} + + /// Return the set of of preopened directories, and their path. + get-directories: func() -> list> +} diff --git a/test/wit/deps/wasi-cli-base/stdio.wit b/test/wit/deps/wasi-cli-base/stdio.wit new file mode 100644 index 00000000..6c9d4a41 --- /dev/null +++ b/test/wit/deps/wasi-cli-base/stdio.wit @@ -0,0 +1,17 @@ +interface stdin { + use wasi:io/streams.{input-stream} + + get-stdin: func() -> input-stream +} + +interface stdout { + use wasi:io/streams.{output-stream} + + get-stdout: func() -> output-stream +} + +interface stderr { + use wasi:io/streams.{output-stream} + + get-stderr: func() -> output-stream +} diff --git a/test/wit/test1.wit b/test/wit/test1.wit index e33b21a7..45f80ac9 100644 --- a/test/wit/test1.wit +++ b/test/wit/test1.wit @@ -1,23 +1,28 @@ -default world test1 { - import wall-clock: clocks.wall-clock - import monotonic-clock: clocks.monotonic-clock - import timezone: clocks.timezone - import filesystem: filesystem.filesystem - import instance-network: sockets.instance-network - import ip-name-lookup: sockets.ip-name-lookup - import network: sockets.network - import tcp-create-socket: sockets.tcp-create-socket - import tcp: sockets.tcp - import udp-create-socket: sockets.udp-create-socket - import udp: sockets.udp - import random: random.random - import poll: poll.poll - import streams: io.streams - import console: logging.handler - import default-outgoing-HTTP: http.outgoing-handler - import environment: wasi-cli-base.environment - import preopens: wasi-cli-base.preopens - import exit: wasi-cli-base.exit +package local:test1 + +world test1 { + import wasi:clocks/wall-clock + import wasi:clocks/monotonic-clock + import wasi:clocks/timezone + import wasi:filesystem/filesystem + import wasi:sockets/instance-network + import wasi:sockets/ip-name-lookup + import wasi:sockets/network + import wasi:sockets/tcp-create-socket + import wasi:sockets/tcp + import wasi:sockets/udp-create-socket + import wasi:sockets/udp + import wasi:random/random + import wasi:random/insecure + import wasi:random/insecure-seed + import wasi:poll/poll + import wasi:io/streams + import wasi:cli-base/environment + import wasi:cli-base/preopens + import wasi:cli-base/exit + import wasi:cli-base/stdin + import wasi:cli-base/stdout + import wasi:cli-base/stderr export test: func() -> string }