@bytecodealliance/preview2-shim 0.0.17 → 0.0.18

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.
@@ -1,63 +1,11 @@
1
- import { _io } from './io.js';
1
+ import { streams } from '../common/io.js';
2
2
  import { environment } from './cli.js';
3
- import { constants, readSync, openSync, opendirSync, closeSync, fstatSync, lstatSync, statSync, writeSync } from 'node:fs';
3
+ import { constants, readSync, openSync, opendirSync, closeSync, fstatSync, lstatSync, statSync, writeSync, mkdirSync } from 'node:fs';
4
4
  import { platform } from 'node:process';
5
5
 
6
- const isWindows = platform === 'win32';
7
-
8
- class ReadableFileStream {
9
- constructor (hostFd, position) {
10
- this.hostFd = hostFd;
11
- this.position = Number(position);
12
- }
13
- read (len) {
14
- const buf = new Uint8Array(Number(len));
15
- const bytesRead = readSync(this.hostFd, buf, 0, buf.byteLength, this.position);
16
- this.position += bytesRead;
17
- if (bytesRead < buf.byteLength)
18
- return [new Uint8Array(buf.buffer, 0, bytesRead), bytesRead === 0 ? 'ended' : 'open'];
19
- return [buf, 'open'];
20
- }
21
- }
6
+ const { InputStream, OutputStream, Error: StreamError } = streams;
22
7
 
23
- class WriteableFileStream {
24
- constructor (hostFd, position) {
25
- this.hostFd = hostFd;
26
- this.position = Number(position);
27
- }
28
- write (contents) {
29
- let totalWritten = 0;
30
- while (totalWritten !== contents.byteLength) {
31
- const bytesWritten = writeSync(this.hostFd, contents, null, null, this.position);
32
- totalWritten += bytesWritten;
33
- contents = new Uint8Array(contents.buffer, bytesWritten);
34
- }
35
- this.position += contents.byteLength;
36
- }
37
- }
38
-
39
- class DirStream {
40
- constructor (dir) {
41
- this.dir = dir;
42
- }
43
- read () {
44
- let entry;
45
- try {
46
- entry = this.dir.readSync();
47
- } catch (e) {
48
- throw convertFsError(e);
49
- }
50
- if (entry === null) {
51
- return null;
52
- }
53
- const name = entry.name;
54
- const type = lookupType(entry);
55
- return { name, type };
56
- }
57
- drop () {
58
- this.dir.closeSync();
59
- }
60
- }
8
+ const isWindows = platform === 'win32';
61
9
 
62
10
  const nsMagnitude = 1_000_000_000_000n;
