Skip to content

Latest commit

 

History

History
34 lines (28 loc) · 2.46 KB

File metadata and controls

34 lines (28 loc) · 2.46 KB

Wry bindgen

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

Project structure

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 from vendored/patches/wasm-bindgen and do not edit it by hand.

Requirements

  • Tests are in the wry-launch/tests folder. 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 js files should be modified manually. All js files are autogenerated from ts files in the build.rs

CI Checks

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 check
  • cargo +1.88 check --workspace --all-features - Compile check
  • cargo +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; needs rustup target add wasm32-unknown-unknown)
  • cargo +1.88 clippy --workspace --all-features - Lint check
  • cargo +nightly doc --no-deps --all-features -p wry-launch -p wry-bindgen-macro -p wry-bindgen-macro-support then cargo +nightly doc --no-deps --all-features --manifest-path packages/wasm-bindgen/Cargo.toml - Documentation check (uses nightly, with RUSTDOCFLAGS=-Dwarnings; wasm-bindgen is documented by manifest path because the wasm32 build pulls a second wasm-bindgen crate, making -p wasm-bindgen ambiguous)
  • 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.