@bytecodealliance/preview2-shim 0.17.1 → 0.17.3

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.
Files changed (67) hide show
  1. package/lib/browser/cli.js +91 -94
  2. package/lib/browser/clocks.js +30 -29
  3. package/lib/browser/filesystem.js +298 -251
  4. package/lib/browser/http.js +129 -128
  5. package/lib/browser/index.js +8 -16
  6. package/lib/browser/io.js +143 -135
  7. package/lib/browser/random.js +44 -42
  8. package/lib/browser/sockets.js +68 -166
  9. package/lib/common/instantiation.js +127 -0
  10. package/lib/io/calls.js +7 -5
  11. package/lib/io/worker-http.js +175 -157
  12. package/lib/io/worker-io.js +402 -386
  13. package/lib/io/worker-socket-tcp.js +271 -219
  14. package/lib/io/worker-socket-udp.js +494 -429
  15. package/lib/io/worker-sockets.js +276 -262
  16. package/lib/io/worker-thread.js +946 -815
  17. package/lib/nodejs/cli.js +64 -63
  18. package/lib/nodejs/clocks.js +51 -45
  19. package/lib/nodejs/filesystem.js +788 -654
  20. package/lib/nodejs/http.js +693 -617
  21. package/lib/nodejs/index.js +8 -16
  22. package/lib/nodejs/random.js +32 -28
  23. package/lib/nodejs/sockets.js +538 -474
  24. package/lib/synckit/index.js +94 -85
  25. package/package.json +9 -5
  26. package/types/cli.d.ts +11 -23
  27. package/types/clocks.d.ts +2 -5
  28. package/types/filesystem.d.ts +2 -5
  29. package/types/http.d.ts +3 -7
  30. package/types/index.d.ts +6 -15
  31. package/types/instantiation.d.ts +112 -0
  32. package/types/interfaces/wasi-cli-environment.d.ts +21 -22
  33. package/types/interfaces/wasi-cli-exit.d.ts +5 -6
  34. package/types/interfaces/wasi-cli-run.d.ts +5 -6
  35. package/types/interfaces/wasi-cli-stderr.d.ts +3 -5
  36. package/types/interfaces/wasi-cli-stdin.d.ts +3 -5
  37. package/types/interfaces/wasi-cli-stdout.d.ts +3 -5
  38. package/types/interfaces/wasi-cli-terminal-input.d.ts +5 -3
  39. package/types/interfaces/wasi-cli-terminal-output.d.ts +5 -3
  40. package/types/interfaces/wasi-cli-terminal-stderr.d.ts +7 -9
  41. package/types/interfaces/wasi-cli-terminal-stdin.d.ts +7 -9
  42. package/types/interfaces/wasi-cli-terminal-stdout.d.ts +7 -9
  43. package/types/interfaces/wasi-clocks-monotonic-clock.d.ts +24 -26
  44. package/types/interfaces/wasi-clocks-wall-clock.d.ts +23 -24
  45. package/types/interfaces/wasi-filesystem-preopens.d.ts +6 -8
  46. package/types/interfaces/wasi-filesystem-types.d.ts +34 -33
  47. package/types/interfaces/wasi-http-incoming-handler.d.ts +16 -19
  48. package/types/interfaces/wasi-http-outgoing-handler.d.ts +18 -23
  49. package/types/interfaces/wasi-http-types.d.ts +49 -38
  50. package/types/interfaces/wasi-io-error.d.ts +5 -3
  51. package/types/interfaces/wasi-io-poll.d.ts +27 -25
  52. package/types/interfaces/wasi-io-streams.d.ts +24 -21
  53. package/types/interfaces/wasi-random-insecure-seed.d.ts +21 -22
  54. package/types/interfaces/wasi-random-insecure.d.ts +19 -20
  55. package/types/interfaces/wasi-random-random.d.ts +23 -24
  56. package/types/interfaces/wasi-sockets-instance-network.d.ts +6 -8
  57. package/types/interfaces/wasi-sockets-ip-name-lookup.d.ts +32 -34
  58. package/types/interfaces/wasi-sockets-network.d.ts +5 -3
  59. package/types/interfaces/wasi-sockets-tcp-create-socket.d.ts +28 -33
  60. package/types/interfaces/wasi-sockets-tcp.d.ts +17 -23
  61. package/types/interfaces/wasi-sockets-udp-create-socket.d.ts +28 -33
  62. package/types/interfaces/wasi-sockets-udp.d.ts +20 -17
  63. package/types/io.d.ts +3 -7
  64. package/types/random.d.ts +3 -7
  65. package/types/sockets.d.ts +7 -15
  66. package/types/wasi-cli-command.d.ts +29 -29
  67. package/types/wasi-http-proxy.d.ts +13 -13
