Skip to content

Commit

Permalink
Update WASI WITs to 0.2.2 (#9395)
Browse files Browse the repository at this point in the history
* Update WASI WITs to 0.2.2

This bumps a number of versions in a number of locations and will be
slated for Wasmtime 27. This additionally requires implementing the
`network-error-code` function which I've left as a stub for now to get
filled out with tests at a later date.

* Fix doc examples
  • Loading branch information
alexcrichton authored Oct 8, 2024
1 parent cbdf173 commit 9bc918f
Show file tree
Hide file tree
Showing 58 changed files with 227 additions and 174 deletions.
26 changes: 13 additions & 13 deletions ci/vendor-wit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ make_vendor() {
cache_dir=$(mktemp -d)

make_vendor "wasi" "
cli@v0.2.1
clocks@v0.2.1
filesystem@v0.2.1
io@v0.2.1
random@v0.2.1
sockets@v0.2.1
cli@v0.2.2
clocks@v0.2.2
filesystem@v0.2.2
io@v0.2.2
random@v0.2.2
sockets@v0.2.2
"

make_vendor "wasi-http" "
cli@v0.2.1
clocks@v0.2.1
filesystem@v0.2.1
io@v0.2.1
random@v0.2.1
sockets@v0.2.1
http@v0.2.1
cli@v0.2.2
clocks@v0.2.2
filesystem@v0.2.2
io@v0.2.2
random@v0.2.2
sockets@v0.2.2
http@v0.2.2
"

make_vendor "wasi-runtime-config" "runtime-config@c667fe6"
Expand Down
26 changes: 13 additions & 13 deletions crates/test-programs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ wit_bindgen::generate!({
package wasmtime:test;
world test {
include wasi:cli/imports@0.2.1;
include wasi:http/imports@0.2.1;
include wasi:cli/imports@0.2.2;
include wasi:http/imports@0.2.2;
include wasi:config/imports@0.2.0-draft;
include wasi:keyvalue/imports@0.2.0-draft;
}
Expand All @@ -31,17 +31,17 @@ pub mod proxy {
default_bindings_module: "test_programs::proxy",
pub_export_macro: true,
with: {
"wasi:http/types@0.2.1": crate::wasi::http::types,
"wasi:http/outgoing-handler@0.2.1": crate::wasi::http::outgoing_handler,
"wasi:random/random@0.2.1": crate::wasi::random::random,
"wasi:io/error@0.2.1": crate::wasi::io::error,
"wasi:io/poll@0.2.1": crate::wasi::io::poll,
"wasi:io/streams@0.2.1": crate::wasi::io::streams,
"wasi:cli/stdout@0.2.1": crate::wasi::cli::stdout,
"wasi:cli/stderr@0.2.1": crate::wasi::cli::stderr,
"wasi:cli/stdin@0.2.1": crate::wasi::cli::stdin,
"wasi:clocks/monotonic-clock@0.2.1": crate::wasi::clocks::monotonic_clock,
"wasi:clocks/wall-clock@0.2.1": crate::wasi::clocks::wall_clock,
"wasi:http/types@0.2.2": crate::wasi::http::types,
"wasi:http/outgoing-handler@0.2.2": crate::wasi::http::outgoing_handler,
"wasi:random/random@0.2.2": crate::wasi::random::random,
"wasi:io/error@0.2.2": crate::wasi::io::error,
"wasi:io/poll@0.2.2": crate::wasi::io::poll,
"wasi:io/streams@0.2.2": crate::wasi::io::streams,
"wasi:cli/stdout@0.2.2": crate::wasi::cli::stdout,
"wasi:cli/stderr@0.2.2": crate::wasi::cli::stderr,
"wasi:cli/stdin@0.2.2": crate::wasi::cli::stdin,
"wasi:clocks/monotonic-clock@0.2.2": crate::wasi::clocks::monotonic_clock,
"wasi:clocks/wall-clock@0.2.2": crate::wasi::clocks::wall_clock,
},
});
}
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/cli/command.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:cli@0.2.1;
package wasi:cli@0.2.2;

@since(version = 0.2.0)
world command {
Expand Down
12 changes: 6 additions & 6 deletions crates/wasi-http/wit/deps/cli/imports.wit
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package wasi:cli@0.2.1;
package wasi:cli@0.2.2;

@since(version = 0.2.0)
world imports {
@since(version = 0.2.0)
include wasi:clocks/imports@0.2.1;
include wasi:clocks/imports@0.2.2;
@since(version = 0.2.0)
include wasi:filesystem/imports@0.2.1;
include wasi:filesystem/imports@0.2.2;
@since(version = 0.2.0)
include wasi:sockets/imports@0.2.1;
include wasi:sockets/imports@0.2.2;
@since(version = 0.2.0)
include wasi:random/imports@0.2.1;
include wasi:random/imports@0.2.2;
@since(version = 0.2.0)
include wasi:io/imports@0.2.1;
include wasi:io/imports@0.2.2;

@since(version = 0.2.0)
import environment;
Expand Down
6 changes: 3 additions & 3 deletions crates/wasi-http/wit/deps/cli/stdio.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@since(version = 0.2.0)
interface stdin {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{input-stream};
use wasi:io/streams@0.2.2.{input-stream};

@since(version = 0.2.0)
get-stdin: func() -> input-stream;
Expand All @@ -10,7 +10,7 @@ interface stdin {
@since(version = 0.2.0)
interface stdout {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{output-stream};
use wasi:io/streams@0.2.2.{output-stream};

@since(version = 0.2.0)
get-stdout: func() -> output-stream;
Expand All @@ -19,7 +19,7 @@ interface stdout {
@since(version = 0.2.0)
interface stderr {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{output-stream};
use wasi:io/streams@0.2.2.{output-stream};

@since(version = 0.2.0)
get-stderr: func() -> output-stream;
Expand Down
4 changes: 2 additions & 2 deletions crates/wasi-http/wit/deps/clocks/monotonic-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
///
Expand All @@ -10,7 +10,7 @@ package wasi:clocks@0.2.1;
@since(version = 0.2.0)
interface monotonic-clock {
@since(version = 0.2.0)
use wasi:io/poll@0.2.1.{pollable};
use wasi:io/poll@0.2.2.{pollable};

/// An instant in time, in nanoseconds. An instant is relative to an
/// unspecified initial value, and can only be compared to instances from
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/clocks/timezone.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;

@unstable(feature = clocks-timezone)
interface timezone {
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/clocks/wall-clock.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;
/// WASI Wall Clock is a clock API intended to let users query the current
/// time. The name "wall" makes an analogy to a "clock on the wall", which
/// is not necessarily monotonic as it may be reset.
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/clocks/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.1;
package wasi:clocks@0.2.2;

@since(version = 0.2.0)
world imports {
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/filesystem/preopens.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;

@since(version = 0.2.0)
interface preopens {
Expand Down
12 changes: 3 additions & 9 deletions crates/wasi-http/wit/deps/filesystem/types.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;
/// WASI filesystem is a filesystem API primarily intended to let users run WASI
/// programs that access their files on their existing filesystems, without
/// significant overhead.
Expand Down Expand Up @@ -26,9 +26,9 @@ package wasi:filesystem@0.2.1;
@since(version = 0.2.0)
interface types {
@since(version = 0.2.0)
use wasi:io/streams@0.2.1.{input-stream, output-stream, error};
use wasi:io/streams@0.2.2.{input-stream, output-stream, error};
@since(version = 0.2.0)
use wasi:clocks/wall-clock@0.2.1.{datetime};
use wasi:clocks/wall-clock@0.2.2.{datetime};

/// File size or length of a region within a file.
@since(version = 0.2.0)
Expand Down Expand Up @@ -523,12 +523,6 @@ interface types {

/// Open a file or directory.
///
/// The returned descriptor is not guaranteed to be the lowest-numbered
/// descriptor not currently open/ it is randomized to prevent applications
/// from depending on making assumptions about indexes, since this is
/// error-prone in multi-threaded contexts. The returned descriptor is
/// guaranteed to be less than 2**31.
///
/// If `flags` contains `descriptor-flags::mutate-directory`, and the base
/// descriptor doesn't have `descriptor-flags::mutate-directory` set,
/// `open-at` fails with `error-code::read-only`.
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi-http/wit/deps/filesystem/world.wit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:filesystem@0.2.1;
package wasi:filesystem@0.2.2;

@since(version = 0.2.0)
world imports {
Expand Down
14 changes: 7 additions & 7 deletions crates/wasi-http/wit/deps/http/proxy.wit
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package wasi:http@0.2.1;
package wasi:http@0.2.2;

/// The `wasi:http/imports` world imports all the APIs for HTTP proxies.
/// It is intended to be `include`d in other worlds.
@since(version = 0.2.0)
world imports {
/// HTTP proxies have access to time and randomness.
@since(version = 0.2.0)
import wasi:clocks/monotonic-clock@0.2.1;
import wasi:clocks/monotonic-clock@0.2.2;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.1;
import wasi:clocks/wall-clock@0.2.2;
@since(version = 0.2.0)
import wasi:random/random@0.2.1;
import wasi:random/random@0.2.2;

/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
@since(version = 0.2.0)
import wasi:cli/stdout@0.2.1;
import wasi:cli/stdout@0.2.2;
@since(version = 0.2.0)
import wasi:cli/stderr@0.2.1;
import wasi:cli/stderr@0.2.2;

/// TODO: this is a temporary workaround until component tooling is able to
/// gracefully handle the absence of stdin. Hosts must return an eof stream
/// for this import, which is what wasi-libc + tooling will do automatically
/// when this import is properly removed.
@since(version = 0.2.0)
import wasi:cli/stdin@0.2.1;
import wasi:cli/stdin@0.2.2;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
Expand Down
Loading

0 comments on commit 9bc918f

Please sign in to comment.