#binding-generator #bindgen #javascript #wasm-bindgen #externref

wasm-bindgen-externref-xform

Internal externref transformations for wasm-bindgen

22 releases

0.2.84 Feb 1, 2023
0.2.83 Sep 12, 2022
0.2.82 Jul 25, 2022
0.2.79 Jan 19, 2022
0.2.67 Jul 28, 2020

#165 in WebAssembly

Download history 8057/week @ 2022-11-30 5960/week @ 2022-12-07 6973/week @ 2022-12-14 5836/week @ 2022-12-21 5968/week @ 2022-12-28 7469/week @ 2023-01-04 7561/week @ 2023-01-11 7719/week @ 2023-01-18 7707/week @ 2023-01-25 9826/week @ 2023-02-01 8984/week @ 2023-02-08 8895/week @ 2023-02-15 8577/week @ 2023-02-22 9807/week @ 2023-03-01 8889/week @ 2023-03-08 7233/week @ 2023-03-15

35,944 downloads per month
Used in 23 crates (via wasm-bindgen-cli-support)

MIT/Apache

32KB
559 lines

Transformation for wasm-bindgen to enable usage of externref in a wasm module.

This crate is in charge of enabling code using wasm-bindgen to use the externref type inside of the wasm module. This transformation pass primarily wraps exports and imports in shims which use externref, but quickly turn them into i32 value types. This is all largely a stopgap until Rust has first-class support for the externref type, but that's thought to be in the far future and will take quite some time to implement. In the meantime, we have this!

The pass here works by collecting information during binding generation about imports and exports. Afterwards this pass runs in one go against a wasm module, updating exports, imports, calls to these functions, etc. The goal at least is to have valid wasm modules coming in that don't use externref and valid wasm modules going out which use externref at the fringes.

Dependencies

~3MB
~62K SLoC