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