wit-bindgen icon indicating copy to clipboard operation
wit-bindgen copied to clipboard

js feature: check exports

Open fabricedesre opened this issue 2 years ago • 1 comments

The generated JS class contains methods for the module itself, and an instanciate method. However instanciate doesn't check that the WASM code actually exports the expected methods. It would be nice to either add that check in instanciate itself or to another generated method.

fabricedesre avatar Jan 08 '22 02:01 fabricedesre

Yes I think this would be a good option (perhaps gated by a conditional CLI flag or something like that). In general the checks performed by the Wasmtime implementation are much more thorough than the JS checks (or with other languages), and ideally those would all be on par.

alexcrichton avatar Jan 10 '22 15:01 alexcrichton

Going over some old JS issues, I'm going to close this as the updates in https://github.com/bytecodealliance/wit-bindgen/pull/373 mean that taking a component provides a stronger guarantee around validation so this is more-or-less done.

alexcrichton avatar Oct 13 '22 17:10 alexcrichton