Skip to content
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
8 changes: 0 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.84.1
components: rustfmt
target: wasm32-unknown-unknown,wasm32-wasip2
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
- name: Install cargo component
Expand Down Expand Up @@ -61,10 +57,6 @@ jobs:
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: 1.84.1
components: rustfmt
target: wasm32-unknown-unknown
- name: Install cargo binstall
uses: cargo-bins/cargo-binstall@main
- name: Install wkg
Expand Down
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ components: $(foreach component,$(COMPONENTS),lib/$(component).wasm $(foreach co
define BUILD_COMPONENT

lib/$1.wasm: Cargo.toml Cargo.lock wit/deps $(shell find components/$1 -type f)
@$(eval TARGET := $(if $(findstring $1,keyvalue-to-filesystem),wasm32-wasip2,wasm32-unknown-unknown))
cargo component build -p $1 --target $(TARGET) --release
cp target/$(TARGET)/release/$(subst -,_,$1).wasm lib/$1.wasm
cargo component build -p $1 --target wasm32-unknown-unknown --release
cp target/wasm32-unknown-unknown/release/$(subst -,_,$1).wasm lib/$1.wasm
cp components/$1/README.md lib/$1.wasm.md

lib/$1.debug.wasm: Cargo.toml Cargo.lock wit/deps $(shell find components/$1 -type f)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A collection of utility components that remix wasi:logging types and interfaces.
## Build

Prereqs:
- a rust toolchain with a recent nightly (`rustup toolchain install nightly`)
- a rust toolchain
- [`cargo component`](https://github.com/bytecodealliance/cargo-component)
- [`wkg`](https://github.com/bytecodealliance/wasm-pkg-tools)

Expand Down
1 change: 1 addition & 0 deletions components/levels/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ fn level_map(level: Level) -> logging::Level {
wit_bindgen::generate!({
path: "../../wit",
world: "levels",
features: ["clocks-timezone"],
generate_all
});

Expand Down
1 change: 1 addition & 0 deletions components/to-stdout/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ impl Guest for LoggingToStdout {
wit_bindgen::generate!({
path: "../../wit",
world: "to-stdout",
features: ["clocks-timezone"],
generate_all
});

Expand Down
3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.91"
targets = [ "wasm32-unknown-unknown", "wasm32-wasip2" ]
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:cli@0.2.3;
package wasi:cli@0.2.6;

@since(version = 0.2.0)
interface environment {
Expand Down Expand Up @@ -28,6 +28,17 @@ 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, 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);
}

@since(version = 0.2.0)
Expand All @@ -40,7 +51,7 @@ interface run {
@since(version = 0.2.0)
interface stdin {
@since(version = 0.2.0)
use wasi:io/streams@0.2.3.{input-stream};
use wasi:io/streams@0.2.6.{input-stream};

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

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

@since(version = 0.2.0)
get-stderr: func() -> output-stream;
Expand Down Expand Up @@ -134,11 +145,11 @@ world imports {
@since(version = 0.2.0)
import exit;
@since(version = 0.2.0)
import wasi:io/error@0.2.3;
import wasi:io/error@0.2.6;
@since(version = 0.2.0)
import wasi:io/poll@0.2.3;
import wasi:io/poll@0.2.6;
@since(version = 0.2.0)
import wasi:io/streams@0.2.3;
import wasi:io/streams@0.2.6;
@since(version = 0.2.0)
import stdin;
@since(version = 0.2.0)
Expand All @@ -156,33 +167,35 @@ world imports {
@since(version = 0.2.0)
import terminal-stderr;
@since(version = 0.2.0)
import wasi:clocks/monotonic-clock@0.2.3;
import wasi:clocks/monotonic-clock@0.2.6;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.3;
import wasi:clocks/wall-clock@0.2.6;
@unstable(feature = clocks-timezone)
import wasi:clocks/timezone@0.2.6;
@since(version = 0.2.0)
import wasi:filesystem/types@0.2.3;
import wasi:filesystem/types@0.2.6;
@since(version = 0.2.0)
import wasi:filesystem/preopens@0.2.3;
import wasi:filesystem/preopens@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/network@0.2.3;
import wasi:sockets/network@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/instance-network@0.2.3;
import wasi:sockets/instance-network@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/udp@0.2.3;
import wasi:sockets/udp@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/udp-create-socket@0.2.3;
import wasi:sockets/udp-create-socket@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/tcp@0.2.3;
import wasi:sockets/tcp@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/tcp-create-socket@0.2.3;
import wasi:sockets/tcp-create-socket@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/ip-name-lookup@0.2.3;
import wasi:sockets/ip-name-lookup@0.2.6;
@since(version = 0.2.0)
import wasi:random/random@0.2.3;
import wasi:random/random@0.2.6;
@since(version = 0.2.0)
import wasi:random/insecure@0.2.3;
import wasi:random/insecure@0.2.6;
@since(version = 0.2.0)
import wasi:random/insecure-seed@0.2.3;
import wasi:random/insecure-seed@0.2.6;
}
@since(version = 0.2.0)
world command {
Expand All @@ -191,11 +204,11 @@ world command {
@since(version = 0.2.0)
import exit;
@since(version = 0.2.0)
import wasi:io/error@0.2.3;
import wasi:io/error@0.2.6;
@since(version = 0.2.0)
import wasi:io/poll@0.2.3;
import wasi:io/poll@0.2.6;
@since(version = 0.2.0)
import wasi:io/streams@0.2.3;
import wasi:io/streams@0.2.6;
@since(version = 0.2.0)
import stdin;
@since(version = 0.2.0)
Expand All @@ -213,33 +226,35 @@ world command {
@since(version = 0.2.0)
import terminal-stderr;
@since(version = 0.2.0)
import wasi:clocks/monotonic-clock@0.2.3;
import wasi:clocks/monotonic-clock@0.2.6;
@since(version = 0.2.0)
import wasi:clocks/wall-clock@0.2.3;
import wasi:clocks/wall-clock@0.2.6;
@unstable(feature = clocks-timezone)
import wasi:clocks/timezone@0.2.6;
@since(version = 0.2.0)
import wasi:filesystem/types@0.2.3;
import wasi:filesystem/types@0.2.6;
@since(version = 0.2.0)
import wasi:filesystem/preopens@0.2.3;
import wasi:filesystem/preopens@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/network@0.2.3;
import wasi:sockets/network@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/instance-network@0.2.3;
import wasi:sockets/instance-network@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/udp@0.2.3;
import wasi:sockets/udp@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/udp-create-socket@0.2.3;
import wasi:sockets/udp-create-socket@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/tcp@0.2.3;
import wasi:sockets/tcp@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/tcp-create-socket@0.2.3;
import wasi:sockets/tcp-create-socket@0.2.6;
@since(version = 0.2.0)
import wasi:sockets/ip-name-lookup@0.2.3;
import wasi:sockets/ip-name-lookup@0.2.6;
@since(version = 0.2.0)
import wasi:random/random@0.2.3;
import wasi:random/random@0.2.6;
@since(version = 0.2.0)
import wasi:random/insecure@0.2.3;
import wasi:random/insecure@0.2.6;
@since(version = 0.2.0)
import wasi:random/insecure-seed@0.2.3;
import wasi:random/insecure-seed@0.2.6;

@since(version = 0.2.0)
export run;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:clocks@0.2.3;
package wasi:clocks@0.2.6;

/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
/// time.
Expand All @@ -11,7 +11,7 @@ package wasi:clocks@0.2.3;
@since(version = 0.2.0)
interface monotonic-clock {
@since(version = 0.2.0)
use wasi:io/poll@0.2.3.{pollable};
use wasi:io/poll@0.2.6.{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 Expand Up @@ -92,12 +92,66 @@ interface wall-clock {
resolution: func() -> datetime;
}

@unstable(feature = clocks-timezone)
interface timezone {
@unstable(feature = clocks-timezone)
use wall-clock.{datetime};

/// Information useful for displaying the timezone of a specific `datetime`.
///
/// This information may vary within a single `timezone` to reflect daylight
/// saving time adjustments.
@unstable(feature = clocks-timezone)
record timezone-display {
/// The number of seconds difference between UTC time and the local
/// time of the timezone.
///
/// The returned value will always be less than 86400 which is the
/// number of seconds in a day (24*60*60).
///
/// In implementations that do not expose an actual time zone, this
/// should return 0.
utc-offset: s32,
/// The abbreviated name of the timezone to display to a user. The name
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
/// reference local standards for the name of the time zone.
///
/// In implementations that do not expose an actual time zone, this
/// should be the string `UTC`.
///
/// In time zones that do not have an applicable name, a formatted
/// representation of the UTC offset may be returned, such as `-04:00`.
name: string,
/// Whether daylight saving time is active.
///
/// In implementations that do not expose an actual time zone, this
/// should return false.
in-daylight-saving-time: bool,
}

/// Return information needed to display the given `datetime`. This includes
/// the UTC offset, the time zone name, and a flag indicating whether
/// daylight saving time is active.
///
/// If the timezone cannot be determined for the given `datetime`, return a
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
/// saving time.
@unstable(feature = clocks-timezone)
display: func(when: datetime) -> timezone-display;

/// The same as `display`, but only return the UTC offset.
@unstable(feature = clocks-timezone)
utc-offset: func(when: datetime) -> s32;
}

@since(version = 0.2.0)
world imports {
@since(version = 0.2.0)
import wasi:io/poll@0.2.3;
import wasi:io/poll@0.2.6;
@since(version = 0.2.0)
import monotonic-clock;
@since(version = 0.2.0)
import wall-clock;
@unstable(feature = clocks-timezone)
import timezone;
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package wasi:filesystem@0.2.3;
package wasi:filesystem@0.2.6;

interface types {
use wasi:io/streams@0.2.3.{input-stream, output-stream, error};
use wasi:clocks/wall-clock@0.2.3.{datetime};
use wasi:io/streams@0.2.6.{input-stream, output-stream, error};
use wasi:clocks/wall-clock@0.2.6.{datetime};

type filesize = u64;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:io@0.2.3;
package wasi:io@0.2.6;

interface poll {
resource pollable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package wasi:random@0.2.3;
package wasi:random@0.2.6;

interface random {
get-random-bytes: func(len: u64) -> list<u8>;
Expand Down
Loading