wrap-cli icon indicating copy to clipboard operation
wrap-cli copied to clipboard

Better wasm-bindgen Support

Open dOrgJelli opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently, wasm-bindgen is not natively supported by Polywrap. Instead we post-process the Rust wasm modules and remove all wasm-bindgen related code: https://github.com/polywrap/toolchain/blob/d7b1762818ed307d76bf44feb82999452ec8474b/packages/cli/src/lib/defaults/build-images/wasm/rust/Dockerfile.mustache#L105-L113

wasm-bindgen is used in most all Rust crates that want to target WebAssembly, and it would make building with Polywrap much easier if we had some support for it.

Describe the solution you'd like I think we need to first start with the differences of how Polywrap & wasm-bindgen encode data across the wasm boundary. Some initial work has been done here to understand what having configurable encoders would look like: https://github.com/polywrap/toolchain/issues/1183

Alternatively we could build an "extension" to the wasm-bindgen tool that emits Polywrap compatible encodings (currently MsgPack).

Lastly, we could do further research into the "Wasm Component Model" and see if becoming compatible with it would mean that we'd now better support wasm-bindgen enabled code.

Additional context This is a bit of a hairy topic, that is not too well defined currently. More research / digging through code is needed.

dOrgJelli avatar Sep 21 '22 11:09 dOrgJelli