@bytecodealliance/jco 1.13.1 → 1.13.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.
@@ -1,8 +1,9 @@
1
1
  /** @module Interface wasi:cli/terminal-input@0.2.3 **/
2
2
 
3
- export class TerminalInput {
3
+ export class TerminalInput implements Partial<Disposable> {
4
4
  /**
5
5
  * This type does not have a public constructor.
6
6
  */
7
7
  private constructor();
8
+ [Symbol.dispose]?: () => void;
8
9
  }
@@ -1,8 +1,9 @@
1
1
  /** @module Interface wasi:cli/terminal-output@0.2.3 **/
2
2
 
3
- export class TerminalOutput {
3
+ export class TerminalOutput implements Partial<Disposable> {
4
4
  /**
5
5
  * This type does not have a public constructor.
6
6
  */
7
7
  private constructor();
8
+ [Symbol.dispose]?: () => void;
8
9
  }
@@ -138,7 +138,7 @@ export interface DirectoryEntry {
138
138
  name: string,
139
139
  }
140
140
 
141
- export class Descriptor {
141
+ export class Descriptor implements Partial<Disposable> {
142
142
  /**
143
143
  * This type does not have a public constructor.
144
144
  */
@@ -153,12 +153,14 @@ export class Descriptor {
153
153
  openAt(pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags): Descriptor;
154
154
  metadataHash(): MetadataHashValue;
155
155
  metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
156
+ [Symbol.dispose]?: () => void;
156
157
  }
157
158
 
158
- export class DirectoryEntryStream {
159
+ export class DirectoryEntryStream implements Partial<Disposable> {
159
160
  /**
160
161
  * This type does not have a public constructor.
161
162
  */
162
163
  private constructor();
163
164
  readDirectoryEntry(): DirectoryEntry | undefined;
165
+ [Symbol.dispose]?: () => void;
164
166
  }
@@ -1,8 +1,9 @@
1
1
  /** @module Interface wasi:io/error@0.2.3 **/
2
2
 
3
- export class Error {
3
+ export class Error implements Partial<Disposable> {
4
4
  /**
5
5
  * This type does not have a public constructor.
6
6
  */
7
7
  private constructor();
8
+ [Symbol.dispose]?: () => void;
8
9
  }
@@ -9,16 +9,17 @@ export interface StreamErrorClosed {
9
9
  tag: 'closed',
10
10
  }
11
11
 
12
- export class InputStream {
12
+ export class InputStream implements Partial<Disposable> {
13
13
  /**
14
14
  * This type does not have a public constructor.
15
15
  */
16
16
  private constructor();
17
17
  read(len: bigint): Uint8Array;
18
18
  blockingRead(len: bigint): Uint8Array;
19
+ [Symbol.dispose]?: () => void;
19
20
  }
20
21
 
21
- export class OutputStream {
22
+ export class OutputStream implements Partial<Disposable> {
22
23
  /**
23
24
  * This type does not have a public constructor.
24
25
  */
@@ -27,4 +28,5 @@ export class OutputStream {
27
28
  write(contents: Uint8Array): void;
28
29
  blockingWriteAndFlush(contents: Uint8Array): void;
29
30
  blockingFlush(): void;
31
+ [Symbol.dispose]?: () => void;
30
32
  }
@@ -87,8 +87,8 @@ function startCurrentTask(componentIdx, isAsync, entryFnName) {
87
87
  const newTask = new AsyncTask({ id: nextId, componentIdx, isAsync, entryFnName });
88
88
  const newTaskMeta = { id: nextId, componentIdx, task: newTask };
89
89
 
90
- ASYNC_CURRENT_TASK_ID = nextId;
91
- ASYNC_CURRENT_COMPONENT_IDX = componentIdx;
90
+ ASYNC_CURRENT_TASK_IDS.push(nextId);
91
+ ASYNC_CURRENT_COMPONENT_IDXS.push(componentIdx);
92
92
 
93
93
  if (!tasks) {
94
94
  ASYNC_TASKS_BY_COMPONENT_IDX.set(componentIdx, [newTaskMeta]);
@@ -102,6 +102,8 @@ function startCurrentTask(componentIdx, isAsync, entryFnName) {
102
102
 
103
103
  function endCurrentTask(componentIdx, taskId) {
104
104
  _debugLog('[endCurrentTask()] args', { componentIdx });
105
+ componentIdx ??= ASYNC_CURRENT_COMPONENT_IDXS.at(-1);
106
+ taskId ??= ASYNC_CURRENT_TASK_IDS.at(-1);
105
107
  if (componentIdx === undefined || componentIdx === null) {
106
108
  throw new Error('missing/invalid component instance index while ending current task');
107
109
  }
@@ -120,14 +122,14 @@ function endCurrentTask(componentIdx, taskId) {
120
122
  }
121
123
  }
122
124
 
123
- ASYNC_CURRENT_TASK_ID = null;
124
- ASYNC_CURRENT_COMPONENT_IDX = null;
125
+ ASYNC_CURRENT_TASK_IDS.pop();
126
+ ASYNC_CURRENT_COMPONENT_IDXS.pop();
125
127
 
126
128
  return tasks.pop();
127
129
  }
128
130
  const ASYNC_TASKS_BY_COMPONENT_IDX = new Map();
129
- let ASYNC_CURRENT_TASK_ID = null;
130
- let ASYNC_CURRENT_COMPONENT_IDX = null;
131
+ let ASYNC_CURRENT_TASK_IDS = [];
132
+ let ASYNC_CURRENT_COMPONENT_IDXS = [];
131
133
 
132
134
  class AsyncTask {
133
135
  static State = {
@@ -596,8 +598,8 @@ class ComponentAsyncState {
596
598
  });
597
599
 
598
600
  // If there is an active promise, then wait for it
601
+ let finishedTicket;
599
602
  while (this.#lock.promise) {
600
- const finishedTicket = await this.#lock.promise;
601
603
  finishedTicket = await this.#lock.promise;
602
604
  if (finishedTicket === ticket - 1n) { break; }
603
605
  }
@@ -755,6 +757,7 @@ function trampoline5() {
755
757
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stderr');
756
758
  const ret = getStderr();
757
759
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
760
+ endCurrentTask(0);
758
761
  if (!(ret instanceof OutputStream)) {
759
762
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
760
763
  }
@@ -782,6 +785,7 @@ function trampoline8() {
782
785
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdin');
783
786
  const ret = getStdin();
784
787
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
788
+ endCurrentTask(0);
785
789
  if (!(ret instanceof InputStream)) {
786
790
  throw new TypeError('Resource error: Not a valid "InputStream" resource.');
787
791
  }
@@ -805,6 +809,7 @@ function trampoline9() {
805
809
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdout');
806
810
  const ret = getStdout();
807
811
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
812
+ endCurrentTask(0);
808
813
  if (!(ret instanceof OutputStream)) {
809
814
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
810
815
  }
@@ -848,6 +853,7 @@ function trampoline10(arg0) {
848
853
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'exit');
849
854
  exit(variant0);
850
855
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"] [Instruction::CallInterface] (sync, @ post-call)');
856
+ endCurrentTask(0);
851
857
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
852
858
  funcName: 'exit',
853
859
  paramCount: 0,
@@ -864,6 +870,7 @@ function trampoline11(arg0) {
864
870
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-environment');
865
871
  const ret = getEnvironment();
866
872
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"] [Instruction::CallInterface] (sync, @ post-call)');
873
+ endCurrentTask(0);
867
874
  var vec3 = ret;
868
875
  var len3 = vec3.length;
869
876
  var result3 = realloc0(0, 0, 4, len3 * 16);
@@ -916,6 +923,7 @@ function trampoline12(arg0, arg1) {
916
923
  rsc[symbolRscHandle] = undefined;
917
924
  }
918
925
  curResourceBorrows = [];
926
+ endCurrentTask(0);
919
927
  var variant5 = ret;
920
928
  switch (variant5.tag) {
921
929
  case 'ok': {
@@ -1167,6 +1175,7 @@ function trampoline13(arg0, arg1) {
1167
1175
  rsc[symbolRscHandle] = undefined;
1168
1176
  }
1169
1177
  curResourceBorrows = [];
1178
+ endCurrentTask(0);
1170
1179
  var variant5 = ret;
1171
1180
  switch (variant5.tag) {
1172
1181
  case 'ok': {
@@ -1376,6 +1385,7 @@ function trampoline14(arg0, arg1) {
1376
1385
  rsc[symbolRscHandle] = undefined;
1377
1386
  }
1378
1387
  curResourceBorrows = [];
1388
+ endCurrentTask(0);
1379
1389
  var variant4 = ret;
1380
1390
  if (variant4 === null || variant4=== undefined) {
1381
1391
  dataView(memory0).setInt8(arg1 + 0, 0, true);
@@ -1583,6 +1593,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1583
1593
  rsc[symbolRscHandle] = undefined;
1584
1594
  }
1585
1595
  curResourceBorrows = [];
1596
+ endCurrentTask(0);
1586
1597
  var variant7 = ret;
1587
1598
  switch (variant7.tag) {
1588
1599
  case 'ok': {
@@ -1793,6 +1804,7 @@ function trampoline16(arg0, arg1, arg2) {
1793
1804
  rsc[symbolRscHandle] = undefined;
1794
1805
  }
1795
1806
  curResourceBorrows = [];
1807
+ endCurrentTask(0);
1796
1808
  var variant5 = ret;
1797
1809
  switch (variant5.tag) {
1798
1810
  case 'ok': {
@@ -2010,6 +2022,7 @@ function trampoline17(arg0, arg1, arg2) {
2010
2022
  rsc[symbolRscHandle] = undefined;
2011
2023
  }
2012
2024
  curResourceBorrows = [];
2025
+ endCurrentTask(0);
2013
2026
  var variant5 = ret;
2014
2027
  switch (variant5.tag) {
2015
2028
  case 'ok': {
@@ -2227,6 +2240,7 @@ function trampoline18(arg0, arg1) {
2227
2240
  rsc[symbolRscHandle] = undefined;
2228
2241
  }
2229
2242
  curResourceBorrows = [];
2243
+ endCurrentTask(0);
2230
2244
  var variant5 = ret;
2231
2245
  switch (variant5.tag) {
2232
2246
  case 'ok': {
@@ -2448,6 +2462,7 @@ function trampoline19(arg0, arg1) {
2448
2462
  rsc[symbolRscHandle] = undefined;
2449
2463
  }
2450
2464
  curResourceBorrows = [];
2465
+ endCurrentTask(0);
2451
2466
  var variant5 = ret;
2452
2467
  switch (variant5.tag) {
2453
2468
  case 'ok': {
@@ -2665,6 +2680,7 @@ function trampoline20(arg0, arg1) {
2665
2680
  rsc[symbolRscHandle] = undefined;
2666
2681
  }
2667
2682
  curResourceBorrows = [];
2683
+ endCurrentTask(0);
2668
2684
  var variant12 = ret;
2669
2685
  switch (variant12.tag) {
2670
2686
  case 'ok': {
@@ -2958,6 +2974,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
2958
2974
  rsc[symbolRscHandle] = undefined;
2959
2975
  }
2960
2976
  curResourceBorrows = [];
2977
+ endCurrentTask(0);
2961
2978
  var variant14 = ret;
2962
2979
  switch (variant14.tag) {
2963
2980
  case 'ok': {
@@ -3271,6 +3288,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3271
3288
  rsc[symbolRscHandle] = undefined;
3272
3289
  }
3273
3290
  curResourceBorrows = [];
3291
+ endCurrentTask(0);
3274
3292
  var variant9 = ret;
3275
3293
  switch (variant9.tag) {
3276
3294
  case 'ok': {
@@ -3488,6 +3506,7 @@ function trampoline23(arg0, arg1) {
3488
3506
  rsc[symbolRscHandle] = undefined;
3489
3507
  }
3490
3508
  curResourceBorrows = [];
3509
+ endCurrentTask(0);
3491
3510
  var variant8 = ret;
3492
3511
  switch (variant8.tag) {
3493
3512
  case 'ok': {
@@ -3751,6 +3770,7 @@ function trampoline24(arg0, arg1, arg2) {
3751
3770
  rsc[symbolRscHandle] = undefined;
3752
3771
  }
3753
3772
  curResourceBorrows = [];
3773
+ endCurrentTask(0);
3754
3774
  var variant6 = ret;
3755
3775
  switch (variant6.tag) {
3756
3776
  case 'ok': {
@@ -3830,6 +3850,7 @@ function trampoline25(arg0, arg1, arg2) {
3830
3850
  rsc[symbolRscHandle] = undefined;
3831
3851
  }
3832
3852
  curResourceBorrows = [];
3853
+ endCurrentTask(0);
3833
3854
  var variant6 = ret;
3834
3855
  switch (variant6.tag) {
3835
3856
  case 'ok': {
@@ -3909,6 +3930,7 @@ function trampoline26(arg0, arg1) {
3909
3930
  rsc[symbolRscHandle] = undefined;
3910
3931
  }
3911
3932
  curResourceBorrows = [];
3933
+ endCurrentTask(0);
3912
3934
  var variant5 = ret;
3913
3935
  switch (variant5.tag) {
3914
3936
  case 'ok': {
@@ -3985,6 +4007,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
3985
4007
  rsc[symbolRscHandle] = undefined;
3986
4008
  }
3987
4009
  curResourceBorrows = [];
4010
+ endCurrentTask(0);
3988
4011
  var variant6 = ret;
3989
4012
  switch (variant6.tag) {
3990
4013
  case 'ok': {
@@ -4060,6 +4083,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4060
4083
  rsc[symbolRscHandle] = undefined;
4061
4084
  }
4062
4085
  curResourceBorrows = [];
4086
+ endCurrentTask(0);
4063
4087
  var variant6 = ret;
4064
4088
  switch (variant6.tag) {
4065
4089
  case 'ok': {
@@ -4132,6 +4156,7 @@ function trampoline29(arg0, arg1) {
4132
4156
  rsc[symbolRscHandle] = undefined;
4133
4157
  }
4134
4158
  curResourceBorrows = [];
4159
+ endCurrentTask(0);
4135
4160
  var variant5 = ret;
4136
4161
  switch (variant5.tag) {
4137
4162
  case 'ok': {
@@ -4186,6 +4211,7 @@ function trampoline30(arg0, arg1) {
4186
4211
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-random-bytes');
4187
4212
  const ret = getRandomBytes(BigInt.asUintN(64, arg0));
4188
4213
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"] [Instruction::CallInterface] (sync, @ post-call)');
4214
+ endCurrentTask(0);
4189
4215
  var val0 = ret;
4190
4216
  var len0 = val0.byteLength;
4191
4217
  var ptr0 = realloc0(0, 0, 1, len0 * 1);
@@ -4206,6 +4232,7 @@ function trampoline31(arg0) {
4206
4232
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-directories');
4207
4233
  const ret = getDirectories();
4208
4234
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"] [Instruction::CallInterface] (sync, @ post-call)');
4235
+ endCurrentTask(0);
4209
4236
  var vec3 = ret;
4210
4237
  var len3 = vec3.length;
4211
4238
  var result3 = realloc0(0, 0, 4, len3 * 12);
@@ -4246,6 +4273,7 @@ function trampoline32(arg0) {
4246
4273
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stdin');
4247
4274
  const ret = getTerminalStdin();
4248
4275
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
4276
+ endCurrentTask(0);
4249
4277
  var variant1 = ret;
4250
4278
  if (variant1 === null || variant1=== undefined) {
4251
4279
  dataView(memory0).setInt8(arg0 + 0, 0, true);
@@ -4280,6 +4308,7 @@ function trampoline33(arg0) {
4280
4308
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stdout');
4281
4309
  const ret = getTerminalStdout();
4282
4310
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
4311
+ endCurrentTask(0);
4283
4312
  var variant1 = ret;
4284
4313
  if (variant1 === null || variant1=== undefined) {
4285
4314
  dataView(memory0).setInt8(arg0 + 0, 0, true);
@@ -4310,6 +4339,7 @@ function trampoline34(arg0) {
4310
4339
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stderr');
4311
4340
  const ret = getTerminalStderr();
4312
4341
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
4342
+ endCurrentTask(0);
4313
4343
  var variant1 = ret;
4314
4344
  if (variant1 === null || variant1=== undefined) {
4315
4345
  dataView(memory0).setInt8(arg0 + 0, 0, true);
package/obj/wasm-tools.js CHANGED
@@ -87,8 +87,8 @@ function startCurrentTask(componentIdx, isAsync, entryFnName) {
87
87
  const newTask = new AsyncTask({ id: nextId, componentIdx, isAsync, entryFnName });
88
88
  const newTaskMeta = { id: nextId, componentIdx, task: newTask };
89
89
 
90
- ASYNC_CURRENT_TASK_ID = nextId;
91
- ASYNC_CURRENT_COMPONENT_IDX = componentIdx;
90
+ ASYNC_CURRENT_TASK_IDS.push(nextId);
91
+ ASYNC_CURRENT_COMPONENT_IDXS.push(componentIdx);
92
92
 
93
93
  if (!tasks) {
94
94
  ASYNC_TASKS_BY_COMPONENT_IDX.set(componentIdx, [newTaskMeta]);
@@ -102,6 +102,8 @@ function startCurrentTask(componentIdx, isAsync, entryFnName) {
102
102
 
103
103
  function endCurrentTask(componentIdx, taskId) {
104
104
  _debugLog('[endCurrentTask()] args', { componentIdx });
105
+ componentIdx ??= ASYNC_CURRENT_COMPONENT_IDXS.at(-1);
106
+ taskId ??= ASYNC_CURRENT_TASK_IDS.at(-1);
105
107
  if (componentIdx === undefined || componentIdx === null) {
106
108
  throw new Error('missing/invalid component instance index while ending current task');
107
109
  }
@@ -120,14 +122,14 @@ function endCurrentTask(componentIdx, taskId) {
120
122
  }
121
123
  }
122
124
 
123
- ASYNC_CURRENT_TASK_ID = null;
124
- ASYNC_CURRENT_COMPONENT_IDX = null;
125
+ ASYNC_CURRENT_TASK_IDS.pop();
126
+ ASYNC_CURRENT_COMPONENT_IDXS.pop();
125
127
 
126
128
  return tasks.pop();
127
129
  }
128
130
  const ASYNC_TASKS_BY_COMPONENT_IDX = new Map();
129
- let ASYNC_CURRENT_TASK_ID = null;
130
- let ASYNC_CURRENT_COMPONENT_IDX = null;
131
+ let ASYNC_CURRENT_TASK_IDS = [];
132
+ let ASYNC_CURRENT_COMPONENT_IDXS = [];
131
133
 
132
134
  class AsyncTask {
133
135
  static State = {
@@ -596,8 +598,8 @@ class ComponentAsyncState {
596
598
  });
597
599
 
598
600
  // If there is an active promise, then wait for it
601
+ let finishedTicket;
599
602
  while (this.#lock.promise) {
600
- const finishedTicket = await this.#lock.promise;
601
603
  finishedTicket = await this.#lock.promise;
602
604
  if (finishedTicket === ticket - 1n) { break; }
603
605
  }
@@ -755,6 +757,7 @@ function trampoline5() {
755
757
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stderr');
756
758
  const ret = getStderr();
757
759
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
760
+ endCurrentTask(0);
758
761
  if (!(ret instanceof OutputStream)) {
759
762
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
760
763
  }
@@ -782,6 +785,7 @@ function trampoline8() {
782
785
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdin');
783
786
  const ret = getStdin();
784
787
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
788
+ endCurrentTask(0);
785
789
  if (!(ret instanceof InputStream)) {
786
790
  throw new TypeError('Resource error: Not a valid "InputStream" resource.');
787
791
  }
@@ -805,6 +809,7 @@ function trampoline9() {
805
809
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-stdout');
806
810
  const ret = getStdout();
807
811
  _debugLog('[iface="wasi:cli/stdout@0.2.3", function="get-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
812
+ endCurrentTask(0);
808
813
  if (!(ret instanceof OutputStream)) {
809
814
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
810
815
  }
@@ -848,6 +853,7 @@ function trampoline10(arg0) {
848
853
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'exit');
849
854
  exit(variant0);
850
855
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"] [Instruction::CallInterface] (sync, @ post-call)');
856
+ endCurrentTask(0);
851
857
  _debugLog('[iface="wasi:cli/exit@0.2.3", function="exit"][Instruction::Return]', {
852
858
  funcName: 'exit',
853
859
  paramCount: 0,
@@ -864,6 +870,7 @@ function trampoline11(arg0) {
864
870
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-environment');
865
871
  const ret = getEnvironment();
866
872
  _debugLog('[iface="wasi:cli/environment@0.2.3", function="get-environment"] [Instruction::CallInterface] (sync, @ post-call)');
873
+ endCurrentTask(0);
867
874
  var vec3 = ret;
868
875
  var len3 = vec3.length;
869
876
  var result3 = realloc0(0, 0, 4, len3 * 16);
@@ -916,6 +923,7 @@ function trampoline12(arg0, arg1) {
916
923
  rsc[symbolRscHandle] = undefined;
917
924
  }
918
925
  curResourceBorrows = [];
926
+ endCurrentTask(0);
919
927
  var variant5 = ret;
920
928
  switch (variant5.tag) {
921
929
  case 'ok': {
@@ -1167,6 +1175,7 @@ function trampoline13(arg0, arg1) {
1167
1175
  rsc[symbolRscHandle] = undefined;
1168
1176
  }
1169
1177
  curResourceBorrows = [];
1178
+ endCurrentTask(0);
1170
1179
  var variant5 = ret;
1171
1180
  switch (variant5.tag) {
1172
1181
  case 'ok': {
@@ -1376,6 +1385,7 @@ function trampoline14(arg0, arg1) {
1376
1385
  rsc[symbolRscHandle] = undefined;
1377
1386
  }
1378
1387
  curResourceBorrows = [];
1388
+ endCurrentTask(0);
1379
1389
  var variant4 = ret;
1380
1390
  if (variant4 === null || variant4=== undefined) {
1381
1391
  dataView(memory0).setInt8(arg1 + 0, 0, true);
@@ -1583,6 +1593,7 @@ function trampoline15(arg0, arg1, arg2, arg3, arg4) {
1583
1593
  rsc[symbolRscHandle] = undefined;
1584
1594
  }
1585
1595
  curResourceBorrows = [];
1596
+ endCurrentTask(0);
1586
1597
  var variant7 = ret;
1587
1598
  switch (variant7.tag) {
1588
1599
  case 'ok': {
@@ -1793,6 +1804,7 @@ function trampoline16(arg0, arg1, arg2) {
1793
1804
  rsc[symbolRscHandle] = undefined;
1794
1805
  }
1795
1806
  curResourceBorrows = [];
1807
+ endCurrentTask(0);
1796
1808
  var variant5 = ret;
1797
1809
  switch (variant5.tag) {
1798
1810
  case 'ok': {
@@ -2010,6 +2022,7 @@ function trampoline17(arg0, arg1, arg2) {
2010
2022
  rsc[symbolRscHandle] = undefined;
2011
2023
  }
2012
2024
  curResourceBorrows = [];
2025
+ endCurrentTask(0);
2013
2026
  var variant5 = ret;
2014
2027
  switch (variant5.tag) {
2015
2028
  case 'ok': {
@@ -2227,6 +2240,7 @@ function trampoline18(arg0, arg1) {
2227
2240
  rsc[symbolRscHandle] = undefined;
2228
2241
  }
2229
2242
  curResourceBorrows = [];
2243
+ endCurrentTask(0);
2230
2244
  var variant5 = ret;
2231
2245
  switch (variant5.tag) {
2232
2246
  case 'ok': {
@@ -2448,6 +2462,7 @@ function trampoline19(arg0, arg1) {
2448
2462
  rsc[symbolRscHandle] = undefined;
2449
2463
  }
2450
2464
  curResourceBorrows = [];
2465
+ endCurrentTask(0);
2451
2466
  var variant5 = ret;
2452
2467
  switch (variant5.tag) {
2453
2468
  case 'ok': {
@@ -2665,6 +2680,7 @@ function trampoline20(arg0, arg1) {
2665
2680
  rsc[symbolRscHandle] = undefined;
2666
2681
  }
2667
2682
  curResourceBorrows = [];
2683
+ endCurrentTask(0);
2668
2684
  var variant12 = ret;
2669
2685
  switch (variant12.tag) {
2670
2686
  case 'ok': {
@@ -2958,6 +2974,7 @@ function trampoline21(arg0, arg1, arg2, arg3, arg4) {
2958
2974
  rsc[symbolRscHandle] = undefined;
2959
2975
  }
2960
2976
  curResourceBorrows = [];
2977
+ endCurrentTask(0);
2961
2978
  var variant14 = ret;
2962
2979
  switch (variant14.tag) {
2963
2980
  case 'ok': {
@@ -3271,6 +3288,7 @@ function trampoline22(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
3271
3288
  rsc[symbolRscHandle] = undefined;
3272
3289
  }
3273
3290
  curResourceBorrows = [];
3291
+ endCurrentTask(0);
3274
3292
  var variant9 = ret;
3275
3293
  switch (variant9.tag) {
3276
3294
  case 'ok': {
@@ -3488,6 +3506,7 @@ function trampoline23(arg0, arg1) {
3488
3506
  rsc[symbolRscHandle] = undefined;
3489
3507
  }
3490
3508
  curResourceBorrows = [];
3509
+ endCurrentTask(0);
3491
3510
  var variant8 = ret;
3492
3511
  switch (variant8.tag) {
3493
3512
  case 'ok': {
@@ -3751,6 +3770,7 @@ function trampoline24(arg0, arg1, arg2) {
3751
3770
  rsc[symbolRscHandle] = undefined;
3752
3771
  }
3753
3772
  curResourceBorrows = [];
3773
+ endCurrentTask(0);
3754
3774
  var variant6 = ret;
3755
3775
  switch (variant6.tag) {
3756
3776
  case 'ok': {
@@ -3830,6 +3850,7 @@ function trampoline25(arg0, arg1, arg2) {
3830
3850
  rsc[symbolRscHandle] = undefined;
3831
3851
  }
3832
3852
  curResourceBorrows = [];
3853
+ endCurrentTask(0);
3833
3854
  var variant6 = ret;
3834
3855
  switch (variant6.tag) {
3835
3856
  case 'ok': {
@@ -3909,6 +3930,7 @@ function trampoline26(arg0, arg1) {
3909
3930
  rsc[symbolRscHandle] = undefined;
3910
3931
  }
3911
3932
  curResourceBorrows = [];
3933
+ endCurrentTask(0);
3912
3934
  var variant5 = ret;
3913
3935
  switch (variant5.tag) {
3914
3936
  case 'ok': {
@@ -3985,6 +4007,7 @@ function trampoline27(arg0, arg1, arg2, arg3) {
3985
4007
  rsc[symbolRscHandle] = undefined;
3986
4008
  }
3987
4009
  curResourceBorrows = [];
4010
+ endCurrentTask(0);
3988
4011
  var variant6 = ret;
3989
4012
  switch (variant6.tag) {
3990
4013
  case 'ok': {
@@ -4060,6 +4083,7 @@ function trampoline28(arg0, arg1, arg2, arg3) {
4060
4083
  rsc[symbolRscHandle] = undefined;
4061
4084
  }
4062
4085
  curResourceBorrows = [];
4086
+ endCurrentTask(0);
4063
4087
  var variant6 = ret;
4064
4088
  switch (variant6.tag) {
4065
4089
  case 'ok': {
@@ -4132,6 +4156,7 @@ function trampoline29(arg0, arg1) {
4132
4156
  rsc[symbolRscHandle] = undefined;
4133
4157
  }
4134
4158
  curResourceBorrows = [];
4159
+ endCurrentTask(0);
4135
4160
  var variant5 = ret;
4136
4161
  switch (variant5.tag) {
4137
4162
  case 'ok': {
@@ -4186,6 +4211,7 @@ function trampoline30(arg0, arg1) {
4186
4211
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-random-bytes');
4187
4212
  const ret = getRandomBytes(BigInt.asUintN(64, arg0));
4188
4213
  _debugLog('[iface="wasi:random/random@0.2.3", function="get-random-bytes"] [Instruction::CallInterface] (sync, @ post-call)');
4214
+ endCurrentTask(0);
4189
4215
  var val0 = ret;
4190
4216
  var len0 = val0.byteLength;
4191
4217
  var ptr0 = realloc0(0, 0, 1, len0 * 1);
@@ -4206,6 +4232,7 @@ function trampoline31(arg0) {
4206
4232
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-directories');
4207
4233
  const ret = getDirectories();
4208
4234
  _debugLog('[iface="wasi:filesystem/preopens@0.2.3", function="get-directories"] [Instruction::CallInterface] (sync, @ post-call)');
4235
+ endCurrentTask(0);
4209
4236
  var vec3 = ret;
4210
4237
  var len3 = vec3.length;
4211
4238
  var result3 = realloc0(0, 0, 4, len3 * 12);
@@ -4246,6 +4273,7 @@ function trampoline32(arg0) {
4246
4273
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stdin');
4247
4274
  const ret = getTerminalStdin();
4248
4275
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ post-call)');
4276
+ endCurrentTask(0);
4249
4277
  var variant1 = ret;
4250
4278
  if (variant1 === null || variant1=== undefined) {
4251
4279
  dataView(memory0).setInt8(arg0 + 0, 0, true);
@@ -4280,6 +4308,7 @@ function trampoline33(arg0) {
4280
4308
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stdout');
4281
4309
  const ret = getTerminalStdout();
4282
4310
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ post-call)');
4311
+ endCurrentTask(0);
4283
4312
  var variant1 = ret;
4284
4313
  if (variant1 === null || variant1=== undefined) {
4285
4314
  dataView(memory0).setInt8(arg0 + 0, 0, true);
@@ -4310,6 +4339,7 @@ function trampoline34(arg0) {
4310
4339
  const _interface_call_currentTaskID = startCurrentTask(0, false, 'get-terminal-stderr');
4311
4340
  const ret = getTerminalStderr();
4312
4341
  _debugLog('[iface="wasi:cli/terminal-stderr@0.2.3", function="get-terminal-stderr"] [Instruction::CallInterface] (sync, @ post-call)');
4342
+ endCurrentTask(0);
4313
4343
  var variant1 = ret;
4314
4344
  if (variant1 === null || variant1=== undefined) {
4315
4345
  dataView(memory0).setInt8(arg0 + 0, 0, true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.13.1",
3
+ "version": "1.13.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",
@@ -77,19 +77,19 @@
77
77
  },
78
78
  "devDependencies": {
79
79
  "@commitlint/config-conventional": "^19.8.1",
80
- "@types/node": "^24.2.0",
81
- "@typescript-eslint/eslint-plugin": "^8.37.0",
82
- "@typescript-eslint/parser": "^8.37.0",
80
+ "@types/node": "^24.2.1",
81
+ "@typescript-eslint/eslint-plugin": "^8.39.0",
82
+ "@typescript-eslint/parser": "^8.39.0",
83
83
  "commitlint": "^19.8.1",
84
84
  "conventional-changelog-conventionalcommits": "^9.1.0",
85
- "eslint": "^9.31.0",
85
+ "eslint": "^9.33.0",
86
86
  "eslint-config-prettier": "^10.1.8",
87
- "eslint-plugin-prettier": "^5.5.3",
87
+ "eslint-plugin-prettier": "^5.5.4",
88
88
  "mime": "^4.0.7",
89
89
  "prettier": "^3.6.2",
90
- "puppeteer": "^24.14.0",
90
+ "puppeteer": "^24.16.1",
91
91
  "semver": "^7.7.1",
92
- "smol-toml": "^1.4.1",
92
+ "smol-toml": "^1.4.2",
93
93
  "typescript": "^5.9.2",
94
94
  "vitest": "^3.2.4"
95
95
  }
@@ -28,6 +28,7 @@ export async function componentize(jsSource, opts) {
28
28
  enableFeatures: opts.enable,
29
29
  preview2Adapter: opts.preview2Adapter,
30
30
  debugBuild: opts.debugStarlingmonkeyBuild,
31
+ engine: opts.engine,
31
32
  debug: {
32
33
  bindings: opts.debugBindings,
33
34
  bindingsDir: opts.debugBindingsDir,
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage('<command> [options]')
27
27
  .enablePositionalOptions()
28
- .version('1.13.1');
28
+ .version('1.13.3');
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);
@@ -69,6 +69,7 @@ program
69
69
  '--debug-starlingmonkey-build',
70
70
  'use a debug build of StarlingMonkey'
71
71
  )
72
+ .option('--engine <path>', 'use a specific StarlingMonkey build')
72
73
  .requiredOption('-o, --out <out>', 'output component file')
73
74
  .option(
74
75
  '--debug-bindings',