@@ -3,142 +3,143 @@
3
3
  * @returns {string}
4
4
  */
5
5
  export function send(req) {
6
- console.log(`[http] Send (browser) ${req.uri}`);
7
- try {
8
- const xhr = new XMLHttpRequest();
9
- xhr.open(req.method.toString(), req.uri, false);
10
- const requestHeaders = new Headers(req.headers);
11
- for (let [name, value] of requestHeaders.entries()) {
12
- if (name !== "user-agent" && name !== "host") {
13
- xhr.setRequestHeader(name, value);
14
- }
6
+ console.log(`[http] Send (browser) ${req.uri}`);
7
+ try {
8
+ const xhr = new XMLHttpRequest();
9
+ xhr.open(req.method.toString(), req.uri, false);
10
+ const requestHeaders = new Headers(req.headers);
11
+ for (let [name, value] of requestHeaders.entries()) {
12
+ if (name !== 'user-agent' && name !== 'host') {
13
+ xhr.setRequestHeader(name, value);
14
+ }
15
+ }
16
+ xhr.send(req.body && req.body.length > 0 ? req.body : null);
17
+ const body = xhr.response
18
+ ? new TextEncoder().encode(xhr.response)
19
+ : undefined;
20
+ const headers = [];
21
+ xhr.getAllResponseHeaders()
22
+ .trim()
23
+ .split(/[\r\n]+/)
24
+ .forEach((line) => {
25
+ var parts = line.split(': ');
26
+ var key = parts.shift();
27
+ var value = parts.join(': ');
28
+ headers.push([key, value]);
29
+ });
30
+ return {
31
+ status: xhr.status,
32
+ headers,
33
+ body,
34
+ };
35
+ } catch (err) {
36
+ throw new Error(err.message);
15
37
  }
16
- xhr.send(req.body && req.body.length > 0 ? req.body : null);
17
- const body = xhr.response ? new TextEncoder().encode(xhr.response) : undefined;
18
- const headers = [];
19
- xhr.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach((line) => {
20
- var parts = line.split(': ');
21
- var key = parts.shift();
22
- var value = parts.join(': ');
23
- headers.push([key, value]);
24
- });
25
- return {
26
- status: xhr.status,
27
- headers,
28
- body,
29
- };
30
- } catch (err) {
31
- throw new Error(err.message);
32
- }
33
38
  }
34
39
 
35
40
  export const incomingHandler = {
36
- handle () {
37
-
38
- }
41
+ handle() {},
39
42
  };
40
43
 
41
44
  export const outgoingHandler = {
42
- handle () {
43
-
44
- }
45
+ handle() {},
45
46
  };
46
47
 
47
48
  export const types = {
48
- dropFields(_fields) {
49
- console.log("[types] Drop fields");
50
- },
51
- newFields(_entries) {
52
- console.log("[types] New fields");
53
- },
54
- fieldsGet(_fields, _name) {
55
- console.log("[types] Fields get");
56
- },
57
- fieldsSet(_fields, _name, _value) {
58
- console.log("[types] Fields set");
59
- },
60
- fieldsDelete(_fields, _name) {
61
- console.log("[types] Fields delete");
62
- },
63
- fieldsAppend(_fields, _name, _value) {
64
- console.log("[types] Fields append");
65
- },
66
- fieldsEntries(_fields) {
67
- console.log("[types] Fields entries");
68
- },
69
- fieldsClone(_fields) {
70
- console.log("[types] Fields clone");
71
- },
72
- finishIncomingStream(s) {
73
- console.log(`[types] Finish incoming stream ${s}`);
74
- },
75
- finishOutgoingStream(s, _trailers) {
76
- console.log(`[types] Finish outgoing stream ${s}`);
77
- },
78
- dropIncomingRequest(_req) {
79
- console.log("[types] Drop incoming request");
80
- },
81
- dropOutgoingRequest(_req) {
82
- console.log("[types] Drop outgoing request");
83
- },
84
- incomingRequestMethod(_req) {
85
- console.log("[types] Incoming request method");
86
- },
87
- incomingRequestPathWithQuery(_req) {
88
- console.log("[types] Incoming request path with query");
89
- },
90
- incomingRequestScheme(_req) {
91
- console.log("[types] Incoming request scheme");
92
- },
93
- incomingRequestAuthority(_req) {
94
- console.log("[types] Incoming request authority");
95
- },
96
- incomingRequestHeaders(_req) {
97
- console.log("[types] Incoming request headers");
98
- },
99
- incomingRequestConsume(_req) {
100
- console.log("[types] Incoming request consume");
101
- },
102
- newOutgoingRequest(_method, _pathWithQuery, _scheme, _authority, _headers) {
103
- console.log("[types] New outgoing request");
104
- },
105
- outgoingRequestWrite(_req) {
106
- console.log("[types] Outgoing request write");
107
- },
108
- dropResponseOutparam(_res) {
109
- console.log("[types] Drop response outparam");
110
- },
111
- setResponseOutparam(_response) {
112
- console.log("[types] Drop fields");
113
- },
114
- dropIncomingResponse(_res) {
115
- console.log("[types] Drop incoming response");
116
- },
117
- dropOutgoingResponse(_res) {
118
- console.log("[types] Drop outgoing response");
119
- },
120
- incomingResponseStatus(_res) {
121
- console.log("[types] Incoming response status");
122
- },
123
- incomingResponseHeaders(_res) {
124
- console.log("[types] Incoming response headers");
125
- },
126
- incomingResponseConsume(_res) {
127
- console.log("[types] Incoming response consume");
128
- },
129
- newOutgoingResponse(_statusCode, _headers) {
130
- console.log("[types] New outgoing response");
131
- },
132
- outgoingResponseWrite(_res) {
133
- console.log("[types] Outgoing response write");
134
- },
135
- dropFutureIncomingResponse(_f) {
136
- console.log("[types] Drop future incoming response");
137
- },
138
- futureIncomingResponseGet(_f) {
139
- console.log("[types] Future incoming response get");
140
- },
141
- listenToFutureIncomingResponse(_f) {
142
- console.log("[types] Listen to future incoming response");
143
- }
49
+ dropFields(_fields) {
50
+ console.log('[types] Drop fields');
51
+ },
52
+ newFields(_entries) {
53
+ console.log('[types] New fields');
54
+ },
55
+ fieldsGet(_fields, _name) {
56
+ console.log('[types] Fields get');
57
+ },
58
+ fieldsSet(_fields, _name, _value) {
59
+ console.log('[types] Fields set');
60
+ },
61
+ fieldsDelete(_fields, _name) {
62
+ console.log('[types] Fields delete');
63
+ },
64
+ fieldsAppend(_fields, _name, _value) {
65
+ console.log('[types] Fields append');
66
+ },
67
+ fieldsEntries(_fields) {
68
+ console.log('[types] Fields entries');
69
+ },
70
+ fieldsClone(_fields) {
71
+ console.log('[types] Fields clone');
72
+ },
73
+ finishIncomingStream(s) {
74
+ console.log(`[types] Finish incoming stream ${s}`);
75
+ },
76
+ finishOutgoingStream(s, _trailers) {
77
+ console.log(`[types] Finish outgoing stream ${s}`);
78
+ },
79
+ dropIncomingRequest(_req) {
80
+ console.log('[types] Drop incoming request');
81
+ },
82
+ dropOutgoingRequest(_req) {
83
+ console.log('[types] Drop outgoing request');
84
+ },
85
+ incomingRequestMethod(_req) {
86
+ console.log('[types] Incoming request method');
87
+ },
88
+ incomingRequestPathWithQuery(_req) {
89
+ console.log('[types] Incoming request path with query');
90
+ },
91
+ incomingRequestScheme(_req) {
92
+ console.log('[types] Incoming request scheme');
93
+ },
94
+ incomingRequestAuthority(_req) {
95
+ console.log('[types] Incoming request authority');
96
+ },
97
+ incomingRequestHeaders(_req) {
98
+ console.log('[types] Incoming request headers');
99
+ },
100
+ incomingRequestConsume(_req) {
101
+ console.log('[types] Incoming request consume');
102
+ },
103
+ newOutgoingRequest(_method, _pathWithQuery, _scheme, _authority, _headers) {
104
+ console.log('[types] New outgoing request');
105
+ },
106
+ outgoingRequestWrite(_req) {
107
+ console.log('[types] Outgoing request write');
108
+ },
109
+ dropResponseOutparam(_res) {
110
+ console.log('[types] Drop response outparam');
111
+ },
112
+ setResponseOutparam(_response) {
113
+ console.log('[types] Drop fields');
114
+ },
115
+ dropIncomingResponse(_res) {
116
+ console.log('[types] Drop incoming response');
117
+ },
118
+ dropOutgoingResponse(_res) {
119
+ console.log('[types] Drop outgoing response');
120
+ },
121
+ incomingResponseStatus(_res) {
122
+ console.log('[types] Incoming response status');
123
+ },
124
+ incomingResponseHeaders(_res) {
125
+ console.log('[types] Incoming response headers');
126
+ },
127
+ incomingResponseConsume(_res) {
128
+ console.log('[types] Incoming response consume');
129
+ },
130
+ newOutgoingResponse(_statusCode, _headers) {
131
+ console.log('[types] New outgoing response');
132
+ },
133
+ outgoingResponseWrite(_res) {
134
+ console.log('[types] Outgoing response write');
135
+ },
136
+ dropFutureIncomingResponse(_f) {
137
+ console.log('[types] Drop future incoming response');
138
+ },
139
+ futureIncomingResponseGet(_f) {
140
+ console.log('[types] Future incoming response get');
141
+ },
142
+ listenToFutureIncomingResponse(_f) {
143
+ console.log('[types] Listen to future incoming response');
144
+ },
144
145
  };
@@ -1,17 +1,9 @@
1
- import * as clocks from "./clocks.js";
2
- import * as filesystem from "./filesystem.js";
3
- import * as http from "./http.js";
4
- import * as io from "./io.js";
5
- import * as random from "./random.js";
6
- import * as sockets from "./sockets.js";
7
- import * as cli from "./cli.js";
1
+ import * as clocks from './clocks.js';
2
+ import * as filesystem from './filesystem.js';
3
+ import * as http from './http.js';
4
+ import * as io from './io.js';
5
+ import * as random from './random.js';
6
+ import * as sockets from './sockets.js';
7
+ import * as cli from './cli.js';
8
8
 
9
- export {
10
- clocks,
11
- filesystem,
12
- http,
13
- io,
14
- random,
15
- sockets,
16
- cli,
17
- }
9
+ export { clocks, filesystem, http, io, random, sockets, cli };
package/lib/browser/io.js CHANGED
@@ -3,13 +3,13 @@ let id = 0;
3
3
  const symbolDispose = Symbol.dispose || Symbol.for('dispose');
4
4
 
5
5
  const IoError = class Error {
6
- constructor (msg) {
7
- this.msg = msg;
8
- }
9
- toDebugString () {
10
- return this.msg;
11
- }
12
- }
6
+ constructor(msg) {
7
+ this.msg = msg;
8
+ }
9
+ toDebugString() {
10
+ return this.msg;
11
+ }
12
+ };
13
13
 
