@bytecodealliance/jco 1.15.1 → 1.15.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.
@@ -150,8 +150,9 @@ class AsyncTask {
150
150
  #state;
151
151
  #isAsync;
152
152
  #onResolve = null;
153
- #returnedResults = null;
154
153
  #entryFnName = null;
154
+ #subtasks = [];
155
+ #completionPromise = null;
155
156
 
156
157
  cancelled = false;
157
158
  requested = false;
@@ -164,6 +165,7 @@ class AsyncTask {
164
165
  awaitableResume = null;
165
166
  awaitableCancel = null;
166
167
 
168
+
167
169
  constructor(opts) {
168
170
  if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
169
171
  this.#id = opts.id;
@@ -175,8 +177,16 @@ class AsyncTask {
175
177
  this.#isAsync = opts?.isAsync ?? false;
176
178
  this.#entryFnName = opts.entryFnName;
177
179
 
180
+ const {
181
+ promise: completionPromise,
182
+ resolve: resolveCompletionPromise,
183
+ reject: rejectCompletionPromise,
184
+ } = Promise.withResolvers();
185
+ this.#completionPromise = completionPromise;
186
+
178
187
  this.#onResolve = (results) => {
179
- this.#returnedResults = results;
188
+ // TODO: handle external facing cancellation (should likely be a rejection)
189
+ resolveCompletionPromise(results);
180
190
  }
181
191
  }
182
192
 
@@ -184,13 +194,8 @@ class AsyncTask {
184
194
  id() { return this.#id; }
185
195
  componentIdx() { return this.#componentIdx; }
186
196
  isAsync() { return this.#isAsync; }
187
- getEntryFnName() { return this.#entryFnName; }
188
-
189
- takeResults() {
190
- const results = this.#returnedResults;
191
- this.#returnedResults = null;
192
- return results;
193
- }
197
+ entryFnName() { return this.#entryFnName; }
198
+ completionPromise() { return this.#completionPromise; }
194
199
 
195
200
  mayEnter(task) {
196
201
  const cstate = getOrCreateAsyncState(this.#componentIdx);
@@ -221,7 +226,6 @@ class AsyncTask {
221
226
  let mayNotEnter = !this.mayEnter(this);
222
227
  const componentHasPendingTasks = cstate.pendingTasks > 0;
223
228
  if (mayNotEnter || componentHasPendingTasks) {
224
-
225
229
  throw new Error('in enter()'); // TODO: remove
226
230
  cstate.pendingTasks.set(this.#id, new Awaitable(new Promise()));
227
231
 
@@ -233,7 +237,7 @@ class AsyncTask {
233
237
  throw new Error('pending task [' + this.#id + '] not found for component instance');
234
238
  }
235
239
  cstate.pendingTasks.remove(this.#id);
236
- this.#onResolve([]);
240
+ this.#onResolve(new Error('failed enter'));
237
241
  return false;
238
242
  }
239
243
 
@@ -386,7 +390,6 @@ class AsyncTask {
386
390
  }
387
391
  }
388
392
 
389
- // NOTE: this should likely be moved to a SubTask class
390
393
  async asyncOnBlock(awaitable) {
391
394
  _debugLog('[AsyncTask#asyncOnBlock()] args', { taskID: this.#id, awaitable });
392
395
  if (!(awaitable instanceof Awaitable)) {
@@ -456,20 +459,23 @@ class AsyncTask {
456
459
  }
457
460
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
458
461
 
459
- this.#onResolve([]);
462
+ this.#onResolve(new Error('cancelled'));
460
463
  this.#state = AsyncTask.State.RESOLVED;
461
464
  }
462
465
 
463
- resolve(result) {
466
+ resolve(results) {
467
+ _debugLog('[AsyncTask#resolve()] args', { results });
464
468
  if (this.#state === AsyncTask.State.RESOLVED) {
465
469
  throw new Error('task is already resolved');
466
470
  }
467
471
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
468
- this.#onResolve(result);
472
+ this.#onResolve(results.length === 1 ? results[0] : results);
469
473
  this.#state = AsyncTask.State.RESOLVED;
470
474
  }
471
475
 
472
476
  exit() {
477
+ _debugLog('[AsyncTask#exit()] args', { });
478
+
473
479
  // TODO: ensure there is only one task at a time (scheduler.lock() functionality)
474
480
  if (this.#state !== AsyncTask.State.RESOLVED) {
475
481
  throw new Error('task exited without resolution');
@@ -488,10 +494,35 @@ class AsyncTask {
488
494
  this.startPendingTask();
489
495
  }
490
496
 
491
- startPendingTask(opts) {
492
- // TODO: implement
497
+ startPendingTask(args) {
498
+ _debugLog('[AsyncTask#startPendingTask()] args', args);
499
+ throw new Error('AsyncTask#startPendingTask() not implemented');
493
500
  }
494
501
 
502
+ createSubtask(args) {
503
+ _debugLog('[AsyncTask#createSubtask()] args', args);
504
+ const newSubtask = new AsyncSubtask({
505
+ componentIdx: this.componentIdx(),
506
+ taskID: this.id(),
507
+ memoryIdx: args?.memoryIdx,
508
+ });
509
+ this.#subtasks.push(newSubtask);
510
+ return newSubtask;
511
+ }
512
+
513
+ currentSubtask() {
514
+ _debugLog('[AsyncTask#currentSubtask()]');
515
+ if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
516
+ return this.#subtasks.at(-1);
517
+ }
518
+
519
+ endCurrentSubtask() {
520
+ _debugLog('[AsyncTask#endCurrentSubtask()]');
521
+ if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
522
+ const subtask = this.#subtasks.pop();
523
+ subtask.drop();
524
+ return subtask;
525
+ }
495
526
  }
496
527
 
497
528
  function unpackCallbackResult(result) {
@@ -520,7 +551,7 @@ class ComponentAsyncState {
520
551
  #syncImportWait = Promise.withResolvers();
521
552
  #lock = null;
522
553
 
523
- mayLeave = false;
554
+ mayLeave = true;
524
555
  waitableSets = new RepTable();
525
556
  waitables = new RepTable();
526
557
 
@@ -626,6 +657,45 @@ isExclusivelyLocked() { return this.#lock !== null; }
626
657
 
627
658
  }
628
659
 
660
+ function prepareCall(memoryIdx) {
661
+ _debugLog('[prepareCall()] args', { memoryIdx });
662
+
663
+ const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
664
+ if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
665
+
666
+ const task = taskMeta.task;
667
+ if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
668
+
669
+ const state = getOrCreateAsyncState(task.componentIdx());
670
+ if (!state) {
671
+ throw new Error('invalid/missing async state for component instance [' + componentInstanceID + ']');
672
+ }
673
+
674
+ const subtask = task.createSubtask({
675
+ memoryIdx,
676
+ });
677
+
678
+ }
679
+
680
+ function asyncStartCall(callbackIdx, postReturnIdx) {
681
+ _debugLog('[asyncStartCall()] args', { callbackIdx, postReturnIdx });
682
+
683
+ const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
684
+ if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
685
+
686
+ const task = taskMeta.task;
687
+ if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
688
+
689
+ const subtask = task.currentSubtask();
690
+ if (!subtask) { throw new Error('invalid/missing subtask during async start call'); }
691
+
692
+ return Number(subtask.waitableRep()) << 4 | subtask.getStateNumber();
693
+ }
694
+
695
+ function syncStartCall(callbackIdx) {
696
+ _debugLog('[syncStartCall()] args', { callbackIdx });
697
+ }
698
+
629
699
  if (!Promise.withResolvers) {
630
700
  Promise.withResolvers = () => {
631
701
  let resolve;
@@ -695,39 +765,42 @@ class RepTable {
695
765
  this.#data.push(null);
696
766
  return (this.#data.length >> 1) - 1;
697
767
  }
698
- this.#data[0] = this.#data[freeIdx];
699
- const newFreeIdx = freeIdx << 1;
700
- this.#data[newFreeIdx] = val;
701
- this.#data[newFreeIdx + 1] = null;
702
- return free;
768
+ this.#data[0] = this.#data[freeIdx << 1];
769
+ const placementIdx = freeIdx << 1;
770
+ this.#data[placementIdx] = val;
771
+ this.#data[placementIdx + 1] = null;
772
+ return freeIdx;
703
773
  }
704
774
 
705
775
  get(rep) {
706
- _debugLog('[RepTable#insert()] args', { rep });
707
- const baseIdx = idx << 1;
776
+ _debugLog('[RepTable#get()] args', { rep });
777
+ const baseIdx = rep << 1;
708
778
  const val = this.#data[baseIdx];
709
779
  return val;
710
780
  }
711
781
 
712
782
  contains(rep) {
713
- _debugLog('[RepTable#insert()] args', { rep });
714
- const baseIdx = idx << 1;
783
+ _debugLog('[RepTable#contains()] args', { rep });
784
+ const baseIdx = rep << 1;
715
785
  return !!this.#data[baseIdx];
716
786
  }
717
787
 
718
788
  remove(rep) {
719
- _debugLog('[RepTable#insert()] args', { idx });
789
+ _debugLog('[RepTable#remove()] args', { rep });
720
790
  if (this.#data.length === 2) { throw new Error('invalid'); }
721
791
 
722
- const baseIdx = idx << 1;
792
+ const baseIdx = rep << 1;
723
793
  const val = this.#data[baseIdx];
724
794
  if (val === 0) { throw new Error('invalid resource rep (cannot be 0)'); }
795
+
725
796
  this.#data[baseIdx] = this.#data[0];
726
- this.#data[0] = idx;
797
+ this.#data[0] = rep;
798
+
727
799
  return val;
728
800
  }
729
801
 
730
802
  clear() {
803
+ _debugLog('[RepTable#clear()] args', { rep });
731
804
  this.#data = [0, null];
732
805
  }
733
806
  }
@@ -766,6 +839,7 @@ function trampoline5() {
766
839
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"][Instruction::Return]', {
767
840
  funcName: 'get-stderr',
768
841
  paramCount: 1,
842
+ async: false,
769
843
  postReturn: false
770
844
  });
771
845
  return handle0;
@@ -794,6 +868,7 @@ function trampoline8() {
794
868
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"][Instruction::Return]', {
795
869
  funcName: 'get-stdin',
796
870
  paramCount: 1,
871
+ async: false,
797
872
  postReturn: false
798
873
  });
799
874
  return handle0;
@@ -818,6 +893,7 @@ function trampoline9() {
818
893
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"][Instruction::Return]', {
819
894
  funcName: 'get-stdout',
820
895
  paramCount: 1,
896
+ async: false,
821
897
  postReturn: false
822
898
  });
823
899
  return handle0;
@@ -853,6 +929,7 @@ function trampoline10(arg0) {
853
929
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
854
930
  funcName: 'exit',
855
931
  paramCount: 0,
932
+ async: false,
856
933
  postReturn: false
857
934
  });
858
935
  }
@@ -887,6 +964,7 @@ function trampoline11(arg0) {
887
964
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"][Instruction::Return]', {
888
965
  funcName: 'get-environment',
889
966
  paramCount: 0,
967
+ async: false,
890
968
  postReturn: false
891
969
  });
892
970
  }
@@ -1143,6 +1221,7 @@ function trampoline12(arg0, arg1) {
1143
1221
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"][Instruction::Return]', {
1144
1222
  funcName: '[method]descriptor.get-type',
1145
1223
  paramCount: 0,
1224
+ async: false,
1146
1225
  postReturn: false
1147
1226
  });
1148
1227
  }
@@ -1354,6 +1433,7 @@ function trampoline13(arg0, arg1) {
1354
1433
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash"][Instruction::Return]', {
1355
1434
  funcName: '[method]descriptor.metadata-hash',
1356
1435
  paramCount: 0,
1436
+ async: false,
1357
1437
  postReturn: false
1358
1438
  });
1359
1439
  }
@@ -1552,6 +1632,7 @@ function trampoline14(arg0, arg1) {
1552
1632
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"][Instruction::Return]', {
1553
1633
  funcName: 'filesystem-error-code',
1554
1634
  paramCount: 0,
1635
+ async: false,
1555
1636
  postReturn: false
1556
1637
  });
1557
1638
  }
@@ -1772,6 +1853,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1772
1853
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash-at"][Instruction::Return]', {
1773
1854
  funcName: '[method]descriptor.metadata-hash-at',
1774
1855
  paramCount: 0,
1856
+ async: false,
1775
1857
  postReturn: false
1776
1858
  });
1777
1859
  }
@@ -1990,6 +2072,7 @@ function trampoline16(arg0, arg1, arg2) {
1990
2072
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-via-stream"][Instruction::Return]', {
1991
2073
  funcName: '[method]descriptor.read-via-stream',
1992
2074
  paramCount: 0,
2075
+ async: false,
1993
2076
  postReturn: false
1994
2077
  });
1995
2078
  }
@@ -2208,6 +2291,7 @@ function trampoline17(arg0, arg1, arg2) {
2208
2291
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
2209
2292
  funcName: '[method]descriptor.write-via-stream',
2210
2293
  paramCount: 0,
2294
+ async: false,
2211
2295
  postReturn: false
2212
2296
  });
2213
2297
  }
@@ -2426,6 +2510,7 @@ function trampoline18(arg0, arg1) {
2426
2510
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
2427
2511
  funcName: '[method]descriptor.append-via-stream',
2428
2512
  paramCount: 0,
2513
+ async: false,
2429
2514
  postReturn: false
2430
2515
  });
2431
2516
  }
@@ -2648,6 +2733,7 @@ function trampoline19(arg0, arg1) {
2648
2733
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-directory"][Instruction::Return]', {
2649
2734
  funcName: '[method]descriptor.read-directory',
2650
2735
  paramCount: 0,
2736
+ async: false,
2651
2737
  postReturn: false
2652
2738
  });
2653
2739
  }
