@bytecodealliance/jco 1.2.4 → 1.3.1

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,19 +113,10 @@ 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
 
@@ -150,36 +141,12 @@ function trampoline5() {
150
141
  }
151
142
  return handle0;
152
143
  }
153
-
154
- function trampoline6(arg0) {
155
- let variant0;
156
- switch (arg0) {
157
- case 0: {
158
- variant0= {
159
- tag: 'ok',
160
- val: undefined
161
- };
162
- break;
163
- }
164
- case 1: {
165
- variant0= {
166
- tag: 'err',
167
- val: undefined
168
- };
169
- break;
170
- }
171
- default: {
172
- throw new TypeError('invalid variant discriminant for expected');
173
- }
174
- }
175
- exit(variant0);
176
- }
177
144
  const handleTable1 = [T_FLAG, 0];
178
145
  const captureTable1= new Map();
179
146
  let captureCnt1 = 0;
180
147
  handleTables[1] = handleTable1;
181
148
 
182
- function trampoline7() {
149
+ function trampoline8() {
183
150
  const ret = getStdin();
184
151
  if (!(ret instanceof InputStream)) {
185
152
  throw new TypeError('Resource error: Not a valid "InputStream" resource.');
@@ -193,7 +160,7 @@ function trampoline7() {
193
160
  return handle0;
194
161
  }
195
162
 
196
- function trampoline8() {
163
+ function trampoline9() {
197
164
  const ret = getStdout();
198
165
  if (!(ret instanceof OutputStream)) {
199
166
  throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
@@ -206,40 +173,58 @@ function trampoline8() {
206
173
  }
207
174
  return handle0;
208
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
+ }
209
200
  let exports2;
210
201
  let memory0;
211
202
  let realloc0;
212
- const handleTable5 = [T_FLAG, 0];
213
- const captureTable5= new Map();
214
- let captureCnt5 = 0;
215
- handleTables[5] = handleTable5;
216
203
 
217
204
  function trampoline11(arg0) {
218
- const ret = getDirectories();
205
+ const ret = getEnvironment();
219
206
  var vec3 = ret;
220
207
  var len3 = vec3.length;
221
- var result3 = realloc0(0, 0, 4, len3 * 12);
208
+ var result3 = realloc0(0, 0, 4, len3 * 16);
222
209
  for (let i = 0; i < vec3.length; i++) {
223
210
  const e = vec3[i];
224
- const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
225
- if (!(tuple0_0 instanceof Descriptor)) {
226
- throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
227
- }
228
- var handle1 = tuple0_0[symbolRscHandle];
229
- if (!handle1) {
230
- const rep = tuple0_0[symbolRscRep] || ++captureCnt5;
231
- captureTable5.set(rep, tuple0_0);
232
- handle1 = rscTableCreateOwn(handleTable5, rep);
233
- }
234
- 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);
235
216
  var ptr2 = utf8Encode(tuple0_1, realloc0, memory0);
236
217
  var len2 = utf8EncodedLen;
237
- dataView(memory0).setInt32(base + 8, len2, true);
238
- dataView(memory0).setInt32(base + 4, ptr2, true);
218
+ dataView(memory0).setInt32(base + 12, len2, true);
219
+ dataView(memory0).setInt32(base + 8, ptr2, true);
239
220
  }
240
221
  dataView(memory0).setInt32(arg0 + 4, len3, true);
241
222
  dataView(memory0).setInt32(arg0 + 0, result3, true);
242
223
  }
224
+ const handleTable5 = [T_FLAG, 0];
225
+ const captureTable5= new Map();
226
+ let captureCnt5 = 0;
227
+ handleTables[5] = handleTable5;
243
228
 
244
229
  function trampoline12(arg0, arg1, arg2) {
245
230
  var handle1 = arg0;
@@ -3379,21 +3364,27 @@ function trampoline30(arg0, arg1) {
3379
3364
  }
3380
3365
 
3381
3366
  function trampoline31(arg0) {
3382
- const ret = getEnvironment();
3367
+ const ret = getDirectories();
3383
3368
  var vec3 = ret;
3384
3369
  var len3 = vec3.length;
3385
- var result3 = realloc0(0, 0, 4, len3 * 16);
3370
+ var result3 = realloc0(0, 0, 4, len3 * 12);
3386
3371
  for (let i = 0; i < vec3.length; i++) {
3387
3372
  const e = vec3[i];
3388
- const base = result3 + i * 16;var [tuple0_0, tuple0_1] = e;
3389
- var ptr1 = utf8Encode(tuple0_0, realloc0, memory0);
3390
- var len1 = utf8EncodedLen;
3391
- dataView(memory0).setInt32(base + 4, len1, true);
3392
- 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);
3393
3384
  var ptr2 = utf8Encode(tuple0_1, realloc0, memory0);
3394
3385
  var len2 = utf8EncodedLen;
3395
- dataView(memory0).setInt32(base + 12, len2, true);
3396
- dataView(memory0).setInt32(base + 8, ptr2, true);
3386
+ dataView(memory0).setInt32(base + 8, len2, true);
3387
+ dataView(memory0).setInt32(base + 4, ptr2, true);
3397
3388
  }
3398
3389
  dataView(memory0).setInt32(arg0 + 4, len3, true);
3399
3390
  dataView(memory0).setInt32(arg0 + 0, result3, true);
@@ -3487,6 +3478,19 @@ function trampoline0(handle) {
3487
3478
  }
3488
3479
  }
3489
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) {
3490
3494
  const handleEntry = rscTableRemove(handleTable0, handle);
3491
3495
  if (handleEntry.own) {
3492
3496
 
@@ -3499,7 +3503,7 @@ function trampoline1(handle) {
3499
3503
  }
3500
3504
  }
3501
3505
  }
3502
- function trampoline2(handle) {
3506
+ function trampoline3(handle) {
3503
3507
  const handleEntry = rscTableRemove(handleTable1, handle);
3504
3508
  if (handleEntry.own) {
3505
3509
 
@@ -3512,19 +3516,6 @@ function trampoline2(handle) {
3512
3516
  }
3513
3517
  }
3514
3518
  }
3515
- function trampoline3(handle) {
3516
- const handleEntry = rscTableRemove(handleTable2, handle);
3517
- if (handleEntry.own) {
3518
-
3519
- const rsc = captureTable2.get(handleEntry.rep);
3520
- if (rsc) {
3521
- if (rsc[symbolDispose]) rsc[symbolDispose]();
3522
- captureTable2.delete(handleEntry.rep);
3523
- } else if (OutputStream[symbolCabiDispose]) {
3524
- OutputStream[symbolCabiDispose](handleEntry.rep);
3525
- }
3526
- }
3527
- }
3528
3519
  function trampoline4(handle) {
3529
3520
  const handleEntry = rscTableRemove(handleTable5, handle);
3530
3521
  if (handleEntry.own) {
@@ -3538,7 +3529,7 @@ function trampoline4(handle) {
3538
3529
  }
3539
3530
  }
3540
3531
  }
3541
- function trampoline9(handle) {
3532
+ function trampoline6(handle) {
3542
3533
  const handleEntry = rscTableRemove(handleTable3, handle);
3543
3534
  if (handleEntry.own) {
3544
3535
 
@@ -3551,7 +3542,7 @@ function trampoline9(handle) {
3551
3542
  }
3552
3543
  }
3553
3544
  }
3554
- function trampoline10(handle) {
3545
+ function trampoline7(handle) {
3555
3546
  const handleEntry = rscTableRemove(handleTable4, handle);
3556
3547
  if (handleEntry.own) {
3557
3548
 
@@ -4098,150 +4089,173 @@ function metadataAdd(arg0, arg1) {
4098
4089
  }
4099
4090
 
4100
4091
  let _initialized = false;
4101
- export const $init = (async() => {
4102
- const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
4103
- const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
4104
- const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8DJiUBAwMAAAAABAcABAAAAwMABQUACAEBAQEGCQoLAgIGAgIMAg0BBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCQAgAEEAEQEACw0AIAAgASACQQERAwALDQAgACABIAJBAhEDAAsLACAAIAFBAxEAAAsLACAAIAFBBBEAAAsLACAAIAFBBREAAAsLACAAIAFBBhEAAAsRACAAIAEgAiADIARBBxEEAAsVACAAIAEgAiADIAQgBSAGQQgRBwALCwAgACABQQkRAAALEQAgACABIAIgAyAEQQoRBAALCwAgACABQQsRAAALCwAgACABQQwRAAALDQAgACABIAJBDREDAAsNACAAIAEgAkEOEQMACwsAIAAgAUEPEQAACw8AIAAgASACIANBEBEFAAsPACAAIAEgAiADQRERBQALCwAgACABQRIRAAALCwAgACABQRMRCAALCQAgAEEUEQEACwkAIABBFREBAAsJACAAQRYRAQALCQAgAEEXEQEACw8AIAAgASACIANBGBEGAAsZACAAIAEgAiADIAQgBSAGIAcgCEEZEQkACxEAIAAgASACIAMgBEEaEQoACxEAIAAgASACIAMgBEEbEQsACwsAIAAgAUEcEQIACwsAIAAgAUEdEQIACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxECAAsLACAAIAFBIBECAAsJACAAQSERDAALCwAgACABQSIRAgALDQAgACABIAJBIxENAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yMDIuMA');
4105
- const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBX9/f39/AGAEf39/fwBgBH9/f38Bf2AHf39/f39/fwBgAn5/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX8C5AEmAAEwAAEAATEAAwABMgADAAEzAAAAATQAAAABNQAAAAE2AAAAATcABAABOAAHAAE5AAAAAjEwAAQAAjExAAAAAjEyAAAAAjEzAAMAAjE0AAMAAjE1AAAAAjE2AAUAAjE3AAUAAjE4AAAAAjE5AAgAAjIwAAEAAjIxAAEAAjIyAAEAAjIzAAEAAjI0AAYAAjI1AAkAAjI2AAoAAjI3AAsAAjI4AAIAAjI5AAIAAjMwAAYAAjMxAAIAAjMyAAIAAjMzAAwAAjM0AAIAAjM1AA0AAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjIwMi4w');
4106
- ({ exports: exports0 } = await instantiateCore(await module2));
4107
- ({ exports: exports1 } = await instantiateCore(await module0, {
4108
- wasi_snapshot_preview1: {
4109
- environ_get: exports0['31'],
4110
- environ_sizes_get: exports0['32'],
4111
- fd_close: exports0['33'],
4112
- fd_filestat_get: exports0['29'],
4113
- fd_prestat_dir_name: exports0['35'],
4114
- fd_prestat_get: exports0['34'],
4115
- fd_read: exports0['30'],
4116
- fd_readdir: exports0['26'],
4117
- fd_write: exports0['24'],
4118
- path_filestat_get: exports0['27'],
4119
- path_open: exports0['25'],
4120
- proc_exit: exports0['36'],
4121
- random_get: exports0['28'],
4122
- },
4123
- }));
4124
- ({ exports: exports2 } = await instantiateCore(await module1, {
4125
- __main_module__: {
4126
- cabi_realloc: exports1.cabi_realloc,
4127
- },
4128
- env: {
4129
- memory: exports1.memory,
4130
- },
4131
- 'wasi:cli/environment@0.2.0': {
4132
- 'get-environment': exports0['20'],
4133
- },
4134
- 'wasi:cli/exit@0.2.0': {
4135
- exit: trampoline6,
4136
- },
4137
- 'wasi:cli/stderr@0.2.0': {
4138
- 'get-stderr': trampoline5,
4139
- },
4140
- 'wasi:cli/stdin@0.2.0': {
4141
- 'get-stdin': trampoline7,
4142
- },
4143
- 'wasi:cli/stdout@0.2.0': {
4144
- 'get-stdout': trampoline8,
4145
- },
4146
- 'wasi:cli/terminal-input@0.2.0': {
4147
- '[resource-drop]terminal-input': trampoline9,
4148
- },
4149
- 'wasi:cli/terminal-output@0.2.0': {
4150
- '[resource-drop]terminal-output': trampoline10,
4151
- },
4152
- 'wasi:cli/terminal-stderr@0.2.0': {
4153
- 'get-terminal-stderr': exports0['23'],
4154
- },
4155
- 'wasi:cli/terminal-stdin@0.2.0': {
4156
- 'get-terminal-stdin': exports0['21'],
4157
- },
4158
- 'wasi:cli/terminal-stdout@0.2.0': {
4159
- 'get-terminal-stdout': exports0['22'],
4160
- },
4161
- 'wasi:filesystem/preopens@0.2.0': {
4162
- 'get-directories': exports0['0'],
4163
- },
4164
- 'wasi:filesystem/types@0.2.0': {
4165
- '[method]descriptor.append-via-stream': exports0['3'],
4166
- '[method]descriptor.get-type': exports0['4'],
4167
- '[method]descriptor.metadata-hash': exports0['9'],
4168
- '[method]descriptor.metadata-hash-at': exports0['10'],
4169
- '[method]descriptor.open-at': exports0['8'],
4170
- '[method]descriptor.read-directory': exports0['5'],
4171
- '[method]descriptor.read-via-stream': exports0['1'],
4172
- '[method]descriptor.stat': exports0['6'],
4173
- '[method]descriptor.stat-at': exports0['7'],
4174
- '[method]descriptor.write-via-stream': exports0['2'],
4175
- '[method]directory-entry-stream.read-directory-entry': exports0['11'],
4176
- '[resource-drop]descriptor': trampoline4,
4177
- '[resource-drop]directory-entry-stream': trampoline0,
4178
- 'filesystem-error-code': exports0['12'],
4179
- },
4180
- 'wasi:io/error@0.2.0': {
4181
- '[resource-drop]error': trampoline1,
4182
- },
4183
- 'wasi:io/streams@0.2.0': {
4184
- '[method]input-stream.blocking-read': exports0['14'],
4185
- '[method]input-stream.read': exports0['13'],
4186
- '[method]output-stream.blocking-flush': exports0['18'],
4187
- '[method]output-stream.blocking-write-and-flush': exports0['17'],
4188
- '[method]output-stream.check-write': exports0['15'],
4189
- '[method]output-stream.write': exports0['16'],
4190
- '[resource-drop]input-stream': trampoline2,
4191
- '[resource-drop]output-stream': trampoline3,
4192
- },
4193
- 'wasi:random/random@0.2.0': {
4194
- 'get-random-bytes': exports0['19'],
4195
- },
4196
- }));
4197
- memory0 = exports1.memory;
4198
- realloc0 = exports2.cabi_import_realloc;
4199
- ({ exports: exports3 } = await instantiateCore(await module3, {
4200
- '': {
4201
- $imports: exports0.$imports,
4202
- '0': trampoline11,
4203
- '1': trampoline12,
4204
- '10': trampoline21,
4205
- '11': trampoline22,
4206
- '12': trampoline23,
4207
- '13': trampoline24,
4208
- '14': trampoline25,
4209
- '15': trampoline26,
4210
- '16': trampoline27,
4211
- '17': trampoline28,
4212
- '18': trampoline29,
4213
- '19': trampoline30,
4214
- '2': trampoline13,
4215
- '20': trampoline31,
4216
- '21': trampoline32,
4217
- '22': trampoline33,
4218
- '23': trampoline34,
4219
- '24': exports2.fd_write,
4220
- '25': exports2.path_open,
4221
- '26': exports2.fd_readdir,
4222
- '27': exports2.path_filestat_get,
4223
- '28': exports2.random_get,
4224
- '29': exports2.fd_filestat_get,
4225
- '3': trampoline14,
4226
- '30': exports2.fd_read,
4227
- '31': exports2.environ_get,
4228
- '32': exports2.environ_sizes_get,
4229
- '33': exports2.fd_close,
4230
- '34': exports2.fd_prestat_get,
4231
- '35': exports2.fd_prestat_dir_name,
4232
- '36': exports2.proc_exit,
4233
- '4': trampoline15,
4234
- '5': trampoline16,
4235
- '6': trampoline17,
4236
- '7': trampoline18,
4237
- '8': trampoline19,
4238
- '9': trampoline20,
4239
- },
4240
- }));
4241
- realloc1 = exports1.cabi_realloc;
4242
- postReturn0 = exports1['cabi_post_local:wasm-tools/tools#component-embed'];
4243
- postReturn1 = exports1['cabi_post_local:wasm-tools/tools#metadata-show'];
4244
- _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;
4245
4259
  })();
4246
4260
  const tools = {
4247
4261
  componentEmbed: componentEmbed,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.2.4",
3
+ "version": "1.3.1",
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",
@@ -27,7 +27,7 @@
27
27
  "terser": "^5"
28
28
  },
29
29
  "devDependencies": {
30
- "@bytecodealliance/componentize-js": "^0.8.3",
30
+ "@bytecodealliance/componentize-js": "^0.9.0",
31
31
  "@types/node": "^18.11.17",
32
32
  "@typescript-eslint/eslint-plugin": "^5.41.0",
33
33
  "@typescript-eslint/parser": "^5.41.0",
@@ -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": [