@bytecodealliance/preview3-shim 0.1.0-rc.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/LICENSE +220 -0
- package/README.md +14 -0
- package/lib/nodejs/cli.js +127 -0
- package/lib/nodejs/clocks.js +100 -0
- package/lib/nodejs/filesystem/descriptor.js +997 -0
- package/lib/nodejs/filesystem/error.js +92 -0
- package/lib/nodejs/filesystem/utils.js +19 -0
- package/lib/nodejs/filesystem.js +2 -0
- package/lib/nodejs/finalization.js +33 -0
- package/lib/nodejs/future.js +187 -0
- package/lib/nodejs/http/client.js +146 -0
- package/lib/nodejs/http/error.js +71 -0
- package/lib/nodejs/http/fields.js +359 -0
- package/lib/nodejs/http/request.js +589 -0
- package/lib/nodejs/http/response.js +212 -0
- package/lib/nodejs/http/server.js +157 -0
- package/lib/nodejs/http.js +34 -0
- package/lib/nodejs/index.js +8 -0
- package/lib/nodejs/random.js +14 -0
- package/lib/nodejs/sockets/address.js +146 -0
- package/lib/nodejs/sockets/error.js +123 -0
- package/lib/nodejs/sockets/ip-name-lookup.js +93 -0
- package/lib/nodejs/sockets/tcp.js +776 -0
- package/lib/nodejs/sockets/udp.js +516 -0
- package/lib/nodejs/sockets.js +14 -0
- package/lib/nodejs/stream.js +423 -0
- package/lib/nodejs/workers/cli-worker.js +49 -0
- package/lib/nodejs/workers/filesystem-worker.js +119 -0
- package/lib/nodejs/workers/http-worker.js +387 -0
- package/lib/nodejs/workers/resource-worker.js +151 -0
- package/lib/nodejs/workers/tcp-worker.js +283 -0
- package/lib/nodejs/workers/udp-worker.js +194 -0
- package/package.json +57 -0
- package/types/cli.d.ts +12 -0
- package/types/clocks.d.ts +2 -0
- package/types/filesystem.d.ts +2 -0
- package/types/http.d.ts +4 -0
- package/types/index.d.ts +6 -0
- package/types/interfaces/wasi-cli-environment.d.ts +21 -0
- package/types/interfaces/wasi-cli-exit.d.ts +6 -0
- package/types/interfaces/wasi-cli-run.d.ts +5 -0
- package/types/interfaces/wasi-cli-stderr.d.ts +14 -0
- package/types/interfaces/wasi-cli-stdin.d.ts +19 -0
- package/types/interfaces/wasi-cli-stdout.d.ts +14 -0
- package/types/interfaces/wasi-cli-terminal-input.d.ts +8 -0
- package/types/interfaces/wasi-cli-terminal-output.d.ts +8 -0
- package/types/interfaces/wasi-cli-terminal-stderr.d.ts +7 -0
- package/types/interfaces/wasi-cli-terminal-stdin.d.ts +7 -0
- package/types/interfaces/wasi-cli-terminal-stdout.d.ts +7 -0
- package/types/interfaces/wasi-cli-types.d.ts +15 -0
- package/types/interfaces/wasi-clocks-monotonic-clock.d.ts +33 -0
- package/types/interfaces/wasi-clocks-system-clock.d.ts +38 -0
- package/types/interfaces/wasi-clocks-types.d.ts +5 -0
- package/types/interfaces/wasi-filesystem-preopens.d.ts +6 -0
- package/types/interfaces/wasi-filesystem-types.d.ts +780 -0
- package/types/interfaces/wasi-http-client.d.ts +9 -0
- package/types/interfaces/wasi-http-handler.d.ts +9 -0
- package/types/interfaces/wasi-http-types.d.ts +619 -0
- package/types/interfaces/wasi-random-insecure-seed.d.ts +21 -0
- package/types/interfaces/wasi-random-insecure.d.ts +26 -0
- package/types/interfaces/wasi-random-random.d.ts +31 -0
- package/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +77 -0
- package/types/interfaces/wasi-sockets-types.d.ts +830 -0
- package/types/random.d.ts +3 -0
- package/types/sockets.d.ts +2 -0
- package/types/wasi-cli-command.d.ts +23 -0
- package/types/wasi-http-service.d.ts +14 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @module Interface wasi:cli/terminal-stdin@0.3.0-rc-2026-03-15 **/
|
|
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 | undefined;
|
|
7
|
+
export type TerminalInput = import('./wasi-cli-terminal-input.js').TerminalInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** @module Interface wasi:cli/terminal-stdout@0.3.0-rc-2026-03-15 **/
|
|
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 | undefined;
|
|
7
|
+
export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** @module Interface wasi:cli/types@0.3.0-rc-2026-03-15 **/
|
|
2
|
+
/**
|
|
3
|
+
* # Variants
|
|
4
|
+
*
|
|
5
|
+
* ## `"io"`
|
|
6
|
+
*
|
|
7
|
+
* Input/output error
|
|
8
|
+
* ## `"illegal-byte-sequence"`
|
|
9
|
+
*
|
|
10
|
+
* Invalid or incomplete multibyte or wide character
|
|
11
|
+
* ## `"pipe"`
|
|
12
|
+
*
|
|
13
|
+
* Broken pipe
|
|
14
|
+
*/
|
|
15
|
+
export type ErrorCode = 'io' | 'illegal-byte-sequence' | 'pipe';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @module Interface wasi:clocks/monotonic-clock@0.3.0-rc-2026-03-15 **/
|
|
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
|
+
* For completeness, this function traps if it's not possible to represent
|
|
9
|
+
* the value of the clock in a `mark`. Consequently, implementations
|
|
10
|
+
* should ensure that the starting time is low enough to avoid the
|
|
11
|
+
* possibility of overflow in practice.
|
|
12
|
+
*/
|
|
13
|
+
export function now(): Mark;
|
|
14
|
+
/**
|
|
15
|
+
* Query the resolution of the clock. Returns the duration of time
|
|
16
|
+
* corresponding to a clock tick.
|
|
17
|
+
*/
|
|
18
|
+
export function getResolution(): Duration;
|
|
19
|
+
/**
|
|
20
|
+
* Wait until the specified mark has occurred.
|
|
21
|
+
*/
|
|
22
|
+
export function waitUntil(when: Mark): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Wait for the specified duration to elapse.
|
|
25
|
+
*/
|
|
26
|
+
export function waitFor(howLong: Duration): Promise<void>;
|
|
27
|
+
export type Duration = import('./wasi-clocks-types.js').Duration;
|
|
28
|
+
/**
|
|
29
|
+
* A mark on a monotonic clock is a number of nanoseconds since an
|
|
30
|
+
* unspecified initial value, and can only be compared to instances from
|
|
31
|
+
* the same monotonic-clock.
|
|
32
|
+
*/
|
|
33
|
+
export type Mark = bigint;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/** @module Interface wasi:clocks/system-clock@0.3.0-rc-2026-03-15 **/
|
|
2
|
+
/**
|
|
3
|
+
* Read the current value of the clock.
|
|
4
|
+
*
|
|
5
|
+
* This clock is not monotonic, therefore calling this function repeatedly
|
|
6
|
+
* will not necessarily produce a sequence of non-decreasing values.
|
|
7
|
+
*
|
|
8
|
+
* The nanoseconds field of the output is always less than 1000000000.
|
|
9
|
+
*/
|
|
10
|
+
export function now(): Instant;
|
|
11
|
+
/**
|
|
12
|
+
* Query the resolution of the clock. Returns the smallest duration of time
|
|
13
|
+
* that the implementation permits distinguishing.
|
|
14
|
+
*/
|
|
15
|
+
export function getResolution(): Duration;
|
|
16
|
+
export type Duration = import('./wasi-clocks-types.js').Duration;
|
|
17
|
+
/**
|
|
18
|
+
* An "instant", or "exact time", is a point in time without regard to any
|
|
19
|
+
* time zone: just the time since a particular external reference point,
|
|
20
|
+
* often called an "epoch".
|
|
21
|
+
*
|
|
22
|
+
* Here, the epoch is 1970-01-01T00:00:00Z, also known as
|
|
23
|
+
* [POSIX's Seconds Since the Epoch], also known as [Unix Time].
|
|
24
|
+
*
|
|
25
|
+
* Note that even if the seconds field is negative, incrementing
|
|
26
|
+
* nanoseconds always represents moving forwards in time.
|
|
27
|
+
* For example, `{ -1 seconds, 999999999 nanoseconds }` represents the
|
|
28
|
+
* instant one nanosecond before the epoch.
|
|
29
|
+
* For more on various different ways to represent time, see
|
|
30
|
+
* https://tc39.es/proposal-temporal/docs/timezone.html
|
|
31
|
+
*
|
|
32
|
+
* [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
33
|
+
* [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
34
|
+
*/
|
|
35
|
+
export interface Instant {
|
|
36
|
+
seconds: bigint,
|
|
37
|
+
nanoseconds: number,
|
|
38
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** @module Interface wasi:filesystem/preopens@0.3.0-rc-2026-03-15 **/
|
|
2
|
+
/**
|
|
3
|
+
* Return the set of preopened directories, and their paths.
|
|
4
|
+
*/
|
|
5
|
+
export function getDirectories(): Array<[Descriptor, string]>;
|
|
6
|
+
export type Descriptor = import('./wasi-filesystem-types.js').Descriptor;
|