@@ -2933,6 +3019,7 @@ function trampoline20(arg0, arg1) {
2933
3019
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"][Instruction::Return]', {
2934
3020
  funcName: '[method]descriptor.stat',
2935
3021
  paramCount: 0,
3022
+ async: false,
2936
3023
  postReturn: false
2937
3024
  });
2938
3025
  }
@@ -3227,6 +3314,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
3227
3314
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat-at"][Instruction::Return]', {
3228
3315
  funcName: '[method]descriptor.stat-at',
3229
3316
  paramCount: 0,
3317
+ async: false,
3230
3318
  postReturn: false
3231
3319
  });
3232
3320
  }
@@ -3474,6 +3562,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3474
3562
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.open-at"][Instruction::Return]', {
3475
3563
  funcName: '[method]descriptor.open-at',
3476
3564
  paramCount: 0,
3565
+ async: false,
3477
3566
  postReturn: false
3478
3567
  });
3479
3568
  }
@@ -3738,6 +3827,7 @@ function trampoline23(arg0, arg1) {
3738
3827
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]directory-entry-stream.read-directory-entry"][Instruction::Return]', {
3739
3828
  funcName: '[method]directory-entry-stream.read-directory-entry',
3740
3829
  paramCount: 0,
3830
+ async: false,
3741
3831
  postReturn: false
