Skip to content

Commit db5fa27

Browse files
committed
fix(crate): declare getrandom std feature and gate wasm-incompatible module
Publishing pagedb standalone (outside the workspace) exposed two gaps masked by feature unification: getrandom needs `std` for PagedbError::Randomness to satisfy getrandom::Error: std::error::Error, and manifest_validation imports a wasm-gated snapshot type, so it must be gated the same way to keep the wasm32 build compiling.
1 parent a8484dd commit db5fa27

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ bytes = "1"
3232
tracing = "0.1"
3333
parking_lot = "0.12"
3434
rayon = "1"
35-
getrandom = { version = "0.2", features = ["js"] }
35+
# `std` is required (not just `js`): `PagedbError::Randomness(#[from]
36+
# getrandom::Error)` relies on `getrandom::Error: std::error::Error`, which
37+
# getrandom only provides under `std`. In the workspace a sibling crate enabled
38+
# `std` via feature unification, masking the gap — published standalone, pagedb
39+
# must declare the feature it actually uses.
40+
getrandom = { version = "0.2", features = ["js", "std"] }
3641

3742
# tokio's `rt-multi-thread` and `fs` features are not supported on
3843
# `wasm32-unknown-unknown`. Split per target so OPFS builds compile.

src/txn/db/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ mod apply_journal;
55
mod catalog;
66
mod core;
77
mod gc;
8+
// Serves the native-only incremental-snapshot apply path: its sole caller is
9+
// `snapshot` (wasm-gated below) and it imports `SnapshotManifest` from the
10+
// wasm-gated `crate::snapshot::export`. Gate it the same way so the wasm build
11+
// does not pull an import that is configured out.
12+
#[cfg(not(target_arch = "wasm32"))]
813
mod manifest_validation;
914
mod misc;
1015
mod open;

0 commit comments

Comments
 (0)