Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use wasi-http and wasi-cli 0.2.0-rc-2023-12-05 (#7640) #7650

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/wasi-http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ pub mod bindings {
wasmtime::component::bindgen!({
path: "wit",
interfaces: "
import wasi:http/[email protected]11-10;
import wasi:http/[email protected]11-10;
import wasi:http/[email protected]11-10;
import wasi:http/[email protected]12-05;
import wasi:http/[email protected]12-05;
import wasi:http/[email protected]12-05;
",
tracing: true,
async: false,
Expand Down
4 changes: 2 additions & 2 deletions crates/wasi-http/wit/command-extended.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// All of the same imports and exports available in the wasi:cli/command world
// with addition of HTTP proxy related imports:
world command-extended {
include wasi:cli/[email protected]11-10;
import wasi:http/[email protected]11-10;
include wasi:cli/[email protected]12-05;
import wasi:http/[email protected]12-05;
}
4 changes: 2 additions & 2 deletions crates/wasi-http/wit/deps/cli/command.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package wasi:[email protected]11-10;
package wasi:[email protected]12-05;

world command {
include reactor;
include imports;

export run;
}
20 changes: 20 additions & 0 deletions crates/wasi-http/wit/deps/cli/imports.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package wasi:[email protected];

world imports {
include wasi:clocks/[email protected];
include wasi:filesystem/[email protected];
include wasi:sockets/[email protected];
include wasi:random/[email protected];
include wasi:io/[email protected];

import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}
31 changes: 0 additions & 31 deletions crates/wasi-http/wit/deps/cli/reactor.wit

This file was deleted.

11 changes: 5 additions & 6 deletions crates/wasi-http/wit/deps/http/proxy.wit
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package wasi:[email protected]11-10;
package wasi:[email protected]12-05;

/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
/// this world may concurrently stream in and out any number of incoming and
/// outgoing HTTP requests.
world proxy {
/// HTTP proxies have access to time and randomness.
import wasi:clocks/[email protected];
import wasi:clocks/[email protected];
include wasi:clocks/[email protected];
import wasi:random/[email protected];

/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]12-05;
import wasi:cli/[email protected]12-05;

/// 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.
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]12-05;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
Expand Down
8 changes: 4 additions & 4 deletions crates/wasi-http/wit/test.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package wasmtime:wasi;

// only used as part of `test-programs`
world test-reactor {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;

export add-strings: func(s: list<string>) -> u32;
export get-strings: func() -> list<string>;
Expand All @@ -16,7 +16,7 @@ world test-reactor {
}

world test-command {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
import wasi:http/[email protected]11-10;
import wasi:http/[email protected]11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
import wasi:http/[email protected]12-05;
import wasi:http/[email protected]12-05;
}
14 changes: 7 additions & 7 deletions crates/wasi-preview1-component-adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub mod bindings {
#[cfg(feature = "reactor")]
wit_bindgen::generate!({
path: "../wasi/wit",
world: "wasi:cli/reactor",
world: "wasi:cli/imports",
std_feature,
raw_strings,
// Automatically generated bindings for these functions will allocate
Expand All @@ -87,9 +87,9 @@ pub mod bindings {
import wasi:clocks/[email protected];
import wasi:clocks/[email protected];
import wasi:random/[email protected];
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]12-05;
import wasi:cli/[email protected]12-05;
import wasi:cli/[email protected]12-05;
}
"#,
std_feature,
Expand All @@ -98,7 +98,7 @@ pub mod bindings {
});
}

#[export_name = "wasi:cli/[email protected]11-10#run"]
#[export_name = "wasi:cli/[email protected]12-05#run"]
#[cfg(feature = "command")]
pub unsafe extern "C" fn run() -> u32 {
#[link(wasm_import_module = "__main_module__")]
Expand Down Expand Up @@ -2641,7 +2641,7 @@ impl State {
#[cfg(not(feature = "proxy"))]
fn get_environment(&self) -> &[StrTuple] {
if self.env_vars.get().is_none() {
#[link(wasm_import_module = "wasi:cli/[email protected]11-10")]
#[link(wasm_import_module = "wasi:cli/[email protected]12-05")]
extern "C" {
#[link_name = "get-environment"]
fn get_environment_import(rval: *mut StrTupleList);
Expand All @@ -2666,7 +2666,7 @@ impl State {
#[cfg(not(feature = "proxy"))]
fn get_args(&self) -> &[WasmStr] {
if self.args.get().is_none() {
#[link(wasm_import_module = "wasi:cli/[email protected]11-10")]
#[link(wasm_import_module = "wasi:cli/[email protected]12-05")]
extern "C" {
#[link_name = "get-arguments"]
fn get_args_import(rval: *mut WasmStrList);
Expand Down
2 changes: 1 addition & 1 deletion crates/wasi/src/preview2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub mod bindings {

wasmtime::component::bindgen!({
path: "wit",
world: "wasi:cli/reactor",
world: "wasi:cli/imports",
tracing: true,
async: {
// Only these functions are `async` and everything else is sync
Expand Down
4 changes: 2 additions & 2 deletions crates/wasi/wit/command-extended.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// All of the same imports and exports available in the wasi:cli/command world
// with addition of HTTP proxy related imports:
world command-extended {
include wasi:cli/[email protected]11-10;
import wasi:http/[email protected]11-10;
include wasi:cli/[email protected]12-05;
import wasi:http/[email protected]12-05;
}
4 changes: 2 additions & 2 deletions crates/wasi/wit/deps/cli/command.wit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package wasi:[email protected]11-10;
package wasi:[email protected]12-05;

world command {
include reactor;
include imports;

export run;
}
20 changes: 20 additions & 0 deletions crates/wasi/wit/deps/cli/imports.wit
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package wasi:[email protected];

world imports {
include wasi:clocks/[email protected];
include wasi:filesystem/[email protected];
include wasi:sockets/[email protected];
include wasi:random/[email protected];
include wasi:io/[email protected];

import environment;
import exit;
import stdin;
import stdout;
import stderr;
import terminal-input;
import terminal-output;
import terminal-stdin;
import terminal-stdout;
import terminal-stderr;
}
31 changes: 0 additions & 31 deletions crates/wasi/wit/deps/cli/reactor.wit

This file was deleted.

11 changes: 5 additions & 6 deletions crates/wasi/wit/deps/http/proxy.wit
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
package wasi:[email protected]11-10;
package wasi:[email protected]12-05;

/// The `wasi:http/proxy` world captures a widely-implementable intersection of
/// hosts that includes HTTP forward and reverse proxies. Components targeting
/// this world may concurrently stream in and out any number of incoming and
/// outgoing HTTP requests.
world proxy {
/// HTTP proxies have access to time and randomness.
import wasi:clocks/[email protected];
import wasi:clocks/[email protected];
include wasi:clocks/[email protected];
import wasi:random/[email protected];

/// Proxies have standard output and error streams which are expected to
/// terminate in a developer-facing console provided by the host.
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]12-05;
import wasi:cli/[email protected]12-05;

/// 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.
import wasi:cli/[email protected]11-10;
import wasi:cli/[email protected]12-05;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
Expand Down
8 changes: 4 additions & 4 deletions crates/wasi/wit/test.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package wasmtime:wasi;

// only used as part of `test-programs`
world test-reactor {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;

export add-strings: func(s: list<string>) -> u32;
export get-strings: func() -> list<string>;
Expand All @@ -16,7 +16,7 @@ world test-reactor {
}

world test-command {
include wasi:cli/reactor@0.2.0-rc-2023-11-10;
import wasi:http/[email protected]11-10;
import wasi:http/[email protected]11-10;
include wasi:cli/imports@0.2.0-rc-2023-12-05;
import wasi:http/[email protected]12-05;
import wasi:http/[email protected]12-05;
}
2 changes: 1 addition & 1 deletion tests/all/cli_tests/component-basic.wat
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
(func $run (result (result))
(canon lift (core func $i "run")))

(instance (export (interface "wasi:cli/[email protected]11-10"))
(instance (export (interface "wasi:cli/[email protected]12-05"))
(export "run" (func $run)))
)
Loading