Skip to content

Commit e4c71d8

Browse files
authored
feat: add wit-0.3.0-draft (#52)
* ci: update `wit-deps` to 0.5.0 Signed-off-by: Roman Volosatovs <[email protected]> * feat: add `wit-0.3.0-draft` Signed-off-by: Roman Volosatovs <[email protected]> --------- Signed-off-by: Roman Volosatovs <[email protected]>
1 parent f58d22f commit e4c71d8

File tree

24 files changed

+1894
-1
lines changed

24 files changed

+1894
-1
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- name: ensure `./wit/deps` are in sync
1515
run: |
16-
curl -Lo 'wit-deps' https://github.com/bytecodealliance/wit-deps/releases/download/v0.3.5/wit-deps-x86_64-unknown-linux-musl
16+
curl -Lo 'wit-deps' https://github.com/bytecodealliance/wit-deps/releases/download/v0.5.0/wit-deps-x86_64-unknown-linux-musl
1717
chmod +x wit-deps
1818
./wit-deps lock
19+
./wit-deps -m wit-0.3.0-draft/deps.toml -l wit-0.3.0-draft/deps.lock -d wit-0.3.0-draft/deps lock
1920
git add -N wit/deps
21+
git add -N wit-0.3.0-draft/deps
2022
git diff --exit-code
2123
- uses: WebAssembly/wit-abi-up-to-date@v22
2224
with:

wit-0.3.0-draft/command.wit

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

wit-0.3.0-draft/deps.lock

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[clocks]
2+
sha256 = "26e315db0d371495f8834edfc0e479042f94152ce677d96d54d3623d0e4ffb1e"
3+
sha512 = "e1c76f499435841316f9287b88d8173558e64f277c321ff390556de8707a0b18dd6c1749bbb17bbbba8d523da246ef6eb05c990ceddb762e03efb2ae30cacc76"
4+
5+
[filesystem]
6+
url = "https://github.com/WebAssembly/wasi-filesystem/archive/main.tar.gz"
7+
subdir = "wit-0.3.0-draft"
8+
sha256 = "f8a82b21e18cad3498b53475666a3f00c4c1b5f030b7ed47c79262e3dbe97461"
9+
sha512 = "0e62fe9ff3ba0572d890a2edd969e88a5c2327279cec681d3f2688ed8442820333f6041b0f0956b44941f971a6afb785bd2f5248ca0c99b51f13521496cadbcc"
10+
deps = ["clocks"]
11+
12+
[random]
13+
url = "https://github.com/WebAssembly/wasi-random/archive/main.tar.gz"
14+
subdir = "wit-0.3.0-draft"
15+
sha256 = "7a483077cc23fc9dc7a3f067d62795663cceee7dbbd23f205934282b1164a83e"
16+
sha512 = "b99280fd60699f781f20209659e94c0058ce6b9e973ddbd0b8865d752f88c74633485d486d5a86b709385b6e60357470d1c6fbcb3a2769af210c0b1f52417506"
17+
18+
[sockets]
19+
url = "https://github.com/WebAssembly/wasi-sockets/archive/main.tar.gz"
20+
subdir = "wit-0.3.0-draft"
21+
sha256 = "48fa617cdf64b66adc7136e4f0c14886061e6d5134072bf8e1698b84e2579669"
22+
sha512 = "786b8a03c14d3f529500275762a37c497ea1e6479e71028e8173aa07594beb77226904d77970a7c356ff3f59aa4a5c10f2e68537cc96b9916ff03a317b05a229"
23+
deps = ["clocks"]

wit-0.3.0-draft/deps.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
filesystem = { url = "https://github.com/WebAssembly/wasi-filesystem/archive/main.tar.gz", subdir = "wit-0.3.0-draft" }
2+
random = { url = "https://github.com/WebAssembly/wasi-random/archive/main.tar.gz", subdir = "wit-0.3.0-draft" }
3+
sockets = { url = "https://github.com/WebAssembly/wasi-sockets/archive/main.tar.gz", subdir = "wit-0.3.0-draft" }
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package wasi:clocks@0.3.0;
2+
/// WASI Monotonic Clock is a clock API intended to let users measure elapsed
3+
/// time.
4+
///
5+
/// It is intended to be portable at least between Unix-family platforms and
6+
/// Windows.
7+
///
8+
/// A monotonic clock is a clock which has an unspecified initial value, and
9+
/// successive reads of the clock will produce non-decreasing values.
10+
@since(version = 0.3.0)
11+
interface monotonic-clock {
12+
/// An instant in time, in nanoseconds. An instant is relative to an
13+
/// unspecified initial value, and can only be compared to instances from
14+
/// the same monotonic-clock.
15+
@since(version = 0.3.0)
16+
type instant = u64;
17+
18+
/// A duration of time, in nanoseconds.
19+
@since(version = 0.3.0)
20+
type duration = u64;
21+
22+
/// Read the current value of the clock.
23+
///
24+
/// The clock is monotonic, therefore calling this function repeatedly will
25+
/// produce a sequence of non-decreasing values.
26+
@since(version = 0.3.0)
27+
now: func() -> instant;
28+
29+
/// Query the resolution of the clock. Returns the duration of time
30+
/// corresponding to a clock tick.
31+
@since(version = 0.3.0)
32+
resolution: func() -> duration;
33+
34+
/// Wait until the specified instant has occurred.
35+
@since(version = 0.3.0)
36+
wait-until: func(
37+
when: instant,
38+
);
39+
40+
/// Wait for the specified duration has elapsed.
41+
@since(version = 0.3.0)
42+
wait-for: func(
43+
how-long: duration,
44+
);
45+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package wasi:clocks@0.3.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+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package wasi:clocks@0.3.0;
2+
/// WASI Wall Clock is a clock API intended to let users query the current
3+
/// time. The name "wall" makes an analogy to a "clock on the wall", which
4+
/// is not necessarily monotonic as it may be reset.
5+
///
6+
/// It is intended to be portable at least between Unix-family platforms and
7+
/// Windows.
8+
///
9+
/// A wall clock is a clock which measures the date and time according to
10+
/// some external reference.
11+
///
12+
/// External references may be reset, so this clock is not necessarily
13+
/// monotonic, making it unsuitable for measuring elapsed time.
14+
///
15+
/// It is intended for reporting the current date and time for humans.
16+
@since(version = 0.3.0)
17+
interface wall-clock {
18+
/// A time and date in seconds plus nanoseconds.
19+
@since(version = 0.3.0)
20+
record datetime {
21+
seconds: u64,
22+
nanoseconds: u32,
23+
}
24+
25+
/// Read the current value of the clock.
26+
///
27+
/// This clock is not monotonic, therefore calling this function repeatedly
28+
/// will not necessarily produce a sequence of non-decreasing values.
29+
///
30+
/// The returned timestamps represent the number of seconds since
31+
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
32+
/// also known as [Unix Time].
33+
///
34+
/// The nanoseconds field of the output is always less than 1000000000.
35+
///
36+
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
37+
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
38+
@since(version = 0.3.0)
39+
now: func() -> datetime;
40+
41+
/// Query the resolution of the clock.
42+
///
43+
/// The nanoseconds field of the output is always less than 1000000000.
44+
@since(version = 0.3.0)
45+
resolution: func() -> datetime;
46+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package wasi:clocks@0.3.0;
2+
3+
@since(version = 0.3.0)
4+
world imports {
5+
@since(version = 0.3.0)
6+
import monotonic-clock;
7+
@since(version = 0.3.0)
8+
import wall-clock;
9+
@unstable(feature = clocks-timezone)
10+
import timezone;
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package wasi:filesystem@0.3.0;
2+
3+
@since(version = 0.3.0)
4+
interface preopens {
5+
@since(version = 0.3.0)
6+
use types.{descriptor};
7+
8+
/// Return the set of preopened directories, and their paths.
9+
@since(version = 0.3.0)
10+
get-directories: func() -> list<tuple<descriptor, string>>;
11+
}

0 commit comments

Comments
 (0)