wit-bindgen
wit-bindgen copied to clipboard
js feature: check exports
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.
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.
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.