@bytecodealliance/jco 1.15.2 → 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,9 +150,9 @@ class AsyncTask {
150
150
  #state;
151
151
  #isAsync;
152
152
  #onResolve = null;
153
- #returnedResults = null;
154
153
  #entryFnName = null;
155
154
  #subtasks = [];
155
+ #completionPromise = null;
156
156
 
157
157
  cancelled = false;
158
158
  requested = false;
@@ -165,6 +165,7 @@ class AsyncTask {
165
165
  awaitableResume = null;
166
166
  awaitableCancel = null;
167
167
 
168
+
168
169
  constructor(opts) {
169
170
  if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
170
171
  this.#id = opts.id;
@@ -176,8 +177,16 @@ class AsyncTask {
176
177
  this.#isAsync = opts?.isAsync ?? false;
177
178
  this.#entryFnName = opts.entryFnName;
178
179
 
180
+ const {
181
+ promise: completionPromise,
182
+ resolve: resolveCompletionPromise,
183
+ reject: rejectCompletionPromise,
184
+ } = Promise.withResolvers();
185
+ this.#completionPromise = completionPromise;
186
+
179
187
  this.#onResolve = (results) => {
180
- this.#returnedResults = results;
188
+ // TODO: handle external facing cancellation (should likely be a rejection)
189
+ resolveCompletionPromise(results);
181
190
  }
182
191
  }
183
192
 
@@ -185,13 +194,8 @@ class AsyncTask {
185
194
  id() { return this.#id; }
186
195
  componentIdx() { return this.#componentIdx; }
187
196
  isAsync() { return this.#isAsync; }
188
- getEntryFnName() { return this.#entryFnName; }
189
-
190
- takeResults() {
191
- const results = this.#returnedResults;
192
- this.#returnedResults = null;
193
- return results;
194
- }
197
+ entryFnName() { return this.#entryFnName; }
198
+ completionPromise() { return this.#completionPromise; }
195
199
 
196
200
  mayEnter(task) {
197
201
  const cstate = getOrCreateAsyncState(this.#componentIdx);
@@ -222,7 +226,6 @@ class AsyncTask {
222
226
  let mayNotEnter = !this.mayEnter(this);
223
227
  const componentHasPendingTasks = cstate.pendingTasks > 0;
224
228
  if (mayNotEnter || componentHasPendingTasks) {
225
-
226
229
  throw new Error('in enter()'); // TODO: remove
227
230
  cstate.pendingTasks.set(this.#id, new Awaitable(new Promise()));
228
231
 
@@ -234,7 +237,7 @@ class AsyncTask {
234
237
  throw new Error('pending task [' + this.#id + '] not found for component instance');
235
238
  }
236
239
  cstate.pendingTasks.remove(this.#id);
237
- this.#onResolve([]);
240
+ this.#onResolve(new Error('failed enter'));
238
241
  return false;
239
242
  }
240
243
 
@@ -456,17 +459,17 @@ 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) {
464
- _debugLog('[AsyncTask#resolve()] args', { result });
466
+ resolve(results) {
467
+ _debugLog('[AsyncTask#resolve()] args', { results });
465
468
  if (this.#state === AsyncTask.State.RESOLVED) {
466
469
  throw new Error('task is already resolved');
467
470
  }
468
471
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
469
- this.#onResolve(result);
472
+ this.#onResolve(results.length === 1 ? results[0] : results);
470
473
  this.#state = AsyncTask.State.RESOLVED;
471
474
  }
472
475
 
@@ -836,6 +839,7 @@ function trampoline5() {
836
839
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"][Instruction::Return]', {
837
840
  funcName: 'get-stderr',
838
841
  paramCount: 1,
842
+ async: false,
839
843
  postReturn: false
840
844
  });
841
845
  return handle0;
@@ -864,6 +868,7 @@ function trampoline8() {
864
868
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"][Instruction::Return]', {
865
869
  funcName: 'get-stdin',
866
870
  paramCount: 1,
871
+ async: false,
867
872
  postReturn: false
868
873
  });
869
874
  return handle0;
@@ -888,6 +893,7 @@ function trampoline9() {
888
893
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"][Instruction::Return]', {
889
894
  funcName: 'get-stdout',
890
895
  paramCount: 1,
896
+ async: false,
891
897
  postReturn: false
892
898
  });
893
899
  return handle0;
@@ -923,6 +929,7 @@ function trampoline10(arg0) {
923
929
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
924
930
  funcName: 'exit',
925
931
  paramCount: 0,
932
+ async: false,
926
933
  postReturn: false
927
934
  });
928
935
  }
@@ -957,6 +964,7 @@ function trampoline11(arg0) {
957
964
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"][Instruction::Return]', {
958
965
  funcName: 'get-environment',
959
966
  paramCount: 0,
967
+ async: false,
960
968
  postReturn: false
961
969
  });
962
970
  }
@@ -1213,6 +1221,7 @@ function trampoline12(arg0, arg1) {
1213
1221
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"][Instruction::Return]', {
1214
1222
  funcName: '[method]descriptor.get-type',
1215
1223
  paramCount: 0,
1224
+ async: false,
1216
1225
  postReturn: false
1217
1226
  });
1218
1227
  }
@@ -1424,6 +1433,7 @@ function trampoline13(arg0, arg1) {
1424
1433
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash"][Instruction::Return]', {
1425
1434
  funcName: '[method]descriptor.metadata-hash',
1426
1435
  paramCount: 0,
1436
+ async: false,
1427
1437
  postReturn: false
1428
1438
  });
1429
1439
  }
@@ -1622,6 +1632,7 @@ function trampoline14(arg0, arg1) {
1622
1632
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"][Instruction::Return]', {
1623
1633
  funcName: 'filesystem-error-code',
1624
1634
  paramCount: 0,
1635
+ async: false,
1625
1636
  postReturn: false
1626
1637
  });
1627
1638
  }
@@ -1842,6 +1853,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1842
1853
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash-at"][Instruction::Return]', {
1843
1854
  funcName: '[method]descriptor.metadata-hash-at',
1844
1855
  paramCount: 0,
1856
+ async: false,
1845
1857
  postReturn: false
1846
1858
  });