3742
3832
  });
3743
3833
  }
@@ -3818,6 +3908,7 @@ function trampoline24(arg0, arg1, arg2) {
3818
3908
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.read"][Instruction::Return]', {
3819
3909
  funcName: '[method]input-stream.read',
3820
3910
  paramCount: 0,
3911
+ async: false,
3821
3912
  postReturn: false
3822
3913
  });
3823
3914
  }
@@ -3898,6 +3989,7 @@ function trampoline25(arg0, arg1, arg2) {
3898
3989
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.blocking-read"][Instruction::Return]', {
3899
3990
  funcName: '[method]input-stream.blocking-read',
3900
3991
  paramCount: 0,
3992
+ async: false,
3901
3993
  postReturn: false
3902
3994
  });
3903
3995
  }
@@ -3972,6 +4064,7 @@ function trampoline26(arg0, arg1) {
3972
4064
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"][Instruction::Return]', {
3973
4065
  funcName: '[method]output-stream.check-write',
3974
4066
  paramCount: 0,
4067
+ async: false,
3975
4068
  postReturn: false
3976
4069
  });
3977
4070
  }
@@ -4048,6 +4141,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
4048
4141
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"][Instruction::Return]', {
4049
4142
  funcName: '[method]output-stream.write',
4050
4143
  paramCount: 0,
4144
+ async: false,
4051
4145
  postReturn: false
4052
4146
  });
4053
4147
  }
@@ -4124,6 +4218,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4124
4218
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
4125
4219
  funcName: '[method]output-stream.blocking-write-and-flush',
4126
4220
  paramCount: 0,
4221
+ async: false,
4127
4222
  postReturn: false
4128
4223
  });
4129
4224
  }
@@ -4197,6 +4292,7 @@ function trampoline29(arg0, arg1) {
4197
4292
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
4198
4293
  funcName: '[method]output-stream.blocking-flush',
4199
4294
  paramCount: 0,
4295
+ async: false,
4200
4296
  postReturn: false
4201
4297
  });
4202
4298
  }
@@ -4218,6 +4314,7 @@ function trampoline30(arg0, arg1) {
4218
4314
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"][Instruction::Return]', {
4219
4315
  funcName: 'get-random-bytes',
4220
4316
  paramCount: 0,
4317
+ async: false,
4221
4318
  postReturn: false
4222
4319
  });
4223
4320
  }
@@ -4255,6 +4352,7 @@ function trampoline31(arg0) {
4255
4352
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"][Instruction::Return]', {
4256
4353
  funcName: 'get-directories',
4257
4354
  paramCount: 0,
4355
+ async: false,
4258
4356
  postReturn: false
4259
4357
  });
4260
4358
  }
@@ -4290,6 +4388,7 @@ function trampoline32(arg0) {
4290
4388
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"][Instruction::Return]', {
4291
4389
  funcName: 'get-terminal-stdin',
4292
4390
  paramCount: 0,
4391
+ async: false,
4293
4392
  postReturn: false
4294
4393
  });
4295
4394
  }
@@ -4325,6 +4424,7 @@ function trampoline33(arg0) {
4325
4424
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"][Instruction::Return]', {
4326
4425
  funcName: 'get-terminal-stdout',
4327
4426
  paramCount: 0,
4427
+ async: false,
4328
4428
  postReturn: false
4329
4429
  });
4330
4430
  }
@@ -4356,6 +4456,7 @@ function trampoline34(arg0) {
4356
4456
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"][Instruction::Return]', {
4357
4457
  funcName: 'get-terminal-stderr',
4358
4458
  paramCount: 0,
4459
+ async: false,
4359
4460
  postReturn: false
4360
4461
  });
4361
4462
  }
@@ -4673,7 +4774,12 @@ function generate(arg0, arg1) {
4673
4774
  }
4674
4775
  }
4675
4776
  }
4676
- _debugLog('[iface="generate", function="generate"] [Instruction::CallWasm] (async? false, @ enter)');
4777
+ _debugLog('[iface="generate", function="generate"][Instruction::CallWasm] enter', {
4778
+ funcName: 'generate',
4779
+ paramCount: 1,
4780
+ async: false,
4781
+ postReturn: true,
4782
+ });
4677
4783
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1Generate');
4678
4784
  const ret = exports1Generate(ptr0);
4679
4785
  endCurrentTask(0);
@@ -4754,6 +4860,7 @@ function generate(arg0, arg1) {
4754
4860
  _debugLog('[iface="generate", function="generate"][Instruction::Return]', {
4755
4861
  funcName: 'generate',
4756
4862
  paramCount: 1,
4863
+ async: false,
4757
4864
  postReturn: true
4758
4865
  });
4759
4866
  const retCopy = variant39;
@@ -4970,7 +5077,12 @@ function generateTypes(arg0, arg1) {
4970
5077
  }
4971
5078
  }
4972
5079
  }
4973
- _debugLog('[iface="generate-types", function="generate-types"] [Instruction::CallWasm] (async? false, @ enter)');
5080
+ _debugLog('[iface="generate-types", function="generate-types"][Instruction::CallWasm] enter', {
5081
+ funcName: 'generate-types',
5082
+ paramCount: 1,
5083
+ async: false,
5084
+ postReturn: true,
5085
+ });
4974
5086
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1GenerateTypes');
4975
5087
  const ret = exports1GenerateTypes(ptr0);
4976
5088
  endCurrentTask(0);
