@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
package/lib/browser/cli.js
CHANGED
|
@@ -29,16 +29,19 @@ export const environment = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
class ComponentExit extends Error {
|
|
32
|
-
constructor(
|
|
33
|
-
super(`Component exited ${
|
|
32
|
+
constructor(code) {
|
|
33
|
+
super(`Component exited ${code === 0 ? 'successfully' : 'with error'}`);
|
|
34
34
|
this.exitError = true;
|
|
35
|
-
this.
|
|
35
|
+
this.code = code;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export const exit = {
|
|
40
40
|
exit (status) {
|
|
41
|
-
throw new ComponentExit(status.tag === 'err' ?
|
|
41
|
+
throw new ComponentExit(status.tag === 'err' ? 1 : 0);
|
|
42
|
+
},
|
|
43
|
+
exitWithCode (code) {
|
|
44
|
+
throw new ComponentExit(code);
|
|
42
45
|
}
|
|
43
46
|
};
|
|
44
47
|
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
} from "./worker-sockets.js";
|
|
32
32
|
import { Socket, Server } from "node:net";
|
|
33
33
|
|
|
34
|
-
const
|
|
34
|
+
const win = process.platform === 'win32';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @typedef {import("../../types/interfaces/wasi-sockets-network.js").IpSocketAddress} IpSocketAddress
|
|
@@ -268,7 +268,7 @@ export function socketTcpGetRemoteAddress(id) {
|
|
|
268
268
|
export function socketTcpShutdown(id, _shutdownType) {
|
|
269
269
|
const socket = tcpSockets.get(id);
|
|
270
270
|
if (socket.state !== SOCKET_STATE_CONNECTION) throw "invalid-state";
|
|
271
|
-
if (
|
|
271
|
+
if (win && socket.tcpSocket.destroySoon)
|
|
272
272
|
socket.tcpSocket.destroySoon();
|
|
273
273
|
else
|
|
274
274
|
socket.tcpSocket.destroy();
|
package/lib/io/worker-thread.js
CHANGED
|
@@ -393,8 +393,9 @@ function handle(call, id, payload) {
|
|
|
393
393
|
return;
|
|
394
394
|
}
|
|
395
395
|
case HTTP_OUTGOING_BODY_DISPOSE:
|
|
396
|
-
if (!streams.
|
|
397
|
-
|
|
396
|
+
if (debug && !streams.has(id))
|
|
397
|
+
console.warn(`wasi-io: stream ${id} not found to dispose`);
|
|
398
|
+
streams.delete(id);
|
|
398
399
|
return;
|
|
399
400
|
case HTTP_SERVER_START:
|
|
400
401
|
return startHttpServer(id, payload);
|
|
@@ -645,34 +646,86 @@ function handle(call, id, payload) {
|
|
|
645
646
|
}
|
|
646
647
|
stream.pollState.ready = false;
|
|
647
648
|
return (stream.flushPromise = new Promise((resolve, reject) => {
|
|
648
|
-
stream.stream.
|
|
649
|
+
if (stream.stream === stdout || stream.stream === stderr) {
|
|
650
|
+
// Inside workers, NodeJS actually queues writes destined for
|
|
651
|
+
// stdout/stderr in a port that is only flushed on exit of the worker.
|
|
652
|
+
//
|
|
653
|
+
// In this case, we cannot attempt to wait for the promise.
|
|
654
|
+
//
|
|
655
|
+
// This code may have to be reworked for browsers.
|
|
656
|
+
//
|
|
657
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker/io.js#L288
|
|
658
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker.js#L303
|
|
659
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/typings/internalBinding/messaging.d.ts#L27
|
|
660
|
+
stream.stream.write(payload);
|
|
649
661
|
stream.flushPromise = null;
|
|
650
662
|
pollStateReady(stream.pollState);
|
|
651
|
-
if (err) return void reject(streamError(err));
|
|
652
663
|
resolve(BigInt(payload.byteLength));
|
|
653
|
-
}
|
|
664
|
+
} else {
|
|
665
|
+
stream.stream.write(payload, (err) => {
|
|
666
|
+
stream.flushPromise = null;
|
|
667
|
+
pollStateReady(stream.pollState);
|
|
668
|
+
if (err) return void reject(streamError(err));
|
|
669
|
+
resolve(BigInt(payload.byteLength));
|
|
670
|
+
});
|
|
671
|
+
}
|
|
654
672
|
}));
|
|
655
673
|
}
|
|
656
674
|
case OUTPUT_STREAM_FLUSH: {
|
|
657
675
|
const stream = getStreamOrThrow(id);
|
|
658
676
|
if (stream.flushPromise) return;
|
|
659
677
|
stream.pollState.ready = false;
|
|
660
|
-
|
|
661
|
-
stream.stream.
|
|
678
|
+
stream.flushPromise = new Promise((resolve, reject) => {
|
|
679
|
+
if (stream.stream === stdout || stream.stream === stderr) {
|
|
680
|
+
// Inside workers, NodeJS actually queues writes destined for
|
|
681
|
+
// stdout/stderr in a port that is only flushed on exit of the worker.
|
|
682
|
+
//
|
|
683
|
+
// In this case, we cannot attempt to wait for the promise.
|
|
684
|
+
//
|
|
685
|
+
// This code may have to be reworked for browsers.
|
|
686
|
+
//
|
|
687
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker/io.js#L288
|
|
688
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker.js#L303
|
|
689
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/typings/internalBinding/messaging.d.ts#L27
|
|
662
690
|
stream.flushPromise = null;
|
|
663
691
|
pollStateReady(stream.pollState);
|
|
664
|
-
if (err) return void reject(streamError(err));
|
|
665
692
|
resolve();
|
|
666
|
-
}
|
|
667
|
-
|
|
693
|
+
} else {
|
|
694
|
+
// For all other writes, we can perform the actual write and expect the write to complete
|
|
695
|
+
// and trigger the relevant callback
|
|
696
|
+
stream.stream.write(new Uint8Array([]), (err) => {
|
|
697
|
+
stream.flushPromise = null;
|
|
698
|
+
pollStateReady(stream.pollState);
|
|
699
|
+
if (err) return void reject(streamError(err));
|
|
700
|
+
resolve();
|
|
701
|
+
});
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
return stream.flushPromise;
|
|
668
705
|
}
|
|
669
706
|
case OUTPUT_STREAM_BLOCKING_FLUSH: {
|
|
670
707
|
const stream = getStreamOrThrow(id);
|
|
671
708
|
if (stream.flushPromise) return stream.flushPromise;
|
|
672
709
|
return new Promise((resolve, reject) => {
|
|
673
|
-
stream.stream.
|
|
674
|
-
|
|
675
|
-
|
|
710
|
+
if (stream.stream === stdout || stream.stream === stderr) {
|
|
711
|
+
// Inside workers, NodeJS actually queues writes destined for
|
|
712
|
+
// stdout/stderr in a port that is only flushed on exit of the worker.
|
|
713
|
+
//
|
|
714
|
+
// In this case, we cannot attempt to wait for the promise.
|
|
715
|
+
//
|
|
716
|
+
// This code may have to be reworked for browsers.
|
|
717
|
+
//
|
|
718
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker/io.js#L288
|
|
719
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/lib/internal/worker.js#L303
|
|
720
|
+
// see: https://github.com/nodejs/node/blob/v22.12.0/typings/internalBinding/messaging.d.ts#L27
|
|
721
|
+
resolve();
|
|
722
|
+
} else {
|
|
723
|
+
// For all other writes, we can perform the actual write and expect the write to complete
|
|
724
|
+
// and trigger the relevant callback
|
|
725
|
+
stream.stream.write(new Uint8Array([]), (err) =>
|
|
726
|
+
err ? reject(streamError(err)) : resolve()
|
|
727
|
+
);
|
|
728
|
+
}
|
|
676
729
|
});
|
|
677
730
|
}
|
|
678
731
|
case OUTPUT_STREAM_WRITE_ZEROES:
|
package/lib/nodejs/cli.js
CHANGED
package/lib/nodejs/filesystem.js
CHANGED
|
@@ -368,19 +368,16 @@ class Descriptor {
|
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
370
|
try {
|
|
371
|
-
const fd = openSync(fullPath, fsOpenFlags);
|
|
371
|
+
const fd = openSync(fullPath.endsWith('/') ? fullPath.slice(0, -1) : fullPath, fsOpenFlags);
|
|
372
372
|
const descriptor = descriptorCreate(
|
|
373
373
|
fd,
|
|
374
374
|
descriptorFlags,
|
|
375
375
|
fullPath,
|
|
376
376
|
preopenEntries
|
|
377
377
|
);
|
|
378
|
-
if (fullPath.endsWith(
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
descriptor[symbolDispose]();
|
|
382
|
-
throw "not-directory";
|
|
383
|
-
}
|
|
378
|
+
if (fullPath.endsWith('/') && descriptor.getType() !== 'directory') {
|
|
379
|
+
descriptor[symbolDispose]();
|
|
380
|
+
throw "not-directory";
|
|
384
381
|
}
|
|
385
382
|
return descriptor;
|
|
386
383
|
} catch (e) {
|
|
@@ -671,6 +668,7 @@ function convertFsError(e) {
|
|
|
671
668
|
case "ENOSPC":
|
|
672
669
|
return "insufficient-space";
|
|
673
670
|
case "ENOTDIR":
|
|
671
|
+
case 'ERR_FS_EISDIR':
|
|
674
672
|
return "not-directory";
|
|
675
673
|
case "ENOTEMPTY":
|
|
676
674
|
return "not-empty";
|
package/package.json
CHANGED
package/types/cli.d.ts
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export const environment: typeof WasiCliEnvironment;
|
|
14
|
-
export const exit: typeof WasiCliExit;
|
|
15
|
-
export const run: typeof WasiCliRun;
|
|
16
|
-
export const stderr: typeof WasiCliStderr;
|
|
17
|
-
export const stdin: typeof WasiCliStdin;
|
|
18
|
-
export const stdout: typeof WasiCliStdout;
|
|
19
|
-
export const terminalInput: typeof WasiCliTerminalInput;
|
|
20
|
-
export const terminalOutput: typeof WasiCliTerminalOutput;
|
|
21
|
-
export const terminalStderr: typeof WasiCliTerminalStderr;
|
|
22
|
-
export const terminalStdin: typeof WasiCliTerminalStdin;
|
|
23
|
-
export const terminalStdout: typeof WasiCliTerminalStdout;
|
|
1
|
+
export type * as environment from './interfaces/wasi-cli-environment.d.ts';
|
|
2
|
+
export type * as exit from './interfaces/wasi-cli-exit.d.ts';
|
|
3
|
+
export type * as run from './interfaces/wasi-cli-run.d.ts';
|
|
4
|
+
export type * as stderr from './interfaces/wasi-cli-stderr.d.ts';
|
|
5
|
+
export type * as stdin from './interfaces/wasi-cli-stdin.d.ts';
|
|
6
|
+
export type * as stdout from './interfaces/wasi-cli-stdout.d.ts';
|
|
7
|
+
export type * as terminalInput from './interfaces/wasi-cli-terminal-input.d.ts';
|
|
8
|
+
export type * as terminalOutput from './interfaces/wasi-cli-terminal-output.d.ts';
|
|
9
|
+
export type * as terminalStderr from './interfaces/wasi-cli-terminal-stderr.d.ts';
|
|
10
|
+
export type * as terminalStdin from './interfaces/wasi-cli-terminal-stdin.d.ts';
|
|
11
|
+
export type * as terminalStdout from './interfaces/wasi-cli-terminal-stdout.d.ts';
|
package/types/clocks.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const wallClock: typeof WasiClocksWallClock;
|
|
5
|
-
export const monotonicClock: typeof WasiClocksMonotonicClock;
|
|
1
|
+
export type * as monotonicClock from './interfaces/wasi-clocks-monotonic-clock.d.ts';
|
|
2
|
+
export type * as wallClock from './interfaces/wasi-clocks-wall-clock.d.ts';
|
package/types/filesystem.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export const preopens: typeof WasiFilesystemPreopens;
|
|
5
|
-
export const types: typeof WasiFilesystemTypes;
|
|
1
|
+
export type * as preopens from './interfaces/wasi-filesystem-preopens.d.ts';
|
|
2
|
+
export type * as types from './interfaces/wasi-filesystem-types.d.ts';
|
package/types/http.d.ts
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export const incomingHandler: typeof WasiHttpIncomingHandler;
|
|
6
|
-
export const outgoingHandler: typeof WasiHttpOutgoingHandler;
|
|
7
|
-
export const types: typeof WasiHttpTypes;
|
|
1
|
+
export type * as incomingHandler from './interfaces/wasi-http-incoming-handler.d.ts';
|
|
2
|
+
export type * as outgoingHandler from './interfaces/wasi-http-outgoing-handler.d.ts';
|
|
3
|
+
export type * as types from './interfaces/wasi-http-types.d.ts';
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const cli: typeof WasiCli;
|
|
10
|
-
export const clocks: typeof WasiClocks;
|
|
11
|
-
export const filesystem: typeof WasiFilesystem;
|
|
12
|
-
export const http: typeof WasiHttp;
|
|
13
|
-
export const io: typeof WasiIo;
|
|
14
|
-
export const random: typeof WasiRandom;
|
|
15
|
-
export const sockets: typeof WasiSockets;
|
|
1
|
+
export type * as cli from "./cli.d.ts";
|
|
2
|
+
export type * as clocks from './clocks.d.ts';
|
|
3
|
+
export type * as filesystem from './filesystem.d.ts';
|
|
4
|
+
export type * as http from "./http.d.ts";
|
|
5
|
+
export type * as io from "./io.d.ts";
|
|
6
|
+
export type * as random from "./random.d.ts";
|
|
7
|
+
export type * as sockets from "./sockets.d.ts";
|
|
@@ -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:cli/environment@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Get the POSIX-style environment variables.
|
|
4
|
+
*
|
|
5
|
+
* Each environment variable is provided as a pair of string variable names
|
|
6
|
+
* and string value.
|
|
7
|
+
*
|
|
8
|
+
* Morally, these are a value import, but until value imports are available
|
|
9
|
+
* in the component model, this import function should return the same
|
|
10
|
+
* values each time it is called.
|
|
11
|
+
*/
|
|
12
|
+
export function getEnvironment(): Array<[string, string]>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the POSIX-style arguments to the program.
|
|
15
|
+
*/
|
|
16
|
+
export function getArguments(): Array<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Return a path that programs should use as their initial current working
|
|
19
|
+
* directory, interpreting `.` as shorthand for this.
|
|
20
|
+
*/
|
|
21
|
+
export function initialCwd(): string | undefined;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
/** @module Interface wasi:cli/exit@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Exit the current instance and any linked instances.
|
|
4
|
+
*/
|
|
5
|
+
export function exit(status: Result<void, void>): void;
|
|
7
6
|
export type Result<T, E> = { tag: 'ok', val: T } | { tag: 'err', val: E };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
/** @module Interface wasi:cli/run@0.2.3 **/
|
|
2
|
+
/**
|
|
3
|
+
* Run the program.
|
|
4
|
+
*/
|
|
5
|
+
export function run(): void;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { OutputStream } from './wasi-io-streams.js';
|
|
5
|
-
export { OutputStream };
|
|
1
|
+
/** @module Interface wasi:cli/stderr@0.2.3 **/
|
|
2
|
+
export function getStderr(): OutputStream;
|
|
3
|
+
export type OutputStream = import('./wasi-io-streams.js').OutputStream;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { InputStream } from './wasi-io-streams.js';
|
|
5
|
-
export { InputStream };
|
|
1
|
+
/** @module Interface wasi:cli/stdin@0.2.3 **/
|
|
2
|
+
export function getStdin(): InputStream;
|
|
3
|
+
export type InputStream = import('./wasi-io-streams.js').InputStream;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import type { OutputStream } from './wasi-io-streams.js';
|
|
5
|
-
export { OutputStream };
|
|
1
|
+
/** @module Interface wasi:cli/stdout@0.2.3 **/
|
|
2
|
+
export function getStdout(): OutputStream;
|
|
3
|
+
export type OutputStream = import('./wasi-io-streams.js').OutputStream;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { TerminalOutput } from './wasi-cli-terminal-output.js';
|
|
9
|
-
export { TerminalOutput };
|
|
1
|
+
/** @module Interface wasi:cli/terminal-stderr@0.2.3 **/
|
|
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 | undefined;
|
|
7
|
+
export type TerminalOutput = import('./wasi-cli-terminal-output.js').TerminalOutput;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { TerminalInput } from './wasi-cli-terminal-input.js';
|
|
9
|
-
export { TerminalInput };
|
|
1
|
+
/** @module Interface wasi:cli/terminal-stdin@0.2.3 **/
|
|
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;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import type { TerminalOutput } from './wasi-cli-terminal-output.js';
|
|
9
|
-
export { TerminalOutput };
|
|
1
|
+
/** @module Interface wasi:cli/terminal-stdout@0.2.3 **/
|
|
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;
|
|
@@ -1,29 +1,27 @@
|
|
|
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
|
-
import type { Pollable } from './wasi-io-poll.js';
|
|
26
|
-
export { Pollable };
|
|
1
|
+
/** @module Interface wasi:clocks/monotonic-clock@0.2.3 **/
|
|
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. Returns the duration of time
|
|
11
|
+
* corresponding to a clock tick.
|
|
12
|
+
*/
|
|
13
|
+
export function resolution(): Duration;
|
|
14
|
+
/**
|
|
15
|
+
* Create a `pollable` which will resolve once the specified instant
|
|
16
|
+
* has occurred.
|
|
17
|
+
*/
|
|
18
|
+
export function subscribeInstant(when: Instant): Pollable;
|
|
19
|
+
/**
|
|
20
|
+
* Create a `pollable` that will resolve after the specified duration has
|
|
21
|
+
* elapsed from the time this function is invoked.
|
|
22
|
+
*/
|
|
23
|
+
export function subscribeDuration(when: Duration): Pollable;
|
|
24
|
+
export type Pollable = import('./wasi-io-poll.js').Pollable;
|
|
27
25
|
/**
|
|
28
26
|
* An instant in time, in nanoseconds. An instant is relative to an
|
|
29
27
|
* unspecified initial value, and can only be compared to instances from
|
|
@@ -1,27 +1,26 @@
|
|
|
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:clocks/wall-clock@0.2.3 **/
|
|
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 returned timestamps represent the number of seconds since
|
|
9
|
+
* 1970-01-01T00:00:00Z, also known as [POSIX's Seconds Since the Epoch],
|
|
10
|
+
* also known as [Unix Time].
|
|
11
|
+
*
|
|
12
|
+
* The nanoseconds field of the output is always less than 1000000000.
|
|
13
|
+
*
|
|
14
|
+
* [POSIX's Seconds Since the Epoch]: https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_xbd_chap04.html#tag_21_04_16
|
|
15
|
+
* [Unix Time]: https://en.wikipedia.org/wiki/Unix_time
|
|
16
|
+
*/
|
|
17
|
+
export function now(): Datetime;
|
|
18
|
+
/**
|
|
19
|
+
* Query the resolution of the clock.
|
|
20
|
+
*
|
|
21
|
+
* The nanoseconds field of the output is always less than 1000000000.
|
|
22
|
+
*/
|
|
23
|
+
export function resolution(): Datetime;
|
|
25
24
|
/**
|
|
26
25
|
* A time and date in seconds plus nanoseconds.
|
|
27
26
|
*/
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type { Descriptor } from './wasi-filesystem-types.js';
|
|
8
|
-
export { Descriptor };
|
|
1
|
+
/** @module Interface wasi:filesystem/preopens@0.2.3 **/
|
|
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;
|