@bytecodealliance/jco 1.15.0 → 1.15.2
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.
|
Binary file
|
|
@@ -152,6 +152,7 @@ class AsyncTask {
|
|
|
152
152
|
#onResolve = null;
|
|
153
153
|
#returnedResults = null;
|
|
154
154
|
#entryFnName = null;
|
|
155
|
+
#subtasks = [];
|
|
155
156
|
|
|
156
157
|
cancelled = false;
|
|
157
158
|
requested = false;
|
|
@@ -386,7 +387,6 @@ class AsyncTask {
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
// NOTE: this should likely be moved to a SubTask class
|
|
390
390
|
async asyncOnBlock(awaitable) {
|
|
391
391
|
_debugLog('[AsyncTask#asyncOnBlock()] args', { taskID: this.#id, awaitable });
|
|
392
392
|
if (!(awaitable instanceof Awaitable)) {
|
|
@@ -461,6 +461,7 @@ class AsyncTask {
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
resolve(result) {
|
|
464
|
+
_debugLog('[AsyncTask#resolve()] args', { result });
|
|
464
465
|
if (this.#state === AsyncTask.State.RESOLVED) {
|
|
465
466
|
throw new Error('task is already resolved');
|
|
466
467
|
}
|
|
@@ -470,6 +471,8 @@ class AsyncTask {
|
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
exit() {
|
|
474
|
+
_debugLog('[AsyncTask#exit()] args', { });
|
|
475
|
+
|
|
473
476
|
// TODO: ensure there is only one task at a time (scheduler.lock() functionality)
|
|
474
477
|
if (this.#state !== AsyncTask.State.RESOLVED) {
|
|
475
478
|
throw new Error('task exited without resolution');
|
|
@@ -488,10 +491,35 @@ class AsyncTask {
|
|
|
488
491
|
this.startPendingTask();
|
|
489
492
|
}
|
|
490
493
|
|
|
491
|
-
startPendingTask(
|
|
492
|
-
|
|
494
|
+
startPendingTask(args) {
|
|
495
|
+
_debugLog('[AsyncTask#startPendingTask()] args', args);
|
|
496
|
+
throw new Error('AsyncTask#startPendingTask() not implemented');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
createSubtask(args) {
|
|
500
|
+
_debugLog('[AsyncTask#createSubtask()] args', args);
|
|
501
|
+
const newSubtask = new AsyncSubtask({
|
|
502
|
+
componentIdx: this.componentIdx(),
|
|
503
|
+
taskID: this.id(),
|
|
504
|
+
memoryIdx: args?.memoryIdx,
|
|
505
|
+
});
|
|
506
|
+
this.#subtasks.push(newSubtask);
|
|
507
|
+
return newSubtask;
|
|
493
508
|
}
|
|
494
509
|
|
|
510
|
+
currentSubtask() {
|
|
511
|
+
_debugLog('[AsyncTask#currentSubtask()]');
|
|
512
|
+
if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
|
|
513
|
+
return this.#subtasks.at(-1);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
endCurrentSubtask() {
|
|
517
|
+
_debugLog('[AsyncTask#endCurrentSubtask()]');
|
|
518
|
+
if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
|
|
519
|
+
const subtask = this.#subtasks.pop();
|
|
520
|
+
subtask.drop();
|
|
521
|
+
return subtask;
|
|
522
|
+
}
|
|
495
523
|
}
|
|
496
524
|
|
|
497
525
|
function unpackCallbackResult(result) {
|
|
@@ -520,7 +548,7 @@ class ComponentAsyncState {
|
|
|
520
548
|
#syncImportWait = Promise.withResolvers();
|
|
521
549
|
#lock = null;
|
|
522
550
|
|
|
523
|
-
mayLeave =
|
|
551
|
+
mayLeave = true;
|
|
524
552
|
waitableSets = new RepTable();
|
|
525
553
|
waitables = new RepTable();
|
|
526
554
|
|
|
@@ -626,6 +654,45 @@ isExclusivelyLocked() { return this.#lock !== null; }
|
|
|
626
654
|
|
|
627
655
|
}
|
|
628
656
|
|
|
657
|
+
function prepareCall(memoryIdx) {
|
|
658
|
+
_debugLog('[prepareCall()] args', { memoryIdx });
|
|
659
|
+
|
|
660
|
+
const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
|
|
661
|
+
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
662
|
+
|
|
663
|
+
const task = taskMeta.task;
|
|
664
|
+
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
665
|
+
|
|
666
|
+
const state = getOrCreateAsyncState(task.componentIdx());
|
|
667
|
+
if (!state) {
|
|
668
|
+
throw new Error('invalid/missing async state for component instance [' + componentInstanceID + ']');
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const subtask = task.createSubtask({
|
|
672
|
+
memoryIdx,
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function asyncStartCall(callbackIdx, postReturnIdx) {
|
|
678
|
+
_debugLog('[asyncStartCall()] args', { callbackIdx, postReturnIdx });
|
|
679
|
+
|
|
680
|
+
const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
|
|
681
|
+
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
682
|
+
|
|
683
|
+
const task = taskMeta.task;
|
|
684
|
+
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
685
|
+
|
|
686
|
+
const subtask = task.currentSubtask();
|
|
687
|
+
if (!subtask) { throw new Error('invalid/missing subtask during async start call'); }
|
|
688
|
+
|
|
689
|
+
return Number(subtask.waitableRep()) << 4 | subtask.getStateNumber();
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function syncStartCall(callbackIdx) {
|
|
693
|
+
_debugLog('[syncStartCall()] args', { callbackIdx });
|
|
694
|
+
}
|
|
695
|
+
|
|
629
696
|
if (!Promise.withResolvers) {
|
|
630
697
|
Promise.withResolvers = () => {
|
|
631
698
|
let resolve;
|
|
@@ -695,39 +762,42 @@ class RepTable {
|
|
|
695
762
|
this.#data.push(null);
|
|
696
763
|
return (this.#data.length >> 1) - 1;
|
|
697
764
|
}
|
|
698
|
-
this.#data[0] = this.#data[freeIdx];
|
|
699
|
-
const
|
|
700
|
-
this.#data[
|
|
701
|
-
this.#data[
|
|
702
|
-
return
|
|
765
|
+
this.#data[0] = this.#data[freeIdx << 1];
|
|
766
|
+
const placementIdx = freeIdx << 1;
|
|
767
|
+
this.#data[placementIdx] = val;
|
|
768
|
+
this.#data[placementIdx + 1] = null;
|
|
769
|
+
return freeIdx;
|
|
703
770
|
}
|
|
704
771
|
|
|
705
772
|
get(rep) {
|
|
706
|
-
_debugLog('[RepTable#
|
|
707
|
-
const baseIdx =
|
|
773
|
+
_debugLog('[RepTable#get()] args', { rep });
|
|
774
|
+
const baseIdx = rep << 1;
|
|
708
775
|
const val = this.#data[baseIdx];
|
|
709
776
|
return val;
|
|
710
777
|
}
|
|
711
778
|
|
|
712
779
|
contains(rep) {
|
|
713
|
-
_debugLog('[RepTable#
|
|
714
|
-
const baseIdx =
|
|
780
|
+
_debugLog('[RepTable#contains()] args', { rep });
|
|
781
|
+
const baseIdx = rep << 1;
|
|
715
782
|
return !!this.#data[baseIdx];
|
|
716
783
|
}
|
|
717
784
|
|
|
718
785
|
remove(rep) {
|
|
719
|
-
_debugLog('[RepTable#
|
|
786
|
+
_debugLog('[RepTable#remove()] args', { rep });
|
|
720
787
|
if (this.#data.length === 2) { throw new Error('invalid'); }
|
|
721
788
|
|
|
722
|
-
const baseIdx =
|
|
789
|
+
const baseIdx = rep << 1;
|
|
723
790
|
const val = this.#data[baseIdx];
|
|
724
791
|
if (val === 0) { throw new Error('invalid resource rep (cannot be 0)'); }
|
|
792
|
+
|
|
725
793
|
this.#data[baseIdx] = this.#data[0];
|
|
726
|
-
this.#data[0] =
|
|
794
|
+
this.#data[0] = rep;
|
|
795
|
+
|
|
727
796
|
return val;
|
|
728
797
|
}
|
|
729
798
|
|
|
730
799
|
clear() {
|
|
800
|
+
_debugLog('[RepTable#clear()] args', { rep });
|
|
731
801
|
this.#data = [0, null];
|
|
732
802
|
}
|
|
733
803
|
}
|
|
@@ -5033,11 +5103,11 @@ function generateTypes(arg0, arg1) {
|
|
|
5033
5103
|
|
|
5034
5104
|
let _initialized = false;
|
|
5035
5105
|
export const $init = (() => {
|
|
5036
|
-
let gen = (function*
|
|
5106
|
+
let gen = (function* _initGenerator () {
|
|
5037
5107
|
const module0 = fetchCompile(new URL('./js-component-bindgen-component.core.wasm', import.meta.url));
|
|
5038
5108
|
const module1 = fetchCompile(new URL('./js-component-bindgen-component.core2.wasm', import.meta.url));
|
|
5039
|
-
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUCBAcECAkCAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+
|
|
5040
|
-
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+
|
|
5109
|
+
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUCBAcECAkCAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlCwAgACABQQARAgALDwAgACABIAIgA0EBEQQACxEAIAAgASACIAMgBEECEQcACw8AIAAgASACIANBAxEEAAsRACAAIAEgAiADIARBBBEIAAsZACAAIAEgAiADIAQgBSAGIAcgCEEFEQkACwsAIAAgAUEGEQIACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
|
|
5110
|
+
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAFf39/fn8Bf2AFf39/f38Bf2AJf39/f39+fn9/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAIAATEABAABMgAHAAEzAAQAATQACAABNQAJAAE2AAIAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
|
|
5041
5111
|
({ exports: exports0 } = yield instantiateCore(yield module2));
|
|
5042
5112
|
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
5043
5113
|
wasi_snapshot_preview1: {
|
package/obj/wasm-tools.core.wasm
CHANGED
|
Binary file
|
package/obj/wasm-tools.js
CHANGED
|
@@ -152,6 +152,7 @@ class AsyncTask {
|
|
|
152
152
|
#onResolve = null;
|
|
153
153
|
#returnedResults = null;
|
|
154
154
|
#entryFnName = null;
|
|
155
|
+
#subtasks = [];
|
|
155
156
|
|
|
156
157
|
cancelled = false;
|
|
157
158
|
requested = false;
|
|
@@ -386,7 +387,6 @@ class AsyncTask {
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
// NOTE: this should likely be moved to a SubTask class
|
|
390
390
|
async asyncOnBlock(awaitable) {
|
|
391
391
|
_debugLog('[AsyncTask#asyncOnBlock()] args', { taskID: this.#id, awaitable });
|
|
392
392
|
if (!(awaitable instanceof Awaitable)) {
|
|
@@ -461,6 +461,7 @@ class AsyncTask {
|
|
|
461
461
|
}
|
|
462
462
|
|
|
463
463
|
resolve(result) {
|
|
464
|
+
_debugLog('[AsyncTask#resolve()] args', { result });
|
|
464
465
|
if (this.#state === AsyncTask.State.RESOLVED) {
|
|
465
466
|
throw new Error('task is already resolved');
|
|
466
467
|
}
|
|
@@ -470,6 +471,8 @@ class AsyncTask {
|
|
|
470
471
|
}
|
|
471
472
|
|
|
472
473
|
exit() {
|
|
474
|
+
_debugLog('[AsyncTask#exit()] args', { });
|
|
475
|
+
|
|
473
476
|
// TODO: ensure there is only one task at a time (scheduler.lock() functionality)
|
|
474
477
|
if (this.#state !== AsyncTask.State.RESOLVED) {
|
|
475
478
|
throw new Error('task exited without resolution');
|
|
@@ -488,10 +491,35 @@ class AsyncTask {
|
|
|
488
491
|
this.startPendingTask();
|
|
489
492
|
}
|
|
490
493
|
|
|
491
|
-
startPendingTask(
|
|
492
|
-
|
|
494
|
+
startPendingTask(args) {
|
|
495
|
+
_debugLog('[AsyncTask#startPendingTask()] args', args);
|
|
496
|
+
throw new Error('AsyncTask#startPendingTask() not implemented');
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
createSubtask(args) {
|
|
500
|
+
_debugLog('[AsyncTask#createSubtask()] args', args);
|
|
501
|
+
const newSubtask = new AsyncSubtask({
|
|
502
|
+
componentIdx: this.componentIdx(),
|
|
503
|
+
taskID: this.id(),
|
|
504
|
+
memoryIdx: args?.memoryIdx,
|
|
505
|
+
});
|
|
506
|
+
this.#subtasks.push(newSubtask);
|
|
507
|
+
return newSubtask;
|
|
493
508
|
}
|
|
494
509
|
|
|
510
|
+
currentSubtask() {
|
|
511
|
+
_debugLog('[AsyncTask#currentSubtask()]');
|
|
512
|
+
if (this.#subtasks.length === 0) { throw new Error('no current subtask'); }
|
|
513
|
+
return this.#subtasks.at(-1);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
endCurrentSubtask() {
|
|
517
|
+
_debugLog('[AsyncTask#endCurrentSubtask()]');
|
|
518
|
+
if (this.#subtasks.length === 0) { throw new Error('cannot end current subtask: no current subtask'); }
|
|
519
|
+
const subtask = this.#subtasks.pop();
|
|
520
|
+
subtask.drop();
|
|
521
|
+
return subtask;
|
|
522
|
+
}
|
|
495
523
|
}
|
|
496
524
|
|
|
497
525
|
function unpackCallbackResult(result) {
|
|
@@ -520,7 +548,7 @@ class ComponentAsyncState {
|
|
|
520
548
|
#syncImportWait = Promise.withResolvers();
|
|
521
549
|
#lock = null;
|
|
522
550
|
|
|
523
|
-
mayLeave =
|
|
551
|
+
mayLeave = true;
|
|
524
552
|
waitableSets = new RepTable();
|
|
525
553
|
waitables = new RepTable();
|
|
526
554
|
|
|
@@ -626,6 +654,45 @@ isExclusivelyLocked() { return this.#lock !== null; }
|
|
|
626
654
|
|
|
627
655
|
}
|
|
628
656
|
|
|
657
|
+
function prepareCall(memoryIdx) {
|
|
658
|
+
_debugLog('[prepareCall()] args', { memoryIdx });
|
|
659
|
+
|
|
660
|
+
const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
|
|
661
|
+
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
662
|
+
|
|
663
|
+
const task = taskMeta.task;
|
|
664
|
+
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
665
|
+
|
|
666
|
+
const state = getOrCreateAsyncState(task.componentIdx());
|
|
667
|
+
if (!state) {
|
|
668
|
+
throw new Error('invalid/missing async state for component instance [' + componentInstanceID + ']');
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
const subtask = task.createSubtask({
|
|
672
|
+
memoryIdx,
|
|
673
|
+
});
|
|
674
|
+
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function asyncStartCall(callbackIdx, postReturnIdx) {
|
|
678
|
+
_debugLog('[asyncStartCall()] args', { callbackIdx, postReturnIdx });
|
|
679
|
+
|
|
680
|
+
const taskMeta = getCurrentTask(ASYNC_CURRENT_COMPONENT_IDXS.at(-1), ASYNC_CURRENT_TASK_IDS.at(-1));
|
|
681
|
+
if (!taskMeta) { throw new Error('invalid/missing current async task meta during prepare call'); }
|
|
682
|
+
|
|
683
|
+
const task = taskMeta.task;
|
|
684
|
+
if (!task) { throw new Error('unexpectedly missing task in task meta during prepare call'); }
|
|
685
|
+
|
|
686
|
+
const subtask = task.currentSubtask();
|
|
687
|
+
if (!subtask) { throw new Error('invalid/missing subtask during async start call'); }
|
|
688
|
+
|
|
689
|
+
return Number(subtask.waitableRep()) << 4 | subtask.getStateNumber();
|
|
690
|
+
}
|
|
691
|
+
|
|
692
|
+
function syncStartCall(callbackIdx) {
|
|
693
|
+
_debugLog('[syncStartCall()] args', { callbackIdx });
|
|
694
|
+
}
|
|
695
|
+
|
|
629
696
|
if (!Promise.withResolvers) {
|
|
630
697
|
Promise.withResolvers = () => {
|
|
631
698
|
let resolve;
|
|
@@ -695,39 +762,42 @@ class RepTable {
|
|
|
695
762
|
this.#data.push(null);
|
|
696
763
|
return (this.#data.length >> 1) - 1;
|
|
697
764
|
}
|
|
698
|
-
this.#data[0] = this.#data[freeIdx];
|
|
699
|
-
const
|
|
700
|
-
this.#data[
|
|
701
|
-
this.#data[
|
|
702
|
-
return
|
|
765
|
+
this.#data[0] = this.#data[freeIdx << 1];
|
|
766
|
+
const placementIdx = freeIdx << 1;
|
|
767
|
+
this.#data[placementIdx] = val;
|
|
768
|
+
this.#data[placementIdx + 1] = null;
|
|
769
|
+
return freeIdx;
|
|
703
770
|
}
|
|
704
771
|
|
|
705
772
|
get(rep) {
|
|
706
|
-
_debugLog('[RepTable#
|
|
707
|
-
const baseIdx =
|
|
773
|
+
_debugLog('[RepTable#get()] args', { rep });
|
|
774
|
+
const baseIdx = rep << 1;
|
|
708
775
|
const val = this.#data[baseIdx];
|
|
709
776
|
return val;
|
|
710
777
|
}
|
|
711
778
|
|
|
712
779
|
contains(rep) {
|
|
713
|
-
_debugLog('[RepTable#
|
|
714
|
-
const baseIdx =
|
|
780
|
+
_debugLog('[RepTable#contains()] args', { rep });
|
|
781
|
+
const baseIdx = rep << 1;
|
|
715
782
|
return !!this.#data[baseIdx];
|
|
716
783
|
}
|
|
717
784
|
|
|
718
785
|
remove(rep) {
|
|
719
|
-
_debugLog('[RepTable#
|
|
786
|
+
_debugLog('[RepTable#remove()] args', { rep });
|
|
720
787
|
if (this.#data.length === 2) { throw new Error('invalid'); }
|
|
721
788
|
|
|
722
|
-
const baseIdx =
|
|
789
|
+
const baseIdx = rep << 1;
|
|
723
790
|
const val = this.#data[baseIdx];
|
|
724
791
|
if (val === 0) { throw new Error('invalid resource rep (cannot be 0)'); }
|
|
792
|
+
|
|
725
793
|
this.#data[baseIdx] = this.#data[0];
|
|
726
|
-
this.#data[0] =
|
|
794
|
+
this.#data[0] = rep;
|
|
795
|
+
|
|
727
796
|
return val;
|
|
728
797
|
}
|
|
729
798
|
|
|
730
799
|
clear() {
|
|
800
|
+
_debugLog('[RepTable#clear()] args', { rep });
|
|
731
801
|
this.#data = [0, null];
|
|
732
802
|
}
|
|
733
803
|
}
|
|
@@ -5165,11 +5235,11 @@ function metadataAdd(arg0, arg1) {
|
|
|
5165
5235
|
|
|
5166
5236
|
let _initialized = false;
|
|
5167
5237
|
export const $init = (() => {
|
|
5168
|
-
let gen = (function*
|
|
5238
|
+
let gen = (function* _initGenerator () {
|
|
5169
5239
|
const module0 = fetchCompile(new URL('./wasm-tools.core.wasm', import.meta.url));
|
|
5170
5240
|
const module1 = fetchCompile(new URL('./wasm-tools.core2.wasm', import.meta.url));
|
|
5171
|
-
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHCAkCAgQEAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+
|
|
5172
|
-
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+
|
|
5241
|
+
const module2 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwADJiUHCAkCAgQEAgIKAgsBAQAAAAUDAwAAAAUMAAMDAAYGAA0BAQEBBAUBcAElJQe7ASYBMAAAATEAAQEyAAIBMwADATQABAE1AAUBNgAGATcABwE4AAgBOQAJAjEwAAoCMTEACwIxMgAMAjEzAA0CMTQADgIxNQAPAjE2ABACMTcAEQIxOAASAjE5ABMCMjAAFAIyMQAVAjIyABYCMjMAFwIyNAAYAjI1ABkCMjYAGgIyNwAbAjI4ABwCMjkAHQIzMAAeAjMxAB8CMzIAIAIzMwAhAjM0ACICMzUAIwIzNgAkCCRpbXBvcnRzAQAK+QMlGQAgACABIAIgAyAEIAUgBiAHIAhBABEHAAsRACAAIAEgAiADIARBAREIAAsRACAAIAEgAiADIARBAhEJAAsLACAAIAFBAxECAAsLACAAIAFBBBECAAsPACAAIAEgAiADQQURBAALDwAgACABIAIgA0EGEQQACwsAIAAgAUEHEQIACwsAIAAgAUEIEQIACwkAIABBCREKAAsLACAAIAFBChECAAsNACAAIAEgAkELEQsACwkAIABBDBEBAAsJACAAQQ0RAQALCwAgACABQQ4RAAALCwAgACABQQ8RAAALCwAgACABQRARAAALEQAgACABIAIgAyAEQRERBQALDQAgACABIAJBEhEDAAsNACAAIAEgAkETEQMACwsAIAAgAUEUEQAACwsAIAAgAUEVEQAACwsAIAAgAUEWEQAACxEAIAAgASACIAMgBEEXEQUACxUAIAAgASACIAMgBCAFIAZBGBEMAAsLACAAIAFBGREAAAsNACAAIAEgAkEaEQMACw0AIAAgASACQRsRAwALCwAgACABQRwRAAALDwAgACABIAIgA0EdEQYACw8AIAAgASACIANBHhEGAAsLACAAIAFBHxEAAAsLACAAIAFBIBENAAsJACAAQSERAQALCQAgAEEiEQEACwkAIABBIxEBAAsJACAAQSQRAQALAC8JcHJvZHVjZXJzAQxwcm9jZXNzZWQtYnkBDXdpdC1jb21wb25lbnQHMC4yNDAuMA');
|
|
5242
|
+
const module3 = base64Compile('AGFzbQEAAAABZw5gAn9/AGABfwBgAn9/AX9gA39+fwBgBH9/f38Bf2AFf39/f38AYAR/f39/AGAJf39/f39+fn9/AX9gBX9/f35/AX9gBX9/f39/AX9gAX8Bf2ADf39/AX9gB39/f39/f38AYAJ+fwAC5AEmAAEwAAcAATEACAABMgAJAAEzAAIAATQAAgABNQAEAAE2AAQAATcAAgABOAACAAE5AAoAAjEwAAIAAjExAAsAAjEyAAEAAjEzAAEAAjE0AAAAAjE1AAAAAjE2AAAAAjE3AAUAAjE4AAMAAjE5AAMAAjIwAAAAAjIxAAAAAjIyAAAAAjIzAAUAAjI0AAwAAjI1AAAAAjI2AAMAAjI3AAMAAjI4AAAAAjI5AAYAAjMwAAYAAjMxAAAAAjMyAA0AAjMzAAEAAjM0AAEAAjM1AAEAAjM2AAEACCRpbXBvcnRzAXABJSUJKwEAQQALJQABAgMEBQYHCAkKCwwNDg8QERITFBUWFxgZGhscHR4fICEiIyQALwlwcm9kdWNlcnMBDHByb2Nlc3NlZC1ieQENd2l0LWNvbXBvbmVudAcwLjI0MC4w');
|
|
5173
5243
|
({ exports: exports0 } = yield instantiateCore(yield module2));
|
|
5174
5244
|
({ exports: exports1 } = yield instantiateCore(yield module0, {
|
|
5175
5245
|
wasi_snapshot_preview1: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytecodealliance/jco",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.2",
|
|
4
4
|
"description": "JavaScript tooling for working with WebAssembly Components",
|
|
5
5
|
"homepage": "https://github.com/bytecodealliance/jco#readme",
|
|
6
6
|
"author": "Guy Bedford",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"prepack": "cargo xtask build release"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@bytecodealliance/componentize-js": "^0.
|
|
74
|
+
"@bytecodealliance/componentize-js": "^0.19.3",
|
|
75
75
|
"@bytecodealliance/preview2-shim": "^0.17.3",
|
|
76
76
|
"binaryen": "^123.0.0",
|
|
77
77
|
"commander": "^14",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
"semver": "^7.7.1",
|
|
93
93
|
"smol-toml": "^1.4.2",
|
|
94
94
|
"typescript": "^5.9.2",
|
|
95
|
-
"vitest": "^3.2.4"
|
|
95
|
+
"vitest": "^3.2.4",
|
|
96
|
+
"which": "^2.0.2"
|
|
96
97
|
}
|
|
97
98
|
}
|
package/src/cmd/transpile.js
CHANGED
|
@@ -176,7 +176,7 @@ export async function transpileComponent(component, opts = {}) {
|
|
|
176
176
|
let asyncMode = opts.asyncMode ?? DEFAULT_ASYNC_MODE;
|
|
177
177
|
if (asyncMode === 'sync' && asyncExports.size > 0) {
|
|
178
178
|
throw new Error(
|
|
179
|
-
'async exports cannot be specified in sync mode (consider
|
|
179
|
+
'async exports cannot be specified in sync mode (consider adding --async-mode=jspi)'
|
|
180
180
|
);
|
|
181
181
|
}
|
|
182
182
|
let asyncModeObj;
|