@hypen-space/core 0.2.1 → 0.2.3
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 +199 -154
- package/dist/src/app.js +2 -1
- package/dist/src/app.js.map +3 -3
- package/dist/src/engine.browser.js +2 -2
- package/dist/src/engine.browser.js.map +2 -2
- package/dist/src/engine.js +4 -3
- package/dist/src/engine.js.map +3 -3
- package/dist/src/index.js +18 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/plugin.js +126 -0
- package/dist/src/plugin.js.map +10 -0
- package/dist/src/resolver.js +102 -0
- package/dist/src/resolver.js.map +10 -0
- package/dist/src/router.js +37 -18
- package/dist/src/router.js.map +3 -3
- package/dist/src/state.js +9 -1
- package/dist/src/state.js.map +3 -3
- package/package.json +15 -2
- package/src/app.ts +1 -0
- package/src/engine.browser.ts +1 -1
- package/src/engine.ts +4 -2
- package/src/index.ts +21 -1
- package/src/plugin.ts +219 -0
- package/src/resolver.ts +216 -0
- package/src/router.ts +43 -21
- package/src/state.ts +20 -0
- package/wasm-browser/README.md +425 -0
- package/wasm-browser/hypen_engine.d.ts +151 -0
- package/wasm-browser/hypen_engine.js +811 -0
- package/wasm-browser/hypen_engine_bg.js +736 -0
- package/wasm-browser/hypen_engine_bg.wasm +0 -0
- package/wasm-browser/hypen_engine_bg.wasm.d.ts +30 -0
- package/wasm-browser/package.json +15 -0
- package/wasm-node/README.md +425 -0
- package/wasm-node/hypen_engine.d.ts +97 -0
- package/wasm-node/hypen_engine.js +751 -0
- package/wasm-node/hypen_engine_bg.js +736 -0
- package/wasm-node/hypen_engine_bg.wasm +0 -0
- package/wasm-node/hypen_engine_bg.wasm.d.ts +30 -0
- package/wasm-node/package.json +11 -0
|
@@ -0,0 +1,736 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let cachedUint8ArrayMemory0 = null;
|
|
8
|
+
|
|
9
|
+
function getUint8ArrayMemory0() {
|
|
10
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
11
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
12
|
+
}
|
|
13
|
+
return cachedUint8ArrayMemory0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
17
|
+
|
|
18
|
+
cachedTextDecoder.decode();
|
|
19
|
+
|
|
20
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
21
|
+
let numBytesDecoded = 0;
|
|
22
|
+
function decodeText(ptr, len) {
|
|
23
|
+
numBytesDecoded += len;
|
|
24
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
25
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
26
|
+
cachedTextDecoder.decode();
|
|
27
|
+
numBytesDecoded = len;
|
|
28
|
+
}
|
|
29
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function getStringFromWasm0(ptr, len) {
|
|
33
|
+
ptr = ptr >>> 0;
|
|
34
|
+
return decodeText(ptr, len);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function addToExternrefTable0(obj) {
|
|
38
|
+
const idx = wasm.__externref_table_alloc();
|
|
39
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
40
|
+
return idx;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function handleError(f, args) {
|
|
44
|
+
try {
|
|
45
|
+
return f.apply(this, args);
|
|
46
|
+
} catch (e) {
|
|
47
|
+
const idx = addToExternrefTable0(e);
|
|
48
|
+
wasm.__wbindgen_exn_store(idx);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
53
|
+
ptr = ptr >>> 0;
|
|
54
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function isLikeNone(x) {
|
|
58
|
+
return x === undefined || x === null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let cachedDataViewMemory0 = null;
|
|
62
|
+
|
|
63
|
+
function getDataViewMemory0() {
|
|
64
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
65
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
66
|
+
}
|
|
67
|
+
return cachedDataViewMemory0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function debugString(val) {
|
|
71
|
+
// primitive types
|
|
72
|
+
const type = typeof val;
|
|
73
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
74
|
+
return `${val}`;
|
|
75
|
+
}
|
|
76
|
+
if (type == 'string') {
|
|
77
|
+
return `"${val}"`;
|
|
78
|
+
}
|
|
79
|
+
if (type == 'symbol') {
|
|
80
|
+
const description = val.description;
|
|
81
|
+
if (description == null) {
|
|
82
|
+
return 'Symbol';
|
|
83
|
+
} else {
|
|
84
|
+
return `Symbol(${description})`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
if (type == 'function') {
|
|
88
|
+
const name = val.name;
|
|
89
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
90
|
+
return `Function(${name})`;
|
|
91
|
+
} else {
|
|
92
|
+
return 'Function';
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// objects
|
|
96
|
+
if (Array.isArray(val)) {
|
|
97
|
+
const length = val.length;
|
|
98
|
+
let debug = '[';
|
|
99
|
+
if (length > 0) {
|
|
100
|
+
debug += debugString(val[0]);
|
|
101
|
+
}
|
|
102
|
+
for(let i = 1; i < length; i++) {
|
|
103
|
+
debug += ', ' + debugString(val[i]);
|
|
104
|
+
}
|
|
105
|
+
debug += ']';
|
|
106
|
+
return debug;
|
|
107
|
+
}
|
|
108
|
+
// Test for built-in
|
|
109
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
110
|
+
let className;
|
|
111
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
112
|
+
className = builtInMatches[1];
|
|
113
|
+
} else {
|
|
114
|
+
// Failed to match the standard '[object ClassName]'
|
|
115
|
+
return toString.call(val);
|
|
116
|
+
}
|
|
117
|
+
if (className == 'Object') {
|
|
118
|
+
// we're a user defined class or Object
|
|
119
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
120
|
+
// easier than looping through ownProperties of `val`.
|
|
121
|
+
try {
|
|
122
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
123
|
+
} catch (_) {
|
|
124
|
+
return 'Object';
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// errors
|
|
128
|
+
if (val instanceof Error) {
|
|
129
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
130
|
+
}
|
|
131
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
132
|
+
return className;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let WASM_VECTOR_LEN = 0;
|
|
136
|
+
|
|
137
|
+
const cachedTextEncoder = new TextEncoder();
|
|
138
|
+
|
|
139
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
140
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
141
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
142
|
+
view.set(buf);
|
|
143
|
+
return {
|
|
144
|
+
read: arg.length,
|
|
145
|
+
written: buf.length
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
151
|
+
|
|
152
|
+
if (realloc === undefined) {
|
|
153
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
154
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
155
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
156
|
+
WASM_VECTOR_LEN = buf.length;
|
|
157
|
+
return ptr;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let len = arg.length;
|
|
161
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
162
|
+
|
|
163
|
+
const mem = getUint8ArrayMemory0();
|
|
164
|
+
|
|
165
|
+
let offset = 0;
|
|
166
|
+
|
|
167
|
+
for (; offset < len; offset++) {
|
|
168
|
+
const code = arg.charCodeAt(offset);
|
|
169
|
+
if (code > 0x7F) break;
|
|
170
|
+
mem[ptr + offset] = code;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (offset !== len) {
|
|
174
|
+
if (offset !== 0) {
|
|
175
|
+
arg = arg.slice(offset);
|
|
176
|
+
}
|
|
177
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
178
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
179
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
180
|
+
|
|
181
|
+
offset += ret.written;
|
|
182
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
WASM_VECTOR_LEN = offset;
|
|
186
|
+
return ptr;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function takeFromExternrefTable0(idx) {
|
|
190
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
191
|
+
wasm.__externref_table_dealloc(idx);
|
|
192
|
+
return value;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
196
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
197
|
+
for (let i = 0; i < array.length; i++) {
|
|
198
|
+
const add = addToExternrefTable0(array[i]);
|
|
199
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
200
|
+
}
|
|
201
|
+
WASM_VECTOR_LEN = array.length;
|
|
202
|
+
return ptr;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Export patches as JSON string (for debugging)
|
|
206
|
+
* @param {any} patches
|
|
207
|
+
* @returns {string}
|
|
208
|
+
*/
|
|
209
|
+
export function patchesToJson(patches) {
|
|
210
|
+
let deferred2_0;
|
|
211
|
+
let deferred2_1;
|
|
212
|
+
try {
|
|
213
|
+
const ret = wasm.patchesToJson(patches);
|
|
214
|
+
var ptr1 = ret[0];
|
|
215
|
+
var len1 = ret[1];
|
|
216
|
+
if (ret[3]) {
|
|
217
|
+
ptr1 = 0; len1 = 0;
|
|
218
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
219
|
+
}
|
|
220
|
+
deferred2_0 = ptr1;
|
|
221
|
+
deferred2_1 = len1;
|
|
222
|
+
return getStringFromWasm0(ptr1, len1);
|
|
223
|
+
} finally {
|
|
224
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Parse Hypen DSL and return AST as JSON
|
|
230
|
+
* @param {string} source
|
|
231
|
+
* @returns {string}
|
|
232
|
+
*/
|
|
233
|
+
export function parseToJson(source) {
|
|
234
|
+
let deferred3_0;
|
|
235
|
+
let deferred3_1;
|
|
236
|
+
try {
|
|
237
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
238
|
+
const len0 = WASM_VECTOR_LEN;
|
|
239
|
+
const ret = wasm.parseToJson(ptr0, len0);
|
|
240
|
+
var ptr2 = ret[0];
|
|
241
|
+
var len2 = ret[1];
|
|
242
|
+
if (ret[3]) {
|
|
243
|
+
ptr2 = 0; len2 = 0;
|
|
244
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
245
|
+
}
|
|
246
|
+
deferred3_0 = ptr2;
|
|
247
|
+
deferred3_1 = len2;
|
|
248
|
+
return getStringFromWasm0(ptr2, len2);
|
|
249
|
+
} finally {
|
|
250
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export function main() {
|
|
255
|
+
wasm.main();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const WasmEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
259
|
+
? { register: () => {}, unregister: () => {} }
|
|
260
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmengine_free(ptr >>> 0, 1));
|
|
261
|
+
/**
|
|
262
|
+
* WASM-exported engine instance
|
|
263
|
+
* Uses Rc<RefCell<>> instead of Send+Sync for WASM single-threaded environment
|
|
264
|
+
*/
|
|
265
|
+
export class WasmEngine {
|
|
266
|
+
|
|
267
|
+
__destroy_into_raw() {
|
|
268
|
+
const ptr = this.__wbg_ptr;
|
|
269
|
+
this.__wbg_ptr = 0;
|
|
270
|
+
WasmEngineFinalization.unregister(this);
|
|
271
|
+
return ptr;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
free() {
|
|
275
|
+
const ptr = this.__destroy_into_raw();
|
|
276
|
+
wasm.__wbg_wasmengine_free(ptr, 0);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Create a new engine instance
|
|
280
|
+
*/
|
|
281
|
+
constructor() {
|
|
282
|
+
const ret = wasm.wasmengine_new();
|
|
283
|
+
this.__wbg_ptr = ret >>> 0;
|
|
284
|
+
WasmEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
285
|
+
return this;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Parse and render Hypen DSL source code
|
|
289
|
+
* @param {string} source
|
|
290
|
+
*/
|
|
291
|
+
renderSource(source) {
|
|
292
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
293
|
+
const len0 = WASM_VECTOR_LEN;
|
|
294
|
+
const ret = wasm.wasmengine_renderSource(this.__wbg_ptr, ptr0, len0);
|
|
295
|
+
if (ret[1]) {
|
|
296
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Set the render callback that receives patches
|
|
301
|
+
* @param {Function} callback
|
|
302
|
+
*/
|
|
303
|
+
setRenderCallback(callback) {
|
|
304
|
+
wasm.wasmengine_setRenderCallback(this.__wbg_ptr, callback);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Set the component resolver callback
|
|
308
|
+
* The resolver receives (componentName, contextPath) and should return
|
|
309
|
+
* { source: string, path: string } or null
|
|
310
|
+
*
|
|
311
|
+
* contextPath is the path of the component that's referencing this component
|
|
312
|
+
* The returned path should be the resolved absolute path to the component file
|
|
313
|
+
* @param {Function} resolver
|
|
314
|
+
*/
|
|
315
|
+
setComponentResolver(resolver) {
|
|
316
|
+
wasm.wasmengine_setComponentResolver(this.__wbg_ptr, resolver);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Register a primitive element (like Text, Button, etc.) to skip component resolution
|
|
320
|
+
* This prevents unnecessary resolver calls for built-in DOM elements
|
|
321
|
+
* @param {string} name
|
|
322
|
+
*/
|
|
323
|
+
registerPrimitive(name) {
|
|
324
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
325
|
+
const len0 = WASM_VECTOR_LEN;
|
|
326
|
+
wasm.wasmengine_registerPrimitive(this.__wbg_ptr, ptr0, len0);
|
|
327
|
+
}
|
|
328
|
+
/**
|
|
329
|
+
* Render a component source (for lazy loading routes)
|
|
330
|
+
* This allows rendering a component on-demand
|
|
331
|
+
* @param {string} source
|
|
332
|
+
*/
|
|
333
|
+
renderLazyComponent(source) {
|
|
334
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
335
|
+
const len0 = WASM_VECTOR_LEN;
|
|
336
|
+
const ret = wasm.wasmengine_renderLazyComponent(this.__wbg_ptr, ptr0, len0);
|
|
337
|
+
if (ret[1]) {
|
|
338
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Render a component into a specific parent node (subtree rendering)
|
|
343
|
+
* This is used for lazy routing where components are rendered on-demand into route containers
|
|
344
|
+
*
|
|
345
|
+
* # Arguments
|
|
346
|
+
* * `source` - The Hypen DSL source to parse and render
|
|
347
|
+
* * `parent_node_id_str` - The serialized node ID string of the parent element
|
|
348
|
+
* * `state_js` - The state to use for rendering (as JsValue)
|
|
349
|
+
* @param {string} source
|
|
350
|
+
* @param {string} parent_node_id_str
|
|
351
|
+
* @param {any} state_js
|
|
352
|
+
*/
|
|
353
|
+
renderInto(source, parent_node_id_str, state_js) {
|
|
354
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
355
|
+
const len0 = WASM_VECTOR_LEN;
|
|
356
|
+
const ptr1 = passStringToWasm0(parent_node_id_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
357
|
+
const len1 = WASM_VECTOR_LEN;
|
|
358
|
+
const ret = wasm.wasmengine_renderInto(this.__wbg_ptr, ptr0, len0, ptr1, len1, state_js);
|
|
359
|
+
if (ret[1]) {
|
|
360
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Update state from JavaScript
|
|
365
|
+
* @param {any} state_patch
|
|
366
|
+
*/
|
|
367
|
+
updateState(state_patch) {
|
|
368
|
+
const ret = wasm.wasmengine_updateState(this.__wbg_ptr, state_patch);
|
|
369
|
+
if (ret[1]) {
|
|
370
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Dispatch an action
|
|
375
|
+
* @param {string} name
|
|
376
|
+
* @param {any} payload
|
|
377
|
+
*/
|
|
378
|
+
dispatchAction(name, payload) {
|
|
379
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
380
|
+
const len0 = WASM_VECTOR_LEN;
|
|
381
|
+
const ret = wasm.wasmengine_dispatchAction(this.__wbg_ptr, ptr0, len0, payload);
|
|
382
|
+
if (ret[1]) {
|
|
383
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Register an action handler
|
|
388
|
+
* @param {string} action_name
|
|
389
|
+
* @param {Function} handler
|
|
390
|
+
*/
|
|
391
|
+
onAction(action_name, handler) {
|
|
392
|
+
const ptr0 = passStringToWasm0(action_name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
393
|
+
const len0 = WASM_VECTOR_LEN;
|
|
394
|
+
wasm.wasmengine_onAction(this.__wbg_ptr, ptr0, len0, handler);
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Clear the engine tree (useful when switching samples)
|
|
398
|
+
*/
|
|
399
|
+
clearTree() {
|
|
400
|
+
wasm.wasmengine_clearTree(this.__wbg_ptr);
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Debug method to inspect parsed components
|
|
404
|
+
* @param {string} source
|
|
405
|
+
* @returns {string}
|
|
406
|
+
*/
|
|
407
|
+
debugParseComponent(source) {
|
|
408
|
+
let deferred3_0;
|
|
409
|
+
let deferred3_1;
|
|
410
|
+
try {
|
|
411
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
412
|
+
const len0 = WASM_VECTOR_LEN;
|
|
413
|
+
const ret = wasm.wasmengine_debugParseComponent(this.__wbg_ptr, ptr0, len0);
|
|
414
|
+
var ptr2 = ret[0];
|
|
415
|
+
var len2 = ret[1];
|
|
416
|
+
if (ret[3]) {
|
|
417
|
+
ptr2 = 0; len2 = 0;
|
|
418
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
419
|
+
}
|
|
420
|
+
deferred3_0 = ptr2;
|
|
421
|
+
deferred3_1 = len2;
|
|
422
|
+
return getStringFromWasm0(ptr2, len2);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Initialize a module
|
|
429
|
+
* @param {string} name
|
|
430
|
+
* @param {string[]} actions
|
|
431
|
+
* @param {string[]} state_keys
|
|
432
|
+
* @param {any} initial_state
|
|
433
|
+
*/
|
|
434
|
+
setModule(name, actions, state_keys, initial_state) {
|
|
435
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
436
|
+
const len0 = WASM_VECTOR_LEN;
|
|
437
|
+
const ptr1 = passArrayJsValueToWasm0(actions, wasm.__wbindgen_malloc);
|
|
438
|
+
const len1 = WASM_VECTOR_LEN;
|
|
439
|
+
const ptr2 = passArrayJsValueToWasm0(state_keys, wasm.__wbindgen_malloc);
|
|
440
|
+
const len2 = WASM_VECTOR_LEN;
|
|
441
|
+
const ret = wasm.wasmengine_setModule(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, initial_state);
|
|
442
|
+
if (ret[1]) {
|
|
443
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
/**
|
|
447
|
+
* Get the current revision number
|
|
448
|
+
* @returns {bigint}
|
|
449
|
+
*/
|
|
450
|
+
getRevision() {
|
|
451
|
+
const ret = wasm.wasmengine_getRevision(this.__wbg_ptr);
|
|
452
|
+
return BigInt.asUintN(64, ret);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
if (Symbol.dispose) WasmEngine.prototype[Symbol.dispose] = WasmEngine.prototype.free;
|
|
456
|
+
|
|
457
|
+
export function __wbg_Error_e17e777aac105295(arg0, arg1) {
|
|
458
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
459
|
+
return ret;
|
|
460
|
+
};
|
|
461
|
+
|
|
462
|
+
export function __wbg_call_13410aac570ffff7() { return handleError(function (arg0, arg1) {
|
|
463
|
+
const ret = arg0.call(arg1);
|
|
464
|
+
return ret;
|
|
465
|
+
}, arguments) };
|
|
466
|
+
|
|
467
|
+
export function __wbg_call_641db1bb5db5a579() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
468
|
+
const ret = arg0.call(arg1, arg2, arg3);
|
|
469
|
+
return ret;
|
|
470
|
+
}, arguments) };
|
|
471
|
+
|
|
472
|
+
export function __wbg_call_a5400b25a865cfd8() { return handleError(function (arg0, arg1, arg2) {
|
|
473
|
+
const ret = arg0.call(arg1, arg2);
|
|
474
|
+
return ret;
|
|
475
|
+
}, arguments) };
|
|
476
|
+
|
|
477
|
+
export function __wbg_done_75ed0ee6dd243d9d(arg0) {
|
|
478
|
+
const ret = arg0.done;
|
|
479
|
+
return ret;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
export function __wbg_entries_2be2f15bd5554996(arg0) {
|
|
483
|
+
const ret = Object.entries(arg0);
|
|
484
|
+
return ret;
|
|
485
|
+
};
|
|
486
|
+
|
|
487
|
+
export function __wbg_error_99981e16d476aa5c(arg0) {
|
|
488
|
+
console.error(arg0);
|
|
489
|
+
};
|
|
490
|
+
|
|
491
|
+
export function __wbg_get_0da715ceaecea5c8(arg0, arg1) {
|
|
492
|
+
const ret = arg0[arg1 >>> 0];
|
|
493
|
+
return ret;
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
export function __wbg_get_458e874b43b18b25() { return handleError(function (arg0, arg1) {
|
|
497
|
+
const ret = Reflect.get(arg0, arg1);
|
|
498
|
+
return ret;
|
|
499
|
+
}, arguments) };
|
|
500
|
+
|
|
501
|
+
export function __wbg_instanceof_ArrayBuffer_67f3012529f6a2dd(arg0) {
|
|
502
|
+
let result;
|
|
503
|
+
try {
|
|
504
|
+
result = arg0 instanceof ArrayBuffer;
|
|
505
|
+
} catch (_) {
|
|
506
|
+
result = false;
|
|
507
|
+
}
|
|
508
|
+
const ret = result;
|
|
509
|
+
return ret;
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
export function __wbg_instanceof_Map_ebb01a5b6b5ffd0b(arg0) {
|
|
513
|
+
let result;
|
|
514
|
+
try {
|
|
515
|
+
result = arg0 instanceof Map;
|
|
516
|
+
} catch (_) {
|
|
517
|
+
result = false;
|
|
518
|
+
}
|
|
519
|
+
const ret = result;
|
|
520
|
+
return ret;
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
export function __wbg_instanceof_Uint8Array_9a8378d955933db7(arg0) {
|
|
524
|
+
let result;
|
|
525
|
+
try {
|
|
526
|
+
result = arg0 instanceof Uint8Array;
|
|
527
|
+
} catch (_) {
|
|
528
|
+
result = false;
|
|
529
|
+
}
|
|
530
|
+
const ret = result;
|
|
531
|
+
return ret;
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
export function __wbg_isArray_030cce220591fb41(arg0) {
|
|
535
|
+
const ret = Array.isArray(arg0);
|
|
536
|
+
return ret;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
export function __wbg_isSafeInteger_1c0d1af5542e102a(arg0) {
|
|
540
|
+
const ret = Number.isSafeInteger(arg0);
|
|
541
|
+
return ret;
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
export function __wbg_iterator_f370b34483c71a1c() {
|
|
545
|
+
const ret = Symbol.iterator;
|
|
546
|
+
return ret;
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
export function __wbg_length_186546c51cd61acd(arg0) {
|
|
550
|
+
const ret = arg0.length;
|
|
551
|
+
return ret;
|
|
552
|
+
};
|
|
553
|
+
|
|
554
|
+
export function __wbg_length_6bb7e81f9d7713e4(arg0) {
|
|
555
|
+
const ret = arg0.length;
|
|
556
|
+
return ret;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
export function __wbg_log_6c7b5f4f00b8ce3f(arg0) {
|
|
560
|
+
console.log(arg0);
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
export function __wbg_new_19c25a3f2fa63a02() {
|
|
564
|
+
const ret = new Object();
|
|
565
|
+
return ret;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
export function __wbg_new_1f3a344cf3123716() {
|
|
569
|
+
const ret = new Array();
|
|
570
|
+
return ret;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
export function __wbg_new_2ff1f68f3676ea53() {
|
|
574
|
+
const ret = new Map();
|
|
575
|
+
return ret;
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
export function __wbg_new_638ebfaedbf32a5e(arg0) {
|
|
579
|
+
const ret = new Uint8Array(arg0);
|
|
580
|
+
return ret;
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
export function __wbg_next_5b3530e612fde77d(arg0) {
|
|
584
|
+
const ret = arg0.next;
|
|
585
|
+
return ret;
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
export function __wbg_next_692e82279131b03c() { return handleError(function (arg0) {
|
|
589
|
+
const ret = arg0.next();
|
|
590
|
+
return ret;
|
|
591
|
+
}, arguments) };
|
|
592
|
+
|
|
593
|
+
export function __wbg_prototypesetcall_3d4a26c1ed734349(arg0, arg1, arg2) {
|
|
594
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
595
|
+
};
|
|
596
|
+
|
|
597
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
598
|
+
arg0[arg1] = arg2;
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
export function __wbg_set_90f6c0f7bd8c0415(arg0, arg1, arg2) {
|
|
602
|
+
arg0[arg1 >>> 0] = arg2;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
export function __wbg_set_b7f1cf4fae26fe2a(arg0, arg1, arg2) {
|
|
606
|
+
const ret = arg0.set(arg1, arg2);
|
|
607
|
+
return ret;
|
|
608
|
+
};
|
|
609
|
+
|
|
610
|
+
export function __wbg_value_dd9372230531eade(arg0) {
|
|
611
|
+
const ret = arg0.value;
|
|
612
|
+
return ret;
|
|
613
|
+
};
|
|
614
|
+
|
|
615
|
+
export function __wbg_wbindgenbigintgetasi64_ac743ece6ab9bba1(arg0, arg1) {
|
|
616
|
+
const v = arg1;
|
|
617
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
618
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
619
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
export function __wbg_wbindgenbooleanget_3fe6f642c7d97746(arg0) {
|
|
623
|
+
const v = arg0;
|
|
624
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
625
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
export function __wbg_wbindgendebugstring_99ef257a3ddda34d(arg0, arg1) {
|
|
629
|
+
const ret = debugString(arg1);
|
|
630
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
631
|
+
const len1 = WASM_VECTOR_LEN;
|
|
632
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
633
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
export function __wbg_wbindgenin_d7a1ee10933d2d55(arg0, arg1) {
|
|
637
|
+
const ret = arg0 in arg1;
|
|
638
|
+
return ret;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
export function __wbg_wbindgenisbigint_ecb90cc08a5a9154(arg0) {
|
|
642
|
+
const ret = typeof(arg0) === 'bigint';
|
|
643
|
+
return ret;
|
|
644
|
+
};
|
|
645
|
+
|
|
646
|
+
export function __wbg_wbindgenisfunction_8cee7dce3725ae74(arg0) {
|
|
647
|
+
const ret = typeof(arg0) === 'function';
|
|
648
|
+
return ret;
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
export function __wbg_wbindgenisnull_f3037694abe4d97a(arg0) {
|
|
652
|
+
const ret = arg0 === null;
|
|
653
|
+
return ret;
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
export function __wbg_wbindgenisobject_307a53c6bd97fbf8(arg0) {
|
|
657
|
+
const val = arg0;
|
|
658
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
659
|
+
return ret;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
export function __wbg_wbindgenisstring_d4fa939789f003b0(arg0) {
|
|
663
|
+
const ret = typeof(arg0) === 'string';
|
|
664
|
+
return ret;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
export function __wbg_wbindgenisundefined_c4b71d073b92f3c5(arg0) {
|
|
668
|
+
const ret = arg0 === undefined;
|
|
669
|
+
return ret;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
export function __wbg_wbindgenjsvaleq_e6f2ad59ccae1b58(arg0, arg1) {
|
|
673
|
+
const ret = arg0 === arg1;
|
|
674
|
+
return ret;
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
export function __wbg_wbindgenjsvallooseeq_9bec8c9be826bed1(arg0, arg1) {
|
|
678
|
+
const ret = arg0 == arg1;
|
|
679
|
+
return ret;
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
export function __wbg_wbindgennumberget_f74b4c7525ac05cb(arg0, arg1) {
|
|
683
|
+
const obj = arg1;
|
|
684
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
685
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
686
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
687
|
+
};
|
|
688
|
+
|
|
689
|
+
export function __wbg_wbindgenstringget_0f16a6ddddef376f(arg0, arg1) {
|
|
690
|
+
const obj = arg1;
|
|
691
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
692
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
693
|
+
var len1 = WASM_VECTOR_LEN;
|
|
694
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
695
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
export function __wbg_wbindgenthrow_451ec1a8469d7eb6(arg0, arg1) {
|
|
699
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
export function __wbindgen_cast_2241b6af4c4b2941(arg0, arg1) {
|
|
703
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
704
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
705
|
+
return ret;
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
export function __wbindgen_cast_4625c577ab2ec9ee(arg0) {
|
|
709
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
710
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
711
|
+
return ret;
|
|
712
|
+
};
|
|
713
|
+
|
|
714
|
+
export function __wbindgen_cast_9ae0607507abb057(arg0) {
|
|
715
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
716
|
+
const ret = arg0;
|
|
717
|
+
return ret;
|
|
718
|
+
};
|
|
719
|
+
|
|
720
|
+
export function __wbindgen_cast_d6cd19b81560fd6e(arg0) {
|
|
721
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
722
|
+
const ret = arg0;
|
|
723
|
+
return ret;
|
|
724
|
+
};
|
|
725
|
+
|
|
726
|
+
export function __wbindgen_init_externref_table() {
|
|
727
|
+
const table = wasm.__wbindgen_export_2;
|
|
728
|
+
const offset = table.grow(4);
|
|
729
|
+
table.set(0, undefined);
|
|
730
|
+
table.set(offset + 0, undefined);
|
|
731
|
+
table.set(offset + 1, null);
|
|
732
|
+
table.set(offset + 2, true);
|
|
733
|
+
table.set(offset + 3, false);
|
|
734
|
+
;
|
|
735
|
+
};
|
|
736
|
+
|