1847
1859
  }
@@ -2060,6 +2072,7 @@ function trampoline16(arg0, arg1, arg2) {
2060
2072
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-via-stream"][Instruction::Return]', {
2061
2073
  funcName: '[method]descriptor.read-via-stream',
2062
2074
  paramCount: 0,
2075
+ async: false,
2063
2076
  postReturn: false
2064
2077
  });
2065
2078
  }
@@ -2278,6 +2291,7 @@ function trampoline17(arg0, arg1, arg2) {
2278
2291
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
2279
2292
  funcName: '[method]descriptor.write-via-stream',
2280
2293
  paramCount: 0,
2294
+ async: false,
2281
2295
  postReturn: false
2282
2296
  });
2283
2297
  }
@@ -2496,6 +2510,7 @@ function trampoline18(arg0, arg1) {
2496
2510
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
2497
2511
  funcName: '[method]descriptor.append-via-stream',
2498
2512
  paramCount: 0,
2513
+ async: false,
2499
2514
  postReturn: false
2500
2515
  });
2501
2516
  }
@@ -2718,6 +2733,7 @@ function trampoline19(arg0, arg1) {
2718
2733
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-directory"][Instruction::Return]', {
2719
2734
  funcName: '[method]descriptor.read-directory',
2720
2735
  paramCount: 0,
2736
+ async: false,
2721
2737
  postReturn: false
2722
2738
  });
2723
2739
  }
@@ -3003,6 +3019,7 @@ function trampoline20(arg0, arg1) {
3003
3019
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"][Instruction::Return]', {
3004
3020
  funcName: '[method]descriptor.stat',
3005
3021
  paramCount: 0,
3022
+ async: false,
3006
3023
  postReturn: false
3007
3024
  });
3008
3025
  }
@@ -3297,6 +3314,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
3297
3314
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat-at"][Instruction::Return]', {
3298
3315
  funcName: '[method]descriptor.stat-at',
3299
3316
  paramCount: 0,
3317
+ async: false,
3300
3318
  postReturn: false
3301
3319
  });
3302
3320
  }
@@ -3544,6 +3562,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3544
3562
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.open-at"][Instruction::Return]', {
3545
3563
  funcName: '[method]descriptor.open-at',
3546
3564
  paramCount: 0,
3565
+ async: false,
3547
3566
  postReturn: false
3548
3567
  });
3549
3568
  }
@@ -3808,6 +3827,7 @@ function trampoline23(arg0, arg1) {
3808
3827
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]directory-entry-stream.read-directory-entry"][Instruction::Return]', {
3809
3828
  funcName: '[method]directory-entry-stream.read-directory-entry',
3810
3829
  paramCount: 0,
3830
+ async: false,
3811
3831
  postReturn: false
3812
3832
  });
3813
3833
  }
@@ -3888,6 +3908,7 @@ function trampoline24(arg0, arg1, arg2) {
3888
3908
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.read"][Instruction::Return]', {
3889
3909
  funcName: '[method]input-stream.read',
3890
3910
  paramCount: 0,
3911
+ async: false,
3891
3912
  postReturn: false
3892
3913
  });
3893
3914
  }
@@ -3968,6 +3989,7 @@ function trampoline25(arg0, arg1, arg2) {
3968
3989
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.blocking-read"][Instruction::Return]', {
3969
3990
  funcName: '[method]input-stream.blocking-read',
3970
3991
  paramCount: 0,
3992
+ async: false,
3971
3993
  postReturn: false
3972
3994
  });
3973
3995
  }
@@ -4042,6 +4064,7 @@ function trampoline26(arg0, arg1) {
4042
4064
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"][Instruction::Return]', {
4043
4065
  funcName: '[method]output-stream.check-write',
4044
4066
  paramCount: 0,
4067
+ async: false,
4045
4068
  postReturn: false
4046
4069
  });
