Skip to content

Commit 74a1d20

Browse files
authored
Release WASI 0.2.1 (#612)
* rename `preview2/` to `wasip2/` * Update to v0.2.1
1 parent 3561990 commit 74a1d20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+564
-147
lines changed

preview2/cli/command.wit

-7
This file was deleted.

preview2/cli/exit.wit

-4
This file was deleted.

preview2/cli/imports.wit

-20
This file was deleted.

preview2/cli/stdio.wit

-17
This file was deleted.

preview2/clocks/world.wit

-6
This file was deleted.

preview2/io/world.wit

-6
This file was deleted.

preview2/sockets/world.wit

-11
This file was deleted.
File renamed without changes.

wasip2/cli/command.wit

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package wasi:cli@0.2.1;
2+
3+
@since(version = 0.2.0)
4+
world command {
5+
@since(version = 0.2.0)
6+
include imports;
7+
8+
@since(version = 0.2.0)
9+
export run;
10+
}

preview2/cli/environment.wit renamed to wasip2/cli/environment.wit

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@since(version = 0.2.0)
12
interface environment {
23
/// Get the POSIX-style environment variables.
34
///
@@ -7,12 +8,15 @@ interface environment {
78
/// Morally, these are a value import, but until value imports are available
89
/// in the component model, this import function should return the same
910
/// values each time it is called.
11+
@since(version = 0.2.0)
1012
get-environment: func() -> list<tuple<string, string>>;
1113

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

1518
/// Return a path that programs should use as their initial current working
1619
/// directory, interpreting `.` as shorthand for this.
20+
@since(version = 0.2.0)
1721
initial-cwd: func() -> option<string>;
1822
}

wasip2/cli/exit.wit

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@since(version = 0.2.0)
2+
interface exit {
3+
/// Exit the current instance and any linked instances.
4+
@since(version = 0.2.0)
5+
exit: func(status: result);
6+
7+
/// Exit the current instance and any linked instances, reporting the
8+
/// specified status code to the host.
9+
///
10+
/// The meaning of the code depends on the context, with 0 usually meaning
11+
/// "success", and other values indicating various types of failure.
12+
///
13+
/// This function does not return; the effect is analogous to a trap, but
14+
/// without the connotation that something bad has happened.
15+
@unstable(feature = cli-exit-with-code)
16+
exit-with-code: func(status-code: u8);
17+
}

wasip2/cli/imports.wit

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package wasi:cli@0.2.1;
2+
3+
@since(version = 0.2.0)
4+
world imports {
5+
@since(version = 0.2.0)
6+
include wasi:clocks/imports@0.2.1;
7+
@since(version = 0.2.0)
8+
include wasi:filesystem/imports@0.2.1;
9+
@since(version = 0.2.0)
10+
include wasi:sockets/imports@0.2.1;
11+
@since(version = 0.2.0)
12+
include wasi:random/imports@0.2.1;
13+
@since(version = 0.2.0)
14+
include wasi:io/imports@0.2.1;
15+
16+
@since(version = 0.2.0)
17+
import environment;
18+
@since(version = 0.2.0)
19+
import exit;
20+
@since(version = 0.2.0)
21+
import stdin;
22+
@since(version = 0.2.0)
23+
import stdout;
24+
@since(version = 0.2.0)
25+
import stderr;
26+
@since(version = 0.2.0)
27+
import terminal-input;
28+
@since(version = 0.2.0)
29+
import terminal-output;
30+
@since(version = 0.2.0)
31+
import terminal-stdin;
32+
@since(version = 0.2.0)
33+
import terminal-stdout;
34+
@since(version = 0.2.0)
35+
import terminal-stderr;
36+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
@since(version = 0.2.0)
12
interface run {
23
/// Run the program.
4+
@since(version = 0.2.0)
35
run: func() -> result;
46
}

wasip2/cli/stdio.wit

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@since(version = 0.2.0)
2+
interface stdin {
3+
@since(version = 0.2.0)
4+
use wasi:io/streams@0.2.1.{input-stream};
5+
6+
@since(version = 0.2.0)
7+
get-stdin: func() -> input-stream;
8+
}
9+
10+
@since(version = 0.2.0)
11+
interface stdout {
12+
@since(version = 0.2.0)
13+
use wasi:io/streams@0.2.1.{output-stream};
14+
15+
@since(version = 0.2.0)
16+
get-stdout: func() -> output-stream;
17+
}
18+
19+
@since(version = 0.2.0)
20+
interface stderr {
21+
@since(version = 0.2.0)
22+
use wasi:io/streams@0.2.1.{output-stream};
23+
24+
@since(version = 0.2.0)
25+
get-stderr: func() -> output-stream;
26+
}

preview2/cli/terminal.wit renamed to wasip2/cli/terminal.wit

+13
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
/// In the future, this may include functions for disabling echoing,
44
/// disabling input buffering so that keyboard events are sent through
55
/// immediately, querying supported features, and so on.
6+
@since(version = 0.2.0)
67
interface terminal-input {
78
/// The input side of a terminal.
9+
@since(version = 0.2.0)
810
resource terminal-input;
911
}
1012

@@ -13,37 +15,48 @@ interface terminal-input {
1315
/// In the future, this may include functions for querying the terminal
1416
/// size, being notified of terminal size changes, querying supported
1517
/// features, and so on.
18+
@since(version = 0.2.0)
1619
interface terminal-output {
1720
/// The output side of a terminal.
21+
@since(version = 0.2.0)
1822
resource terminal-output;
1923
}
2024

2125
/// An interface providing an optional `terminal-input` for stdin as a
2226
/// link-time authority.
27+
@since(version = 0.2.0)
2328
interface terminal-stdin {
29+
@since(version = 0.2.0)
2430
use terminal-input.{terminal-input};
2531

2632
/// If stdin is connected to a terminal, return a `terminal-input` handle
2733
/// allowing further interaction with it.
34+
@since(version = 0.2.0)
2835
get-terminal-stdin: func() -> option<terminal-input>;
2936
}
3037

3138
/// An interface providing an optional `terminal-output` for stdout as a
3239
/// link-time authority.
40+
@since(version = 0.2.0)
3341
interface terminal-stdout {
42+
@since(version = 0.2.0)
3443
use terminal-output.{terminal-output};
3544

3645
/// If stdout is connected to a terminal, return a `terminal-output` handle
3746
/// allowing further interaction with it.
47+
@since(version = 0.2.0)
3848
get-terminal-stdout: func() -> option<terminal-output>;
3949
}
4050

4151
/// An interface providing an optional `terminal-output` for stderr as a
4252
/// link-time authority.
53+
@since(version = 0.2.0)
4354
interface terminal-stderr {
55+
@since(version = 0.2.0)
4456
use terminal-output.{terminal-output};
4557

4658
/// If stderr is connected to a terminal, return a `terminal-output` handle
4759
/// allowing further interaction with it.
60+
@since(version = 0.2.0)
4861
get-terminal-stderr: func() -> option<terminal-output>;
4962
}

preview2/clocks/monotonic-clock.wit renamed to wasip2/clocks/monotonic-clock.wit

+11-6
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,43 @@ package wasi:clocks@0.2.0;
77
///
88
/// A monotonic clock is a clock which has an unspecified initial value, and
99
/// successive reads of the clock will produce non-decreasing values.
10-
///
11-
/// It is intended for measuring elapsed time.
10+
@since(version = 0.2.0)
1211
interface monotonic-clock {
12+
@since(version = 0.2.0)
1313
use wasi:io/poll@0.2.0.{pollable};
1414

1515
/// An instant in time, in nanoseconds. An instant is relative to an
1616
/// unspecified initial value, and can only be compared to instances from
1717
/// the same monotonic-clock.
18+
@since(version = 0.2.0)
1819
type instant = u64;
1920

2021
/// A duration of time, in nanoseconds.
22+
@since(version = 0.2.0)
2123
type duration = u64;
2224

2325
/// Read the current value of the clock.
2426
///
2527
/// The clock is monotonic, therefore calling this function repeatedly will
2628
/// produce a sequence of non-decreasing values.
29+
@since(version = 0.2.0)
2730
now: func() -> instant;
2831

2932
/// Query the resolution of the clock. Returns the duration of time
3033
/// corresponding to a clock tick.
34+
@since(version = 0.2.0)
3135
resolution: func() -> duration;
3236

3337
/// Create a `pollable` which will resolve once the specified instant
34-
/// occured.
38+
/// has occured.
39+
@since(version = 0.2.0)
3540
subscribe-instant: func(
3641
when: instant,
3742
) -> pollable;
3843

39-
/// Create a `pollable` which will resolve once the given duration has
40-
/// elapsed, starting at the time at which this function was called.
41-
/// occured.
44+
/// Create a `pollable` that will resolve after the specified duration has
45+
/// elapsed from the time this function is invoked.
46+
@since(version = 0.2.0)
4247
subscribe-duration: func(
4348
when: duration,
4449
) -> pollable;

wasip2/clocks/timezone.wit

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package wasi:clocks@0.2.0;
2+
3+
@unstable(feature = clocks-timezone)
4+
interface timezone {
5+
@unstable(feature = clocks-timezone)
6+
use wall-clock.{datetime};
7+
8+
/// Return information needed to display the given `datetime`. This includes
9+
/// the UTC offset, the time zone name, and a flag indicating whether
10+
/// daylight saving time is active.
11+
///
12+
/// If the timezone cannot be determined for the given `datetime`, return a
13+
/// `timezone-display` for `UTC` with a `utc-offset` of 0 and no daylight
14+
/// saving time.
15+
@unstable(feature = clocks-timezone)
16+
display: func(when: datetime) -> timezone-display;
17+
18+
/// The same as `display`, but only return the UTC offset.
19+
@unstable(feature = clocks-timezone)
20+
utc-offset: func(when: datetime) -> s32;
21+
22+
/// Information useful for displaying the timezone of a specific `datetime`.
23+
///
24+
/// This information may vary within a single `timezone` to reflect daylight
25+
/// saving time adjustments.
26+
@unstable(feature = clocks-timezone)
27+
record timezone-display {
28+
/// The number of seconds difference between UTC time and the local
29+
/// time of the timezone.
30+
///
31+
/// The returned value will always be less than 86400 which is the
32+
/// number of seconds in a day (24*60*60).
33+
///
34+
/// In implementations that do not expose an actual time zone, this
35+
/// should return 0.
36+
utc-offset: s32,
37+
38+
/// The abbreviated name of the timezone to display to a user. The name
39+
/// `UTC` indicates Coordinated Universal Time. Otherwise, this should
40+
/// reference local standards for the name of the time zone.
41+
///
42+
/// In implementations that do not expose an actual time zone, this
43+
/// should be the string `UTC`.
44+
///
45+
/// In time zones that do not have an applicable name, a formatted
46+
/// representation of the UTC offset may be returned, such as `-04:00`.
47+
name: string,
48+
49+
/// Whether daylight saving time is active.
50+
///
51+
/// In implementations that do not expose an actual time zone, this
52+
/// should return false.
53+
in-daylight-saving-time: bool,
54+
}
55+
}

preview2/clocks/wall-clock.wit renamed to wasip2/clocks/wall-clock.wit

+4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ package wasi:clocks@0.2.0;
1313
/// monotonic, making it unsuitable for measuring elapsed time.
1414
///
1515
/// It is intended for reporting the current date and time for humans.
16+
@since(version = 0.2.0)
1617
interface wall-clock {
1718
/// A time and date in seconds plus nanoseconds.
19+
@since(version = 0.2.0)
1820
record datetime {
1921
seconds: u64,
2022
nanoseconds: u32,
@@ -33,10 +35,12 @@ interface wall-clock {
3335
///
3436
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
3537
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
38+
@since(version = 0.2.0)
3639
now: func() -> datetime;
3740

3841
/// Query the resolution of the clock.
3942
///
4043
/// The nanoseconds field of the output is always less than 1000000000.
44+
@since(version = 0.2.0)
4145
resolution: func() -> datetime;
4246
}

0 commit comments

Comments
 (0)