@wasi-gfx/js-webgpu 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/canvas.d.ts +3 -3
- package/dist/canvas.js +36 -23
- package/dist/globals.js +12 -10
- package/dist/webgpu.d.ts +68 -12
- package/dist/webgpu.js +340 -48
- package/package.json +12 -6
- package/types/interfaces/wasi-cli-run.d.ts +2 -2
- package/types/interfaces/wasi-cli-stdout.d.ts +14 -3
- package/types/interfaces/wasi-cli-types.d.ts +15 -0
- package/types/interfaces/wasi-gfx-frame-buffer-frame-buffer.d.ts +13 -0
- package/types/interfaces/wasi-gfx-surface-surface-frame-buffer.d.ts +12 -0
- package/types/interfaces/wasi-gfx-surface-surface-webgpu.d.ts +29 -0
- package/types/interfaces/{wasi-surface-surface.d.ts → wasi-gfx-surface-surface.d.ts} +8 -18
- package/types/interfaces/wasi-webgpu-webgpu.d.ts +809 -810
- package/types/wit.d.ts +9 -10
- package/wit/deps/wasi-cli-0.3.0/package.wit +256 -0
- package/wit/deps/wasi-clocks-0.3.0/package.wit +43 -0
- package/wit/deps/wasi-filesystem-0.3.0/package.wit +149 -0
- package/wit/deps/wasi-gfx-frame-buffer-0.2.0/package.wit +13 -0
- package/wit/deps/{surface/surface.wit → wasi-gfx-surface-0.2.0/package.wit} +69 -44
- package/wit/deps/wasi-random-0.3.0/package.wit +18 -0
- package/wit/deps/wasi-sockets-0.3.0/package.wit +116 -0
- package/wit/deps/{webgpu/webgpu.wit → wasi-webgpu-0.3.0-rc.2/package.wit} +1007 -836
- package/wit/world.wit +8 -7
- package/types/interfaces/wasi-frame-buffer-frame-buffer.d.ts +0 -21
- package/types/interfaces/wasi-graphics-context-graphics-context.d.ts +0 -17
- package/types/interfaces/wasi-io-error.d.ts +0 -18
- package/types/interfaces/wasi-io-poll.d.ts +0 -43
- package/types/interfaces/wasi-io-streams.d.ts +0 -240
- package/wit/deps/cli/command.wit +0 -7
- package/wit/deps/cli/environment.wit +0 -18
- package/wit/deps/cli/exit.wit +0 -4
- package/wit/deps/cli/imports.wit +0 -20
- package/wit/deps/cli/run.wit +0 -4
- package/wit/deps/cli/stdio.wit +0 -17
- package/wit/deps/cli/terminal.wit +0 -49
- package/wit/deps/clocks/monotonic-clock.wit +0 -45
- package/wit/deps/clocks/wall-clock.wit +0 -42
- package/wit/deps/clocks/world.wit +0 -6
- package/wit/deps/filesystem/preopens.wit +0 -8
- package/wit/deps/filesystem/types.wit +0 -634
- package/wit/deps/filesystem/world.wit +0 -6
- package/wit/deps/frame-buffer/frame-buffer.wit +0 -23
- package/wit/deps/graphics-context/graphics-context.wit +0 -18
- package/wit/deps/io/error.wit +0 -34
- package/wit/deps/io/poll.wit +0 -41
- package/wit/deps/io/streams.wit +0 -262
- package/wit/deps/io/world.wit +0 -6
- package/wit/deps/random/insecure-seed.wit +0 -25
- package/wit/deps/random/insecure.wit +0 -22
- package/wit/deps/random/random.wit +0 -26
- package/wit/deps/random/world.wit +0 -7
- package/wit/deps/sockets/instance-network.wit +0 -9
- package/wit/deps/sockets/ip-name-lookup.wit +0 -51
- package/wit/deps/sockets/network.wit +0 -145
- package/wit/deps/sockets/tcp-create-socket.wit +0 -27
- package/wit/deps/sockets/tcp.wit +0 -353
- package/wit/deps/sockets/udp-create-socket.wit +0 -27
- package/wit/deps/sockets/udp.wit +0 -266
- package/wit/deps/sockets/world.wit +0 -11
- package/wit/deps/webgpu/imports.wit +0 -5
- package/wit/deps.lock +0 -51
- package/wit/deps.toml +0 -18
package/wit/world.wit
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
package wasi-gfx:js-webgpu
|
|
1
|
+
package wasi-gfx:js-webgpu;
|
|
2
2
|
|
|
3
3
|
world imports {
|
|
4
|
-
import wasi:webgpu/webgpu@0.0.
|
|
5
|
-
import wasi:
|
|
6
|
-
import wasi:surface/surface@0.0
|
|
7
|
-
import wasi:
|
|
8
|
-
import wasi:
|
|
9
|
-
|
|
4
|
+
import wasi:webgpu/webgpu@0.3.0-rc.2;
|
|
5
|
+
import wasi-gfx:frame-buffer/frame-buffer@0.2.0;
|
|
6
|
+
import wasi-gfx:surface/surface@0.2.0;
|
|
7
|
+
import wasi-gfx:surface/surface-webgpu@0.2.0;
|
|
8
|
+
import wasi-gfx:surface/surface-frame-buffer@0.2.0;
|
|
9
|
+
import wasi:cli/stdout@0.3.0;
|
|
10
|
+
export wasi:cli/run@0.3.0;
|
|
10
11
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:frame-buffer/frame-buffer@0.0.1 **/
|
|
2
|
-
export type Context = import('./wasi-graphics-context-graphics-context.js').Context;
|
|
3
|
-
export type AbstractBuffer = import('./wasi-graphics-context-graphics-context.js').AbstractBuffer;
|
|
4
|
-
|
|
5
|
-
export class Buffer {
|
|
6
|
-
/**
|
|
7
|
-
* This type does not have a public constructor.
|
|
8
|
-
*/
|
|
9
|
-
private constructor();
|
|
10
|
-
static fromGraphicsBuffer(buffer: AbstractBuffer): Buffer;
|
|
11
|
-
/**
|
|
12
|
-
* TODO: This should be replcated with something that doesn't require a copy.
|
|
13
|
-
*/
|
|
14
|
-
get(): Uint8Array;
|
|
15
|
-
set(val: Uint8Array): void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export class Device {
|
|
19
|
-
constructor()
|
|
20
|
-
connectGraphicsContext(context: Context): void;
|
|
21
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:graphics-context/graphics-context@0.0.1 **/
|
|
2
|
-
|
|
3
|
-
export class AbstractBuffer {
|
|
4
|
-
/**
|
|
5
|
-
* This type does not have a public constructor.
|
|
6
|
-
*/
|
|
7
|
-
private constructor();
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class Context {
|
|
11
|
-
constructor()
|
|
12
|
-
getCurrentBuffer(): AbstractBuffer;
|
|
13
|
-
/**
|
|
14
|
-
* TODO: might want to remove this.
|
|
15
|
-
*/
|
|
16
|
-
present(): void;
|
|
17
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:io/error@0.2.0 **/
|
|
2
|
-
|
|
3
|
-
export class Error {
|
|
4
|
-
/**
|
|
5
|
-
* This type does not have a public constructor.
|
|
6
|
-
*/
|
|
7
|
-
private constructor();
|
|
8
|
-
/**
|
|
9
|
-
* Returns a string that is suitable to assist humans in debugging
|
|
10
|
-
* this error.
|
|
11
|
-
*
|
|
12
|
-
* WARNING: The returned string should not be consumed mechanically!
|
|
13
|
-
* It may change across platforms, hosts, or other implementation
|
|
14
|
-
* details. Parsing this string is a major platform-compatibility
|
|
15
|
-
* hazard.
|
|
16
|
-
*/
|
|
17
|
-
toDebugString(): string;
|
|
18
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:io/poll@0.2.0 **/
|
|
2
|
-
/**
|
|
3
|
-
* Poll for completion on a set of pollables.
|
|
4
|
-
*
|
|
5
|
-
* This function takes a list of pollables, which identify I/O sources of
|
|
6
|
-
* interest, and waits until one or more of the events is ready for I/O.
|
|
7
|
-
*
|
|
8
|
-
* The result `list<u32>` contains one or more indices of handles in the
|
|
9
|
-
* argument list that is ready for I/O.
|
|
10
|
-
*
|
|
11
|
-
* If the list contains more elements than can be indexed with a `u32`
|
|
12
|
-
* value, this function traps.
|
|
13
|
-
*
|
|
14
|
-
* A timeout can be implemented by adding a pollable from the
|
|
15
|
-
* wasi-clocks API to the list.
|
|
16
|
-
*
|
|
17
|
-
* This function does not return a `result`; polling in itself does not
|
|
18
|
-
* do any I/O so it doesn't fail. If any of the I/O sources identified by
|
|
19
|
-
* the pollables has an error, it is indicated by marking the source as
|
|
20
|
-
* being reaedy for I/O.
|
|
21
|
-
*/
|
|
22
|
-
export function poll(in_: Array<Pollable>): Uint32Array;
|
|
23
|
-
|
|
24
|
-
export class Pollable {
|
|
25
|
-
/**
|
|
26
|
-
* This type does not have a public constructor.
|
|
27
|
-
*/
|
|
28
|
-
private constructor();
|
|
29
|
-
/**
|
|
30
|
-
* Return the readiness of a pollable. This function never blocks.
|
|
31
|
-
*
|
|
32
|
-
* Returns `true` when the pollable is ready, and `false` otherwise.
|
|
33
|
-
*/
|
|
34
|
-
ready(): boolean;
|
|
35
|
-
/**
|
|
36
|
-
* `block` returns immediately if the pollable is ready, and otherwise
|
|
37
|
-
* blocks until ready.
|
|
38
|
-
*
|
|
39
|
-
* This function is equivalent to calling `poll.poll` on a list
|
|
40
|
-
* containing only this pollable.
|
|
41
|
-
*/
|
|
42
|
-
block(): void;
|
|
43
|
-
}
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
/** @module Interface wasi:io/streams@0.2.0 **/
|
|
2
|
-
export type Error = import('./wasi-io-error.js').Error;
|
|
3
|
-
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
4
|
-
/**
|
|
5
|
-
* An error for input-stream and output-stream operations.
|
|
6
|
-
*/
|
|
7
|
-
export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
|
|
8
|
-
/**
|
|
9
|
-
* The last operation (a write or flush) failed before completion.
|
|
10
|
-
*
|
|
11
|
-
* More information is available in the `error` payload.
|
|
12
|
-
*/
|
|
13
|
-
export interface StreamErrorLastOperationFailed {
|
|
14
|
-
tag: 'last-operation-failed',
|
|
15
|
-
val: Error,
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The stream is closed: no more input will be accepted by the
|
|
19
|
-
* stream. A closed output-stream will return this error on all
|
|
20
|
-
* future operations.
|
|
21
|
-
*/
|
|
22
|
-
export interface StreamErrorClosed {
|
|
23
|
-
tag: 'closed',
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export class InputStream {
|
|
27
|
-
/**
|
|
28
|
-
* This type does not have a public constructor.
|
|
29
|
-
*/
|
|
30
|
-
private constructor();
|
|
31
|
-
/**
|
|
32
|
-
* Perform a non-blocking read from the stream.
|
|
33
|
-
*
|
|
34
|
-
* When the source of a `read` is binary data, the bytes from the source
|
|
35
|
-
* are returned verbatim. When the source of a `read` is known to the
|
|
36
|
-
* implementation to be text, bytes containing the UTF-8 encoding of the
|
|
37
|
-
* text are returned.
|
|
38
|
-
*
|
|
39
|
-
* This function returns a list of bytes containing the read data,
|
|
40
|
-
* when successful. The returned list will contain up to `len` bytes;
|
|
41
|
-
* it may return fewer than requested, but not more. The list is
|
|
42
|
-
* empty when no bytes are available for reading at this time. The
|
|
43
|
-
* pollable given by `subscribe` will be ready when more bytes are
|
|
44
|
-
* available.
|
|
45
|
-
*
|
|
46
|
-
* This function fails with a `stream-error` when the operation
|
|
47
|
-
* encounters an error, giving `last-operation-failed`, or when the
|
|
48
|
-
* stream is closed, giving `closed`.
|
|
49
|
-
*
|
|
50
|
-
* When the caller gives a `len` of 0, it represents a request to
|
|
51
|
-
* read 0 bytes. If the stream is still open, this call should
|
|
52
|
-
* succeed and return an empty list, or otherwise fail with `closed`.
|
|
53
|
-
*
|
|
54
|
-
* The `len` parameter is a `u64`, which could represent a list of u8 which
|
|
55
|
-
* is not possible to allocate in wasm32, or not desirable to allocate as
|
|
56
|
-
* as a return value by the callee. The callee may return a list of bytes
|
|
57
|
-
* less than `len` in size while more bytes are available for reading.
|
|
58
|
-
*/
|
|
59
|
-
read(len: bigint): Uint8Array;
|
|
60
|
-
/**
|
|
61
|
-
* Read bytes from a stream, after blocking until at least one byte can
|
|
62
|
-
* be read. Except for blocking, behavior is identical to `read`.
|
|
63
|
-
*/
|
|
64
|
-
blockingRead(len: bigint): Uint8Array;
|
|
65
|
-
/**
|
|
66
|
-
* Skip bytes from a stream. Returns number of bytes skipped.
|
|
67
|
-
*
|
|
68
|
-
* Behaves identical to `read`, except instead of returning a list
|
|
69
|
-
* of bytes, returns the number of bytes consumed from the stream.
|
|
70
|
-
*/
|
|
71
|
-
skip(len: bigint): bigint;
|
|
72
|
-
/**
|
|
73
|
-
* Skip bytes from a stream, after blocking until at least one byte
|
|
74
|
-
* can be skipped. Except for blocking behavior, identical to `skip`.
|
|
75
|
-
*/
|
|
76
|
-
blockingSkip(len: bigint): bigint;
|
|
77
|
-
/**
|
|
78
|
-
* Create a `pollable` which will resolve once either the specified stream
|
|
79
|
-
* has bytes available to read or the other end of the stream has been
|
|
80
|
-
* closed.
|
|
81
|
-
* The created `pollable` is a child resource of the `input-stream`.
|
|
82
|
-
* Implementations may trap if the `input-stream` is dropped before
|
|
83
|
-
* all derived `pollable`s created with this function are dropped.
|
|
84
|
-
*/
|
|
85
|
-
subscribe(): Pollable;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
export class OutputStream {
|
|
89
|
-
/**
|
|
90
|
-
* This type does not have a public constructor.
|
|
91
|
-
*/
|
|
92
|
-
private constructor();
|
|
93
|
-
/**
|
|
94
|
-
* Check readiness for writing. This function never blocks.
|
|
95
|
-
*
|
|
96
|
-
* Returns the number of bytes permitted for the next call to `write`,
|
|
97
|
-
* or an error. Calling `write` with more bytes than this function has
|
|
98
|
-
* permitted will trap.
|
|
99
|
-
*
|
|
100
|
-
* When this function returns 0 bytes, the `subscribe` pollable will
|
|
101
|
-
* become ready when this function will report at least 1 byte, or an
|
|
102
|
-
* error.
|
|
103
|
-
*/
|
|
104
|
-
checkWrite(): bigint;
|
|
105
|
-
/**
|
|
106
|
-
* Perform a write. This function never blocks.
|
|
107
|
-
*
|
|
108
|
-
* When the destination of a `write` is binary data, the bytes from
|
|
109
|
-
* `contents` are written verbatim. When the destination of a `write` is
|
|
110
|
-
* known to the implementation to be text, the bytes of `contents` are
|
|
111
|
-
* transcoded from UTF-8 into the encoding of the destination and then
|
|
112
|
-
* written.
|
|
113
|
-
*
|
|
114
|
-
* Precondition: check-write gave permit of Ok(n) and contents has a
|
|
115
|
-
* length of less than or equal to n. Otherwise, this function will trap.
|
|
116
|
-
*
|
|
117
|
-
* returns Err(closed) without writing if the stream has closed since
|
|
118
|
-
* the last call to check-write provided a permit.
|
|
119
|
-
*/
|
|
120
|
-
write(contents: Uint8Array): void;
|
|
121
|
-
/**
|
|
122
|
-
* Perform a write of up to 4096 bytes, and then flush the stream. Block
|
|
123
|
-
* until all of these operations are complete, or an error occurs.
|
|
124
|
-
*
|
|
125
|
-
* This is a convenience wrapper around the use of `check-write`,
|
|
126
|
-
* `subscribe`, `write`, and `flush`, and is implemented with the
|
|
127
|
-
* following pseudo-code:
|
|
128
|
-
*
|
|
129
|
-
* ```text
|
|
130
|
-
* let pollable = this.subscribe();
|
|
131
|
-
* while !contents.is_empty() {
|
|
132
|
-
* // Wait for the stream to become writable
|
|
133
|
-
* pollable.block();
|
|
134
|
-
* let Ok(n) = this.check-write(); // eliding error handling
|
|
135
|
-
* let len = min(n, contents.len());
|
|
136
|
-
* let (chunk, rest) = contents.split_at(len);
|
|
137
|
-
* this.write(chunk ); // eliding error handling
|
|
138
|
-
* contents = rest;
|
|
139
|
-
* }
|
|
140
|
-
* this.flush();
|
|
141
|
-
* // Wait for completion of `flush`
|
|
142
|
-
* pollable.block();
|
|
143
|
-
* // Check for any errors that arose during `flush`
|
|
144
|
-
* let _ = this.check-write(); // eliding error handling
|
|
145
|
-
* ```
|
|
146
|
-
*/
|
|
147
|
-
blockingWriteAndFlush(contents: Uint8Array): void;
|
|
148
|
-
/**
|
|
149
|
-
* Request to flush buffered output. This function never blocks.
|
|
150
|
-
*
|
|
151
|
-
* This tells the output-stream that the caller intends any buffered
|
|
152
|
-
* output to be flushed. the output which is expected to be flushed
|
|
153
|
-
* is all that has been passed to `write` prior to this call.
|
|
154
|
-
*
|
|
155
|
-
* Upon calling this function, the `output-stream` will not accept any
|
|
156
|
-
* writes (`check-write` will return `ok(0)`) until the flush has
|
|
157
|
-
* completed. The `subscribe` pollable will become ready when the
|
|
158
|
-
* flush has completed and the stream can accept more writes.
|
|
159
|
-
*/
|
|
160
|
-
flush(): void;
|
|
161
|
-
/**
|
|
162
|
-
* Request to flush buffered output, and block until flush completes
|
|
163
|
-
* and stream is ready for writing again.
|
|
164
|
-
*/
|
|
165
|
-
blockingFlush(): void;
|
|
166
|
-
/**
|
|
167
|
-
* Create a `pollable` which will resolve once the output-stream
|
|
168
|
-
* is ready for more writing, or an error has occured. When this
|
|
169
|
-
* pollable is ready, `check-write` will return `ok(n)` with n>0, or an
|
|
170
|
-
* error.
|
|
171
|
-
*
|
|
172
|
-
* If the stream is closed, this pollable is always ready immediately.
|
|
173
|
-
*
|
|
174
|
-
* The created `pollable` is a child resource of the `output-stream`.
|
|
175
|
-
* Implementations may trap if the `output-stream` is dropped before
|
|
176
|
-
* all derived `pollable`s created with this function are dropped.
|
|
177
|
-
*/
|
|
178
|
-
subscribe(): Pollable;
|
|
179
|
-
/**
|
|
180
|
-
* Write zeroes to a stream.
|
|
181
|
-
*
|
|
182
|
-
* This should be used precisely like `write` with the exact same
|
|
183
|
-
* preconditions (must use check-write first), but instead of
|
|
184
|
-
* passing a list of bytes, you simply pass the number of zero-bytes
|
|
185
|
-
* that should be written.
|
|
186
|
-
*/
|
|
187
|
-
writeZeroes(len: bigint): void;
|
|
188
|
-
/**
|
|
189
|
-
* Perform a write of up to 4096 zeroes, and then flush the stream.
|
|
190
|
-
* Block until all of these operations are complete, or an error
|
|
191
|
-
* occurs.
|
|
192
|
-
*
|
|
193
|
-
* This is a convenience wrapper around the use of `check-write`,
|
|
194
|
-
* `subscribe`, `write-zeroes`, and `flush`, and is implemented with
|
|
195
|
-
* the following pseudo-code:
|
|
196
|
-
*
|
|
197
|
-
* ```text
|
|
198
|
-
* let pollable = this.subscribe();
|
|
199
|
-
* while num_zeroes != 0 {
|
|
200
|
-
* // Wait for the stream to become writable
|
|
201
|
-
* pollable.block();
|
|
202
|
-
* let Ok(n) = this.check-write(); // eliding error handling
|
|
203
|
-
* let len = min(n, num_zeroes);
|
|
204
|
-
* this.write-zeroes(len); // eliding error handling
|
|
205
|
-
* num_zeroes -= len;
|
|
206
|
-
* }
|
|
207
|
-
* this.flush();
|
|
208
|
-
* // Wait for completion of `flush`
|
|
209
|
-
* pollable.block();
|
|
210
|
-
* // Check for any errors that arose during `flush`
|
|
211
|
-
* let _ = this.check-write(); // eliding error handling
|
|
212
|
-
* ```
|
|
213
|
-
*/
|
|
214
|
-
blockingWriteZeroesAndFlush(len: bigint): void;
|
|
215
|
-
/**
|
|
216
|
-
* Read from one stream and write to another.
|
|
217
|
-
*
|
|
218
|
-
* The behavior of splice is equivelant to:
|
|
219
|
-
* 1. calling `check-write` on the `output-stream`
|
|
220
|
-
* 2. calling `read` on the `input-stream` with the smaller of the
|
|
221
|
-
* `check-write` permitted length and the `len` provided to `splice`
|
|
222
|
-
* 3. calling `write` on the `output-stream` with that read data.
|
|
223
|
-
*
|
|
224
|
-
* Any error reported by the call to `check-write`, `read`, or
|
|
225
|
-
* `write` ends the splice and reports that error.
|
|
226
|
-
*
|
|
227
|
-
* This function returns the number of bytes transferred; it may be less
|
|
228
|
-
* than `len`.
|
|
229
|
-
*/
|
|
230
|
-
splice(src: InputStream, len: bigint): bigint;
|
|
231
|
-
/**
|
|
232
|
-
* Read from one stream and write to another, with blocking.
|
|
233
|
-
*
|
|
234
|
-
* This is similar to `splice`, except that it blocks until the
|
|
235
|
-
* `output-stream` is ready for writing, and the `input-stream`
|
|
236
|
-
* is ready for reading, before performing the `splice`.
|
|
237
|
-
*/
|
|
238
|
-
blockingSplice(src: InputStream, len: bigint): bigint;
|
|
239
|
-
}
|
|
240
|
-
|
package/wit/deps/cli/command.wit
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
interface environment {
|
|
2
|
-
/// Get the POSIX-style environment variables.
|
|
3
|
-
///
|
|
4
|
-
/// Each environment variable is provided as a pair of string variable names
|
|
5
|
-
/// and string value.
|
|
6
|
-
///
|
|
7
|
-
/// Morally, these are a value import, but until value imports are available
|
|
8
|
-
/// in the component model, this import function should return the same
|
|
9
|
-
/// values each time it is called.
|
|
10
|
-
get-environment: func() -> list<tuple<string, string>>;
|
|
11
|
-
|
|
12
|
-
/// Get the POSIX-style arguments to the program.
|
|
13
|
-
get-arguments: func() -> list<string>;
|
|
14
|
-
|
|
15
|
-
/// Return a path that programs should use as their initial current working
|
|
16
|
-
/// directory, interpreting `.` as shorthand for this.
|
|
17
|
-
initial-cwd: func() -> option<string>;
|
|
18
|
-
}
|
package/wit/deps/cli/exit.wit
DELETED
package/wit/deps/cli/imports.wit
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
package wasi:cli@0.2.0;
|
|
2
|
-
|
|
3
|
-
world imports {
|
|
4
|
-
include wasi:clocks/imports@0.2.0;
|
|
5
|
-
include wasi:filesystem/imports@0.2.0;
|
|
6
|
-
include wasi:sockets/imports@0.2.0;
|
|
7
|
-
include wasi:random/imports@0.2.0;
|
|
8
|
-
include wasi:io/imports@0.2.0;
|
|
9
|
-
|
|
10
|
-
import environment;
|
|
11
|
-
import exit;
|
|
12
|
-
import stdin;
|
|
13
|
-
import stdout;
|
|
14
|
-
import stderr;
|
|
15
|
-
import terminal-input;
|
|
16
|
-
import terminal-output;
|
|
17
|
-
import terminal-stdin;
|
|
18
|
-
import terminal-stdout;
|
|
19
|
-
import terminal-stderr;
|
|
20
|
-
}
|
package/wit/deps/cli/run.wit
DELETED
package/wit/deps/cli/stdio.wit
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
interface stdin {
|
|
2
|
-
use wasi:io/streams@0.2.0.{input-stream};
|
|
3
|
-
|
|
4
|
-
get-stdin: func() -> input-stream;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
interface stdout {
|
|
8
|
-
use wasi:io/streams@0.2.0.{output-stream};
|
|
9
|
-
|
|
10
|
-
get-stdout: func() -> output-stream;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface stderr {
|
|
14
|
-
use wasi:io/streams@0.2.0.{output-stream};
|
|
15
|
-
|
|
16
|
-
get-stderr: func() -> output-stream;
|
|
17
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/// Terminal input.
|
|
2
|
-
///
|
|
3
|
-
/// In the future, this may include functions for disabling echoing,
|
|
4
|
-
/// disabling input buffering so that keyboard events are sent through
|
|
5
|
-
/// immediately, querying supported features, and so on.
|
|
6
|
-
interface terminal-input {
|
|
7
|
-
/// The input side of a terminal.
|
|
8
|
-
resource terminal-input;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
/// Terminal output.
|
|
12
|
-
///
|
|
13
|
-
/// In the future, this may include functions for querying the terminal
|
|
14
|
-
/// size, being notified of terminal size changes, querying supported
|
|
15
|
-
/// features, and so on.
|
|
16
|
-
interface terminal-output {
|
|
17
|
-
/// The output side of a terminal.
|
|
18
|
-
resource terminal-output;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/// An interface providing an optional `terminal-input` for stdin as a
|
|
22
|
-
/// link-time authority.
|
|
23
|
-
interface terminal-stdin {
|
|
24
|
-
use terminal-input.{terminal-input};
|
|
25
|
-
|
|
26
|
-
/// If stdin is connected to a terminal, return a `terminal-input` handle
|
|
27
|
-
/// allowing further interaction with it.
|
|
28
|
-
get-terminal-stdin: func() -> option<terminal-input>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/// An interface providing an optional `terminal-output` for stdout as a
|
|
32
|
-
/// link-time authority.
|
|
33
|
-
interface terminal-stdout {
|
|
34
|
-
use terminal-output.{terminal-output};
|
|
35
|
-
|
|
36
|
-
/// If stdout is connected to a terminal, return a `terminal-output` handle
|
|
37
|
-
/// allowing further interaction with it.
|
|
38
|
-
get-terminal-stdout: func() -> option<terminal-output>;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/// An interface providing an optional `terminal-output` for stderr as a
|
|
42
|
-
/// link-time authority.
|
|
43
|
-
interface terminal-stderr {
|
|
44
|
-
use terminal-output.{terminal-output};
|
|
45
|
-
|
|
46
|
-
/// If stderr is connected to a terminal, return a `terminal-output` handle
|
|
47
|
-
/// allowing further interaction with it.
|
|
48
|
-
get-terminal-stderr: func() -> option<terminal-output>;
|
|
49
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
package wasi:clocks@0.2.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
|
-
///
|
|
11
|
-
/// It is intended for measuring elapsed time.
|
|
12
|
-
interface monotonic-clock {
|
|
13
|
-
use wasi:io/poll@0.2.0.{pollable};
|
|
14
|
-
|
|
15
|
-
/// An instant in time, in nanoseconds. An instant is relative to an
|
|
16
|
-
/// unspecified initial value, and can only be compared to instances from
|
|
17
|
-
/// the same monotonic-clock.
|
|
18
|
-
type instant = u64;
|
|
19
|
-
|
|
20
|
-
/// A duration of time, in nanoseconds.
|
|
21
|
-
type duration = u64;
|
|
22
|
-
|
|
23
|
-
/// Read the current value of the clock.
|
|
24
|
-
///
|
|
25
|
-
/// The clock is monotonic, therefore calling this function repeatedly will
|
|
26
|
-
/// produce a sequence of non-decreasing values.
|
|
27
|
-
now: func() -> instant;
|
|
28
|
-
|
|
29
|
-
/// Query the resolution of the clock. Returns the duration of time
|
|
30
|
-
/// corresponding to a clock tick.
|
|
31
|
-
resolution: func() -> duration;
|
|
32
|
-
|
|
33
|
-
/// Create a `pollable` which will resolve once the specified instant
|
|
34
|
-
/// occured.
|
|
35
|
-
subscribe-instant: func(
|
|
36
|
-
when: instant,
|
|
37
|
-
) -> pollable;
|
|
38
|
-
|
|
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.
|
|
42
|
-
subscribe-duration: func(
|
|
43
|
-
when: duration,
|
|
44
|
-
) -> pollable;
|
|
45
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
package wasi:clocks@0.2.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
|
-
interface wall-clock {
|
|
17
|
-
/// A time and date in seconds plus nanoseconds.
|
|
18
|
-
record datetime {
|
|
19
|
-
seconds: u64,
|
|
20
|
-
nanoseconds: u32,
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/// Read the current value of the clock.
|
|
24
|
-
///
|
|
25
|
-
/// This clock is not monotonic, therefore calling this function repeatedly
|
|
26
|
-
/// will not necessarily produce a sequence of non-decreasing values.
|
|
27
|
-
///
|
|
28
|
-
/// The returned timestamps represent the number of seconds since
|
|
29
|
-
/// 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
|
|
30
|
-
/// also known as [Unix Time].
|
|
31
|
-
///
|
|
32
|
-
/// The nanoseconds field of the output is always less than 1000000000.
|
|
33
|
-
///
|
|
34
|
-
/// [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
35
|
-
/// [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
36
|
-
now: func() -> datetime;
|
|
37
|
-
|
|
38
|
-
/// Query the resolution of the clock.
|
|
39
|
-
///
|
|
40
|
-
/// The nanoseconds field of the output is always less than 1000000000.
|
|
41
|
-
resolution: func() -> datetime;
|
|
42
|
-
}
|