@bytecodealliance/preview2-shim 0.17.0 → 0.17.2
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/lib/browser/cli.js +7 -4
- package/lib/io/worker-socket-tcp.js +2 -2
- package/lib/io/worker-thread.js +66 -13
- package/lib/nodejs/cli.js +3 -0
- package/lib/nodejs/filesystem.js +5 -7
- package/package.json +1 -1
- package/types/cli.d.ts +11 -23
- package/types/clocks.d.ts +2 -5
- package/types/filesystem.d.ts +2 -5
- package/types/http.d.ts +3 -7
- package/types/index.d.ts +7 -15
- package/types/interfaces/wasi-cli-environment.d.ts +21 -22
- package/types/interfaces/wasi-cli-exit.d.ts +5 -6
- package/types/interfaces/wasi-cli-run.d.ts +5 -6
- package/types/interfaces/wasi-cli-stderr.d.ts +3 -5
- package/types/interfaces/wasi-cli-stdin.d.ts +3 -5
- package/types/interfaces/wasi-cli-stdout.d.ts +3 -5
- package/types/interfaces/wasi-cli-terminal-input.d.ts +5 -3
- package/types/interfaces/wasi-cli-terminal-output.d.ts +5 -3
- package/types/interfaces/wasi-cli-terminal-stderr.d.ts +7 -9
- package/types/interfaces/wasi-cli-terminal-stdin.d.ts +7 -9
- package/types/interfaces/wasi-cli-terminal-stdout.d.ts +7 -9
- package/types/interfaces/wasi-clocks-monotonic-clock.d.ts +24 -26
- package/types/interfaces/wasi-clocks-wall-clock.d.ts +23 -24
- package/types/interfaces/wasi-filesystem-preopens.d.ts +6 -8
- package/types/interfaces/wasi-filesystem-types.d.ts +34 -39
- package/types/interfaces/wasi-http-incoming-handler.d.ts +16 -19
- package/types/interfaces/wasi-http-outgoing-handler.d.ts +18 -23
- package/types/interfaces/wasi-http-types.d.ts +94 -66
- package/types/interfaces/wasi-io-error.d.ts +5 -3
- package/types/interfaces/wasi-io-poll.d.ts +27 -25
- package/types/interfaces/wasi-io-streams.d.ts +27 -21
- package/types/interfaces/wasi-random-insecure-seed.d.ts +21 -22
- package/types/interfaces/wasi-random-insecure.d.ts +19 -20
- package/types/interfaces/wasi-random-random.d.ts +23 -24
- package/types/interfaces/wasi-sockets-instance-network.d.ts +6 -8
- package/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +33 -35
- package/types/interfaces/wasi-sockets-network.d.ts +5 -3
- package/types/interfaces/wasi-sockets-tcp-create-socket.d.ts +28 -33
- package/types/interfaces/wasi-sockets-tcp.d.ts +18 -24
- package/types/interfaces/wasi-sockets-udp-create-socket.d.ts +28 -33
- package/types/interfaces/wasi-sockets-udp.d.ts +23 -20
- package/types/io.d.ts +3 -7
- package/types/random.d.ts +3 -7
- package/types/sockets.d.ts +7 -15
- package/types/wasi-cli-command.d.ts +29 -29
- package/types/wasi-http-proxy.d.ts +13 -13
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
1
|
+
/** @module Interface wasi:random/insecure-seed@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Return a 128-bit value that may contain a pseudo-random value.
|
|
4
|
+
*
|
|
5
|
+
* The returned value is not required to be computed from a CSPRNG, and may
|
|
6
|
+
* even be entirely deterministic. Host implementations are encouraged to
|
|
7
|
+
* provide pseudo-random values to any program exposed to
|
|
8
|
+
* attacker-controlled content, to enable DoS protection built into many
|
|
9
|
+
* languages' hash-map implementations.
|
|
10
|
+
*
|
|
11
|
+
* This function is intended to only be called once, by a source language
|
|
12
|
+
* to initialize Denial Of Service (DoS) protection in its hash-map
|
|
13
|
+
* implementation.
|
|
14
|
+
*
|
|
15
|
+
* # Expected future evolution
|
|
16
|
+
*
|
|
17
|
+
* This will likely be changed to a value import, to prevent it from being
|
|
18
|
+
* called multiple times and potentially used for purposes other than DoS
|
|
19
|
+
* protection.
|
|
20
|
+
*/
|
|
21
|
+
export function insecureSeed(): [bigint, bigint];
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
1
|
+
/** @module Interface wasi:random/insecure@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Return `len` insecure pseudo-random bytes.
|
|
4
|
+
*
|
|
5
|
+
* This function is not cryptographically secure. Do not use it for
|
|
6
|
+
* anything related to security.
|
|
7
|
+
*
|
|
8
|
+
* There are no requirements on the values of the returned bytes, however
|
|
9
|
+
* implementations are encouraged to return evenly distributed values with
|
|
10
|
+
* a long period.
|
|
11
|
+
*/
|
|
12
|
+
export function getInsecureRandomBytes(len: bigint): Uint8Array;
|
|
13
|
+
/**
|
|
14
|
+
* Return an insecure pseudo-random `u64` value.
|
|
15
|
+
*
|
|
16
|
+
* This function returns the same type of pseudo-random data as
|
|
17
|
+
* `get-insecure-random-bytes`, represented as a `u64`.
|
|
18
|
+
*/
|
|
19
|
+
export function getInsecureRandomU64(): bigint;
|
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
1
|
+
/** @module Interface wasi:random/random@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Return `len` cryptographically-secure random or pseudo-random bytes.
|
|
4
|
+
*
|
|
5
|
+
* This function must produce data at least as cryptographically secure and
|
|
6
|
+
* fast as an adequately seeded cryptographically-secure pseudo-random
|
|
7
|
+
* number generator (CSPRNG). It must not block, from the perspective of
|
|
8
|
+
* the calling program, under any circumstances, including on the first
|
|
9
|
+
* request and on requests for numbers of bytes. The returned data must
|
|
10
|
+
* always be unpredictable.
|
|
11
|
+
*
|
|
12
|
+
* This function must always return fresh data. Deterministic environments
|
|
13
|
+
* must omit this function, rather than implementing it with deterministic
|
|
14
|
+
* data.
|
|
15
|
+
*/
|
|
16
|
+
export function getRandomBytes(len: bigint): Uint8Array;
|
|
17
|
+
/**
|
|
18
|
+
* Return a cryptographically-secure random or pseudo-random `u64` value.
|
|
19
|
+
*
|
|
20
|
+
* This function returns the same type of data as `get-random-bytes`,
|
|
21
|
+
* represented as a `u64`.
|
|
22
|
+
*/
|
|
23
|
+
export function getRandomU64(): bigint;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type { Network } from './wasi-sockets-network.js';
|
|
8
|
-
export { Network };
|
|
1
|
+
/** @module Interface wasi:sockets/instance-network@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Get a handle to the default network.
|
|
4
|
+
*/
|
|
5
|
+
export function instanceNetwork(): Network;
|
|
6
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
import type { Network } from './wasi-sockets-network.js';
|
|
30
|
-
export { Network };
|
|
31
|
-
import type { ErrorCode } from './wasi-sockets-network.js';
|
|
32
|
-
export { ErrorCode };
|
|
33
|
-
import type { IpAddress } from './wasi-sockets-network.js';
|
|
34
|
-
export { IpAddress };
|
|
1
|
+
/** @module Interface wasi:sockets/ip-name-lookup@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Resolve an internet host name to a list of IP addresses.
|
|
4
|
+
*
|
|
5
|
+
* Unicode domain names are automatically converted to ASCII using IDNA encoding.
|
|
6
|
+
* If the input is an IP address string, the address is parsed and returned
|
|
7
|
+
* as-is without making any external requests.
|
|
8
|
+
*
|
|
9
|
+
* See the wasi-socket proposal README.md for a comparison with getaddrinfo.
|
|
10
|
+
*
|
|
11
|
+
* This function never blocks. It either immediately fails or immediately
|
|
12
|
+
* returns successfully with a `resolve-address-stream` that can be used
|
|
13
|
+
* to (asynchronously) fetch the results.
|
|
14
|
+
*
|
|
15
|
+
* # Typical errors
|
|
16
|
+
* - `invalid-argument`: `name` is a syntactically invalid domain name or IP address.
|
|
17
|
+
*
|
|
18
|
+
* # References:
|
|
19
|
+
* - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/getaddrinfo.html>
|
|
20
|
+
* - <https://man7.org/linux/man-pages/man3/getaddrinfo.3.html>
|
|
21
|
+
* - <https://learn.microsoft.com/en-us/windows/win32/api/ws2tcpip/nf-ws2tcpip-getaddrinfo>
|
|
22
|
+
* - <https://man.freebsd.org/cgi/man.cgi?query=getaddrinfo&sektion=3>
|
|
23
|
+
*/
|
|
24
|
+
export function resolveAddresses(network: Network, name: string): ResolveAddressStream;
|
|
25
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
26
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
27
|
+
export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
|
|
28
|
+
export type IpAddress = import('./wasi-sockets-network.js').IpAddress;
|
|
35
29
|
|
|
36
30
|
export class ResolveAddressStream {
|
|
31
|
+
/**
|
|
32
|
+
* This type does not have a public constructor.
|
|
33
|
+
*/
|
|
34
|
+
private constructor();
|
|
37
35
|
/**
|
|
38
36
|
* Returns the next address from the resolver.
|
|
39
37
|
*
|
|
@@ -53,7 +51,7 @@ export class ResolveAddressStream {
|
|
|
53
51
|
/**
|
|
54
52
|
* Create a `pollable` which will resolve once the stream is ready for I/O.
|
|
55
53
|
*
|
|
56
|
-
* Note: this function is here for WASI
|
|
54
|
+
* Note: this function is here for WASI 0.2 only.
|
|
57
55
|
* It's planned to be removed when `future` is natively supported in Preview3.
|
|
58
56
|
*/
|
|
59
57
|
subscribe(): Pollable;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { Network };
|
|
3
|
-
}
|
|
1
|
+
/** @module Interface wasi:sockets/network@0.2.3 **/
|
|
4
2
|
/**
|
|
5
3
|
* Error codes.
|
|
6
4
|
*
|
|
@@ -159,4 +157,8 @@ export interface IpSocketAddressIpv6 {
|
|
|
159
157
|
}
|
|
160
158
|
|
|
161
159
|
export class Network {
|
|
160
|
+
/**
|
|
161
|
+
* This type does not have a public constructor.
|
|
162
|
+
*/
|
|
163
|
+
private constructor();
|
|
162
164
|
}
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
export { ErrorCode };
|
|
30
|
-
import type { IpAddressFamily } from './wasi-sockets-network.js';
|
|
31
|
-
export { IpAddressFamily };
|
|
32
|
-
import type { TcpSocket } from './wasi-sockets-tcp.js';
|
|
33
|
-
export { TcpSocket };
|
|
1
|
+
/** @module Interface wasi:sockets/tcp-create-socket@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Create a new TCP socket.
|
|
4
|
+
*
|
|
5
|
+
* Similar to `socket(AF_INET or AF_INET6, SOCK_STREAM, IPPROTO_TCP)` in POSIX.
|
|
6
|
+
* On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
|
|
7
|
+
*
|
|
8
|
+
* This function does not require a network capability handle. This is considered to be safe because
|
|
9
|
+
* at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind`/`connect`
|
|
10
|
+
* is called, the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
|
|
11
|
+
*
|
|
12
|
+
* All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
|
|
13
|
+
*
|
|
14
|
+
* # Typical errors
|
|
15
|
+
* - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT)
|
|
16
|
+
* - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
|
|
17
|
+
*
|
|
18
|
+
* # References
|
|
19
|
+
* - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
|
|
20
|
+
* - <https://man7.org/linux/man-pages/man2/socket.2.html>
|
|
21
|
+
* - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
|
|
22
|
+
* - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
|
|
23
|
+
*/
|
|
24
|
+
export function createTcpSocket(addressFamily: IpAddressFamily): TcpSocket;
|
|
25
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
26
|
+
export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
|
|
27
|
+
export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
|
|
28
|
+
export type TcpSocket = import('./wasi-sockets-tcp.js').TcpSocket;
|
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
import type { Duration } from './wasi-clocks-monotonic-clock.js';
|
|
11
|
-
export { Duration };
|
|
12
|
-
import type { Network } from './wasi-sockets-network.js';
|
|
13
|
-
export { Network };
|
|
14
|
-
import type { ErrorCode } from './wasi-sockets-network.js';
|
|
15
|
-
export { ErrorCode };
|
|
16
|
-
import type { IpSocketAddress } from './wasi-sockets-network.js';
|
|
17
|
-
export { IpSocketAddress };
|
|
18
|
-
import type { IpAddressFamily } from './wasi-sockets-network.js';
|
|
19
|
-
export { IpAddressFamily };
|
|
1
|
+
/** @module Interface wasi:sockets/tcp@0.2.3 **/
|
|
2
|
+
export type InputStream = import('./wasi-io-streams.js').InputStream;
|
|
3
|
+
export type OutputStream = import('./wasi-io-streams.js').OutputStream;
|
|
4
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
5
|
+
export type Duration = import('./wasi-clocks-monotonic-clock.js').Duration;
|
|
6
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
7
|
+
export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
|
|
8
|
+
export type IpSocketAddress = import('./wasi-sockets-network.js').IpSocketAddress;
|
|
9
|
+
export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
|
|
20
10
|
/**
|
|
21
11
|
* # Variants
|
|
22
12
|
*
|
|
@@ -33,6 +23,10 @@ export { IpAddressFamily };
|
|
|
33
23
|
export type ShutdownType = 'receive' | 'send' | 'both';
|
|
34
24
|
|
|
35
25
|
export class TcpSocket {
|
|
26
|
+
/**
|
|
27
|
+
* This type does not have a public constructor.
|
|
28
|
+
*/
|
|
29
|
+
private constructor();
|
|
36
30
|
/**
|
|
37
31
|
* Bind the socket to a specific network on the provided IP address and port.
|
|
38
32
|
*
|
|
@@ -332,7 +326,7 @@ export class TcpSocket {
|
|
|
332
326
|
* See <https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md#pollable-readiness>
|
|
333
327
|
* for more information.
|
|
334
328
|
*
|
|
335
|
-
* Note: this function is here for WASI
|
|
329
|
+
* Note: this function is here for WASI 0.2 only.
|
|
336
330
|
* It's planned to be removed when `future` is natively supported in Preview3.
|
|
337
331
|
*/
|
|
338
332
|
subscribe(): Pollable;
|
|
@@ -340,11 +334,11 @@ export class TcpSocket {
|
|
|
340
334
|
* Initiate a graceful shutdown.
|
|
341
335
|
*
|
|
342
336
|
* - `receive`: The socket is not expecting to receive any data from
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
337
|
+
* the peer. The `input-stream` associated with this socket will be
|
|
338
|
+
* closed. Any data still in the receive queue at time of calling
|
|
339
|
+
* this method will be discarded.
|
|
346
340
|
* - `send`: The socket has no more data to send to the peer. The `output-stream`
|
|
347
|
-
*
|
|
341
|
+
* associated with this socket will be closed and a FIN packet will be sent.
|
|
348
342
|
* - `both`: Same effect as `receive` & `send` combined.
|
|
349
343
|
*
|
|
350
344
|
* This function is idempotent; shutting down a direction more than once
|
|
@@ -1,33 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
export { ErrorCode };
|
|
30
|
-
import type { IpAddressFamily } from './wasi-sockets-network.js';
|
|
31
|
-
export { IpAddressFamily };
|
|
32
|
-
import type { UdpSocket } from './wasi-sockets-udp.js';
|
|
33
|
-
export { UdpSocket };
|
|
1
|
+
/** @module Interface wasi:sockets/udp-create-socket@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Create a new UDP socket.
|
|
4
|
+
*
|
|
5
|
+
* Similar to `socket(AF_INET or AF_INET6, SOCK_DGRAM, IPPROTO_UDP)` in POSIX.
|
|
6
|
+
* On IPv6 sockets, IPV6_V6ONLY is enabled by default and can't be configured otherwise.
|
|
7
|
+
*
|
|
8
|
+
* This function does not require a network capability handle. This is considered to be safe because
|
|
9
|
+
* at time of creation, the socket is not bound to any `network` yet. Up to the moment `bind` is called,
|
|
10
|
+
* the socket is effectively an in-memory configuration object, unable to communicate with the outside world.
|
|
11
|
+
*
|
|
12
|
+
* All sockets are non-blocking. Use the wasi-poll interface to block on asynchronous operations.
|
|
13
|
+
*
|
|
14
|
+
* # Typical errors
|
|
15
|
+
* - `not-supported`: The specified `address-family` is not supported. (EAFNOSUPPORT)
|
|
16
|
+
* - `new-socket-limit`: The new socket resource could not be created because of a system limit. (EMFILE, ENFILE)
|
|
17
|
+
*
|
|
18
|
+
* # References:
|
|
19
|
+
* - <https://pubs.opengroup.org/onlinepubs/9699919799/functions/socket.html>
|
|
20
|
+
* - <https://man7.org/linux/man-pages/man2/socket.2.html>
|
|
21
|
+
* - <https://learn.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-wsasocketw>
|
|
22
|
+
* - <https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2>
|
|
23
|
+
*/
|
|
24
|
+
export function createUdpSocket(addressFamily: IpAddressFamily): UdpSocket;
|
|
25
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
26
|
+
export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
|
|
27
|
+
export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
|
|
28
|
+
export type UdpSocket = import('./wasi-sockets-udp.js').UdpSocket;
|
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export { Pollable };
|
|
8
|
-
import type { Network } from './wasi-sockets-network.js';
|
|
9
|
-
export { Network };
|
|
10
|
-
import type { ErrorCode } from './wasi-sockets-network.js';
|
|
11
|
-
export { ErrorCode };
|
|
12
|
-
import type { IpSocketAddress } from './wasi-sockets-network.js';
|
|
13
|
-
export { IpSocketAddress };
|
|
14
|
-
import type { IpAddressFamily } from './wasi-sockets-network.js';
|
|
15
|
-
export { IpAddressFamily };
|
|
1
|
+
/** @module Interface wasi:sockets/udp@0.2.3 **/
|
|
2
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
3
|
+
export type Network = import('./wasi-sockets-network.js').Network;
|
|
4
|
+
export type ErrorCode = import('./wasi-sockets-network.js').ErrorCode;
|
|
5
|
+
export type IpSocketAddress = import('./wasi-sockets-network.js').IpSocketAddress;
|
|
6
|
+
export type IpAddressFamily = import('./wasi-sockets-network.js').IpAddressFamily;
|
|
16
7
|
/**
|
|
17
8
|
* A received datagram.
|
|
18
9
|
*/
|
|
@@ -53,6 +44,10 @@ export interface OutgoingDatagram {
|
|
|
53
44
|
}
|
|
54
45
|
|
|
55
46
|
export class IncomingDatagramStream {
|
|
47
|
+
/**
|
|
48
|
+
* This type does not have a public constructor.
|
|
49
|
+
*/
|
|
50
|
+
private constructor();
|
|
56
51
|
/**
|
|
57
52
|
* Receive messages on the socket.
|
|
58
53
|
*
|
|
@@ -82,13 +77,17 @@ export class IncomingDatagramStream {
|
|
|
82
77
|
/**
|
|
83
78
|
* Create a `pollable` which will resolve once the stream is ready to receive again.
|
|
84
79
|
*
|
|
85
|
-
* Note: this function is here for WASI
|
|
80
|
+
* Note: this function is here for WASI 0.2 only.
|
|
86
81
|
* It's planned to be removed when `future` is natively supported in Preview3.
|
|
87
82
|
*/
|
|
88
83
|
subscribe(): Pollable;
|
|
89
84
|
}
|
|
90
85
|
|
|
91
86
|
export class OutgoingDatagramStream {
|
|
87
|
+
/**
|
|
88
|
+
* This type does not have a public constructor.
|
|
89
|
+
*/
|
|
90
|
+
private constructor();
|
|
92
91
|
/**
|
|
93
92
|
* Check readiness for sending. This function never blocks.
|
|
94
93
|
*
|
|
@@ -143,13 +142,17 @@ export class OutgoingDatagramStream {
|
|
|
143
142
|
/**
|
|
144
143
|
* Create a `pollable` which will resolve once the stream is ready to send again.
|
|
145
144
|
*
|
|
146
|
-
* Note: this function is here for WASI
|
|
145
|
+
* Note: this function is here for WASI 0.2 only.
|
|
147
146
|
* It's planned to be removed when `future` is natively supported in Preview3.
|
|
148
147
|
*/
|
|
149
148
|
subscribe(): Pollable;
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
export class UdpSocket {
|
|
152
|
+
/**
|
|
153
|
+
* This type does not have a public constructor.
|
|
154
|
+
*/
|
|
155
|
+
private constructor();
|
|
153
156
|
/**
|
|
154
157
|
* Bind the socket to a specific network on the provided IP address and port.
|
|
155
158
|
*
|
|
@@ -198,10 +201,10 @@ export class UdpSocket {
|
|
|
198
201
|
* The POSIX equivalent in pseudo-code is:
|
|
199
202
|
* ```text
|
|
200
203
|
* if (was previously connected) {
|
|
201
|
-
*
|
|
204
|
+
* connect(s, AF_UNSPEC)
|
|
202
205
|
* }
|
|
203
206
|
* if (remote_address is Some) {
|
|
204
|
-
*
|
|
207
|
+
* connect(s, remote_address)
|
|
205
208
|
* }
|
|
206
209
|
* ```
|
|
207
210
|
*
|
|
@@ -290,7 +293,7 @@ export class UdpSocket {
|
|
|
290
293
|
/**
|
|
291
294
|
* Create a `pollable` which will resolve once the socket is ready for I/O.
|
|
292
295
|
*
|
|
293
|
-
* Note: this function is here for WASI
|
|
296
|
+
* Note: this function is here for WASI 0.2 only.
|
|
294
297
|
* It's planned to be removed when `future` is natively supported in Preview3.
|
|
295
298
|
*/
|
|
296
299
|
subscribe(): Pollable;
|
package/types/io.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const error: typeof WasiIoError;
|
|
6
|
-
export const poll: typeof WasiIoPoll;
|
|
7
|
-
export const streams: typeof WasiIoStreams;
|
|
1
|
+
export type * as error from './interfaces/wasi-io-error.d.ts';
|
|
2
|
+
export type * as poll from './interfaces/wasi-io-poll.d.ts';
|
|
3
|
+
export type * as streams from './interfaces/wasi-io-streams.d.ts';
|
package/types/random.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const insecureSeed: typeof WasiRandomInsecureSeed;
|
|
6
|
-
export const insecure: typeof WasiRandomInsecure;
|
|
7
|
-
export const random: typeof WasiRandomRandom;
|
|
1
|
+
export type * as insecureSeed from './interfaces/wasi-random-insecure-seed.d.ts';
|
|
2
|
+
export type * as insecure from './interfaces/wasi-random-insecure.d.ts';
|
|
3
|
+
export type * as random from './interfaces/wasi-random-random.d.ts';
|
package/types/sockets.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const instanceNetwork: typeof WasiSocketsInstanceNetwork;
|
|
10
|
-
export const ipNameLookup: typeof WasiSocketsIpNameLookup;
|
|
11
|
-
export const network: typeof WasiSocketsNetwork;
|
|
12
|
-
export const tcpCreateSocket: typeof WasiSocketsTcpCreateSocket;
|
|
13
|
-
export const tcp: typeof WasiSocketsTcp;
|
|
14
|
-
export const udpCreateSocket: typeof WasiSocketsUdpCreateSocket;
|
|
15
|
-
export const udp: typeof WasiSocketsUdp;
|
|
1
|
+
export type * as instanceNetwork from './interfaces/wasi-sockets-instance-network.d.ts';
|
|
2
|
+
export type * as ipNameLookup from './interfaces/wasi-sockets-ip-name-lookup.d.ts';
|
|
3
|
+
export type * as network from './interfaces/wasi-sockets-network.d.ts';
|
|
4
|
+
export type * as tcpCreateSocket from './interfaces/wasi-sockets-tcp-create-socket.d.ts';
|
|
5
|
+
export type * as tcp from './interfaces/wasi-sockets-tcp.d.ts';
|
|
6
|
+
export type * as udpCreateSocket from './interfaces/wasi-sockets-udp-create-socket.d.ts';
|
|
7
|
+
export type * as udp from './interfaces/wasi-sockets-udp.d.ts';
|