Skip to content

Commit 5f5dce6

Browse files
committed
feat: support wasi-common feature
1 parent c369938 commit 5f5dce6

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

lib/wasix/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,8 @@ webc_runner_rt_dproxy = [
202202
"tower-http",
203203
"journal",
204204
]
205-
205+
# the minimal wasip1 implementation
206+
wasi-common = ["wasmer/sys", "sys-thread", "tokio/fs"]
206207
sys = [
207208
"webc/mmap",
208209
"time",

lib/wasix/src/lib.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,18 @@
1414
//! [WASI plugin example](https://github.com/wasmerio/wasmer/blob/main/examples/plugin.rs)
1515
//! for an example of how to extend WASI using the WASI FS API.
1616
17-
#[cfg(all(not(feature = "sys"), not(feature = "js")))]
18-
compile_error!("At least the `sys` or the `js` feature must be enabled. Please, pick one.");
17+
#[cfg(all(
18+
not(feature = "sys"),
19+
not(feature = "js"),
20+
not(feature = "wasi-common")
21+
))]
22+
compile_error!(
23+
"At least the `sys` or the `js` or `wasi-common` feature must be enabled. Please, pick one."
24+
);
1925

20-
#[cfg(all(feature = "sys", feature = "js"))]
26+
#[cfg(all(feature = "sys", feature = "js", feature = "wasi-common"))]
2127
compile_error!(
22-
"Cannot have both `sys` and `js` features enabled at the same time. Please, pick one."
28+
"Cannot have both `sys` and `js` and `wasi-common`features enabled at the same time. Please, pick one."
2329
);
2430

2531
#[cfg(all(feature = "sys", target_arch = "wasm32"))]

lib/wasix/src/state/handles/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod global;
22
mod thread_local;
33

4-
#[cfg(feature = "sys")]
4+
#[cfg(any(feature = "sys", feature = "wasi-common"))]
55
pub(crate) use global::*;
66
#[cfg(feature = "js")]
77
pub(crate) use thread_local::*;

lib/wasix/src/state/handles/thread_local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![cfg_attr(feature = "sys", allow(unused))]
1+
#![cfg_attr(any(feature = "sys",feature="wasi-common"), allow(unused))]
22
use std::cell::{Ref, RefCell, RefMut};
33
use std::ops::{Deref, DerefMut};
44
use std::{

0 commit comments

Comments
 (0)