@yowasp/yosys 0.37.58-dev.635 → 0.37.67-dev.638

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,5 +1,5 @@
1
1
  // node_modules/@yowasp/runtime/lib/api-node.js
2
- import { randomBytes } from "crypto";
2
+ import { readFile } from "fs/promises";
3
3
 
4
4
  // node_modules/@yowasp/runtime/lib/wasi-virt.js
5
5
  var Exit = class extends Error {
@@ -17,15 +17,32 @@ function wallClockNow() {
17
17
  const nanoseconds = now % 1e3 * 1e6;
18
18
  return { seconds, nanoseconds };
19
19
  }
20
- var randomBytesImpl = function() {
21
- throw "not implemented";
20
+ var Xoroshiro128StarStar = class {
21
+ constructor(seed) {
22
+ if (BigInt(seed) === 0n) {
23
+ throw new Error("xoroshiro128** must be seeded with a non-zero state");
24
+ }
25
+ this.s = [BigInt(seed) & 0xffffffffffffffffn, BigInt(seed) >> 64n & 0xffffffffffffffffn];
26
+ }
27
+ next() {
28
+ function trunc64(x) {
29
+ return x & 0xffffffffffffffffn;
30
+ }
31
+ function rotl(x, k) {
32
+ return x << k | x >> 64n - k;
33
+ }
34
+ let [s0, s1] = this.s;
35
+ const r = trunc64(rotl(s0 * 5n, 7n) * 9n);
36
+ s1 ^= s0;
37
+ s0 = trunc64(rotl(s0, 24n) ^ s1 ^ s1 << 16n);
38
+ s1 = trunc64(rotl(s1, 37n));
39
+ this.s = [s0, s1];
40
+ return r;
41
+ }
42
+ getBytes(length) {
43
+ return Uint8Array.from({ length }, () => Number(BigInt.asUintN(8, this.next() >> 32n)));
44
+ }
22
45
  };
23
- function setRandomBytesImpl(impl) {
24
- randomBytesImpl = impl;
25
- }
26
- function getRandomBytes(len) {
27
- return randomBytesImpl(Number(len));
28
- }
29
46
  var IoError = class extends Error {
30
47
  };
31
48
  var InputStream = class {
@@ -53,33 +70,27 @@ var OutputStream = class {
53
70
  this.blockingFlush();
54
71
  }
55
72
  };
56
- var TerminalInput = class {
57
- };
58
- var TerminalOutput = class {
59
- };
60
- var TerminalOutputStream = class extends OutputStream {
61
- buffer = "";
62
- constructor(printLine = console.log) {
73
+ var CallbackOutputStream = class extends OutputStream {
74
+ constructor(callback = null) {
63
75
  super();
64
- this.printLine = printLine;
76
+ this.callback = callback;
65
77
  }
66
78
  checkWrite() {
67
79
  return 4096;
68
80
  }
69
81
  write(contents) {
70
- this.buffer += new TextDecoder().decode(contents);
71
- let newlineAt = -1;
72
- while (true) {
73
- const nextNewlineAt = this.buffer.indexOf("\n", newlineAt + 1);
74
- if (nextNewlineAt === -1) {
75
- break;
76
- }
77
- this.printLine(this.buffer.substring(0, nextNewlineAt));
78
- newlineAt = nextNewlineAt;
79
- }
80
- this.buffer = this.buffer.substring(newlineAt + 1);
82
+ if (this.callback !== null)
83
+ this.callback(contents);
84
+ }
85
+ flush() {
86
+ if (this.callback !== null)
87
+ this.callback(null);
81
88
  }
82
89
  };
90
+ var TerminalInput = class {
91
+ };
92
+ var TerminalOutput = class {
93
+ };
83
94
  var File = class {
84
95
  constructor(data = "") {
85
96
  if (data instanceof Uint8Array) {
@@ -298,8 +309,10 @@ var Environment = class {
298
309
  args = [];
299
310
  root = new Directory({});
300
311
  constructor() {
301
- this.terminalInputStream = new InputStream();
302
- this.terminalOutputStream = new TerminalOutputStream();
312
+ this.prng = new Xoroshiro128StarStar(1n);
313
+ this.standardInputStream = new InputStream();
314
+ this.standardOutputStream = new CallbackOutputStream();
315
+ this.standardErrorStream = new CallbackOutputStream();
303
316
  this.terminalInput = new TerminalInput();
304
317
  this.terminalOutput = new TerminalOutput();
305
318
  const $this = this;
@@ -311,7 +324,9 @@ var Environment = class {
311
324
  now: wallClockNow
312
325
  },
313
326
  random: {
314
- getRandomBytes
327
+ getRandomBytes(length) {
328
+ return $this.prng.getBytes(Number(length));
329
+ }
315
330
  },
316
331
  io: {
317
332
  Error: IoError,
@@ -329,13 +344,13 @@ var Environment = class {
329
344
  return $this.args;
330
345
  },
331
346
  getStdin() {
332
- return $this.terminalInputStream;
347
+ return $this.standardInputStream;
333
348
  },
334
349
  getStdout() {
335
- return $this.terminalOutputStream;
350
+ return $this.standardOutputStream;
336
351
  },
337
352
  getStderr() {
338
- return $this.terminalOutputStream;
353
+ return $this.standardErrorStream;
339
354
  },
340
355
  getTerminalStdin() {
341
356
  return $this.terminalInput;
@@ -362,16 +377,41 @@ var Environment = class {
362
377
  }
363
378
  };
364
379
  }
365
- get printLine() {
366
- return this.terminalOutputStream.printLine;
380
+ get stdout() {
381
+ return this.standardOutputStream.callback;
367
382
  }
368
- set printLine(fn) {
369
- this.terminalOutputStream.printLine = fn;
383
+ set stdout(callback) {
384
+ this.standardOutputStream.callback = callback;
385
+ }
386
+ get stderr() {
387
+ return this.standardErrorStream.callback;
388
+ }
389
+ set stderr(callback) {
390
+ this.standardErrorStream.callback = callback;
370
391
  }
371
392
  };
372
393
 
373
- // node_modules/@yowasp/runtime/lib/api-node.js
374
- import { readFile } from "fs/promises";
394
+ // node_modules/@yowasp/runtime/lib/util.js
395
+ function lineBuffered(processLine) {
396
+ let buffer = new Uint8Array();
397
+ return (bytes) => {
398
+ if (bytes === null)
399
+ return;
400
+ let newBuffer = new Uint8Array(buffer.length + bytes.length);
401
+ newBuffer.set(buffer);
402
+ newBuffer.set(bytes, buffer.length);
403
+ buffer = newBuffer;
404
+ let newlineAt = -1;
405
+ while (true) {
406
+ const nextNewlineAt = buffer.indexOf(10, newlineAt + 1);
407
+ if (nextNewlineAt === -1)
408
+ break;
409
+ processLine(new TextDecoder().decode(buffer.subarray(newlineAt + 1, nextNewlineAt)));
410
+ newlineAt = nextNewlineAt;
411
+ }
412
+ buffer = buffer.subarray(newlineAt + 1);
413
+ };
414
+ }
375
415
 
376
416
  // node_modules/@yowasp/runtime/lib/api-base.js
377
417
  var BaseApplication = class {
@@ -381,7 +421,8 @@ var BaseApplication = class {
381
421
  this.instantiate = instantiate2;
382
422
  this.argv0 = argv0;
383
423
  }
384
- async run(args = null, files = {}, { printLine = console.log, decodeASCII = true } = {}) {
424
+ // The `printLine` option is deprecated and not documented but still accepted for compatibility.
425
+ async run(args = null, files = {}, { stdout, stderr, decodeASCII = true, printLine } = {}) {
385
426
  if (this.resources === null)
386
427
  this.resources = await this._fetchResources();
387
428
  if (args === null)
@@ -391,7 +432,9 @@ var BaseApplication = class {
391
432
  environment.root = directoryFromTree(files);
392
433
  for (const [dirName, dirContents] of Object.entries(this.resources.filesystem))
393
434
  environment.root.files[dirName] = directoryFromTree(dirContents);
394
- environment.printLine = printLine;
435
+ const lineBufferedConsole = lineBuffered(printLine ?? console.log);
436
+ environment.stdout = stdout === void 0 ? lineBufferedConsole : stdout;
437
+ environment.stderr = stderr === void 0 ? lineBufferedConsole : stderr;
395
438
  const wasmCommand = await this.instantiate(
396
439
  (filename) => this.resources.modules[filename],
397
440
  { runtime: environment.exports }
@@ -416,7 +459,6 @@ var BaseApplication = class {
416
459
  }
417
460
  }
418
461
  async _fetchResources() {
419
- console.log(`[YoWASP runtime] Fetching resource bundle ${this.resourceFileURL}`);
420
462
  const { modules, filesystem } = await import(this.resourceFileURL);
421
463
  return {
422
464
  modules: await this._fetchObject(modules, this._fetchWebAssembly),
@@ -424,16 +466,18 @@ var BaseApplication = class {
424
466
  };
425
467
  }
426
468
  async _fetchObject(obj, fetchFn) {
469
+ const promises = [];
427
470
  for (const [key, value] of Object.entries(obj)) {
428
471
  if (value instanceof URL) {
429
- console.log(`[YoWASP runtime] Fetching resource file ${value}`);
430
- obj[key] = await fetchFn(value);
472
+ promises.push(fetchFn(value).then((fetched) => [key, fetched]));
431
473
  } else if (typeof value === "string" || value instanceof Uint8Array) {
432
- obj[key] = value;
474
+ promises.push(Promise.resolve([key, value]));
433
475
  } else {
434
- obj[key] = await this._fetchObject(value, fetchFn);
476
+ promises.push(this._fetchObject(value, fetchFn).then((fetched) => [key, fetched]));
435
477
  }
436
478
  }
479
+ for (const [key, value] of await Promise.all(promises))
480
+ obj[key] = value;
437
481
  return obj;
438
482
  }
439
483
  async _fetchUint8Array(_url) {
@@ -445,7 +489,6 @@ var BaseApplication = class {
445
489
  };
446
490
 
447
491
  // node_modules/@yowasp/runtime/lib/api-node.js
448
- setRandomBytesImpl(randomBytes);
449
492
  var Application = class extends BaseApplication {
450
493
  _fetchUint8Array(url) {
451
494
  return readFile(url);
@@ -540,7 +583,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
540
583
  const ret = now();
541
584
  return toUint64(ret);
542
585
  }
543
- function trampoline9() {
586
+ function trampoline8() {
544
587
  const ret = getStderr();
545
588
  if (!(ret instanceof OutputStream2)) {
546
589
  throw new Error('Resource error: Not a valid "OutputStream" resource.');
@@ -549,7 +592,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
549
592
  handleTable2.set(handle0, { rep: ret, own: true });
550
593
  return handle0;
551
594
  }
552
- function trampoline10(arg0) {
595
+ function trampoline9(arg0) {
553
596
  let variant0;
554
597
  switch (arg0) {
555
598
  case 0: {
@@ -572,7 +615,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
572
615
  }
573
616
  exit(variant0);
574
617
  }
575
- function trampoline11() {
618
+ function trampoline10() {
576
619
  const ret = getStdin();
577
620
  if (!(ret instanceof InputStream2)) {
578
621
  throw new Error('Resource error: Not a valid "InputStream" resource.');
@@ -581,7 +624,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
581
624
  handleTable1.set(handle0, { rep: ret, own: true });
582
625
  return handle0;
583
626
  }
584
- function trampoline12() {
627
+ function trampoline11() {
585
628
  const ret = getStdout();
586
629
  if (!(ret instanceof OutputStream2)) {
587
630
  throw new Error('Resource error: Not a valid "OutputStream" resource.');
@@ -591,7 +634,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
591
634
  return handle0;
592
635
  }
593
636
  let exports2;
594
- function trampoline13(arg0) {
637
+ function trampoline12(arg0) {
595
638
  const ret = getDirectories();
596
639
  var vec3 = ret;
597
640
  var len3 = vec3.length;
@@ -603,8 +646,8 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
603
646
  if (!(tuple0_0 instanceof Descriptor2)) {
604
647
  throw new Error('Resource error: Not a valid "Descriptor" resource.');
605
648
  }
606
- var handle1 = handleCnt3++;
607
- handleTable3.set(handle1, { rep: tuple0_0, own: true });
649
+ var handle1 = handleCnt5++;
650
+ handleTable5.set(handle1, { rep: tuple0_0, own: true });
608
651
  dataView(memory0).setInt32(base + 0, handle1, true);
609
652
  var ptr2 = utf8Encode(tuple0_1, realloc0, memory0);
610
653
  var len2 = utf8EncodedLen;
@@ -616,15 +659,15 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
616
659
  }
617
660
  let memory0;
618
661
  let realloc0;
619
- function trampoline14(arg0) {
662
+ function trampoline13(arg0) {
620
663
  const ret = now$1();
621
664
  var { seconds: v0_0, nanoseconds: v0_1 } = ret;
622
665
  dataView(memory0).setBigInt64(arg0 + 0, toUint64(v0_0), true);
623
666
  dataView(memory0).setInt32(arg0 + 8, toUint32(v0_1), true);
624
667
  }
625
- function trampoline15(arg0, arg1, arg2) {
668
+ function trampoline14(arg0, arg1, arg2) {
626
669
  var handle1 = arg0;
627
- var rsc0 = handleTable3.get(handle1).rep;
670
+ var rsc0 = handleTable5.get(handle1).rep;
628
671
  let ret;
629
672
  try {
630
673
  ret = { tag: "ok", val: Descriptor2.prototype.readViaStream.call(rsc0, BigInt.asUintN(64, arg1)) };
@@ -813,9 +856,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
813
856
  }
814
857
  }
815
858
  }
816
- function trampoline16(arg0, arg1, arg2) {
859
+ function trampoline15(arg0, arg1, arg2) {
817
860
  var handle1 = arg0;
818
- var rsc0 = handleTable3.get(handle1).rep;
861
+ var rsc0 = handleTable5.get(handle1).rep;
819
862
  let ret;
820
863
  try {
821
864
  ret = { tag: "ok", val: Descriptor2.prototype.writeViaStream.call(rsc0, BigInt.asUintN(64, arg1)) };
@@ -1004,9 +1047,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1004
1047
  }
1005
1048
  }
1006
1049
  }
1007
- function trampoline17(arg0, arg1) {
1050
+ function trampoline16(arg0, arg1) {
1008
1051
  var handle1 = arg0;
1009
- var rsc0 = handleTable3.get(handle1).rep;
1052
+ var rsc0 = handleTable5.get(handle1).rep;
1010
1053
  let ret;
1011
1054
  try {
1012
1055
  ret = { tag: "ok", val: Descriptor2.prototype.appendViaStream.call(rsc0) };
@@ -1195,9 +1238,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1195
1238
  }
1196
1239
  }
1197
1240
  }
1198
- function trampoline18(arg0, arg1) {
1241
+ function trampoline17(arg0, arg1) {
1199
1242
  var handle1 = arg0;
1200
- var rsc0 = handleTable3.get(handle1).rep;
1243
+ var rsc0 = handleTable5.get(handle1).rep;
1201
1244
  let ret;
1202
1245
  try {
1203
1246
  ret = { tag: "ok", val: Descriptor2.prototype.getFlags.call(rsc0) };
@@ -1387,9 +1430,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1387
1430
  }
1388
1431
  }
1389
1432
  }
1390
- function trampoline19(arg0, arg1) {
1433
+ function trampoline18(arg0, arg1) {
1391
1434
  var handle1 = arg0;
1392
- var rsc0 = handleTable3.get(handle1).rep;
1435
+ var rsc0 = handleTable5.get(handle1).rep;
1393
1436
  let ret;
1394
1437
  try {
1395
1438
  ret = { tag: "ok", val: Descriptor2.prototype.getType.call(rsc0) };
@@ -1615,9 +1658,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1615
1658
  }
1616
1659
  }
1617
1660
  }
1618
- function trampoline20(arg0, arg1) {
1661
+ function trampoline19(arg0, arg1) {
1619
1662
  var handle1 = arg0;
1620
- var rsc0 = handleTable3.get(handle1).rep;
1663
+ var rsc0 = handleTable5.get(handle1).rep;
1621
1664
  let ret;
1622
1665
  try {
1623
1666
  ret = { tag: "ok", val: Descriptor2.prototype.readDirectory.call(rsc0) };
@@ -1632,8 +1675,8 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1632
1675
  if (!(e instanceof DirectoryEntryStream2)) {
1633
1676
  throw new Error('Resource error: Not a valid "DirectoryEntryStream" resource.');
1634
1677
  }
1635
- var handle2 = handleCnt4++;
1636
- handleTable4.set(handle2, { rep: e, own: true });
1678
+ var handle2 = handleCnt6++;
1679
+ handleTable6.set(handle2, { rep: e, own: true });
1637
1680
  dataView(memory0).setInt32(arg1 + 4, handle2, true);
1638
1681
  break;
1639
1682
  }
@@ -1806,9 +1849,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1806
1849
  }
1807
1850
  }
1808
1851
  }
1809
- function trampoline21(arg0, arg1, arg2, arg3) {
1852
+ function trampoline20(arg0, arg1, arg2, arg3) {
1810
1853
  var handle1 = arg0;
1811
- var rsc0 = handleTable3.get(handle1).rep;
1854
+ var rsc0 = handleTable5.get(handle1).rep;
1812
1855
  var ptr2 = arg1;
1813
1856
  var len2 = arg2;
1814
1857
  var result2 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr2, len2));
@@ -1994,9 +2037,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
1994
2037
  }
1995
2038
  }
1996
2039
  }
1997
- function trampoline22(arg0, arg1) {
2040
+ function trampoline21(arg0, arg1) {
1998
2041
  var handle1 = arg0;
1999
- var rsc0 = handleTable3.get(handle1).rep;
2042
+ var rsc0 = handleTable5.get(handle1).rep;
2000
2043
  let ret;
2001
2044
  try {
2002
2045
  ret = { tag: "ok", val: Descriptor2.prototype.stat.call(rsc0) };
@@ -2255,9 +2298,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
2255
2298
  }
2256
2299
  }
2257
2300
  }
2258
- function trampoline23(arg0, arg1, arg2, arg3, arg4) {
2301
+ function trampoline22(arg0, arg1, arg2, arg3, arg4) {
2259
2302
  var handle1 = arg0;
2260
- var rsc0 = handleTable3.get(handle1).rep;
2303
+ var rsc0 = handleTable5.get(handle1).rep;
2261
2304
  if ((arg1 & 4294967294) !== 0) {
2262
2305
  throw new TypeError("flags have extraneous bits set");
2263
2306
  }
@@ -2525,9 +2568,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
2525
2568
  }
2526
2569
  }
2527
2570
  }
2528
- function trampoline24(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
2571
+ function trampoline23(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
2529
2572
  var handle1 = arg0;
2530
- var rsc0 = handleTable3.get(handle1).rep;
2573
+ var rsc0 = handleTable5.get(handle1).rep;
2531
2574
  if ((arg1 & 4294967294) !== 0) {
2532
2575
  throw new TypeError("flags have extraneous bits set");
2533
2576
  }
@@ -2571,8 +2614,8 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
2571
2614
  if (!(e instanceof Descriptor2)) {
2572
2615
  throw new Error('Resource error: Not a valid "Descriptor" resource.');
2573
2616
  }
2574
- var handle6 = handleCnt3++;
2575
- handleTable3.set(handle6, { rep: e, own: true });
2617
+ var handle6 = handleCnt5++;
2618
+ handleTable5.set(handle6, { rep: e, own: true });
2576
2619
  dataView(memory0).setInt32(arg6 + 4, handle6, true);
2577
2620
  break;
2578
2621
  }
@@ -2745,9 +2788,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
2745
2788
  }
2746
2789
  }
2747
2790
  }
2748
- function trampoline25(arg0, arg1, arg2, arg3) {
2791
+ function trampoline24(arg0, arg1, arg2, arg3) {
2749
2792
  var handle1 = arg0;
2750
- var rsc0 = handleTable3.get(handle1).rep;
2793
+ var rsc0 = handleTable5.get(handle1).rep;
2751
2794
  var ptr2 = arg1;
2752
2795
  var len2 = arg2;
2753
2796
  var result2 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr2, len2));
@@ -2933,9 +2976,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
2933
2976
  }
2934
2977
  }
2935
2978
  }
2936
- function trampoline26(arg0, arg1, arg2, arg3) {
2979
+ function trampoline25(arg0, arg1, arg2, arg3) {
2937
2980
  var handle1 = arg0;
2938
- var rsc0 = handleTable3.get(handle1).rep;
2981
+ var rsc0 = handleTable5.get(handle1).rep;
2939
2982
  var ptr2 = arg1;
2940
2983
  var len2 = arg2;
2941
2984
  var result2 = utf8Decoder.decode(new Uint8Array(memory0.buffer, ptr2, len2));
@@ -3121,9 +3164,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3121
3164
  }
3122
3165
  }
3123
3166
  }
3124
- function trampoline27(arg0, arg1) {
3167
+ function trampoline26(arg0, arg1) {
3125
3168
  var handle1 = arg0;
3126
- var rsc0 = handleTable3.get(handle1).rep;
3169
+ var rsc0 = handleTable5.get(handle1).rep;
3127
3170
  let ret;
3128
3171
  try {
3129
3172
  ret = { tag: "ok", val: Descriptor2.prototype.metadataHash.call(rsc0) };
@@ -3309,9 +3352,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3309
3352
  }
3310
3353
  }
3311
3354
  }
3312
- function trampoline28(arg0, arg1, arg2, arg3, arg4) {
3355
+ function trampoline27(arg0, arg1, arg2, arg3, arg4) {
3313
3356
  var handle1 = arg0;
3314
- var rsc0 = handleTable3.get(handle1).rep;
3357
+ var rsc0 = handleTable5.get(handle1).rep;
3315
3358
  if ((arg1 & 4294967294) !== 0) {
3316
3359
  throw new TypeError("flags have extraneous bits set");
3317
3360
  }
@@ -3506,9 +3549,9 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3506
3549
  }
3507
3550
  }
3508
3551
  }
3509
- function trampoline29(arg0, arg1) {
3552
+ function trampoline28(arg0, arg1) {
3510
3553
  var handle1 = arg0;
3511
- var rsc0 = handleTable4.get(handle1).rep;
3554
+ var rsc0 = handleTable6.get(handle1).rep;
3512
3555
  let ret;
3513
3556
  try {
3514
3557
  ret = { tag: "ok", val: DirectoryEntryStream2.prototype.readDirectoryEntry.call(rsc0) };
@@ -3746,7 +3789,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3746
3789
  }
3747
3790
  }
3748
3791
  }
3749
- function trampoline30(arg0, arg1) {
3792
+ function trampoline29(arg0, arg1) {
3750
3793
  var handle1 = arg0;
3751
3794
  var rsc0 = handleTable0.get(handle1).rep;
3752
3795
  const ret = filesystemErrorCode(rsc0);
@@ -3917,7 +3960,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3917
3960
  dataView(memory0).setInt8(arg1 + 1, enum2, true);
3918
3961
  }
3919
3962
  }
3920
- function trampoline31(arg0, arg1, arg2) {
3963
+ function trampoline30(arg0, arg1, arg2) {
3921
3964
  var handle1 = arg0;
3922
3965
  var rsc0 = handleTable1.get(handle1).rep;
3923
3966
  let ret;
@@ -3971,7 +4014,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
3971
4014
  }
3972
4015
  }
3973
4016
  }
3974
- function trampoline32(arg0, arg1, arg2) {
4017
+ function trampoline31(arg0, arg1, arg2) {
3975
4018
  var handle1 = arg0;
3976
4019
  var rsc0 = handleTable1.get(handle1).rep;
3977
4020
  let ret;
@@ -4025,7 +4068,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4025
4068
  }
4026
4069
  }
4027
4070
  }
4028
- function trampoline33(arg0, arg1) {
4071
+ function trampoline32(arg0, arg1) {
4029
4072
  var handle1 = arg0;
4030
4073
  var rsc0 = handleTable2.get(handle1).rep;
4031
4074
  let ret;
@@ -4073,7 +4116,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4073
4116
  }
4074
4117
  }
4075
4118
  }
4076
- function trampoline34(arg0, arg1, arg2, arg3) {
4119
+ function trampoline33(arg0, arg1, arg2, arg3) {
4077
4120
  var handle1 = arg0;
4078
4121
  var rsc0 = handleTable2.get(handle1).rep;
4079
4122
  var ptr2 = arg1;
@@ -4123,7 +4166,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4123
4166
  }
4124
4167
  }
4125
4168
  }
4126
- function trampoline35(arg0, arg1, arg2, arg3) {
4169
+ function trampoline34(arg0, arg1, arg2, arg3) {
4127
4170
  var handle1 = arg0;
4128
4171
  var rsc0 = handleTable2.get(handle1).rep;
4129
4172
  var ptr2 = arg1;
@@ -4173,7 +4216,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4173
4216
  }
4174
4217
  }
4175
4218
  }
4176
- function trampoline36(arg0, arg1) {
4219
+ function trampoline35(arg0, arg1) {
4177
4220
  var handle1 = arg0;
4178
4221
  var rsc0 = handleTable2.get(handle1).rep;
4179
4222
  let ret;
@@ -4220,7 +4263,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4220
4263
  }
4221
4264
  }
4222
4265
  }
4223
- function trampoline37(arg0) {
4266
+ function trampoline36(arg0) {
4224
4267
  const ret = getEnvironment();
4225
4268
  var vec3 = ret;
4226
4269
  var len3 = vec3.length;
@@ -4241,7 +4284,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4241
4284
  dataView(memory0).setInt32(arg0 + 4, len3, true);
4242
4285
  dataView(memory0).setInt32(arg0 + 0, result3, true);
4243
4286
  }
4244
- function trampoline38(arg0) {
4287
+ function trampoline37(arg0) {
4245
4288
  const ret = getArguments();
4246
4289
  var vec1 = ret;
4247
4290
  var len1 = vec1.length;
@@ -4257,7 +4300,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4257
4300
  dataView(memory0).setInt32(arg0 + 4, len1, true);
4258
4301
  dataView(memory0).setInt32(arg0 + 0, result1, true);
4259
4302
  }
4260
- function trampoline39(arg0) {
4303
+ function trampoline38(arg0) {
4261
4304
  const ret = getTerminalStdin();
4262
4305
  var variant1 = ret;
4263
4306
  if (variant1 === null || variant1 === void 0) {
@@ -4268,12 +4311,12 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4268
4311
  if (!(e instanceof TerminalInput2)) {
4269
4312
  throw new Error('Resource error: Not a valid "TerminalInput" resource.');
4270
4313
  }
4271
- var handle0 = handleCnt6++;
4272
- handleTable6.set(handle0, { rep: e, own: true });
4314
+ var handle0 = handleCnt3++;
4315
+ handleTable3.set(handle0, { rep: e, own: true });
4273
4316
  dataView(memory0).setInt32(arg0 + 4, handle0, true);
4274
4317
  }
4275
4318
  }
4276
- function trampoline40(arg0) {
4319
+ function trampoline39(arg0) {
4277
4320
  const ret = getTerminalStdout();
4278
4321
  var variant1 = ret;
4279
4322
  if (variant1 === null || variant1 === void 0) {
@@ -4284,12 +4327,12 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4284
4327
  if (!(e instanceof TerminalOutput2)) {
4285
4328
  throw new Error('Resource error: Not a valid "TerminalOutput" resource.');
4286
4329
  }
4287
- var handle0 = handleCnt7++;
4288
- handleTable7.set(handle0, { rep: e, own: true });
4330
+ var handle0 = handleCnt4++;
4331
+ handleTable4.set(handle0, { rep: e, own: true });
4289
4332
  dataView(memory0).setInt32(arg0 + 4, handle0, true);
4290
4333
  }
4291
4334
  }
4292
- function trampoline41(arg0) {
4335
+ function trampoline40(arg0) {
4293
4336
  const ret = getTerminalStderr();
4294
4337
  var variant1 = ret;
4295
4338
  if (variant1 === null || variant1 === void 0) {
@@ -4300,18 +4343,18 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4300
4343
  if (!(e instanceof TerminalOutput2)) {
4301
4344
  throw new Error('Resource error: Not a valid "TerminalOutput" resource.');
4302
4345
  }
4303
- var handle0 = handleCnt7++;
4304
- handleTable7.set(handle0, { rep: e, own: true });
4346
+ var handle0 = handleCnt4++;
4347
+ handleTable4.set(handle0, { rep: e, own: true });
4305
4348
  dataView(memory0).setInt32(arg0 + 4, handle0, true);
4306
4349
  }
4307
4350
  }
4308
4351
  let exports3;
4309
4352
  function trampoline1(handle) {
4310
- const handleEntry = handleTable4.get(handle);
4353
+ const handleEntry = handleTable6.get(handle);
4311
4354
  if (!handleEntry) {
4312
4355
  throw new Error(`Resource error: Invalid handle ${handle}`);
4313
4356
  }
4314
- handleTable4.delete(handle);
4357
+ handleTable6.delete(handle);
4315
4358
  if (handleEntry.own && handleEntry.rep[symbolDispose]) {
4316
4359
  handleEntry.rep[symbolDispose]();
4317
4360
  }
@@ -4347,16 +4390,6 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4347
4390
  }
4348
4391
  }
4349
4392
  function trampoline5(handle) {
4350
- const handleEntry = handleTable3.get(handle);
4351
- if (!handleEntry) {
4352
- throw new Error(`Resource error: Invalid handle ${handle}`);
4353
- }
4354
- handleTable3.delete(handle);
4355
- if (handleEntry.own && handleEntry.rep[symbolDispose]) {
4356
- handleEntry.rep[symbolDispose]();
4357
- }
4358
- }
4359
- function trampoline6(handle) {
4360
4393
  const handleEntry = handleTable5.get(handle);
4361
4394
  if (!handleEntry) {
4362
4395
  throw new Error(`Resource error: Invalid handle ${handle}`);
@@ -4366,22 +4399,22 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4366
4399
  handleEntry.rep[symbolDispose]();
4367
4400
  }
4368
4401
  }
4369
- function trampoline7(handle) {
4370
- const handleEntry = handleTable7.get(handle);
4402
+ function trampoline6(handle) {
4403
+ const handleEntry = handleTable4.get(handle);
4371
4404
  if (!handleEntry) {
4372
4405
  throw new Error(`Resource error: Invalid handle ${handle}`);
4373
4406
  }
4374
- handleTable7.delete(handle);
4407
+ handleTable4.delete(handle);
4375
4408
  if (handleEntry.own && handleEntry.rep[symbolDispose]) {
4376
4409
  handleEntry.rep[symbolDispose]();
4377
4410
  }
4378
4411
  }
4379
- function trampoline8(handle) {
4380
- const handleEntry = handleTable6.get(handle);
4412
+ function trampoline7(handle) {
4413
+ const handleEntry = handleTable3.get(handle);
4381
4414
  if (!handleEntry) {
4382
4415
  throw new Error(`Resource error: Invalid handle ${handle}`);
4383
4416
  }
4384
- handleTable6.delete(handle);
4417
+ handleTable3.delete(handle);
4385
4418
  if (handleEntry.own && handleEntry.rep[symbolDispose]) {
4386
4419
  handleEntry.rep[symbolDispose]();
4387
4420
  }
@@ -4421,35 +4454,35 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4421
4454
  env: {
4422
4455
  memory: exports1.memory
4423
4456
  },
4424
- "wasi:cli/environment@0.2.0-rc-2023-11-10": {
4457
+ "wasi:cli/environment@0.2.0-rc-2023-12-05": {
4425
4458
  "get-arguments": exports0["25"],
4426
4459
  "get-environment": exports0["24"]
4427
4460
  },
4428
- "wasi:cli/exit@0.2.0-rc-2023-11-10": {
4429
- exit: trampoline10
4461
+ "wasi:cli/exit@0.2.0-rc-2023-12-05": {
4462
+ exit: trampoline9
4430
4463
  },
4431
- "wasi:cli/stderr@0.2.0-rc-2023-11-10": {
4432
- "get-stderr": trampoline9
4464
+ "wasi:cli/stderr@0.2.0-rc-2023-12-05": {
4465
+ "get-stderr": trampoline8
4433
4466
  },
4434
- "wasi:cli/stdin@0.2.0-rc-2023-11-10": {
4435
- "get-stdin": trampoline11
4467
+ "wasi:cli/stdin@0.2.0-rc-2023-12-05": {
4468
+ "get-stdin": trampoline10
4436
4469
  },
4437
- "wasi:cli/stdout@0.2.0-rc-2023-11-10": {
4438
- "get-stdout": trampoline12
4470
+ "wasi:cli/stdout@0.2.0-rc-2023-12-05": {
4471
+ "get-stdout": trampoline11
4439
4472
  },
4440
- "wasi:cli/terminal-input@0.2.0-rc-2023-11-10": {
4441
- "[resource-drop]terminal-input": trampoline8
4473
+ "wasi:cli/terminal-input@0.2.0-rc-2023-12-05": {
4474
+ "[resource-drop]terminal-input": trampoline7
4442
4475
  },
4443
- "wasi:cli/terminal-output@0.2.0-rc-2023-11-10": {
4444
- "[resource-drop]terminal-output": trampoline7
4476
+ "wasi:cli/terminal-output@0.2.0-rc-2023-12-05": {
4477
+ "[resource-drop]terminal-output": trampoline6
4445
4478
  },
4446
- "wasi:cli/terminal-stderr@0.2.0-rc-2023-11-10": {
4479
+ "wasi:cli/terminal-stderr@0.2.0-rc-2023-12-05": {
4447
4480
  "get-terminal-stderr": exports0["28"]
4448
4481
  },
4449
- "wasi:cli/terminal-stdin@0.2.0-rc-2023-11-10": {
4482
+ "wasi:cli/terminal-stdin@0.2.0-rc-2023-12-05": {
4450
4483
  "get-terminal-stdin": exports0["26"]
4451
4484
  },
4452
- "wasi:cli/terminal-stdout@0.2.0-rc-2023-11-10": {
4485
+ "wasi:cli/terminal-stdout@0.2.0-rc-2023-12-05": {
4453
4486
  "get-terminal-stdout": exports0["27"]
4454
4487
  },
4455
4488
  "wasi:clocks/monotonic-clock@0.2.0-rc-2023-11-10": {
@@ -4493,9 +4526,6 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4493
4526
  "[method]output-stream.write": exports0["21"],
4494
4527
  "[resource-drop]input-stream": trampoline3,
4495
4528
  "[resource-drop]output-stream": trampoline4
4496
- },
4497
- "wasi:sockets/tcp@0.2.0-rc-2023-11-10": {
4498
- "[resource-drop]tcp-socket": trampoline6
4499
4529
  }
4500
4530
  }));
4501
4531
  memory0 = exports1.memory;
@@ -4503,30 +4533,30 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4503
4533
  ({ exports: exports3 } = await instantiateCore(await module3, {
4504
4534
  "": {
4505
4535
  $imports: exports0.$imports,
4506
- "0": trampoline13,
4507
- "1": trampoline14,
4508
- "10": trampoline23,
4509
- "11": trampoline24,
4510
- "12": trampoline25,
4511
- "13": trampoline26,
4512
- "14": trampoline27,
4513
- "15": trampoline28,
4514
- "16": trampoline29,
4515
- "17": trampoline30,
4516
- "18": trampoline31,
4517
- "19": trampoline32,
4518
- "2": trampoline15,
4519
- "20": trampoline33,
4520
- "21": trampoline34,
4521
- "22": trampoline35,
4522
- "23": trampoline36,
4523
- "24": trampoline37,
4524
- "25": trampoline38,
4525
- "26": trampoline39,
4526
- "27": trampoline40,
4527
- "28": trampoline41,
4536
+ "0": trampoline12,
4537
+ "1": trampoline13,
4538
+ "10": trampoline22,
4539
+ "11": trampoline23,
4540
+ "12": trampoline24,
4541
+ "13": trampoline25,
4542
+ "14": trampoline26,
4543
+ "15": trampoline27,
4544
+ "16": trampoline28,
4545
+ "17": trampoline29,
4546
+ "18": trampoline30,
4547
+ "19": trampoline31,
4548
+ "2": trampoline14,
4549
+ "20": trampoline32,
4550
+ "21": trampoline33,
4551
+ "22": trampoline34,
4552
+ "23": trampoline35,
4553
+ "24": trampoline36,
4554
+ "25": trampoline37,
4555
+ "26": trampoline38,
4556
+ "27": trampoline39,
4557
+ "28": trampoline40,
4528
4558
  "29": exports2.args_get,
4529
- "3": trampoline16,
4559
+ "3": trampoline15,
4530
4560
  "30": exports2.args_sizes_get,
4531
4561
  "31": exports2.environ_get,
4532
4562
  "32": exports2.environ_sizes_get,
@@ -4537,7 +4567,7 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4537
4567
  "37": exports2.fd_prestat_get,
4538
4568
  "38": exports2.fd_prestat_dir_name,
4539
4569
  "39": exports2.fd_read,
4540
- "4": trampoline17,
4570
+ "4": trampoline16,
4541
4571
  "40": exports2.fd_readdir,
4542
4572
  "41": exports2.fd_renumber,
4543
4573
  "42": exports2.fd_seek,
@@ -4548,15 +4578,15 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4548
4578
  "47": exports2.path_remove_directory,
4549
4579
  "48": exports2.path_unlink_file,
4550
4580
  "49": exports2.proc_exit,
4551
- "5": trampoline18,
4552
- "6": trampoline19,
4553
- "7": trampoline20,
4554
- "8": trampoline21,
4555
- "9": trampoline22
4581
+ "5": trampoline17,
4582
+ "6": trampoline18,
4583
+ "7": trampoline19,
4584
+ "8": trampoline20,
4585
+ "9": trampoline21
4556
4586
  }
4557
4587
  }));
4558
4588
  function run() {
4559
- const ret = exports2["wasi:cli/run@0.2.0-rc-2023-11-10#run"]();
4589
+ const ret = exports2["wasi:cli/run@0.2.0-rc-2023-12-05#run"]();
4560
4590
  let variant0;
4561
4591
  switch (ret) {
4562
4592
  case 0: {
@@ -4596,12 +4626,10 @@ async function instantiate(getCoreModule, imports, instantiateCore = WebAssembly
4596
4626
  let handleCnt5 = 0;
4597
4627
  const handleTable6 = /* @__PURE__ */ new Map();
4598
4628
  let handleCnt6 = 0;
4599
- const handleTable7 = /* @__PURE__ */ new Map();
4600
- let handleCnt7 = 0;
4601
- const run0_2_0Rc20231110 = {
4629
+ const run0_2_0Rc20231205 = {
4602
4630
  run
4603
4631
  };
4604
- return { run: run0_2_0Rc20231110, "wasi:cli/run@0.2.0-rc-2023-11-10": run0_2_0Rc20231110 };
4632
+ return { run: run0_2_0Rc20231205, "wasi:cli/run@0.2.0-rc-2023-12-05": run0_2_0Rc20231205 };
4605
4633
  }
4606
4634
 
4607
4635
  // lib/api.js