4047
4070
  }
@@ -4118,6 +4141,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
4118
4141
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"][Instruction::Return]', {
4119
4142
  funcName: '[method]output-stream.write',
4120
4143
  paramCount: 0,
4144
+ async: false,
4121
4145
  postReturn: false
4122
4146
  });
4123
4147
  }
@@ -4194,6 +4218,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4194
4218
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
4195
4219
  funcName: '[method]output-stream.blocking-write-and-flush',
4196
4220
  paramCount: 0,
4221
+ async: false,
4197
4222
  postReturn: false
4198
4223
  });
4199
4224
  }
@@ -4267,6 +4292,7 @@ function trampoline29(arg0, arg1) {
4267
4292
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
4268
4293
  funcName: '[method]output-stream.blocking-flush',
4269
4294
  paramCount: 0,
4295
+ async: false,
4270
4296
  postReturn: false
4271
4297
  });
4272
4298
  }
@@ -4288,6 +4314,7 @@ function trampoline30(arg0, arg1) {
4288
4314
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"][Instruction::Return]', {
4289
4315
  funcName: 'get-random-bytes',
4290
4316
  paramCount: 0,
4317
+ async: false,
4291
4318
  postReturn: false
4292
4319
  });
4293
4320
  }
@@ -4325,6 +4352,7 @@ function trampoline31(arg0) {
4325
4352
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"][Instruction::Return]', {
4326
4353
  funcName: 'get-directories',
4327
4354
  paramCount: 0,
4355
+ async: false,
4328
4356
  postReturn: false
4329
4357
  });
4330
4358
  }
@@ -4360,6 +4388,7 @@ function trampoline32(arg0) {
4360
4388
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"][Instruction::Return]', {
4361
4389
  funcName: 'get-terminal-stdin',
4362
4390
  paramCount: 0,
4391
+ async: false,
4363
4392
  postReturn: false
4364
4393
  });
4365
4394
  }
@@ -4395,6 +4424,7 @@ function trampoline33(arg0) {
4395
4424
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"][Instruction::Return]', {
4396
4425
  funcName: 'get-terminal-stdout',
4397
4426
  paramCount: 0,
4427
+ async: false,
4398
4428
  postReturn: false
4399
4429
  });
4400
4430
  }
@@ -4426,6 +4456,7 @@ function trampoline34(arg0) {
4426
4456
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"][Instruction::Return]', {
4427
4457
  funcName: 'get-terminal-stderr',
4428
4458
  paramCount: 0,
4459
+ async: false,
4429
4460
  postReturn: false
4430
4461
  });
4431
4462
  }
@@ -4743,7 +4774,12 @@ function generate(arg0, arg1) {
4743
4774
  }
4744
4775
  }
4745
4776
  }
4746
- _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
+ });
4747
4783
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1Generate');
4748
4784
  const ret = exports1Generate(ptr0);
4749
4785
  endCurrentTask(0);
@@ -4824,6 +4860,7 @@ function generate(arg0, arg1) {
4824
4860
  _debugLog('[iface="generate", function="generate"][Instruction::Return]', {
4825
4861
  funcName: 'generate',
4826
4862
  paramCount: 1,
4863
+ async: false,
4827
4864
  postReturn: true
4828
4865
  });
4829
4866
  const retCopy = variant39;
@@ -5040,7 +5077,12 @@ function generateTypes(arg0, arg1) {
5040
5077
  }
5041
5078
  }
5042
5079
  }
5043
- _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
+ });
5044
5086
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'exports1GenerateTypes');
5045
5087
  const ret = exports1GenerateTypes(ptr0);
5046
5088
  endCurrentTask(0);