@@ -5013,6 +5125,7 @@ function generateTypes(arg0, arg1) {
5013
5125
  _debugLog('[iface="generate-types", function="generate-types"][Instruction::Return]', {
5014
5126
  funcName: 'generate-types',
5015
5127
  paramCount: 1,
5128
+ async: false,
5016
5129
  postReturn: true
5017
5130
  });
5018
5131
  const retCopy = variant33;
@@ -5033,27 +5146,27 @@ function generateTypes(arg0, arg1) {
5033
5146
 
5034
5147
  let _initialized = false;
5035
5148
  export const $init = (() => {
5036
- let gen = (function* init () {
5149
+ let gen = (function* _initGenerator () {
5037
5150
  const module0 = fetchCompile(new URL('./js-component-bindgen-component.core.wasm', import.meta.url));
5038
5151
  const module1 = fetchCompile(new URL('./js-component-bindgen-component.core2.wasm', import.meta.url));
5039
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUCBAcECAkCAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCwAgACABQQARAgALDwAgACABIAIgA0EBEQQACxEAIAAgASACIAMgBEECEQcACw8AIAAgASACIANBAxEEAAsRACAAIAEgAiADIARBBBEIAAsZACAAIAEgAiADIAQgBSAGIAcgCEEFEQkACwsAIAAgAUEGEQIACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMzkuMA');
5040
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAIAATEABAABMgAHAAEzAAQAATQACAABNQAJAAE2AAIAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIzOS4w');
5152
+ const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHAgIIBAQJAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlEQAgACABIAIgAyAEQQARBwALCwAgACABQQERAgALCwAgACABQQIRAgALEQAgACABIAIgAyAEQQMRCAALDwAgACABIAIgA0EEEQQACw8AIAAgASACIANBBREEAAsZACAAIAEgAiADIAQgBSAGIAcgCEEGEQkACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
5153
+ const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAcAATEAAgABMgACAAEzAAgAATQABAABNQAEAAE2AAkAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
5041
5154
  ({ exports: exports0 } = yield instantiateCore(yield module2));
5042
5155
  ({ exports: exports1 } = yield instantiateCore(yield module0, {
5043
5156
  wasi_snapshot_preview1: {
5044
5157
  environ_get: exports0['7'],
5045
5158
  environ_sizes_get: exports0['8'],
5046
5159
  fd_close: exports0['9'],
5047
- fd_filestat_get: exports0['0'],
5160
+ fd_filestat_get: exports0['2'],
5048
5161
  fd_prestat_dir_name: exports0['11'],
5049
5162
  fd_prestat_get: exports0['10'],
5050
- fd_read: exports0['1'],
5051
- fd_readdir: exports0['2'],
5052
- fd_write: exports0['3'],
5053
- path_filestat_get: exports0['4'],
5054
- path_open: exports0['5'],
5163
+ fd_read: exports0['4'],
5164
+ fd_readdir: exports0['0'],
5165
+ fd_write: exports0['5'],
5166
+ path_filestat_get: exports0['3'],
5167
+ path_open: exports0['6'],
5055
5168
  proc_exit: exports0['12'],
5056
- random_get: exports0['6'],
5169
+ random_get: exports0['1'],
5057
5170
  },
5058
5171
  }));
5059
5172
  ({ exports: exports2 } = yield instantiateCore(yield module1, {
@@ -5134,8 +5247,8 @@ export const $init = (() => {
5134
5247
  ({ exports: exports3 } = yield instantiateCore(yield module3, {
5135
5248
  '': {
5136
5249
  $imports: exports0.$imports,
5137
- '0': exports2.fd_filestat_get,
5138
- '1': exports2.fd_read,
5250
+ '0': exports2.fd_readdir,
5251
+ '1': exports2.random_get,
5139
5252
  '10': exports2.fd_prestat_get,
5140
5253
  '11': exports2.fd_prestat_dir_name,
5141
5254
  '12': exports2.proc_exit,
@@ -5146,7 +5259,7 @@ export const $init = (() => {
5146
5259
  '17': trampoline15,
5147
5260
  '18': trampoline16,
5148
5261
  '19': trampoline17,
5149
- '2': exports2.fd_readdir,
5262
+ '2': exports2.fd_filestat_get,
5150
5263
  '20': trampoline18,
5151
5264
  '21': trampoline19,
5152
5265
  '22': trampoline20,
@@ -5157,7 +5270,7 @@ export const $init = (() => {
5157
5270
  '27': trampoline25,
5158
5271
  '28': trampoline26,
5159
5272
  '29': trampoline27,
5160
- '3': exports2.fd_write,
5273
+ '3': exports2.path_filestat_get,
5161
5274
  '30': trampoline28,
5162
5275
  '31': trampoline29,
5163
5276
  '32': trampoline30,
@@ -5165,9 +5278,9 @@ export const $init = (() => {
5165
5278
  '34': trampoline32,
5166
5279
  '35': trampoline33,
5167
5280
  '36': trampoline34,
5168
- '4': exports2.path_filestat_get,
5169
- '5': exports2.path_open,
5170
- '6': exports2.random_get,
5281
+ '4': exports2.fd_read,
5282
+ '5': exports2.fd_write,
5283
+ '6': exports2.path_open,
5171
5284
  '7': exports2.environ_get,
5172
5285
  '8': exports2.environ_sizes_get,
5173
5286
  '9': exports2.fd_close,
Binary file
package/obj/wasm-tools.js CHANGED
@@ -150,8 +150,9 @@ class AsyncTask {
150
150
  #state;
151
151
  #isAsync;
152
152
  #onResolve = null;
153
- #returnedResults = null;
154
153
  #entryFnName = null;
154
+ #subtasks = [];
155
+ #completionPromise = null;
155
156
 
156
157
  cancelled = false;
157
158
  requested = false;
@@ -164,6 +165,7 @@ class AsyncTask {
164
165
  awaitableResume = null;
165
166
  awaitableCancel = null;
166
167
 
168
+
167
169
  constructor(opts) {
168
170
  if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
169
171
  this.#id = opts.id;
@@ -175,8 +177,16 @@ class AsyncTask {
175
177
  this.#isAsync = opts?.isAsync ?? false;
176
178
  this.#entryFnName = opts.entryFnName;
177
179
 
180
+ const {
181
+ promise: completionPromise,
182
+ resolve: resolveCompletionPromise,
183
+ reject: rejectCompletionPromise,
184
+ } = Promise.withResolvers();
185
+ this.#completionPromise = completionPromise;
186
+
178
187
  this.#onResolve = (results) => {
179
- this.#returnedResults = results;
188
+ // TODO: handle external facing cancellation (should likely be a rejection)
189
+ resolveCompletionPromise(results);
180
190
  }
181
191
  }
182
192
 
@@ -184,13 +194,8 @@ class AsyncTask {
184
194
  id() { return this.#id; }
185
195
  componentIdx() { return this.#componentIdx; }
186
196
  isAsync() { return this.#isAsync; }
187
- getEntryFnName() { return this.#entryFnName; }
188
-
189
- takeResults() {
190
- const results = this.#returnedResults;
191
- this.#returnedResults = null;
192
- return results;
193
- }
197
+ entryFnName() { return this.#entryFnName; }
198
+ completionPromise() { return this.#completionPromise; }
194
199
 
195
200
  mayEnter(task) {
196
201
  const cstate = getOrCreateAsyncState(this.#componentIdx);
@@ -221,7 +226,6 @@ class AsyncTask {
221
226
  let mayNotEnter = !this.mayEnter(this);
222
227
  const componentHasPendingTasks = cstate.pendingTasks > 0;
223
228
  if (mayNotEnter || componentHasPendingTasks) {
224
-
225
229
  throw new Error('in enter()'); // TODO: remove
226
230
  cstate.pendingTasks.set(this.#id, new Awaitable(new Promise()));
227
231
 
@@ -233,7 +237,7 @@ class AsyncTask {
233
237
  throw new Error('pending task [' + this.#id + '] not found for component instance');
234
238
  }
235
239
  cstate.pendingTasks.remove(this.#id);
236
- this.#onResolve([]);
240
+ this.#onResolve(new Error('failed enter'));
237
241
  return false;
238
242
  }
239
243
 
@@ -386,7 +390,6 @@ class AsyncTask {
386
390
  }
387
391
  }
388
392
 
389
- // NOTE: this should likely be moved to a SubTask class
390
393
  async asyncOnBlock(awaitable) {
391
394
  _debugLog('[AsyncTask#asyncOnBlock()] args', { taskID: this.#id, awaitable });
392
395
  if (!(awaitable instanceof Awaitable)) {
@@ -456,20 +459,23 @@ class AsyncTask {
456
459
  }
457
460
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
458
461
 
459
- this.#onResolve([]);
462
+ this.#onResolve(new Error('cancelled'));
460
463
  this.#state = AsyncTask.State.RESOLVED;
461
464
  }
462
465
 
463
- resolve(result) {
466
+ resolve(results) {
467
+ _debugLog('[AsyncTask#resolve()] args', { results });
464
468
  if (this.#state === AsyncTask.State.RESOLVED) {
465
469
  throw new Error('task is already resolved');
466
470
  }
467
471
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
468
- this.#onResolve(result);
472
+ this.#onResolve(results.length === 1 ? results[0] : results);
469
473
  this.#state = AsyncTask.State.RESOLVED;
470
474
  }
471
475
 
472
476
  exit() {
477
+ _debugLog('[AsyncTask#exit()] args', { });
478
+
473
479
  // TODO: ensure there is only one task at a time (scheduler.lock() functionality)
474
480
  if (this.#state !== AsyncTask.State.RESOLVED) {
475
481
  throw new Error('task exited without resolution');
@@ -488,10 +494,35 @@ class AsyncTask {
488
494
  this.startPendingTask();
489
495
  }
490
496
 
491
- startPendingTask(opts) {
492
- // TODO: implement
497
+ startPendingTask(args) {
498
+ _debugLog('[AsyncTask#startPendingTask()] args', args);
499
+ throw new Error('AsyncTask#startPendingTask() not implemented');
493
500
  }
494
501
 
502
+ createSubtask(args) {
503
+ _debugLog('[AsyncTask#createSubtask()] args', args);
504
+ const newSubtask = new AsyncSubtask({
505
+ componentIdx: this.componentIdx(),
506
+ taskID: this.id(),
507
+ memoryIdx: args?.memoryIdx,
508
+ });
509
+ this.#subtasks.push(newSubtask);
510
+ return newSubtask;
511
+ }
512
+
513
+ currentSubtask() {
514
+ _debugLog('[AsyncTask#currentSubtask()]');
515
+ if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
516
+ return this.#subtasks.at(-1);
517
+ }
518
+
519
+ endCurrentSubtask() {
520
+ _debugLog('[AsyncTask#endCurrentSubtask()]');
521
+ if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
522
+ const subtask = this.#subtasks.pop();
523
+ subtask.drop();
524
+ return subtask;
525
+ }
495
526
  }
496
527
 
497
528
  function unpackCallbackResult(result) {
@@ -520,7 +551,7 @@ class ComponentAsyncState {
520
551
  #syncImportWait = Promise.withResolvers();
521
552
  #lock = null;
522
553
 
523
- mayLeave = false;
554
+ mayLeave = true;
524
555
  waitableSets = new RepTable();
525
556
  waitables = new RepTable();
526
557
 
@@ -626,6 +657,45 @@ isExclusivelyLocked() { return this.#lock !== null; }
626
657
 
627
658
  }
628
659
 
660
+ function prepareCall(memoryIdx) {
661
+ _debugLog('[prepareCall()] args', { memoryIdx });
662
+
663
+ const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
664
+ if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
665
+
666
+ const task = taskMeta.task;
667
+ if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
668
+
669
+ const state = getOrCreateAsyncState(task.componentIdx());
670
+ if (!state) {
671
+ throw new Error('invalid/missing async state for component instance [' + componentInstanceID + ']');
672
+ }
673
+
674
+ const subtask = task.createSubtask({
675
+ memoryIdx,
676
+ });
677
+
678
+ }
679
+
680
+ function asyncStartCall(callbackIdx, postReturnIdx) {
681
+ _debugLog('[asyncStartCall()] args', { callbackIdx, postReturnIdx });
682
+
683
+ const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
684
+ if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
685
+
686
+ const task = taskMeta.task;
687
+ if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
688
+
689
+ const subtask = task.currentSubtask();
690
+ if (!subtask) { throw new Error('invalid/missing subtask during async start call'); }
691
+
692
+ return Number(subtask.waitableRep()) << 4 | subtask.getStateNumber();
693
+ }
694
+
695
+ function syncStartCall(callbackIdx) {
696
+ _debugLog('[syncStartCall()] args', { callbackIdx });
697
+ }
698
+
629
699
  if (!Promise.withResolvers) {
630
700
  Promise.withResolvers = () => {
631
701
  let resolve;
@@ -695,39 +765,42 @@ class RepTable {
695
765
  this.#data.push(null);
696
766
  return (this.#data.length >> 1) - 1;
697
767
  }
698
- this.#data[0] = this.#data[freeIdx];
699
- const newFreeIdx = freeIdx << 1;
700
- this.#data[newFreeIdx] = val;
701
- this.#data[newFreeIdx + 1] = null;
702
- return free;
768
+ this.#data[0] = this.#data[freeIdx << 1];
769
+ const placementIdx = freeIdx << 1;
770
+ this.#data[placementIdx] = val;
771
+ this.#data[placementIdx + 1] = null;
772
+ return freeIdx;
703
773
  }
704
774
 
705
775
  get(rep) {
706
- _debugLog('[RepTable#insert()] args', { rep });
707
- const baseIdx = idx << 1;
776
+ _debugLog('[RepTable#get()] args', { rep });
777
+ const baseIdx = rep << 1;
708
778
  const val = this.#data[baseIdx];
709
779
  return val;
710
780
  }
711
781
 
712
782
  contains(rep) {
713
- _debugLog('[RepTable#insert()] args', { rep });
714
- const baseIdx = idx << 1;
783
+ _debugLog('[RepTable#contains()] args', { rep });
784
+ const baseIdx = rep << 1;
715
785
  return !!this.#data[baseIdx];
716
786
  }
717
787
 
718
788
  remove(rep) {
719
- _debugLog('[RepTable#insert()] args', { idx });
789
+ _debugLog('[RepTable#remove()] args', { rep });
720
790
  if (this.#data.length === 2) { throw new Error('invalid'); }
721
791
 
722
- const baseIdx = idx << 1;
792
+ const baseIdx = rep << 1;
723
793
  const val = this.#data[baseIdx];
724
794
  if (val === 0) { throw new Error('invalid resource rep (cannot be 0)'); }
795
+
725
796
  this.#data[baseIdx] = this.#data[0];
726
- this.#data[0] = idx;
797
+ this.#data[0] = rep;
798
+
727
799
  return val;
728
800
  }
729
801
 
730
802
  clear() {
803
+ _debugLog('[RepTable#clear()] args', { rep });
731
804
  this.#data = [0, null];
732
805
  }
733
806
  }
@@ -766,6 +839,7 @@ function trampoline5() {
766
839
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"][Instruction::Return]', {
767
840
  funcName: 'get-stderr',
768
841
  paramCount: 1,
842
+ async: false,
769
843
  postReturn: false
770
844
  });
771
845
  return handle0;
@@ -794,6 +868,7 @@ function trampoline8() {
794
868
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"][Instruction::Return]', {
795
869
  funcName: 'get-stdin',
796
870
  paramCount: 1,
871
+ async: false,
797
872
  postReturn: false
798
873
  });
799
874
  return handle0;
@@ -818,6 +893,7 @@ function trampoline9() {
818
893
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"][Instruction::Return]', {
819
894
  funcName: 'get-stdout',
820
895
  paramCount: 1,
896
+ async: false,
821
897
  postReturn: false
822
898
  });
823
899
  return handle0;
@@ -853,6 +929,7 @@ function trampoline10(arg0) {
853
929
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
854
930
  funcName: 'exit',
855
931
  paramCount: 0,
932
+ async: false,
856
933
  postReturn: false
857
934
  });
858
935
  }
@@ -887,6 +964,7 @@ function trampoline11(arg0) {
887
964
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"][Instruction::Return]', {
888
965
  funcName: 'get-environment',
889
966
  paramCount: 0,
967
+ async: false,
890
968
  postReturn: false
891
969
  });
892
970
  }
@@ -1143,6 +1221,7 @@ function trampoline12(arg0, arg1) {
1143
1221
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"][Instruction::Return]', {
1144
1222
  funcName: '[method]descriptor.get-type',
1145
1223
  paramCount: 0,
1224
+ async: false,
1146
1225
  postReturn: false
1147
1226
  });
1148
1227
  }
@@ -1354,6 +1433,7 @@ function trampoline13(arg0, arg1) {
1354
1433
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash"][Instruction::Return]', {
1355
1434
  funcName: '[method]descriptor.metadata-hash',
1356
1435
  paramCount: 0,
1436
+ async: false,
1357
1437
  postReturn: false
1358
1438
  });
1359
1439
  }
@@ -1552,6 +1632,7 @@ function trampoline14(arg0, arg1) {
1552
1632
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"][Instruction::Return]', {
1553
1633
  funcName: 'filesystem-error-code',
1554
1634
  paramCount: 0,
1635
+ async: false,
1555
1636
  postReturn: false
1556
1637
  });
1557
1638
  }
@@ -1772,6 +1853,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1772
1853
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash-at"][Instruction::Return]', {
1773
1854
  funcName: '[method]descriptor.metadata-hash-at',
1774
1855
  paramCount: 0,
1856
+ async: false,
1775
1857
  postReturn: false
1776
1858
  });
1777
1859
  }
@@ -1990,6 +2072,7 @@ function trampoline16(arg0, arg1, arg2) {
1990
2072
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-via-stream"][Instruction::Return]', {
1991
2073
  funcName: '[method]descriptor.read-via-stream',
1992
2074
  paramCount: 0,
2075
+ async: false,
1993
2076
  postReturn: false
1994
2077
  });
1995
2078
  }
@@ -2208,6 +2291,7 @@ function trampoline17(arg0, arg1, arg2) {
2208
2291
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
2209
2292
  funcName: '[method]descriptor.write-via-stream',
2210
2293
  paramCount: 0,
2294
+ async: false,
2211
2295
  postReturn: false
2212
2296
  });
2213
2297
  }
@@ -2426,6 +2510,7 @@ function trampoline18(arg0, arg1) {
2426
2510
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
2427
2511
  funcName: '[method]descriptor.append-via-stream',
2428
2512
  paramCount: 0,
2513
+ async: false,
2429
2514
  postReturn: false
2430
2515
  });
2431
2516
  }
@@ -2648,6 +2733,7 @@ function trampoline19(arg0, arg1) {
2648
2733
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-directory"][Instruction::Return]', {
2649
2734
  funcName: '[method]descriptor.read-directory',
2650
2735
  paramCount: 0,
2736
+ async: false,
2651
2737
  postReturn: false
2652
2738
  });
2653
2739
  }
@@ -2933,6 +3019,7 @@ function trampoline20(arg0, arg1) {
2933
3019
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"][Instruction::Return]', {
2934
3020
  funcName: '[method]descriptor.stat',
2935
3021
  paramCount: 0,
3022
+ async: false,
2936
3023
  postReturn: false
2937
3024
  });
2938
3025
  }
@@ -3227,6 +3314,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
3227
3314
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat-at"][Instruction::Return]', {
3228
3315
  funcName: '[method]descriptor.stat-at',
3229
3316
  paramCount: 0,
3317
+ async: false,
3230
3318
  postReturn: false
3231
3319
  });
3232
3320
  }
@@ -3474,6 +3562,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3474
3562
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.open-at"][Instruction::Return]', {
3475
3563
  funcName: '[method]descriptor.open-at',
3476
3564
  paramCount: 0,
3565
+ async: false,
3477
3566
  postReturn: false
3478
3567
  });
3479
3568
  }
@@ -3738,6 +3827,7 @@ function trampoline23(arg0, arg1) {
3738
3827
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]directory-entry-stream.read-directory-entry"][Instruction::Return]', {
3739
3828
  funcName: '[method]directory-entry-stream.read-directory-entry',
3740
3829
  paramCount: 0,
3830
+ async: false,
3741
3831
  postReturn: false
3742
3832
  });
3743
3833
  }
@@ -3818,6 +3908,7 @@ function trampoline24(arg0, arg1, arg2) {
3818
3908
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.read"][Instruction::Return]', {
3819
3909
  funcName: '[method]input-stream.read',
3820
3910
  paramCount: 0,
3911
+ async: false,
3821
3912
  postReturn: false
3822
3913
  });
3823
3914
  }
@@ -3898,6 +3989,7 @@ function trampoline25(arg0, arg1, arg2) {
3898
3989
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.blocking-read"][Instruction::Return]', {
3899
3990
  funcName: '[method]input-stream.blocking-read',
3900
3991
  paramCount: 0,
3992
+ async: false,
3901
3993
  postReturn: false
3902
3994
  });
3903
3995
  }
@@ -3972,6 +4064,7 @@ function trampoline26(arg0, arg1) {
3972
4064
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"][Instruction::Return]', {
3973
4065
  funcName: '[method]output-stream.check-write',
3974
4066
  paramCount: 0,
4067
+ async: false,
3975
4068
  postReturn: false
3976
4069
  });
3977
4070
  }
@@ -4048,6 +4141,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
4048
4141
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"][Instruction::Return]', {
4049
4142
  funcName: '[method]output-stream.write',
4050
4143
  paramCount: 0,
4144
+ async: false,
4051
4145
  postReturn: false
4052
4146
  });
4053
4147
  }
@@ -4124,6 +4218,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4124
4218
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
4125
4219
  funcName: '[method]output-stream.blocking-write-and-flush',
4126
4220
  paramCount: 0,
4221
+ async: false,
4127
4222
  postReturn: false
4128
4223
  });
4129
4224
  }
