I am beginning to experiment a bit with the new exceptions proposal, and built a component using wit-bindgen@0.43.0 and the upcoming wasi-sdk changes with exception handling: WebAssembly/wasi-sdk#590.
Unfortunately, when transpiling this module to JS+TS using jco, I get the following error:
file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769
throw new ComponentError(retCopy.val);
^
ComponentError: failed to translate component
Caused by:
exceptions proposal not enabled (at offset 0x5082)
at generate (file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769:11)
at transpileComponent (file:///.../node_modules/@bytecodealliance/jco/src/cmd/transpile.js:197:39)
at async file:///.../scripts/transpile_component.js:43:16
Node.js v20.11.1
Looking at the source code in this repo, it looks like feature proposal support is enabled within the js-component-bindgen-component crate, and more specifically with wasmparser:
|
let mut validator = wasmtime_environ::wasmparser::Validator::new_with_features( |
|
WasmFeatures::WASM2 |
|
| WasmFeatures::COMPONENT_MODEL |
|
| WasmFeatures::CM_ASYNC |
|
| WasmFeatures::CM_ASYNC_BUILTINS |
|
| WasmFeatures::CM_ASYNC_STACKFUL |
|
| WasmFeatures::CM_ERROR_CONTEXT |
|
| WasmFeatures::EXTENDED_CONST |
|
| WasmFeatures::MEMORY64 |
|
| WasmFeatures::MULTI_MEMORY, |
|
); |
Would it be reasonable to add feature support for Exceptions using wasmparser's WasmFeatures::EXCEPTIONS constant? (ref)?
I am beginning to experiment a bit with the new exceptions proposal, and built a component using
wit-bindgen@0.43.0and the upcomingwasi-sdkchanges with exception handling: WebAssembly/wasi-sdk#590.Unfortunately, when transpiling this module to JS+TS using
jco, I get the following error:file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769 throw new ComponentError(retCopy.val); ^ ComponentError: failed to translate component Caused by: exceptions proposal not enabled (at offset 0x5082) at generate (file:///.../node_modules/@bytecodealliance/jco/obj/js-component-bindgen-component.js:4769:11) at transpileComponent (file:///.../node_modules/@bytecodealliance/jco/src/cmd/transpile.js:197:39) at async file:///.../scripts/transpile_component.js:43:16 Node.js v20.11.1Looking at the source code in this repo, it looks like feature proposal support is enabled within the
js-component-bindgen-componentcrate, and more specifically withwasmparser:jco/crates/js-component-bindgen/src/lib.rs
Lines 131 to 141 in fdc1442
Would it be reasonable to add feature support for Exceptions using
wasmparser'sWasmFeatures::EXCEPTIONSconstant? (ref)?