@@ -5083,6 +5125,7 @@ function generateTypes(arg0, arg1) {
5083
5125
  _debugLog('[iface="generate-types", function="generate-types"][Instruction::Return]', {
5084
5126
  funcName: 'generate-types',
5085
5127
  paramCount: 1,
5128
+ async: false,
5086
5129
  postReturn: true
5087
5130
  });
5088
5131
  const retCopy = variant33;
@@ -5106,24 +5149,24 @@ export const $init = (() => {
5106
5149
  let gen = (function* _initGenerator () {
5107
5150
  const module0 = fetchCompile(new URL('./js-component-bindgen-component.core.wasm', import.meta.url));
5108
5151
  const module1 = fetchCompile(new URL('./js-component-bindgen-component.core2.wasm', import.meta.url));
5109
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUCBAcECAkCAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCwAgACABQQARAgALDwAgACABIAIgA0EBEQQACxEAIAAgASACIAMgBEECEQcACw8AIAAgASACIANBAxEEAAsRACAAIAEgAiADIARBBBEIAAsZACAAIAEgAiADIAQgBSAGIAcgCEEFEQkACwsAIAAgAUEGEQIACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
5110
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAIAATEABAABMgAHAAEzAAQAATQACAABNQAJAAE2AAIAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
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');
5111
5154
  ({ exports: exports0 } = yield instantiateCore(yield module2));
5112
5155
  ({ exports: exports1 } = yield instantiateCore(yield module0, {
5113
5156
  wasi_snapshot_preview1: {
5114
5157
  environ_get: exports0['7'],
5115
5158
  environ_sizes_get: exports0['8'],
5116
5159
  fd_close: exports0['9'],
5117
- fd_filestat_get: exports0['0'],
5160
+ fd_filestat_get: exports0['2'],
5118
5161
  fd_prestat_dir_name: exports0['11'],
5119
5162
  fd_prestat_get: exports0['10'],
5120
- fd_read: exports0['1'],
5121
- fd_readdir: exports0['2'],
5122
- fd_write: exports0['3'],
5123
- path_filestat_get: exports0['4'],
5124
- 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'],
5125
5168
  proc_exit: exports0['12'],
5126
- random_get: exports0['6'],
5169
+ random_get: exports0['1'],
5127
5170
  },
5128
5171
  }));
5129
5172
  ({ exports: exports2 } = yield instantiateCore(yield module1, {
@@ -5204,8 +5247,8 @@ export const $init = (() => {
5204
5247
  ({ exports: exports3 } = yield instantiateCore(yield module3, {
5205
5248
  '': {
5206
5249
  $imports: exports0.$imports,
5207
- '0': exports2.fd_filestat_get,
5208
- '1': exports2.fd_read,
5250
+ '0': exports2.fd_readdir,
5251
+ '1': exports2.random_get,
5209
5252
  '10': exports2.fd_prestat_get,
5210
5253
  '11': exports2.fd_prestat_dir_name,
5211
5254
  '12': exports2.proc_exit,
@@ -5216,7 +5259,7 @@ export const $init = (() => {
5216
5259
  '17': trampoline15,
5217
5260
  '18': trampoline16,
5218
5261
  '19': trampoline17,
5219
- '2': exports2.fd_readdir,
5262
+ '2': exports2.fd_filestat_get,
5220
5263
  '20': trampoline18,
5221
5264
  '21': trampoline19,
5222
5265
  '22': trampoline20,
@@ -5227,7 +5270,7 @@ export const $init = (() => {
5227
5270
  '27': trampoline25,
5228
5271
  '28': trampoline26,
5229
5272
  '29': trampoline27,
5230
- '3': exports2.fd_write,
5273
+ '3': exports2.path_filestat_get,
5231
5274
  '30': trampoline28,
5232
5275
  '31': trampoline29,
5233
5276
  '32': trampoline30,
@@ -5235,9 +5278,9 @@ export const $init = (() => {
5235
5278
  '34': trampoline32,
5236
5279
  '35': trampoline33,
5237
5280
  '36': trampoline34,
5238
- '4': exports2.path_filestat_get,
5239
- '5': exports2.path_open,
5240
- '6': exports2.random_get,
5281
+ '4': exports2.fd_read,
5282
+ '5': exports2.fd_write,
5283
+ '6': exports2.path_open,
5241
5284
  '7': exports2.environ_get,
5242
5285
  '8': exports2.environ_sizes_get,
5243
5286
  '9': exports2.fd_close,
Binary file
package/obj/wasm-tools.js CHANGED
@@ -150,9 +150,9 @@ class AsyncTask {
150
150
  #state;
151
151
  #isAsync;
152
152
  #onResolve = null;
153
- #returnedResults = null;
154
153
  #entryFnName = null;
155
154
  #subtasks = [];
155
+ #completionPromise = null;
156
156
 
157
157
  cancelled = false;
158
158
  requested = false;
@@ -165,6 +165,7 @@ class AsyncTask {
165
165
  awaitableResume = null;
166
166
  awaitableCancel = null;
167
167
 
168
+
168
169
  constructor(opts) {
169
170
  if (opts?.id === undefined) { throw new TypeError('missing task ID during task creation'); }
170
171
  this.#id = opts.id;
@@ -176,8 +177,16 @@ class AsyncTask {
176
177
  this.#isAsync = opts?.isAsync ?? false;
177
178
  this.#entryFnName = opts.entryFnName;
178
179
 
180
+ const {
181
+ promise: completionPromise,
182
+ resolve: resolveCompletionPromise,
183
+ reject: rejectCompletionPromise,
184
+ } = Promise.withResolvers();
185
+ this.#completionPromise = completionPromise;
186
+
179
187
  this.#onResolve = (results) => {
180
- this.#returnedResults = results;
188
+ // TODO: handle external facing cancellation (should likely be a rejection)
189
+ resolveCompletionPromise(results);
181
190
  }
182
191
  }
183
192
 
@@ -185,13 +194,8 @@ class AsyncTask {
185
194
  id() { return this.#id; }
186
195
  componentIdx() { return this.#componentIdx; }
187
196
  isAsync() { return this.#isAsync; }
188
- getEntryFnName() { return this.#entryFnName; }
189
-
190
- takeResults() {
191
- const results = this.#returnedResults;
192
- this.#returnedResults = null;
193
- return results;
194
- }
197
+ entryFnName() { return this.#entryFnName; }
198
+ completionPromise() { return this.#completionPromise; }
195
199
 
196
200
  mayEnter(task) {
197
201
  const cstate = getOrCreateAsyncState(this.#componentIdx);
@@ -222,7 +226,6 @@ class AsyncTask {
222
226
  let mayNotEnter = !this.mayEnter(this);
223
227
  const componentHasPendingTasks = cstate.pendingTasks > 0;
224
228
  if (mayNotEnter || componentHasPendingTasks) {
225
-
226
229
  throw new Error('in enter()'); // TODO: remove
227
230
  cstate.pendingTasks.set(this.#id, new Awaitable(new Promise()));
228
231
 
@@ -234,7 +237,7 @@ class AsyncTask {
234
237
  throw new Error('pending task [' + this.#id + '] not found for component instance');
235
238
  }
236
239
  cstate.pendingTasks.remove(this.#id);
237
- this.#onResolve([]);
240
+ this.#onResolve(new Error('failed enter'));
238
241
  return false;
239
242
  }
240
243
 
@@ -456,17 +459,17 @@ 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) {
464
- _debugLog('[AsyncTask#resolve()] args', { result });
466
+ resolve(results) {
467
+ _debugLog('[AsyncTask#resolve()] args', { results });
465
468
  if (this.#state === AsyncTask.State.RESOLVED) {
466
469
  throw new Error('task is already resolved');
467
470
  }
468
471
  if (this.borrowedHandles.length > 0) { throw new Error('task still has borrow handles'); }
469
- this.#onResolve(result);
472
+ this.#onResolve(results.length === 1 ? results[0] : results);
470
473
  this.#state = AsyncTask.State.RESOLVED;
471
474
  }
472
475
 
@@ -836,6 +839,7 @@ function trampoline5() {
836
839
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"][Instruction::Return]', {
837
840
  funcName: 'get-stderr',
838
841
  paramCount: 1,
842
+ async: false,
839
843
  postReturn: false
840
844
  });
841
845
  return handle0;
@@ -864,6 +868,7 @@ function trampoline8() {
864
868
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"][Instruction::Return]', {
865
869
  funcName: 'get-stdin',
866
870
  paramCount: 1,
871
+ async: false,
867
872
  postReturn: false
868
873
  });
869
874
  return handle0;
@@ -888,6 +893,7 @@ function trampoline9() {
888
893
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"][Instruction::Return]', {
889
894
  funcName: 'get-stdout',
890
895
  paramCount: 1,
896
+ async: false,
891
897
  postReturn: false
892
898
  });
893
899
  return handle0;
@@ -923,6 +929,7 @@ function trampoline10(arg0) {
923
929
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
924
930
  funcName: 'exit',
925
931
  paramCount: 0,
932
+ async: false,
926
933
  postReturn: false
927
934
  });
928
935
  }
@@ -957,6 +964,7 @@ function trampoline11(arg0) {
957
964
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"][Instruction::Return]', {
958
965
  funcName: 'get-environment',
959
966
  paramCount: 0,
967
+ async: false,
960
968
  postReturn: false
961
969
  });
962
970
  }
@@ -1213,6 +1221,7 @@ function trampoline12(arg0, arg1) {
1213
1221
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.get-type"][Instruction::Return]', {
1214
1222
  funcName: '[method]descriptor.get-type',
1215
1223
  paramCount: 0,
1224
+ async: false,
1216
1225
  postReturn: false
1217
1226
  });
1218
1227
  }
@@ -1424,6 +1433,7 @@ function trampoline13(arg0, arg1) {
1424
1433
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash"][Instruction::Return]', {
1425
1434
  funcName: '[method]descriptor.metadata-hash',
1426
1435
  paramCount: 0,
1436
+ async: false,
1427
1437
  postReturn: false
1428
1438
  });
1429
1439
  }
@@ -1622,6 +1632,7 @@ function trampoline14(arg0, arg1) {
1622
1632
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="filesystem-error-code"][Instruction::Return]', {
1623
1633
  funcName: 'filesystem-error-code',
1624
1634
  paramCount: 0,
1635
+ async: false,
1625
1636
  postReturn: false
1626
1637
  });
1627
1638
  }
@@ -1842,6 +1853,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1842
1853
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.metadata-hash-at"][Instruction::Return]', {
1843
1854
  funcName: '[method]descriptor.metadata-hash-at',
1844
1855
  paramCount: 0,
1856
+ async: false,
1845
1857
  postReturn: false
1846
1858
  });
1847
1859
  }
@@ -2060,6 +2072,7 @@ function trampoline16(arg0, arg1, arg2) {
2060
2072
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-via-stream"][Instruction::Return]', {
2061
2073
  funcName: '[method]descriptor.read-via-stream',
2062
2074
  paramCount: 0,
2075
+ async: false,
2063
2076
  postReturn: false
2064
2077
  });
2065
2078
  }
@@ -2278,6 +2291,7 @@ function trampoline17(arg0, arg1, arg2) {
2278
2291
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.write-via-stream"][Instruction::Return]', {
2279
2292
  funcName: '[method]descriptor.write-via-stream',
2280
2293
  paramCount: 0,
2294
+ async: false,
2281
2295
  postReturn: false
2282
2296
  });
2283
2297
  }
@@ -2496,6 +2510,7 @@ function trampoline18(arg0, arg1) {
2496
2510
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.append-via-stream"][Instruction::Return]', {
2497
2511
  funcName: '[method]descriptor.append-via-stream',
2498
2512
  paramCount: 0,
2513
+ async: false,
2499
2514
  postReturn: false
2500
2515
  });
2501
2516
  }
@@ -2718,6 +2733,7 @@ function trampoline19(arg0, arg1) {
2718
2733
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.read-directory"][Instruction::Return]', {
2719
2734
  funcName: '[method]descriptor.read-directory',
2720
2735
  paramCount: 0,
2736
+ async: false,
2721
2737
  postReturn: false
2722
2738
  });
2723
2739
  }
@@ -3003,6 +3019,7 @@ function trampoline20(arg0, arg1) {
3003
3019
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat"][Instruction::Return]', {
3004
3020
  funcName: '[method]descriptor.stat',
3005
3021
  paramCount: 0,
3022
+ async: false,
3006
3023
  postReturn: false
3007
3024
  });
3008
3025
  }
@@ -3297,6 +3314,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
3297
3314
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.stat-at"][Instruction::Return]', {
3298
3315
  funcName: '[method]descriptor.stat-at',
3299
3316
  paramCount: 0,
3317
+ async: false,
3300
3318
  postReturn: false
3301
3319
  });
3302
3320
  }
@@ -3544,6 +3562,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3544
3562
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]descriptor.open-at"][Instruction::Return]', {
3545
3563
  funcName: '[method]descriptor.open-at',
3546
3564
  paramCount: 0,
3565
+ async: false,
3547
3566
  postReturn: false
3548
3567
  });
3549
3568
  }
@@ -3808,6 +3827,7 @@ function trampoline23(arg0, arg1) {
3808
3827
  _debugLog('[iface="wasi:filesystem/types@0.2.3", function="[method]directory-entry-stream.read-directory-entry"][Instruction::Return]', {
3809
3828
  funcName: '[method]directory-entry-stream.read-directory-entry',
3810
3829
  paramCount: 0,
3830
+ async: false,
3811
3831
  postReturn: false
3812
3832
  });
3813
3833
  }
@@ -3888,6 +3908,7 @@ function trampoline24(arg0, arg1, arg2) {
3888
3908
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.read"][Instruction::Return]', {
3889
3909
  funcName: '[method]input-stream.read',
3890
3910
  paramCount: 0,
3911
+ async: false,
3891
3912
  postReturn: false
3892
3913
  });