@@ -4197,6 +4292,7 @@ function trampoline29(arg0, arg1) {
4197
4292
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
4198
4293
  funcName: '[method]output-stream.blocking-flush',
4199
4294
  paramCount: 0,
4295
+ async: false,
4200
4296
  postReturn: false
4201
4297
  });
4202
4298
  }
@@ -4218,6 +4314,7 @@ function trampoline30(arg0, arg1) {
4218
4314
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"][Instruction::Return]', {
4219
4315
  funcName: 'get-random-bytes',
4220
4316
  paramCount: 0,
4317
+ async: false,
4221
4318
  postReturn: false
4222
4319
  });
4223
4320
  }
@@ -4255,6 +4352,7 @@ function trampoline31(arg0) {
4255
4352
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"][Instruction::Return]', {
4256
4353
  funcName: 'get-directories',
4257
4354
  paramCount: 0,
4355
+ async: false,
4258
4356
  postReturn: false
4259
4357
  });
4260
4358
  }
@@ -4290,6 +4388,7 @@ function trampoline32(arg0) {
4290
4388
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"][Instruction::Return]', {
4291
4389
  funcName: 'get-terminal-stdin',
4292
4390
  paramCount: 0,
4391
+ async: false,
4293
4392
  postReturn: false
4294
4393
  });
