@bytecodealliance/preview2-shim 0.16.7 → 0.17.1

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.
@@ -4,7 +4,7 @@ const { InputStream, OutputStream } = streams;
4
4
 
5
5
  const symbolDispose = Symbol.dispose ?? Symbol.for('dispose');
6
6
 
7
- let _env = [], _args = [], _cwd = null;
7
+ let _env = [], _args = [], _cwd = "/";
8
8
  export function _setEnv (envObj) {
9
9
  _env = Object.entries(envObj);
10
10
  }
@@ -29,16 +29,19 @@ export const environment = {
29
29
  };
30
30
 
31
31
  class ComponentExit extends Error {
32
- constructor(ok) {
33
- super(`Component exited ${ok ? 'successfully' : 'with error'}`);
32
+ constructor(code) {
33
+ super(`Component exited ${code === 0 ? 'successfully' : 'with error'}`);
34
34
  this.exitError = true;
35
- this.ok = ok;
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' ? true : false);
41
+ throw new ComponentExit(status.tag === 'err' ? 1 : 0);
42
+ },
43
+ exitWithCode (code) {
44
+ throw new ComponentExit(code);
42
45
  }
43
46
  };
44
47
 
@@ -75,6 +78,10 @@ const stdinStream = new InputStream({
75
78
  let textDecoder = new TextDecoder();
76
79
  const stdoutStream = new OutputStream({
77
80
  write (contents) {
81
+ if (contents[contents.length - 1] == 10) {
82
+ // console.log already appends a new line
83
+ contents = contents.subarray(0, contents.length - 1);
84
+ }
78
85
  console.log(textDecoder.decode(contents));
79
86
  },
80
87
  blockingFlush () {
@@ -84,10 +91,13 @@ const stdoutStream = new OutputStream({
84
91
  });
85
92
  const stderrStream = new OutputStream({
86
93
  write (contents) {
94
+ if (contents[contents.length - 1] == 10) {
95
+ // console.error already appends a new line
96
+ contents = contents.subarray(0, contents.length - 1);
97
+ }
87
98
  console.error(textDecoder.decode(contents));
88
99
  },
89
100
  blockingFlush () {
90
-
91
101
  },
92
102
  [symbolDispose] () {
93
103
 
@@ -3,7 +3,7 @@ import { environment } from './cli.js';
3
3
 
4
4
  const { InputStream, OutputStream } = streams;
5
5
 
6
- let _cwd = null;
6
+ let _cwd = "/";
7
7
 
8
8
  export function _setCwd (cwd) {
9
9
  _cwd = cwd;
@@ -31,7 +31,7 @@ import {
31
31
  } from "./worker-sockets.js";
32
32
  import { Socket, Server } from "node:net";
33
33
 
34
- const winOrMac = process.platform === 'win32' || process.platform === 'darwin';
34
+ const win = process.platform === 'win32';
35
35
 
36
36
  /**
37
37
  * @typedef {import("../../types/interfaces/wasi-sockets-network.js").IpSocketAddress} IpSocketAddress
@@ -265,16 +265,13 @@ export function socketTcpGetRemoteAddress(id) {
265
265
  return ipSocketAddress(out.family.toLowerCase(), out.address, out.port);
266
266
  }
267
267
 
268
- export function socketTcpShutdown(id, shutdownType) {
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
- // Node.js only supports a write shutdown, which is triggered on end
272
- if (shutdownType === "send" || shutdownType === "both") {
273
- if (winOrMac && socket.tcpSocket.destroySoon)
274
- socket.tcpSocket.destroySoon();
275
- else
276
- socket.tcpSocket.destroy();
277
- }
271
+ if (win && socket.tcpSocket.destroySoon)
272
+ socket.tcpSocket.destroySoon();
273
+ else
274
+ socket.tcpSocket.destroy();
278
275
  }
279
276
 
280
277
  export function socketTcpSetKeepAlive(id, { keepAlive, keepAliveIdleTime }) {
@@ -393,8 +393,9 @@ function handle(call, id, payload) {
393
393
  return;
394
394
  }
395
395
  case HTTP_OUTGOING_BODY_DISPOSE:
396
- if (!streams.delete(id))
397
- throw new Error("wasi-io trap: stream not found to dispose");
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);
package/lib/nodejs/cli.js CHANGED
@@ -47,6 +47,9 @@ export const exit = {
47
47
  exit(status) {
48
48
  process.exit(status.tag === "err" ? 1 : 0);
49
49
  },
50
+ exitWithCode(code) {
51
+ process.exit(code);
52
+ }
50
53
  };
51
54
 
52
55
  // Stdin is created as a FILE descriptor
@@ -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("/") && isWindows) {
379
- // check if its a directory
380
- if (descriptor.getType() !== "directory") {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/preview2-shim",
3
- "version": "0.16.7",
3
+ "version": "0.17.1",
4
4
  "description": "WASI Preview2 shim for JS environments",
5
5
  "author": "Guy Bedford, Eduardo Rodrigues<16357187+eduardomourar@users.noreply.github.com>",
6
6
  "type": "module",
@@ -13,13 +13,12 @@ export namespace WasiClocksMonotonicClock {
13
13
  export function resolution(): Duration;
14
14
  /**
15
15
  * Create a `pollable` which will resolve once the specified instant
16
- * occured.
16
+ * has occurred.
17
17
  */
18
18
  export function subscribeInstant(when: Instant): Pollable;
19
19
  /**
20
- * Create a `pollable` which will resolve once the given duration has
21
- * elapsed, starting at the time at which this function was called.
22
- * occured.
20
+ * Create a `pollable` that will resolve after the specified duration has
21
+ * elapsed from the time this function is invoked.
23
22
  */
24
23
  export function subscribeDuration(when: Duration): Pollable;
25
24
  }
@@ -95,7 +95,7 @@ export interface DescriptorFlags {
95
95
  */
96
96
  dataIntegritySync?: boolean,
97
97
  /**
98
- * Requests that reads be performed at the same level of integrety
98
+ * Requests that reads be performed at the same level of integrity
99
99
  * requested for writes. This is similar to `O_RSYNC` in POSIX.
100
100
  *
101
101
  * The precise semantics of this operation have not yet been defined for
@@ -569,12 +569,6 @@ export class Descriptor {
569
569
  /**
570
570
  * Open a file or directory.
571
571
  *
572
- * The returned descriptor is not guaranteed to be the lowest-numbered
573
- * descriptor not currently open/ it is randomized to prevent applications
574
- * from depending on making assumptions about indexes, since this is
575
- * error-prone in multi-threaded contexts. The returned descriptor is
576
- * guaranteed to be less than 2**31.
577
- *
578
572
  * If `flags` contains `descriptor-flags::mutate-directory`, and the base
579
573
  * descriptor doesn't have `descriptor-flags::mutate-directory` set,
580
574
  * `open-at` fails with `error-code::read-only`.
@@ -255,7 +255,7 @@ export interface ErrorCodeInternalError {
255
255
  */
256
256
  export type HeaderError = HeaderErrorInvalidSyntax | HeaderErrorForbidden | HeaderErrorImmutable;
257
257
  /**
258
- * This error indicates that a `field-key` or `field-value` was
258
+ * This error indicates that a `field-name` or `field-value` was
259
259
  * syntactically invalid when used with an operation that sets headers in a
260
260
  * `fields`.
261
261
  */
@@ -263,7 +263,7 @@ export interface HeaderErrorInvalidSyntax {
263
263
  tag: 'invalid-syntax',
264
264
  }
265
265
  /**
266
- * This error indicates that a forbidden `field-key` was used when trying
266
+ * This error indicates that a forbidden `field-name` was used when trying
267
267
  * to set a header in a `fields`.
268
268
  */
269
269
  export interface HeaderErrorForbidden {
@@ -278,8 +278,22 @@ export interface HeaderErrorImmutable {
278
278
  }
279
279
  /**
280
280
  * Field keys are always strings.
281
+ *
282
+ * Field keys should always be treated as case insensitive by the `fields`
283
+ * resource for the purposes of equality checking.
284
+ *
285
+ * # Deprecation
286
+ *
287
+ * This type has been deprecated in favor of the `field-name` type.
281
288
  */
282
289
  export type FieldKey = string;
290
+ /**
291
+ * Field names are always strings.
292
+ *
293
+ * Field names should always be treated as case insensitive by the `fields`
294
+ * resource for the purposes of equality checking.
295
+ */
296
+ export type FieldName = FieldKey;
283
297
  /**
284
298
  * Field values should always be ASCII strings. However, in
285
299
  * reality, HTTP implementations often have to interpret malformed values,
@@ -312,63 +326,73 @@ export class Fields {
312
326
  *
313
327
  * The resulting `fields` is mutable.
314
328
  *
315
- * The list represents each key-value pair in the Fields. Keys
329
+ * The list represents each name-value pair in the Fields. Names
316
330
  * which have multiple values are represented by multiple entries in this
317
- * list with the same key.
331
+ * list with the same name.
318
332
  *
319
- * The tuple is a pair of the field key, represented as a string, and
320
- * Value, represented as a list of bytes. In a valid Fields, all keys
321
- * and values are valid UTF-8 strings. However, values are not always
322
- * well-formed, so they are represented as a raw list of bytes.
333
+ * The tuple is a pair of the field name, represented as a string, and
334
+ * Value, represented as a list of bytes.
323
335
  *
324
- * An error result will be returned if any header or value was
325
- * syntactically invalid, or if a header was forbidden.
336
+ * An error result will be returned if any `field-name` or `field-value` is
337
+ * syntactically invalid, or if a field is forbidden.
326
338
  */
327
- static fromList(entries: Array<[FieldKey, FieldValue]>): Fields;
339
+ static fromList(entries: Array<[FieldName, FieldValue]>): Fields;
328
340
  /**
329
- * Get all of the values corresponding to a key. If the key is not present
330
- * in this `fields`, an empty list is returned. However, if the key is
331
- * present but empty, this is represented by a list with one or more
332
- * empty field-values present.
341
+ * Get all of the values corresponding to a name. If the name is not present
342
+ * in this `fields` or is syntactically invalid, an empty list is returned.
343
+ * However, if the name is present but empty, this is represented by a list
344
+ * with one or more empty field-values present.
333
345
  */
334
- get(name: FieldKey): Array<FieldValue>;
346
+ get(name: FieldName): Array<FieldValue>;
335
347
  /**
336
- * Returns `true` when the key is present in this `fields`. If the key is
348
+ * Returns `true` when the name is present in this `fields`. If the name is
337
349
  * syntactically invalid, `false` is returned.
338
350
  */
339
- has(name: FieldKey): boolean;
351
+ has(name: FieldName): boolean;
340
352
  /**
341
- * Set all of the values for a key. Clears any existing values for that
342
- * key, if they have been set.
353
+ * Set all of the values for a name. Clears any existing values for that
354
+ * name, if they have been set.
343
355
  *
344
356
  * Fails with `header-error.immutable` if the `fields` are immutable.
357
+ *
358
+ * Fails with `header-error.invalid-syntax` if the `field-name` or any of
359
+ * the `field-value`s are syntactically invalid.
345
360
  */
346
- set(name: FieldKey, value: Array<FieldValue>): void;
361
+ set(name: FieldName, value: Array<FieldValue>): void;
347
362
  /**
348
- * Delete all values for a key. Does nothing if no values for the key
363
+ * Delete all values for a name. Does nothing if no values for the name
349
364
  * exist.
350
365
  *
351
366
  * Fails with `header-error.immutable` if the `fields` are immutable.
367
+ *
368
+ * Fails with `header-error.invalid-syntax` if the `field-name` is
369
+ * syntactically invalid.
352
370
  */
353
- 'delete'(name: FieldKey): void;
371
+ 'delete'(name: FieldName): void;
354
372
  /**
355
- * Append a value for a key. Does not change or delete any existing
356
- * values for that key.
373
+ * Append a value for a name. Does not change or delete any existing
374
+ * values for that name.
357
375
  *
358
376
  * Fails with `header-error.immutable` if the `fields` are immutable.
377
+ *
378
+ * Fails with `header-error.invalid-syntax` if the `field-name` or
379
+ * `field-value` are syntactically invalid.
359
380
  */
360
- append(name: FieldKey, value: FieldValue): void;
381
+ append(name: FieldName, value: FieldValue): void;
361
382
  /**
362
- * Retrieve the full set of keys and values in the Fields. Like the
363
- * constructor, the list represents each key-value pair.
383
+ * Retrieve the full set of names and values in the Fields. Like the
384
+ * constructor, the list represents each name-value pair.
364
385
  *
365
- * The outer list represents each key-value pair in the Fields. Keys
386
+ * The outer list represents each name-value pair in the Fields. Names
366
387
  * which have multiple values are represented by multiple entries in this
367
- * list with the same key.
388
+ * list with the same name.
389
+ *
390
+ * The names and values are always returned in the original casing and in
391
+ * the order in which they will be serialized for transport.
368
392
  */
369
- entries(): Array<[FieldKey, FieldValue]>;
393
+ entries(): Array<[FieldName, FieldValue]>;
370
394
  /**
371
- * Make a deep copy of the Fields. Equivelant in behavior to calling the
395
+ * Make a deep copy of the Fields. Equivalent in behavior to calling the
372
396
  * `fields` constructor on the return value of `entries`. The resulting
373
397
  * `fields` is mutable.
374
398
  */
@@ -378,7 +402,7 @@ export class Fields {
378
402
  export class FutureIncomingResponse {
379
403
  /**
380
404
  * Returns a pollable which becomes ready when either the Response has
381
- * been received, or an error has occured. When this pollable is ready,
405
+ * been received, or an error has occurred. When this pollable is ready,
382
406
  * the `get` method will return `some`.
383
407
  */
384
408
  subscribe(): Pollable;
@@ -393,8 +417,8 @@ export class FutureIncomingResponse {
393
417
  * is `some`, and error on subsequent calls.
394
418
  *
395
419
  * The inner `result` represents that either the incoming HTTP Response
396
- * status and headers have recieved successfully, or that an error
397
- * occured. Errors may also occur while consuming the response body,
420
+ * status and headers have received successfully, or that an error
421
+ * occurred. Errors may also occur while consuming the response body,
398
422
  * but those will be reported by the `incoming-body` and its
399
423
  * `output-stream` child.
400
424
  */
@@ -404,12 +428,12 @@ export class FutureIncomingResponse {
404
428
  export class FutureTrailers {
405
429
  /**
406
430
  * Returns a pollable which becomes ready when either the trailers have
407
- * been received, or an error has occured. When this pollable is ready,
431
+ * been received, or an error has occurred. When this pollable is ready,
408
432
  * the `get` method will return `some`.
409
433
  */
410
434
  subscribe(): Pollable;
411
435
  /**
412
- * Returns the contents of the trailers, or an error which occured,
436
+ * Returns the contents of the trailers, or an error which occurred,
413
437
  * once the future is ready.
414
438
  *
415
439
  * The outer `option` represents future readiness. Users can wait on this
@@ -421,7 +445,7 @@ export class FutureTrailers {
421
445
  *
422
446
  * The inner `result` represents that either the HTTP Request or Response
423
447
  * body, as well as any trailers, were received successfully, or that an
424
- * error occured receiving them. The optional `trailers` indicates whether
448
+ * error occurred receiving them. The optional `trailers` indicates whether
425
449
  * or not trailers were present in the body.
426
450
  *
427
451
  * When some `trailers` are returned by this method, the `trailers`
@@ -472,7 +496,7 @@ export class IncomingRequest {
472
496
  */
473
497
  scheme(): Scheme | undefined;
474
498
  /**
475
- * Returns the authority from the request, if it was present.
499
+ * Returns the authority of the Request's target URI, if present.
476
500
  */
477
501
  authority(): string | undefined;
478
502
  /**
@@ -597,16 +621,16 @@ export class OutgoingRequest {
597
621
  */
598
622
  setScheme(scheme: Scheme | undefined): void;
599
623
  /**
600
- * Get the HTTP Authority for the Request. A value of `none` may be used
601
- * with Related Schemes which do not require an Authority. The HTTP and
624
+ * Get the authority of the Request's target URI. A value of `none` may be used
625
+ * with Related Schemes which do not require an authority. The HTTP and
602
626
  * HTTPS schemes always require an authority.
603
627
  */
604
628
  authority(): string | undefined;
605
629
  /**
606
- * Set the HTTP Authority for the Request. A value of `none` may be used
607
- * with Related Schemes which do not require an Authority. The HTTP and
630
+ * Set the authority of the Request's target URI. A value of `none` may be used
631
+ * with Related Schemes which do not require an authority. The HTTP and
608
632
  * HTTPS schemes always require an authority. Fails if the string given is
609
- * not a syntactically valid uri authority.
633
+ * not a syntactically valid URI authority.
610
634
  */
611
635
  setAuthority(authority: string | undefined): void;
612
636
  /**
@@ -616,7 +640,7 @@ export class OutgoingRequest {
616
640
  * `delete` operations will fail with `header-error.immutable`.
617
641
  *
618
642
  * This headers resource is a child: it must be dropped before the parent
619
- * `outgoing-request` is dropped, or its ownership is transfered to
643
+ * `outgoing-request` is dropped, or its ownership is transferred to
620
644
  * another component by e.g. `outgoing-handler.handle`.
621
645
  */
622
646
  headers(): Headers;
@@ -647,7 +671,7 @@ export class OutgoingResponse {
647
671
  * `delete` operations will fail with `header-error.immutable`.
648
672
  *
649
673
  * This headers resource is a child: it must be dropped before the parent
650
- * `outgoing-request` is dropped, or its ownership is transfered to
674
+ * `outgoing-request` is dropped, or its ownership is transferred to
651
675
  * another component by e.g. `outgoing-handler.handle`.
652
676
  */
653
677
  headers(): Headers;
@@ -9,8 +9,9 @@ export namespace WasiIoPoll {
9
9
  * The result `list<u32>` contains one or more indices of handles in the
10
10
  * argument list that is ready for I/O.
11
11
  *
12
- * If the list contains more elements than can be indexed with a `u32`
13
- * value, this function traps.
12
+ * This function traps if either:
13
+ * - the list is empty, or:
14
+ * - the list contains more elements than can be indexed with a `u32` value.
14
15
  *
15
16
  * A timeout can be implemented by adding a pollable from the
16
17
  * wasi-clocks API to the list.
@@ -18,7 +19,7 @@ export namespace WasiIoPoll {
18
19
  * This function does not return a `result`; polling in itself does not
19
20
  * do any I/O so it doesn't fail. If any of the I/O sources identified by
20
21
  * the pollables has an error, it is indicated by marking the source as
21
- * being reaedy for I/O.
22
+ * being ready for I/O.
22
23
  */
23
24
  export function poll(in_: Array<Pollable>): Uint32Array;
24
25
  }
@@ -14,6 +14,9 @@ export type StreamError = StreamErrorLastOperationFailed | StreamErrorClosed;
14
14
  * The last operation (a write or flush) failed before completion.
15
15
  *
16
16
  * More information is available in the `error` payload.
17
+ *
18
+ * After this, the stream will be closed. All future operations return
19
+ * `stream-error::closed`.
17
20
  */
18
21
  export interface StreamErrorLastOperationFailed {
19
22
  tag: 'last-operation-failed',
@@ -162,7 +165,7 @@ export class OutputStream {
162
165
  blockingFlush(): void;
163
166
  /**
164
167
  * Create a `pollable` which will resolve once the output-stream
165
- * is ready for more writing, or an error has occured. When this
168
+ * is ready for more writing, or an error has occurred. When this
166
169
  * pollable is ready, `check-write` will return `ok(n)` with n>0, or an
167
170
  * error.
168
171
  *
@@ -212,7 +215,7 @@ export class OutputStream {
212
215
  /**
213
216
  * Read from one stream and write to another.
214
217
  *
215
- * The behavior of splice is equivelant to:
218
+ * The behavior of splice is equivalent to:
216
219
  * 1. calling `check-write` on the `output-stream`
217
220
  * 2. calling `read` on the `input-stream` with the smaller of the
218
221
  * `check-write` permitted length and the `len` provided to `splice`
@@ -53,7 +53,7 @@ export class ResolveAddressStream {
53
53
  /**
54
54
  * Create a `pollable` which will resolve once the stream is ready for I/O.
55
55
  *
56
- * Note: this function is here for WASI Preview2 only.
56
+ * Note: this function is here for WASI 0.2 only.
57
57
  * It's planned to be removed when `future` is natively supported in Preview3.
58
58
  */
59
59
  subscribe(): Pollable;
@@ -79,7 +79,7 @@ export class TcpSocket {
79
79
  * Connect to a remote endpoint.
80
80
  *
81
81
  * On success:
82
- * - the socket is transitioned into the `connection` state.
82
+ * - the socket is transitioned into the `connected` state.
83
83
  * - a pair of streams is returned that can be used to read & write to the connection
84
84
  *
85
85
  * After a failed connection attempt, the socket will be in the `closed`
@@ -329,10 +329,10 @@ export class TcpSocket {
329
329
  * `subscribe` only has to be called once per socket and can then be
330
330
  * (re)used for the remainder of the socket's lifetime.
331
331
  *
332
- * See <https://github.com/WebAssembly/wasi-sockets/TcpSocketOperationalSemantics.md#Pollable-readiness>
333
- * for a more information.
332
+ * See <https://github.com/WebAssembly/wasi-sockets/blob/main/TcpSocketOperationalSemantics.md#pollable-readiness>
333
+ * for more information.
334
334
  *
335
- * Note: this function is here for WASI Preview2 only.
335
+ * Note: this function is here for WASI 0.2 only.
336
336
  * It's planned to be removed when `future` is natively supported in Preview3.
337
337
  */
338
338
  subscribe(): Pollable;
@@ -347,7 +347,7 @@ export class TcpSocket {
347
347
  * associated with this socket will be closed and a FIN packet will be sent.
348
348
  * - `both`: Same effect as `receive` & `send` combined.
349
349
  *
350
- * This function is idempotent. Shutting a down a direction more than once
350
+ * This function is idempotent; shutting down a direction more than once
351
351
  * has no effect and returns `ok`.
352
352
  *
353
353
  * The shutdown function does not close (drop) the socket.
@@ -82,7 +82,7 @@ export class IncomingDatagramStream {
82
82
  /**
83
83
  * Create a `pollable` which will resolve once the stream is ready to receive again.
84
84
  *
85
- * Note: this function is here for WASI Preview2 only.
85
+ * Note: this function is here for WASI 0.2 only.
86
86
  * It's planned to be removed when `future` is natively supported in Preview3.
87
87
  */
88
88
  subscribe(): Pollable;
@@ -143,7 +143,7 @@ export class OutgoingDatagramStream {
143
143
  /**
144
144
  * Create a `pollable` which will resolve once the stream is ready to send again.
145
145
  *
146
- * Note: this function is here for WASI Preview2 only.
146
+ * Note: this function is here for WASI 0.2 only.
147
147
  * It's planned to be removed when `future` is natively supported in Preview3.
148
148
  */
149
149
  subscribe(): Pollable;
@@ -290,7 +290,7 @@ export class UdpSocket {
290
290
  /**
291
291
  * Create a `pollable` which will resolve once the socket is ready for I/O.
292
292
  *
293
- * Note: this function is here for WASI Preview2 only.
293
+ * Note: this function is here for WASI 0.2 only.
294
294
  * It's planned to be removed when `future` is natively supported in Preview3.
295
295
  */
296
296
  subscribe(): Pollable;