3893
3914
  }
@@ -3968,6 +3989,7 @@ function trampoline25(arg0, arg1, arg2) {
3968
3989
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]input-stream.blocking-read"][Instruction::Return]', {
3969
3990
  funcName: '[method]input-stream.blocking-read',
3970
3991
  paramCount: 0,
3992
+ async: false,
3971
3993
  postReturn: false
3972
3994
  });
3973
3995
  }
@@ -4042,6 +4064,7 @@ function trampoline26(arg0, arg1) {
4042
4064
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.check-write"][Instruction::Return]', {
4043
4065
  funcName: '[method]output-stream.check-write',
4044
4066
  paramCount: 0,
4067
+ async: false,
4045
4068
  postReturn: false
4046
4069
  });
4047
4070
  }
@@ -4118,6 +4141,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
4118
4141
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.write"][Instruction::Return]', {
4119
4142
  funcName: '[method]output-stream.write',
4120
4143
  paramCount: 0,
4144
+ async: false,
4121
4145
  postReturn: false
4122
4146
  });
4123
4147
  }
@@ -4194,6 +4218,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4194
4218
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-write-and-flush"][Instruction::Return]', {
4195
4219
  funcName: '[method]output-stream.blocking-write-and-flush',
4196
4220
  paramCount: 0,
