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