From d246adbb328044e787dddd49fd122740c6b40939 Mon Sep 17 00:00:00 2001 From: xfy Date: Tue, 16 Jun 2026 17:10:27 +0800 Subject: [PATCH] build: make rand optional and remove explicit getrandom dependency --- AGENTS.md | 2 +- Cargo.toml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index d18f18d..66c7709 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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`). diff --git a/Cargo.toml b/Cargo.toml index 8ff7447..1869bfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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",