@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.
- package/lib/browser/http.js +1 -1
- package/lib/browser/io.js +14 -3
- package/lib/http/error.js +1 -1
- package/lib/http/make-request.js +2 -2
- package/lib/http/wasi-http.js +62 -39
- package/lib/nodejs/io.js +16 -5
- package/package.json +1 -1
- package/types/{exports → interfaces}/wasi-cli-environment.d.ts +1 -1
- package/types/{imports → interfaces}/wasi-cli-stderr.d.ts +1 -1
- package/types/{exports → interfaces}/wasi-cli-stdin.d.ts +1 -1
- package/types/{imports → interfaces}/wasi-cli-stdout.d.ts +1 -1
- package/types/{imports → interfaces}/wasi-cli-terminal-stderr.d.ts +2 -2
- package/types/{imports → interfaces}/wasi-cli-terminal-stdin.d.ts +2 -2
- package/types/{imports → interfaces}/wasi-cli-terminal-stdout.d.ts +2 -2
- package/types/{imports → interfaces}/wasi-clocks-monotonic-clock.d.ts +1 -1
- package/types/{exports → interfaces}/wasi-clocks-timezone.d.ts +1 -1
- package/types/{exports → interfaces}/wasi-filesystem-preopens.d.ts +1 -1
- package/types/{imports → interfaces}/wasi-filesystem-types.d.ts +5 -5
- package/types/interfaces/wasi-io-streams.d.ts +274 -0
- package/types/{imports → interfaces}/wasi-sockets-instance-network.d.ts +1 -1
- package/types/{exports → interfaces}/wasi-sockets-ip-name-lookup.d.ts +7 -7
- package/types/{imports → interfaces}/wasi-sockets-tcp-create-socket.d.ts +4 -4
- package/types/{imports → interfaces}/wasi-sockets-tcp.d.ts +20 -7
- package/types/{exports → interfaces}/wasi-sockets-udp-create-socket.d.ts +4 -4
- package/types/{exports → interfaces}/wasi-sockets-udp.d.ts +5 -5
- package/types/wasi-cli-command.d.ts +28 -28
- package/types/exports/wasi-cli-stderr.d.ts +0 -5
- package/types/exports/wasi-cli-stdout.d.ts +0 -5
- package/types/exports/wasi-cli-terminal-stderr.d.ts +0 -9
- package/types/exports/wasi-cli-terminal-stdin.d.ts +0 -9
- package/types/exports/wasi-cli-terminal-stdout.d.ts +0 -9
- package/types/exports/wasi-clocks-monotonic-clock.d.ts +0 -24
- package/types/exports/wasi-filesystem-types.d.ts +0 -843
- package/types/exports/wasi-http-incoming-handler.d.ts +0 -7
- package/types/exports/wasi-http-outgoing-handler.d.ts +0 -9
- package/types/exports/wasi-http-types.d.ts +0 -118
- package/types/exports/wasi-io-streams.d.ts +0 -220
- package/types/exports/wasi-sockets-instance-network.d.ts +0 -8
- package/types/exports/wasi-sockets-tcp-create-socket.d.ts +0 -33
- package/types/exports/wasi-sockets-tcp.d.ts +0 -285
- package/types/imports/wasi-cli-environment.d.ts +0 -22
- package/types/imports/wasi-cli-exit.d.ts +0 -7
- package/types/imports/wasi-cli-stdin.d.ts +0 -5
- package/types/imports/wasi-cli-terminal-input.d.ts +0 -13
- package/types/imports/wasi-cli-terminal-output.d.ts +0 -13
- package/types/imports/wasi-clocks-timezone.d.ts +0 -71
- package/types/imports/wasi-clocks-wall-clock.d.ts +0 -31
- package/types/imports/wasi-filesystem-preopens.d.ts +0 -8
- package/types/imports/wasi-http-outgoing-handler.d.ts +0 -9
- package/types/imports/wasi-http-types.d.ts +0 -118
- package/types/imports/wasi-io-streams.d.ts +0 -220
- package/types/imports/wasi-poll-poll.d.ts +0 -39
- package/types/imports/wasi-random-insecure-seed.d.ts +0 -22
- package/types/imports/wasi-random-insecure.d.ts +0 -20
- package/types/imports/wasi-random-random.d.ts +0 -22
- package/types/imports/wasi-sockets-ip-name-lookup.d.ts +0 -76
- package/types/imports/wasi-sockets-network.d.ts +0 -180
- package/types/imports/wasi-sockets-udp-create-socket.d.ts +0 -33
- package/types/imports/wasi-sockets-udp.d.ts +0 -228
- package/types/wasi-http-proxy.d.ts +0 -13
- /package/types/{exports → interfaces}/wasi-cli-exit.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-cli-run.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-cli-terminal-input.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-cli-terminal-output.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-clocks-wall-clock.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-poll-poll.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-random-insecure-seed.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-random-insecure.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-random-random.d.ts +0 -0
- /package/types/{exports → interfaces}/wasi-sockets-network.d.ts +0 -0
package/lib/browser/http.js
CHANGED
package/lib/browser/io.js
CHANGED
|
@@ -89,11 +89,22 @@ export const streams = {
|
|
|
89
89
|
dropInputStream(s) {
|
|
90
90
|
console.log(`[streams] Drop input stream ${s}`);
|
|
91
91
|
},
|
|
92
|
+
checkWrite(_s) {
|
|
93
|
+
// TODO: implement
|
|
94
|
+
return 1000000n;
|
|
95
|
+
},
|
|
92
96
|
write(s, buf) {
|
|
93
|
-
|
|
97
|
+
getStream(s).write(buf);
|
|
98
|
+
},
|
|
99
|
+
blockingWriteAndFlush(s, buf) {
|
|
100
|
+
// TODO: implement
|
|
101
|
+
return streams.write(s, buf);
|
|
102
|
+
},
|
|
103
|
+
flush(s) {
|
|
104
|
+
return streams.blockingFlush(s);
|
|
94
105
|
},
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
blockingFlush(_s) {
|
|
107
|
+
// TODO: implement
|
|
97
108
|
},
|
|
98
109
|
writeZeroes(s, _len) {
|
|
99
110
|
console.log(`[streams] Write zeroes ${s}`);
|
package/lib/http/error.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export class UnexpectedError extends Error {
|
|
2
|
-
/** @type { import("../../types/
|
|
2
|
+
/** @type { import("../../types/interfaces/wasi-http-types").ErrorUnexpectedError } */
|
|
3
3
|
payload;
|
|
4
4
|
constructor(message = "unexpected-error") {
|
|
5
5
|
super(message);
|
package/lib/http/make-request.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { runAsWorker } from "./synckit/index.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @param {import("../../types/
|
|
4
|
+
* @param {import("../../types/interfaces/wasi-http-types").Request} req
|
|
5
5
|
* @returns {Promise<string>}
|
|
6
6
|
*/
|
|
7
7
|
async function makeRequest(req) {
|
|
@@ -16,7 +16,7 @@ async function makeRequest(req) {
|
|
|
16
16
|
let arrayBuffer = await resp.arrayBuffer();
|
|
17
17
|
return JSON.stringify({
|
|
18
18
|
status: resp.status,
|
|
19
|
-
headers: Array.from(resp.headers
|
|
19
|
+
headers: Array.from(resp.headers),
|
|
20
20
|
body:
|
|
21
21
|
arrayBuffer.byteLength > 0
|
|
22
22
|
? Buffer.from(arrayBuffer).toString("base64")
|
package/lib/http/wasi-http.js
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
// https://github.com/bytecodealliance/wasmtime/blob/8efcb9851602287fd07a1a1e91501f51f2653d7e/crates/wasi-http/
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @typedef {import("../../types/
|
|
6
|
-
* @typedef {import("../../types/
|
|
7
|
-
* @typedef {import("../../types/
|
|
8
|
-
* @typedef {import("../../types/
|
|
9
|
-
* @typedef {import("../../types/
|
|
10
|
-
* @typedef {import("../../types/
|
|
11
|
-
* @typedef {import("../../types/
|
|
12
|
-
* @typedef {import("../../types/
|
|
13
|
-
* @typedef {import("../../types/
|
|
14
|
-
* @typedef {import("../../types/
|
|
15
|
-
* @typedef {import("../../types/
|
|
16
|
-
* @typedef {import("../../types/
|
|
5
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").Fields} Fields
|
|
6
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").FutureIncomingResponse} FutureIncomingResponse
|
|
7
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").Headers} Headers
|
|
8
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").IncomingResponse} IncomingResponse
|
|
9
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").IncomingStream} IncomingStream
|
|
10
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").Method} Method
|
|
11
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").OutgoingRequest} OutgoingRequest
|
|
12
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").RequestOptions} RequestOptions
|
|
13
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").Result} Result
|
|
14
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").Scheme} Scheme
|
|
15
|
+
* @typedef {import("../../types/interfaces/wasi-http-types").StatusCode} StatusCode
|
|
16
|
+
* @typedef {import("../../types/interfaces/wasi-io-streams").StreamStatus} StreamStatus
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import * as io from '@bytecodealliance/preview2-shim/io';
|
|
@@ -28,7 +28,7 @@ export class WasiHttp {
|
|
|
28
28
|
futureIdBase = 1;
|
|
29
29
|
/** @type {Map<number,ActiveRequest>} */ requests = new Map();
|
|
30
30
|
/** @type {Map<number,ActiveResponse>} */ responses = new Map();
|
|
31
|
-
/** @type {Map<number,
|
|
31
|
+
/** @type {Map<number,ActiveFields>} */ fields = new Map();
|
|
32
32
|
/** @type {Map<number,Uint8Array>} */ streams = new Map();
|
|
33
33
|
/** @type {Map<number,ActiveFuture>} */ futures = new Map();
|
|
34
34
|
|
|
@@ -53,9 +53,11 @@ export class WasiHttp {
|
|
|
53
53
|
const headers = {
|
|
54
54
|
"host": request.authority,
|
|
55
55
|
};
|
|
56
|
-
if (request.headers
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
if (request.headers) {
|
|
57
|
+
const requestHeaders = this.fields.get(request.headers);
|
|
58
|
+
const decoder = new TextDecoder();
|
|
59
|
+
for (const [key, value] of requestHeaders.fields.entries()) {
|
|
60
|
+
headers[key] = decoder.decode(value);
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
const body = this.streams.get(request.body);
|
|
@@ -69,10 +71,8 @@ export class WasiHttp {
|
|
|
69
71
|
});
|
|
70
72
|
|
|
71
73
|
response.status = res.status;
|
|
72
|
-
if (res.headers && res.headers.
|
|
73
|
-
|
|
74
|
-
response.responseHeaders.set(key, [value]);
|
|
75
|
-
}
|
|
74
|
+
if (res.headers && res.headers.length > 0) {
|
|
75
|
+
response.headers = this.newFields(res.headers);
|
|
76
76
|
}
|
|
77
77
|
const buf = res.body;
|
|
78
78
|
response.body = this.streamIdBase;
|
|
@@ -131,21 +131,38 @@ export class WasiHttp {
|
|
|
131
131
|
s.set([]);
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
checkWrite = (stream) => {
|
|
135
|
+
// TODO: implement
|
|
136
|
+
return io.streams.checkWrite(stream);
|
|
136
137
|
}
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
140
|
* @param {OutputStream} stream
|
|
140
141
|
* @param {Uint8Array} buf
|
|
141
|
-
* @returns {[bigint, StreamStatus]}
|
|
142
142
|
*/
|
|
143
|
-
|
|
143
|
+
write = (stream, buf) => {
|
|
144
144
|
if (stream < 3) {
|
|
145
|
-
return io.streams.
|
|
145
|
+
return io.streams.write(stream, buf);
|
|
146
146
|
}
|
|
147
147
|
this.streams.set(stream, buf);
|
|
148
|
-
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
blockingWriteAndFlush = (stream, buf) => {
|
|
151
|
+
if (stream < 3) {
|
|
152
|
+
return io.streams.blockingWriteAndFlush(stream, buf);
|
|
153
|
+
}
|
|
154
|
+
// TODO: implement
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
flush = (stream) => {
|
|
158
|
+
return this.blockingFlush(stream);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
blockingFlush = (stream) => {
|
|
162
|
+
if (stream < 3) {
|
|
163
|
+
return io.streams.blockingFlush(stream);
|
|
164
|
+
}
|
|
165
|
+
// TODO: implement
|
|
149
166
|
}
|
|
150
167
|
|
|
151
168
|
/**
|
|
@@ -178,21 +195,20 @@ export class WasiHttp {
|
|
|
178
195
|
* @returns {Fields}
|
|
179
196
|
*/
|
|
180
197
|
newFields = (entries) => {
|
|
181
|
-
const map = new Map(entries);
|
|
182
|
-
|
|
183
198
|
const id = this.fieldsIdBase;
|
|
184
199
|
this.fieldsIdBase += 1;
|
|
185
|
-
this.fields.set(id,
|
|
200
|
+
this.fields.set(id, new ActiveFields(id, entries));
|
|
186
201
|
|
|
187
202
|
return id;
|
|
188
203
|
}
|
|
189
204
|
|
|
190
205
|
/**
|
|
191
206
|
* @param {Fields} fields
|
|
192
|
-
* @returns {[string,
|
|
207
|
+
* @returns {[string, Uint8Array][]}
|
|
193
208
|
*/
|
|
194
209
|
fieldsEntries = (fields) => {
|
|
195
|
-
|
|
210
|
+
const activeFields = this.fields.get(fields);
|
|
211
|
+
return activeFields ? Array.from(activeFields.fields) : [];
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
/**
|
|
@@ -218,7 +234,7 @@ export class WasiHttp {
|
|
|
218
234
|
req.pathWithQuery = pathWithQuery;
|
|
219
235
|
req.authority = authority;
|
|
220
236
|
req.method = method;
|
|
221
|
-
req.headers =
|
|
237
|
+
req.headers = headers;
|
|
222
238
|
req.scheme = scheme;
|
|
223
239
|
this.requests.set(id, req);
|
|
224
240
|
return id;
|
|
@@ -257,11 +273,7 @@ export class WasiHttp {
|
|
|
257
273
|
*/
|
|
258
274
|
incomingResponseHeaders = (response) => {
|
|
259
275
|
const r = this.responses.get(response);
|
|
260
|
-
|
|
261
|
-
this.fieldsIdBase += 1;
|
|
262
|
-
|
|
263
|
-
this.fields.set(id, r.responseHeaders);
|
|
264
|
-
return id;
|
|
276
|
+
return r.headers ?? 0;
|
|
265
277
|
}
|
|
266
278
|
|
|
267
279
|
/**
|
|
@@ -316,7 +328,7 @@ class ActiveRequest {
|
|
|
316
328
|
/** @type {Scheme | null} */ scheme = { tag: 'HTTP' };
|
|
317
329
|
pathWithQuery = null;
|
|
318
330
|
authority = null;
|
|
319
|
-
/** @type {
|
|
331
|
+
/** @type {number | null} */ headers = null;
|
|
320
332
|
body = 3;
|
|
321
333
|
|
|
322
334
|
constructor(id) {
|
|
@@ -329,7 +341,7 @@ class ActiveResponse {
|
|
|
329
341
|
activeResponse = false;
|
|
330
342
|
status = 0;
|
|
331
343
|
body = 3;
|
|
332
|
-
/** @type {
|
|
344
|
+
/** @type {number | null} */ headers = null;
|
|
333
345
|
|
|
334
346
|
constructor(id) {
|
|
335
347
|
this.id = id;
|
|
@@ -345,3 +357,14 @@ class ActiveFuture {
|
|
|
345
357
|
this.responseId = responseId;
|
|
346
358
|
}
|
|
347
359
|
}
|
|
360
|
+
|
|
361
|
+
class ActiveFields {
|
|
362
|
+
/** @type {number} */ id;
|
|
363
|
+
/** @type {Map<string, Uint8Array[]>} */ fields;
|
|
364
|
+
|
|
365
|
+
constructor(id, fields) {
|
|
366
|
+
this.id = id;
|
|
367
|
+
const encoder = new TextEncoder();
|
|
368
|
+
this.fields = new Map(fields.map(([k, v]) => [k, encoder.encode(v)]));
|
|
369
|
+
}
|
|
370
|
+
}
|
package/lib/nodejs/io.js
CHANGED
|
@@ -106,25 +106,36 @@ export const streams = {
|
|
|
106
106
|
dropInputStream(s) {
|
|
107
107
|
delete _streams[s];
|
|
108
108
|
},
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
checkWrite(_s) {
|
|
110
|
+
// TODO: implement
|
|
111
|
+
return 1000000n;
|
|
111
112
|
},
|
|
112
|
-
|
|
113
|
+
write(s, buf) {
|
|
113
114
|
switch (s) {
|
|
114
115
|
case 0:
|
|
115
116
|
throw new Error(`TODO: write stdin`);
|
|
116
117
|
case 1: {
|
|
117
118
|
process.stdout.write(buf);
|
|
118
|
-
|
|
119
|
+
break;
|
|
119
120
|
}
|
|
120
121
|
case 2: {
|
|
121
122
|
process.stderr.write(buf);
|
|
122
|
-
|
|
123
|
+
break;
|
|
123
124
|
}
|
|
124
125
|
default:
|
|
125
126
|
throw new Error(`TODO: write ${s}`);
|
|
126
127
|
}
|
|
127
128
|
},
|
|
129
|
+
blockingWriteAndFlush(s, buf) {
|
|
130
|
+
// TODO: implement
|
|
131
|
+
return streams.write(s, buf);
|
|
132
|
+
},
|
|
133
|
+
flush(s) {
|
|
134
|
+
return streams.blockingFlush(s);
|
|
135
|
+
},
|
|
136
|
+
blockingFlush(_s) {
|
|
137
|
+
// TODO: implement
|
|
138
|
+
},
|
|
128
139
|
writeZeroes(s, _len) {
|
|
129
140
|
console.log(`[streams] Write zeroes ${s}`);
|
|
130
141
|
},
|
package/package.json
CHANGED
|
@@ -18,5 +18,5 @@ export namespace WasiCliEnvironment {
|
|
|
18
18
|
* Return a path that programs should use as their initial current working
|
|
19
19
|
* directory, interpreting `.` as shorthand for this.
|
|
20
20
|
*/
|
|
21
|
-
export function initialCwd(): string |
|
|
21
|
+
export function initialCwd(): string | undefined;
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@ export namespace WasiCliTerminalStderr {
|
|
|
3
3
|
* If stderr is connected to a terminal, return a `terminal-output` handle
|
|
4
4
|
* allowing further interaction with it.
|
|
5
5
|
*/
|
|
6
|
-
export function getTerminalStderr(): TerminalOutput |
|
|
6
|
+
export function getTerminalStderr(): TerminalOutput | undefined;
|
|
7
7
|
}
|
|
8
|
-
import type { TerminalOutput } from '../
|
|
8
|
+
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
|
|
9
9
|
export { TerminalOutput };
|
|
@@ -3,7 +3,7 @@ export namespace WasiCliTerminalStdin {
|
|
|
3
3
|
* If stdin is connected to a terminal, return a `terminal-input` handle
|
|
4
4
|
* allowing further interaction with it.
|
|
5
5
|
*/
|
|
6
|
-
export function getTerminalStdin(): TerminalInput |
|
|
6
|
+
export function getTerminalStdin(): TerminalInput | undefined;
|
|
7
7
|
}
|
|
8
|
-
import type { TerminalInput } from '../
|
|
8
|
+
import type { TerminalInput } from '../interfaces/wasi-cli-terminal-input';
|
|
9
9
|
export { TerminalInput };
|
|
@@ -3,7 +3,7 @@ export namespace WasiCliTerminalStdout {
|
|
|
3
3
|
* If stdout is connected to a terminal, return a `terminal-output` handle
|
|
4
4
|
* allowing further interaction with it.
|
|
5
5
|
*/
|
|
6
|
-
export function getTerminalStdout(): TerminalOutput |
|
|
6
|
+
export function getTerminalStdout(): TerminalOutput | undefined;
|
|
7
7
|
}
|
|
8
|
-
import type { TerminalOutput } from '../
|
|
8
|
+
import type { TerminalOutput } from '../interfaces/wasi-cli-terminal-output';
|
|
9
9
|
export { TerminalOutput };
|
|
@@ -16,7 +16,7 @@ export namespace WasiClocksMonotonicClock {
|
|
|
16
16
|
*/
|
|
17
17
|
export function subscribe(when: Instant, absolute: boolean): Pollable;
|
|
18
18
|
}
|
|
19
|
-
import type { Pollable } from '../
|
|
19
|
+
import type { Pollable } from '../interfaces/wasi-poll-poll';
|
|
20
20
|
export { Pollable };
|
|
21
21
|
/**
|
|
22
22
|
* A timestamp in nanoseconds.
|
|
@@ -19,7 +19,7 @@ export namespace WasiClocksTimezone {
|
|
|
19
19
|
*/
|
|
20
20
|
export function dropTimezone(this_: Timezone): void;
|
|
21
21
|
}
|
|
22
|
-
import type { Datetime } from '../
|
|
22
|
+
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
|
|
23
23
|
export { Datetime };
|
|
24
24
|
/**
|
|
25
25
|
* A timezone.
|
|
@@ -4,5 +4,5 @@ export namespace WasiFilesystemPreopens {
|
|
|
4
4
|
*/
|
|
5
5
|
export function getDirectories(): [Descriptor, string][];
|
|
6
6
|
}
|
|
7
|
-
import type { Descriptor } from '../
|
|
7
|
+
import type { Descriptor } from '../interfaces/wasi-filesystem-types';
|
|
8
8
|
export { Descriptor };
|
|
@@ -93,7 +93,7 @@ export namespace WasiFilesystemTypes {
|
|
|
93
93
|
*
|
|
94
94
|
* Note: This is similar to `pread` in POSIX.
|
|
95
95
|
*/
|
|
96
|
-
export function read(this_: Descriptor, length: Filesize, offset: Filesize): [Uint8Array
|
|
96
|
+
export function read(this_: Descriptor, length: Filesize, offset: Filesize): [Uint8Array, boolean];
|
|
97
97
|
/**
|
|
98
98
|
* Write to a descriptor, without using and updating the descriptor's offset.
|
|
99
99
|
*
|
|
@@ -377,7 +377,7 @@ export namespace WasiFilesystemTypes {
|
|
|
377
377
|
/**
|
|
378
378
|
* Read a single directory entry from a `directory-entry-stream`.
|
|
379
379
|
*/
|
|
380
|
-
export function readDirectoryEntry(this_: DirectoryEntryStream): DirectoryEntry |
|
|
380
|
+
export function readDirectoryEntry(this_: DirectoryEntryStream): DirectoryEntry | undefined;
|
|
381
381
|
/**
|
|
382
382
|
* Dispose of the specified `directory-entry-stream`, after which it may no longer
|
|
383
383
|
* be used.
|
|
@@ -422,11 +422,11 @@ export namespace WasiFilesystemTypes {
|
|
|
422
422
|
*/
|
|
423
423
|
export function metadataHashAt(this_: Descriptor, pathFlags: PathFlags, path: string): MetadataHashValue;
|
|
424
424
|
}
|
|
425
|
-
import type { InputStream } from '../
|
|
425
|
+
import type { InputStream } from '../interfaces/wasi-io-streams';
|
|
426
426
|
export { InputStream };
|
|
427
|
-
import type { OutputStream } from '../
|
|
427
|
+
import type { OutputStream } from '../interfaces/wasi-io-streams';
|
|
428
428
|
export { OutputStream };
|
|
429
|
-
import type { Datetime } from '../
|
|
429
|
+
import type { Datetime } from '../interfaces/wasi-clocks-wall-clock';
|
|
430
430
|
export { Datetime };
|
|
431
431
|
/**
|
|
432
432
|
* File size or length of a region within a file.
|