33 releases

0.2.95 Oct 10, 2024
0.2.93 Aug 12, 2024
0.2.92 Mar 4, 2024
0.2.89 Nov 27, 2023
0.2.67 Jul 28, 2020

#1466 in WebAssembly

Download history 46618/week @ 2024-07-27 43576/week @ 2024-08-03 38510/week @ 2024-08-10 36220/week @ 2024-08-17 33743/week @ 2024-08-24 32681/week @ 2024-08-31 32899/week @ 2024-09-07 32943/week @ 2024-09-14 31077/week @ 2024-09-21 36349/week @ 2024-09-28 32811/week @ 2024-10-05 35724/week @ 2024-10-12 36787/week @ 2024-10-19 33925/week @ 2024-10-26 31999/week @ 2024-11-02 30614/week @ 2024-11-09

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

MIT/Apache

45KB
790 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