build: make rand optional and remove explicit getrandom dependency

This commit is contained in:
xfy 2026-06-16 17:10:27 +08:00
parent 726c6ec4e5
commit d246adbb32
2 changed files with 3 additions and 3 deletions

View File

@ -165,6 +165,6 @@ Most tests use `#[cfg(all(test, feature = "server"))]` — they only run when th
## Notes
- `rand` + `getrandom` with `js` feature are required for Argon2 salt generation in WASM builds.
- `rand` is optional and only enabled by the `server` feature; it is not compiled into the WASM frontend.
- `#[allow(unused_mut, unused_variables)]` on `Write` component is intentional — `mut` signals are used in `#[cfg(target_arch = "wasm32")]` blocks stripped in server builds.
- Server uses incremental rendering with 300s cache (`IncrementalRendererConfig` in `src/main.rs`).

View File

@ -18,8 +18,7 @@ dotenvy = { version = "0.15", optional = true }
tracing = { version = "0.1", optional = true, features = ["release_max_level_info"] }
tracing-subscriber = { version = "0.3", optional = true }
tower-http = { version = "0.6", optional = true }
rand = { version = "0.8", features = ["getrandom"] }
getrandom = { version = "0.2", features = ["js"] }
rand = { version = "0.8", features = ["getrandom"], optional = true }
http = "1"
axum = { version = "0.8", optional = true, features = ["multipart"] }
serde_json = "1.0"
@ -64,6 +63,7 @@ server = [
"dep:uuid",
"dep:regex",
"dep:pulldown-cmark",
"dep:rand",
"dep:dotenvy",
"dep:tracing",
"dep:tracing-subscriber",