37 releases

new 0.2.99 Dec 7, 2024
0.2.97 Nov 30, 2024
0.2.92 Mar 4, 2024
0.2.89 Nov 27, 2023
0.2.67 Jul 28, 2020

#1502 in WebAssembly

Download history 34767/week @ 2024-08-21 31313/week @ 2024-08-28 35534/week @ 2024-09-04 31895/week @ 2024-09-11 32119/week @ 2024-09-18 33266/week @ 2024-09-25 35733/week @ 2024-10-02 32182/week @ 2024-10-09 36965/week @ 2024-10-16 35728/week @ 2024-10-23 33643/week @ 2024-10-30 31961/week @ 2024-11-06 38848/week @ 2024-11-13 36437/week @ 2024-11-20 32335/week @ 2024-11-27 35389/week @ 2024-12-04

149,271 downloads per month
Used in 37 crates (via wasm-bindgen-cli-support)

MIT/Apache

46KB
806 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

~5.5MB
~114K SLoC