diff --git a/examples/components/add/package-lock.json b/examples/components/add/package-lock.json index 3dc933b26..986a519d6 100644 --- a/examples/components/add/package-lock.json +++ b/examples/components/add/package-lock.json @@ -6,36 +6,36 @@ "": { "name": "add-wasm", "devDependencies": { - "@bytecodealliance/componentize-js": "0.15.0", - "@bytecodealliance/jco": "1.8.1" + "@bytecodealliance/componentize-js": "0.16.0", + "@bytecodealliance/jco": "1.9.1" } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.0.tgz", - "integrity": "sha512-NyMsXJi4LxeGGYwmZR5c8Zq69scTgTmaXUOXeC4IDvDoLNz5qZdBqC8gjZnsqvRq69QFM2Hd3Xweb5P5AyEOGA==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.16.0.tgz", + "integrity": "sha512-x5vKTLd4I+ovC58l4zjld+XTJSve5Glblu7Ola/2v6vOh0YS2eODihDVLWkl4kd9GC/8OjxwEdE0pXelQt6ovw==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/jco": "^1.9.1", "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.8.1.tgz", - "integrity": "sha512-mYjE7lrSWEzFD6lAVA4skm9/6DvorFjuO5DHoxzwWlJ2hKyO/d9t0Wx1V0nT5L1s7+98ZtVSB1emYLNMebpMdA==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.9.1.tgz", + "integrity": "sha512-Xmd1iw2OrWhlLOPZraFTBuE1AGfMSQVqKzswmq3k1vQ5B0EJe8O1CFG/UJeRXwbq1fxHHS9DTtlfAZiTeOdLWQ==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/componentize-js": "^0.15.0", "@bytecodealliance/preview2-shim": "^0.17.1", "binaryen": "^120.0.0", "chalk-template": "^1", @@ -49,16 +49,16 @@ } }, "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/componentize-js": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz", - "integrity": "sha512-Y53lxcHEQz5k4PwqBY3+q6Y+TmFSu5mWhd+2dyURE7mk0GDaFYKRDoATCoXxD8Dvq/HgNPrDSE2X7AJIjPMtYQ==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.1.tgz", + "integrity": "sha512-bTQT+uwWNeyFXRiV6cp+5ERUKC2g6lyiMoeMys2/yg8IcWPwq+3btV1Pj/q0ueAwyiIsuQ//c+peMHPrNTmHOg==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.7.1", - "@bytecodealliance/weval": "^0.3.2", + "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } @@ -244,9 +244,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, "license": "MIT", "dependencies": { @@ -630,15 +630,15 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.5.tgz", - "integrity": "sha512-kwUxR7J9WLutBbulqg1dfOrMTwhMdXLdcGUhcbCcGwnPLt3gz19uHVdwH1syKVDbE022ZS2vZxOWflFLS0YTjw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.6.tgz", + "integrity": "sha512-z8YVS3XszxFTO73iwvFDNpQIzdMmSDTP/mB3E/ucR37V3Sx57hSExcXyMoNwaucWxnsWf4xfbZv0iZ30jr0M4Q==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.1.0", - "@emnapi/runtime": "^1.1.0", + "@emnapi/core": "^1.3.1", + "@emnapi/runtime": "^1.3.1", "@tybys/wasm-util": "^0.9.0" } }, @@ -797,9 +797,9 @@ "license": "MIT" }, "node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", "dev": true, "license": "MIT", "engines": { @@ -992,9 +992,9 @@ } }, "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", + "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", "dev": true, "license": "MIT" }, @@ -1256,9 +1256,9 @@ } }, "node_modules/ora": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.1.1.tgz", - "integrity": "sha512-YWielGi1XzG1UTvOaCFaNgEnuhZVMSHYkW/FQ7UX8O26PtlpdM84c0f7wLPlkvx2RfiQmnzd61d/MGxmpQeJPw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", + "integrity": "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==", "dev": true, "license": "MIT", "dependencies": { @@ -1536,9 +1536,9 @@ } }, "node_modules/terser": { - "version": "5.36.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.36.0.tgz", - "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.38.0.tgz", + "integrity": "sha512-a4GD5R1TjEeuCT6ZRiYMHmIf7okbCPEuhQET8bczV6FrQMMlFXA1n+G0KKjdlFCm3TEHV77GxfZB3vZSUQGFpg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { diff --git a/examples/components/add/package.json b/examples/components/add/package.json index 46d66933e..e527915b4 100644 --- a/examples/components/add/package.json +++ b/examples/components/add/package.json @@ -9,7 +9,7 @@ "all": "npm run build && npm run transpile && npm run transpiled-js" }, "devDependencies": { - "@bytecodealliance/jco": "1.8.1", - "@bytecodealliance/componentize-js": "0.15.0" + "@bytecodealliance/jco": "1.9.1", + "@bytecodealliance/componentize-js": "0.16.0" } } diff --git a/examples/components/http-hello-world/package-lock.json b/examples/components/http-hello-world/package-lock.json index 10880ebff..c525b196b 100644 --- a/examples/components/http-hello-world/package-lock.json +++ b/examples/components/http-hello-world/package-lock.json @@ -1,43 +1,43 @@ { - "name": "reverser-wasm", + "name": "http-hello-world-wasm", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "reverser-wasm", + "name": "http-hello-world-wasm", "devDependencies": { - "@bytecodealliance/componentize-js": "0.13.0", - "@bytecodealliance/jco": "1.7.0" + "@bytecodealliance/componentize-js": "0.16.0", + "@bytecodealliance/jco": "1.9.1" } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.13.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.13.0.tgz", - "integrity": "sha512-SBmuSiw2CQTBnmE5+944ujFG9VykovteE2q5XLsTblJgey67TAxrIjlLsygDypFbi2JUGNJJ6t9Y0HSarBgKxQ==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.16.0.tgz", + "integrity": "sha512-x5vKTLd4I+ovC58l4zjld+XTJSve5Glblu7Ola/2v6vOh0YS2eODihDVLWkl4kd9GC/8OjxwEdE0pXelQt6ovw==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.5.0", - "@bytecodealliance/weval": "^0.3.2", + "@bytecodealliance/jco": "^1.9.1", + "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.7.0.tgz", - "integrity": "sha512-DOoYzWmCjm5N3O1WE+g9VXUHXgKEJ3OatV3KhLYgaG1t9+sj+voS3PZA0JbWuA6vEkBT73Kg4yd4bJgIe1yFXA==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.9.1.tgz", + "integrity": "sha512-Xmd1iw2OrWhlLOPZraFTBuE1AGfMSQVqKzswmq3k1vQ5B0EJe8O1CFG/UJeRXwbq1fxHHS9DTtlfAZiTeOdLWQ==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.13.0", - "@bytecodealliance/preview2-shim": "^0.17.0", - "binaryen": "^119.0.0", + "@bytecodealliance/componentize-js": "^0.15.0", + "@bytecodealliance/preview2-shim": "^0.17.1", + "binaryen": "^120.0.0", "chalk-template": "^1", "commander": "^12", "mkdirp": "^3", @@ -48,17 +48,32 @@ "jco": "src/jco.js" } }, + "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/componentize-js": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.1.tgz", + "integrity": "sha512-bTQT+uwWNeyFXRiV6cp+5ERUKC2g6lyiMoeMys2/yg8IcWPwq+3btV1Pj/q0ueAwyiIsuQ//c+peMHPrNTmHOg==", + "dev": true, + "workspaces": [ + "." + ], + "dependencies": { + "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/weval": "^0.3.3", + "@bytecodealliance/wizer": "^7.0.5", + "es-module-lexer": "^1.5.4" + } + }, "node_modules/@bytecodealliance/preview2-shim": { - "version": "0.17.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.0.tgz", - "integrity": "sha512-JorcEwe4ud0x5BS/Ar2aQWOQoFzjq/7jcnxYXCvSMh0oRm0dQXzOA+hqLDBnOMks1LLBA7dmiLLsEBl09Yd6iQ==", + "version": "0.17.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/preview2-shim/-/preview2-shim-0.17.1.tgz", + "integrity": "sha512-h1qLL0TN5KXk/zagY2BtbZuDX6xYjz4Br9RZXEa0ID4UpiPc0agUMhTdz9r89G4vX5SU/tqBg1A6UNv2+DJ5pg==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)" }, "node_modules/@bytecodealliance/weval": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.3.2.tgz", - "integrity": "sha512-yH28sdq0Y0Oc29LbbWCEx2PvRFi0D7CEhWdNHPovl/L7thzlNlFWCRcOLanB0XgXQ5rygTpVVBFH0/50tWMg2w==", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@bytecodealliance/weval/-/weval-0.3.3.tgz", + "integrity": "sha512-hrQI47O1l3ilFscixu0uuSJTj5tbQW0QmCATQWWNW0E8wJxbKH4yo8y57O5gqpRSKk/T+da1sH/GJNrnGHTFNA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -195,9 +210,9 @@ } }, "node_modules/@emnapi/core": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.2.0.tgz", - "integrity": "sha512-E7Vgw78I93we4ZWdYCb4DGAwRROGkMIXk7/y87UmANR+J6qsWusmC3gLt0H+O0KOt5e6O38U8oJamgbudrES/w==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.3.1.tgz", + "integrity": "sha512-pVGjBIt1Y6gg3EJN8jTcfpP/+uuRksIo055oE/OBkDNcjZqVbfkWCksG1Jp4yZnj3iKWyWX8fdG/j6UDYPbFog==", "dev": true, "license": "MIT", "optional": true, @@ -207,9 +222,9 @@ } }, "node_modules/@emnapi/runtime": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.2.0.tgz", - "integrity": "sha512-bV21/9LQmcQeCPEg3BDFtvwL6cwiTMksYNWQQ4KOxCZikEGalWtenoZ0wCiukJINlGCIi2KXx01g4FoH/LxpzQ==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.3.1.tgz", + "integrity": "sha512-kEBmG8KyqtxJZv+ygbEim+KCGtIq1fC22Ms3S4ziXmYKm8uyoLX0MHONVKwp+9opg390VaKRNt4a7A9NwmpNhw==", "dev": true, "license": "MIT", "optional": true, @@ -229,9 +244,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, "license": "MIT", "dependencies": { @@ -615,15 +630,15 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.4.tgz", - "integrity": "sha512-9zESzOO5aDByvhIAsOy9TbpZ0Ur2AJbUI7UT73kcUTS2mxAMHOBaa1st/jAymNoCtvrit99kkzT1FZuXVcgfIQ==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.6.tgz", + "integrity": "sha512-z8YVS3XszxFTO73iwvFDNpQIzdMmSDTP/mB3E/ucR37V3Sx57hSExcXyMoNwaucWxnsWf4xfbZv0iZ30jr0M4Q==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.1.0", - "@emnapi/runtime": "^1.1.0", + "@emnapi/core": "^1.3.1", + "@emnapi/runtime": "^1.3.1", "@tybys/wasm-util": "^0.9.0" } }, @@ -639,9 +654,9 @@ } }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", + "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "dev": true, "license": "MIT", "bin": { @@ -686,9 +701,9 @@ "license": "MIT" }, "node_modules/binaryen": { - "version": "119.0.0", - "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-119.0.0.tgz", - "integrity": "sha512-DTdcs8ijrj2OIEftWVPVkYsgJ8MzlYH+uSsC8156g88E7CNaG8kEfWNGSXxb3tPlzadrm6sD3mgSEKKZJu4Q3g==", + "version": "120.0.0", + "resolved": "https://registry.npmjs.org/binaryen/-/binaryen-120.0.0.tgz", + "integrity": "sha512-MaNC1qW5ubk5S7MNNxNpAb9ivKp6TAf8CDknRk4XeCC2wkrpdaubK10S1CAwUXaDDF54gZLtk6opzbEA9VTtJw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -782,9 +797,9 @@ "license": "MIT" }, "node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", "dev": true, "license": "MIT", "engines": { @@ -1011,9 +1026,9 @@ "license": "MIT" }, "node_modules/get-east-asian-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", - "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.3.0.tgz", + "integrity": "sha512-vpeMIQKxczTD/0s2CdEWHcb0eeJe6TFjxb+J5xgX7hScxqrGuyjmv4c1D4A/gelKfyox0gJJwIHF+fLjeaM8kQ==", "dev": true, "license": "MIT", "engines": { @@ -1241,9 +1256,9 @@ } }, "node_modules/ora": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.1.0.tgz", - "integrity": "sha512-GQEkNkH/GHOhPFXcqZs3IDahXEQcQxsSjEkK4KvEEST4t7eNzoMjxTzef+EZ+JluDEV+Raoi3WQ2CflnRdSVnQ==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", + "integrity": "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==", "dev": true, "license": "MIT", "dependencies": { @@ -1521,9 +1536,9 @@ } }, "node_modules/terser": { - "version": "5.34.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.34.1.tgz", - "integrity": "sha512-FsJZ7iZLd/BXkz+4xrRTGJ26o/6VTjQytUk8b8OxkwcD2I+79VPJlz7qss1+zE7h8GNIScFqXcDyJ/KqBYZFVA==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.38.0.tgz", + "integrity": "sha512-a4GD5R1TjEeuCT6ZRiYMHmIf7okbCPEuhQET8bczV6FrQMMlFXA1n+G0KKjdlFCm3TEHV77GxfZB3vZSUQGFpg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { @@ -1561,9 +1576,9 @@ "license": "MIT" }, "node_modules/tslib": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.7.0.tgz", - "integrity": "sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA==", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "dev": true, "license": "0BSD", "optional": true diff --git a/examples/components/http-hello-world/package.json b/examples/components/http-hello-world/package.json index e35cec3c2..79ec6926e 100644 --- a/examples/components/http-hello-world/package.json +++ b/examples/components/http-hello-world/package.json @@ -3,12 +3,13 @@ "description": "Simple codebase for reversing a string via WebAssembly with jco", "type": "module", "scripts": { + "build:component": "jco componentize http-hello-world.js --wit wit/ --world-name component --out http-hello-world.wasm", "build": "jco componentize http-hello-world.js --wit wit/ --world-name component --out http-hello-world.wasm", "serve": "jco serve http-hello-world.wasm", "all": "npm run build" }, "devDependencies": { - "@bytecodealliance/jco": "1.8.1", - "@bytecodealliance/componentize-js": "0.15.0" + "@bytecodealliance/jco": "1.9.1", + "@bytecodealliance/componentize-js": "0.16.0" } } diff --git a/examples/components/http-hello-world/types/interfaces/wasi-clocks-monotonic-clock.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-clocks-monotonic-clock.d.ts deleted file mode 100644 index 8d6622ba7..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-clocks-monotonic-clock.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -export namespace WasiClocksMonotonicClock { - /** - * Read the current value of the clock. - * - * The clock is monotonic, therefore calling this function repeatedly will - * produce a sequence of non-decreasing values. - */ - export function now(): Instant; - /** - * Query the resolution of the clock. Returns the duration of time - * corresponding to a clock tick. - */ - export function resolution(): Duration; - /** - * Create a `pollable` which will resolve once the specified instant - * occured. - */ - export function subscribeInstant(when: Instant): Pollable; - /** - * Create a `pollable` which will resolve once the given duration has - * elapsed, starting at the time at which this function was called. - * occured. - */ - export function subscribeDuration(when: Duration): Pollable; -} -import type { Pollable } from './wasi-io-poll.js'; -export { Pollable }; -/** - * An instant in time, in nanoseconds. An instant is relative to an - * unspecified initial value, and can only be compared to instances from - * the same monotonic-clock. - */ -export type Instant = bigint; -/** - * A duration of time, in nanoseconds. - */ -export type Duration = bigint; diff --git a/examples/components/http-hello-world/types/interfaces/wasi-http-incoming-handler.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-http-incoming-handler.d.ts deleted file mode 100644 index cd927f7d3..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-http-incoming-handler.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -export namespace WasiHttpIncomingHandler { - /** - * This function is invoked with an incoming HTTP Request, and a resource - * `response-outparam` which provides the capability to reply with an HTTP - * Response. The response is sent by calling the `response-outparam.set` - * method, which allows execution to continue after the response has been - * sent. This enables both streaming to the response body, and performing other - * work. - * - * The implementor of this function must write a response to the - * `response-outparam` before returning, or else the caller will respond - * with an error on its behalf. - */ - export function handle(request: IncomingRequest, responseOut: ResponseOutparam): void; -} -import type { IncomingRequest } from './wasi-http-types.js'; -export { IncomingRequest }; -import type { ResponseOutparam } from './wasi-http-types.js'; -export { ResponseOutparam }; diff --git a/examples/components/http-hello-world/types/interfaces/wasi-http-types.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-http-types.d.ts deleted file mode 100644 index f2afd4bb3..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-http-types.d.ts +++ /dev/null @@ -1,713 +0,0 @@ -export namespace WasiHttpTypes { - export { Fields }; - export { IncomingRequest }; - export { OutgoingRequest }; - export { RequestOptions }; - export { ResponseOutparam }; - export { IncomingResponse }; - export { IncomingBody }; - export { FutureTrailers }; - export { OutgoingResponse }; - export { OutgoingBody }; - export { FutureIncomingResponse }; - /** - * Attempts to extract a http-related `error` from the wasi:io `error` - * provided. - * - * Stream operations which return - * `wasi:io/stream/stream-error::last-operation-failed` have a payload of - * type `wasi:io/error/error` with more information about the operation - * that failed. This payload can be passed through to this function to see - * if there's http-related information about the error to return. - * - * Note that this function is fallible because not all io-errors are - * http-related errors. - */ - export function httpErrorCode(err: IoError): ErrorCode | undefined; -} -import type { Duration } from './wasi-clocks-monotonic-clock.js'; -export { Duration }; -import type { InputStream } from './wasi-io-streams.js'; -export { InputStream }; -import type { OutputStream } from './wasi-io-streams.js'; -export { OutputStream }; -import type { Error as IoError } from './wasi-io-error.js'; -export { IoError }; -import type { Pollable } from './wasi-io-poll.js'; -export { Pollable }; -/** - * This type corresponds to HTTP standard Methods. - */ -export type Method = MethodGet | MethodHead | MethodPost | MethodPut | MethodDelete | MethodConnect | MethodOptions | MethodTrace | MethodPatch | MethodOther; -export interface MethodGet { - tag: 'get', -} -export interface MethodHead { - tag: 'head', -} -export interface MethodPost { - tag: 'post', -} -export interface MethodPut { - tag: 'put', -} -export interface MethodDelete { - tag: 'delete', -} -export interface MethodConnect { - tag: 'connect', -} -export interface MethodOptions { - tag: 'options', -} -export interface MethodTrace { - tag: 'trace', -} -export interface MethodPatch { - tag: 'patch', -} -export interface MethodOther { - tag: 'other', - val: string, -} -/** - * This type corresponds to HTTP standard Related Schemes. - */ -export type Scheme = SchemeHttp | SchemeHttps | SchemeOther; -export interface SchemeHttp { - tag: 'HTTP', -} -export interface SchemeHttps { - tag: 'HTTPS', -} -export interface SchemeOther { - tag: 'other', - val: string, -} -/** - * Defines the case payload type for `DNS-error` above: - */ -export interface DnsErrorPayload { - rcode?: string, - infoCode?: number, -} -/** - * Defines the case payload type for `TLS-alert-received` above: - */ -export interface TlsAlertReceivedPayload { - alertId?: number, - alertMessage?: string, -} -/** - * Defines the case payload type for `HTTP-response-{header,trailer}-size` above: - */ -export interface FieldSizePayload { - fieldName?: string, - fieldSize?: number, -} -/** - * These cases are inspired by the IANA HTTP Proxy Error Types: - * https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types - */ -export type ErrorCode = ErrorCodeDnsTimeout | ErrorCodeDnsError | ErrorCodeDestinationNotFound | ErrorCodeDestinationUnavailable | ErrorCodeDestinationIpProhibited | ErrorCodeDestinationIpUnroutable | ErrorCodeConnectionRefused | ErrorCodeConnectionTerminated | ErrorCodeConnectionTimeout | ErrorCodeConnectionReadTimeout | ErrorCodeConnectionWriteTimeout | ErrorCodeConnectionLimitReached | ErrorCodeTlsProtocolError | ErrorCodeTlsCertificateError | ErrorCodeTlsAlertReceived | ErrorCodeHttpRequestDenied | ErrorCodeHttpRequestLengthRequired | ErrorCodeHttpRequestBodySize | ErrorCodeHttpRequestMethodInvalid | ErrorCodeHttpRequestUriInvalid | ErrorCodeHttpRequestUriTooLong | ErrorCodeHttpRequestHeaderSectionSize | ErrorCodeHttpRequestHeaderSize | ErrorCodeHttpRequestTrailerSectionSize | ErrorCodeHttpRequestTrailerSize | ErrorCodeHttpResponseIncomplete | ErrorCodeHttpResponseHeaderSectionSize | ErrorCodeHttpResponseHeaderSize | ErrorCodeHttpResponseBodySize | ErrorCodeHttpResponseTrailerSectionSize | ErrorCodeHttpResponseTrailerSize | ErrorCodeHttpResponseTransferCoding | ErrorCodeHttpResponseContentCoding | ErrorCodeHttpResponseTimeout | ErrorCodeHttpUpgradeFailed | ErrorCodeHttpProtocolError | ErrorCodeLoopDetected | ErrorCodeConfigurationError | ErrorCodeInternalError; -export interface ErrorCodeDnsTimeout { - tag: 'DNS-timeout', -} -export interface ErrorCodeDnsError { - tag: 'DNS-error', - val: DnsErrorPayload, -} -export interface ErrorCodeDestinationNotFound { - tag: 'destination-not-found', -} -export interface ErrorCodeDestinationUnavailable { - tag: 'destination-unavailable', -} -export interface ErrorCodeDestinationIpProhibited { - tag: 'destination-IP-prohibited', -} -export interface ErrorCodeDestinationIpUnroutable { - tag: 'destination-IP-unroutable', -} -export interface ErrorCodeConnectionRefused { - tag: 'connection-refused', -} -export interface ErrorCodeConnectionTerminated { - tag: 'connection-terminated', -} -export interface ErrorCodeConnectionTimeout { - tag: 'connection-timeout', -} -export interface ErrorCodeConnectionReadTimeout { - tag: 'connection-read-timeout', -} -export interface ErrorCodeConnectionWriteTimeout { - tag: 'connection-write-timeout', -} -export interface ErrorCodeConnectionLimitReached { - tag: 'connection-limit-reached', -} -export interface ErrorCodeTlsProtocolError { - tag: 'TLS-protocol-error', -} -export interface ErrorCodeTlsCertificateError { - tag: 'TLS-certificate-error', -} -export interface ErrorCodeTlsAlertReceived { - tag: 'TLS-alert-received', - val: TlsAlertReceivedPayload, -} -export interface ErrorCodeHttpRequestDenied { - tag: 'HTTP-request-denied', -} -export interface ErrorCodeHttpRequestLengthRequired { - tag: 'HTTP-request-length-required', -} -export interface ErrorCodeHttpRequestBodySize { - tag: 'HTTP-request-body-size', - val: bigint | undefined, -} -export interface ErrorCodeHttpRequestMethodInvalid { - tag: 'HTTP-request-method-invalid', -} -export interface ErrorCodeHttpRequestUriInvalid { - tag: 'HTTP-request-URI-invalid', -} -export interface ErrorCodeHttpRequestUriTooLong { - tag: 'HTTP-request-URI-too-long', -} -export interface ErrorCodeHttpRequestHeaderSectionSize { - tag: 'HTTP-request-header-section-size', - val: number | undefined, -} -export interface ErrorCodeHttpRequestHeaderSize { - tag: 'HTTP-request-header-size', - val: FieldSizePayload | undefined, -} -export interface ErrorCodeHttpRequestTrailerSectionSize { - tag: 'HTTP-request-trailer-section-size', - val: number | undefined, -} -export interface ErrorCodeHttpRequestTrailerSize { - tag: 'HTTP-request-trailer-size', - val: FieldSizePayload, -} -export interface ErrorCodeHttpResponseIncomplete { - tag: 'HTTP-response-incomplete', -} -export interface ErrorCodeHttpResponseHeaderSectionSize { - tag: 'HTTP-response-header-section-size', - val: number | undefined, -} -export interface ErrorCodeHttpResponseHeaderSize { - tag: 'HTTP-response-header-size', - val: FieldSizePayload, -} -export interface ErrorCodeHttpResponseBodySize { - tag: 'HTTP-response-body-size', - val: bigint | undefined, -} -export interface ErrorCodeHttpResponseTrailerSectionSize { - tag: 'HTTP-response-trailer-section-size', - val: number | undefined, -} -export interface ErrorCodeHttpResponseTrailerSize { - tag: 'HTTP-response-trailer-size', - val: FieldSizePayload, -} -export interface ErrorCodeHttpResponseTransferCoding { - tag: 'HTTP-response-transfer-coding', - val: string | undefined, -} -export interface ErrorCodeHttpResponseContentCoding { - tag: 'HTTP-response-content-coding', - val: string | undefined, -} -export interface ErrorCodeHttpResponseTimeout { - tag: 'HTTP-response-timeout', -} -export interface ErrorCodeHttpUpgradeFailed { - tag: 'HTTP-upgrade-failed', -} -export interface ErrorCodeHttpProtocolError { - tag: 'HTTP-protocol-error', -} -export interface ErrorCodeLoopDetected { - tag: 'loop-detected', -} -export interface ErrorCodeConfigurationError { - tag: 'configuration-error', -} -/** - * This is a catch-all error for anything that doesn't fit cleanly into a - * more specific case. It also includes an optional string for an - * unstructured description of the error. Users should not depend on the - * string for diagnosing errors, as it's not required to be consistent - * between implementations. - */ -export interface ErrorCodeInternalError { - tag: 'internal-error', - val: string | undefined, -} -/** - * This type enumerates the different kinds of errors that may occur when - * setting or appending to a `fields` resource. - */ -export type HeaderError = HeaderErrorInvalidSyntax | HeaderErrorForbidden | HeaderErrorImmutable; -/** - * This error indicates that a `field-key` or `field-value` was - * syntactically invalid when used with an operation that sets headers in a - * `fields`. - */ -export interface HeaderErrorInvalidSyntax { - tag: 'invalid-syntax', -} -/** - * This error indicates that a forbidden `field-key` was used when trying - * to set a header in a `fields`. - */ -export interface HeaderErrorForbidden { - tag: 'forbidden', -} -/** - * This error indicates that the operation on the `fields` was not - * permitted because the fields are immutable. - */ -export interface HeaderErrorImmutable { - tag: 'immutable', -} -/** - * Field keys are always strings. - */ -export type FieldKey = string; -/** - * Field values should always be ASCII strings. However, in - * reality, HTTP implementations often have to interpret malformed values, - * so they are provided as a list of bytes. - */ -export type FieldValue = Uint8Array; -/** - * Headers is an alias for Fields. - */ -export type Headers = Fields; -/** - * Trailers is an alias for Fields. - */ -export type Trailers = Fields; -/** - * This type corresponds to the HTTP standard Status Code. - */ -export type StatusCode = number; -export type Result = { tag: 'ok', val: T } | { tag: 'err', val: E }; - -export class Fields { - /** - * Construct an empty HTTP Fields. - * - * The resulting `fields` is mutable. - */ - constructor() - /** - * Construct an HTTP Fields. - * - * The resulting `fields` is mutable. - * - * The list represents each key-value pair in the Fields. Keys - * which have multiple values are represented by multiple entries in this - * list with the same key. - * - * The tuple is a pair of the field key, represented as a string, and - * Value, represented as a list of bytes. In a valid Fields, all keys - * and values are valid UTF-8 strings. However, values are not always - * well-formed, so they are represented as a raw list of bytes. - * - * An error result will be returned if any header or value was - * syntactically invalid, or if a header was forbidden. - */ - static fromList(entries: Array<[FieldKey, FieldValue]>): Fields; - /** - * Get all of the values corresponding to a key. If the key is not present - * in this `fields`, an empty list is returned. However, if the key is - * present but empty, this is represented by a list with one or more - * empty field-values present. - */ - get(name: FieldKey): Array; - /** - * Returns `true` when the key is present in this `fields`. If the key is - * syntactically invalid, `false` is returned. - */ - has(name: FieldKey): boolean; - /** - * Set all of the values for a key. Clears any existing values for that - * key, if they have been set. - * - * Fails with `header-error.immutable` if the `fields` are immutable. - */ - set(name: FieldKey, value: Array): void; - /** - * Delete all values for a key. Does nothing if no values for the key - * exist. - * - * Fails with `header-error.immutable` if the `fields` are immutable. - */ - 'delete'(name: FieldKey): void; - /** - * Append a value for a key. Does not change or delete any existing - * values for that key. - * - * Fails with `header-error.immutable` if the `fields` are immutable. - */ - append(name: FieldKey, value: FieldValue): void; - /** - * Retrieve the full set of keys and values in the Fields. Like the - * constructor, the list represents each key-value pair. - * - * The outer list represents each key-value pair in the Fields. Keys - * which have multiple values are represented by multiple entries in this - * list with the same key. - */ - entries(): Array<[FieldKey, FieldValue]>; - /** - * Make a deep copy of the Fields. Equivelant in behavior to calling the - * `fields` constructor on the return value of `entries`. The resulting - * `fields` is mutable. - */ - clone(): Fields; -} - -export class FutureIncomingResponse { - /** - * Returns a pollable which becomes ready when either the Response has - * been received, or an error has occured. When this pollable is ready, - * the `get` method will return `some`. - */ - subscribe(): Pollable; - /** - * Returns the incoming HTTP Response, or an error, once one is ready. - * - * The outer `option` represents future readiness. Users can wait on this - * `option` to become `some` using the `subscribe` method. - * - * The outer `result` is used to retrieve the response or error at most - * once. It will be success on the first call in which the outer option - * is `some`, and error on subsequent calls. - * - * The inner `result` represents that either the incoming HTTP Response - * status and headers have recieved successfully, or that an error - * occured. Errors may also occur while consuming the response body, - * but those will be reported by the `incoming-body` and its - * `output-stream` child. - */ - get(): Result, void> | undefined; -} - -export class FutureTrailers { - /** - * Returns a pollable which becomes ready when either the trailers have - * been received, or an error has occured. When this pollable is ready, - * the `get` method will return `some`. - */ - subscribe(): Pollable; - /** - * Returns the contents of the trailers, or an error which occured, - * once the future is ready. - * - * The outer `option` represents future readiness. Users can wait on this - * `option` to become `some` using the `subscribe` method. - * - * The outer `result` is used to retrieve the trailers or error at most - * once. It will be success on the first call in which the outer option - * is `some`, and error on subsequent calls. - * - * The inner `result` represents that either the HTTP Request or Response - * body, as well as any trailers, were received successfully, or that an - * error occured receiving them. The optional `trailers` indicates whether - * or not trailers were present in the body. - * - * When some `trailers` are returned by this method, the `trailers` - * resource is immutable, and a child. Use of the `set`, `append`, or - * `delete` methods will return an error, and the resource must be - * dropped before the parent `future-trailers` is dropped. - */ - get(): Result, void> | undefined; -} - -export class IncomingBody { - /** - * Returns the contents of the body, as a stream of bytes. - * - * Returns success on first call: the stream representing the contents - * can be retrieved at most once. Subsequent calls will return error. - * - * The returned `input-stream` resource is a child: it must be dropped - * before the parent `incoming-body` is dropped, or consumed by - * `incoming-body.finish`. - * - * This invariant ensures that the implementation can determine whether - * the user is consuming the contents of the body, waiting on the - * `future-trailers` to be ready, or neither. This allows for network - * backpressure is to be applied when the user is consuming the body, - * and for that backpressure to not inhibit delivery of the trailers if - * the user does not read the entire body. - */ - stream(): InputStream; - /** - * Takes ownership of `incoming-body`, and returns a `future-trailers`. - * This function will trap if the `input-stream` child is still alive. - */ - static finish(this_: IncomingBody): FutureTrailers; -} - -export class IncomingRequest { - /** - * Returns the method of the incoming request. - */ - method(): Method; - /** - * Returns the path with query parameters from the request, as a string. - */ - pathWithQuery(): string | undefined; - /** - * Returns the protocol scheme from the request. - */ - scheme(): Scheme | undefined; - /** - * Returns the authority from the request, if it was present. - */ - authority(): string | undefined; - /** - * Get the `headers` associated with the request. - * - * The returned `headers` resource is immutable: `set`, `append`, and - * `delete` operations will fail with `header-error.immutable`. - * - * The `headers` returned are a child resource: it must be dropped before - * the parent `incoming-request` is dropped. Dropping this - * `incoming-request` before all children are dropped will trap. - */ - headers(): Headers; - /** - * Gives the `incoming-body` associated with this request. Will only - * return success at most once, and subsequent calls will return error. - */ - consume(): IncomingBody; -} - -export class IncomingResponse { - /** - * Returns the status code from the incoming response. - */ - status(): StatusCode; - /** - * Returns the headers from the incoming response. - * - * The returned `headers` resource is immutable: `set`, `append`, and - * `delete` operations will fail with `header-error.immutable`. - * - * This headers resource is a child: it must be dropped before the parent - * `incoming-response` is dropped. - */ - headers(): Headers; - /** - * Returns the incoming body. May be called at most once. Returns error - * if called additional times. - */ - consume(): IncomingBody; -} - -export class OutgoingBody { - /** - * Returns a stream for writing the body contents. - * - * The returned `output-stream` is a child resource: it must be dropped - * before the parent `outgoing-body` resource is dropped (or finished), - * otherwise the `outgoing-body` drop or `finish` will trap. - * - * Returns success on the first call: the `output-stream` resource for - * this `outgoing-body` may be retrieved at most once. Subsequent calls - * will return error. - */ - write(): OutputStream; - /** - * Finalize an outgoing body, optionally providing trailers. This must be - * called to signal that the response is complete. If the `outgoing-body` - * is dropped without calling `outgoing-body.finalize`, the implementation - * should treat the body as corrupted. - * - * Fails if the body's `outgoing-request` or `outgoing-response` was - * constructed with a Content-Length header, and the contents written - * to the body (via `write`) does not match the value given in the - * Content-Length. - */ - static finish(this_: OutgoingBody, trailers: Trailers | undefined): void; -} - -export class OutgoingRequest { - /** - * Construct a new `outgoing-request` with a default `method` of `GET`, and - * `none` values for `path-with-query`, `scheme`, and `authority`. - * - * * `headers` is the HTTP Headers for the Request. - * - * It is possible to construct, or manipulate with the accessor functions - * below, an `outgoing-request` with an invalid combination of `scheme` - * and `authority`, or `headers` which are not permitted to be sent. - * It is the obligation of the `outgoing-handler.handle` implementation - * to reject invalid constructions of `outgoing-request`. - */ - constructor(headers: Headers) - /** - * Returns the resource corresponding to the outgoing Body for this - * Request. - * - * Returns success on the first call: the `outgoing-body` resource for - * this `outgoing-request` can be retrieved at most once. Subsequent - * calls will return error. - */ - body(): OutgoingBody; - /** - * Get the Method for the Request. - */ - method(): Method; - /** - * Set the Method for the Request. Fails if the string present in a - * `method.other` argument is not a syntactically valid method. - */ - setMethod(method: Method): void; - /** - * Get the combination of the HTTP Path and Query for the Request. - * When `none`, this represents an empty Path and empty Query. - */ - pathWithQuery(): string | undefined; - /** - * Set the combination of the HTTP Path and Query for the Request. - * When `none`, this represents an empty Path and empty Query. Fails is the - * string given is not a syntactically valid path and query uri component. - */ - setPathWithQuery(pathWithQuery: string | undefined): void; - /** - * Get the HTTP Related Scheme for the Request. When `none`, the - * implementation may choose an appropriate default scheme. - */ - scheme(): Scheme | undefined; - /** - * Set the HTTP Related Scheme for the Request. When `none`, the - * implementation may choose an appropriate default scheme. Fails if the - * string given is not a syntactically valid uri scheme. - */ - setScheme(scheme: Scheme | undefined): void; - /** - * Get the HTTP Authority for the Request. A value of `none` may be used - * with Related Schemes which do not require an Authority. The HTTP and - * HTTPS schemes always require an authority. - */ - authority(): string | undefined; - /** - * Set the HTTP Authority for the Request. A value of `none` may be used - * with Related Schemes which do not require an Authority. The HTTP and - * HTTPS schemes always require an authority. Fails if the string given is - * not a syntactically valid uri authority. - */ - setAuthority(authority: string | undefined): void; - /** - * Get the headers associated with the Request. - * - * The returned `headers` resource is immutable: `set`, `append`, and - * `delete` operations will fail with `header-error.immutable`. - * - * This headers resource is a child: it must be dropped before the parent - * `outgoing-request` is dropped, or its ownership is transfered to - * another component by e.g. `outgoing-handler.handle`. - */ - headers(): Headers; -} - -export class OutgoingResponse { - /** - * Construct an `outgoing-response`, with a default `status-code` of `200`. - * If a different `status-code` is needed, it must be set via the - * `set-status-code` method. - * - * * `headers` is the HTTP Headers for the Response. - */ - constructor(headers: Headers) - /** - * Get the HTTP Status Code for the Response. - */ - statusCode(): StatusCode; - /** - * Set the HTTP Status Code for the Response. Fails if the status-code - * given is not a valid http status code. - */ - setStatusCode(statusCode: StatusCode): void; - /** - * Get the headers associated with the Request. - * - * The returned `headers` resource is immutable: `set`, `append`, and - * `delete` operations will fail with `header-error.immutable`. - * - * This headers resource is a child: it must be dropped before the parent - * `outgoing-request` is dropped, or its ownership is transfered to - * another component by e.g. `outgoing-handler.handle`. - */ - headers(): Headers; - /** - * Returns the resource corresponding to the outgoing Body for this Response. - * - * Returns success on the first call: the `outgoing-body` resource for - * this `outgoing-response` can be retrieved at most once. Subsequent - * calls will return error. - */ - body(): OutgoingBody; -} - -export class RequestOptions { - /** - * Construct a default `request-options` value. - */ - constructor() - /** - * The timeout for the initial connect to the HTTP Server. - */ - connectTimeout(): Duration | undefined; - /** - * Set the timeout for the initial connect to the HTTP Server. An error - * return value indicates that this timeout is not supported. - */ - setConnectTimeout(duration: Duration | undefined): void; - /** - * The timeout for receiving the first byte of the Response body. - */ - firstByteTimeout(): Duration | undefined; - /** - * Set the timeout for receiving the first byte of the Response body. An - * error return value indicates that this timeout is not supported. - */ - setFirstByteTimeout(duration: Duration | undefined): void; - /** - * The timeout for receiving subsequent chunks of bytes in the Response - * body stream. - */ - betweenBytesTimeout(): Duration | undefined; - /** - * Set the timeout for receiving subsequent chunks of bytes in the Response - * body stream. An error return value indicates that this timeout is not - * supported. - */ - setBetweenBytesTimeout(duration: Duration | undefined): void; -} - -export class ResponseOutparam { - /** - * Set the value of the `response-outparam` to either send a response, - * or indicate an error. - * - * This method consumes the `response-outparam` to ensure that it is - * called at most once. If it is never called, the implementation - * will respond with an error. - * - * The user may provide an `error` to `response` to allow the - * implementation determine how to respond with an HTTP error response. - */ - static set(param: ResponseOutparam, response: Result): void; -} diff --git a/examples/components/http-hello-world/types/interfaces/wasi-io-error.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-io-error.d.ts deleted file mode 100644 index e0dbb1c22..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-io-error.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -export namespace WasiIoError { - export { Error }; -} - -export class Error { - /** - * Returns a string that is suitable to assist humans in debugging - * this error. - * - * WARNING: The returned string should not be consumed mechanically! - * It may change across platforms, hosts, or other implementation - * details. Parsing this string is a major platform-compatibility - * hazard. - */ - toDebugString(): string; -} diff --git a/examples/components/http-hello-world/types/interfaces/wasi-io-poll.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-io-poll.d.ts deleted file mode 100644 index 78a569d73..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-io-poll.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -export namespace WasiIoPoll { - export { Pollable }; - /** - * Poll for completion on a set of pollables. - * - * This function takes a list of pollables, which identify I/O sources of - * interest, and waits until one or more of the events is ready for I/O. - * - * The result `list` contains one or more indices of handles in the - * argument list that is ready for I/O. - * - * If the list contains more elements than can be indexed with a `u32` - * value, this function traps. - * - * A timeout can be implemented by adding a pollable from the - * wasi-clocks API to the list. - * - * This function does not return a `result`; polling in itself does not - * do any I/O so it doesn't fail. If any of the I/O sources identified by - * the pollables has an error, it is indicated by marking the source as - * being reaedy for I/O. - */ - export function poll(in_: Array): Uint32Array; -} - -export class Pollable { - /** - * Return the readiness of a pollable. This function never blocks. - * - * Returns `true` when the pollable is ready, and `false` otherwise. - */ - ready(): boolean; - /** - * `block` returns immediately if the pollable is ready, and otherwise - * blocks until ready. - * - * This function is equivalent to calling `poll.poll` on a list - * containing only this pollable. - */ - block(): void; -} diff --git a/examples/components/http-hello-world/types/interfaces/wasi-io-streams.d.ts b/examples/components/http-hello-world/types/interfaces/wasi-io-streams.d.ts deleted file mode 100644 index 46500e742..000000000 --- a/examples/components/http-hello-world/types/interfaces/wasi-io-streams.d.ts +++ /dev/null @@ -1,237 +0,0 @@ -export namespace WasiIoStreams { - export { InputStream }; - export { OutputStream }; -} -import type { Error } from './wasi-io-error.js'; -export { Error }; -import type { Pollable } from './wasi-io-poll.js'; -export { Pollable }; -/** - * An error for input-stream and output-stream operations. - */ -export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed; -/** - * The last operation (a write or flush) failed before completion. - * - * More information is available in the `error` payload. - */ -export interface StreamErrorLastOperationFailed { - tag: 'last-operation-failed', - val: Error, -} -/** - * The stream is closed: no more input will be accepted by the - * stream. A closed output-stream will return this error on all - * future operations. - */ -export interface StreamErrorClosed { - tag: 'closed', -} - -export class InputStream { - /** - * Perform a non-blocking read from the stream. - * - * When the source of a `read` is binary data, the bytes from the source - * are returned verbatim. When the source of a `read` is known to the - * implementation to be text, bytes containing the UTF-8 encoding of the - * text are returned. - * - * This function returns a list of bytes containing the read data, - * when successful. The returned list will contain up to `len` bytes; - * it may return fewer than requested, but not more. The list is - * empty when no bytes are available for reading at this time. The - * pollable given by `subscribe` will be ready when more bytes are - * available. - * - * This function fails with a `stream-error` when the operation - * encounters an error, giving `last-operation-failed`, or when the - * stream is closed, giving `closed`. - * - * When the caller gives a `len` of 0, it represents a request to - * read 0 bytes. If the stream is still open, this call should - * succeed and return an empty list, or otherwise fail with `closed`. - * - * The `len` parameter is a `u64`, which could represent a list of u8 which - * is not possible to allocate in wasm32, or not desirable to allocate as - * as a return value by the callee. The callee may return a list of bytes - * less than `len` in size while more bytes are available for reading. - */ - read(len: bigint): Uint8Array; - /** - * Read bytes from a stream, after blocking until at least one byte can - * be read. Except for blocking, behavior is identical to `read`. - */ - blockingRead(len: bigint): Uint8Array; - /** - * Skip bytes from a stream. Returns number of bytes skipped. - * - * Behaves identical to `read`, except instead of returning a list - * of bytes, returns the number of bytes consumed from the stream. - */ - skip(len: bigint): bigint; - /** - * Skip bytes from a stream, after blocking until at least one byte - * can be skipped. Except for blocking behavior, identical to `skip`. - */ - blockingSkip(len: bigint): bigint; - /** - * 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. - * The created `pollable` is a child resource of the `input-stream`. - * Implementations may trap if the `input-stream` is dropped before - * all derived `pollable`s created with this function are dropped. - */ - subscribe(): Pollable; -} - -export class OutputStream { - /** - * Check readiness for writing. This function never blocks. - * - * Returns the number of bytes permitted for the next call to `write`, - * or an error. Calling `write` with more bytes than this function has - * permitted will trap. - * - * When this function returns 0 bytes, the `subscribe` pollable will - * become ready when this function will report at least 1 byte, or an - * error. - */ - checkWrite(): bigint; - /** - * Perform a write. This function never blocks. - * - * When the destination of a `write` is binary data, the bytes from - * `contents` are written verbatim. When the destination of a `write` is - * known to the implementation to be text, the bytes of `contents` are - * transcoded from UTF-8 into the encoding of the destination and then - * written. - * - * Precondition: check-write gave permit of Ok(n) and contents has a - * length of less than or equal to n. Otherwise, this function will trap. - * - * returns Err(closed) without writing if the stream has closed since - * the last call to check-write provided a permit. - */ - write(contents: Uint8Array): void; - /** - * Perform a write of up to 4096 bytes, and then flush the stream. Block - * until all of these operations are complete, or an error occurs. - * - * This is a convenience wrapper around the use of `check-write`, - * `subscribe`, `write`, and `flush`, and is implemented with the - * following pseudo-code: - * - * ```text - * let pollable = this.subscribe(); - * while !contents.is_empty() { - * // Wait for the stream to become writable - * pollable.block(); - * let Ok(n) = this.check-write(); // eliding error handling - * let len = min(n, contents.len()); - * let (chunk, rest) = contents.split_at(len); - * this.write(chunk ); // eliding error handling - * contents = rest; - * } - * this.flush(); - * // Wait for completion of `flush` - * pollable.block(); - * // Check for any errors that arose during `flush` - * let _ = this.check-write(); // eliding error handling - * ``` - */ - blockingWriteAndFlush(contents: Uint8Array): void; - /** - * Request to flush buffered output. This function never blocks. - * - * This tells the output-stream that the caller intends any buffered - * output to be flushed. the output which is expected to be flushed - * is all that has been passed to `write` prior to this call. - * - * Upon calling this function, the `output-stream` will not accept any - * writes (`check-write` will return `ok(0)`) until the flush has - * completed. The `subscribe` pollable will become ready when the - * flush has completed and the stream can accept more writes. - */ - flush(): void; - /** - * Request to flush buffered output, and block until flush completes - * and stream is ready for writing again. - */ - blockingFlush(): void; - /** - * Create a `pollable` which will resolve once the output-stream - * is ready for more writing, or an error has occured. When this - * pollable is ready, `check-write` will return `ok(n)` with n>0, or an - * error. - * - * If the stream is closed, this pollable is always ready immediately. - * - * The created `pollable` is a child resource of the `output-stream`. - * Implementations may trap if the `output-stream` is dropped before - * all derived `pollable`s created with this function are dropped. - */ - subscribe(): Pollable; - /** - * Write zeroes to a stream. - * - * This should be used precisely like `write` with the exact same - * preconditions (must use check-write first), but instead of - * passing a list of bytes, you simply pass the number of zero-bytes - * that should be written. - */ - writeZeroes(len: bigint): void; - /** - * Perform a write of up to 4096 zeroes, and then flush the stream. - * Block until all of these operations are complete, or an error - * occurs. - * - * This is a convenience wrapper around the use of `check-write`, - * `subscribe`, `write-zeroes`, and `flush`, and is implemented with - * the following pseudo-code: - * - * ```text - * let pollable = this.subscribe(); - * while num_zeroes != 0 { - * // Wait for the stream to become writable - * pollable.block(); - * let Ok(n) = this.check-write(); // eliding error handling - * let len = min(n, num_zeroes); - * this.write-zeroes(len); // eliding error handling - * num_zeroes -= len; - * } - * this.flush(); - * // Wait for completion of `flush` - * pollable.block(); - * // Check for any errors that arose during `flush` - * let _ = this.check-write(); // eliding error handling - * ``` - */ - blockingWriteZeroesAndFlush(len: bigint): void; - /** - * Read from one stream and write to another. - * - * The behavior of splice is equivelant to: - * 1. calling `check-write` on the `output-stream` - * 2. calling `read` on the `input-stream` with the smaller of the - * `check-write` permitted length and the `len` provided to `splice` - * 3. calling `write` on the `output-stream` with that read data. - * - * Any error reported by the call to `check-write`, `read`, or - * `write` ends the splice and reports that error. - * - * This function returns the number of bytes transferred; it may be less - * than `len`. - */ - splice(src: InputStream, len: bigint): bigint; - /** - * Read from one stream and write to another, with blocking. - * - * This is similar to `splice`, except that it blocks until the - * `output-stream` is ready for writing, and the `input-stream` - * is ready for reading, before performing the `splice`. - */ - blockingSplice(src: InputStream, len: bigint): bigint; - } - \ No newline at end of file diff --git a/examples/components/http-hello-world/types/wit.d.ts b/examples/components/http-hello-world/types/wit.d.ts deleted file mode 100644 index 2dcc5191a..000000000 --- a/examples/components/http-hello-world/types/wit.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { WasiClocksMonotonicClock } from './interfaces/wasi-clocks-monotonic-clock.js'; -import { WasiHttpTypes } from './interfaces/wasi-http-types.js'; -import { WasiIoError } from './interfaces/wasi-io-error.js'; -import { WasiIoPoll } from './interfaces/wasi-io-poll.js'; -import { WasiIoStreams } from './interfaces/wasi-io-streams.js'; -import { WasiHttpIncomingHandler } from './interfaces/wasi-http-incoming-handler.js'; -export const incomingHandler: typeof WasiHttpIncomingHandler; diff --git a/examples/components/string-reverse/package-lock.json b/examples/components/string-reverse/package-lock.json index 356f422cd..0353227d4 100644 --- a/examples/components/string-reverse/package-lock.json +++ b/examples/components/string-reverse/package-lock.json @@ -6,36 +6,36 @@ "": { "name": "string-reverse-wasm", "devDependencies": { - "@bytecodealliance/componentize-js": "0.15.0", - "@bytecodealliance/jco": "1.8.1" + "@bytecodealliance/componentize-js": "0.16.0", + "@bytecodealliance/jco": "1.9.1" } }, "node_modules/@bytecodealliance/componentize-js": { - "version": "0.15.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.0.tgz", - "integrity": "sha512-NyMsXJi4LxeGGYwmZR5c8Zq69scTgTmaXUOXeC4IDvDoLNz5qZdBqC8gjZnsqvRq69QFM2Hd3Xweb5P5AyEOGA==", + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.16.0.tgz", + "integrity": "sha512-x5vKTLd4I+ovC58l4zjld+XTJSve5Glblu7Ola/2v6vOh0YS2eODihDVLWkl4kd9GC/8OjxwEdE0pXelQt6ovw==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/jco": "^1.9.1", "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } }, "node_modules/@bytecodealliance/jco": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.8.1.tgz", - "integrity": "sha512-mYjE7lrSWEzFD6lAVA4skm9/6DvorFjuO5DHoxzwWlJ2hKyO/d9t0Wx1V0nT5L1s7+98ZtVSB1emYLNMebpMdA==", + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/jco/-/jco-1.9.1.tgz", + "integrity": "sha512-Xmd1iw2OrWhlLOPZraFTBuE1AGfMSQVqKzswmq3k1vQ5B0EJe8O1CFG/UJeRXwbq1fxHHS9DTtlfAZiTeOdLWQ==", "dev": true, "license": "(Apache-2.0 WITH LLVM-exception)", "workspaces": [ "packages/preview2-shim" ], "dependencies": { - "@bytecodealliance/componentize-js": "^0.14.0", + "@bytecodealliance/componentize-js": "^0.15.0", "@bytecodealliance/preview2-shim": "^0.17.1", "binaryen": "^120.0.0", "chalk-template": "^1", @@ -49,16 +49,16 @@ } }, "node_modules/@bytecodealliance/jco/node_modules/@bytecodealliance/componentize-js": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.14.0.tgz", - "integrity": "sha512-Y53lxcHEQz5k4PwqBY3+q6Y+TmFSu5mWhd+2dyURE7mk0GDaFYKRDoATCoXxD8Dvq/HgNPrDSE2X7AJIjPMtYQ==", + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@bytecodealliance/componentize-js/-/componentize-js-0.15.1.tgz", + "integrity": "sha512-bTQT+uwWNeyFXRiV6cp+5ERUKC2g6lyiMoeMys2/yg8IcWPwq+3btV1Pj/q0ueAwyiIsuQ//c+peMHPrNTmHOg==", "dev": true, "workspaces": [ "." ], "dependencies": { - "@bytecodealliance/jco": "^1.7.1", - "@bytecodealliance/weval": "^0.3.2", + "@bytecodealliance/jco": "^1.8.1", + "@bytecodealliance/weval": "^0.3.3", "@bytecodealliance/wizer": "^7.0.5", "es-module-lexer": "^1.5.4" } @@ -244,9 +244,9 @@ } }, "node_modules/@jridgewell/gen-mapping": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.5.tgz", - "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", "dev": true, "license": "MIT", "dependencies": { @@ -630,15 +630,15 @@ } }, "node_modules/@napi-rs/wasm-runtime": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.5.tgz", - "integrity": "sha512-kwUxR7J9WLutBbulqg1dfOrMTwhMdXLdcGUhcbCcGwnPLt3gz19uHVdwH1syKVDbE022ZS2vZxOWflFLS0YTjw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-0.2.6.tgz", + "integrity": "sha512-z8YVS3XszxFTO73iwvFDNpQIzdMmSDTP/mB3E/ucR37V3Sx57hSExcXyMoNwaucWxnsWf4xfbZv0iZ30jr0M4Q==", "dev": true, "license": "MIT", "optional": true, "dependencies": { - "@emnapi/core": "^1.1.0", - "@emnapi/runtime": "^1.1.0", + "@emnapi/core": "^1.3.1", + "@emnapi/runtime": "^1.3.1", "@tybys/wasm-util": "^0.9.0" } }, @@ -797,9 +797,9 @@ "license": "MIT" }, "node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.4.1.tgz", + "integrity": "sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==", "dev": true, "license": "MIT", "engines": { @@ -992,9 +992,9 @@ } }, "node_modules/es-module-lexer": { - "version": "1.5.4", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.5.4.tgz", - "integrity": "sha512-MVNK56NiMrOwitFB7cqDwq0CQutbw+0BvLshJSse0MUNU+y1FC3bUS/AQg7oUng+/wKrrki7JfmwtVHkVfPLlw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.6.0.tgz", + "integrity": "sha512-qqnD1yMU6tk/jnaMosogGySTZP8YtUgAffA9nMN+E/rjxcfRQ6IEk7IiozUjgxKoFHBGjTLnrHB/YC45r/59EQ==", "dev": true, "license": "MIT" }, @@ -1256,9 +1256,9 @@ } }, "node_modules/ora": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.1.1.tgz", - "integrity": "sha512-YWielGi1XzG1UTvOaCFaNgEnuhZVMSHYkW/FQ7UX8O26PtlpdM84c0f7wLPlkvx2RfiQmnzd61d/MGxmpQeJPw==", + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz", + "integrity": "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==", "dev": true, "license": "MIT", "dependencies": { @@ -1536,9 +1536,9 @@ } }, "node_modules/terser": { - "version": "5.36.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.36.0.tgz", - "integrity": "sha512-IYV9eNMuFAV4THUspIRXkLakHnV6XO7FEdtKjf/mDyrnqUg9LnlOn6/RwRvM9SZjR4GUq8Nk8zj67FzVARr74w==", + "version": "5.38.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.38.0.tgz", + "integrity": "sha512-a4GD5R1TjEeuCT6ZRiYMHmIf7okbCPEuhQET8bczV6FrQMMlFXA1n+G0KKjdlFCm3TEHV77GxfZB3vZSUQGFpg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { diff --git a/examples/components/string-reverse/package.json b/examples/components/string-reverse/package.json index 932524d56..08454f362 100644 --- a/examples/components/string-reverse/package.json +++ b/examples/components/string-reverse/package.json @@ -9,7 +9,7 @@ "all": "npm run build; npm run transpile; npm run transpiled-js" }, "devDependencies": { - "@bytecodealliance/jco": "1.8.1", - "@bytecodealliance/componentize-js": "0.15.0" + "@bytecodealliance/jco": "1.9.1", + "@bytecodealliance/componentize-js": "0.16.0" } } diff --git a/examples/guides/00-tooling-setup.md b/examples/guides/00-tooling-setup.md index 620a9d22e..ce5a13387 100644 --- a/examples/guides/00-tooling-setup.md +++ b/examples/guides/00-tooling-setup.md @@ -8,7 +8,7 @@ which means installing [`jco`][jco] and related tooling. > [!NOTE] > [Typescript][ts] can *also* be used, given that it is transpiled to JS first by relevant tooling (`tsc`). -> `jco` includes a `jco types` subcommand for generating typings that can be used with a Typescript codebase. +> `jco` includes a `jco guest-types` subcommand for generating typings that can be used with a Typescript component. [jco]: https://github.com/bytecodealliance/jco [ts]: https://typescriptlang.org