@bytecodealliance/jco 1.0.3 → 1.1.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/README.md +1 -1
- package/lib/wasi_snapshot_preview1.command.wasm +0 -0
- package/lib/wasi_snapshot_preview1.reactor.wasm +0 -0
- package/obj/interfaces/wasi-filesystem-types.d.ts +4 -4
- package/obj/js-component-bindgen-component.component.wasm +0 -0
- package/obj/js-component-bindgen-component.core.wasm +0 -0
- package/obj/js-component-bindgen-component.core2.wasm +0 -0
- package/obj/js-component-bindgen-component.js +105 -115
- package/obj/wasm-tools.component.wasm +0 -0
- package/obj/wasm-tools.core.wasm +0 -0
- package/obj/wasm-tools.core2.wasm +0 -0
- package/obj/wasm-tools.js +117 -120
- package/package.json +3 -3
- package/src/cmd/componentize.js +2 -2
- package/src/jco.js +1 -1
package/README.md
CHANGED
|
@@ -96,7 +96,7 @@ fn();
|
|
|
96
96
|
Imports can be remapped using the `--map` flag, or to provide imports as an argument use the `--instantiation` option.
|
|
97
97
|
|
|
98
98
|
Components relying on WASI bindings will contain external WASI imports, which are automatically updated
|
|
99
|
-
to the `@bytecodealliance/
|
|
99
|
+
to the `@bytecodealliance/preview2-shim` package. This package can be installed from npm separately for
|
|
100
100
|
runtime usage. This shim layer supports both Node.js and browsers.
|
|
101
101
|
|
|
102
102
|
Options include:
|
|
Binary file
|
|
Binary file
|
|
@@ -145,10 +145,6 @@ export interface DirectoryEntry {
|
|
|
145
145
|
import type { Error } from './wasi-io-streams.js';
|
|
146
146
|
export { Error };
|
|
147
147
|
|
|
148
|
-
export class DirectoryEntryStream {
|
|
149
|
-
readDirectoryEntry(): DirectoryEntry | undefined;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
148
|
export class Descriptor {
|
|
153
149
|
readViaStream(offset: Filesize): InputStream;
|
|
154
150
|
writeViaStream(offset: Filesize): OutputStream;
|
|
@@ -161,3 +157,7 @@ export class Descriptor {
|
|
|
161
157
|
metadataHash(): MetadataHashValue;
|
|
162
158
|
metadataHashAt(pathFlags: PathFlags, path: string): MetadataHashValue;
|
|
163
159
|
}
|
|
160
|
+
|
|
161
|
+
export class DirectoryEntryStream {
|
|
162
|
+
readDirectoryEntry(): DirectoryEntry | undefined;
|
|
163
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,7 +14,6 @@ const { getTerminalStdin } = terminalStdin;
|
|
|
14
14
|
const { getTerminalStdout } = terminalStdout;
|
|
15
15
|
const { getDirectories } = preopens;
|
|
16
16
|
const { Descriptor,
|
|
17
|
-
DirectoryEntryStream,
|
|
18
17
|
filesystemErrorCode } = types;
|
|
19
18
|
const { Error: Error$1 } = error;
|
|
20
19
|
const { InputStream,
|
|
@@ -46,6 +45,7 @@ async function fetchCompile (url) {
|
|
|
46
45
|
|
|
47
46
|
function getErrorPayload(e) {
|
|
48
47
|
if (e && hasOwnProperty.call(e, 'payload')) return e.payload;
|
|
48
|
+
if (e instanceof Error) throw e;
|
|
49
49
|
return e;
|
|
50
50
|
}
|
|
51
51
|
|
|
@@ -58,7 +58,7 @@ const instantiateCore = WebAssembly.instantiate;
|
|
|
58
58
|
const T_FLAG = 1 << 30;
|
|
59
59
|
|
|
60
60
|
function rscTableCreateOwn (table, rep) {
|
|
61
|
-
if (rep === 0) throw new
|
|
61
|
+
if (rep === 0) throw new TypeError('Invalid rep');
|
|
62
62
|
const free = table[0] & ~T_FLAG;
|
|
63
63
|
if (free === 0) {
|
|
64
64
|
table.push(0);
|
|
@@ -76,7 +76,7 @@ function rscTableRemove (table, handle) {
|
|
|
76
76
|
const val = table[(handle << 1) + 1];
|
|
77
77
|
const own = (val & T_FLAG) !== 0;
|
|
78
78
|
const rep = val & ~T_FLAG;
|
|
79
|
-
if (val === 0 || (scope & T_FLAG) !== 0) throw new
|
|
79
|
+
if (val === 0 || (scope & T_FLAG) !== 0) throw new TypeError('Invalid handle');
|
|
80
80
|
table[handle << 1] = table[0] | T_FLAG;
|
|
81
81
|
table[0] = handle | T_FLAG;
|
|
82
82
|
return { rep, scope, own };
|
|
@@ -91,7 +91,7 @@ const symbolRscRep = Symbol.for('cabiRep');
|
|
|
91
91
|
const symbolDispose = Symbol.dispose || Symbol.for('dispose');
|
|
92
92
|
|
|
93
93
|
function throwUninitialized() {
|
|
94
|
-
throw new
|
|
94
|
+
throw new TypeError('Wasm uninitialized use `await $init` first');
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
const toUint64 = val => BigInt.asUintN(64, BigInt(val));
|
|
@@ -129,14 +129,17 @@ function utf8Encode(s, realloc, memory) {
|
|
|
129
129
|
|
|
130
130
|
let exports0;
|
|
131
131
|
let exports1;
|
|
132
|
+
const handleTable2 = [T_FLAG, 0];
|
|
133
|
+
const captureTable2= new Map();
|
|
134
|
+
let captureCnt2 = 0;
|
|
135
|
+
handleTables[2] = handleTable2;
|
|
132
136
|
|
|
133
137
|
function trampoline5() {
|
|
134
138
|
const ret = getStderr();
|
|
135
139
|
if (!(ret instanceof OutputStream)) {
|
|
136
|
-
throw new
|
|
140
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
137
141
|
}
|
|
138
142
|
var handle0 = ret[symbolRscHandle];
|
|
139
|
-
|
|
140
143
|
if (!handle0) {
|
|
141
144
|
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
142
145
|
captureTable2.set(rep, ret);
|
|
@@ -168,14 +171,17 @@ function trampoline6(arg0) {
|
|
|
168
171
|
}
|
|
169
172
|
exit(variant0);
|
|
170
173
|
}
|
|
174
|
+
const handleTable1 = [T_FLAG, 0];
|
|
175
|
+
const captureTable1= new Map();
|
|
176
|
+
let captureCnt1 = 0;
|
|
177
|
+
handleTables[1] = handleTable1;
|
|
171
178
|
|
|
172
179
|
function trampoline7() {
|
|
173
180
|
const ret = getStdin();
|
|
174
181
|
if (!(ret instanceof InputStream)) {
|
|
175
|
-
throw new
|
|
182
|
+
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
176
183
|
}
|
|
177
184
|
var handle0 = ret[symbolRscHandle];
|
|
178
|
-
|
|
179
185
|
if (!handle0) {
|
|
180
186
|
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
181
187
|
captureTable1.set(rep, ret);
|
|
@@ -187,10 +193,9 @@ function trampoline7() {
|
|
|
187
193
|
function trampoline8() {
|
|
188
194
|
const ret = getStdout();
|
|
189
195
|
if (!(ret instanceof OutputStream)) {
|
|
190
|
-
throw new
|
|
196
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
191
197
|
}
|
|
192
198
|
var handle0 = ret[symbolRscHandle];
|
|
193
|
-
|
|
194
199
|
if (!handle0) {
|
|
195
200
|
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
196
201
|
captureTable2.set(rep, ret);
|
|
@@ -201,6 +206,10 @@ function trampoline8() {
|
|
|
201
206
|
let exports2;
|
|
202
207
|
let memory0;
|
|
203
208
|
let realloc0;
|
|
209
|
+
const handleTable5 = [T_FLAG, 0];
|
|
210
|
+
const captureTable5= new Map();
|
|
211
|
+
let captureCnt5 = 0;
|
|
212
|
+
handleTables[5] = handleTable5;
|
|
204
213
|
|
|
205
214
|
function trampoline11(arg0) {
|
|
206
215
|
const ret = getDirectories();
|
|
@@ -211,10 +220,9 @@ function trampoline11(arg0) {
|
|
|
211
220
|
const e = vec3[i];
|
|
212
221
|
const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
|
|
213
222
|
if (!(tuple0_0 instanceof Descriptor)) {
|
|
214
|
-
throw new
|
|
223
|
+
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
215
224
|
}
|
|
216
225
|
var handle1 = tuple0_0[symbolRscHandle];
|
|
217
|
-
|
|
218
226
|
if (!handle1) {
|
|
219
227
|
const rep = tuple0_0[symbolRscRep] || ++captureCnt5;
|
|
220
228
|
captureTable5.set(rep, tuple0_0);
|
|
@@ -252,10 +260,9 @@ function trampoline12(arg0, arg1, arg2) {
|
|
|
252
260
|
const e = variant5.val;
|
|
253
261
|
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
254
262
|
if (!(e instanceof InputStream)) {
|
|
255
|
-
throw new
|
|
263
|
+
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
256
264
|
}
|
|
257
265
|
var handle3 = e[symbolRscHandle];
|
|
258
|
-
|
|
259
266
|
if (!handle3) {
|
|
260
267
|
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
261
268
|
captureTable1.set(rep, e);
|
|
@@ -457,10 +464,9 @@ function trampoline13(arg0, arg1, arg2) {
|
|
|
457
464
|
const e = variant5.val;
|
|
458
465
|
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
459
466
|
if (!(e instanceof OutputStream)) {
|
|
460
|
-
throw new
|
|
467
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
461
468
|
}
|
|
462
469
|
var handle3 = e[symbolRscHandle];
|
|
463
|
-
|
|
464
470
|
if (!handle3) {
|
|
465
471
|
const rep = e[symbolRscRep] || ++captureCnt2;
|
|
466
472
|
captureTable2.set(rep, e);
|
|
@@ -662,10 +668,9 @@ function trampoline14(arg0, arg1) {
|
|
|
662
668
|
const e = variant5.val;
|
|
663
669
|
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
664
670
|
if (!(e instanceof OutputStream)) {
|
|
665
|
-
throw new
|
|
671
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
666
672
|
}
|
|
667
673
|
var handle3 = e[symbolRscHandle];
|
|
668
|
-
|
|
669
674
|
if (!handle3) {
|
|
670
675
|
const rep = e[symbolRscRep] || ++captureCnt2;
|
|
671
676
|
captureTable2.set(rep, e);
|
|
@@ -1405,10 +1410,9 @@ function trampoline17(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
|
1405
1410
|
const e = variant9.val;
|
|
1406
1411
|
dataView(memory0).setInt8(arg6 + 0, 0, true);
|
|
1407
1412
|
if (!(e instanceof Descriptor)) {
|
|
1408
|
-
throw new
|
|
1413
|
+
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
1409
1414
|
}
|
|
1410
1415
|
var handle7 = e[symbolRscHandle];
|
|
1411
|
-
|
|
1412
1416
|
if (!handle7) {
|
|
1413
1417
|
const rep = e[symbolRscRep] || ++captureCnt5;
|
|
1414
1418
|
captureTable5.set(rep, e);
|
|
@@ -1784,6 +1788,10 @@ function trampoline18(arg0, arg1) {
|
|
|
1784
1788
|
}
|
|
1785
1789
|
}
|
|
1786
1790
|
}
|
|
1791
|
+
const handleTable0 = [T_FLAG, 0];
|
|
1792
|
+
const captureTable0= new Map();
|
|
1793
|
+
let captureCnt0 = 0;
|
|
1794
|
+
handleTables[0] = handleTable0;
|
|
1787
1795
|
|
|
1788
1796
|
function trampoline19(arg0, arg1) {
|
|
1789
1797
|
var handle1 = arg0;
|
|
@@ -2004,10 +2012,9 @@ function trampoline20(arg0, arg1, arg2) {
|
|
|
2004
2012
|
const e = variant5.val;
|
|
2005
2013
|
dataView(memory0).setInt8(arg2 + 4, 0, true);
|
|
2006
2014
|
if (!(e instanceof Error$1)) {
|
|
2007
|
-
throw new
|
|
2015
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2008
2016
|
}
|
|
2009
2017
|
var handle4 = e[symbolRscHandle];
|
|
2010
|
-
|
|
2011
2018
|
if (!handle4) {
|
|
2012
2019
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2013
2020
|
captureTable0.set(rep, e);
|
|
@@ -2071,10 +2078,9 @@ function trampoline21(arg0, arg1, arg2) {
|
|
|
2071
2078
|
const e = variant5.val;
|
|
2072
2079
|
dataView(memory0).setInt8(arg2 + 4, 0, true);
|
|
2073
2080
|
if (!(e instanceof Error$1)) {
|
|
2074
|
-
throw new
|
|
2081
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2075
2082
|
}
|
|
2076
2083
|
var handle4 = e[symbolRscHandle];
|
|
2077
|
-
|
|
2078
2084
|
if (!handle4) {
|
|
2079
2085
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2080
2086
|
captureTable0.set(rep, e);
|
|
@@ -2132,10 +2138,9 @@ function trampoline22(arg0, arg1) {
|
|
|
2132
2138
|
const e = variant4.val;
|
|
2133
2139
|
dataView(memory0).setInt8(arg1 + 8, 0, true);
|
|
2134
2140
|
if (!(e instanceof Error$1)) {
|
|
2135
|
-
throw new
|
|
2141
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2136
2142
|
}
|
|
2137
2143
|
var handle3 = e[symbolRscHandle];
|
|
2138
|
-
|
|
2139
2144
|
if (!handle3) {
|
|
2140
2145
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2141
2146
|
captureTable0.set(rep, e);
|
|
@@ -2195,10 +2200,9 @@ function trampoline23(arg0, arg1, arg2, arg3) {
|
|
|
2195
2200
|
const e = variant5.val;
|
|
2196
2201
|
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
2197
2202
|
if (!(e instanceof Error$1)) {
|
|
2198
|
-
throw new
|
|
2203
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2199
2204
|
}
|
|
2200
2205
|
var handle4 = e[symbolRscHandle];
|
|
2201
|
-
|
|
2202
2206
|
if (!handle4) {
|
|
2203
2207
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2204
2208
|
captureTable0.set(rep, e);
|
|
@@ -2258,10 +2262,9 @@ function trampoline24(arg0, arg1, arg2, arg3) {
|
|
|
2258
2262
|
const e = variant5.val;
|
|
2259
2263
|
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
2260
2264
|
if (!(e instanceof Error$1)) {
|
|
2261
|
-
throw new
|
|
2265
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2262
2266
|
}
|
|
2263
2267
|
var handle4 = e[symbolRscHandle];
|
|
2264
|
-
|
|
2265
2268
|
if (!handle4) {
|
|
2266
2269
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2267
2270
|
captureTable0.set(rep, e);
|
|
@@ -2318,10 +2321,9 @@ function trampoline25(arg0, arg1) {
|
|
|
2318
2321
|
const e = variant4.val;
|
|
2319
2322
|
dataView(memory0).setInt8(arg1 + 4, 0, true);
|
|
2320
2323
|
if (!(e instanceof Error$1)) {
|
|
2321
|
-
throw new
|
|
2324
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2322
2325
|
}
|
|
2323
2326
|
var handle3 = e[symbolRscHandle];
|
|
2324
|
-
|
|
2325
2327
|
if (!handle3) {
|
|
2326
2328
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2327
2329
|
captureTable0.set(rep, e);
|
|
@@ -2377,6 +2379,10 @@ function trampoline27(arg0) {
|
|
|
2377
2379
|
dataView(memory0).setInt32(arg0 + 4, len3, true);
|
|
2378
2380
|
dataView(memory0).setInt32(arg0 + 0, result3, true);
|
|
2379
2381
|
}
|
|
2382
|
+
const handleTable3 = [T_FLAG, 0];
|
|
2383
|
+
const captureTable3= new Map();
|
|
2384
|
+
let captureCnt3 = 0;
|
|
2385
|
+
handleTables[3] = handleTable3;
|
|
2380
2386
|
|
|
2381
2387
|
function trampoline28(arg0) {
|
|
2382
2388
|
const ret = getTerminalStdin();
|
|
@@ -2387,10 +2393,9 @@ function trampoline28(arg0) {
|
|
|
2387
2393
|
const e = variant1;
|
|
2388
2394
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
2389
2395
|
if (!(e instanceof TerminalInput)) {
|
|
2390
|
-
throw new
|
|
2396
|
+
throw new TypeError('Resource error: Not a valid "TerminalInput" resource.');
|
|
2391
2397
|
}
|
|
2392
2398
|
var handle0 = e[symbolRscHandle];
|
|
2393
|
-
|
|
2394
2399
|
if (!handle0) {
|
|
2395
2400
|
const rep = e[symbolRscRep] || ++captureCnt3;
|
|
2396
2401
|
captureTable3.set(rep, e);
|
|
@@ -2399,6 +2404,10 @@ function trampoline28(arg0) {
|
|
|
2399
2404
|
dataView(memory0).setInt32(arg0 + 4, handle0, true);
|
|
2400
2405
|
}
|
|
2401
2406
|
}
|
|
2407
|
+
const handleTable4 = [T_FLAG, 0];
|
|
2408
|
+
const captureTable4= new Map();
|
|
2409
|
+
let captureCnt4 = 0;
|
|
2410
|
+
handleTables[4] = handleTable4;
|
|
2402
2411
|
|
|
2403
2412
|
function trampoline29(arg0) {
|
|
2404
2413
|
const ret = getTerminalStdout();
|
|
@@ -2409,10 +2418,9 @@ function trampoline29(arg0) {
|
|
|
2409
2418
|
const e = variant1;
|
|
2410
2419
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
2411
2420
|
if (!(e instanceof TerminalOutput)) {
|
|
2412
|
-
throw new
|
|
2421
|
+
throw new TypeError('Resource error: Not a valid "TerminalOutput" resource.');
|
|
2413
2422
|
}
|
|
2414
2423
|
var handle0 = e[symbolRscHandle];
|
|
2415
|
-
|
|
2416
2424
|
if (!handle0) {
|
|
2417
2425
|
const rep = e[symbolRscRep] || ++captureCnt4;
|
|
2418
2426
|
captureTable4.set(rep, e);
|
|
@@ -2431,10 +2439,9 @@ function trampoline30(arg0) {
|
|
|
2431
2439
|
const e = variant1;
|
|
2432
2440
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
2433
2441
|
if (!(e instanceof TerminalOutput)) {
|
|
2434
|
-
throw new
|
|
2442
|
+
throw new TypeError('Resource error: Not a valid "TerminalOutput" resource.');
|
|
2435
2443
|
}
|
|
2436
2444
|
var handle0 = e[symbolRscHandle];
|
|
2437
|
-
|
|
2438
2445
|
if (!handle0) {
|
|
2439
2446
|
const rep = e[symbolRscRep] || ++captureCnt4;
|
|
2440
2447
|
captureTable4.set(rep, e);
|
|
@@ -2453,103 +2460,86 @@ let captureCnt6 = 0;
|
|
|
2453
2460
|
handleTables[6] = handleTable6;
|
|
2454
2461
|
function trampoline0(handle) {
|
|
2455
2462
|
const handleEntry = rscTableRemove(handleTable6, handle);
|
|
2456
|
-
if (
|
|
2457
|
-
|
|
2458
|
-
if (rsc) {
|
|
2459
|
-
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2460
|
-
captureTable6.delete(handleEntry.rep);
|
|
2461
|
-
} else if (DirectoryEntryStream[symbolCabiDispose]) {
|
|
2462
|
-
DirectoryEntryStream[symbolCabiDispose](handleEntry.rep);
|
|
2463
|
+
if (handleEntry.own) {
|
|
2464
|
+
throw new TypeError('unreachable resource trampoline')
|
|
2463
2465
|
}
|
|
2464
2466
|
}
|
|
2465
|
-
const handleTable0 = [T_FLAG, 0];
|
|
2466
|
-
const captureTable0= new Map();
|
|
2467
|
-
let captureCnt0 = 0;
|
|
2468
|
-
handleTables[0] = handleTable0;
|
|
2469
2467
|
function trampoline1(handle) {
|
|
2470
2468
|
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
2471
|
-
if (
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
if (rsc
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
Error$1[symbolCabiDispose]
|
|
2469
|
+
if (handleEntry.own) {
|
|
2470
|
+
|
|
2471
|
+
const rsc = captureTable0.get(handleEntry.rep);
|
|
2472
|
+
if (rsc) {
|
|
2473
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2474
|
+
captureTable0.delete(handleEntry.rep);
|
|
2475
|
+
} else if (Error$1[symbolCabiDispose]) {
|
|
2476
|
+
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
2477
|
+
}
|
|
2478
2478
|
}
|
|
2479
2479
|
}
|
|
2480
|
-
const handleTable1 = [T_FLAG, 0];
|
|
2481
|
-
const captureTable1= new Map();
|
|
2482
|
-
let captureCnt1 = 0;
|
|
2483
|
-
handleTables[1] = handleTable1;
|
|
2484
2480
|
function trampoline2(handle) {
|
|
2485
2481
|
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
2486
|
-
if (
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
if (rsc
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
InputStream[symbolCabiDispose]
|
|
2482
|
+
if (handleEntry.own) {
|
|
2483
|
+
|
|
2484
|
+
const rsc = captureTable1.get(handleEntry.rep);
|
|
2485
|
+
if (rsc) {
|
|
2486
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2487
|
+
captureTable1.delete(handleEntry.rep);
|
|
2488
|
+
} else if (InputStream[symbolCabiDispose]) {
|
|
2489
|
+
InputStream[symbolCabiDispose](handleEntry.rep);
|
|
2490
|
+
}
|
|
2493
2491
|
}
|
|
2494
2492
|
}
|
|
2495
|
-
const handleTable2 = [T_FLAG, 0];
|
|
2496
|
-
const captureTable2= new Map();
|
|
2497
|
-
let captureCnt2 = 0;
|
|
2498
|
-
handleTables[2] = handleTable2;
|
|
2499
2493
|
function trampoline3(handle) {
|
|
2500
2494
|
const handleEntry = rscTableRemove(handleTable2, handle);
|
|
2501
|
-
if (
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
if (rsc
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
OutputStream[symbolCabiDispose]
|
|
2495
|
+
if (handleEntry.own) {
|
|
2496
|
+
|
|
2497
|
+
const rsc = captureTable2.get(handleEntry.rep);
|
|
2498
|
+
if (rsc) {
|
|
2499
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2500
|
+
captureTable2.delete(handleEntry.rep);
|
|
2501
|
+
} else if (OutputStream[symbolCabiDispose]) {
|
|
2502
|
+
OutputStream[symbolCabiDispose](handleEntry.rep);
|
|
2503
|
+
}
|
|
2508
2504
|
}
|
|
2509
2505
|
}
|
|
2510
|
-
const handleTable5 = [T_FLAG, 0];
|
|
2511
|
-
const captureTable5= new Map();
|
|
2512
|
-
let captureCnt5 = 0;
|
|
2513
|
-
handleTables[5] = handleTable5;
|
|
2514
2506
|
function trampoline4(handle) {
|
|
2515
2507
|
const handleEntry = rscTableRemove(handleTable5, handle);
|
|
2516
|
-
if (
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
if (rsc
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
Descriptor[symbolCabiDispose]
|
|
2508
|
+
if (handleEntry.own) {
|
|
2509
|
+
|
|
2510
|
+
const rsc = captureTable5.get(handleEntry.rep);
|
|
2511
|
+
if (rsc) {
|
|
2512
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2513
|
+
captureTable5.delete(handleEntry.rep);
|
|
2514
|
+
} else if (Descriptor[symbolCabiDispose]) {
|
|
2515
|
+
Descriptor[symbolCabiDispose](handleEntry.rep);
|
|
2516
|
+
}
|
|
2523
2517
|
}
|
|
2524
2518
|
}
|
|
2525
|
-
const handleTable4 = [T_FLAG, 0];
|
|
2526
|
-
const captureTable4= new Map();
|
|
2527
|
-
let captureCnt4 = 0;
|
|
2528
|
-
handleTables[4] = handleTable4;
|
|
2529
2519
|
function trampoline9(handle) {
|
|
2530
|
-
const handleEntry = rscTableRemove(
|
|
2531
|
-
if (
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
if (rsc
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2520
|
+
const handleEntry = rscTableRemove(handleTable3, handle);
|
|
2521
|
+
if (handleEntry.own) {
|
|
2522
|
+
|
|
2523
|
+
const rsc = captureTable3.get(handleEntry.rep);
|
|
2524
|
+
if (rsc) {
|
|
2525
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2526
|
+
captureTable3.delete(handleEntry.rep);
|
|
2527
|
+
} else if (TerminalInput[symbolCabiDispose]) {
|
|
2528
|
+
TerminalInput[symbolCabiDispose](handleEntry.rep);
|
|
2529
|
+
}
|
|
2538
2530
|
}
|
|
2539
2531
|
}
|
|
2540
|
-
const handleTable3 = [T_FLAG, 0];
|
|
2541
|
-
const captureTable3= new Map();
|
|
2542
|
-
let captureCnt3 = 0;
|
|
2543
|
-
handleTables[3] = handleTable3;
|
|
2544
2532
|
function trampoline10(handle) {
|
|
2545
|
-
const handleEntry = rscTableRemove(
|
|
2546
|
-
if (
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
if (rsc
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2533
|
+
const handleEntry = rscTableRemove(handleTable4, handle);
|
|
2534
|
+
if (handleEntry.own) {
|
|
2535
|
+
|
|
2536
|
+
const rsc = captureTable4.get(handleEntry.rep);
|
|
2537
|
+
if (rsc) {
|
|
2538
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
2539
|
+
captureTable4.delete(handleEntry.rep);
|
|
2540
|
+
} else if (TerminalOutput[symbolCabiDispose]) {
|
|
2541
|
+
TerminalOutput[symbolCabiDispose](handleEntry.rep);
|
|
2542
|
+
}
|
|
2553
2543
|
}
|
|
2554
2544
|
}
|
|
2555
2545
|
|
|
@@ -3011,10 +3001,10 @@ export const $init = (async() => {
|
|
|
3011
3001
|
'get-stdout': trampoline8,
|
|
3012
3002
|
},
|
|
3013
3003
|
'wasi:cli/terminal-input@0.2.0': {
|
|
3014
|
-
'[resource-drop]terminal-input':
|
|
3004
|
+
'[resource-drop]terminal-input': trampoline9,
|
|
3015
3005
|
},
|
|
3016
3006
|
'wasi:cli/terminal-output@0.2.0': {
|
|
3017
|
-
'[resource-drop]terminal-output':
|
|
3007
|
+
'[resource-drop]terminal-output': trampoline10,
|
|
3018
3008
|
},
|
|
3019
3009
|
'wasi:cli/terminal-stderr@0.2.0': {
|
|
3020
3010
|
'get-terminal-stderr': exports0['19'],
|
|
Binary file
|
package/obj/wasm-tools.core.wasm
CHANGED
|
Binary file
|
|
Binary file
|
package/obj/wasm-tools.js
CHANGED
|
@@ -46,6 +46,7 @@ async function fetchCompile (url) {
|
|
|
46
46
|
|
|
47
47
|
function getErrorPayload(e) {
|
|
48
48
|
if (e && hasOwnProperty.call(e, 'payload')) return e.payload;
|
|
49
|
+
if (e instanceof Error) throw e;
|
|
49
50
|
return e;
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -58,7 +59,7 @@ const instantiateCore = WebAssembly.instantiate;
|
|
|
58
59
|
const T_FLAG = 1 << 30;
|
|
59
60
|
|
|
60
61
|
function rscTableCreateOwn (table, rep) {
|
|
61
|
-
if (rep === 0) throw new
|
|
62
|
+
if (rep === 0) throw new TypeError('Invalid rep');
|
|
62
63
|
const free = table[0] & ~T_FLAG;
|
|
63
64
|
if (free === 0) {
|
|
64
65
|
table.push(0);
|
|
@@ -76,7 +77,7 @@ function rscTableRemove (table, handle) {
|
|
|
76
77
|
const val = table[(handle << 1) + 1];
|
|
77
78
|
const own = (val & T_FLAG) !== 0;
|
|
78
79
|
const rep = val & ~T_FLAG;
|
|
79
|
-
if (val === 0 || (scope & T_FLAG) !== 0) throw new
|
|
80
|
+
if (val === 0 || (scope & T_FLAG) !== 0) throw new TypeError('Invalid handle');
|
|
80
81
|
table[handle << 1] = table[0] | T_FLAG;
|
|
81
82
|
table[0] = handle | T_FLAG;
|
|
82
83
|
return { rep, scope, own };
|
|
@@ -91,7 +92,7 @@ const symbolRscRep = Symbol.for('cabiRep');
|
|
|
91
92
|
const symbolDispose = Symbol.dispose || Symbol.for('dispose');
|
|
92
93
|
|
|
93
94
|
function throwUninitialized() {
|
|
94
|
-
throw new
|
|
95
|
+
throw new TypeError('Wasm uninitialized use `await $init` first');
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
const toUint64 = val => BigInt.asUintN(64, BigInt(val));
|
|
@@ -129,14 +130,17 @@ function utf8Encode(s, realloc, memory) {
|
|
|
129
130
|
|
|
130
131
|
let exports0;
|
|
131
132
|
let exports1;
|
|
133
|
+
const handleTable2 = [T_FLAG, 0];
|
|
134
|
+
const captureTable2= new Map();
|
|
135
|
+
let captureCnt2 = 0;
|
|
136
|
+
handleTables[2] = handleTable2;
|
|
132
137
|
|
|
133
138
|
function trampoline5() {
|
|
134
139
|
const ret = getStderr();
|
|
135
140
|
if (!(ret instanceof OutputStream)) {
|
|
136
|
-
throw new
|
|
141
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
137
142
|
}
|
|
138
143
|
var handle0 = ret[symbolRscHandle];
|
|
139
|
-
|
|
140
144
|
if (!handle0) {
|
|
141
145
|
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
142
146
|
captureTable2.set(rep, ret);
|
|
@@ -168,14 +172,17 @@ function trampoline6(arg0) {
|
|
|
168
172
|
}
|
|
169
173
|
exit(variant0);
|
|
170
174
|
}
|
|
175
|
+
const handleTable1 = [T_FLAG, 0];
|
|
176
|
+
const captureTable1= new Map();
|
|
177
|
+
let captureCnt1 = 0;
|
|
178
|
+
handleTables[1] = handleTable1;
|
|
171
179
|
|
|
172
180
|
function trampoline7() {
|
|
173
181
|
const ret = getStdin();
|
|
174
182
|
if (!(ret instanceof InputStream)) {
|
|
175
|
-
throw new
|
|
183
|
+
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
176
184
|
}
|
|
177
185
|
var handle0 = ret[symbolRscHandle];
|
|
178
|
-
|
|
179
186
|
if (!handle0) {
|
|
180
187
|
const rep = ret[symbolRscRep] || ++captureCnt1;
|
|
181
188
|
captureTable1.set(rep, ret);
|
|
@@ -187,10 +194,9 @@ function trampoline7() {
|
|
|
187
194
|
function trampoline8() {
|
|
188
195
|
const ret = getStdout();
|
|
189
196
|
if (!(ret instanceof OutputStream)) {
|
|
190
|
-
throw new
|
|
197
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
191
198
|
}
|
|
192
199
|
var handle0 = ret[symbolRscHandle];
|
|
193
|
-
|
|
194
200
|
if (!handle0) {
|
|
195
201
|
const rep = ret[symbolRscRep] || ++captureCnt2;
|
|
196
202
|
captureTable2.set(rep, ret);
|
|
@@ -201,6 +207,10 @@ function trampoline8() {
|
|
|
201
207
|
let exports2;
|
|
202
208
|
let memory0;
|
|
203
209
|
let realloc0;
|
|
210
|
+
const handleTable5 = [T_FLAG, 0];
|
|
211
|
+
const captureTable5= new Map();
|
|
212
|
+
let captureCnt5 = 0;
|
|
213
|
+
handleTables[5] = handleTable5;
|
|
204
214
|
|
|
205
215
|
function trampoline11(arg0) {
|
|
206
216
|
const ret = getDirectories();
|
|
@@ -211,10 +221,9 @@ function trampoline11(arg0) {
|
|
|
211
221
|
const e = vec3[i];
|
|
212
222
|
const base = result3 + i * 12;var [tuple0_0, tuple0_1] = e;
|
|
213
223
|
if (!(tuple0_0 instanceof Descriptor)) {
|
|
214
|
-
throw new
|
|
224
|
+
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
215
225
|
}
|
|
216
226
|
var handle1 = tuple0_0[symbolRscHandle];
|
|
217
|
-
|
|
218
227
|
if (!handle1) {
|
|
219
228
|
const rep = tuple0_0[symbolRscRep] || ++captureCnt5;
|
|
220
229
|
captureTable5.set(rep, tuple0_0);
|
|
@@ -252,10 +261,9 @@ function trampoline12(arg0, arg1, arg2) {
|
|
|
252
261
|
const e = variant5.val;
|
|
253
262
|
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
254
263
|
if (!(e instanceof InputStream)) {
|
|
255
|
-
throw new
|
|
264
|
+
throw new TypeError('Resource error: Not a valid "InputStream" resource.');
|
|
256
265
|
}
|
|
257
266
|
var handle3 = e[symbolRscHandle];
|
|
258
|
-
|
|
259
267
|
if (!handle3) {
|
|
260
268
|
const rep = e[symbolRscRep] || ++captureCnt1;
|
|
261
269
|
captureTable1.set(rep, e);
|
|
@@ -457,10 +465,9 @@ function trampoline13(arg0, arg1, arg2) {
|
|
|
457
465
|
const e = variant5.val;
|
|
458
466
|
dataView(memory0).setInt8(arg2 + 0, 0, true);
|
|
459
467
|
if (!(e instanceof OutputStream)) {
|
|
460
|
-
throw new
|
|
468
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
461
469
|
}
|
|
462
470
|
var handle3 = e[symbolRscHandle];
|
|
463
|
-
|
|
464
471
|
if (!handle3) {
|
|
465
472
|
const rep = e[symbolRscRep] || ++captureCnt2;
|
|
466
473
|
captureTable2.set(rep, e);
|
|
@@ -662,10 +669,9 @@ function trampoline14(arg0, arg1) {
|
|
|
662
669
|
const e = variant5.val;
|
|
663
670
|
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
664
671
|
if (!(e instanceof OutputStream)) {
|
|
665
|
-
throw new
|
|
672
|
+
throw new TypeError('Resource error: Not a valid "OutputStream" resource.');
|
|
666
673
|
}
|
|
667
674
|
var handle3 = e[symbolRscHandle];
|
|
668
|
-
|
|
669
675
|
if (!handle3) {
|
|
670
676
|
const rep = e[symbolRscRep] || ++captureCnt2;
|
|
671
677
|
captureTable2.set(rep, e);
|
|
@@ -1082,6 +1088,10 @@ function trampoline15(arg0, arg1) {
|
|
|
1082
1088
|
}
|
|
1083
1089
|
}
|
|
1084
1090
|
}
|
|
1091
|
+
const handleTable6 = [T_FLAG, 0];
|
|
1092
|
+
const captureTable6= new Map();
|
|
1093
|
+
let captureCnt6 = 0;
|
|
1094
|
+
handleTables[6] = handleTable6;
|
|
1085
1095
|
|
|
1086
1096
|
function trampoline16(arg0, arg1) {
|
|
1087
1097
|
var handle1 = arg0;
|
|
@@ -1105,10 +1115,9 @@ function trampoline16(arg0, arg1) {
|
|
|
1105
1115
|
const e = variant5.val;
|
|
1106
1116
|
dataView(memory0).setInt8(arg1 + 0, 0, true);
|
|
1107
1117
|
if (!(e instanceof DirectoryEntryStream)) {
|
|
1108
|
-
throw new
|
|
1118
|
+
throw new TypeError('Resource error: Not a valid "DirectoryEntryStream" resource.');
|
|
1109
1119
|
}
|
|
1110
1120
|
var handle3 = e[symbolRscHandle];
|
|
1111
|
-
|
|
1112
1121
|
if (!handle3) {
|
|
1113
1122
|
const rep = e[symbolRscRep] || ++captureCnt6;
|
|
1114
1123
|
captureTable6.set(rep, e);
|
|
@@ -1890,10 +1899,9 @@ function trampoline19(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
|
|
|
1890
1899
|
const e = variant9.val;
|
|
1891
1900
|
dataView(memory0).setInt8(arg6 + 0, 0, true);
|
|
1892
1901
|
if (!(e instanceof Descriptor)) {
|
|
1893
|
-
throw new
|
|
1902
|
+
throw new TypeError('Resource error: Not a valid "Descriptor" resource.');
|
|
1894
1903
|
}
|
|
1895
1904
|
var handle7 = e[symbolRscHandle];
|
|
1896
|
-
|
|
1897
1905
|
if (!handle7) {
|
|
1898
1906
|
const rep = e[symbolRscRep] || ++captureCnt5;
|
|
1899
1907
|
captureTable5.set(rep, e);
|
|
@@ -2725,6 +2733,10 @@ function trampoline22(arg0, arg1) {
|
|
|
2725
2733
|
}
|
|
2726
2734
|
}
|
|
2727
2735
|
}
|
|
2736
|
+
const handleTable0 = [T_FLAG, 0];
|
|
2737
|
+
const captureTable0= new Map();
|
|
2738
|
+
let captureCnt0 = 0;
|
|
2739
|
+
handleTables[0] = handleTable0;
|
|
2728
2740
|
|
|
2729
2741
|
function trampoline23(arg0, arg1) {
|
|
2730
2742
|
var handle1 = arg0;
|
|
@@ -2945,10 +2957,9 @@ function trampoline24(arg0, arg1, arg2) {
|
|
|
2945
2957
|
const e = variant5.val;
|
|
2946
2958
|
dataView(memory0).setInt8(arg2 + 4, 0, true);
|
|
2947
2959
|
if (!(e instanceof Error$1)) {
|
|
2948
|
-
throw new
|
|
2960
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
2949
2961
|
}
|
|
2950
2962
|
var handle4 = e[symbolRscHandle];
|
|
2951
|
-
|
|
2952
2963
|
if (!handle4) {
|
|
2953
2964
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
2954
2965
|
captureTable0.set(rep, e);
|
|
@@ -3012,10 +3023,9 @@ function trampoline25(arg0, arg1, arg2) {
|
|
|
3012
3023
|
const e = variant5.val;
|
|
3013
3024
|
dataView(memory0).setInt8(arg2 + 4, 0, true);
|
|
3014
3025
|
if (!(e instanceof Error$1)) {
|
|
3015
|
-
throw new
|
|
3026
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
3016
3027
|
}
|
|
3017
3028
|
var handle4 = e[symbolRscHandle];
|
|
3018
|
-
|
|
3019
3029
|
if (!handle4) {
|
|
3020
3030
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
3021
3031
|
captureTable0.set(rep, e);
|
|
@@ -3073,10 +3083,9 @@ function trampoline26(arg0, arg1) {
|
|
|
3073
3083
|
const e = variant4.val;
|
|
3074
3084
|
dataView(memory0).setInt8(arg1 + 8, 0, true);
|
|
3075
3085
|
if (!(e instanceof Error$1)) {
|
|
3076
|
-
throw new
|
|
3086
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
3077
3087
|
}
|
|
3078
3088
|
var handle3 = e[symbolRscHandle];
|
|
3079
|
-
|
|
3080
3089
|
if (!handle3) {
|
|
3081
3090
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
3082
3091
|
captureTable0.set(rep, e);
|
|
@@ -3136,10 +3145,9 @@ function trampoline27(arg0, arg1, arg2, arg3) {
|
|
|
3136
3145
|
const e = variant5.val;
|
|
3137
3146
|
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
3138
3147
|
if (!(e instanceof Error$1)) {
|
|
3139
|
-
throw new
|
|
3148
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
3140
3149
|
}
|
|
3141
3150
|
var handle4 = e[symbolRscHandle];
|
|
3142
|
-
|
|
3143
3151
|
if (!handle4) {
|
|
3144
3152
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
3145
3153
|
captureTable0.set(rep, e);
|
|
@@ -3199,10 +3207,9 @@ function trampoline28(arg0, arg1, arg2, arg3) {
|
|
|
3199
3207
|
const e = variant5.val;
|
|
3200
3208
|
dataView(memory0).setInt8(arg3 + 4, 0, true);
|
|
3201
3209
|
if (!(e instanceof Error$1)) {
|
|
3202
|
-
throw new
|
|
3210
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
3203
3211
|
}
|
|
3204
3212
|
var handle4 = e[symbolRscHandle];
|
|
3205
|
-
|
|
3206
3213
|
if (!handle4) {
|
|
3207
3214
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
3208
3215
|
captureTable0.set(rep, e);
|
|
@@ -3259,10 +3266,9 @@ function trampoline29(arg0, arg1) {
|
|
|
3259
3266
|
const e = variant4.val;
|
|
3260
3267
|
dataView(memory0).setInt8(arg1 + 4, 0, true);
|
|
3261
3268
|
if (!(e instanceof Error$1)) {
|
|
3262
|
-
throw new
|
|
3269
|
+
throw new TypeError('Resource error: Not a valid "Error" resource.');
|
|
3263
3270
|
}
|
|
3264
3271
|
var handle3 = e[symbolRscHandle];
|
|
3265
|
-
|
|
3266
3272
|
if (!handle3) {
|
|
3267
3273
|
const rep = e[symbolRscRep] || ++captureCnt0;
|
|
3268
3274
|
captureTable0.set(rep, e);
|
|
@@ -3318,6 +3324,10 @@ function trampoline31(arg0) {
|
|
|
3318
3324
|
dataView(memory0).setInt32(arg0 + 4, len3, true);
|
|
3319
3325
|
dataView(memory0).setInt32(arg0 + 0, result3, true);
|
|
3320
3326
|
}
|
|
3327
|
+
const handleTable3 = [T_FLAG, 0];
|
|
3328
|
+
const captureTable3= new Map();
|
|
3329
|
+
let captureCnt3 = 0;
|
|
3330
|
+
handleTables[3] = handleTable3;
|
|
3321
3331
|
|
|
3322
3332
|
function trampoline32(arg0) {
|
|
3323
3333
|
const ret = getTerminalStdin();
|
|
@@ -3328,10 +3338,9 @@ function trampoline32(arg0) {
|
|
|
3328
3338
|
const e = variant1;
|
|
3329
3339
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
3330
3340
|
if (!(e instanceof TerminalInput)) {
|
|
3331
|
-
throw new
|
|
3341
|
+
throw new TypeError('Resource error: Not a valid "TerminalInput" resource.');
|
|
3332
3342
|
}
|
|
3333
3343
|
var handle0 = e[symbolRscHandle];
|
|
3334
|
-
|
|
3335
3344
|
if (!handle0) {
|
|
3336
3345
|
const rep = e[symbolRscRep] || ++captureCnt3;
|
|
3337
3346
|
captureTable3.set(rep, e);
|
|
@@ -3340,6 +3349,10 @@ function trampoline32(arg0) {
|
|
|
3340
3349
|
dataView(memory0).setInt32(arg0 + 4, handle0, true);
|
|
3341
3350
|
}
|
|
3342
3351
|
}
|
|
3352
|
+
const handleTable4 = [T_FLAG, 0];
|
|
3353
|
+
const captureTable4= new Map();
|
|
3354
|
+
let captureCnt4 = 0;
|
|
3355
|
+
handleTables[4] = handleTable4;
|
|
3343
3356
|
|
|
3344
3357
|
function trampoline33(arg0) {
|
|
3345
3358
|
const ret = getTerminalStdout();
|
|
@@ -3350,10 +3363,9 @@ function trampoline33(arg0) {
|
|
|
3350
3363
|
const e = variant1;
|
|
3351
3364
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
3352
3365
|
if (!(e instanceof TerminalOutput)) {
|
|
3353
|
-
throw new
|
|
3366
|
+
throw new TypeError('Resource error: Not a valid "TerminalOutput" resource.');
|
|
3354
3367
|
}
|
|
3355
3368
|
var handle0 = e[symbolRscHandle];
|
|
3356
|
-
|
|
3357
3369
|
if (!handle0) {
|
|
3358
3370
|
const rep = e[symbolRscRep] || ++captureCnt4;
|
|
3359
3371
|
captureTable4.set(rep, e);
|
|
@@ -3372,10 +3384,9 @@ function trampoline34(arg0) {
|
|
|
3372
3384
|
const e = variant1;
|
|
3373
3385
|
dataView(memory0).setInt8(arg0 + 0, 1, true);
|
|
3374
3386
|
if (!(e instanceof TerminalOutput)) {
|
|
3375
|
-
throw new
|
|
3387
|
+
throw new TypeError('Resource error: Not a valid "TerminalOutput" resource.');
|
|
3376
3388
|
}
|
|
3377
3389
|
var handle0 = e[symbolRscHandle];
|
|
3378
|
-
|
|
3379
3390
|
if (!handle0) {
|
|
3380
3391
|
const rep = e[symbolRscRep] || ++captureCnt4;
|
|
3381
3392
|
captureTable4.set(rep, e);
|
|
@@ -3393,109 +3404,95 @@ let postReturn3;
|
|
|
3393
3404
|
let postReturn4;
|
|
3394
3405
|
let postReturn5;
|
|
3395
3406
|
let postReturn6;
|
|
3396
|
-
const handleTable6 = [T_FLAG, 0];
|
|
3397
|
-
const captureTable6= new Map();
|
|
3398
|
-
let captureCnt6 = 0;
|
|
3399
|
-
handleTables[6] = handleTable6;
|
|
3400
3407
|
function trampoline0(handle) {
|
|
3401
3408
|
const handleEntry = rscTableRemove(handleTable6, handle);
|
|
3402
|
-
if (
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
if (rsc
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
DirectoryEntryStream[symbolCabiDispose]
|
|
3409
|
+
if (handleEntry.own) {
|
|
3410
|
+
|
|
3411
|
+
const rsc = captureTable6.get(handleEntry.rep);
|
|
3412
|
+
if (rsc) {
|
|
3413
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3414
|
+
captureTable6.delete(handleEntry.rep);
|
|
3415
|
+
} else if (DirectoryEntryStream[symbolCabiDispose]) {
|
|
3416
|
+
DirectoryEntryStream[symbolCabiDispose](handleEntry.rep);
|
|
3417
|
+
}
|
|
3409
3418
|
}
|
|
3410
3419
|
}
|
|
3411
|
-
const handleTable0 = [T_FLAG, 0];
|
|
3412
|
-
const captureTable0= new Map();
|
|
3413
|
-
let captureCnt0 = 0;
|
|
3414
|
-
handleTables[0] = handleTable0;
|
|
3415
3420
|
function trampoline1(handle) {
|
|
3416
3421
|
const handleEntry = rscTableRemove(handleTable0, handle);
|
|
3417
|
-
if (
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
if (rsc
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
Error$1[symbolCabiDispose]
|
|
3422
|
+
if (handleEntry.own) {
|
|
3423
|
+
|
|
3424
|
+
const rsc = captureTable0.get(handleEntry.rep);
|
|
3425
|
+
if (rsc) {
|
|
3426
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3427
|
+
captureTable0.delete(handleEntry.rep);
|
|
3428
|
+
} else if (Error$1[symbolCabiDispose]) {
|
|
3429
|
+
Error$1[symbolCabiDispose](handleEntry.rep);
|
|
3430
|
+
}
|
|
3424
3431
|
}
|
|
3425
3432
|
}
|
|
3426
|
-
const handleTable1 = [T_FLAG, 0];
|
|
3427
|
-
const captureTable1= new Map();
|
|
3428
|
-
let captureCnt1 = 0;
|
|
3429
|
-
handleTables[1] = handleTable1;
|
|
3430
3433
|
function trampoline2(handle) {
|
|
3431
3434
|
const handleEntry = rscTableRemove(handleTable1, handle);
|
|
3432
|
-
if (
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
if (rsc
|
|
3436
|
-
|
|
3437
|
-
|
|
3438
|
-
InputStream[symbolCabiDispose]
|
|
3435
|
+
if (handleEntry.own) {
|
|
3436
|
+
|
|
3437
|
+
const rsc = captureTable1.get(handleEntry.rep);
|
|
3438
|
+
if (rsc) {
|
|
3439
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3440
|
+
captureTable1.delete(handleEntry.rep);
|
|
3441
|
+
} else if (InputStream[symbolCabiDispose]) {
|
|
3442
|
+
InputStream[symbolCabiDispose](handleEntry.rep);
|
|
3443
|
+
}
|
|
3439
3444
|
}
|
|
3440
3445
|
}
|
|
3441
|
-
const handleTable2 = [T_FLAG, 0];
|
|
3442
|
-
const captureTable2= new Map();
|
|
3443
|
-
let captureCnt2 = 0;
|
|
3444
|
-
handleTables[2] = handleTable2;
|
|
3445
3446
|
function trampoline3(handle) {
|
|
3446
3447
|
const handleEntry = rscTableRemove(handleTable2, handle);
|
|
3447
|
-
if (
|
|
3448
|
-
|
|
3449
|
-
|
|
3450
|
-
if (rsc
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
OutputStream[symbolCabiDispose]
|
|
3448
|
+
if (handleEntry.own) {
|
|
3449
|
+
|
|
3450
|
+
const rsc = captureTable2.get(handleEntry.rep);
|
|
3451
|
+
if (rsc) {
|
|
3452
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3453
|
+
captureTable2.delete(handleEntry.rep);
|
|
3454
|
+
} else if (OutputStream[symbolCabiDispose]) {
|
|
3455
|
+
OutputStream[symbolCabiDispose](handleEntry.rep);
|
|
3456
|
+
}
|
|
3454
3457
|
}
|
|
3455
3458
|
}
|
|
3456
|
-
const handleTable5 = [T_FLAG, 0];
|
|
3457
|
-
const captureTable5= new Map();
|
|
3458
|
-
let captureCnt5 = 0;
|
|
3459
|
-
handleTables[5] = handleTable5;
|
|
3460
3459
|
function trampoline4(handle) {
|
|
3461
3460
|
const handleEntry = rscTableRemove(handleTable5, handle);
|
|
3462
|
-
if (
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
if (rsc
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
Descriptor[symbolCabiDispose]
|
|
3461
|
+
if (handleEntry.own) {
|
|
3462
|
+
|
|
3463
|
+
const rsc = captureTable5.get(handleEntry.rep);
|
|
3464
|
+
if (rsc) {
|
|
3465
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3466
|
+
captureTable5.delete(handleEntry.rep);
|
|
3467
|
+
} else if (Descriptor[symbolCabiDispose]) {
|
|
3468
|
+
Descriptor[symbolCabiDispose](handleEntry.rep);
|
|
3469
|
+
}
|
|
3469
3470
|
}
|
|
3470
3471
|
}
|
|
3471
|
-
const handleTable4 = [T_FLAG, 0];
|
|
3472
|
-
const captureTable4= new Map();
|
|
3473
|
-
let captureCnt4 = 0;
|
|
3474
|
-
handleTables[4] = handleTable4;
|
|
3475
3472
|
function trampoline9(handle) {
|
|
3476
|
-
const handleEntry = rscTableRemove(
|
|
3477
|
-
if (
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
if (rsc
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3473
|
+
const handleEntry = rscTableRemove(handleTable3, handle);
|
|
3474
|
+
if (handleEntry.own) {
|
|
3475
|
+
|
|
3476
|
+
const rsc = captureTable3.get(handleEntry.rep);
|
|
3477
|
+
if (rsc) {
|
|
3478
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3479
|
+
captureTable3.delete(handleEntry.rep);
|
|
3480
|
+
} else if (TerminalInput[symbolCabiDispose]) {
|
|
3481
|
+
TerminalInput[symbolCabiDispose](handleEntry.rep);
|
|
3482
|
+
}
|
|
3484
3483
|
}
|
|
3485
3484
|
}
|
|
3486
|
-
const handleTable3 = [T_FLAG, 0];
|
|
3487
|
-
const captureTable3= new Map();
|
|
3488
|
-
let captureCnt3 = 0;
|
|
3489
|
-
handleTables[3] = handleTable3;
|
|
3490
3485
|
function trampoline10(handle) {
|
|
3491
|
-
const handleEntry = rscTableRemove(
|
|
3492
|
-
if (
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
if (rsc
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3486
|
+
const handleEntry = rscTableRemove(handleTable4, handle);
|
|
3487
|
+
if (handleEntry.own) {
|
|
3488
|
+
|
|
3489
|
+
const rsc = captureTable4.get(handleEntry.rep);
|
|
3490
|
+
if (rsc) {
|
|
3491
|
+
if (rsc[symbolDispose]) rsc[symbolDispose]();
|
|
3492
|
+
captureTable4.delete(handleEntry.rep);
|
|
3493
|
+
} else if (TerminalOutput[symbolCabiDispose]) {
|
|
3494
|
+
TerminalOutput[symbolCabiDispose](handleEntry.rep);
|
|
3495
|
+
}
|
|
3499
3496
|
}
|
|
3500
3497
|
}
|
|
3501
3498
|
|
|
@@ -4078,10 +4075,10 @@ export const $init = (async() => {
|
|
|
4078
4075
|
'get-stdout': trampoline8,
|
|
4079
4076
|
},
|
|
4080
4077
|
'wasi:cli/terminal-input@0.2.0': {
|
|
4081
|
-
'[resource-drop]terminal-input':
|
|
4078
|
+
'[resource-drop]terminal-input': trampoline9,
|
|
4082
4079
|
},
|
|
4083
4080
|
'wasi:cli/terminal-output@0.2.0': {
|
|
4084
|
-
'[resource-drop]terminal-output':
|
|
4081
|
+
'[resource-drop]terminal-output': trampoline10,
|
|
4085
4082
|
},
|
|
4086
4083
|
'wasi:cli/terminal-stderr@0.2.0': {
|
|
4087
4084
|
'get-terminal-stderr': exports0['23'],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytecodealliance/jco",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "JavaScript tooling for working with WebAssembly Components",
|
|
5
5
|
"author": "Guy Bedford",
|
|
6
6
|
"bin": {
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"terser": "^5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@bytecodealliance/componentize-js": "^0.
|
|
30
|
+
"@bytecodealliance/componentize-js": "^0.8.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 lib/**/*.js packages/*/lib/**/*.js",
|
|
58
58
|
"test:lts": "mocha -u tdd test/test.js --timeout 30000",
|
|
59
|
-
"test": "node --experimental-wasm-multi-memory node_modules/mocha/bin/mocha.js -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",
|
|
60
60
|
"prepublishOnly": "cargo xtask build release && npm run test"
|
|
61
61
|
},
|
|
62
62
|
"files": [
|
package/src/cmd/componentize.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { resolve } from 'node:path';
|
|
2
|
+
import { resolve, basename } from 'node:path';
|
|
3
3
|
import c from 'chalk-template';
|
|
4
4
|
|
|
5
5
|
export async function componentize (jsSource, opts) {
|
|
@@ -13,7 +13,7 @@ export async function componentize (jsSource, opts) {
|
|
|
13
13
|
}
|
|
14
14
|
const source = await readFile(jsSource, 'utf8');
|
|
15
15
|
const { component, imports } = await componentizeFn(source, {
|
|
16
|
-
sourceName: jsSource,
|
|
16
|
+
sourceName: basename(jsSource),
|
|
17
17
|
witPath: resolve(opts.wit),
|
|
18
18
|
worldName: opts.worldName,
|
|
19
19
|
enableStdout: opts.enableStdout,
|
package/src/jco.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
.name('jco')
|
|
12
12
|
.description(c`{bold jco - WebAssembly JS Component Tools}\n JS Component Transpilation Bindgen & Wasm Tools for JS`)
|
|
13
13
|
.usage('<command> [options]')
|
|
14
|
-
.version('1.0
|
|
14
|
+
.version('1.1.0');
|
|
15
15
|
|
|
16
16
|
function myParseInt(value) {
|
|
17
17
|
return parseInt(value, 10);
|