@bytecodealliance/jco 1.2.3 → 1.3.0

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.
package/obj/wasm-tools.js CHANGED
@@ -113,22 +113,14 @@ function utf8Encode(s, realloc, memory) {
113
113
  utf8EncodedLen = 0;
114
114
  return 1;
115
115
  }
116
- let allocLen = 0;
117
- let ptr = 0;
118
- let writtenTotal = 0;
119
- while (s.length > 0) {
120
- ptr = realloc(ptr, allocLen, 1, allocLen += s.length * 2);
121
- const { read, written } = utf8Encoder.encodeInto(
122
- s,
123
- new Uint8Array(memory.buffer, ptr + writtenTotal, allocLen - writtenTotal),
124
- );
125
- writtenTotal += written;
126
- s = s.slice(read);
127
- }
128
- utf8EncodedLen = writtenTotal;
116
+ let buf = utf8Encoder.encode(s);
117
+ let ptr = realloc(0, 0, 1, buf.length);
118
+ new Uint8Array(memory.buffer).set(buf, ptr);
119
+ utf8EncodedLen = buf.length;
129
120
  return ptr;
130
121
  }
131
122
 
123
+
132
124
  let exports0;
133
125
  let exports1;
134
126
  const handleTable2 = [T_FLAG, 0];
@@ -149,36 +141,12 @@ function trampoline5() {
149
141
  }
150
142
  return handle0;
151
143
  }
152
-
153
- function trampoline6(arg0) {
154
- let variant0;
155
- switch (arg0) {
156
- case 0: {
157
- variant0= {
158
- tag: 'ok',
159
- val: undefined
160
- };
161
- break;
162
- }
163
- case 1: {
164
- variant0= {
165
- tag: 'err',
166
- val: undefined
167
- };
168
- break;
169
- }
170
- default: {
171
- throw new TypeError('invalid variant discriminant for expected');
172
- }
173
- }
174
- exit(variant0);
175
- }
176
144
  const handleTable1 = [T_FLAG, 0];
177
145
  const captureTable1= new Map();
178
146
  let captureCnt1 = 0;
179
147
  handleTables[1] = handleTable1;
180
148
 