14
14
  /**
15
15
  * @typedef {{
@@ -20,7 +20,7 @@ const IoError = class Error {
20
20
  * subscribe: () => void,
21
21
  * drop?: () => void,
22
22
  * }} InputStreamHandler
23
- *
23
+ *
24
24
  * @typedef {{
25
25
  * checkWrite?: () -> BigInt,
26
26
  * write: (buf: Uint8Array) => BigInt,
@@ -36,132 +36,140 @@ const IoError = class Error {
36
36
  * subscribe?: () => void,
37
37
  * drop?: () => void,
38
38
  * }} OutputStreamHandler
39
- *
39
+ *
40
40
  **/
41
41
 
42
42
  class InputStream {
43
- /**
44
- * @param {InputStreamHandler} handler
45
- */
46
- constructor (handler) {
47
- if (!handler)
48
- console.trace('no handler');
49
- this.id = ++id;
50
- this.handler = handler;
51
- }
52
- read(len) {
53
- if (this.handler.read)
54
- return this.handler.read(len);
55
- return this.handler.blockingRead.call(this, len);
56
- }
57
- blockingRead(len) {
58
- return this.handler.blockingRead.call(this, len);
59
- }
60
- skip(len) {
61
- if (this.handler.skip)
62
- return this.handler.skip.call(this, len);
63
- if (this.handler.read) {
64
- const bytes = this.handler.read.call(this, len);
65
- return BigInt(bytes.byteLength);
66
- }
67
- return this.blockingSkip.call(this, len);
68
- }
69
- blockingSkip(len) {
70
- if (this.handler.blockingSkip)
71
- return this.handler.blockingSkip.call(this, len);
72
- const bytes = this.handler.blockingRead.call(this, len);
73
- return BigInt(bytes.byteLength);
74
- }
75
- subscribe() {
76
- console.log(`[streams] Subscribe to input stream ${this.id}`);
77
- }
78
- [symbolDispose] () {
79
- if (this.handler.drop)
80
- this.handler.drop.call(this);
81
- }
43
+ /**
44
+ * @param {InputStreamHandler} handler
45
+ */
46
+ constructor(handler) {
47
+ if (!handler) {
48
+ console.trace('no handler');
49
+ }
50
+ this.id = ++id;
51
+ this.handler = handler;
52
+ }
53
+ read(len) {
54
+ if (this.handler.read) {
55
+ return this.handler.read(len);
56
+ }
57
+ return this.handler.blockingRead.call(this, len);
58
+ }
59
+ blockingRead(len) {
60
+ return this.handler.blockingRead.call(this, len);
61
+ }
62
+ skip(len) {
63
+ if (this.handler.skip) {
64
+ return this.handler.skip.call(this, len);
65
+ }
66
+ if (this.handler.read) {
67
+ const bytes = this.handler.read.call(this, len);
68
+ return BigInt(bytes.byteLength);
69
+ }
70
+ return this.blockingSkip.call(this, len);
71
+ }
72
+ blockingSkip(len) {
73
+ if (this.handler.blockingSkip) {
74
+ return this.handler.blockingSkip.call(this, len);
75
+ }
76
+ const bytes = this.handler.blockingRead.call(this, len);
77
+ return BigInt(bytes.byteLength);
78
+ }
79
+ subscribe() {
80
+ console.log(`[streams] Subscribe to input stream ${this.id}`);
81
+ }
82
+ [symbolDispose]() {
83
+ if (this.handler.drop) {
84
+ this.handler.drop.call(this);
85
+ }
86
+ }
82
87
  }
