@bytecodealliance/jco 1.20.0 → 1.21.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.
@@ -1334,6 +1334,7 @@ class Waitable {
1334
1334
 
1335
1335
  function rscTableCreateOwn(table, rep) {
1336
1336
  const free = table[0] & ~T_FLAG;
1337
+ table._createdReps.add(rep);
1337
1338
  if (free === 0) {
1338
1339
  table.push(0);
1339
1340
  table.push(rep | T_FLAG);
@@ -3026,10 +3027,14 @@ function _lowerFlatFlags(meta) {
3026
3027
 
3027
3028
  let flagObj = ctx.vals[0];
3028
3029
  let flagValue = 0;
3029
- for (const [idx, name] of names.entries()) {
3030
- if (flagObj[name] === true) {
3031
- flagValue |= 1 << idx;
3030
+ if (typeof flagObj === 'object' && flagObj !== null) {
3031
+ for (const [idx, name] of names.entries()) {
3032
+ if (flagObj[name] === true) {
3033
+ flagValue |= 1 << idx;
3034
+ }
3032
3035
  }
3036
+ } else if (flagObj !== null && flagObj !== undefined) {
3037
+ throw new TypeError('only an object, undefined or null can be converted to flags');
3033
3038
  }
3034
3039
 
3035
3040
  const rem = ctx.storagePtr % align32;
@@ -3849,7 +3854,8 @@ const symbolRscHandle = Symbol('handle');
3849
3854
 
3850
3855
  const symbolRscRep = Symbol.for('cabiRep');
3851
3856
 
3852
- const handleTables = [];
3857
+ const HANDLE_TABLES= [];
3858
+
3853
3859
 
3854
3860
  class ComponentError extends Error {
3855
3861
  constructor (value) {
@@ -3878,10 +3884,15 @@ const instantiateCore = WebAssembly.instantiate;
3878
3884
 
3879
3885
  let exports0;
3880
3886
  let exports1;
3887
+
3881
3888
  const handleTable2 = [T_FLAG, 0];
3889
+ handleTable2._createdReps = new Set();
3890
+
3891
+
3882
3892
  const captureTable2= new Map();
3883
- let captureCnt2 = 0;
3884
- handleTables[2] = handleTable2;
3893
+ let captureCnt2= 0;
3894
+
3895
+ HANDLE_TABLES[2] = handleTable2;
3885
3896
 
3886
3897
  const _trampoline5 = function() {
3887
3898
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ enter)');
@@ -3968,10 +3979,15 @@ const _trampoline5 = function() {
3968
3979
  return handle0;
3969
3980
  }
3970
3981
  _trampoline5.fnName = 'wasi:cli/stderr@0.2.3#getStderr';
3982
+
3971
3983
  const handleTable1 = [T_FLAG, 0];
3984
+ handleTable1._createdReps = new Set();
3985
+
3986
+
3972
3987
  const captureTable1= new Map();
3973
- let captureCnt1 = 0;
3974
- handleTables[1] = handleTable1;
3988
+ let captureCnt1= 0;
3989
+
3990
+ HANDLE_TABLES[1] = handleTable1;
3975
3991
 
3976
3992
  const _trampoline8 = function() {
3977
3993
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ enter)');
@@ -4339,10 +4355,15 @@ const _trampoline11 = function(arg0) {
4339
4355
  task.exit();
4340
4356
  }
4341
4357
  _trampoline11.fnName = 'wasi:cli/environment@0.2.3#getEnvironment';
4358
+
4342
4359
  const handleTable6 = [T_FLAG, 0];
4360
+ handleTable6._createdReps = new Set();
4361
+
4362
+
4343
4363
  const captureTable6= new Map();
4344
- let captureCnt6 = 0;
4345
- handleTables[6] = handleTable6;
4364
+ let captureCnt6= 0;
4365
+
4366
+ HANDLE_TABLES[6] = handleTable6;
4346
4367
 
4347
4368
  const _trampoline12 = function(arg0, arg1) {
4348
4369
  var handle1 = arg0;
@@ -5183,10 +5204,15 @@ task.resolve([ret]);
5183
5204
  task.exit();
5184
5205
  }
5185
5206
  _trampoline14.fnName = 'wasi:filesystem/types@0.2.3#metadataHash';
5207
+
5186
5208
  const handleTable0 = [T_FLAG, 0];
5209
+ handleTable0._createdReps = new Set();
5210
+
5211
+
5187
5212
  const captureTable0= new Map();
5188
- let captureCnt0 = 0;
5189
- handleTables[0] = handleTable0;
5213
+ let captureCnt0= 0;
5214
+
5215
+ HANDLE_TABLES[0] = handleTable0;
5190
5216
 
5191
5217
  const _trampoline15 = function(arg0, arg1) {
5192
5218
  var handle1 = arg0;
@@ -6539,10 +6565,15 @@ task.resolve([ret]);
6539
6565
  task.exit();
6540
6566
  }
6541
6567
  _trampoline19.fnName = 'wasi:filesystem/types@0.2.3#appendViaStream';
6568
+
6542
6569
  const handleTable5 = [T_FLAG, 0];
6570
+ handleTable5._createdReps = new Set();
6571
+
6572
+
6543
6573
  const captureTable5= new Map();
6544
- let captureCnt5 = 0;
6545
- handleTables[5] = handleTable5;
6574
+ let captureCnt5= 0;
6575
+
6576
+ HANDLE_TABLES[5] = handleTable5;
6546
6577
 
6547
6578
  const _trampoline20 = function(arg0, arg1) {
6548
6579
  var handle1 = arg0;
@@ -9157,10 +9188,15 @@ const _trampoline32 = function(arg0) {
9157
9188
  task.exit();
9158
9189
  }
9159
9190
  _trampoline32.fnName = 'wasi:filesystem/preopens@0.2.3#getDirectories';
9191
+
9160
9192
  const handleTable3 = [T_FLAG, 0];
9193
+ handleTable3._createdReps = new Set();
9194
+
9195
+
9161
9196
  const captureTable3= new Map();
9162
- let captureCnt3 = 0;
9163
- handleTables[3] = handleTable3;
9197
+ let captureCnt3= 0;
9198
+
9199
+ HANDLE_TABLES[3] = handleTable3;
9164
9200
 
9165
9201
  const _trampoline33 = function(arg0) {
9166
9202
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ enter)');
@@ -9254,10 +9290,15 @@ const _trampoline33 = function(arg0) {
9254
9290
  task.exit();
9255
9291
  }
9256
9292
  _trampoline33.fnName = 'wasi:cli/terminal-stdin@0.2.3#getTerminalStdin';
9293
+
9257
9294
  const handleTable4 = [T_FLAG, 0];
9295
+ handleTable4._createdReps = new Set();
9296
+
9297
+
9258
9298
  const captureTable4= new Map();
9259
- let captureCnt4 = 0;
9260
- handleTables[4] = handleTable4;
9299
+ let captureCnt4= 0;
9300
+
9301
+ HANDLE_TABLES[4] = handleTable4;
9261
9302
 
9262
9303
  const _trampoline34 = function(arg0) {
9263
9304
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ enter)');
@@ -10621,7 +10662,7 @@ null,
10621
10662
  isManualAsync: _trampoline12.manuallyAsync,
10622
10663
  paramLiftFns: [_liftFlatBorrow.bind(null, 6)],
10623
10664
  resultLowerFns: [_lowerFlatResult([
10624
- [ 'ok', _lowerFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
10665
+ [ 'ok', _lowerFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
10625
10666
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 2, 1, 1 ],
10626
10667
  ])
10627
10668
  ],
@@ -10645,7 +10686,7 @@ null,
10645
10686
  isManualAsync: _trampoline12.manuallyAsync,
10646
10687
  paramLiftFns: [_liftFlatBorrow.bind(null, 6)],
10647
10688
  resultLowerFns: [_lowerFlatResult([
10648
- [ 'ok', _lowerFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
10689
+ [ 'ok', _lowerFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
10649
10690
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 2, 1, 1 ],
10650
10691
  ])
10651
10692
  ],
@@ -10815,7 +10856,7 @@ null,
10815
10856
  componentIdx: 0,
10816
10857
  isAsync: false,
10817
10858
  isManualAsync: _trampoline16.manuallyAsync,
10818
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
10859
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
10819
10860
  resultLowerFns: [_lowerFlatResult([
10820
10861
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['lower', _lowerFlatU64, 8, 8 ],['upper', _lowerFlatU64, 8, 8 ],], size32: 16, align32: 8 }), 24, 8, 8 ],
10821
10862
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 24, 8, 8 ],
@@ -10839,7 +10880,7 @@ null,
10839
10880
  componentIdx: 0,
10840
10881
  isAsync: false,
10841
10882
  isManualAsync: _trampoline16.manuallyAsync,
10842
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
10883
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
10843
10884
  resultLowerFns: [_lowerFlatResult([
10844
10885
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['lower', _lowerFlatU64, 8, 8 ],['upper', _lowerFlatU64, 8, 8 ],], size32: 16, align32: 8 }), 24, 8, 8 ],
10845
10886
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 24, 8, 8 ],
@@ -11261,7 +11302,7 @@ null,
11261
11302
  componentIdx: 0,
11262
11303
  isAsync: false,
11263
11304
  isManualAsync: _trampoline22.manuallyAsync,
11264
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11305
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11265
11306
  resultLowerFns: [_lowerFlatResult([
11266
11307
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['type', _lowerFlatEnum([['unknown', null, 1, 1, 1],['block-device', null, 1, 1, 1],['character-device', null, 1, 1, 1],['directory', null, 1, 1, 1],['fifo', null, 1, 1, 1],['symbolic-link', null, 1, 1, 1],['regular-file', null, 1, 1, 1],['socket', null, 1, 1, 1],]), 1, 1 ],['linkCount', _lowerFlatU64, 8, 8 ],['size', _lowerFlatU64, 8, 8 ],['dataAccessTimestamp', _lowerFlatOption([
11267
11308
  [ 'none', null, 24, 8, 8 ],
@@ -11297,7 +11338,7 @@ null,
11297
11338
  componentIdx: 0,
11298
11339
  isAsync: false,
11299
11340
  isManualAsync: _trampoline22.manuallyAsync,
11300
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11341
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11301
11342
  resultLowerFns: [_lowerFlatResult([
11302
11343
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['type', _lowerFlatEnum([['unknown', null, 1, 1, 1],['block-device', null, 1, 1, 1],['character-device', null, 1, 1, 1],['directory', null, 1, 1, 1],['fifo', null, 1, 1, 1],['symbolic-link', null, 1, 1, 1],['regular-file', null, 1, 1, 1],['socket', null, 1, 1, 1],]), 1, 1 ],['linkCount', _lowerFlatU64, 8, 8 ],['size', _lowerFlatU64, 8, 8 ],['dataAccessTimestamp', _lowerFlatOption([
11303
11344
  [ 'none', null, 24, 8, 8 ],
@@ -11334,7 +11375,7 @@ null,
11334
11375
  componentIdx: 0,
11335
11376
  isAsync: false,
11336
11377
  isManualAsync: _trampoline23.manuallyAsync,
11337
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 })],
11378
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 })],
11338
11379
  resultLowerFns: [_lowerFlatResult([
11339
11380
  [ 'ok', _lowerFlatOwn({
11340
11381
  componentIdx: 0,
@@ -11374,7 +11415,7 @@ null,
11374
11415
  componentIdx: 0,
11375
11416
  isAsync: false,
11376
11417
  isManualAsync: _trampoline23.manuallyAsync,
11377
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 })],
11418
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 })],
11378
11419
  resultLowerFns: [_lowerFlatResult([
11379
11420
  [ 'ok', _lowerFlatOwn({
11380
11421
  componentIdx: 0,
Binary file
package/obj/wasm-tools.js CHANGED
@@ -1334,6 +1334,7 @@ class Waitable {
1334
1334
 
1335
1335
  function rscTableCreateOwn(table, rep) {
1336
1336
  const free = table[0] & ~T_FLAG;
1337
+ table._createdReps.add(rep);
1337
1338
  if (free === 0) {
1338
1339
  table.push(0);
1339
1340
  table.push(rep | T_FLAG);
@@ -3026,10 +3027,14 @@ function _lowerFlatFlags(meta) {
3026
3027
 
3027
3028
  let flagObj = ctx.vals[0];
3028
3029
  let flagValue = 0;
3029
- for (const [idx, name] of names.entries()) {
3030
- if (flagObj[name] === true) {
3031
- flagValue |= 1 << idx;
3030
+ if (typeof flagObj === 'object' && flagObj !== null) {
3031
+ for (const [idx, name] of names.entries()) {
3032
+ if (flagObj[name] === true) {
3033
+ flagValue |= 1 << idx;
3034
+ }
3032
3035
  }
3036
+ } else if (flagObj !== null && flagObj !== undefined) {
3037
+ throw new TypeError('only an object, undefined or null can be converted to flags');
3033
3038
  }
3034
3039
 
3035
3040
  const rem = ctx.storagePtr % align32;
@@ -3849,7 +3854,8 @@ const symbolRscHandle = Symbol('handle');
3849
3854
 
3850
3855
  const symbolRscRep = Symbol.for('cabiRep');
3851
3856
 
3852
- const handleTables = [];
3857
+ const HANDLE_TABLES= [];
3858
+
3853
3859
 
3854
3860
  class ComponentError extends Error {
3855
3861
  constructor (value) {
@@ -3878,10 +3884,15 @@ const instantiateCore = WebAssembly.instantiate;
3878
3884
 
3879
3885
  let exports0;
3880
3886
  let exports1;
3887
+
3881
3888
  const handleTable2 = [T_FLAG, 0];
3889
+ handleTable2._createdReps = new Set();
3890
+
3891
+
3882
3892
  const captureTable2= new Map();
3883
- let captureCnt2 = 0;
3884
- handleTables[2] = handleTable2;
3893
+ let captureCnt2= 0;
3894
+
3895
+ HANDLE_TABLES[2] = handleTable2;
3885
3896
 
3886
3897
  const _trampoline5 = function() {
3887
3898
  _debugLog('[iface="wasi:cli/stderr@0.2.3", function="get-stderr"] [Instruction::CallInterface] (sync, @ enter)');
@@ -3968,10 +3979,15 @@ const _trampoline5 = function() {
3968
3979
  return handle0;
3969
3980
  }
3970
3981
  _trampoline5.fnName = 'wasi:cli/stderr@0.2.3#getStderr';
3982
+
3971
3983
  const handleTable1 = [T_FLAG, 0];
3984
+ handleTable1._createdReps = new Set();
3985
+
3986
+
3972
3987
  const captureTable1= new Map();
3973
- let captureCnt1 = 0;
3974
- handleTables[1] = handleTable1;
3988
+ let captureCnt1= 0;
3989
+
3990
+ HANDLE_TABLES[1] = handleTable1;
3975
3991
 
3976
3992
  const _trampoline8 = function() {
3977
3993
  _debugLog('[iface="wasi:cli/stdin@0.2.3", function="get-stdin"] [Instruction::CallInterface] (sync, @ enter)');
@@ -4339,10 +4355,15 @@ const _trampoline11 = function(arg0) {
4339
4355
  task.exit();
4340
4356
  }
4341
4357
  _trampoline11.fnName = 'wasi:cli/environment@0.2.3#getEnvironment';
4358
+
4342
4359
  const handleTable6 = [T_FLAG, 0];
4360
+ handleTable6._createdReps = new Set();
4361
+
4362
+
4343
4363
  const captureTable6= new Map();
4344
- let captureCnt6 = 0;
4345
- handleTables[6] = handleTable6;
4364
+ let captureCnt6= 0;
4365
+
4366
+ HANDLE_TABLES[6] = handleTable6;
4346
4367
 
4347
4368
  const _trampoline12 = function(arg0, arg1) {
4348
4369
  var handle1 = arg0;
@@ -5183,10 +5204,15 @@ task.resolve([ret]);
5183
5204
  task.exit();
5184
5205
  }
5185
5206
  _trampoline14.fnName = 'wasi:filesystem/types@0.2.3#metadataHash';
5207
+
5186
5208
  const handleTable0 = [T_FLAG, 0];
5209
+ handleTable0._createdReps = new Set();
5210
+
5211
+
5187
5212
  const captureTable0= new Map();
5188
- let captureCnt0 = 0;
5189
- handleTables[0] = handleTable0;
5213
+ let captureCnt0= 0;
5214
+
5215
+ HANDLE_TABLES[0] = handleTable0;
5190
5216
 
5191
5217
  const _trampoline15 = function(arg0, arg1) {
5192
5218
  var handle1 = arg0;
@@ -6539,10 +6565,15 @@ task.resolve([ret]);
6539
6565
  task.exit();
6540
6566
  }
6541
6567
  _trampoline19.fnName = 'wasi:filesystem/types@0.2.3#appendViaStream';
6568
+
6542
6569
  const handleTable5 = [T_FLAG, 0];
6570
+ handleTable5._createdReps = new Set();
6571
+
6572
+
6543
6573
  const captureTable5= new Map();
6544
- let captureCnt5 = 0;
6545
- handleTables[5] = handleTable5;
6574
+ let captureCnt5= 0;
6575
+
6576
+ HANDLE_TABLES[5] = handleTable5;
6546
6577
 
6547
6578
  const _trampoline20 = function(arg0, arg1) {
6548
6579
  var handle1 = arg0;
@@ -9157,10 +9188,15 @@ const _trampoline32 = function(arg0) {
9157
9188
  task.exit();
9158
9189
  }
9159
9190
  _trampoline32.fnName = 'wasi:filesystem/preopens@0.2.3#getDirectories';
9191
+
9160
9192
  const handleTable3 = [T_FLAG, 0];
9193
+ handleTable3._createdReps = new Set();
9194
+
9195
+
9161
9196
  const captureTable3= new Map();
9162
- let captureCnt3 = 0;
9163
- handleTables[3] = handleTable3;
9197
+ let captureCnt3= 0;
9198
+
9199
+ HANDLE_TABLES[3] = handleTable3;
9164
9200
 
9165
9201
  const _trampoline33 = function(arg0) {
9166
9202
  _debugLog('[iface="wasi:cli/terminal-stdin@0.2.3", function="get-terminal-stdin"] [Instruction::CallInterface] (sync, @ enter)');
@@ -9254,10 +9290,15 @@ const _trampoline33 = function(arg0) {
9254
9290
  task.exit();
9255
9291
  }
9256
9292
  _trampoline33.fnName = 'wasi:cli/terminal-stdin@0.2.3#getTerminalStdin';
9293
+
9257
9294
  const handleTable4 = [T_FLAG, 0];
9295
+ handleTable4._createdReps = new Set();
9296
+
9297
+
9258
9298
  const captureTable4= new Map();
9259
- let captureCnt4 = 0;
9260
- handleTables[4] = handleTable4;
9299
+ let captureCnt4= 0;
9300
+
9301
+ HANDLE_TABLES[4] = handleTable4;
9261
9302
 
9262
9303
  const _trampoline34 = function(arg0) {
9263
9304
  _debugLog('[iface="wasi:cli/terminal-stdout@0.2.3", function="get-terminal-stdout"] [Instruction::CallInterface] (sync, @ enter)');
@@ -11324,7 +11365,7 @@ null,
11324
11365
  isManualAsync: _trampoline12.manuallyAsync,
11325
11366
  paramLiftFns: [_liftFlatBorrow.bind(null, 6)],
11326
11367
  resultLowerFns: [_lowerFlatResult([
11327
- [ 'ok', _lowerFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
11368
+ [ 'ok', _lowerFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
11328
11369
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 2, 1, 1 ],
11329
11370
  ])
11330
11371
  ],
@@ -11348,7 +11389,7 @@ null,
11348
11389
  isManualAsync: _trampoline12.manuallyAsync,
11349
11390
  paramLiftFns: [_liftFlatBorrow.bind(null, 6)],
11350
11391
  resultLowerFns: [_lowerFlatResult([
11351
- [ 'ok', _lowerFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
11392
+ [ 'ok', _lowerFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 }), 2, 1, 1 ],
11352
11393
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 2, 1, 1 ],
11353
11394
  ])
11354
11395
  ],
@@ -11518,7 +11559,7 @@ null,
11518
11559
  componentIdx: 0,
11519
11560
  isAsync: false,
11520
11561
  isManualAsync: _trampoline16.manuallyAsync,
11521
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11562
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11522
11563
  resultLowerFns: [_lowerFlatResult([
11523
11564
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['lower', _lowerFlatU64, 8, 8 ],['upper', _lowerFlatU64, 8, 8 ],], size32: 16, align32: 8 }), 24, 8, 8 ],
11524
11565
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 24, 8, 8 ],
@@ -11542,7 +11583,7 @@ null,
11542
11583
  componentIdx: 0,
11543
11584
  isAsync: false,
11544
11585
  isManualAsync: _trampoline16.manuallyAsync,
11545
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11586
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11546
11587
  resultLowerFns: [_lowerFlatResult([
11547
11588
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['lower', _lowerFlatU64, 8, 8 ],['upper', _lowerFlatU64, 8, 8 ],], size32: 16, align32: 8 }), 24, 8, 8 ],
11548
11589
  [ 'err', _lowerFlatEnum([['access', null, 1, 1, 1],['would-block', null, 1, 1, 1],['already', null, 1, 1, 1],['bad-descriptor', null, 1, 1, 1],['busy', null, 1, 1, 1],['deadlock', null, 1, 1, 1],['quota', null, 1, 1, 1],['exist', null, 1, 1, 1],['file-too-large', null, 1, 1, 1],['illegal-byte-sequence', null, 1, 1, 1],['in-progress', null, 1, 1, 1],['interrupted', null, 1, 1, 1],['invalid', null, 1, 1, 1],['io', null, 1, 1, 1],['is-directory', null, 1, 1, 1],['loop', null, 1, 1, 1],['too-many-links', null, 1, 1, 1],['message-size', null, 1, 1, 1],['name-too-long', null, 1, 1, 1],['no-device', null, 1, 1, 1],['no-entry', null, 1, 1, 1],['no-lock', null, 1, 1, 1],['insufficient-memory', null, 1, 1, 1],['insufficient-space', null, 1, 1, 1],['not-directory', null, 1, 1, 1],['not-empty', null, 1, 1, 1],['not-recoverable', null, 1, 1, 1],['unsupported', null, 1, 1, 1],['no-tty', null, 1, 1, 1],['no-such-device', null, 1, 1, 1],['overflow', null, 1, 1, 1],['not-permitted', null, 1, 1, 1],['pipe', null, 1, 1, 1],['read-only', null, 1, 1, 1],['invalid-seek', null, 1, 1, 1],['text-file-busy', null, 1, 1, 1],['cross-device', null, 1, 1, 1],]), 24, 8, 8 ],
@@ -11964,7 +12005,7 @@ null,
11964
12005
  componentIdx: 0,
11965
12006
  isAsync: false,
11966
12007
  isManualAsync: _trampoline22.manuallyAsync,
11967
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
12008
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
11968
12009
  resultLowerFns: [_lowerFlatResult([
11969
12010
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['type', _lowerFlatEnum([['unknown', null, 1, 1, 1],['block-device', null, 1, 1, 1],['character-device', null, 1, 1, 1],['directory', null, 1, 1, 1],['fifo', null, 1, 1, 1],['symbolic-link', null, 1, 1, 1],['regular-file', null, 1, 1, 1],['socket', null, 1, 1, 1],]), 1, 1 ],['linkCount', _lowerFlatU64, 8, 8 ],['size', _lowerFlatU64, 8, 8 ],['dataAccessTimestamp', _lowerFlatOption([
11970
12011
  [ 'none', null, 24, 8, 8 ],
@@ -12000,7 +12041,7 @@ null,
12000
12041
  componentIdx: 0,
12001
12042
  isAsync: false,
12002
12043
  isManualAsync: _trampoline22.manuallyAsync,
12003
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
12044
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny],
12004
12045
  resultLowerFns: [_lowerFlatResult([
12005
12046
  [ 'ok', _lowerFlatRecord({ fieldMetas: [['type', _lowerFlatEnum([['unknown', null, 1, 1, 1],['block-device', null, 1, 1, 1],['character-device', null, 1, 1, 1],['directory', null, 1, 1, 1],['fifo', null, 1, 1, 1],['symbolic-link', null, 1, 1, 1],['regular-file', null, 1, 1, 1],['socket', null, 1, 1, 1],]), 1, 1 ],['linkCount', _lowerFlatU64, 8, 8 ],['size', _lowerFlatU64, 8, 8 ],['dataAccessTimestamp', _lowerFlatOption([
12006
12047
  [ 'none', null, 24, 8, 8 ],
@@ -12037,7 +12078,7 @@ null,
12037
12078
  componentIdx: 0,
12038
12079
  isAsync: false,
12039
12080
  isManualAsync: _trampoline23.manuallyAsync,
12040
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 })],
12081
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 })],
12041
12082
  resultLowerFns: [_lowerFlatResult([
12042
12083
  [ 'ok', _lowerFlatOwn({
12043
12084
  componentIdx: 0,
@@ -12077,7 +12118,7 @@ null,
12077
12118
  componentIdx: 0,
12078
12119
  isAsync: false,
12079
12120
  isManualAsync: _trampoline23.manuallyAsync,
12080
- paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlink-follow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','file-integrity-sync','data-integrity-sync','requested-write-sync','mutate-directory'], size32: 1, align32: 1, intSizeBytes: 1 })],
12121
+ paramLiftFns: [_liftFlatBorrow.bind(null, 6),_liftFlatFlags({ names: ['symlinkFollow'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatStringAny,_liftFlatFlags({ names: ['create','directory','exclusive','truncate'], size32: 1, align32: 1, intSizeBytes: 1 }),_liftFlatFlags({ names: ['read','write','fileIntegritySync','dataIntegritySync','requestedWriteSync','mutateDirectory'], size32: 1, align32: 1, intSizeBytes: 1 })],
12081
12122
  resultLowerFns: [_lowerFlatResult([
12082
12123
  [ 'ok', _lowerFlatOwn({
12083
12124
  componentIdx: 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytecodealliance/jco",
3
- "version": "1.20.0",
3
+ "version": "1.21.0",
4
4
  "description": "JavaScript tooling for working with WebAssembly Components",
5
5
  "keywords": [
6
6
  "Component",
@@ -77,12 +77,12 @@
77
77
  "conventional-changelog-conventionalcommits": "^9.1.0",
78
78
  "mime": "^4.0.7",
79
79
  "oxfmt": "^0.28.0",
80
- "puppeteer": "^24.43.1",
80
+ "puppeteer": "^25.1.0",
81
81
  "semver": "^7.7.1",
82
82
  "smol-toml": "^1.4.2",
83
83
  "typescript": "^5.9.2",
84
84
  "vite": "^7.1.5",
85
- "vitest": "^3.2.4",
85
+ "vitest": "^4.1.0",
86
86
  "which": "^2.0.2"
87
87
  },
88
88
  "scripts": {
@@ -96,6 +96,7 @@
96
96
  "lint": "oxlint",
97
97
  "lint:fix": "oxlint --fix",
98
98
  "test": "vitest run -c test/vitest.ts",
99
- "test:lts": "vitest run -c test/vitest.lts.ts"
99
+ "test:lts": "vitest run -c test/vitest.lts.ts",
100
+ "test:extended": "vitest run -c test/vitest.extended.ts"
100
101
  }
101
102
  }
package/src/jco.js CHANGED
@@ -25,7 +25,7 @@ program
25
25
  )
26
26
  .usage("<command> [options]")
27
27
  .enablePositionalOptions()
28
- .version("1.20.0");
28
+ .version("1.21.0");
29
29
 
30
30
  function myParseInt(value) {
31
31
  return parseInt(value, 10);