Skip to content

Commit

Permalink
fmt: format all wit files
Browse files Browse the repository at this point in the history
  • Loading branch information
oovm committed Jan 30, 2025
1 parent ee451dd commit c43ab7b
Show file tree
Hide file tree
Showing 14 changed files with 837 additions and 838 deletions.
8 changes: 4 additions & 4 deletions wasip2/cli/command.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package wasi:cli@0.2.3;

@since(version = 0.2.0)
world command {
@since(version = 0.2.0)
include imports;
@since(version = 0.2.0)
include imports;

@since(version = 0.2.0)
export run;
@since(version = 0.2.0)
export run;
}
34 changes: 17 additions & 17 deletions wasip2/cli/environment.wit
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
@since(version = 0.2.0)
interface environment {
/// Get the POSIX-style environment variables.
///
/// Each environment variable is provided as a pair of string variable names
/// and string value.
///
/// Morally, these are a value import, but until value imports are available
/// in the component model, this import function should return the same
/// values each time it is called.
@since(version = 0.2.0)
get-environment: func() -> list<tuple<string, string>>;
/// Get the POSIX-style environment variables.
///
/// Each environment variable is provided as a pair of string variable names
/// and string value.
///
/// Morally, these are a value import, but until value imports are available
/// in the component model, this import function should return the same
/// values each time it is called.
@since(version = 0.2.0)
get-environment: func() -> list<tuple<string, string>>;

/// Get the POSIX-style arguments to the program.
@since(version = 0.2.0)
get-arguments: func() -> list<string>;
/// Get the POSIX-style arguments to the program.
@since(version = 0.2.0)
get-arguments: func() -> list<string>;

/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
@since(version = 0.2.0)
initial-cwd: func() -> option<string>;
/// Return a path that programs should use as their initial current working
/// directory, interpreting `.` as shorthand for this.
@since(version = 0.2.0)
initial-cwd: func() -> option<string>;
}
26 changes: 13 additions & 13 deletions wasip2/cli/exit.wit
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@since(version = 0.2.0)
interface exit {
/// Exit the current instance and any linked instances.
@since(version = 0.2.0)
exit: func(status: result);
/// Exit the current instance and any linked instances.
@since(version = 0.2.0)
exit: func(status: result);

/// Exit the current instance and any linked instances, reporting the
/// specified status code to the host.
///
/// The meaning of the code depends on the context, with 0 usually meaning
/// "success", and other values indicating various types of failure.
///
/// This function does not return; the effect is analogous to a trap, but
/// without the connotation that something bad has happened.
@unstable(feature = cli-exit-with-code)
exit-with-code: func(status-code: u8);
/// Exit the current instance and any linked instances, reporting the
/// specified status code to the host.
///
/// The meaning of the code depends on the context, with 0 usually meaning
/// "success", and other values indicating various types of failure.
///
/// This function does not return; the effect is analogous to a trap, but
/// without the connotation that something bad has happened.
@unstable(feature = cli-exit-with-code)
exit-with-code: func(status-code: u8);
}
60 changes: 30 additions & 30 deletions wasip2/cli/imports.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,35 @@ package wasi:cli@0.2.3;

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

@since(version = 0.2.0)
import environment;
@since(version = 0.2.0)
import exit;
@since(version = 0.2.0)
import stdin;
@since(version = 0.2.0)
import stdout;
@since(version = 0.2.0)
import stderr;
@since(version = 0.2.0)
import terminal-input;
@since(version = 0.2.0)
import terminal-output;
@since(version = 0.2.0)
import terminal-stdin;
@since(version = 0.2.0)
import terminal-stdout;
@since(version = 0.2.0)
import terminal-stderr;
@since(version = 0.2.0)
import environment;
@since(version = 0.2.0)
import exit;
@since(version = 0.2.0)
import stdin;
@since(version = 0.2.0)
import stdout;
@since(version = 0.2.0)
import stderr;
@since(version = 0.2.0)
import terminal-input;
@since(version = 0.2.0)
import terminal-output;
@since(version = 0.2.0)
import terminal-stdin;
@since(version = 0.2.0)
import terminal-stdout;
@since(version = 0.2.0)
import terminal-stderr;
}
6 changes: 3 additions & 3 deletions wasip2/cli/run.wit
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@since(version = 0.2.0)
interface run {
/// Run the program.
@since(version = 0.2.0)
run: func() -> result;
/// Run the program.
@since(version = 0.2.0)
run: func() -> result;
}
24 changes: 12 additions & 12 deletions wasip2/cli/stdio.wit
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
@since(version = 0.2.0)
interface stdin {
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{input-stream};
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{input-stream};

@since(version = 0.2.0)
get-stdin: func() -> input-stream;
@since(version = 0.2.0)
get-stdin: func() -> input-stream;
}

@since(version = 0.2.0)
interface stdout {
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{output-stream};
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{output-stream};

@since(version = 0.2.0)
get-stdout: func() -> output-stream;
@since(version = 0.2.0)
get-stdout: func() -> output-stream;
}

