diff --git a/Cargo.lock b/Cargo.lock index 9aa8863d43..88e88c82e5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3513,6 +3513,7 @@ name = "wasmtime-wasi" version = "0.25.0" dependencies = [ "anyhow", + "wasi-cap-std-sync", "wasi-common", "wasmtime", "wasmtime-wiggle", diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml index 5937ec55a2..a6db19e5b4 100644 --- a/crates/wasi/Cargo.toml +++ b/crates/wasi/Cargo.toml @@ -14,7 +14,12 @@ build = "build.rs" [dependencies] wasi-common = { path = "../wasi-common", version = "0.25.0" } +wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync", version = "0.25.0", optional = true } wiggle = { path = "../wiggle", default-features = false, version = "0.25.0" } wasmtime-wiggle = { path = "../wiggle/wasmtime", default-features = false, version = "0.25.0" } wasmtime = { path = "../wasmtime", default-features = false, version = "0.25.0" } anyhow = "1.0" + +[features] +default = ["sync"] +sync = ["wasi-cap-std-sync"] diff --git a/crates/wasi/src/lib.rs b/crates/wasi/src/lib.rs index 1c3ad448ad..2b71d7ab37 100644 --- a/crates/wasi/src/lib.rs +++ b/crates/wasi/src/lib.rs @@ -12,6 +12,14 @@ use std::rc::Rc; pub use wasi_common::{Error, WasiCtx, WasiCtxBuilder, WasiDir, WasiFile}; use wasmtime::{Config, Linker, Store}; +/// Re-export the commonly used wasi-cap-std-sync crate here. This saves +/// consumers of this library from having to keep additional dependencies +/// in sync. +#[cfg(feature = "sync")] +pub mod sync { + pub use wasi_cap_std_sync::*; +} + /// An instantiated instance of all available wasi exports. Presently includes /// both the "preview1" snapshot and the "unstable" (preview0) snapshot. pub struct Wasi {