Skip to content

Commit

Permalink
Implement WASI "preview0" in wasmtime-wasi
Browse files Browse the repository at this point in the history
This commit implements the `wasi_unstable` module, sometimes referred to
as "preview0", in the `wasmtime-wasi` crate. Previously this was only
implemented by the `wasi-common` crate but now this is implemented for
both meaning that the switch to preview2 won't lose this functionality.

The preview0 WITX files are vendored like the preview1 files and the
implementation of preview0 is exclusively implemented by delegating to
the preview1 implementation.
  • Loading branch information
alexcrichton committed Nov 16, 2023
1 parent bba4ee7 commit 2f2cd76
Show file tree
Hide file tree
Showing 11 changed files with 2,192 additions and 40 deletions.
3 changes: 2 additions & 1 deletion crates/cli-flags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ wasmtime_option_group! {
pub inherit_network: Option<bool>,
/// Indicates whether `wasi:sockets/ip-name-lookup` is enabled or not.
pub allow_ip_name_lookup: Option<bool>,

/// Allows imports from the `wasi_unstable` core wasm module.
pub preview0: Option<bool>,
}

enum Wasi {
Expand Down
2 changes: 2 additions & 0 deletions crates/wasi/src/preview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ mod network;
pub mod pipe;
mod poll;
#[cfg(feature = "preview1-on-preview2")]
pub mod preview0;
#[cfg(feature = "preview1-on-preview2")]
pub mod preview1;
mod random;
mod stdio;
Expand Down
Loading

0 comments on commit 2f2cd76

Please sign in to comment.