4221
+ async: false,
4197
4222
  postReturn: false
4198
4223
  });
4199
4224
  }
@@ -4267,6 +4292,7 @@ function trampoline29(arg0, arg1) {
4267
4292
  _debugLog('[iface="wasi:io/streams@0.2.3", function="[method]output-stream.blocking-flush"][Instruction::Return]', {
4268
4293
  funcName: '[method]output-stream.blocking-flush',
4269
4294
  paramCount: 0,
4295
+ async: false,
4270
4296
  postReturn: false
4271
4297
  });
4272
4298
  }
@@ -4288,6 +4314,7 @@ function trampoline30(arg0, arg1) {
4288
4314
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"][Instruction::Return]', {
4289
4315
  funcName: 'get-random-bytes',
4290
4316
  paramCount: 0,
4317
+ async: false,
4291
4318
  postReturn: false
4292
4319
  });
4293
4320
  }
@@ -4325,6 +4352,7 @@ function trampoline31(arg0) {
4325
4352
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"][Instruction::Return]', {
4326
4353
  funcName: 'get-directories',
4327
4354
  paramCount: 0,
4355
+ async: false,
4328
4356
  postReturn: false
4329
4357
  });
4330
4358
  }
@@ -4360,6 +4388,7 @@ function trampoline32(arg0) {
4360
4388
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"][Instruction::Return]', {
4361
4389
  funcName: 'get-terminal-stdin',
4362
4390
  paramCount: 0,
4391
+ async: false,
4363
4392
  postReturn: false
4364
4393
  });
