@bytecodealliance/preview2-shim 0.0.14 → 0.0.16

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.
Files changed (70) hide show
  1. package/lib/browser/http.js +1 -1
  2. package/lib/browser/io.js +14 -3
  3. package/lib/http/error.js +1 -1
  4. package/lib/http/make-request.js +2 -2
  5. package/lib/http/wasi-http.js +62 -39
  6. package/lib/nodejs/io.js +16 -5
  7. package/package.json +1 -1
  8. package/types/{exports → interfaces}/wasi-cli-environment.d.ts +1 -1
  9. package/types/{imports → interfaces}/wasi-cli-stderr.d.ts +1 -1
  10. package/types/{exports → interfaces}/wasi-cli-stdin.d.ts +1 -1
  11. package/types/{imports → interfaces}/wasi-cli-stdout.d.ts +1 -1
  12. package/types/{imports → interfaces}/wasi-cli-terminal-stderr.d.ts +2 -2
  13. package/types/{imports → interfaces}/wasi-cli-terminal-stdin.d.ts +2 -2
  14. package/types/{imports → interfaces}/wasi-cli-terminal-stdout.d.ts +2 -2
  15. package/types/{imports → interfaces}/wasi-clocks-monotonic-clock.d.ts +1 -1
  16. package/types/{exports → interfaces}/wasi-clocks-timezone.d.ts +1 -1
  17. package/types/{exports → interfaces}/wasi-filesystem-preopens.d.ts +1 -1
  18. package/types/{imports → interfaces}/wasi-filesystem-types.d.ts +5 -5
  19. package/types/interfaces/wasi-io-streams.d.ts +274 -0
  20. package/types/{imports → interfaces}/wasi-sockets-instance-network.d.ts +1 -1
  21. package/types/{exports → interfaces}/wasi-sockets-ip-name-lookup.d.ts +7 -7
  22. package/types/{imports → interfaces}/wasi-sockets-tcp-create-socket.d.ts +4 -4
  23. package/types/{imports → interfaces}/wasi-sockets-tcp.d.ts +20 -7
  24. package/types/{exports → interfaces}/wasi-sockets-udp-create-socket.d.ts +4 -4
  25. package/types/{exports → interfaces}/wasi-sockets-udp.d.ts +5 -5
  26. package/types/wasi-cli-command.d.ts +28 -28
  27. package/types/exports/wasi-cli-stderr.d.ts +0 -5
  28. package/types/exports/wasi-cli-stdout.d.ts +0 -5
  29. package/types/exports/wasi-cli-terminal-stderr.d.ts +0 -9
  30. package/types/exports/wasi-cli-terminal-stdin.d.ts +0 -9
  31. package/types/exports/wasi-cli-terminal-stdout.d.ts +0 -9
  32. package/types/exports/wasi-clocks-monotonic-clock.d.ts +0 -24
  33. package/types/exports/wasi-filesystem-types.d.ts +0 -843
  34. package/types/exports/wasi-http-incoming-handler.d.ts +0 -7
  35. package/types/exports/wasi-http-outgoing-handler.d.ts +0 -9
  36. package/types/exports/wasi-http-types.d.ts +0 -118
  37. package/types/exports/wasi-io-streams.d.ts +0 -220
  38. package/types/exports/wasi-sockets-instance-network.d.ts +0 -8
  39. package/types/exports/wasi-sockets-tcp-create-socket.d.ts +0 -33
  40. package/types/exports/wasi-sockets-tcp.d.ts +0 -285
  41. package/types/imports/wasi-cli-environment.d.ts +0 -22
  42. package/types/imports/wasi-cli-exit.d.ts +0 -7
  43. package/types/imports/wasi-cli-stdin.d.ts +0 -5
  44. package/types/imports/wasi-cli-terminal-input.d.ts +0 -13
  45. package/types/imports/wasi-cli-terminal-output.d.ts +0 -13
  46. package/types/imports/wasi-clocks-timezone.d.ts +0 -71
  47. package/types/imports/wasi-clocks-wall-clock.d.ts +0 -31
  48. package/types/imports/wasi-filesystem-preopens.d.ts +0 -8
  49. package/types/imports/wasi-http-outgoing-handler.d.ts +0 -9
  50. package/types/imports/wasi-http-types.d.ts +0 -118
  51. package/types/imports/wasi-io-streams.d.ts +0 -220
  52. package/types/imports/wasi-poll-poll.d.ts +0 -39
  53. package/types/imports/wasi-random-insecure-seed.d.ts +0 -22
  54. package/types/imports/wasi-random-insecure.d.ts +0 -20
  55. package/types/imports/wasi-random-random.d.ts +0 -22
  56. package/types/imports/wasi-sockets-ip-name-lookup.d.ts +0 -76
  57. package/types/imports/wasi-sockets-network.d.ts +0 -180
  58. package/types/imports/wasi-sockets-udp-create-socket.d.ts +0 -33
  59. package/types/imports/wasi-sockets-udp.d.ts +0 -228
  60. package/types/wasi-http-proxy.d.ts +0 -13
  61. /package/types/{exports → interfaces}/wasi-cli-exit.d.ts +0 -0
  62. /package/types/{exports → interfaces}/wasi-cli-run.d.ts +0 -0
  63. /package/types/{exports → interfaces}/wasi-cli-terminal-input.d.ts +0 -0
  64. /package/types/{exports → interfaces}/wasi-cli-terminal-output.d.ts +0 -0
  65. /package/types/{exports → interfaces}/wasi-clocks-wall-clock.d.ts +0 -0
  66. /package/types/{exports → interfaces}/wasi-poll-poll.d.ts +0 -0
  67. /package/types/{exports → interfaces}/wasi-random-insecure-seed.d.ts +0 -0
  68. /package/types/{exports → interfaces}/wasi-random-insecure.d.ts +0 -0
  69. /package/types/{exports → interfaces}/wasi-random-random.d.ts +0 -0
  70. /package/types/{exports → interfaces}/wasi-sockets-network.d.ts +0 -0