83
88
 
84
89
  class OutputStream {
85
- /**
86
- * @param {OutputStreamHandler} handler
87
- */
88
- constructor (handler) {
89
- if (!handler)
90
- console.trace('no handler');
91
- this.id = ++id;
92
- this.open = true;
93
- this.handler = handler;
94
- }
95
- checkWrite(len) {
96
- if (!this.open)
97
- return 0n;
98
- if (this.handler.checkWrite)
99
- return this.handler.checkWrite.call(this, len);
100
- return 1_000_000n;
101
- }
102
- write(buf) {
103
- this.handler.write.call(this, buf);
104
- }
105
- blockingWriteAndFlush(buf) {
106
- /// Perform a write of up to 4096 bytes, and then flush the stream. Block
107
- /// until all of these operations are complete, or an error occurs.
108
- ///
109
- /// This is a convenience wrapper around the use of `check-write`,
110
- /// `subscribe`, `write`, and `flush`, and is implemented with the
111
- /// following pseudo-code:
112
- ///
113
- /// ```text
114
- /// let pollable = this.subscribe();
115
- /// while !contents.is_empty() {
116
- /// // Wait for the stream to become writable
117
- /// poll-one(pollable);
118
- /// let Ok(n) = this.check-write(); // eliding error handling
119
- /// let len = min(n, contents.len());
120
- /// let (chunk, rest) = contents.split_at(len);
121
- /// this.write(chunk ); // eliding error handling
122
- /// contents = rest;
123
- /// }
124
- /// this.flush();
125
- /// // Wait for completion of `flush`
126
- /// poll-one(pollable);
127
- /// // Check for any errors that arose during `flush`
128
- /// let _ = this.check-write(); // eliding error handling
129
- /// ```
130
- this.handler.write.call(this, buf);
131
- }
132
- flush() {
133
- if (this.handler.flush)
134
- this.handler.flush.call(this);
135
- }
136
- blockingFlush() {
137
- this.open = true;
138
- }
139
- writeZeroes(len) {
140
- this.write.call(this, new Uint8Array(Number(len)));
141
- }
142
- blockingWriteZeroes(len) {
143
- this.blockingWrite.call(this, new Uint8Array(Number(len)));
144
- }
145
- blockingWriteZeroesAndFlush(len) {
146
- this.blockingWriteAndFlush.call(this, new Uint8Array(Number(len)));
147
- }
148
- splice(src, len) {
149
- const spliceLen = Math.min(len, this.checkWrite.call(this));
150
- const bytes = src.read(spliceLen);
151
- this.write.call(this, bytes);
152
- return bytes.byteLength;
153
- }
154
- blockingSplice(_src, _len) {
155
- console.log(`[streams] Blocking splice ${this.id}`);
156
- }
157
- forward(_src) {
158
- console.log(`[streams] Forward ${this.id}`);
159
- }
160
- subscribe() {
161
- console.log(`[streams] Subscribe to output stream ${this.id}`);
162
- }
163
- [symbolDispose]() {
164
- }
90
+ /**
91
+ * @param {OutputStreamHandler} handler
92
+ */
93
+ constructor(handler) {
94
+ if (!handler) {
95
+ console.trace('no handler');
96
+ }
97
+ this.id = ++id;
98
+ this.open = true;
99
+ this.handler = handler;
100
+ }
101
+ checkWrite(len) {
102
+ if (!this.open) {
103
+ return 0n;
104
+ }
105
+ if (this.handler.checkWrite) {
106
+ return this.handler.checkWrite.call(this, len);
107
+ }
108
+ return 1_000_000n;
109
+ }
110
+ write(buf) {
111
+ this.handler.write.call(this, buf);
112
+ }
113
+ blockingWriteAndFlush(buf) {
114
+ /// Perform a write of up to 4096 bytes, and then flush the stream. Block
115
+ /// until all of these operations are complete, or an error occurs.
116
+ ///
117
+ /// This is a convenience wrapper around the use of `check-write`,
118
+ /// `subscribe`, `write`, and `flush`, and is implemented with the
119
+ /// following pseudo-code:
120
+ ///
121
+ /// ```text
122
+ /// let pollable = this.subscribe();
123
+ /// while !contents.is_empty() {
124
+ /// // Wait for the stream to become writable
125
+ /// poll-one(pollable);
126
+ /// let Ok(n) = this.check-write(); // eliding error handling
127
+ /// let len = min(n, contents.len());
128
+ /// let (chunk, rest) = contents.split_at(len);
129
+ /// this.write(chunk ); // eliding error handling
130
+ /// contents = rest;
131
+ /// }
132
+ /// this.flush();
133
+ /// // Wait for completion of `flush`
134
+ /// poll-one(pollable);
135
+ /// // Check for any errors that arose during `flush`
136
+ /// let _ = this.check-write(); // eliding error handling
137
+ /// ```
138
+ this.handler.write.call(this, buf);
139
+ }
140
+ flush() {
141
+ if (this.handler.flush) {
142
+ this.handler.flush.call(this);
143
+ }
144
+ }
145
+ blockingFlush() {
146
+ this.open = true;
147
+ }
148
+ writeZeroes(len) {
149
+ this.write.call(this, new Uint8Array(Number(len)));
150
+ }
151
+ blockingWriteZeroes(len) {
152
+ this.blockingWrite.call(this, new Uint8Array(Number(len)));
153
+ }
154
+ blockingWriteZeroesAndFlush(len) {
155
+ this.blockingWriteAndFlush.call(this, new Uint8Array(Number(len)));
156
+ }
157
+ splice(src, len) {
158
+ const spliceLen = Math.min(len, this.checkWrite.call(this));
159
+ const bytes = src.read(spliceLen);
160
+ this.write.call(this, bytes);
161
+ return bytes.byteLength;
162
+ }
163
+ blockingSplice(_src, _len) {
164
+ console.log(`[streams] Blocking splice ${this.id}`);
165
+ }
166
+ forward(_src) {
167
+ console.log(`[streams] Forward ${this.id}`);
168
+ }
169
+ subscribe() {
170
+ console.log(`[streams] Subscribe to output stream ${this.id}`);
171
+ }
172
+ [symbolDispose]() {}
165
173
  }
166
174
 
167
175
  export const error = { Error: IoError };
@@ -170,16 +178,16 @@ export const streams = { InputStream, OutputStream };
170
178
 
171
179
  class Pollable {}
172
180
 
173
- function pollList (_list) {
174
- // TODO
181
+ function pollList(_list) {
182
+ // TODO
175
183
  }
176
184
 
177
- function pollOne (_poll) {
178
- // TODO
185
+ function pollOne(_poll) {
186
+ // TODO
179
187
  }
180
188
 
181
189
  export const poll = {
182
- Pollable,
183
- pollList,
184
- pollOne
190
+ Pollable,
191
+ pollList,
192
+ pollOne,
185
193
  };