4365
4394
  }
@@ -4395,6 +4424,7 @@ function trampoline33(arg0) {
4395
4424
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"][Instruction::Return]', {
4396
4425
  funcName: 'get-terminal-stdout',
4397
4426
  paramCount: 0,
4427
+ async: false,
4398
4428
  postReturn: false
4399
4429
  });
4400
4430
  }
@@ -4426,6 +4456,7 @@ function trampoline34(arg0) {
4426
4456
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"][Instruction::Return]', {
4427
4457
  funcName: 'get-terminal-stderr',
4428
4458
  paramCount: 0,
4459
+ async: false,
4429
4460
  postReturn: false
4430
4461
  });
4431
4462
  }
@@ -4531,7 +4562,12 @@ function parse(arg0) {
4531
4562
  if (!_initialized) throwUninitialized();
4532
4563
  var ptr0 = utf8Encode(arg0, realloc1, memory0);
4533
4564
  var len0 = utf8EncodedLen;
4534
- _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
+ });
4535
4571
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsParse');
4536
4572
  const ret = toolsParse(ptr0, len0);
4537
4573
  endCurrentTask(0);
@@ -4564,6 +4600,7 @@ function parse(arg0) {
4564
4600
  _debugLog('[iface="local:wasm-tools/tools", function="parse"][Instruction::Return]', {
4565
4601
  funcName: 'parse',
4566
4602
  paramCount: 1,
4603
+ async: false,
4567
4604
  postReturn: true
4568
4605
  });
4569
4606
  const retCopy = variant3;
@@ -4590,7 +4627,12 @@ function print(arg0) {
4590
4627
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
4591
4628
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
4592
4629
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
4593
- _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
+ });
4594
4636
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsPrint');
4595
4637
  const ret = toolsPrint(ptr0, len0);
4596
4638
  endCurrentTask(0);
@@ -4623,6 +4665,7 @@ function print(arg0) {
4623
4665
  _debugLog('[iface="local:wasm-tools/tools", function="print"][Instruction::Return]', {
4624
4666
  funcName: 'print',
4625
4667
  paramCount: 1,
4668
+ async: false,
4626
4669
  postReturn: true
4627
4670
  });
4628
4671
  const retCopy = variant3;
@@ -4681,7 +4724,12 @@ function componentNew(arg0, arg1) {
4681
4724
  variant5_1 = result4;
4682
4725
  variant5_2 = len4;
4683
4726
  }
4684
- _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
+ });
4685
4733
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentNew');
4686
4734
  const ret = toolsComponentNew(ptr0, len0, variant5_0, variant5_1, variant5_2);
4687
4735
  endCurrentTask(0);
@@ -4714,6 +4762,7 @@ function componentNew(arg0, arg1) {
4714
4762
  _debugLog('[iface="local:wasm-tools/tools", function="component-new"][Instruction::Return]', {
4715
4763
  funcName: 'component-new',
4716
4764
  paramCount: 1,
4765
+ async: false,
4717
4766
  postReturn: true
4718
4767
  });
4719
4768
  const retCopy = variant8;
@@ -4740,7 +4789,12 @@ function componentWit(arg0) {
4740
4789
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
4741
4790
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
4742
4791
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
4743
- _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
+ });
4744
4798
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentWit');
4745
4799
  const ret = toolsComponentWit(ptr0, len0);
4746
4800
  endCurrentTask(0);
@@ -4773,6 +4827,7 @@ function componentWit(arg0) {
4773
4827
  _debugLog('[iface="local:wasm-tools/tools", function="component-wit"][Instruction::Return]', {
4774
4828
  funcName: 'component-wit',
4775
4829
  paramCount: 1,
4830
+ async: false,
4776
4831
  postReturn: true
4777
4832
  });
4778
4833
  const retCopy = variant3;
@@ -4953,7 +5008,12 @@ function componentEmbed(arg0) {
4953
5008
  }
4954
5009
  }
4955
5010
  }
4956
- _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
+ });
4957
5017
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsComponentEmbed');
4958
5018
  const ret = toolsComponentEmbed(ptr0);
4959
5019
  endCurrentTask(0);