181
- function trampoline7() {
149
+ function trampoline8() {
182
150
  const ret = getStdin();
183
151
  if (!(ret instanceof InputStream)) {
184
152
  throw new TypeError('Resource error: Not a valid "InputStream" resource.');
@@ -192,7 +160,7 @@ function trampoline7() {
192
160
  return handle0;
193
161
  }
194
162
 
195
- function trampoline8() {
163
+ function trampoline9() {
196
164
  const ret = getStdout();
197
165
  if (!(ret instanceof OutputStream)) {
198
166
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
@@ -205,40 +173,58 @@ function trampoline8() {
205
173
  }
206
174
  return handle0;
207
175
  }
176
+
177
+ function trampoline10(arg0) {
178
+ let variant0;
179
+ switch (arg0) {
180
+ case 0: {
181
+ variant0= {
182
+ tag: 'ok',
183
+ val: undefined
184
+ };
185
+ break;
186
+ }
187
+ case 1: {
188
+ variant0= {
189
+ tag: 'err',
190
+ val: undefined
191
+ };
192
+ break;
193
+ }
194
+ default: {
195
+ throw new TypeError('invalid variant discriminant for expected');
196
+ }
197
+ }
198
+ exit(variant0);
199
+ }
208
200
  let exports2;
209
201
  let memory0;
210
202
  let realloc0;
211
- const handleTable5 = [T_FLAG, 0];
212
- const captureTable5= new Map();
213
- let captureCnt5 = 0;
214
- handleTables[5] = handleTable5;
215
203
 
216
204
  function trampoline11(arg0) {
217
- const ret = getDirectories();
205
+ const ret = getEnvironment();
218
206
  var vec3 = ret;
219
207
  var len3 = vec3.length;
220
- var result3 = realloc0(0, 0, 4, len3 * 12);
208
+ var result3 = realloc0(0, 0, 4, len3 * 16);
221
209
  for (let i = 0; i < vec3.length; i++) {
222
210
  const e = vec3[i];
223
- const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
224
- if (!(tuple0_0 instanceof Descriptor)) {
225
- throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
226
- }
227
- var handle1 = tuple0_0[symbolRscHandle];
228
- if (!handle1) {
229
- const rep = tuple0_0[symbolRscRep] || ++captureCnt5;
230
- captureTable5.set(rep, tuple0_0);
231
- handle1 = rscTableCreateOwn(handleTable5, rep);
232
- }
233
- dataView(memory0).setInt32(base + 0, handle1, true);
211
+ const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
212
+ var ptr1 = utf8Encode(tuple0_0, realloc0, memory0);
213
+ var len1 = utf8EncodedLen;
214
+ dataView(memory0).setInt32(base + 4, len1, true);
215
+ dataView(memory0).setInt32(base + 0, ptr1, true);
234
216
  var ptr2 = utf8Encode(tuple0_1, realloc0, memory0);
235
217
  var len2 = utf8EncodedLen;
236
- dataView(memory0).setInt32(base + 8, len2, true);
237
- dataView(memory0).setInt32(base + 4, ptr2, true);
218
+ dataView(memory0).setInt32(base + 12, len2, true);
219
+ dataView(memory0).setInt32(base + 8, ptr2, true);
238
220
  }
239
221
  dataView(memory0).setInt32(arg0 + 4, len3, true);
240
222
  dataView(memory0).setInt32(arg0 + 0, result3, true);
241
223
  }
224
+ const handleTable5 = [T_FLAG, 0];
225
+ const captureTable5= new Map();
226
+ let captureCnt5 = 0;
227
+ handleTables[5] = handleTable5;
242
228
 
243
229
  function trampoline12(arg0, arg1, arg2) {
244
230
  var handle1 = arg0;
@@ -3378,21 +3364,27 @@ function trampoline30(arg0, arg1) {
3378
3364
  }
3379
3365
 
3380
3366
  function trampoline31(arg0) {
3381
- const ret = getEnvironment();
3367
+ const ret = getDirectories();
3382
3368
  var vec3 = ret;
3383
3369
  var len3 = vec3.length;
3384
- var result3 = realloc0(0, 0, 4, len3 * 16);
3370
+ var result3 = realloc0(0, 0, 4, len3 * 12);
3385
3371
  for (let i = 0; i < vec3.length; i++) {
3386
3372
  const e = vec3[i];
3387
- const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
3388
- var ptr1 = utf8Encode(tuple0_0, realloc0, memory0);
3389
- var len1 = utf8EncodedLen;
3390
- dataView(memory0).setInt32(base + 4, len1, true);
3391
- dataView(memory0).setInt32(base + 0, ptr1, true);
3373
+ const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
3374
+ if (!(tuple0_0 instanceof Descriptor)) {
3375
+ throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
3376
+ }
3377
+ var handle1 = tuple0_0[symbolRscHandle];
3378
+ if (!handle1) {
3379
+ const rep = tuple0_0[symbolRscRep] || ++captureCnt5;
3380
+ captureTable5.set(rep, tuple0_0);
3381
+ handle1 = rscTableCreateOwn(handleTable5, rep);
3382
+ }
3383
+ dataView(memory0).setInt32(base + 0, handle1, true);
3392
3384
  var ptr2 = utf8Encode(tuple0_1, realloc0, memory0);
3393
3385
  var len2 = utf8EncodedLen;
3394
- dataView(memory0).setInt32(base + 12, len2, true);
3395
- dataView(memory0).setInt32(base + 8, ptr2, true);
3386
+ dataView(memory0).setInt32(base + 8, len2, true);
3387
+ dataView(memory0).setInt32(base + 4, ptr2, true);
3396
3388
  }
3397
3389
  dataView(memory0).setInt32(arg0 + 4, len3, true);
3398
3390
  dataView(memory0).setInt32(arg0 + 0, result3, true);
@@ -3486,6 +3478,19 @@ function trampoline0(handle) {
3486
3478
  }
3487
3479
  }
3488
3480
  function trampoline1(handle) {
3481
+ const handleEntry = rscTableRemove(handleTable2, handle);
3482
+ if (handleEntry.own) {
3483
+
3484
+ const rsc = captureTable2.get(handleEntry.rep);
3485
+ if (rsc) {
3486
+ if (rsc[symbolDispose]) rsc[symbolDispose]();
3487
+ captureTable2.delete(handleEntry.rep);
3488
+ } else if (OutputStream[symbolCabiDispose]) {
3489
+ OutputStream[symbolCabiDispose](handleEntry.rep);
3490
+ }
3491
+ }
3492
+ }
3493
+ function trampoline2(handle) {
3489
3494
  const handleEntry = rscTableRemove(handleTable0, handle);
3490
3495
  if (handleEntry.own) {
3491
3496
 
@@ -3498,7 +3503,7 @@ function trampoline1(handle) {
3498
3503
  }
3499
3504
  }
3500
3505
  }
3501
- function trampoline2(handle) {
3506
+ function trampoline3(handle) {
3502
3507
  const handleEntry = rscTableRemove(handleTable1, handle);
3503
3508
  if (handleEntry.own) {
3504
3509
 
@@ -3511,19 +3516,6 @@ function trampoline2(handle) {
3511
3516
  }
3512
3517
  }
3513
3518
  }
3514
- function trampoline3(handle) {
3515
- const handleEntry = rscTableRemove(handleTable2, handle);
3516
- if (handleEntry.own) {
3517
-
3518
- const rsc = captureTable2.get(handleEntry.rep);
3519
- if (rsc) {
3520
- if (rsc[symbolDispose]) rsc[symbolDispose]();
3521
- captureTable2.delete(handleEntry.rep);
3522
- } else if (OutputStream[symbolCabiDispose]) {
3523
- OutputStream[symbolCabiDispose](handleEntry.rep);
3524
- }
3525
- }
3526
- }
3527
3519
  function trampoline4(handle) {
3528
3520
  const handleEntry = rscTableRemove(handleTable5, handle);
3529
3521
  if (handleEntry.own) {
@@ -3537,7 +3529,7 @@ function trampoline4(handle) {
3537
3529
  }
3538
3530
  }
3539
3531
  }
3540
- function trampoline9(handle) {
3532
+ function trampoline6(handle) {
3541
3533
  const handleEntry = rscTableRemove(handleTable3, handle);
3542
3534
  if (handleEntry.own) {
3543
3535
 
@@ -3550,7 +3542,7 @@ function trampoline9(handle) {
3550
3542
  }
3551
3543
  }
3552
3544
  }
3553
- function trampoline10(handle) {
3545
+ function trampoline7(handle) {
3554
3546
  const handleEntry = rscTableRemove(handleTable4, handle);
3555
3547
  if (handleEntry.own) {
3556
3548
 
@@ -4097,150 +4089,173 @@ function metadataAdd(arg0, arg1) {
4097
4089
  }
4098
4090
 
4099
4091
  let _initialized = false;
4100
- export const $init = (async() => {
4101
- const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
4102
- const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
4103
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCQAgAEEAEQEACw0AIAAgASACQQERAwALDQAgACABIAJBAhEDAAsLACAAIAFBAxEAAAsLACAAIAFBBBEAAAsLACAAIAFBBREAAAsLACAAIAFBBhEAAAsRACAAIAEgAiADIARBBxEEAAsVACAAIAEgAiADIAQgBSAGQQgRBwALCwAgACABQQkRAAALEQAgACABIAIgAyAEQQoRBAALCwAgACABQQsRAAALCwAgACABQQwRAAALDQAgACABIAJBDREDAAsNACAAIAEgAkEOEQMACwsAIAAgAUEPEQAACw8AIAAgASACIANBEBEFAAsPACAAIAEgAiADQRERBQALCwAgACABQRIRAAALCwAgACABQRMRCAALCQAgAEEUEQEACwkAIABBFREBAAsJACAAQRYRAQALCQAgAEEXEQEACw8AIAAgASACIANBGBEGAAsZACAAIAEgAiADIAQgBSAGIAcgCEEZEQkACxEAIAAgASACIAMgBEEaEQoACxEAIAAgASACIAMgBEEbEQsACwsAIAAgAUEcEQIACwsAIAAgAUEdEQIACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxECAAsLACAAIAFBIBECAAsJACAAQSERDAALCwAgACABQSIRAgALDQAgACABIAJBIxENAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMDIuMA');
4104
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8C5AEmAAEwAAEAATEAAwABMgADAAEzAAAAATQAAAABNQAAAAE2AAAAATcABAABOAAHAAE5AAAAAjEwAAQAAjExAAAAAjEyAAAAAjEzAAMAAjE0AAMAAjE1AAAAAjE2AAUAAjE3AAUAAjE4AAAAAjE5AAgAAjIwAAEAAjIxAAEAAjIyAAEAAjIzAAEAAjI0AAYAAjI1AAkAAjI2AAoAAjI3AAsAAjI4AAIAAjI5AAIAAjMwAAYAAjMxAAIAAjMyAAIAAjMzAAwAAjM0AAIAAjM1AA0AAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIwMi4w');
4105
- ({ exports: exports0 } = await instantiateCore(await module2));
4106
- ({ exports: exports1 } = await instantiateCore(await module0, {
4107
- wasi_snapshot_preview1: {
4108
- environ_get: exports0['31'],
4109
- environ_sizes_get: exports0['32'],
4110
- fd_close: exports0['33'],
4111
- fd_filestat_get: exports0['29'],
4112
- fd_prestat_dir_name: exports0['35'],
4113
- fd_prestat_get: exports0['34'],
4114
- fd_read: exports0['30'],
4115
- fd_readdir: exports0['26'],
4116
- fd_write: exports0['24'],
4117
- path_filestat_get: exports0['27'],
4118
- path_open: exports0['25'],
4119
- proc_exit: exports0['36'],
4120
- random_get: exports0['28'],
4121
- },
4122
- }));
4123
- ({ exports: exports2 } = await instantiateCore(await module1, {
4124
- __main_module__: {
4125
- cabi_realloc: exports1.cabi_realloc,
4126
- },
4127
- env: {
4128
- memory: exports1.memory,
4129
- },
4130
- 'wasi:cli/environment@0.2.0': {
4131
- 'get-environment': exports0['20'],
4132
- },
4133
- 'wasi:cli/exit@0.2.0': {
4134
- exit: trampoline6,
4135
- },
4136
- 'wasi:cli/stderr@0.2.0': {
4137
- 'get-stderr': trampoline5,
4138
- },
4139
- 'wasi:cli/stdin@0.2.0': {
4140
- 'get-stdin': trampoline7,
4141
- },
4142
- 'wasi:cli/stdout@0.2.0': {
4143
- 'get-stdout': trampoline8,
4144
- },
4145
- 'wasi:cli/terminal-input@0.2.0': {
4146
- '[resource-drop]terminal-input': trampoline9,
4147
- },
4148
- 'wasi:cli/terminal-output@0.2.0': {
4149
- '[resource-drop]terminal-output': trampoline10,
4150
- },
4151
- 'wasi:cli/terminal-stderr@0.2.0': {
4152
- 'get-terminal-stderr': exports0['23'],
4153
- },
4154
- 'wasi:cli/terminal-stdin@0.2.0': {
4155
- 'get-terminal-stdin': exports0['21'],
4156
- },
4157
- 'wasi:cli/terminal-stdout@0.2.0': {
4158
- 'get-terminal-stdout': exports0['22'],
4159
- },
4160
- 'wasi:filesystem/preopens@0.2.0': {
4161
- 'get-directories': exports0['0'],
4162
- },
4163
- 'wasi:filesystem/types@0.2.0': {
4164
- '[method]descriptor.append-via-stream': exports0['3'],
4165
- '[method]descriptor.get-type': exports0['4'],
4166
- '[method]descriptor.metadata-hash': exports0['9'],
4167
- '[method]descriptor.metadata-hash-at': exports0['10'],
4168
- '[method]descriptor.open-at': exports0['8'],
4169
- '[method]descriptor.read-directory': exports0['5'],
4170
- '[method]descriptor.read-via-stream': exports0['1'],
4171
- '[method]descriptor.stat': exports0['6'],
4172
- '[method]descriptor.stat-at': exports0['7'],
4173
- '[method]descriptor.write-via-stream': exports0['2'],
4174
- '[method]directory-entry-stream.read-directory-entry': exports0['11'],
4175
- '[resource-drop]descriptor': trampoline4,
4176
- '[resource-drop]directory-entry-stream': trampoline0,
4177
- 'filesystem-error-code': exports0['12'],
4178
- },
4179
- 'wasi:io/error@0.2.0': {
4180
- '[resource-drop]error': trampoline1,
4181
- },
4182
- 'wasi:io/streams@0.2.0': {
4183
- '[method]input-stream.blocking-read': exports0['14'],
4184
- '[method]input-stream.read': exports0['13'],
4185
- '[method]output-stream.blocking-flush': exports0['18'],
4186
- '[method]output-stream.blocking-write-and-flush': exports0['17'],
4187
- '[method]output-stream.check-write': exports0['15'],
4188
- '[method]output-stream.write': exports0['16'],
4189
- '[resource-drop]input-stream': trampoline2,
4190
- '[resource-drop]output-stream': trampoline3,
4191
- },
4192
- 'wasi:random/random@0.2.0': {
4193
- 'get-random-bytes': exports0['19'],
4194
- },
4195
- }));
4196
- memory0 = exports1.memory;
4197
- realloc0 = exports2.cabi_import_realloc;
4198
- ({ exports: exports3 } = await instantiateCore(await module3, {
4199
- '': {
4200
- $imports: exports0.$imports,
4201
- '0': trampoline11,
4202
- '1': trampoline12,
4203
- '10': trampoline21,
4204
- '11': trampoline22,
4205
- '12': trampoline23,
4206
- '13': trampoline24,
4207
- '14': trampoline25,
4208
- '15': trampoline26,
4209
- '16': trampoline27,
4210
- '17': trampoline28,
4211
- '18': trampoline29,
4212
- '19': trampoline30,
4213
- '2': trampoline13,
4214
- '20': trampoline31,
4215
- '21': trampoline32,
4216
- '22': trampoline33,
4217
- '23': trampoline34,
4218
- '24': exports2.fd_write,
4219
- '25': exports2.path_open,
4220
- '26': exports2.fd_readdir,
4221
- '27': exports2.path_filestat_get,
4222
- '28': exports2.random_get,
4223
- '29': exports2.fd_filestat_get,
4224
- '3': trampoline14,
4225
- '30': exports2.fd_read,
4226
- '31': exports2.environ_get,
4227
- '32': exports2.environ_sizes_get,
4228
- '33': exports2.fd_close,
4229
- '34': exports2.fd_prestat_get,
4230
- '35': exports2.fd_prestat_dir_name,
4231
- '36': exports2.proc_exit,
4232
- '4': trampoline15,
4233
- '5': trampoline16,
4234
- '6': trampoline17,
4235
- '7': trampoline18,
4236
- '8': trampoline19,
4237
- '9': trampoline20,
4238
- },
4239
- }));
4240
- realloc1 = exports1.cabi_realloc;
4241
- postReturn0 = exports1['cabi_post_local:wasm-tools/tools#component-embed'];
4242
- postReturn1 = exports1['cabi_post_local:wasm-tools/tools#metadata-show'];
4243
- _initialized = true;
4092
+ export const $init = (() => {
4093
+ let gen = (function* init () {
4094
+ const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
4095
+ const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
4096
+ const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCQAgAEEAEQEACw0AIAAgASACQQERAwALDQAgACABIAJBAhEDAAsLACAAIAFBAxEAAAsLACAAIAFBBBEAAAsLACAAIAFBBREAAAsLACAAIAFBBhEAAAsRACAAIAEgAiADIARBBxEEAAsVACAAIAEgAiADIAQgBSAGQQgRBwALCwAgACABQQkRAAALEQAgACABIAIgAyAEQQoRBAALCwAgACABQQsRAAALCwAgACABQQwRAAALDQAgACABIAJBDREDAAsNACAAIAEgAkEOEQMACwsAIAAgAUEPEQAACw8AIAAgASACIANBEBEFAAsPACAAIAEgAiADQRERBQALCwAgACABQRIRAAALCwAgACABQRMRCAALCQAgAEEUEQEACwkAIABBFREBAAsJACAAQRYRAQALCQAgAEEXEQEACw8AIAAgASACIANBGBEGAAsZACAAIAEgAiADIAQgBSAGIAcgCEEZEQkACxEAIAAgASACIAMgBEEaEQoACxEAIAAgASACIAMgBEEbEQsACwsAIAAgAUEcEQIACwsAIAAgAUEdEQIACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxECAAsLACAAIAFBIBECAAsJACAAQSERDAALCwAgACABQSIRAgALDQAgACABIAJBIxENAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMDkuMQ');
4097
+ const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8C5AEmAAEwAAEAATEAAwABMgADAAEzAAAAATQAAAABNQAAAAE2AAAAATcABAABOAAHAAE5AAAAAjEwAAQAAjExAAAAAjEyAAAAAjEzAAMAAjE0AAMAAjE1AAAAAjE2AAUAAjE3AAUAAjE4AAAAAjE5AAgAAjIwAAEAAjIxAAEAAjIyAAEAAjIzAAEAAjI0AAYAAjI1AAkAAjI2AAoAAjI3AAsAAjI4AAIAAjI5AAIAAjMwAAYAAjMxAAIAAjMyAAIAAjMzAAwAAjM0AAIAAjM1AA0AAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIwOS4x');
4098
+ ({ exports: exports0 } = yield instantiateCore(yield module2));
4099
+ ({ exports: exports1 } = yield instantiateCore(yield module0, {
4100
+ wasi_snapshot_preview1: {
4101
+ environ_get: exports0['31'],
4102
+ environ_sizes_get: exports0['32'],
4103
+ fd_close: exports0['33'],
4104
+ fd_filestat_get: exports0['29'],
4105
+ fd_prestat_dir_name: exports0['35'],
4106
+ fd_prestat_get: exports0['34'],
4107
+ fd_read: exports0['30'],
4108
+ fd_readdir: exports0['26'],
4109
+ fd_write: exports0['24'],
4110
+ path_filestat_get: exports0['27'],
4111
+ path_open: exports0['25'],
4112
+ proc_exit: exports0['36'],
4113
+ random_get: exports0['28'],
4114
+ },
4115
+ }));
4116
+ ({ exports: exports2 } = yield instantiateCore(yield module1, {
4117
+ __main_module__: {
4118
+ cabi_realloc: exports1.cabi_realloc,
4119
+ },
4120
+ env: {
4121
+ memory: exports1.memory,
4122
+ },
4123
+ 'wasi:cli/environment@0.2.0': {
4124
+ 'get-environment': exports0['0'],
4125
+ },
4126
+ 'wasi:cli/exit@0.2.0': {
4127
+ exit: trampoline10,
4128
+ },
4129
+ 'wasi:cli/stderr@0.2.0': {
4130
+ 'get-stderr': trampoline5,
4131
+ },
4132
+ 'wasi:cli/stdin@0.2.0': {
4133
+ 'get-stdin': trampoline8,
4134
+ },
4135
+ 'wasi:cli/stdout@0.2.0': {
4136
+ 'get-stdout': trampoline9,
4137
+ },
4138
+ 'wasi:cli/terminal-input@0.2.0': {
4139
+ '[resource-drop]terminal-input': trampoline6,
4140
+ },
4141
+ 'wasi:cli/terminal-output@0.2.0': {
4142
+ '[resource-drop]terminal-output': trampoline7,
4143
+ },
4144
+ 'wasi:cli/terminal-stderr@0.2.0': {
4145
+ 'get-terminal-stderr': exports0['23'],
4146
+ },
4147
+ 'wasi:cli/terminal-stdin@0.2.0': {
4148
+ 'get-terminal-stdin': exports0['21'],
4149
+ },
4150
+ 'wasi:cli/terminal-stdout@0.2.0': {
4151
+ 'get-terminal-stdout': exports0['22'],
4152
+ },
4153
+ 'wasi:filesystem/preopens@0.2.0': {
4154
+ 'get-directories': exports0['20'],
4155
+ },
4156
+ 'wasi:filesystem/types@0.2.0': {
4157
+ '[method]descriptor.append-via-stream': exports0['3'],
4158
+ '[method]descriptor.get-type': exports0['4'],
4159
+ '[method]descriptor.metadata-hash': exports0['9'],
4160
+ '[method]descriptor.metadata-hash-at': exports0['10'],
4161
+ '[method]descriptor.open-at': exports0['8'],
4162
+ '[method]descriptor.read-directory': exports0['5'],
4163
+ '[method]descriptor.read-via-stream': exports0['1'],
4164
+ '[method]descriptor.stat': exports0['6'],
4165
+ '[method]descriptor.stat-at': exports0['7'],
4166
+ '[method]descriptor.write-via-stream': exports0['2'],
4167
+ '[method]directory-entry-stream.read-directory-entry': exports0['11'],
4168
+ '[resource-drop]descriptor': trampoline4,
4169
+ '[resource-drop]directory-entry-stream': trampoline0,
4170
+ 'filesystem-error-code': exports0['12'],
4171
+ },
4172
+ 'wasi:io/error@0.2.0': {
4173
+ '[resource-drop]error': trampoline2,
4174
+ },
4175
+ 'wasi:io/streams@0.2.0': {
4176
+ '[method]input-stream.blocking-read': exports0['14'],
4177
+ '[method]input-stream.read': exports0['13'],
4178
+ '[method]output-stream.blocking-flush': exports0['18'],
4179
+ '[method]output-stream.blocking-write-and-flush': exports0['17'],
4180
+ '[method]output-stream.check-write': exports0['15'],
4181
+ '[method]output-stream.write': exports0['16'],
4182
+ '[resource-drop]input-stream': trampoline3,
4183
+ '[resource-drop]output-stream': trampoline1,
4184
+ },
4185
+ 'wasi:random/random@0.2.0': {
4186
+ 'get-random-bytes': exports0['19'],
4187
+ },
4188
+ }));
4189
+ memory0 = exports1.memory;
4190
+ realloc0 = exports2.cabi_import_realloc;
4191
+ ({ exports: exports3 } = yield instantiateCore(yield module3, {
4192
+ '': {
4193
+ $imports: exports0.$imports,
4194
+ '0': trampoline11,
4195
+ '1': trampoline12,
4196
+ '10': trampoline21,
4197
+ '11': trampoline22,
4198
+ '12': trampoline23,
4199
+ '13': trampoline24,
4200
+ '14': trampoline25,
4201
+ '15': trampoline26,
4202
+ '16': trampoline27,
4203
+ '17': trampoline28,
4204
+ '18': trampoline29,
4205
+ '19': trampoline30,
4206
+ '2': trampoline13,
4207
+ '20': trampoline31,
4208
+ '21': trampoline32,
4209
+ '22': trampoline33,
4210
+ '23': trampoline34,
4211
+ '24': exports2.fd_write,
4212
+ '25': exports2.path_open,
4213
+ '26': exports2.fd_readdir,
4214
+ '27': exports2.path_filestat_get,
4215
+ '28': exports2.random_get,
4216
+ '29': exports2.fd_filestat_get,
4217
+ '3': trampoline14,
4218
+ '30': exports2.fd_read,
4219
+ '31': exports2.environ_get,
4220
+ '32': exports2.environ_sizes_get,
4221
+ '33': exports2.fd_close,
4222
+ '34': exports2.fd_prestat_get,
4223
+ '35': exports2.fd_prestat_dir_name,
4224
+ '36': exports2.proc_exit,
4225
+ '4': trampoline15,
4226
+ '5': trampoline16,
4227
+ '6': trampoline17,
4228
+ '7': trampoline18,
4229
+ '8': trampoline19,
4230
+ '9': trampoline20,
4231
+ },
4232
+ }));
4233
+ realloc1 = exports1.cabi_realloc;
4234
+ postReturn0 = exports1['cabi_post_local:wasm-tools/tools#component-embed'];
4235
+ postReturn1 = exports1['cabi_post_local:wasm-tools/tools#metadata-show'];
4236
+ _initialized = true;
4237
+ })();
4238
+ let promise, resolve, reject;
4239
+ function runNext (value) {
4240
+ try {
4241
+ let done;
4242
+ do {
4243
+ ({ value, done } = gen.next(value));
4244
+ } while (!(value instanceof Promise) && !done);
4245
+ if (done) {
4246
+ if (resolve) resolve(value);
4247
+ else return value;
4248
+ }
4249
+ if (!promise) promise = new Promise((_resolve, _reject) => (resolve = _resolve, reject = _reject));
4250
+ value.then(runNext, reject);
4251
+ }
4252
+ catch (e) {
4253
+ if (reject) reject(e);
4254
+ else throw e;
4255
+ }
4256
+ }
4257
+ const maybeSyncReturn = runNext(null);
4258
+ return promise || maybeSyncReturn;
4244
4259
  })();
4245
4260
  const tools = {
4246
4261
  componentEmbed: componentEmbed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "author": "Guy Bedford",
6
6
  "bin": {
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "type": "module",
20
20
  "dependencies": {
21
- "@bytecodealliance/preview2-shim": "^0.16.2",
21
+ "@bytecodealliance/preview2-shim": "^0.16.3",
22
22
  "binaryen": "^116.0.0",
23
23
  "chalk-template": "^1",
24
24
  "commander": "^12",
@@ -56,7 +56,7 @@
56
56
  "build:types:preview2-shim": "cargo xtask generate wasi-types",
57
57
  "lint": "eslint -c eslintrc.cjs src/**/*.js packages/*/lib/**/*.js",
58
58
  "test:lts": "mocha -u tdd test/test.js --timeout 30000",
59
- "test": "node --stack-trace-limit=100 --experimental-wasm-multi-memory node_modules/mocha/bin/mocha.js -u tdd test/test.js --timeout 30000",
59
+ "test": "node --stack-trace-limit=100 node_modules/mocha/bin/mocha.js -u tdd test/test.js --timeout 30000",
60
60
  "prepublishOnly": "cargo xtask build release && npm run test"
61
61
  },
62
62
  "files": [