4295
4394
  }
@@ -4325,6 +4424,7 @@ function trampoline33(arg0) {
4325
4424
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"][Instruction::Return]', {
4326
4425
  funcName: 'get-terminal-stdout',
4327
4426
  paramCount: 0,
4427
+ async: false,
4328
4428
  postReturn: false
4329
4429
  });
4330
4430
  }
@@ -4356,6 +4456,7 @@ function trampoline34(arg0) {
4356
4456
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"][Instruction::Return]', {
4357
4457
  funcName: 'get-terminal-stderr',
4358
4458
  paramCount: 0,
4459
+ async: false,
4359
4460
  postReturn: false
4360
4461
  });
4361
4462
  }
@@ -4461,7 +4562,12 @@ function parse(arg0) {
4461
4562
  if (!_initialized) throwUninitialized();
4462
4563
  var ptr0 = utf8Encode(arg0, realloc1, memory0);
4463
4564
  var len0 = utf8EncodedLen;
4464
- _debugLog('[iface="local:wasm-tools/tools", function="parse"] [Instruction::CallWasm] (async? false, @ enter)');
4565
+ _debugLog('[iface="local:wasm-tools/tools", function="parse"][Instruction::CallWasm] enter', {
4566
+ funcName: 'parse',
4567
+ paramCount: 2,
4568
+ async: false,
4569
+ postReturn: true,
4570
+ });
4465
4571
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsParse');
4466
4572
  const ret = toolsParse(ptr0, len0);
4467
4573
  endCurrentTask(0);
@@ -4494,6 +4600,7 @@ function parse(arg0) {
4494
4600
  _debugLog('[iface="local:wasm-tools/tools", function="parse"][Instruction::Return]', {
4495
4601
  funcName: 'parse',
4496
4602
  paramCount: 1,
4603
+ async: false,
4497
4604
  postReturn: true
4498
4605
  });
4499
4606
  const retCopy = variant3;
@@ -4520,7 +4627,12 @@ function print(arg0) {
4520
4627
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
4521
4628
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
4522
4629
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
4523
- _debugLog('[iface="local:wasm-tools/tools", function="print"] [Instruction::CallWasm] (async? false, @ enter)');
4630
+ _debugLog('[iface="local:wasm-tools/tools", function="print"][Instruction::CallWasm] enter', {
4631
+ funcName: 'print',
4632
+ paramCount: 2,
4633
+ async: false,
4634
+ postReturn: true,
4635
+ });
4524
4636
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsPrint');
4525
4637
  const ret = toolsPrint(ptr0, len0);
4526
4638
  endCurrentTask(0);
@@ -4553,6 +4665,7 @@ function print(arg0) {
4553
4665
  _debugLog('[iface="local:wasm-tools/tools", function="print"][Instruction::Return]', {
4554
4666
  funcName: 'print',
4555
4667
  paramCount: 1,
4668
+ async: false,
4556
4669
  postReturn: true
4557
4670
  });
4558
4671
  const retCopy = variant3;
@@ -4611,7 +4724,12 @@ function componentNew(arg0, arg1) {
4611
4724
  variant5_1 = result4;
4612
4725
  variant5_2 = len4;
4613
4726
  }
4614
- _debugLog('[iface="local:wasm-tools/tools", function="component-new"] [Instruction::CallWasm] (async? false, @ enter)');
4727
+ _debugLog('[iface="local:wasm-tools/tools", function="component-new"][Instruction::CallWasm] enter', {
4728
+ funcName: 'component-new',
4729
+ paramCount: 5,
4730
+ async: false,
4731
+ postReturn: true,
4732
+ });
4615
4733
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentNew');
4616
4734
  const ret = toolsComponentNew(ptr0, len0, variant5_0, variant5_1, variant5_2);
4617
4735
  endCurrentTask(0);
@@ -4644,6 +4762,7 @@ function componentNew(arg0, arg1) {
4644
4762
  _debugLog('[iface="local:wasm-tools/tools", function="component-new"][Instruction::Return]', {
4645
4763
  funcName: 'component-new',
4646
4764
  paramCount: 1,
4765
+ async: false,
4647
4766
  postReturn: true
4648
4767
  });
4649
4768
  const retCopy = variant8;
@@ -4670,7 +4789,12 @@ function componentWit(arg0) {
4670
4789
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
4671
4790
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
4672
4791
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
4673
- _debugLog('[iface="local:wasm-tools/tools", function="component-wit"] [Instruction::CallWasm] (async? false, @ enter)');
4792
+ _debugLog('[iface="local:wasm-tools/tools", function="component-wit"][Instruction::CallWasm] enter', {
4793
+ funcName: 'component-wit',
4794
+ paramCount: 2,
4795
+ async: false,
4796
+ postReturn: true,
4797
+ });
4674
4798
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentWit');
4675
4799
  const ret = toolsComponentWit(ptr0, len0);
4676
4800
  endCurrentTask(0);
@@ -4703,6 +4827,7 @@ function componentWit(arg0) {
4703
4827
  _debugLog('[iface="local:wasm-tools/tools", function="component-wit"][Instruction::Return]', {
4704
4828
  funcName: 'component-wit',
4705
4829
  paramCount: 1,
4830
+ async: false,
4706
4831
  postReturn: true
4707
4832
  });
4708
4833
  const retCopy = variant3;
@@ -4883,7 +5008,12 @@ function componentEmbed(arg0) {
4883
5008
  }
4884
5009
  }
4885
5010
  }
4886
- _debugLog('[iface="local:wasm-tools/tools", function="component-embed"] [Instruction::CallWasm] (async? false, @ enter)');
5011
+ _debugLog('[iface="local:wasm-tools/tools", function="component-embed"][Instruction::CallWasm] enter', {
5012
+ funcName: 'component-embed',
5013
+ paramCount: 1,
5014
+ async: false,
5015
+ postReturn: true,
5016
+ });
4887
5017
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentEmbed');
4888
5018
  const ret = toolsComponentEmbed(ptr0);
4889
5019
  endCurrentTask(0);
@@ -4916,6 +5046,7 @@ function componentEmbed(arg0) {
4916
5046
  _debugLog('[iface="local:wasm-tools/tools", function="component-embed"][Instruction::Return]', {
4917
5047
  funcName: 'component-embed',
4918
5048
  paramCount: 1,
5049
+ async: false,
4919
5050
  postReturn: true
4920
5051
  });
4921
5052
  const retCopy = variant27;
@@ -4942,7 +5073,12 @@ function metadataShow(arg0) {
4942
5073
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
4943
5074
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
4944
5075
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
4945
- _debugLog('[iface="local:wasm-tools/tools", function="metadata-show"] [Instruction::CallWasm] (async? false, @ enter)');
5076
+ _debugLog('[iface="local:wasm-tools/tools", function="metadata-show"][Instruction::CallWasm] enter', {
5077
+ funcName: 'metadata-show',
5078
+ paramCount: 2,
5079
+ async: false,
5080
+ postReturn: true,
5081
+ });
4946
5082
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsMetadataShow');
4947
5083
  const ret = toolsMetadataShow(ptr0, len0);
4948
5084
  endCurrentTask(0);
@@ -5058,6 +5194,7 @@ function metadataShow(arg0) {
5058
5194
  _debugLog('[iface="local:wasm-tools/tools", function="metadata-show"][Instruction::Return]', {
5059
5195
  funcName: 'metadata-show',
5060
5196
  paramCount: 1,
5197
+ async: false,
5061
5198
  postReturn: true
5062
5199
  });
5063
5200
  const retCopy = variant12;
@@ -5112,7 +5249,12 @@ function metadataAdd(arg0, arg1) {
5112
5249
  dataView(memory0).setUint32(base + 12, len6, true);
5113
5250
  dataView(memory0).setUint32(base + 8, result6, true);
5114
5251
  }
5115
- _debugLog('[iface="local:wasm-tools/tools", function="metadata-add"] [Instruction::CallWasm] (async? false, @ enter)');
5252
+ _debugLog('[iface="local:wasm-tools/tools", function="metadata-add"][Instruction::CallWasm] enter', {
5253
+ funcName: 'metadata-add',
5254
+ paramCount: 4,
5255
+ async: false,
5256
+ postReturn: true,
5257
+ });
5116
5258
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsMetadataAdd');
5117
5259
  const ret = toolsMetadataAdd(ptr0, len0, result7, len7);
5118
5260
  endCurrentTask(0);
@@ -5145,6 +5287,7 @@ function metadataAdd(arg0, arg1) {
5145
5287
  _debugLog('[iface="local:wasm-tools/tools", function="metadata-add"][Instruction::Return]', {
5146
5288
  funcName: 'metadata-add',
5147
5289
  paramCount: 1,
5290
+ async: false,
5148
5291
  postReturn: true
5149
5292
  });
5150
5293
  const retCopy = variant10;
@@ -5165,11 +5308,11 @@ function metadataAdd(arg0, arg1) {
5165
5308
 
5166
5309
  let _initialized = false;
5167
5310
  export const $init = (() => {
5168
- let gen = (function* init () {
5311
+ let gen = (function* _initGenerator () {
5169
5312
  const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
5170
5313
  const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
5171
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHCAkCAgQEAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlGQAgACABIAIgAyAEIAUgBiAHIAhBABEHAAsRACAAIAEgAiADIARBAREIAAsRACAAIAEgAiADIARBAhEJAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsPACAAIAEgAiADQQURBAALDwAgACABIAIgA0EGEQQACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMzkuMA');
5172
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAcAATEACAABMgAJAAEzAAIAATQAAgABNQAEAAE2AAQAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIzOS4w');
5314
+ const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/f38Bf2AJf39/f39+fn9/AX9gBX9/f35/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHCAkCAgQEAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlEQAgACABIAIgAyAEQQARBwALGQAgACABIAIgAyAEIAUgBiAHIAhBAREIAAsRACAAIAEgAiADIARBAhEJAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsPACAAIAEgAiADQQURBAALDwAgACABIAIgA0EGEQQACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
5315
+ const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/f38Bf2AJf39/f39+fn9/AX9gBX9/f35/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAcAATEACAABMgAJAAEzAAIAATQAAgABNQAEAAE2AAQAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
5173
5316
  ({ exports: exports0 } = yield instantiateCore(yield module2));
5174
5317
  ({ exports: exports1 } = yield instantiateCore(yield module0, {
5175
5318
  wasi_snapshot_preview1: {
@@ -5180,10 +5323,10 @@ export const $init = (() => {
5180
5323
  fd_prestat_dir_name: exports0['11'],
5181
5324
  fd_prestat_get: exports0['10'],
5182
5325
  fd_read: exports0['5'],
5183
- fd_readdir: exports0['1'],
5326
+ fd_readdir: exports0['2'],
5184
5327
  fd_write: exports0['6'],
5185
- path_filestat_get: exports0['2'],
5186
- path_open: exports0['0'],
5328
+ path_filestat_get: exports0['0'],
5329
+ path_open: exports0['1'],
5187
5330
  proc_exit: exports0['12'],
5188
5331
  random_get: exports0['3'],
5189
5332
  },
@@ -5266,8 +5409,8 @@ export const $init = (() => {
5266
5409
  ({ exports: exports3 } = yield instantiateCore(yield module3, {
5267
5410
  '': {
5268
5411
  $imports: exports0.$imports,
5269
- '0': exports2.path_open,
5270
- '1': exports2.fd_readdir,
5412
+ '0': exports2.path_filestat_get,
5413
+ '1': exports2.path_open,
5271
5414
  '10': exports2.fd_prestat_get,
5272
5415
  '11': exports2.fd_prestat_dir_name,
5273
5416
  '12': exports2.proc_exit,
@@ -5278,7 +5421,7 @@ export const $init = (() => {
5278
5421
  '17': trampoline15,
5279
5422
  '18': trampoline16,
5280
5423
  '19': trampoline17,
5281
- '2': exports2.path_filestat_get,
5424
+ '2': exports2.fd_readdir,
5282
5425
  '20': trampoline18,
5283
5426
  '21': trampoline19,
5284
5427
  '22': trampoline20,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "homepage": "https://github.com/bytecodealliance/jco#readme",
6
6
  "author": "Guy Bedford",
@@ -71,7 +71,7 @@
71
71
  "prepack": "cargo xtask build release"
72
72
  },
73
73
  "dependencies": {
74
- "@bytecodealliance/componentize-js": "^0.19.1",
74
+ "@bytecodealliance/componentize-js": "^0.19.3",
75
75
  "@bytecodealliance/preview2-shim": "^0.17.3",
76
76
  "binaryen": "^123.0.0",
77
77
  "commander": "^14",
@@ -92,6 +92,7 @@
92
92
  "semver": "^7.7.1",
93
93
  "smol-toml": "^1.4.2",
94
94
  "typescript": "^5.9.2",
95
- "vitest": "^3.2.4"
95
+ "vitest": "^3.2.4",
96
+ "which": "^2.0.2"
96
97
  }
97
98
  }
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage('<command> [options]')
27
27
  .enablePositionalOptions()
28
- .version('1.15.1');
28
+ .version('1.15.3');
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);