@@ -4986,6 +5046,7 @@ function componentEmbed(arg0) {
4986
5046
  _debugLog('[iface="local:wasm-tools/tools", function="component-embed"][Instruction::Return]', {
4987
5047
  funcName: 'component-embed',
4988
5048
  paramCount: 1,
5049
+ async: false,
4989
5050
  postReturn: true
4990
5051
  });
4991
5052
  const retCopy = variant27;
@@ -5012,7 +5073,12 @@ function metadataShow(arg0) {
5012
5073
  var ptr0 = realloc1(0, 0, 1, len0 * 1);
5013
5074
  var src0 = new Uint8Array(val0.buffer || val0, val0.byteOffset, len0 * 1);
5014
5075
  (new Uint8Array(memory0.buffer, ptr0, len0 * 1)).set(src0);
5015
- _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
+ });
5016
5082
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsMetadataShow');
5017
5083
  const ret = toolsMetadataShow(ptr0, len0);
5018
5084
  endCurrentTask(0);
@@ -5128,6 +5194,7 @@ function metadataShow(arg0) {
5128
5194
  _debugLog('[iface="local:wasm-tools/tools", function="metadata-show"][Instruction::Return]', {
5129
5195
  funcName: 'metadata-show',
5130
5196
  paramCount: 1,
5197
+ async: false,
5131
5198
  postReturn: true
5132
5199
  });
5133
5200
  const retCopy = variant12;
@@ -5182,7 +5249,12 @@ function metadataAdd(arg0, arg1) {
5182
5249
  dataView(memory0).setUint32(base + 12, len6, true);
5183
5250
  dataView(memory0).setUint32(base + 8, result6, true);
5184
5251
  }
5185
- _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
+ });
5186
5258
  const _wasm_call_currentTaskID = startCurrentTask(0, false, 'toolsMetadataAdd');
5187
5259
  const ret = toolsMetadataAdd(ptr0, len0, result7, len7);
5188
5260
  endCurrentTask(0);
@@ -5215,6 +5287,7 @@ function metadataAdd(arg0, arg1) {
5215
5287
  _debugLog('[iface="local:wasm-tools/tools", function="metadata-add"][Instruction::Return]', {
5216
5288
  funcName: 'metadata-add',
5217
5289
  paramCount: 1,
5290
+ async: false,
5218
5291
  postReturn: true
5219
5292
  });
5220
5293
  const retCopy = variant10;
@@ -5238,8 +5311,8 @@ export const $init = (() => {
5238
5311
  let gen = (function* _initGenerator () {
5239
5312
  const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
5240
5313
  const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
5241
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHCAkCAgQEAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlGQAgACABIAIgAyAEIAUgBiAHIAhBABEHAAsRACAAIAEgAiADIARBAREIAAsRACAAIAEgAiADIARBAhEJAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsPACAAIAEgAiADQQURBAALDwAgACABIAIgA0EGEQQACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
5242
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAcAATEACAABMgAJAAEzAAIAATQAAgABNQAEAAE2AAQAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
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');
5243
5316
  ({ exports: exports0 } = yield instantiateCore(yield module2));
5244
5317
  ({ exports: exports1 } = yield instantiateCore(yield module0, {
5245
5318
  wasi_snapshot_preview1: {
@@ -5250,10 +5323,10 @@ export const $init = (() => {
5250
5323
  fd_prestat_dir_name: exports0['11'],
5251
5324
  fd_prestat_get: exports0['10'],
5252
5325
  fd_read: exports0['5'],
5253
- fd_readdir: exports0['1'],
5326
+ fd_readdir: exports0['2'],
5254
5327
  fd_write: exports0['6'],
5255
- path_filestat_get: exports0['2'],
5256
- path_open: exports0['0'],
5328
+ path_filestat_get: exports0['0'],
5329
+ path_open: exports0['1'],
5257
5330
  proc_exit: exports0['12'],
5258
5331
  random_get: exports0['3'],
5259
5332
  },
@@ -5336,8 +5409,8 @@ export const $init = (() => {
5336
5409
  ({ exports: exports3 } = yield instantiateCore(yield module3, {
5337
5410
  '': {
5338
5411
  $imports: exports0.$imports,
5339
- '0': exports2.path_open,
5340
- '1': exports2.fd_readdir,
5412
+ '0': exports2.path_filestat_get,
5413
+ '1': exports2.path_open,
5341
5414
  '10': exports2.fd_prestat_get,
5342
5415
  '11': exports2.fd_prestat_dir_name,
5343
5416
  '12': exports2.proc_exit,
@@ -5348,7 +5421,7 @@ export const $init = (() => {
5348
5421
  '17': trampoline15,
5349
5422
  '18': trampoline16,
5350
5423
  '19': trampoline17,
5351
- '2': exports2.path_filestat_get,
5424
+ '2': exports2.fd_readdir,
5352
5425
  '20': trampoline18,
5353
5426
  '21': trampoline19,
5354
5427
  '22': trampoline20,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.15.2",
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",
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage('<command> [options]')
27
27
  .enablePositionalOptions()
28
- .version('1.15.2');
28
+ .version('1.15.3');
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);