@@ -0,0 +1,274 @@
1
+ export namespace WasiIoStreams {
2
+ /**
3
+ * Perform a non-blocking read from the stream.
4
+ *
5
+ * This function returns a list of bytes containing the data that was
6
+ * read, along with a `stream-status` which, indicates whether further
7
+ * reads are expected to produce data. The returned list will contain up to
8
+ * `len` bytes; it may return fewer than requested, but not more. An
9
+ * empty list and `stream-status:open` indicates no more data is
10
+ * available at this time, and that the pollable given by
11
+ * `subscribe-to-input-stream` will be ready when more data is available.
12
+ *
13
+ * Once a stream has reached the end, subsequent calls to `read` or
14
+ * `skip` will always report `stream-status:ended` rather than producing more
15
+ * data.
16
+ *
17
+ * When the caller gives a `len` of 0, it represents a request to read 0
18
+ * bytes. This read should always succeed and return an empty list and
19
+ * the current `stream-status`.
20
+ *
21
+ * The `len` parameter is a `u64`, which could represent a list of u8 which
22
+ * is not possible to allocate in wasm32, or not desirable to allocate as
23
+ * as a return value by the callee. The callee may return a list of bytes
24
+ * less than `len` in size while more bytes are available for reading.
25
+ */
26
+ export function read(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
27
+ /**
28
+ * Read bytes from a stream, after blocking until at least one byte can
29
+ * be read. Except for blocking, identical to `read`.
30
+ */
31
+ export function blockingRead(this_: InputStream, len: bigint): [Uint8Array, StreamStatus];
32
+ /**
33
+ * Skip bytes from a stream.
34
+ *
35
+ * This is similar to the `read` function, but avoids copying the
36
+ * bytes into the instance.
37
+ *
38
+ * Once a stream has reached the end, subsequent calls to read or
39
+ * `skip` will always report end-of-stream rather than producing more
40
+ * data.
41
+ *
42
+ * This function returns the number of bytes skipped, along with a
43
+ * `stream-status` indicating whether the end of the stream was
44
+ * reached. The returned value will be at most `len`; it may be less.
45
+ */
46
+ export function skip(this_: InputStream, len: bigint): [bigint, StreamStatus];
47
+ /**
48
+ * Skip bytes from a stream, after blocking until at least one byte
49
+ * can be skipped. Except for blocking behavior, identical to `skip`.
50
+ */
51
+ export function blockingSkip(this_: InputStream, len: bigint): [bigint, StreamStatus];
52
+ /**
53
+ * Create a `pollable` which will resolve once either the specified stream
54
+ * has bytes available to read or the other end of the stream has been
55
+ * closed.
56
+ * The created `pollable` is a child resource of the `input-stream`.
57
+ * Implementations may trap if the `input-stream` is dropped before
58
+ * all derived `pollable`s created with this function are dropped.
59
+ */
60
+ export function subscribeToInputStream(this_: InputStream): Pollable;
61
+ /**
62
+ * Dispose of the specified `input-stream`, after which it may no longer
63
+ * be used.
64
+ * Implementations may trap if this `input-stream` is dropped while child
65
+ * `pollable` resources are still alive.
66
+ * After this `input-stream` is dropped, implementations may report any
67
+ * corresponding `output-stream` has `stream-state.closed`.
68
+ */
69
+ export function dropInputStream(this_: InputStream): void;
70
+ /**
71
+ * Check readiness for writing. This function never blocks.
72
+ *
73
+ * Returns the number of bytes permitted for the next call to `write`,
74
+ * or an error. Calling `write` with more bytes than this function has
75
+ * permitted will trap.
76
+ *
77
+ * When this function returns 0 bytes, the `subscribe-to-output-stream`
78
+ * pollable will become ready when this function will report at least
79
+ * 1 byte, or an error.
80
+ */
81
+ export function checkWrite(this_: OutputStream): bigint;
82
+ /**
83
+ * Perform a write. This function never blocks.
84
+ *
85
+ * Precondition: check-write gave permit of Ok(n) and contents has a
86
+ * length of less than or equal to n. Otherwise, this function will trap.
87
+ *
88
+ * returns Err(closed) without writing if the stream has closed since
89
+ * the last call to check-write provided a permit.
90
+ */
91
+ export function write(this_: OutputStream, contents: Uint8Array): void;
92
+ /**
93
+ * Perform a write of up to 4096 bytes, and then flush the stream. Block
94
+ * until all of these operations are complete, or an error occurs.
95
+ *
96
+ * This is a convenience wrapper around the use of `check-write`,
97
+ * `subscribe-to-output-stream`, `write`, and `flush`, and is implemented
98
+ * with the following pseudo-code:
99
+ *
100
+ * ```text
101
+ * let pollable = subscribe-to-output-stream(this);
102
+ * while !contents.is_empty() {
103
+ * // Wait for the stream to become writable
104
+ * poll-oneoff(pollable);
105
+ * let Ok(n) = check-write(this); // eliding error handling
106
+ * let len = min(n, contents.len());
107
+ * let (chunk, rest) = contents.split_at(len);
108
+ * write(this, chunk); // eliding error handling
109
+ * contents = rest;
110
+ * }
111
+ * flush(this);
112
+ * // Wait for completion of `flush`
113
+ * poll-oneoff(pollable);
114
+ * // Check for any errors that arose during `flush`
115
+ * let _ = check-write(this); // eliding error handling
116
+ * ```
117
+ */
118
+ export function blockingWriteAndFlush(this_: OutputStream, contents: Uint8Array): void;
119
+ /**
120
+ * Request to flush buffered output. This function never blocks.
121
+ *
122
+ * This tells the output-stream that the caller intends any buffered
123
+ * output to be flushed. the output which is expected to be flushed
124
+ * is all that has been passed to `write` prior to this call.
125
+ *
126
+ * Upon calling this function, the `output-stream` will not accept any
127
+ * writes (`check-write` will return `ok(0)`) until the flush has
128
+ * completed. The `subscribe-to-output-stream` pollable will become ready
129
+ * when the flush has completed and the stream can accept more writes.
130
+ */
131
+ export function flush(this_: OutputStream): void;
132
+ /**
133
+ * Request to flush buffered output, and block until flush completes
134
+ * and stream is ready for writing again.
135
+ */
136
+ export function blockingFlush(this_: OutputStream): void;
137
+ /**
138
+ * Create a `pollable` which will resolve once the output-stream
139
+ * is ready for more writing, or an error has occured. When this
140
+ * pollable is ready, `check-write` will return `ok(n)` with n>0, or an
141
+ * error.
142
+ *
143
+ * If the stream is closed, this pollable is always ready immediately.
144
+ *
145
+ * The created `pollable` is a child resource of the `output-stream`.
146
+ * Implementations may trap if the `output-stream` is dropped before
147
+ * all derived `pollable`s created with this function are dropped.
148
+ */
149
+ export function subscribeToOutputStream(this_: OutputStream): Pollable;
150
+ /**
151
+ * Write zeroes to a stream.
152
+ *
153
+ * this should be used precisely like `write` with the exact same
154
+ * preconditions (must use check-write first), but instead of
155
+ * passing a list of bytes, you simply pass the number of zero-bytes
156
+ * that should be written.
157
+ */
158
+ export function writeZeroes(this_: OutputStream, len: bigint): void;
159
+ /**
160
+ * Read from one stream and write to another.
161
+ *
162
+ * This function returns the number of bytes transferred; it may be less
163
+ * than `len`.
164
+ *
165
+ * Unlike other I/O functions, this function blocks until all the data
166
+ * read from the input stream has been written to the output stream.
167
+ */
168
+ export function splice(this_: OutputStream, src: InputStream, len: bigint): [bigint, StreamStatus];
169
+ /**
170
+ * Read from one stream and write to another, with blocking.
171
+ *
172
+ * This is similar to `splice`, except that it blocks until at least
173
+ * one byte can be read.
174
+ */
175
+ export function blockingSplice(this_: OutputStream, src: InputStream, len: bigint): [bigint, StreamStatus];
176
+ /**
177
+ * Forward the entire contents of an input stream to an output stream.
178
+ *
179
+ * This function repeatedly reads from the input stream and writes
180
+ * the data to the output stream, until the end of the input stream
181
+ * is reached, or an error is encountered.
182
+ *
183
+ * Unlike other I/O functions, this function blocks until the end
184
+ * of the input stream is seen and all the data has been written to
185
+ * the output stream.
186
+ *
187
+ * This function returns the number of bytes transferred, and the status of
188
+ * the output stream.
189
+ */
190
+ export function forward(this_: OutputStream, src: InputStream): [bigint, StreamStatus];
191
+ /**
192
+ * Dispose of the specified `output-stream`, after which it may no longer
193
+ * be used.
194
+ * Implementations may trap if this `output-stream` is dropped while
195
+ * child `pollable` resources are still alive.
196
+ * After this `output-stream` is dropped, implementations may report any
197
+ * corresponding `input-stream` has `stream-state.closed`.
198
+ */
199
+ export function dropOutputStream(this_: OutputStream): void;
200
+ }
201
+ import type { Pollable } from '../interfaces/wasi-poll-poll';
202
+ export { Pollable };
203
+ /**
204
+ * Streams provide a sequence of data and then end; once they end, they
205
+ * no longer provide any further data.
206
+ *
207
+ * For example, a stream reading from a file ends when the stream reaches
208
+ * the end of the file. For another example, a stream reading from a
209
+ * socket ends when the socket is closed.
210
+ * # Variants
211
+ *
212
+ * ## `"open"`
213
+ *
214
+ * The stream is open and may produce further data.
215
+ * ## `"ended"`
216
+ *
217
+ * When reading, this indicates that the stream will not produce
218
+ * further data.
219
+ * When writing, this indicates that the stream will no longer be read.
220
+ * Further writes are still permitted.
221
+ */
222
+ export type StreamStatus = 'open' | 'ended';
223
+ /**
224
+ * An input bytestream. In the future, this will be replaced by handle
225
+ * types.
226
+ *
227
+ * `input-stream`s are *non-blocking* to the extent practical on underlying
228
+ * platforms. I/O operations always return promptly; if fewer bytes are
229
+ * promptly available than requested, they return the number of bytes promptly
230
+ * available, which could even be zero. To wait for data to be available,
231
+ * use the `subscribe-to-input-stream` function to obtain a `pollable` which
232
+ * can be polled for using `wasi:poll/poll.poll_oneoff`.
233
+ *
234
+ * And at present, it is a `u32` instead of being an actual handle, until
235
+ * the wit-bindgen implementation of handles and resources is ready.
236
+ *
237
+ * This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
238
+ */
239
+ export type InputStream = number;
240
+ /**
241
+ * An output bytestream. In the future, this will be replaced by handle
242
+ * types.
243
+ *
244
+ * `output-stream`s are *non-blocking* to the extent practical on
245
+ * underlying platforms. Except where specified otherwise, I/O operations also
246
+ * always return promptly, after the number of bytes that can be written
247
+ * promptly, which could even be zero. To wait for the stream to be ready to
248
+ * accept data, the `subscribe-to-output-stream` function to obtain a
249
+ * `pollable` which can be polled for using `wasi:poll`.
250
+ *
251
+ * And at present, it is a `u32` instead of being an actual handle, until
252
+ * the wit-bindgen implementation of handles and resources is ready.
253
+ *
254
+ * This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
255
+ */
256
+ export type OutputStream = number;
257
+ /**
258
+ * An error for output-stream operations.
259
+ *
260
+ * Contrary to input-streams, a closed output-stream is reported using
261
+ * an error.
262
+ * # Variants
263
+ *
264
+ * ## `"last-operation-failed"`
265
+ *
266
+ * The last operation (a write or flush) failed before completion.
267
+ * ## `"closed"`
268
+ *
269
+ * The stream is closed: no more input will be accepted by the
270
+ * stream. A closed output-stream will return this error on all
271
+ * future operations.
272
+ */
273
+ export type WriteError = 'last-operation-failed' | 'closed';
274
+
@@ -4,5 +4,5 @@ export namespace WasiSocketsInstanceNetwork {
4
4
  */
5
5
  export function instanceNetwork(): Network;
6
6
  }
7
- import type { Network } from '../imports/wasi-sockets-network';
7
+ import type { Network } from '../interfaces/wasi-sockets-network';
8
8
  export { Network };
@@ -31,7 +31,7 @@ export namespace WasiSocketsIpNameLookup {
31
31
  * - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
32
32
  * - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
33
33
  */
34
- export function resolveAddresses(network: Network, name: string, addressFamily: IpAddressFamily | null, includeUnavailable: boolean): ResolveAddressStream;
34
+ export function resolveAddresses(network: Network, name: string, addressFamily: IpAddressFamily | undefined, includeUnavailable: boolean): ResolveAddressStream;
35
35
  /**
36
36
  * Returns the next address from the resolver.
37
37
  *
@@ -48,7 +48,7 @@ export namespace WasiSocketsIpNameLookup {
48
48
  * - `permanent-resolver-failure`: A permanent failure in name resolution occurred. (EAI_FAIL)
49
49
  * - `would-block`: A result is not available yet. (EWOULDBLOCK, EAGAIN)
50
50
  */
51
- export function resolveNextAddress(this_: ResolveAddressStream): IpAddress | null;
51
+ export function resolveNextAddress(this_: ResolveAddressStream): IpAddress | undefined;
52
52
  /**
53
53
  * Dispose of the specified `resolve-address-stream`, after which it may no longer be used.
54
54
  *
@@ -63,14 +63,14 @@ export namespace WasiSocketsIpNameLookup {
63
63
  */
64
64
  export function subscribe(this_: ResolveAddressStream): Pollable;
65
65
  }
66
- import type { Pollable } from '../exports/wasi-poll-poll';
66
+ import type { Pollable } from '../interfaces/wasi-poll-poll';
67
67
  export { Pollable };
68
- import type { Network } from '../exports/wasi-sockets-network';
68
+ import type { Network } from '../interfaces/wasi-sockets-network';
69
69
  export { Network };
70
- import type { ErrorCode } from '../exports/wasi-sockets-network';
70
+ import type { ErrorCode } from '../interfaces/wasi-sockets-network';
71
71
  export { ErrorCode };
72
- import type { IpAddress } from '../exports/wasi-sockets-network';
72
+ import type { IpAddress } from '../interfaces/wasi-sockets-network';
73
73
  export { IpAddress };
74
- import type { IpAddressFamily } from '../exports/wasi-sockets-network';
74
+ import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
75
75
  export { IpAddressFamily };
76
76
  export type ResolveAddressStream = number;
@@ -23,11 +23,11 @@ export namespace WasiSocketsTcpCreateSocket {
23
23
  */
24
24
  export function createTcpSocket(addressFamily: IpAddressFamily): TcpSocket;
25
25
  }
26
- import type { Network } from '../imports/wasi-sockets-network';
26
+ import type { Network } from '../interfaces/wasi-sockets-network';
27
27
  export { Network };
28
- import type { ErrorCode } from '../imports/wasi-sockets-network';
28
+ import type { ErrorCode } from '../interfaces/wasi-sockets-network';
29
29
  export { ErrorCode };
30
- import type { IpAddressFamily } from '../imports/wasi-sockets-network';
30
+ import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
31
31
  export { IpAddressFamily };
32
- import type { TcpSocket } from '../imports/wasi-sockets-tcp';
32
+ import type { TcpSocket } from '../interfaces/wasi-sockets-tcp';
33
33
  export { TcpSocket };
@@ -63,6 +63,11 @@ export namespace WasiSocketsTcp {
63
63
  * - <https://man.freebsd.org/cgi/man.cgi?connect>
64
64
  */
65
65
  export function startConnect(this_: TcpSocket, network: Network, remoteAddress: IpSocketAddress): void;
66
+ /**
67
+ * Note: the returned `input-stream` and `output-stream` are child
68
+ * resources of the `tcp-socket`. Implementations may trap if the
69
+ * `tcp-socket` is dropped before both of these streams are dropped.
70
+ */
66
71
  export function finishConnect(this_: TcpSocket): [InputStream, OutputStream];
67
72
  /**
68
73
  * Start listening for new connections.
@@ -100,6 +105,10 @@ export namespace WasiSocketsTcp {
100
105
  * On success, this function returns the newly accepted client socket along with
101
106
  * a pair of streams that can be used to read & write to the connection.
102
107
  *
108
+ * Note: the returned `input-stream` and `output-stream` are child
109
+ * resources of the returned `tcp-socket`. Implementations may trap if the
110
+ * `tcp-socket` is dropped before its child streams are dropped.
111
+ *
103
112
  * # Typical errors
104
113
  * - `not-listening`: Socket is not in the Listener state. (EINVAL)
105
114
  * - `would-block`: No pending connections at the moment. (EWOULDBLOCK, EAGAIN)
@@ -216,6 +225,10 @@ export namespace WasiSocketsTcp {
216
225
  /**
217
226
  * Create a `pollable` which will resolve once the socket is ready for I/O.
218
227
  *
228
+ * The created `pollable` is a child resource of the `tcp-socket`.
229
+ * Implementations may trap if the `tcp-socket` is dropped before all
230
+ * derived `pollable`s created with this function are dropped.
231
+ *
219
232
  * Note: this function is here for WASI Preview2 only.
220
233
  * It's planned to be removed when `future` is natively supported in Preview3.
221
234
  */
@@ -251,19 +264,19 @@ export namespace WasiSocketsTcp {
251
264
  */
252
265
  export function dropTcpSocket(this_: TcpSocket): void;
253
266
  }
254
- import type { InputStream } from '../imports/wasi-io-streams';
267
+ import type { InputStream } from '../interfaces/wasi-io-streams';
255
268
  export { InputStream };
256
- import type { OutputStream } from '../imports/wasi-io-streams';
269
+ import type { OutputStream } from '../interfaces/wasi-io-streams';
257
270
  export { OutputStream };
258
- import type { Pollable } from '../imports/wasi-poll-poll';
271
+ import type { Pollable } from '../interfaces/wasi-poll-poll';
259
272
  export { Pollable };
260
- import type { Network } from '../imports/wasi-sockets-network';
273
+ import type { Network } from '../interfaces/wasi-sockets-network';
261
274
  export { Network };
262
- import type { ErrorCode } from '../imports/wasi-sockets-network';
275
+ import type { ErrorCode } from '../interfaces/wasi-sockets-network';
263
276
  export { ErrorCode };
264
- import type { IpSocketAddress } from '../imports/wasi-sockets-network';
277
+ import type { IpSocketAddress } from '../interfaces/wasi-sockets-network';
265
278
  export { IpSocketAddress };
266
- import type { IpAddressFamily } from '../imports/wasi-sockets-network';
279
+ import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
267
280
  export { IpAddressFamily };
268
281
  /**
269
282
  * A TCP socket handle.
@@ -23,11 +23,11 @@ export namespace WasiSocketsUdpCreateSocket {
23
23
  */
24
24
  export function createUdpSocket(addressFamily: IpAddressFamily): UdpSocket;
25
25
  }
26
- import type { Network } from '../exports/wasi-sockets-network';
26
+ import type { Network } from '../interfaces/wasi-sockets-network';
27
27
  export { Network };
28
- import type { ErrorCode } from '../exports/wasi-sockets-network';
28
+ import type { ErrorCode } from '../interfaces/wasi-sockets-network';
29
29
  export { ErrorCode };
30
- import type { IpAddressFamily } from '../exports/wasi-sockets-network';
30
+ import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
31
31
  export { IpAddressFamily };
32
- import type { UdpSocket } from '../exports/wasi-sockets-udp';
32
+ import type { UdpSocket } from '../interfaces/wasi-sockets-udp';
33
33
  export { UdpSocket };
@@ -208,15 +208,15 @@ export namespace WasiSocketsUdp {
208
208
  */
209
209
  export function dropUdpSocket(this_: UdpSocket): void;
210
210
  }
211
- import type { Pollable } from '../exports/wasi-poll-poll';
211
+ import type { Pollable } from '../interfaces/wasi-poll-poll';
212
212
  export { Pollable };
213
- import type { Network } from '../exports/wasi-sockets-network';
213
+ import type { Network } from '../interfaces/wasi-sockets-network';
214
214
  export { Network };
215
- import type { ErrorCode } from '../exports/wasi-sockets-network';
215
+ import type { ErrorCode } from '../interfaces/wasi-sockets-network';
216
216
  export { ErrorCode };
217
- import type { IpSocketAddress } from '../exports/wasi-sockets-network';
217
+ import type { IpSocketAddress } from '../interfaces/wasi-sockets-network';
218
218
  export { IpSocketAddress };
219
- import type { IpAddressFamily } from '../exports/wasi-sockets-network';
219
+ import type { IpAddressFamily } from '../interfaces/wasi-sockets-network';
220
220
  export { IpAddressFamily };
221
221
  /**
222
222
  * A UDP socket handle.
@@ -1,29 +1,29 @@
1
- import { WasiCliEnvironment } from './imports/wasi-cli-environment';
2
- import { WasiCliExit } from './imports/wasi-cli-exit';
3
- import { WasiCliStderr } from './imports/wasi-cli-stderr';
4
- import { WasiCliStdin } from './imports/wasi-cli-stdin';
5
- import { WasiCliStdout } from './imports/wasi-cli-stdout';
6
- import { WasiCliTerminalInput } from './imports/wasi-cli-terminal-input';
7
- import { WasiCliTerminalOutput } from './imports/wasi-cli-terminal-output';
8
- import { WasiCliTerminalStderr } from './imports/wasi-cli-terminal-stderr';
9
- import { WasiCliTerminalStdin } from './imports/wasi-cli-terminal-stdin';
10
- import { WasiCliTerminalStdout } from './imports/wasi-cli-terminal-stdout';
11
- import { WasiClocksMonotonicClock } from './imports/wasi-clocks-monotonic-clock';
12
- import { WasiClocksTimezone } from './imports/wasi-clocks-timezone';
13
- import { WasiClocksWallClock } from './imports/wasi-clocks-wall-clock';
14
- import { WasiFilesystemPreopens } from './imports/wasi-filesystem-preopens';
15
- import { WasiFilesystemTypes } from './imports/wasi-filesystem-types';
16
- import { WasiIoStreams } from './imports/wasi-io-streams';
17
- import { WasiPollPoll } from './imports/wasi-poll-poll';
18
- import { WasiRandomInsecure } from './imports/wasi-random-insecure';
19
- import { WasiRandomInsecureSeed } from './imports/wasi-random-insecure-seed';
20
- import { WasiRandomRandom } from './imports/wasi-random-random';
21
- import { WasiSocketsInstanceNetwork } from './imports/wasi-sockets-instance-network';
22
- import { WasiSocketsIpNameLookup } from './imports/wasi-sockets-ip-name-lookup';
23
- import { WasiSocketsNetwork } from './imports/wasi-sockets-network';
24
- import { WasiSocketsTcp } from './imports/wasi-sockets-tcp';
25
- import { WasiSocketsTcpCreateSocket } from './imports/wasi-sockets-tcp-create-socket';
26
- import { WasiSocketsUdp } from './imports/wasi-sockets-udp';
27
- import { WasiSocketsUdpCreateSocket } from './imports/wasi-sockets-udp-create-socket';
28
- import { WasiCliRun } from './exports/wasi-cli-run';
1
+ import { WasiCliEnvironment } from './interfaces/wasi-cli-environment';
2
+ import { WasiCliExit } from './interfaces/wasi-cli-exit';
3
+ import { WasiCliStderr } from './interfaces/wasi-cli-stderr';
4
+ import { WasiCliStdin } from './interfaces/wasi-cli-stdin';
5
+ import { WasiCliStdout } from './interfaces/wasi-cli-stdout';
6
+ import { WasiCliTerminalInput } from './interfaces/wasi-cli-terminal-input';
7
+ import { WasiCliTerminalOutput } from './interfaces/wasi-cli-terminal-output';
8
+ import { WasiCliTerminalStderr } from './interfaces/wasi-cli-terminal-stderr';
9
+ import { WasiCliTerminalStdin } from './interfaces/wasi-cli-terminal-stdin';
10
+ import { WasiCliTerminalStdout } from './interfaces/wasi-cli-terminal-stdout';
11
+ import { WasiClocksMonotonicClock } from './interfaces/wasi-clocks-monotonic-clock';
12
+ import { WasiClocksTimezone } from './interfaces/wasi-clocks-timezone';
13
+ import { WasiClocksWallClock } from './interfaces/wasi-clocks-wall-clock';
14
+ import { WasiFilesystemPreopens } from './interfaces/wasi-filesystem-preopens';
15
+ import { WasiFilesystemTypes } from './interfaces/wasi-filesystem-types';
16
+ import { WasiIoStreams } from './interfaces/wasi-io-streams';
17
+ import { WasiPollPoll } from './interfaces/wasi-poll-poll';
18
+ import { WasiRandomInsecure } from './interfaces/wasi-random-insecure';
19
+ import { WasiRandomInsecureSeed } from './interfaces/wasi-random-insecure-seed';
20
+ import { WasiRandomRandom } from './interfaces/wasi-random-random';
21
+ import { WasiSocketsInstanceNetwork } from './interfaces/wasi-sockets-instance-network';
22
+ import { WasiSocketsIpNameLookup } from './interfaces/wasi-sockets-ip-name-lookup';
23
+ import { WasiSocketsNetwork } from './interfaces/wasi-sockets-network';
24
+ import { WasiSocketsTcp } from './interfaces/wasi-sockets-tcp';
25
+ import { WasiSocketsTcpCreateSocket } from './interfaces/wasi-sockets-tcp-create-socket';
26
+ import { WasiSocketsUdp } from './interfaces/wasi-sockets-udp';
27
+ import { WasiSocketsUdpCreateSocket } from './interfaces/wasi-sockets-udp-create-socket';
28
+ import { WasiCliRun } from './interfaces/wasi-cli-run';
29
29
  export const run: typeof WasiCliRun;
@@ -1,5 +0,0 @@
1
- export namespace WasiCliStderr {
2
- export function getStderr(): OutputStream;
3
- }
4
- import type { OutputStream } from '../exports/wasi-io-streams';
5
- export { OutputStream };
@@ -1,5 +0,0 @@
1
- export namespace WasiCliStdout {
2
- export function getStdout(): OutputStream;
3
- }
4
- import type { OutputStream } from '../exports/wasi-io-streams';
5
- export { OutputStream };
@@ -1,9 +0,0 @@
1
- export namespace WasiCliTerminalStderr {
2
- /**
3
- * If stderr is connected to a terminal, return a `terminal-output` handle
4
- * allowing further interaction with it.
5
- */
6
- export function getTerminalStderr(): TerminalOutput | null;
7
- }
8
- import type { TerminalOutput } from '../exports/wasi-cli-terminal-output';
9
- export { TerminalOutput };
@@ -1,9 +0,0 @@
1
- export namespace WasiCliTerminalStdin {
2
- /**
3
- * If stdin is connected to a terminal, return a `terminal-input` handle
4
- * allowing further interaction with it.
5
- */
6
- export function getTerminalStdin(): TerminalInput | null;
7
- }
8
- import type { TerminalInput } from '../exports/wasi-cli-terminal-input';
9
- export { TerminalInput };
@@ -1,9 +0,0 @@
1
- export namespace WasiCliTerminalStdout {
2
- /**
3
- * If stdout is connected to a terminal, return a `terminal-output` handle
4
- * allowing further interaction with it.
5
- */
6
- export function getTerminalStdout(): TerminalOutput | null;
7
- }
8
- import type { TerminalOutput } from '../exports/wasi-cli-terminal-output';
9
- export { TerminalOutput };
@@ -1,24 +0,0 @@
1
- export namespace WasiClocksMonotonicClock {
2
- /**
3
- * Read the current value of the clock.
4
- *
5
- * The clock is monotonic, therefore calling this function repeatedly will
6
- * produce a sequence of non-decreasing values.
7
- */
8
- export function now(): Instant;
9
- /**
10
- * Query the resolution of the clock.
11
- */
12
- export function resolution(): Instant;
13
- /**
14
- * Create a `pollable` which will resolve once the specified time has been
15
- * reached.
16
- */
17
- export function subscribe(when: Instant, absolute: boolean): Pollable;
18
- }
19
- import type { Pollable } from '../exports/wasi-poll-poll';
20
- export { Pollable };
21
- /**
22
- * A timestamp in nanoseconds.
23
- */
24
- export type Instant = bigint;