feat: Refactor kvstore and vault to use features and logging

- Remove hardcoded dependencies in kvstore Cargo.toml; use features
  instead. This allows for more flexible compilation for different
  targets (native vs. WASM).
- Improve logging in vault crate using the `log` crate. This makes
  debugging easier and provides more informative output during
  execution.  Native tests use `env_logger`, WASM tests use
  `console_log`.
- Update README to reflect new logging best practices.
- Add cfg attributes to native and wasm modules to improve clarity.
- Update traits.rs to specify Send + Sync behavior expectations.
This commit is contained in:
2025-05-15 16:42:19 +03:00
parent 7d7f94f114
commit cea2d7e655
17 changed files with 843 additions and 295 deletions

View File

@@ -8,24 +8,21 @@ path = "src/lib.rs"
[dependencies]
async-trait = "0.1"
sled = { version = "0.34", optional = true }
idb = { version = "0.4", optional = true }
js-sys = "0.3"
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
thiserror = "1"
tempfile = "3"
[features]
default = []
native = ["sled", "tokio"]
web = ["idb"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.45", optional = true, default-features = false, features = ["rt-multi-thread", "macros"] }
sled = { version = "0.34" }
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
[target.'cfg(target_arch = "wasm32")'.dependencies]
idb = "0.4"
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
idb = { version = "0.4" }
wasm-bindgen-test = "0.3"
[features]
default = []
native = []