@lightvm/core-browser-wasm 0.1.0-alpha.7 → 0.1.0-alpha.8
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 +5 -5
- package/index.js +833 -0
- package/index.wasm +0 -0
- package/lightvm.d.ts +76 -0
- package/lightvm_bg.wasm.d.ts +24 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -206,7 +206,7 @@ LightVM uses a strict capability-based security model. You must explicitly grant
|
|
|
206
206
|
</details>
|
|
207
207
|
|
|
208
208
|
> [!NOTE]
|
|
209
|
-
> __Capability Required__: no
|
|
209
|
+
> __Capability Required__: no specific capability
|
|
210
210
|
|
|
211
211
|
3. ``inspect()`` method:
|
|
212
212
|
Function to view state, number of instructions, and capability.
|
|
@@ -282,7 +282,7 @@ LightVM uses a strict capability-based security model. You must explicitly grant
|
|
|
282
282
|
</details>
|
|
283
283
|
|
|
284
284
|
> [!NOTE]
|
|
285
|
-
> __Capability Required__: no
|
|
285
|
+
> __Capability Required__: no specific capability
|
|
286
286
|
> __Event__: tick, halt, and panic
|
|
287
287
|
|
|
288
288
|
6. ``export()`` method:
|
|
@@ -303,8 +303,8 @@ LightVM uses a strict capability-based security model. You must explicitly grant
|
|
|
303
303
|
```rust
|
|
304
304
|
let mut add = vm.export("add".to_string());
|
|
305
305
|
let args = vec![serde_json::json!(5), serde_json::json!(6)];
|
|
306
|
-
if let Some(
|
|
307
|
-
println!("
|
|
306
|
+
if let Some(result) = add_func(args) {
|
|
307
|
+
println!("Result from VM: {}", result);
|
|
308
308
|
}
|
|
309
309
|
```
|
|
310
310
|
</details>
|
|
@@ -407,7 +407,7 @@ LightVM uses a strict capability-based security model. You must explicitly grant
|
|
|
407
407
|
</ol>
|
|
408
408
|
|
|
409
409
|
> [!NOTE]
|
|
410
|
-
> __Capability Required__: no
|
|
410
|
+
> __Capability Required__: no specific capability
|
|
411
411
|
|
|
412
412
|
## References
|
|
413
413
|
### Supported Primitive Types
|
package/index.js
ADDED
|
@@ -0,0 +1,833 @@
|
|
|
1
|
+
/* @ts-self-types="./lightvm.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class LightVM {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
LightVMFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_lightvm_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} name
|
|
16
|
+
* @param {any} args
|
|
17
|
+
* @returns {any}
|
|
18
|
+
*/
|
|
19
|
+
callExport(name, args) {
|
|
20
|
+
try {
|
|
21
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
22
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
23
|
+
const len0 = WASM_VECTOR_LEN;
|
|
24
|
+
wasm.lightvm_callExport(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(args));
|
|
25
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
26
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
27
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
28
|
+
if (r2) {
|
|
29
|
+
throw takeObject(r1);
|
|
30
|
+
}
|
|
31
|
+
return takeObject(r0);
|
|
32
|
+
} finally {
|
|
33
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @returns {any}
|
|
38
|
+
*/
|
|
39
|
+
embedded() {
|
|
40
|
+
try {
|
|
41
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
42
|
+
wasm.lightvm_embedded(retptr, this.__wbg_ptr);
|
|
43
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
44
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
45
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
46
|
+
if (r2) {
|
|
47
|
+
throw takeObject(r1);
|
|
48
|
+
}
|
|
49
|
+
return takeObject(r0);
|
|
50
|
+
} finally {
|
|
51
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
halt() {
|
|
55
|
+
try {
|
|
56
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
57
|
+
wasm.lightvm_halt(retptr, this.__wbg_ptr);
|
|
58
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
59
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
60
|
+
if (r1) {
|
|
61
|
+
throw takeObject(r0);
|
|
62
|
+
}
|
|
63
|
+
} finally {
|
|
64
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* @returns {any}
|
|
69
|
+
*/
|
|
70
|
+
inspect() {
|
|
71
|
+
try {
|
|
72
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
73
|
+
wasm.lightvm_inspect(retptr, this.__wbg_ptr);
|
|
74
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
75
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
76
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
77
|
+
if (r2) {
|
|
78
|
+
throw takeObject(r1);
|
|
79
|
+
}
|
|
80
|
+
return takeObject(r0);
|
|
81
|
+
} finally {
|
|
82
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @param {string} source
|
|
87
|
+
*/
|
|
88
|
+
load(source) {
|
|
89
|
+
try {
|
|
90
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
91
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
92
|
+
const len0 = WASM_VECTOR_LEN;
|
|
93
|
+
wasm.lightvm_load(retptr, this.__wbg_ptr, ptr0, len0);
|
|
94
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
95
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
96
|
+
if (r1) {
|
|
97
|
+
throw takeObject(r0);
|
|
98
|
+
}
|
|
99
|
+
} finally {
|
|
100
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* @param {Uint32Array} caps_raw
|
|
105
|
+
*/
|
|
106
|
+
constructor(caps_raw) {
|
|
107
|
+
try {
|
|
108
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
109
|
+
const ptr0 = passArray32ToWasm0(caps_raw, wasm.__wbindgen_export);
|
|
110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
111
|
+
wasm.lightvm_new(retptr, ptr0, len0);
|
|
112
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
113
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
114
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
115
|
+
if (r2) {
|
|
116
|
+
throw takeObject(r1);
|
|
117
|
+
}
|
|
118
|
+
this.__wbg_ptr = r0;
|
|
119
|
+
LightVMFinalization.register(this, this.__wbg_ptr, this);
|
|
120
|
+
return this;
|
|
121
|
+
} finally {
|
|
122
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @param {string} event_type
|
|
127
|
+
* @param {Function} callback
|
|
128
|
+
*/
|
|
129
|
+
on(event_type, callback) {
|
|
130
|
+
try {
|
|
131
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
132
|
+
const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
134
|
+
wasm.lightvm_on(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(callback));
|
|
135
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
136
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
137
|
+
if (r1) {
|
|
138
|
+
throw takeObject(r0);
|
|
139
|
+
}
|
|
140
|
+
} finally {
|
|
141
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* @param {string} name
|
|
146
|
+
* @param {any} value
|
|
147
|
+
*/
|
|
148
|
+
provide(name, value) {
|
|
149
|
+
try {
|
|
150
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
151
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
152
|
+
const len0 = WASM_VECTOR_LEN;
|
|
153
|
+
wasm.lightvm_provide(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(value));
|
|
154
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
155
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
156
|
+
if (r1) {
|
|
157
|
+
throw takeObject(r0);
|
|
158
|
+
}
|
|
159
|
+
} finally {
|
|
160
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
run() {
|
|
164
|
+
try {
|
|
165
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
166
|
+
wasm.lightvm_run(retptr, this.__wbg_ptr);
|
|
167
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
168
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
169
|
+
if (r1) {
|
|
170
|
+
throw takeObject(r0);
|
|
171
|
+
}
|
|
172
|
+
} finally {
|
|
173
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @returns {LightVMTools}
|
|
178
|
+
*/
|
|
179
|
+
tools() {
|
|
180
|
+
const ret = wasm.lightvm_tools(this.__wbg_ptr);
|
|
181
|
+
return LightVMTools.__wrap(ret);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
if (Symbol.dispose) LightVM.prototype[Symbol.dispose] = LightVM.prototype.free;
|
|
185
|
+
|
|
186
|
+
export class LightVMTools {
|
|
187
|
+
static __wrap(ptr) {
|
|
188
|
+
const obj = Object.create(LightVMTools.prototype);
|
|
189
|
+
obj.__wbg_ptr = ptr;
|
|
190
|
+
LightVMToolsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
191
|
+
return obj;
|
|
192
|
+
}
|
|
193
|
+
__destroy_into_raw() {
|
|
194
|
+
const ptr = this.__wbg_ptr;
|
|
195
|
+
this.__wbg_ptr = 0;
|
|
196
|
+
LightVMToolsFinalization.unregister(this);
|
|
197
|
+
return ptr;
|
|
198
|
+
}
|
|
199
|
+
free() {
|
|
200
|
+
const ptr = this.__destroy_into_raw();
|
|
201
|
+
wasm.__wbg_lightvmtools_free(ptr, 0);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @param {any} bytecode
|
|
205
|
+
* @returns {any}
|
|
206
|
+
*/
|
|
207
|
+
optimizeBytecode(bytecode) {
|
|
208
|
+
try {
|
|
209
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
210
|
+
wasm.lightvmtools_optimizeBytecode(retptr, this.__wbg_ptr, addHeapObject(bytecode));
|
|
211
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
212
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
213
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
214
|
+
if (r2) {
|
|
215
|
+
throw takeObject(r1);
|
|
216
|
+
}
|
|
217
|
+
return takeObject(r0);
|
|
218
|
+
} finally {
|
|
219
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* @param {string} code
|
|
224
|
+
* @returns {string}
|
|
225
|
+
*/
|
|
226
|
+
parseLtc(code) {
|
|
227
|
+
let deferred3_0;
|
|
228
|
+
let deferred3_1;
|
|
229
|
+
try {
|
|
230
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
231
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
232
|
+
const len0 = WASM_VECTOR_LEN;
|
|
233
|
+
wasm.lightvmtools_parseLtc(retptr, this.__wbg_ptr, ptr0, len0);
|
|
234
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
235
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
236
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
237
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
238
|
+
var ptr2 = r0;
|
|
239
|
+
var len2 = r1;
|
|
240
|
+
if (r3) {
|
|
241
|
+
ptr2 = 0; len2 = 0;
|
|
242
|
+
throw takeObject(r2);
|
|
243
|
+
}
|
|
244
|
+
deferred3_0 = ptr2;
|
|
245
|
+
deferred3_1 = len2;
|
|
246
|
+
return getStringFromWasm0(ptr2, len2);
|
|
247
|
+
} finally {
|
|
248
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
249
|
+
wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @param {string} code
|
|
254
|
+
* @returns {any}
|
|
255
|
+
*/
|
|
256
|
+
parseLtcArray(code) {
|
|
257
|
+
const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ret = wasm.lightvmtools_parseLtcArray(this.__wbg_ptr, ptr0, len0);
|
|
260
|
+
return takeObject(ret);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* @param {any} json
|
|
264
|
+
* @returns {string}
|
|
265
|
+
*/
|
|
266
|
+
stringifyLtc(json) {
|
|
267
|
+
let deferred2_0;
|
|
268
|
+
let deferred2_1;
|
|
269
|
+
try {
|
|
270
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
271
|
+
wasm.lightvmtools_stringifyLtc(retptr, this.__wbg_ptr, addHeapObject(json));
|
|
272
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
273
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
274
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
275
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
276
|
+
var ptr1 = r0;
|
|
277
|
+
var len1 = r1;
|
|
278
|
+
if (r3) {
|
|
279
|
+
ptr1 = 0; len1 = 0;
|
|
280
|
+
throw takeObject(r2);
|
|
281
|
+
}
|
|
282
|
+
deferred2_0 = ptr1;
|
|
283
|
+
deferred2_1 = len1;
|
|
284
|
+
return getStringFromWasm0(ptr1, len1);
|
|
285
|
+
} finally {
|
|
286
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
287
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
if (Symbol.dispose) LightVMTools.prototype[Symbol.dispose] = LightVMTools.prototype.free;
|
|
292
|
+
function __wbg_get_imports() {
|
|
293
|
+
const import0 = {
|
|
294
|
+
__proto__: null,
|
|
295
|
+
__wbg_Error_9dc85fe1bc224456: function(arg0, arg1) {
|
|
296
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
297
|
+
return addHeapObject(ret);
|
|
298
|
+
},
|
|
299
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
300
|
+
const ret = String(getObject(arg1));
|
|
301
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
302
|
+
const len1 = WASM_VECTOR_LEN;
|
|
303
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
304
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
305
|
+
},
|
|
306
|
+
__wbg___wbindgen_bigint_get_as_i64_8ea6736501f396b6: function(arg0, arg1) {
|
|
307
|
+
const v = getObject(arg1);
|
|
308
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
309
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
310
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
311
|
+
},
|
|
312
|
+
__wbg___wbindgen_boolean_get_b131b2f36d6b2f55: function(arg0) {
|
|
313
|
+
const v = getObject(arg0);
|
|
314
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
315
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
316
|
+
},
|
|
317
|
+
__wbg___wbindgen_debug_string_56c147eb1a51f0c4: function(arg0, arg1) {
|
|
318
|
+
const ret = debugString(getObject(arg1));
|
|
319
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
320
|
+
const len1 = WASM_VECTOR_LEN;
|
|
321
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
322
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
323
|
+
},
|
|
324
|
+
__wbg___wbindgen_in_ce8569b2fc6f5088: function(arg0, arg1) {
|
|
325
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
326
|
+
return ret;
|
|
327
|
+
},
|
|
328
|
+
__wbg___wbindgen_is_bigint_df272c65456269c2: function(arg0) {
|
|
329
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
330
|
+
return ret;
|
|
331
|
+
},
|
|
332
|
+
__wbg___wbindgen_is_function_147961669f068cd4: function(arg0) {
|
|
333
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
334
|
+
return ret;
|
|
335
|
+
},
|
|
336
|
+
__wbg___wbindgen_is_object_3a2c414391dbf751: function(arg0) {
|
|
337
|
+
const val = getObject(arg0);
|
|
338
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
339
|
+
return ret;
|
|
340
|
+
},
|
|
341
|
+
__wbg___wbindgen_is_string_6541b0f6ecd4e8e5: function(arg0) {
|
|
342
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
343
|
+
return ret;
|
|
344
|
+
},
|
|
345
|
+
__wbg___wbindgen_jsval_eq_174c93ec61bab0c5: function(arg0, arg1) {
|
|
346
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
347
|
+
return ret;
|
|
348
|
+
},
|
|
349
|
+
__wbg___wbindgen_jsval_loose_eq_e07e3b1f5db6da6c: function(arg0, arg1) {
|
|
350
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
351
|
+
return ret;
|
|
352
|
+
},
|
|
353
|
+
__wbg___wbindgen_number_get_588ed6b97f0d7e14: function(arg0, arg1) {
|
|
354
|
+
const obj = getObject(arg1);
|
|
355
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
356
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
357
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
358
|
+
},
|
|
359
|
+
__wbg___wbindgen_string_get_fa2687d531ed17a5: function(arg0, arg1) {
|
|
360
|
+
const obj = getObject(arg1);
|
|
361
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
362
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
363
|
+
var len1 = WASM_VECTOR_LEN;
|
|
364
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
365
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
366
|
+
},
|
|
367
|
+
__wbg___wbindgen_throw_bbadd78c1bac3a77: function(arg0, arg1) {
|
|
368
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
369
|
+
},
|
|
370
|
+
__wbg_call_91f00ddc43e01490: function() { return handleError(function (arg0, arg1) {
|
|
371
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
372
|
+
return addHeapObject(ret);
|
|
373
|
+
}, arguments); },
|
|
374
|
+
__wbg_call_ec09a4cf93377d3a: function() { return handleError(function (arg0, arg1, arg2) {
|
|
375
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
376
|
+
return addHeapObject(ret);
|
|
377
|
+
}, arguments); },
|
|
378
|
+
__wbg_done_6a8439e544ec6206: function(arg0) {
|
|
379
|
+
const ret = getObject(arg0).done;
|
|
380
|
+
return ret;
|
|
381
|
+
},
|
|
382
|
+
__wbg_entries_5a6a7e7e0df09fe5: function(arg0) {
|
|
383
|
+
const ret = Object.entries(getObject(arg0));
|
|
384
|
+
return addHeapObject(ret);
|
|
385
|
+
},
|
|
386
|
+
__wbg_get_44e98e27bda25b5b: function() { return handleError(function (arg0, arg1) {
|
|
387
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
388
|
+
return addHeapObject(ret);
|
|
389
|
+
}, arguments); },
|
|
390
|
+
__wbg_get_4b90d6d8c5deb5d5: function(arg0, arg1) {
|
|
391
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
392
|
+
return addHeapObject(ret);
|
|
393
|
+
},
|
|
394
|
+
__wbg_get_unchecked_46e778e3cec74b5e: function(arg0, arg1) {
|
|
395
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
396
|
+
return addHeapObject(ret);
|
|
397
|
+
},
|
|
398
|
+
__wbg_instanceof_ArrayBuffer_a581da923203f29f: function(arg0) {
|
|
399
|
+
let result;
|
|
400
|
+
try {
|
|
401
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
402
|
+
} catch (_) {
|
|
403
|
+
result = false;
|
|
404
|
+
}
|
|
405
|
+
const ret = result;
|
|
406
|
+
return ret;
|
|
407
|
+
},
|
|
408
|
+
__wbg_instanceof_Map_7f94c740225003e2: function(arg0) {
|
|
409
|
+
let result;
|
|
410
|
+
try {
|
|
411
|
+
result = getObject(arg0) instanceof Map;
|
|
412
|
+
} catch (_) {
|
|
413
|
+
result = false;
|
|
414
|
+
}
|
|
415
|
+
const ret = result;
|
|
416
|
+
return ret;
|
|
417
|
+
},
|
|
418
|
+
__wbg_instanceof_Uint8Array_b6fe1ac89eba107e: function(arg0) {
|
|
419
|
+
let result;
|
|
420
|
+
try {
|
|
421
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
422
|
+
} catch (_) {
|
|
423
|
+
result = false;
|
|
424
|
+
}
|
|
425
|
+
const ret = result;
|
|
426
|
+
return ret;
|
|
427
|
+
},
|
|
428
|
+
__wbg_isArray_139f48e3c057ede8: function(arg0) {
|
|
429
|
+
const ret = Array.isArray(getObject(arg0));
|
|
430
|
+
return ret;
|
|
431
|
+
},
|
|
432
|
+
__wbg_isSafeInteger_c22ccb4af2201fe9: function(arg0) {
|
|
433
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
434
|
+
return ret;
|
|
435
|
+
},
|
|
436
|
+
__wbg_iterator_9b36cebf3be7b7cd: function() {
|
|
437
|
+
const ret = Symbol.iterator;
|
|
438
|
+
return addHeapObject(ret);
|
|
439
|
+
},
|
|
440
|
+
__wbg_length_68a9d5278d084f4f: function(arg0) {
|
|
441
|
+
const ret = getObject(arg0).length;
|
|
442
|
+
return ret;
|
|
443
|
+
},
|
|
444
|
+
__wbg_length_fb04d16d7bdf6d4c: function(arg0) {
|
|
445
|
+
const ret = getObject(arg0).length;
|
|
446
|
+
return ret;
|
|
447
|
+
},
|
|
448
|
+
__wbg_new_0b303268aa395a38: function() {
|
|
449
|
+
const ret = new Array();
|
|
450
|
+
return addHeapObject(ret);
|
|
451
|
+
},
|
|
452
|
+
__wbg_new_20b778a4c5c691c3: function() {
|
|
453
|
+
const ret = new Object();
|
|
454
|
+
return addHeapObject(ret);
|
|
455
|
+
},
|
|
456
|
+
__wbg_new_5fae30e6b23db8df: function(arg0, arg1) {
|
|
457
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
458
|
+
return addHeapObject(ret);
|
|
459
|
+
},
|
|
460
|
+
__wbg_new_883c0db065f06efd: function() {
|
|
461
|
+
const ret = new Map();
|
|
462
|
+
return addHeapObject(ret);
|
|
463
|
+
},
|
|
464
|
+
__wbg_new_b06772b280cc6e52: function(arg0) {
|
|
465
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
466
|
+
return addHeapObject(ret);
|
|
467
|
+
},
|
|
468
|
+
__wbg_next_8cb028b6ba50743f: function() { return handleError(function (arg0) {
|
|
469
|
+
const ret = getObject(arg0).next();
|
|
470
|
+
return addHeapObject(ret);
|
|
471
|
+
}, arguments); },
|
|
472
|
+
__wbg_next_cfd0b146c9538df8: function(arg0) {
|
|
473
|
+
const ret = getObject(arg0).next;
|
|
474
|
+
return addHeapObject(ret);
|
|
475
|
+
},
|
|
476
|
+
__wbg_prototypesetcall_956c7493c68e29b4: function(arg0, arg1, arg2) {
|
|
477
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
478
|
+
},
|
|
479
|
+
__wbg_set_5f806304fb633ab3: function(arg0, arg1, arg2) {
|
|
480
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
481
|
+
return addHeapObject(ret);
|
|
482
|
+
},
|
|
483
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
484
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
485
|
+
},
|
|
486
|
+
__wbg_set_da33c120a6584674: function(arg0, arg1, arg2) {
|
|
487
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
488
|
+
},
|
|
489
|
+
__wbg_value_3d3defe09fb1ffca: function(arg0) {
|
|
490
|
+
const ret = getObject(arg0).value;
|
|
491
|
+
return addHeapObject(ret);
|
|
492
|
+
},
|
|
493
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
494
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
495
|
+
const ret = arg0;
|
|
496
|
+
return addHeapObject(ret);
|
|
497
|
+
},
|
|
498
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
499
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
500
|
+
const ret = arg0;
|
|
501
|
+
return addHeapObject(ret);
|
|
502
|
+
},
|
|
503
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
504
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
505
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
506
|
+
return addHeapObject(ret);
|
|
507
|
+
},
|
|
508
|
+
__wbindgen_cast_0000000000000004: function(arg0) {
|
|
509
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
510
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
511
|
+
return addHeapObject(ret);
|
|
512
|
+
},
|
|
513
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
514
|
+
takeObject(arg0);
|
|
515
|
+
},
|
|
516
|
+
};
|
|
517
|
+
return {
|
|
518
|
+
__proto__: null,
|
|
519
|
+
"./lightvm_bg.js": import0,
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const LightVMFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
524
|
+
? { register: () => {}, unregister: () => {} }
|
|
525
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lightvm_free(ptr, 1));
|
|
526
|
+
const LightVMToolsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
527
|
+
? { register: () => {}, unregister: () => {} }
|
|
528
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_lightvmtools_free(ptr, 1));
|
|
529
|
+
|
|
530
|
+
function addHeapObject(obj) {
|
|
531
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
532
|
+
const idx = heap_next;
|
|
533
|
+
heap_next = heap[idx];
|
|
534
|
+
|
|
535
|
+
heap[idx] = obj;
|
|
536
|
+
return idx;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
function debugString(val) {
|
|
540
|
+
// primitive types
|
|
541
|
+
const type = typeof val;
|
|
542
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
543
|
+
return `${val}`;
|
|
544
|
+
}
|
|
545
|
+
if (type == 'string') {
|
|
546
|
+
return `"${val}"`;
|
|
547
|
+
}
|
|
548
|
+
if (type == 'symbol') {
|
|
549
|
+
const description = val.description;
|
|
550
|
+
if (description == null) {
|
|
551
|
+
return 'Symbol';
|
|
552
|
+
} else {
|
|
553
|
+
return `Symbol(${description})`;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
if (type == 'function') {
|
|
557
|
+
const name = val.name;
|
|
558
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
559
|
+
return `Function(${name})`;
|
|
560
|
+
} else {
|
|
561
|
+
return 'Function';
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
// objects
|
|
565
|
+
if (Array.isArray(val)) {
|
|
566
|
+
const length = val.length;
|
|
567
|
+
let debug = '[';
|
|
568
|
+
if (length > 0) {
|
|
569
|
+
debug += debugString(val[0]);
|
|
570
|
+
}
|
|
571
|
+
for(let i = 1; i < length; i++) {
|
|
572
|
+
debug += ', ' + debugString(val[i]);
|
|
573
|
+
}
|
|
574
|
+
debug += ']';
|
|
575
|
+
return debug;
|
|
576
|
+
}
|
|
577
|
+
// Test for built-in
|
|
578
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
579
|
+
let className;
|
|
580
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
581
|
+
className = builtInMatches[1];
|
|
582
|
+
} else {
|
|
583
|
+
// Failed to match the standard '[object ClassName]'
|
|
584
|
+
return toString.call(val);
|
|
585
|
+
}
|
|
586
|
+
if (className == 'Object') {
|
|
587
|
+
// we're a user defined class or Object
|
|
588
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
589
|
+
// easier than looping through ownProperties of `val`.
|
|
590
|
+
try {
|
|
591
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
592
|
+
} catch (_) {
|
|
593
|
+
return 'Object';
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
// errors
|
|
597
|
+
if (val instanceof Error) {
|
|
598
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
599
|
+
}
|
|
600
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
601
|
+
return className;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function dropObject(idx) {
|
|
605
|
+
if (idx < 1028) return;
|
|
606
|
+
heap[idx] = heap_next;
|
|
607
|
+
heap_next = idx;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
611
|
+
ptr = ptr >>> 0;
|
|
612
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
let cachedDataViewMemory0 = null;
|
|
616
|
+
function getDataViewMemory0() {
|
|
617
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
618
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
619
|
+
}
|
|
620
|
+
return cachedDataViewMemory0;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
function getStringFromWasm0(ptr, len) {
|
|
624
|
+
return decodeText(ptr >>> 0, len);
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
let cachedUint32ArrayMemory0 = null;
|
|
628
|
+
function getUint32ArrayMemory0() {
|
|
629
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
630
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
631
|
+
}
|
|
632
|
+
return cachedUint32ArrayMemory0;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
let cachedUint8ArrayMemory0 = null;
|
|
636
|
+
function getUint8ArrayMemory0() {
|
|
637
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
638
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
639
|
+
}
|
|
640
|
+
return cachedUint8ArrayMemory0;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
function getObject(idx) { return heap[idx]; }
|
|
644
|
+
|
|
645
|
+
function handleError(f, args) {
|
|
646
|
+
try {
|
|
647
|
+
return f.apply(this, args);
|
|
648
|
+
} catch (e) {
|
|
649
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
let heap = new Array(1024).fill(undefined);
|
|
654
|
+
heap.push(undefined, null, true, false);
|
|
655
|
+
|
|
656
|
+
let heap_next = heap.length;
|
|
657
|
+
|
|
658
|
+
function isLikeNone(x) {
|
|
659
|
+
return x === undefined || x === null;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
663
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
664
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
665
|
+
WASM_VECTOR_LEN = arg.length;
|
|
666
|
+
return ptr;
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
670
|
+
if (realloc === undefined) {
|
|
671
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
672
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
673
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
674
|
+
WASM_VECTOR_LEN = buf.length;
|
|
675
|
+
return ptr;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
let len = arg.length;
|
|
679
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
680
|
+
|
|
681
|
+
const mem = getUint8ArrayMemory0();
|
|
682
|
+
|
|
683
|
+
let offset = 0;
|
|
684
|
+
|
|
685
|
+
for (; offset < len; offset++) {
|
|
686
|
+
const code = arg.charCodeAt(offset);
|
|
687
|
+
if (code > 0x7F) break;
|
|
688
|
+
mem[ptr + offset] = code;
|
|
689
|
+
}
|
|
690
|
+
if (offset !== len) {
|
|
691
|
+
if (offset !== 0) {
|
|
692
|
+
arg = arg.slice(offset);
|
|
693
|
+
}
|
|
694
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
695
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
696
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
697
|
+
|
|
698
|
+
offset += ret.written;
|
|
699
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
WASM_VECTOR_LEN = offset;
|
|
703
|
+
return ptr;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
function takeObject(idx) {
|
|
707
|
+
const ret = getObject(idx);
|
|
708
|
+
dropObject(idx);
|
|
709
|
+
return ret;
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
713
|
+
cachedTextDecoder.decode();
|
|
714
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
715
|
+
let numBytesDecoded = 0;
|
|
716
|
+
function decodeText(ptr, len) {
|
|
717
|
+
numBytesDecoded += len;
|
|
718
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
719
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
720
|
+
cachedTextDecoder.decode();
|
|
721
|
+
numBytesDecoded = len;
|
|
722
|
+
}
|
|
723
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
const cachedTextEncoder = new TextEncoder();
|
|
727
|
+
|
|
728
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
729
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
730
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
731
|
+
view.set(buf);
|
|
732
|
+
return {
|
|
733
|
+
read: arg.length,
|
|
734
|
+
written: buf.length
|
|
735
|
+
};
|
|
736
|
+
};
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
let WASM_VECTOR_LEN = 0;
|
|
740
|
+
|
|
741
|
+
let wasmModule, wasmInstance, wasm;
|
|
742
|
+
function __wbg_finalize_init(instance, module) {
|
|
743
|
+
wasmInstance = instance;
|
|
744
|
+
wasm = instance.exports;
|
|
745
|
+
wasmModule = module;
|
|
746
|
+
cachedDataViewMemory0 = null;
|
|
747
|
+
cachedUint32ArrayMemory0 = null;
|
|
748
|
+
cachedUint8ArrayMemory0 = null;
|
|
749
|
+
return wasm;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
async function __wbg_load(module, imports) {
|
|
753
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
754
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
755
|
+
try {
|
|
756
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
757
|
+
} catch (e) {
|
|
758
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
759
|
+
|
|
760
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
761
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
762
|
+
|
|
763
|
+
} else { throw e; }
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
const bytes = await module.arrayBuffer();
|
|
768
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
769
|
+
} else {
|
|
770
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
771
|
+
|
|
772
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
773
|
+
return { instance, module };
|
|
774
|
+
} else {
|
|
775
|
+
return instance;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function expectedResponseType(type) {
|
|
780
|
+
switch (type) {
|
|
781
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
782
|
+
}
|
|
783
|
+
return false;
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
function initSync(module) {
|
|
788
|
+
if (wasm !== undefined) return wasm;
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
if (module !== undefined) {
|
|
792
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
793
|
+
({module} = module)
|
|
794
|
+
} else {
|
|
795
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const imports = __wbg_get_imports();
|
|
800
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
801
|
+
module = new WebAssembly.Module(module);
|
|
802
|
+
}
|
|
803
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
804
|
+
return __wbg_finalize_init(instance, module);
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
async function __wbg_init(module_or_path) {
|
|
808
|
+
if (wasm !== undefined) return wasm;
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
if (module_or_path !== undefined) {
|
|
812
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
813
|
+
({module_or_path} = module_or_path)
|
|
814
|
+
} else {
|
|
815
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
if (module_or_path === undefined) {
|
|
820
|
+
module_or_path = new URL('lightvm_bg.wasm', import.meta.url);
|
|
821
|
+
}
|
|
822
|
+
const imports = __wbg_get_imports();
|
|
823
|
+
|
|
824
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
825
|
+
module_or_path = fetch(module_or_path);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
829
|
+
|
|
830
|
+
return __wbg_finalize_init(instance, module);
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
export { initSync, __wbg_init as default };
|
package/index.wasm
ADDED
|
Binary file
|
package/lightvm.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class LightVM {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
callExport(name: string, args: any): any;
|
|
8
|
+
embedded(): any;
|
|
9
|
+
halt(): void;
|
|
10
|
+
inspect(): any;
|
|
11
|
+
load(source: string): void;
|
|
12
|
+
constructor(caps_raw: Uint32Array);
|
|
13
|
+
on(event_type: string, callback: Function): void;
|
|
14
|
+
provide(name: string, value: any): void;
|
|
15
|
+
run(): void;
|
|
16
|
+
tools(): LightVMTools;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export class LightVMTools {
|
|
20
|
+
private constructor();
|
|
21
|
+
free(): void;
|
|
22
|
+
[Symbol.dispose](): void;
|
|
23
|
+
optimizeBytecode(bytecode: any): any;
|
|
24
|
+
parseLtc(code: string): string;
|
|
25
|
+
parseLtcArray(code: string): any;
|
|
26
|
+
stringifyLtc(json: any): string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
30
|
+
|
|
31
|
+
export interface InitOutput {
|
|
32
|
+
readonly memory: WebAssembly.Memory;
|
|
33
|
+
readonly __wbg_lightvm_free: (a: number, b: number) => void;
|
|
34
|
+
readonly __wbg_lightvmtools_free: (a: number, b: number) => void;
|
|
35
|
+
readonly lightvm_callExport: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
36
|
+
readonly lightvm_embedded: (a: number, b: number) => void;
|
|
37
|
+
readonly lightvm_halt: (a: number, b: number) => void;
|
|
38
|
+
readonly lightvm_inspect: (a: number, b: number) => void;
|
|
39
|
+
readonly lightvm_load: (a: number, b: number, c: number, d: number) => void;
|
|
40
|
+
readonly lightvm_new: (a: number, b: number, c: number) => void;
|
|
41
|
+
readonly lightvm_on: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
42
|
+
readonly lightvm_provide: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
43
|
+
readonly lightvm_run: (a: number, b: number) => void;
|
|
44
|
+
readonly lightvm_tools: (a: number) => number;
|
|
45
|
+
readonly lightvmtools_optimizeBytecode: (a: number, b: number, c: number) => void;
|
|
46
|
+
readonly lightvmtools_parseLtc: (a: number, b: number, c: number, d: number) => void;
|
|
47
|
+
readonly lightvmtools_parseLtcArray: (a: number, b: number, c: number) => number;
|
|
48
|
+
readonly lightvmtools_stringifyLtc: (a: number, b: number, c: number) => void;
|
|
49
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
50
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
51
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
52
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
53
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
60
|
+
* a precompiled `WebAssembly.Module`.
|
|
61
|
+
*
|
|
62
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
63
|
+
*
|
|
64
|
+
* @returns {InitOutput}
|
|
65
|
+
*/
|
|
66
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
70
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
71
|
+
*
|
|
72
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
73
|
+
*
|
|
74
|
+
* @returns {Promise<InitOutput>}
|
|
75
|
+
*/
|
|
76
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_lightvm_free: (a: number, b: number) => void;
|
|
5
|
+
export const __wbg_lightvmtools_free: (a: number, b: number) => void;
|
|
6
|
+
export const lightvm_callExport: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
7
|
+
export const lightvm_embedded: (a: number, b: number) => void;
|
|
8
|
+
export const lightvm_halt: (a: number, b: number) => void;
|
|
9
|
+
export const lightvm_inspect: (a: number, b: number) => void;
|
|
10
|
+
export const lightvm_load: (a: number, b: number, c: number, d: number) => void;
|
|
11
|
+
export const lightvm_new: (a: number, b: number, c: number) => void;
|
|
12
|
+
export const lightvm_on: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
13
|
+
export const lightvm_provide: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
14
|
+
export const lightvm_run: (a: number, b: number) => void;
|
|
15
|
+
export const lightvm_tools: (a: number) => number;
|
|
16
|
+
export const lightvmtools_optimizeBytecode: (a: number, b: number, c: number) => void;
|
|
17
|
+
export const lightvmtools_parseLtc: (a: number, b: number, c: number, d: number) => void;
|
|
18
|
+
export const lightvmtools_parseLtcArray: (a: number, b: number, c: number) => number;
|
|
19
|
+
export const lightvmtools_stringifyLtc: (a: number, b: number, c: number) => void;
|
|
20
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
21
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
22
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
23
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
24
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightvm/core-browser-wasm",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"os": [
|
|
5
5
|
"browser"
|
|
6
6
|
],
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
],
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"files": [
|
|
12
|
-
"
|
|
13
|
-
"
|
|
12
|
+
"index.wasm",
|
|
13
|
+
"index.js",
|
|
14
14
|
"*.d.ts",
|
|
15
15
|
"README.md",
|
|
16
16
|
"LICENSE"
|