@since(version = 0.2.0)
interface stderr {
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{output-stream};
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{output-stream};

@since(version = 0.2.0)
get-stderr: func() -> output-stream;
@since(version = 0.2.0)
get-stderr: func() -> output-stream;
}
8 changes: 4 additions & 4 deletions wasip2/filesystem/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,10 @@ interface types {
/// 128-bit integer type.
@since(version = 0.2.0)
record metadata-hash-value {
/// 64 bits of a 128-bit hash value.
lower: u64,
/// Another 64 bits of a 128-bit hash value.
upper: u64,
/// 64 bits of a 128-bit hash value.
lower: u64,
/// Another 64 bits of a 128-bit hash value.
upper: u64,
}

/// A descriptor is a reference to a filesystem object, which may be a file,
Expand Down
72 changes: 36 additions & 36 deletions wasip2/http/handler.wit
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@
/// be exported by components which can respond to HTTP Requests.
@since(version = 0.2.0)
interface incoming-handler {
@since(version = 0.2.0)
use types.{incoming-request, response-outparam};
@since(version = 0.2.0)
use types.{incoming-request, response-outparam};

/// This function is invoked with an incoming HTTP Request, and a resource
/// `response-outparam` which provides the capability to reply with an HTTP
/// Response. The response is sent by calling the `response-outparam.set`
/// method, which allows execution to continue after the response has been
/// sent. This enables both streaming to the response body, and performing other
/// work.
///
/// The implementor of this function must write a response to the
/// `response-outparam` before returning, or else the caller will respond
/// with an error on its behalf.
@since(version = 0.2.0)
handle: func(
request: incoming-request,
response-out: response-outparam
);
/// This function is invoked with an incoming HTTP Request, and a resource
/// `response-outparam` which provides the capability to reply with an HTTP
/// Response. The response is sent by calling the `response-outparam.set`
/// method, which allows execution to continue after the response has been
/// sent. This enables both streaming to the response body, and performing other
/// work.
///
/// The implementor of this function must write a response to the
/// `response-outparam` before returning, or else the caller will respond
/// with an error on its behalf.
@since(version = 0.2.0)
handle: func(
request: incoming-request,
response-out: response-outparam
);
}

/// This interface defines a handler of outgoing HTTP Requests. It should be
/// imported by components which wish to make HTTP Requests.
@since(version = 0.2.0)
interface outgoing-handler {
@since(version = 0.2.0)
use types.{
outgoing-request, request-options, future-incoming-response, error-code
};
@since(version = 0.2.0)
use types.{
outgoing-request, request-options, future-incoming-response, error-code
};

/// This function is invoked with an outgoing HTTP Request, and it returns
/// a resource `future-incoming-response` which represents an HTTP Response
/// which may arrive in the future.
///
/// The `options` argument accepts optional parameters for the HTTP
/// protocol's transport layer.
///
/// This function may return an error if the `outgoing-request` is invalid
/// or not allowed to be made. Otherwise, protocol errors are reported
/// through the `future-incoming-response`.
@since(version = 0.2.0)
handle: func(
request: outgoing-request,
options: option<request-options>
) -> result<future-incoming-response, error-code>;
/// This function is invoked with an outgoing HTTP Request, and it returns
/// a resource `future-incoming-response` which represents an HTTP Response
/// which may arrive in the future.
///
/// The `options` argument accepts optional parameters for the HTTP
/// protocol's transport layer.
///
/// This function may return an error if the `outgoing-request` is invalid
/// or not allowed to be made. Otherwise, protocol errors are reported
/// through the `future-incoming-response`.
@since(version = 0.2.0)
handle: func(
request: outgoing-request,
options: option<request-options>
) -> result<future-incoming-response, error-code>;
}
62 changes: 31 additions & 31 deletions wasip2/http/proxy.wit
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ package wasi:http@0.2.3;
/// 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.3;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.3;
@since(version = 0.2.0)
import wasi:random/random@0.2.3;
/// HTTP proxies have access to time and randomness.
@since(version = 0.2.0)
import wasi:clocks/monotonic-clock@0.2.3;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.3;
@since(version = 0.2.0)
import wasi:random/random@0.2.3;

/// 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.3;
@since(version = 0.2.0)
import wasi:cli/stderr@0.2.3;
/// 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.3;
@since(version = 0.2.0)
import wasi:cli/stderr@0.2.3;

/// 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.3;
/// 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.3;

/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
@since(version = 0.2.0)
import outgoing-handler;
/// This is the default handler to use when user code simply wants to make an
/// HTTP request (e.g., via `fetch()`).
@since(version = 0.2.0)
import outgoing-handler;
}

/// The `wasi:http/proxy` world captures a widely-implementable intersection of
Expand All @@ -38,13 +38,13 @@ world imports {
/// outgoing HTTP requests.
@since(version = 0.2.0)
world proxy {
@since(version = 0.2.0)
include imports;
@since(version = 0.2.0)
include imports;

/// The host delivers incoming HTTP requests to a component by calling the
/// `handle` function of this exported interface. A host may arbitrarily reuse
/// or not reuse component instance when delivering incoming HTTP requests and
/// thus a component must be able to handle 0..N calls to `handle`.
@since(version = 0.2.0)
export incoming-handler;
/// The host delivers incoming HTTP requests to a component by calling the
/// `handle` function of this exported interface. A host may arbitrarily reuse
/// or not reuse component instance when delivering incoming HTTP requests and
/// thus a component must be able to handle 0..N calls to `handle`.
@since(version = 0.2.0)
export incoming-handler;
}
Loading

0 comments on commit c43ab7b

Please sign in to comment.