63
11
  function nsToDateTime (ns) {
@@ -86,24 +34,17 @@ function lookupType (obj) {
86
34
 
87
35
  /**
88
36
  * @typedef {
89
- * { stream: number } |
90
37
  * { hostPreopen: string } |
91
38
  * { fullPath: string, fd: number }
92
- * } Descriptor
39
+ * } DescriptorProps
93
40
  */
94
41
  export class FileSystem {
95
- getDescriptor (fd) {
96
- const descriptor = this.descriptors[fd];
97
- if (!descriptor) throw 'bad-descriptor';
98
- return descriptor;
99
- }
100
-
101
42
  // Note: This should implement per-segment semantics of openAt, but we cannot currently
102
43
  // due to the lack of support for openat() in Node.js.
103
44
  // Tracking issue: https://github.com/libuv/libuv/issues/4167
104
45
 
105
46
  // TODO: support followSymlinks
106
- getFullPath (fd, subpath, _followSymlinks) {
47
+ getFullPath (descriptor, subpath, _followSymlinks) {
107
48
  if (subpath.indexOf('\\') !== -1)
108
49
  subpath = subpath.replace(/\\/g, '/');
109
50
  if (subpath[0] === '/') {
@@ -115,14 +56,13 @@ export class FileSystem {
115
56
  }
116
57
  if (!bestPreopenMatch)
117
58
  throw 'no-entry';
118
- fd = bestPreopenMatch[0];
59
+ descriptor = bestPreopenMatch[0];
119
60
  subpath = subpath.slice(bestPreopenMatch[1]);
120
61
  if (subpath[0] === '/')
121
62
  subpath = subpath.slice(1);
122
63
  }
123
64
  if (subpath.startsWith('.'))
124
65
  subpath = subpath.slice(subpath[1] === '/' ? 2 : 1);
125
- const descriptor = this.getDescriptor(fd);
126
66
  if (descriptor.hostPreopen)
127
67
  return descriptor.hostPreopen + (descriptor.hostPreopen.endsWith('/') ? '' : '/') + subpath;
128
68
  return descriptor.fullPath + '/' + subpath;
@@ -130,131 +70,186 @@ export class FileSystem {
130
70
 
131
71
  /**
132
72
  *
133
- * @param {import('./io.js').Io} io
134
73
  * @param {[string, string][]} preopens
74
+ * @param {import('./cli.js').environment} environment
135
75
  * @returns
136
76
  */
137
- constructor (io, preopens, environment) {
77
+ constructor (preopens, environment) {
78
+ const fs = this;
138
79
  this.cwd = environment.initialCwd();
139
- // io always has streams 0, 1, 2 as stdio streams
140
- this.descriptorCnt = 3;
141
- /**
142
- * @type {Record<number, Descriptor>}
143
- */
144
- this.descriptors = {
145
- 0: { stream: 0 },
146
- 1: { stream: 1 },
147
- 2: { stream: 2 },
148
- };
149
- this.preopenEntries = [];
150
- for (const [virtualPath, hostPreopen] of Object.entries(preopens)) {
151
- const preopenEntry = [this.descriptorCnt, virtualPath];
152
- this.preopenEntries.push(preopenEntry);
153
- this.descriptors[this.descriptorCnt++] = { hostPreopen };
80
+
81
+ class FileInputStream extends InputStream {
82
+ constructor (hostFd, position) {
83
+ super({
84
+ blockingRead (len) {
85
+ const buf = new Uint8Array(Number(len));
86
+ try {
87
+ var bytesRead = readSync(this.hostFd, buf, 0, buf.byteLength, this.position);
88
+ } catch (e) {
89
+ throw { tag: 'last-operation-failed', val: new StreamError(e.message) };
90
+ }
91
+ this.position += bytesRead;
92
+ if (bytesRead < buf.byteLength) {
93
+ if (bytesRead === 0)
94
+ throw { tag: 'closed' };
95
+ return new Uint8Array(buf.buffer, 0, bytesRead);
96
+ }
97
+ return buf;
98
+ },
99
+ subscribe () {
100
+ // TODO
101
+ },
102
+ drop () {
103
+ // TODO
104
+ }
105
+ });
106
+ this.hostFd = hostFd;
107
+ this.position = Number(position);
108
+ }
154
109
  }
155
- const fs = this;
156
- this.preopens = {
157
- getDirectories () {
158
- return fs.preopenEntries;
110
+
111
+ class FileOutputStream extends OutputStream {
112
+ constructor (hostFd, position) {
113
+ super({
114
+ write (contents) {
115
+ let totalWritten = 0;
116
+ while (totalWritten !== contents.byteLength) {
117
+ const bytesWritten = writeSync(this.hostFd, contents, null, null, this.position);
118
+ totalWritten += bytesWritten;
119
+ contents = new Uint8Array(contents.buffer, bytesWritten);
120
+ }
121
+ this.position += contents.byteLength;
122
+ },
123
+ blockingFlush () {
124
+
125
+ },
126
+ drop () {
127
+
128
+ }
129
+ });
130
+ this.hostFd = hostFd;
131
+ this.position = Number(position);
159
132
  }
160
- };
161
- this.types = {
162
- readViaStream(fd, offset) {
163
- const descriptor = fs.getDescriptor(fd);
164
- if (descriptor.stream)
165
- return descriptor.stream;
166
- if (descriptor.hostPreopen)
167
- throw 'is-directory';
168
- return io.createStream(new ReadableFileStream(descriptor.fd, offset));
169
- },
133
+ }
170
134
 
171
- writeViaStream(fd, offset) {
172
- const descriptor = fs.getDescriptor(fd);
173
- if (descriptor.stream)
174
- return descriptor.stream;
175
- if (descriptor.hostPreopen)
135
+ class DirectoryEntryStream {
136
+ constructor (dir) {
137
+ this.dir = dir;
138
+ }
139
+ readDirectoryEntry () {
140
+ let entry;
141
+ try {
142
+ entry = this.dir.readSync();
143
+ } catch (e) {
144
+ throw convertFsError(e);
145
+ }
146
+ if (entry === null) {
147
+ return null;
148
+ }
149
+ const name = entry.name;
150
+ const type = lookupType(entry);
151
+ return { name, type };
152
+ }
153
+ drop () {
154
+ this.dir.closeSync();
155
+ }
156
+ }
157
+
158
+ /**
159
+ * @implements {DescriptorProps}
160
+ */
161
+ class Descriptor {
162
+ constructor () {
163
+ this.id = fs.descriptorCnt++;
164
+ }
165
+ readViaStream(offset) {
166
+ if (this.hostPreopen)
167
+ throw { tag: 'last-operation-failed', val: new StreamError };
168
+ return new FileInputStream(this.fd, offset);
169
+ }
170
+ writeViaStream(offset) {
171
+ if (this.hostPreopen)
176
172
  throw 'is-directory';
177
- return io.createStream(new WriteableFileStream(descriptor.fd, offset));
178
- },
173
+ return new FileOutputStream(this.fd, offset);
174
+ }
179
175
 
180
- appendViaStream(fd) {
181
- console.log(`[filesystem] APPEND STREAM ${fd}`);
182
- },
176
+ appendViaStream() {
177
+ console.log(`[filesystem] APPEND STREAM ${this.id}`);
178
+ }
183
179
 
184
- advise(fd, offset, length, advice) {
185
- console.log(`[filesystem] ADVISE`, fd, offset, length, advice);
186
- },
180
+ advise(offset, length, advice) {
181
+ console.log(`[filesystem] ADVISE`, this.id, offset, length, advice);
182
+ }
187
183
 
188
- syncData(fd) {
189
- console.log(`[filesystem] SYNC DATA ${fd}`);
190
- },
184
+ syncData() {
185
+ console.log(`[filesystem] SYNC DATA ${this.id}`);
186
+ }
191
187
 
192
- getFlags(fd) {
193
- console.log(`[filesystem] FLAGS FOR ${fd}`);
194
- },
188
+ getFlags() {
189
+ console.log(`[filesystem] FLAGS FOR ${this.id}`);
190
+ }
195
191
 
196
- getType(fd) {
197
- const descriptor = fs.getDescriptor(fd);
198
- if (descriptor.stream) return 'fifo';
199
- if (descriptor.hostPreopen) return 'directory';
200
- const stats = fstatSync(descriptor.fd);
192
+ getType() {
193
+ if (this.hostPreopen) return 'directory';
194
+ const stats = fstatSync(this.fd);
201
195
  return lookupType(stats);
202
- },
196
+ }
203
197
 
204
- setFlags(fd, flags) {
205
- console.log(`[filesystem] SET FLAGS ${fd} ${JSON.stringify(flags)}`);
206
- },
198
+ setFlags(flags) {
199
+ console.log(`[filesystem] SET FLAGS ${this.id} ${JSON.stringify(flags)}`);
200
+ }
207
201
 
208
- setSize(fd, size) {
209
- console.log(`[filesystem] SET SIZE`, fd, size);
210
- },
202
+ setSize(size) {
203
+ console.log(`[filesystem] SET SIZE`, this.id, size);
204
+ }
211
205
 
212
- setTimes(fd, dataAccessTimestamp, dataModificationTimestamp) {
213
- console.log(`[filesystem] SET TIMES`, fd, dataAccessTimestamp, dataModificationTimestamp);
214
- },
206
+ setTimes(dataAccessTimestamp, dataModificationTimestamp) {
207
+ console.log(`[filesystem] SET TIMES`, this.id, dataAccessTimestamp, dataModificationTimestamp);
208
+ }
215
209
 
216
- read(fd, length, offset) {
217
- const descriptor = fs.getDescriptor(fd);
218
- if (!descriptor.fullPath) throw 'bad-descriptor';
210
+ read(length, offset) {
211
+ if (!this.fullPath) throw 'bad-descriptor';
219
212
  const buf = new Uint8Array(length);
220
- const bytesRead = readSync(descriptor.fd, buf, Number(offset), length, 0);
213
+ const bytesRead = readSync(this.fd, buf, Number(offset), length, 0);
221
214
  const out = new Uint8Array(buf.buffer, 0, bytesRead);
222
215
  return [out, bytesRead === 0 ? 'ended' : 'open'];
223
- },
216
+ }
224
217
 
225
- write(fd, buffer, offset) {
226
- const descriptor = fs.getDescriptor(fd);
227
- if (!descriptor.fullPath) throw 'bad-descriptor';
228
- return BigInt(writeSync(descriptor.fd, buffer, Number(offset), buffer.byteLength - offset, 0));
229
- },
218
+ write(buffer, offset) {
219
+ if (!this.fullPath) throw 'bad-descriptor';
220
+ return BigInt(writeSync(this.fd, buffer, Number(offset), buffer.byteLength - offset, 0));
221
+ }
230
222
 
231
- readDirectory(fd) {
232
- const descriptor = fs.getDescriptor(fd);
233
- if (!descriptor.fullPath) throw 'bad-descriptor';
223
+ readDirectory() {
224
+ if (!this.fullPath) throw 'bad-descriptor';
234
225
  try {
235
- const dir = opendirSync(isWindows ? descriptor.fullPath.slice(1) : descriptor.fullPath);
236
- return io.createStream(new DirStream(dir));
226
+ const dir = opendirSync(isWindows ? this.fullPath.slice(1) : this.fullPath);
227
+ return new DirectoryEntryStream(dir);
237
228
  }
238
229
  catch (e) {
239
230
  throw convertFsError(e);
240
231
  }
241
- },
232
+ }
242
233
 
243
- sync(fd) {
244
- console.log(`[filesystem] SYNC`, fd);
245
- },
234
+ sync() {
235
+ console.log(`[filesystem] SYNC`, this.id);
236
+ }
246
237
 
247
- createDirectoryAt(fd, path) {
248
- const entry = fs.getOrCreateChildDescriptor(fd, path, { create: true, directory: true });
249
- if (entry.source) throw 'exist';
250
- },
251
-
252
- stat(fd) {
253
- const descriptor = fs.getDescriptor(fd);
254
- if (descriptor.stream || descriptor.hostPreopen) throw 'invalid';
238
+ createDirectoryAt(path) {
239
+ const fullPath = fs.getFullPath(this, path);
240
+ try {
241
+ mkdirSync(fullPath);
242
+ }
243
+ catch (e) {
244
+ throw convertFsError(e);
245
+ }
246
+ }
247
+
248
+ stat() {
249
+ if (this.hostPreopen) throw 'invalid';
255
250
  let stats;
256
251
  try {
257
- stats = fstatSync(descriptor.fd, { bigint: true });
252
+ stats = fstatSync(this.fd, { bigint: true });
258
253
  }
259
254
  catch (e) {
260
255
  convertFsError(e);
@@ -268,10 +263,10 @@ export class FileSystem {
268
263
  dataModificationTimestamp: nsToDateTime(stats.mtimeNs),
269
264
  statusChangeTimestamp: nsToDateTime(stats.ctimeNs),
270
265
  };
271
- },
266
+ }
272
267
 
273
- statAt(fd, pathFlags, path) {
274
- const fullPath = fs.getFullPath(fd, path, false);
268
+ statAt(pathFlags, path) {
269
+ const fullPath = fs.getFullPath(this, path, false);
275
270
  let stats;
276
271
  try {
277
272
  stats = (pathFlags.symlinkFollow ? statSync : lstatSync)(isWindows ? fullPath.slice(1) : fullPath, { bigint: true });
@@ -288,19 +283,18 @@ export class FileSystem {
288
283
  dataModificationTimestamp: nsToDateTime(stats.mtimeNs),
289
284
  statusChangeTimestamp: nsToDateTime(stats.ctimeNs),
290
285
  };
291
- },
286
+ }
292
287
 
293
- setTimesAt(fd) {
294
- console.log(`[filesystem] SET TIMES AT`, fd);
295
- },
288
+ setTimesAt() {
289
+ console.log(`[filesystem] SET TIMES AT`, this.id);
290
+ }
296
291
 
297
- linkAt(fd) {
298
- console.log(`[filesystem] LINK AT`, fd);
299
- },
292
+ linkAt() {
293
+ console.log(`[filesystem] LINK AT`, this.id);
294
+ }
300
295
 
301
- openAt(fd, pathFlags, path, openFlags, descriptorFlags, modes) {
302
- const fullPath = fs.getFullPath(fd, path, pathFlags.symlinkFollow);
303
- const childFd = fs.descriptorCnt++;
296
+ openAt(pathFlags, path, openFlags, descriptorFlags, modes) {
297
+ const fullPath = fs.getFullPath(this, path, pathFlags.symlinkFollow);
304
298
  let fsOpenFlags = 0x0;
305
299
  if (openFlags.create)
306
300
  fsOpenFlags |= constants.O_CREAT;
@@ -331,94 +325,80 @@ export class FileSystem {
331
325
 
332
326
  try {
333
327
  const fd = openSync(isWindows ? fullPath.slice(1) : fullPath, fsOpenFlags, fsMode);
334
- fs.descriptors[childFd] = { fullPath, fd };
328
+ return Object.assign(new Descriptor(), { fullPath, fd });
335
329
  }
336
330
  catch (e) {
337
331
  throw convertFsError(e);
338
332
  }
339
- return childFd;
340
- },
341
-
342
- readlinkAt(fd) {
343
- console.log(`[filesystem] READLINK AT`, fd);
344
- },
345
-
346
- removeDirectoryAt(fd) {
347
- console.log(`[filesystem] REMOVE DIR AT`, fd);
348
- },
349
-
350
- renameAt(fd) {
351
- console.log(`[filesystem] RENAME AT`, fd);
352
- },
353
-
354
- symlinkAt(fd) {
355
- console.log(`[filesystem] SYMLINK AT`, fd);
356
- },
357
-
358
- unlinkFileAt(fd) {
359
- console.log(`[filesystem] UNLINK FILE AT`, fd);
360
- },
361
-
362
- changeFilePermissionsAt(fd) {
363
- console.log(`[filesystem] CHANGE FILE PERMISSIONS AT`, fd);
364
- },
365
-
366
- changeDirectoryPermissionsAt(fd) {
367
- console.log(`[filesystem] CHANGE DIR PERMISSIONS AT`, fd);
368
- },
369
-
370
- lockShared(fd) {
371
- console.log(`[filesystem] LOCK SHARED`, fd);
372
- },
373
-
374
- lockExclusive(fd) {
375
- console.log(`[filesystem] LOCK EXCLUSIVE`, fd);
376
- },
377
-
378
- tryLockShared(fd) {
379
- console.log(`[filesystem] TRY LOCK SHARED`, fd);
380
- },
381
-
382
- tryLockExclusive(fd) {
383
- console.log(`[filesystem] TRY LOCK EXCLUSIVE`, fd);
384
- },
385
-
386
- unlock(fd) {
387
- console.log(`[filesystem] UNLOCK`, fd);
388
- },
389
-
390
- dropDescriptor(fd) {
391
- const descriptor = fs.getDescriptor(fd);
392
- if (descriptor.fd)
393
- closeSync(descriptor.fd);
394
- delete fs.descriptors[fd];
395
- },
396
-
397
- readDirectoryEntry(sid) {
398
- return io.getStream(sid).read();
399
- },
400
-
401
- dropDirectoryEntryStream(sid) {
402
- io.dropStream(sid);
403
- },
404
-
405
- metadataHash(fd) {
406
- const descriptor = fs.getDescriptor(fd);
407
- if (descriptor.stream)
408
- return { upper: 0n, lower: descriptor.stream}
409
- if (descriptor.hostPreopen)
410
- return { upper: 0n, lower: BigInt(fd) };
333
+ }
334
+
335
+ readlinkAt() {
336
+ console.log(`[filesystem] READLINK AT`, this.id);
337
+ }
338
+
339
+ removeDirectoryAt() {
340
+ console.log(`[filesystem] REMOVE DIR AT`, this.id);
341
+ }
342
+
343
+ renameAt() {
344
+ console.log(`[filesystem] RENAME AT`, this.id);
345
+ }
346
+
347
+ symlinkAt() {
348
+ console.log(`[filesystem] SYMLINK AT`, this.id);
349
+ }
350
+
351
+ unlinkFileAt() {
352
+ console.log(`[filesystem] UNLINK FILE AT`, this.id);
353
+ }
354
+
355
+ changeFilePermissionsAt() {
356
+ console.log(`[filesystem] CHANGE FILE PERMISSIONS AT`, this.id);
357
+ }
358
+
359
+ changeDirectoryPermissionsAt() {
360
+ console.log(`[filesystem] CHANGE DIR PERMISSIONS AT`, this.id);
361
+ }
362
+
363
+ lockShared() {
364
+ console.log(`[filesystem] LOCK SHARED`, this.id);
365
+ }
366
+
367
+ lockExclusive() {
368
+ console.log(`[filesystem] LOCK EXCLUSIVE`, this.id);
369
+ }
370
+
371
+ tryLockShared() {
372
+ console.log(`[filesystem] TRY LOCK SHARED`, this.id);
373
+ }
374
+
375
+ tryLockExclusive() {
376
+ console.log(`[filesystem] TRY LOCK EXCLUSIVE`, this.id);
377
+ }
378
+
379
+ unlock() {
380
+ console.log(`[filesystem] UNLOCK`, this.id);
381
+ }
382
+
383
+ drop() {
384
+ if (this.fd)
385
+ closeSync(this.fd);
386
+ }
387
+
388
+ metadataHash() {
389
+ if (this.hostPreopen)
390
+ return { upper: 0n, lower: BigInt(this.id) };
411
391
  try {
412
- const stats = fstatSync(descriptor.fd, { bigint: true });
392
+ const stats = fstatSync(this.fd, { bigint: true });
413
393
  return { upper: stats.mtimeNs, lower: stats.ino };
414
394
  }
415
395
  catch (e) {
416
396
  convertFsError(e);
417
397
  }
418
- },
398
+ }
419
399
 
420
- metadataHashAt(fd, pathFlags, path) {
421
- const fullPath = fs.getFullPath(fd, path, false);
400
+ metadataHashAt(pathFlags, path) {
401
+ const fullPath = fs.getFullPath(this, path, false);
422
402
  try {
423
403
  const stats = (pathFlags.symlinkFollow ? statSync : lstatSync)(isWindows ? fullPath.slice(1) : fullPath, { bigint: true });
424
404
  return { upper: stats.mtimeNs, lower: stats.ino };
@@ -427,11 +407,27 @@ export class FileSystem {
427
407
  convertFsError(e);
428
408
  }
429
409
  }
410
+ }
411
+
412
+ this.descriptorCnt = 3;
413
+ this.preopenEntries = [];
414
+ for (const [virtualPath, hostPreopen] of Object.entries(preopens)) {
415
+ const preopenEntry = [Object.assign(new Descriptor(), { hostPreopen }), virtualPath];
416
+ this.preopenEntries.push(preopenEntry);
417
+ }
418
+ this.preopens = {
419
+ Descriptor,
420
+ getDirectories () {
421
+ return fs.preopenEntries;
422
+ }
423
+ };
424
+ this.types = {
425
+ Descriptor,
430
426
  };
431
427
  }
432
428
  }
433
429
 
434
- const _fs = new FileSystem(_io, { '/': '/' }, environment);
430
+ const _fs = new FileSystem({ '/': '/' }, environment);
435
431
 
436
432
  export const { preopens, types } = _fs;
437
433
 
@@ -1,5 +1,5 @@
1
1
  import { WasiHttp } from '../http/wasi-http.js';
2
- import { _io } from './io.js';
2
+ import { streams } from '../common/io.js';
3
3
 
4
- const http = new WasiHttp(_io);
4
+ const http = new WasiHttp(streams);
5
5
  export const { incomingHandler, outgoingHandler, types } = http;
@@ -1,8 +1,7 @@
1
1
  import * as clocks from "./clocks.js";
2
2
  import * as filesystem from "./filesystem.js";
3
3
  import * as http from "./http.js";
4
- import * as io from "./io.js";
5
- import * as logging from "./logging.js";
4
+ import * as io from "../common/io.js";
6
5
  import * as poll from "./poll.js";
7
6
  import * as random from "./random.js";
8
7
  import * as sockets from "./sockets.js";
@@ -13,7 +12,6 @@ export {
13
12
  filesystem,
14
13
  http,
15
14
  io,
16
- logging,
17
15
  poll,
18
16
  random,
19
17
  sockets,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/preview2-shim",
3
- "version": "0.0.17",
3
+ "version": "0.0.18",
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",
@@ -11,6 +11,10 @@
11
11
  "node": "./lib/nodejs/index.js",
12
12
  "default": "./lib/browser/index.js"
13
13
  },
14
+ "./io": {
15
+ "types": "./types/io.d.ts",
16
+ "default": "./lib/common/io.js"
17
+ },
14
18
  "./*": {
15
19
  "types": "./types/*.d.ts",
16
20
  "node": "./lib/nodejs/*.js",
@@ -1,13 +1,2 @@
1
1
  export namespace WasiCliTerminalInput {
2
- /**
3
- * Dispose of the specified terminal-input after which it may no longer
4
- * be used.
5
- */
6
- export function dropTerminalInput(this_: TerminalInput): void;
7
2
  }
8
- /**
9
- * The input side of a terminal.
10
- *
11
- * This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
12
- */
13
- export type TerminalInput = number;