jsontrek 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/bundle.d.ts +8 -0
- package/bundle.js +4 -0
- package/bundle_bg.js +461 -0
- package/{web_bg.wasm → bundle_bg.wasm} +0 -0
- package/package.json +8 -6
- package/web.d.ts +0 -40
- package/web.js +0 -218
package/bundle.d.ts
ADDED
package/bundle.js
ADDED
package/bundle_bg.js
ADDED
@@ -0,0 +1,461 @@
|
|
1
|
+
let wasm;
|
2
|
+
export function __wbg_set_wasm(val) {
|
3
|
+
wasm = val;
|
4
|
+
}
|
5
|
+
|
6
|
+
|
7
|
+
const heap = new Array(128).fill(undefined);
|
8
|
+
|
9
|
+
heap.push(undefined, null, true, false);
|
10
|
+
|
11
|
+
function getObject(idx) { return heap[idx]; }
|
12
|
+
|
13
|
+
let heap_next = heap.length;
|
14
|
+
|
15
|
+
function dropObject(idx) {
|
16
|
+
if (idx < 132) return;
|
17
|
+
heap[idx] = heap_next;
|
18
|
+
heap_next = idx;
|
19
|
+
}
|
20
|
+
|
21
|
+
function takeObject(idx) {
|
22
|
+
const ret = getObject(idx);
|
23
|
+
dropObject(idx);
|
24
|
+
return ret;
|
25
|
+
}
|
26
|
+
|
27
|
+
let WASM_VECTOR_LEN = 0;
|
28
|
+
|
29
|
+
let cachedUint8ArrayMemory0 = null;
|
30
|
+
|
31
|
+
function getUint8ArrayMemory0() {
|
32
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
33
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
34
|
+
}
|
35
|
+
return cachedUint8ArrayMemory0;
|
36
|
+
}
|
37
|
+
|
38
|
+
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
39
|
+
|
40
|
+
let cachedTextEncoder = new lTextEncoder('utf-8');
|
41
|
+
|
42
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
43
|
+
? function (arg, view) {
|
44
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
45
|
+
}
|
46
|
+
: function (arg, view) {
|
47
|
+
const buf = cachedTextEncoder.encode(arg);
|
48
|
+
view.set(buf);
|
49
|
+
return {
|
50
|
+
read: arg.length,
|
51
|
+
written: buf.length
|
52
|
+
};
|
53
|
+
});
|
54
|
+
|
55
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
56
|
+
|
57
|
+
if (realloc === undefined) {
|
58
|
+
const buf = cachedTextEncoder.encode(arg);
|
59
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
60
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
61
|
+
WASM_VECTOR_LEN = buf.length;
|
62
|
+
return ptr;
|
63
|
+
}
|
64
|
+
|
65
|
+
let len = arg.length;
|
66
|
+
let ptr = malloc(len, 1) >>> 0;
|
67
|
+
|
68
|
+
const mem = getUint8ArrayMemory0();
|
69
|
+
|
70
|
+
let offset = 0;
|
71
|
+
|
72
|
+
for (; offset < len; offset++) {
|
73
|
+
const code = arg.charCodeAt(offset);
|
74
|
+
if (code > 0x7F) break;
|
75
|
+
mem[ptr + offset] = code;
|
76
|
+
}
|
77
|
+
|
78
|
+
if (offset !== len) {
|
79
|
+
if (offset !== 0) {
|
80
|
+
arg = arg.slice(offset);
|
81
|
+
}
|
82
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
83
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
84
|
+
const ret = encodeString(arg, view);
|
85
|
+
|
86
|
+
offset += ret.written;
|
87
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
88
|
+
}
|
89
|
+
|
90
|
+
WASM_VECTOR_LEN = offset;
|
91
|
+
return ptr;
|
92
|
+
}
|
93
|
+
|
94
|
+
function isLikeNone(x) {
|
95
|
+
return x === undefined || x === null;
|
96
|
+
}
|
97
|
+
|
98
|
+
let cachedDataViewMemory0 = null;
|
99
|
+
|
100
|
+
function getDataViewMemory0() {
|
101
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
102
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
103
|
+
}
|
104
|
+
return cachedDataViewMemory0;
|
105
|
+
}
|
106
|
+
|
107
|
+
function addHeapObject(obj) {
|
108
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
109
|
+
const idx = heap_next;
|
110
|
+
heap_next = heap[idx];
|
111
|
+
|
112
|
+
heap[idx] = obj;
|
113
|
+
return idx;
|
114
|
+
}
|
115
|
+
|
116
|
+
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
117
|
+
|
118
|
+
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
119
|
+
|
120
|
+
cachedTextDecoder.decode();
|
121
|
+
|
122
|
+
function getStringFromWasm0(ptr, len) {
|
123
|
+
ptr = ptr >>> 0;
|
124
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
125
|
+
}
|
126
|
+
|
127
|
+
function debugString(val) {
|
128
|
+
// primitive types
|
129
|
+
const type = typeof val;
|
130
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
131
|
+
return `${val}`;
|
132
|
+
}
|
133
|
+
if (type == 'string') {
|
134
|
+
return `"${val}"`;
|
135
|
+
}
|
136
|
+
if (type == 'symbol') {
|
137
|
+
const description = val.description;
|
138
|
+
if (description == null) {
|
139
|
+
return 'Symbol';
|
140
|
+
} else {
|
141
|
+
return `Symbol(${description})`;
|
142
|
+
}
|
143
|
+
}
|
144
|
+
if (type == 'function') {
|
145
|
+
const name = val.name;
|
146
|
+
if (typeof name == 'string' && name.length > 0) {
|
147
|
+
return `Function(${name})`;
|
148
|
+
} else {
|
149
|
+
return 'Function';
|
150
|
+
}
|
151
|
+
}
|
152
|
+
// objects
|
153
|
+
if (Array.isArray(val)) {
|
154
|
+
const length = val.length;
|
155
|
+
let debug = '[';
|
156
|
+
if (length > 0) {
|
157
|
+
debug += debugString(val[0]);
|
158
|
+
}
|
159
|
+
for(let i = 1; i < length; i++) {
|
160
|
+
debug += ', ' + debugString(val[i]);
|
161
|
+
}
|
162
|
+
debug += ']';
|
163
|
+
return debug;
|
164
|
+
}
|
165
|
+
// Test for built-in
|
166
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
167
|
+
let className;
|
168
|
+
if (builtInMatches.length > 1) {
|
169
|
+
className = builtInMatches[1];
|
170
|
+
} else {
|
171
|
+
// Failed to match the standard '[object ClassName]'
|
172
|
+
return toString.call(val);
|
173
|
+
}
|
174
|
+
if (className == 'Object') {
|
175
|
+
// we're a user defined class or Object
|
176
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
177
|
+
// easier than looping through ownProperties of `val`.
|
178
|
+
try {
|
179
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
180
|
+
} catch (_) {
|
181
|
+
return 'Object';
|
182
|
+
}
|
183
|
+
}
|
184
|
+
// errors
|
185
|
+
if (val instanceof Error) {
|
186
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
187
|
+
}
|
188
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
189
|
+
return className;
|
190
|
+
}
|
191
|
+
/**
|
192
|
+
* @param {any} obj
|
193
|
+
* @param {string} path
|
194
|
+
* @returns {any}
|
195
|
+
*/
|
196
|
+
export function parse(obj, path) {
|
197
|
+
const ptr0 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
198
|
+
const len0 = WASM_VECTOR_LEN;
|
199
|
+
const ret = wasm.parse(addHeapObject(obj), ptr0, len0);
|
200
|
+
return takeObject(ret);
|
201
|
+
}
|
202
|
+
|
203
|
+
function handleError(f, args) {
|
204
|
+
try {
|
205
|
+
return f.apply(this, args);
|
206
|
+
} catch (e) {
|
207
|
+
wasm.__wbindgen_exn_store(addHeapObject(e));
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
212
|
+
takeObject(arg0);
|
213
|
+
};
|
214
|
+
|
215
|
+
export function __wbindgen_string_get(arg0, arg1) {
|
216
|
+
const obj = getObject(arg1);
|
217
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
218
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
219
|
+
var len1 = WASM_VECTOR_LEN;
|
220
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
221
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
222
|
+
};
|
223
|
+
|
224
|
+
export function __wbindgen_boolean_get(arg0) {
|
225
|
+
const v = getObject(arg0);
|
226
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
227
|
+
return ret;
|
228
|
+
};
|
229
|
+
|
230
|
+
export function __wbindgen_is_bigint(arg0) {
|
231
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
232
|
+
return ret;
|
233
|
+
};
|
234
|
+
|
235
|
+
export function __wbindgen_number_get(arg0, arg1) {
|
236
|
+
const obj = getObject(arg1);
|
237
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
238
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
239
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
240
|
+
};
|
241
|
+
|
242
|
+
export function __wbindgen_is_object(arg0) {
|
243
|
+
const val = getObject(arg0);
|
244
|
+
const ret = typeof(val) === 'object' && val !== null;
|
245
|
+
return ret;
|
246
|
+
};
|
247
|
+
|
248
|
+
export function __wbindgen_in(arg0, arg1) {
|
249
|
+
const ret = getObject(arg0) in getObject(arg1);
|
250
|
+
return ret;
|
251
|
+
};
|
252
|
+
|
253
|
+
export function __wbindgen_bigint_from_i64(arg0) {
|
254
|
+
const ret = arg0;
|
255
|
+
return addHeapObject(ret);
|
256
|
+
};
|
257
|
+
|
258
|
+
export function __wbindgen_jsval_eq(arg0, arg1) {
|
259
|
+
const ret = getObject(arg0) === getObject(arg1);
|
260
|
+
return ret;
|
261
|
+
};
|
262
|
+
|
263
|
+
export function __wbindgen_bigint_from_u64(arg0) {
|
264
|
+
const ret = BigInt.asUintN(64, arg0);
|
265
|
+
return addHeapObject(ret);
|
266
|
+
};
|
267
|
+
|
268
|
+
export function __wbindgen_error_new(arg0, arg1) {
|
269
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
270
|
+
return addHeapObject(ret);
|
271
|
+
};
|
272
|
+
|
273
|
+
export function __wbindgen_is_string(arg0) {
|
274
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
275
|
+
return ret;
|
276
|
+
};
|
277
|
+
|
278
|
+
export function __wbindgen_jsval_loose_eq(arg0, arg1) {
|
279
|
+
const ret = getObject(arg0) == getObject(arg1);
|
280
|
+
return ret;
|
281
|
+
};
|
282
|
+
|
283
|
+
export function __wbindgen_number_new(arg0) {
|
284
|
+
const ret = arg0;
|
285
|
+
return addHeapObject(ret);
|
286
|
+
};
|
287
|
+
|
288
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
289
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
290
|
+
return addHeapObject(ret);
|
291
|
+
};
|
292
|
+
|
293
|
+
export function __wbg_set_f975102236d3c502(arg0, arg1, arg2) {
|
294
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
295
|
+
};
|
296
|
+
|
297
|
+
export function __wbg_get_5419cf6b954aa11d(arg0, arg1) {
|
298
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
299
|
+
return addHeapObject(ret);
|
300
|
+
};
|
301
|
+
|
302
|
+
export function __wbg_length_f217bbbf7e8e4df4(arg0) {
|
303
|
+
const ret = getObject(arg0).length;
|
304
|
+
return ret;
|
305
|
+
};
|
306
|
+
|
307
|
+
export function __wbg_new_034f913e7636e987() {
|
308
|
+
const ret = new Array();
|
309
|
+
return addHeapObject(ret);
|
310
|
+
};
|
311
|
+
|
312
|
+
export function __wbindgen_is_function(arg0) {
|
313
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
314
|
+
return ret;
|
315
|
+
};
|
316
|
+
|
317
|
+
export function __wbg_new_7a87a0376e40533b() {
|
318
|
+
const ret = new Map();
|
319
|
+
return addHeapObject(ret);
|
320
|
+
};
|
321
|
+
|
322
|
+
export function __wbg_next_13b477da1eaa3897(arg0) {
|
323
|
+
const ret = getObject(arg0).next;
|
324
|
+
return addHeapObject(ret);
|
325
|
+
};
|
326
|
+
|
327
|
+
export function __wbg_next_b06e115d1b01e10b() { return handleError(function (arg0) {
|
328
|
+
const ret = getObject(arg0).next();
|
329
|
+
return addHeapObject(ret);
|
330
|
+
}, arguments) };
|
331
|
+
|
332
|
+
export function __wbg_done_983b5ffcaec8c583(arg0) {
|
333
|
+
const ret = getObject(arg0).done;
|
334
|
+
return ret;
|
335
|
+
};
|
336
|
+
|
337
|
+
export function __wbg_value_2ab8a198c834c26a(arg0) {
|
338
|
+
const ret = getObject(arg0).value;
|
339
|
+
return addHeapObject(ret);
|
340
|
+
};
|
341
|
+
|
342
|
+
export function __wbg_iterator_695d699a44d6234c() {
|
343
|
+
const ret = Symbol.iterator;
|
344
|
+
return addHeapObject(ret);
|
345
|
+
};
|
346
|
+
|
347
|
+
export function __wbg_get_ef828680c64da212() { return handleError(function (arg0, arg1) {
|
348
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
349
|
+
return addHeapObject(ret);
|
350
|
+
}, arguments) };
|
351
|
+
|
352
|
+
export function __wbg_call_a9ef466721e824f2() { return handleError(function (arg0, arg1) {
|
353
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
354
|
+
return addHeapObject(ret);
|
355
|
+
}, arguments) };
|
356
|
+
|
357
|
+
export function __wbg_new_e69b5f66fda8f13c() {
|
358
|
+
const ret = new Object();
|
359
|
+
return addHeapObject(ret);
|
360
|
+
};
|
361
|
+
|
362
|
+
export function __wbg_set_425e70f7c64ac962(arg0, arg1, arg2) {
|
363
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
364
|
+
};
|
365
|
+
|
366
|
+
export function __wbg_isArray_6f3b47f09adb61b5(arg0) {
|
367
|
+
const ret = Array.isArray(getObject(arg0));
|
368
|
+
return ret;
|
369
|
+
};
|
370
|
+
|
371
|
+
export function __wbg_instanceof_ArrayBuffer_74945570b4a62ec7(arg0) {
|
372
|
+
let result;
|
373
|
+
try {
|
374
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
375
|
+
} catch (_) {
|
376
|
+
result = false;
|
377
|
+
}
|
378
|
+
const ret = result;
|
379
|
+
return ret;
|
380
|
+
};
|
381
|
+
|
382
|
+
export function __wbg_instanceof_Map_f96986929e7e89ed(arg0) {
|
383
|
+
let result;
|
384
|
+
try {
|
385
|
+
result = getObject(arg0) instanceof Map;
|
386
|
+
} catch (_) {
|
387
|
+
result = false;
|
388
|
+
}
|
389
|
+
const ret = result;
|
390
|
+
return ret;
|
391
|
+
};
|
392
|
+
|
393
|
+
export function __wbg_set_277a63e77c89279f(arg0, arg1, arg2) {
|
394
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
395
|
+
return addHeapObject(ret);
|
396
|
+
};
|
397
|
+
|
398
|
+
export function __wbg_isSafeInteger_b9dff570f01a9100(arg0) {
|
399
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
400
|
+
return ret;
|
401
|
+
};
|
402
|
+
|
403
|
+
export function __wbg_entries_c02034de337d3ee2(arg0) {
|
404
|
+
const ret = Object.entries(getObject(arg0));
|
405
|
+
return addHeapObject(ret);
|
406
|
+
};
|
407
|
+
|
408
|
+
export function __wbg_buffer_ccaed51a635d8a2d(arg0) {
|
409
|
+
const ret = getObject(arg0).buffer;
|
410
|
+
return addHeapObject(ret);
|
411
|
+
};
|
412
|
+
|
413
|
+
export function __wbg_new_fec2611eb9180f95(arg0) {
|
414
|
+
const ret = new Uint8Array(getObject(arg0));
|
415
|
+
return addHeapObject(ret);
|
416
|
+
};
|
417
|
+
|
418
|
+
export function __wbg_set_ec2fcf81bc573fd9(arg0, arg1, arg2) {
|
419
|
+
getObject(arg0).set(getObject(arg1), arg2 >>> 0);
|
420
|
+
};
|
421
|
+
|
422
|
+
export function __wbg_length_9254c4bd3b9f23c4(arg0) {
|
423
|
+
const ret = getObject(arg0).length;
|
424
|
+
return ret;
|
425
|
+
};
|
426
|
+
|
427
|
+
export function __wbg_instanceof_Uint8Array_df0761410414ef36(arg0) {
|
428
|
+
let result;
|
429
|
+
try {
|
430
|
+
result = getObject(arg0) instanceof Uint8Array;
|
431
|
+
} catch (_) {
|
432
|
+
result = false;
|
433
|
+
}
|
434
|
+
const ret = result;
|
435
|
+
return ret;
|
436
|
+
};
|
437
|
+
|
438
|
+
export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
|
439
|
+
const v = getObject(arg1);
|
440
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
441
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
442
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
443
|
+
};
|
444
|
+
|
445
|
+
export function __wbindgen_debug_string(arg0, arg1) {
|
446
|
+
const ret = debugString(getObject(arg1));
|
447
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
448
|
+
const len1 = WASM_VECTOR_LEN;
|
449
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
450
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
451
|
+
};
|
452
|
+
|
453
|
+
export function __wbindgen_throw(arg0, arg1) {
|
454
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
455
|
+
};
|
456
|
+
|
457
|
+
export function __wbindgen_memory() {
|
458
|
+
const ret = wasm.memory;
|
459
|
+
return addHeapObject(ret);
|
460
|
+
};
|
461
|
+
|
Binary file
|
package/package.json
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "jsontrek",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.3",
|
5
5
|
"files": [
|
6
|
-
"
|
7
|
-
"
|
8
|
-
"
|
6
|
+
"bundle_bg.wasm",
|
7
|
+
"bundle.js",
|
8
|
+
"bundle_bg.js",
|
9
|
+
"bundle.d.ts"
|
9
10
|
],
|
10
|
-
"main": "
|
11
|
-
"types": "
|
11
|
+
"main": "bundle.js",
|
12
|
+
"types": "bundle.d.ts",
|
12
13
|
"sideEffects": [
|
14
|
+
"./bundle.js",
|
13
15
|
"./snippets/*"
|
14
16
|
]
|
15
17
|
}
|
package/web.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
/* tslint:disable */
|
2
|
-
/* eslint-disable */
|
3
|
-
/**
|
4
|
-
* @param {string} obj
|
5
|
-
* @param {string} path
|
6
|
-
* @returns {string}
|
7
|
-
*/
|
8
|
-
export function parse(obj: string, path: string): string;
|
9
|
-
|
10
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
11
|
-
|
12
|
-
export interface InitOutput {
|
13
|
-
readonly memory: WebAssembly.Memory;
|
14
|
-
readonly parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
15
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
16
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
17
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
18
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
19
|
-
}
|
20
|
-
|
21
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
22
|
-
/**
|
23
|
-
* Instantiates the given `module`, which can either be bytes or
|
24
|
-
* a precompiled `WebAssembly.Module`.
|
25
|
-
*
|
26
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
27
|
-
*
|
28
|
-
* @returns {InitOutput}
|
29
|
-
*/
|
30
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
31
|
-
|
32
|
-
/**
|
33
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
34
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
35
|
-
*
|
36
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
37
|
-
*
|
38
|
-
* @returns {Promise<InitOutput>}
|
39
|
-
*/
|
40
|
-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/web.js
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
let wasm;
|
2
|
-
|
3
|
-
let WASM_VECTOR_LEN = 0;
|
4
|
-
|
5
|
-
let cachedUint8ArrayMemory0 = null;
|
6
|
-
|
7
|
-
function getUint8ArrayMemory0() {
|
8
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
9
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
10
|
-
}
|
11
|
-
return cachedUint8ArrayMemory0;
|
12
|
-
}
|
13
|
-
|
14
|
-
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
15
|
-
|
16
|
-
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
17
|
-
? function (arg, view) {
|
18
|
-
return cachedTextEncoder.encodeInto(arg, view);
|
19
|
-
}
|
20
|
-
: function (arg, view) {
|
21
|
-
const buf = cachedTextEncoder.encode(arg);
|
22
|
-
view.set(buf);
|
23
|
-
return {
|
24
|
-
read: arg.length,
|
25
|
-
written: buf.length
|
26
|
-
};
|
27
|
-
});
|
28
|
-
|
29
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
30
|
-
|
31
|
-
if (realloc === undefined) {
|
32
|
-
const buf = cachedTextEncoder.encode(arg);
|
33
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
34
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
35
|
-
WASM_VECTOR_LEN = buf.length;
|
36
|
-
return ptr;
|
37
|
-
}
|
38
|
-
|
39
|
-
let len = arg.length;
|
40
|
-
let ptr = malloc(len, 1) >>> 0;
|
41
|
-
|
42
|
-
const mem = getUint8ArrayMemory0();
|
43
|
-
|
44
|
-
let offset = 0;
|
45
|
-
|
46
|
-
for (; offset < len; offset++) {
|
47
|
-
const code = arg.charCodeAt(offset);
|
48
|
-
if (code > 0x7F) break;
|
49
|
-
mem[ptr + offset] = code;
|
50
|
-
}
|
51
|
-
|
52
|
-
if (offset !== len) {
|
53
|
-
if (offset !== 0) {
|
54
|
-
arg = arg.slice(offset);
|
55
|
-
}
|
56
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
57
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
58
|
-
const ret = encodeString(arg, view);
|
59
|
-
|
60
|
-
offset += ret.written;
|
61
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
62
|
-
}
|
63
|
-
|
64
|
-
WASM_VECTOR_LEN = offset;
|
65
|
-
return ptr;
|
66
|
-
}
|
67
|
-
|
68
|
-
let cachedDataViewMemory0 = null;
|
69
|
-
|
70
|
-
function getDataViewMemory0() {
|
71
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
72
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
73
|
-
}
|
74
|
-
return cachedDataViewMemory0;
|
75
|
-
}
|
76
|
-
|
77
|
-
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
78
|
-
|
79
|
-
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
80
|
-
|
81
|
-
function getStringFromWasm0(ptr, len) {
|
82
|
-
ptr = ptr >>> 0;
|
83
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
84
|
-
}
|
85
|
-
/**
|
86
|
-
* @param {string} obj
|
87
|
-
* @param {string} path
|
88
|
-
* @returns {string}
|
89
|
-
*/
|
90
|
-
export function parse(obj, path) {
|
91
|
-
let deferred3_0;
|
92
|
-
let deferred3_1;
|
93
|
-
try {
|
94
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
95
|
-
const ptr0 = passStringToWasm0(obj, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
96
|
-
const len0 = WASM_VECTOR_LEN;
|
97
|
-
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
98
|
-
const len1 = WASM_VECTOR_LEN;
|
99
|
-
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
100
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
101
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
102
|
-
deferred3_0 = r0;
|
103
|
-
deferred3_1 = r1;
|
104
|
-
return getStringFromWasm0(r0, r1);
|
105
|
-
} finally {
|
106
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
107
|
-
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
async function __wbg_load(module, imports) {
|
112
|
-
if (typeof Response === 'function' && module instanceof Response) {
|
113
|
-
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
114
|
-
try {
|
115
|
-
return await WebAssembly.instantiateStreaming(module, imports);
|
116
|
-
|
117
|
-
} catch (e) {
|
118
|
-
if (module.headers.get('Content-Type') != 'application/wasm') {
|
119
|
-
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);
|
120
|
-
|
121
|
-
} else {
|
122
|
-
throw e;
|
123
|
-
}
|
124
|
-
}
|
125
|
-
}
|
126
|
-
|
127
|
-
const bytes = await module.arrayBuffer();
|
128
|
-
return await WebAssembly.instantiate(bytes, imports);
|
129
|
-
|
130
|
-
} else {
|
131
|
-
const instance = await WebAssembly.instantiate(module, imports);
|
132
|
-
|
133
|
-
if (instance instanceof WebAssembly.Instance) {
|
134
|
-
return { instance, module };
|
135
|
-
|
136
|
-
} else {
|
137
|
-
return instance;
|
138
|
-
}
|
139
|
-
}
|
140
|
-
}
|
141
|
-
|
142
|
-
function __wbg_get_imports() {
|
143
|
-
const imports = {};
|
144
|
-
imports.wbg = {};
|
145
|
-
|
146
|
-
return imports;
|
147
|
-
}
|
148
|
-
|
149
|
-
function __wbg_init_memory(imports, memory) {
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
function __wbg_finalize_init(instance, module) {
|
154
|
-
wasm = instance.exports;
|
155
|
-
__wbg_init.__wbindgen_wasm_module = module;
|
156
|
-
cachedDataViewMemory0 = null;
|
157
|
-
cachedUint8ArrayMemory0 = null;
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
return wasm;
|
162
|
-
}
|
163
|
-
|
164
|
-
function initSync(module) {
|
165
|
-
if (wasm !== undefined) return wasm;
|
166
|
-
|
167
|
-
|
168
|
-
if (typeof module !== 'undefined') {
|
169
|
-
if (Object.getPrototypeOf(module) === Object.prototype) {
|
170
|
-
({module} = module)
|
171
|
-
} else {
|
172
|
-
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
173
|
-
}
|
174
|
-
}
|
175
|
-
|
176
|
-
const imports = __wbg_get_imports();
|
177
|
-
|
178
|
-
__wbg_init_memory(imports);
|
179
|
-
|
180
|
-
if (!(module instanceof WebAssembly.Module)) {
|
181
|
-
module = new WebAssembly.Module(module);
|
182
|
-
}
|
183
|
-
|
184
|
-
const instance = new WebAssembly.Instance(module, imports);
|
185
|
-
|
186
|
-
return __wbg_finalize_init(instance, module);
|
187
|
-
}
|
188
|
-
|
189
|
-
async function __wbg_init(module_or_path) {
|
190
|
-
if (wasm !== undefined) return wasm;
|
191
|
-
|
192
|
-
|
193
|
-
if (typeof module_or_path !== 'undefined') {
|
194
|
-
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
195
|
-
({module_or_path} = module_or_path)
|
196
|
-
} else {
|
197
|
-
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
198
|
-
}
|
199
|
-
}
|
200
|
-
|
201
|
-
if (typeof module_or_path === 'undefined') {
|
202
|
-
module_or_path = new URL('web_bg.wasm', import.meta.url);
|
203
|
-
}
|
204
|
-
const imports = __wbg_get_imports();
|
205
|
-
|
206
|
-
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
207
|
-
module_or_path = fetch(module_or_path);
|
208
|
-
}
|
209
|
-
|
210
|
-
__wbg_init_memory(imports);
|
211
|
-
|
212
|
-
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
213
|
-
|
214
|
-
return __wbg_finalize_init(instance, module);
|
215
|
-
}
|
216
|
-
|
217
|
-
export { initSync };
|
218
|
-
export default __wbg_init;
|