# yrs (pinned in core/Cargo.toml) unconditionally generates a random # document GUID internally (`Doc::with_client_id` still calls `uuid_v4()`, # via `fastrand`, on every Doc construction — the "with_client_id" name only # refers to the collaboration client id, not the guid). On wasm32-unknown- # unknown, fastrand's transitively-required "js" feature makes `getrandom` # default to a `wasm-bindgen`-based backend that imports host JS functions # (`crypto.getRandomValues` etc.) — even when the randomness-using code path # is never actually reachable at runtime, referencing `yrs::Doc` anywhere in # this crate is enough for those wasm-bindgen exports to end up in the final # module. The Go/wazero host provides no JS glue, so that import breaks the # zero-imports contract enforced by core/tests/no_host_imports.rs. # # Selecting getrandom's "custom" backend (see core/src/lib.rs for the # `__getrandom_v03_custom` symbol this requires) routes entropy requests to # our own no-JS-dependency implementation instead, for the wasm32 target # only — native builds (tests, tooling) are unaffected and keep getrandom's # normal OS-backed source. [target.wasm32-unknown-unknown] rustflags = ["--cfg", 'getrandom_backend="custom"']