This is a replacement for wasm bindgen in the wry-bindgen folder. Status:
- Minimal features in web-sys compiling with the new bindgen
- Web-sys compiling with --all-features
- Support for Clamped type
- Support for Option<Vec>
- Js-sys compiling with the new bindgen
- Basic roundtrip tests passing
- Casting and type checking
- Don't hardcode drop and clone implementations - use the macro
The wry-bindgen project is structured as follows:
wry-bindgen: The core crate that handles types for calls into and from the wry webview.wry-bindgen-macro: The procedural macro crate that generates the bindings.vendored/wasm-bindgen: A vendored copy of the patched upstream wasm-bindgen tree. Keep it generated fromvendored/patches/wasm-bindgenand do not edit it by hand.
- Tests are in the
wry-launch/testsfolder. Any new behavior should be covered by tests. Test should only take < 30 seconds to run. Run them with a timeout of 30 seconds. - No
jsfiles should be modified manually. Alljsfiles are autogenerated fromtsfiles in the build.rs
CI runs the following checks with rust 1.88. When running these checks locally, make sure to use cargo +1.88 to ensure compatibility:
cargo +1.88 fmt --all -- --check- Format checkcargo +1.88 check --workspace --all-features- Compile checkcargo +1.88 check --manifest-path packages/wasm-bindgen/Cargo.toml --target wasm32-unknown-unknown --all-features- Wasm compile check (the shim must still build for the browser target, where it delegates to the real upstream wasm-bindgen; needsrustup target add wasm32-unknown-unknown)cargo +1.88 clippy --workspace --all-features- Lint checkcargo +nightly doc --no-deps --all-features -p wry-launch -p wry-bindgen-macro -p wry-bindgen-macro-supportthencargo +nightly doc --no-deps --all-features --manifest-path packages/wasm-bindgen/Cargo.toml- Documentation check (uses nightly, withRUSTDOCFLAGS=-Dwarnings;wasm-bindgenis documented by manifest path because the wasm32 build pulls a secondwasm-bindgencrate, making-p wasm-bindgenambiguous)cargo +1.88 test --workspace --all-features -- --test-threads=1- Test check
To automatically fix issues, you can run the following commands:
./scripts/automated-fix-tests.sh- This script will automatically fix formatting and lint issues, then run all checks to ensure everything is still working.