@swc/html-wasm 1.15.13 → 1.15.17

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.
Files changed (4) hide show
  1. package/package.json +6 -2
  2. package/wasm.d.ts +38 -0
  3. package/wasm.js +401 -369
  4. package/wasm_bg.wasm +0 -0
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@swc/html-wasm",
3
+ "type": "module",
3
4
  "collaborators": [
4
5
  "강동윤 <kdy1997.dev@gmail.com>"
5
6
  ],
6
7
  "description": "wasm module for swc html",
7
- "version": "1.15.13",
8
+ "version": "1.15.17",
8
9
  "license": "Apache-2.0",
9
10
  "repository": {
10
11
  "type": "git",
@@ -16,5 +17,8 @@
16
17
  "wasm.d.ts"
17
18
  ],
18
19
  "main": "wasm.js",
19
- "types": "wasm.d.ts"
20
+ "types": "wasm.d.ts",
21
+ "sideEffects": [
22
+ "./snippets/*"
23
+ ]
20
24
  }
package/wasm.d.ts CHANGED
@@ -69,3 +69,41 @@ export function minifyFragment(content: string, options?: FragmentOptions): Prom
69
69
  export function minifyFragmentSync(content: string, options?: FragmentOptions): TransformOutput;
70
70
 
71
71
 
72
+
73
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
74
+
75
+ export interface InitOutput {
76
+ readonly memory: WebAssembly.Memory;
77
+ readonly minify: (a: number, b: number, c: number) => number;
78
+ readonly minifyFragment: (a: number, b: number, c: number) => number;
79
+ readonly minifySync: (a: number, b: number, c: number, d: number) => void;
80
+ readonly minifyFragmentSync: (a: number, b: number, c: number, d: number) => void;
81
+ readonly __wbindgen_export_0: (a: number, b: number) => number;
82
+ readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
83
+ readonly __wbindgen_export_2: (a: number) => void;
84
+ readonly __wbindgen_export_3: WebAssembly.Table;
85
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
86
+ readonly __wbindgen_export_4: (a: number, b: number, c: number) => void;
87
+ readonly __wbindgen_export_5: (a: number, b: number, c: number, d: number) => void;
88
+ }
89
+
90
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
91
+ /**
92
+ * Instantiates the given `module`, which can either be bytes or
93
+ * a precompiled `WebAssembly.Module`.
94
+ *
95
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
96
+ *
97
+ * @returns {InitOutput}
98
+ */
99
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
100
+
101
+ /**
102
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
103
+ * for everything else, calls `WebAssembly.instantiate` directly.
104
+ *
105
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
106
+ *
107
+ * @returns {Promise<InitOutput>}
108
+ */
109
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/wasm.js CHANGED
@@ -1,8 +1,4 @@
1
-
2
- let imports = {};
3
- imports['__wbindgen_placeholder__'] = module.exports;
4
1
  let wasm;
5
- const { TextEncoder, TextDecoder } = require(`util`);
6
2
 
7
3
  const heap = new Array(128).fill(undefined);
8
4
 
@@ -21,7 +17,7 @@ function getUint8ArrayMemory0() {
21
17
  return cachedUint8ArrayMemory0;
22
18
  }
23
19
 
24
- let cachedTextEncoder = new TextEncoder('utf-8');
20
+ const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
25
21
 
26
22
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
27
23
  ? function (arg, view) {
@@ -108,9 +104,9 @@ function getArrayU8FromWasm0(ptr, len) {
108
104
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
109
105
  }
110
106
 
111
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
107
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
112
108
 
113
- cachedTextDecoder.decode();
109
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
114
110
 
115
111
  function getStringFromWasm0(ptr, len) {
116
112
  ptr = ptr >>> 0;
@@ -241,31 +237,31 @@ function debugString(val) {
241
237
  * @param {any} options
242
238
  * @returns {Promise<any>}
243
239
  */
244
- module.exports.minify = function(code, options) {
240
+ export function minify(code, options) {
245
241
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
246
242
  const len0 = WASM_VECTOR_LEN;
247
243
  const ret = wasm.minify(ptr0, len0, addHeapObject(options));
248
244
  return takeObject(ret);
249
- };
245
+ }
250
246
 
251
247
  /**
252
248
  * @param {string} code
253
249
  * @param {any} options
254
250
  * @returns {Promise<any>}
255
251
  */
256
- module.exports.minifyFragment = function(code, options) {
252
+ export function minifyFragment(code, options) {
257
253
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
258
254
  const len0 = WASM_VECTOR_LEN;
259
255
  const ret = wasm.minifyFragment(ptr0, len0, addHeapObject(options));
260
256
  return takeObject(ret);
261
- };
257
+ }
262
258
 
263
259
  /**
264
260
  * @param {string} code
265
261
  * @param {any} options
266
262
  * @returns {any}
267
263
  */
268
- module.exports.minifySync = function(code, options) {
264
+ export function minifySync(code, options) {
269
265
  try {
270
266
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
271
267
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -281,14 +277,14 @@ module.exports.minifySync = function(code, options) {
281
277
  } finally {
282
278
  wasm.__wbindgen_add_to_stack_pointer(16);
283
279
  }
284
- };
280
+ }
285
281
 
286
282
  /**
287
283
  * @param {string} code
288
284
  * @param {any} options
289
285
  * @returns {any}
290
286
  */
291
- module.exports.minifyFragmentSync = function(code, options) {
287
+ export function minifyFragmentSync(code, options) {
292
288
  try {
293
289
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
290
  const ptr0 = passStringToWasm0(code, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
@@ -304,7 +300,7 @@ module.exports.minifyFragmentSync = function(code, options) {
304
300
  } finally {
305
301
  wasm.__wbindgen_add_to_stack_pointer(16);
306
302
  }
307
- };
303
+ }
308
304
 
309
305
  function __wbg_adapter_50(arg0, arg1, arg2) {
310
306
  wasm.__wbindgen_export_4(arg0, arg1, addHeapObject(arg2));
@@ -314,378 +310,414 @@ function __wbg_adapter_101(arg0, arg1, arg2, arg3) {
314
310
  wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
315
311
  }
316
312
 
317
- module.exports.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
318
- const ret = String(getObject(arg1));
319
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
320
- const len1 = WASM_VECTOR_LEN;
321
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
322
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
323
- };
324
-
325
- module.exports.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
326
- const ret = getObject(arg0).buffer;
327
- return addHeapObject(ret);
328
- };
329
-
330
- module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
331
- const ret = getObject(arg0).call(getObject(arg1));
332
- return addHeapObject(ret);
333
- }, arguments) };
334
-
335
- module.exports.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
336
- const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
337
- return addHeapObject(ret);
338
- }, arguments) };
339
-
340
- module.exports.__wbg_done_769e5ede4b31c67b = function(arg0) {
341
- const ret = getObject(arg0).done;
342
- return ret;
343
- };
344
-
345
- module.exports.__wbg_entries_3265d4158b33e5dc = function(arg0) {
346
- const ret = Object.entries(getObject(arg0));
347
- return addHeapObject(ret);
348
- };
349
-
350
- module.exports.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
351
- globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
352
- }, arguments) };
353
-
354
- module.exports.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
355
- const ret = Reflect.get(getObject(arg0), getObject(arg1));
356
- return addHeapObject(ret);
357
- }, arguments) };
358
-
359
- module.exports.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
360
- const ret = getObject(arg0)[arg1 >>> 0];
361
- return addHeapObject(ret);
362
- };
363
-
364
- module.exports.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
365
- const ret = getObject(arg0)[getObject(arg1)];
366
- return addHeapObject(ret);
367
- };
368
-
369
- module.exports.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
370
- let result;
371
- try {
372
- result = getObject(arg0) instanceof ArrayBuffer;
373
- } catch (_) {
374
- result = false;
375
- }
376
- const ret = result;
377
- return ret;
378
- };
313
+ async function __wbg_load(module, imports) {
314
+ if (typeof Response === 'function' && module instanceof Response) {
315
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
316
+ try {
317
+ return await WebAssembly.instantiateStreaming(module, imports);
379
318
 
380
- module.exports.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
381
- let result;
382
- try {
383
- result = getObject(arg0) instanceof Map;
384
- } catch (_) {
385
- result = false;
386
- }
387
- const ret = result;
388
- return ret;
389
- };
319
+ } catch (e) {
320
+ if (module.headers.get('Content-Type') != 'application/wasm') {
321
+ 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);
390
322
 
391
- module.exports.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
392
- let result;
393
- try {
394
- result = getObject(arg0) instanceof Uint8Array;
395
- } catch (_) {
396
- result = false;
323
+ } else {
324
+ throw e;
325
+ }
326
+ }
327
+ }
328
+
329
+ const bytes = await module.arrayBuffer();
330
+ return await WebAssembly.instantiate(bytes, imports);
331
+
332
+ } else {
333
+ const instance = await WebAssembly.instantiate(module, imports);
334
+
335
+ if (instance instanceof WebAssembly.Instance) {
336
+ return { instance, module };
337
+
338
+ } else {
339
+ return instance;
340
+ }
397
341
  }
398
- const ret = result;
399
- return ret;
400
- };
342
+ }
401
343
 
402
- module.exports.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
403
- const ret = Array.isArray(getObject(arg0));
404
- return ret;
405
- };
344
+ function __wbg_get_imports() {
345
+ const imports = {};
346
+ imports.wbg = {};
347
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
348
+ const ret = String(getObject(arg1));
349
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
350
+ const len1 = WASM_VECTOR_LEN;
351
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
352
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
353
+ };
354
+ imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
355
+ const ret = getObject(arg0).buffer;
356
+ return addHeapObject(ret);
357
+ };
358
+ imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
359
+ const ret = getObject(arg0).call(getObject(arg1));
360
+ return addHeapObject(ret);
361
+ }, arguments) };
362
+ imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
363
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
364
+ return addHeapObject(ret);
365
+ }, arguments) };
366
+ imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
367
+ const ret = getObject(arg0).done;
368
+ return ret;
369
+ };
370
+ imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
371
+ const ret = Object.entries(getObject(arg0));
372
+ return addHeapObject(ret);
373
+ };
374
+ imports.wbg.__wbg_getRandomValues_1c61fac11405ffdc = function() { return handleError(function (arg0, arg1) {
375
+ globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
376
+ }, arguments) };
377
+ imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
378
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
379
+ return addHeapObject(ret);
380
+ }, arguments) };
381
+ imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
382
+ const ret = getObject(arg0)[arg1 >>> 0];
383
+ return addHeapObject(ret);
384
+ };
385
+ imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
386
+ const ret = getObject(arg0)[getObject(arg1)];
387
+ return addHeapObject(ret);
388
+ };
389
+ imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
390
+ let result;
391
+ try {
392
+ result = getObject(arg0) instanceof ArrayBuffer;
393
+ } catch (_) {
394
+ result = false;
395
+ }
396
+ const ret = result;
397
+ return ret;
398
+ };
399
+ imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
400
+ let result;
401
+ try {
402
+ result = getObject(arg0) instanceof Map;
403
+ } catch (_) {
404
+ result = false;
405
+ }
406
+ const ret = result;
407
+ return ret;
408
+ };
409
+ imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
410
+ let result;
411
+ try {
412
+ result = getObject(arg0) instanceof Uint8Array;
413
+ } catch (_) {
414
+ result = false;
415
+ }
416
+ const ret = result;
417
+ return ret;
418
+ };
419
+ imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
420
+ const ret = Array.isArray(getObject(arg0));
421
+ return ret;
422
+ };
423
+ imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
424
+ const ret = Number.isSafeInteger(getObject(arg0));
425
+ return ret;
426
+ };
427
+ imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
428
+ const ret = Symbol.iterator;
429
+ return addHeapObject(ret);
430
+ };
431
+ imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
432
+ const ret = getObject(arg0).length;
433
+ return ret;
434
+ };
435
+ imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
436
+ const ret = getObject(arg0).length;
437
+ return ret;
438
+ };
439
+ imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
440
+ try {
441
+ var state0 = {a: arg0, b: arg1};
442
+ var cb0 = (arg0, arg1) => {
443
+ const a = state0.a;
444
+ state0.a = 0;
445
+ try {
446
+ return __wbg_adapter_101(a, state0.b, arg0, arg1);
447
+ } finally {
448
+ state0.a = a;
449
+ }
450
+ };
451
+ const ret = new Promise(cb0);
452
+ return addHeapObject(ret);
453
+ } finally {
454
+ state0.a = state0.b = 0;
455
+ }
456
+ };
457
+ imports.wbg.__wbg_new_405e22f390576ce2 = function() {
458
+ const ret = new Object();
459
+ return addHeapObject(ret);
460
+ };
461
+ imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
462
+ const ret = new Map();
463
+ return addHeapObject(ret);
464
+ };
465
+ imports.wbg.__wbg_new_78feb108b6472713 = function() {
466
+ const ret = new Array();
467
+ return addHeapObject(ret);
468
+ };
469
+ imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
470
+ const ret = new Uint8Array(getObject(arg0));
471
+ return addHeapObject(ret);
472
+ };
473
+ imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
474
+ var v0 = getCachedStringFromWasm0(arg0, arg1);
475
+ const ret = new Function(v0);
476
+ return addHeapObject(ret);
477
+ };
478
+ imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
479
+ const ret = getObject(arg0).next;
480
+ return addHeapObject(ret);
481
+ };
482
+ imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
483
+ const ret = getObject(arg0).next();
484
+ return addHeapObject(ret);
485
+ }, arguments) };
486
+ imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
487
+ queueMicrotask(getObject(arg0));
488
+ };
489
+ imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
490
+ const ret = getObject(arg0).queueMicrotask;
491
+ return addHeapObject(ret);
492
+ };
493
+ imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
494
+ const ret = Promise.resolve(getObject(arg0));
495
+ return addHeapObject(ret);
496
+ };
497
+ imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
498
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
499
+ };
500
+ imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
501
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
502
+ };
503
+ imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
504
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
505
+ };
506
+ imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
507
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
508
+ return addHeapObject(ret);
509
+ };
510
+ imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
511
+ const ret = typeof global === 'undefined' ? null : global;
512
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
513
+ };
514
+ imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
515
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
516
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
517
+ };
518
+ imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
519
+ const ret = typeof self === 'undefined' ? null : self;
520
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
521
+ };
522
+ imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
523
+ const ret = typeof window === 'undefined' ? null : window;
524
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
525
+ };
526
+ imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
527
+ const ret = getObject(arg0).then(getObject(arg1));
528
+ return addHeapObject(ret);
529
+ };
530
+ imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
531
+ const ret = getObject(arg0).value;
532
+ return addHeapObject(ret);
533
+ };
534
+ imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
535
+ const ret = arg0;
536
+ return addHeapObject(ret);
537
+ };
538
+ imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
539
+ const ret = BigInt.asUintN(64, arg0);
540
+ return addHeapObject(ret);
541
+ };
542
+ imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
543
+ const v = getObject(arg1);
544
+ const ret = typeof(v) === 'bigint' ? v : undefined;
545
+ getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
546
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
547
+ };
548
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
549
+ const v = getObject(arg0);
550
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
551
+ return ret;
552
+ };
553
+ imports.wbg.__wbindgen_cb_drop = function(arg0) {
554
+ const obj = takeObject(arg0).original;
555
+ if (obj.cnt-- == 1) {
556
+ obj.a = 0;
557
+ return true;
558
+ }
559
+ const ret = false;
560
+ return ret;
561
+ };
562
+ imports.wbg.__wbindgen_closure_wrapper10136 = function(arg0, arg1, arg2) {
563
+ const ret = makeMutClosure(arg0, arg1, 533, __wbg_adapter_50);
564
+ return addHeapObject(ret);
565
+ };
566
+ imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
567
+ const ret = debugString(getObject(arg1));
568
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
569
+ const len1 = WASM_VECTOR_LEN;
570
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
571
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
572
+ };
573
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
574
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
575
+ return addHeapObject(ret);
576
+ };
577
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
578
+ const ret = getObject(arg0) in getObject(arg1);
579
+ return ret;
580
+ };
581
+ imports.wbg.__wbindgen_is_bigint = function(arg0) {
582
+ const ret = typeof(getObject(arg0)) === 'bigint';
583
+ return ret;
584
+ };
585
+ imports.wbg.__wbindgen_is_function = function(arg0) {
586
+ const ret = typeof(getObject(arg0)) === 'function';
587
+ return ret;
588
+ };
589
+ imports.wbg.__wbindgen_is_null = function(arg0) {
590
+ const ret = getObject(arg0) === null;
591
+ return ret;
592
+ };
593
+ imports.wbg.__wbindgen_is_object = function(arg0) {
594
+ const val = getObject(arg0);
595
+ const ret = typeof(val) === 'object' && val !== null;
596
+ return ret;
597
+ };
598
+ imports.wbg.__wbindgen_is_string = function(arg0) {
599
+ const ret = typeof(getObject(arg0)) === 'string';
600
+ return ret;
601
+ };
602
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
603
+ const ret = getObject(arg0) === undefined;
604
+ return ret;
605
+ };
606
+ imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
607
+ const ret = getObject(arg0) === getObject(arg1);
608
+ return ret;
609
+ };
610
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
611
+ const ret = getObject(arg0) == getObject(arg1);
612
+ return ret;
613
+ };
614
+ imports.wbg.__wbindgen_memory = function() {
615
+ const ret = wasm.memory;
616
+ return addHeapObject(ret);
617
+ };
618
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
619
+ const obj = getObject(arg1);
620
+ const ret = typeof(obj) === 'number' ? obj : undefined;
621
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
622
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
623
+ };
624
+ imports.wbg.__wbindgen_number_new = function(arg0) {
625
+ const ret = arg0;
626
+ return addHeapObject(ret);
627
+ };
628
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
629
+ const ret = getObject(arg0);
630
+ return addHeapObject(ret);
631
+ };
632
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
633
+ takeObject(arg0);
634
+ };
635
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
636
+ const obj = getObject(arg1);
637
+ const ret = typeof(obj) === 'string' ? obj : undefined;
638
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
639
+ var len1 = WASM_VECTOR_LEN;
640
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
641
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
642
+ };
643
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
644
+ const ret = getStringFromWasm0(arg0, arg1);
645
+ return addHeapObject(ret);
646
+ };
647
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
648
+ throw new Error(getStringFromWasm0(arg0, arg1));
649
+ };
406
650
 
407
- module.exports.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
408
- const ret = Number.isSafeInteger(getObject(arg0));
409
- return ret;
410
- };
651
+ return imports;
652
+ }
411
653
 
412
- module.exports.__wbg_iterator_9a24c88df860dc65 = function() {
413
- const ret = Symbol.iterator;
414
- return addHeapObject(ret);
415
- };
654
+ function __wbg_init_memory(imports, memory) {
416
655
 
417
- module.exports.__wbg_length_a446193dc22c12f8 = function(arg0) {
418
- const ret = getObject(arg0).length;
419
- return ret;
420
- };
656
+ }
421
657
 
422
- module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
423
- const ret = getObject(arg0).length;
424
- return ret;
425
- };
658
+ function __wbg_finalize_init(instance, module) {
659
+ wasm = instance.exports;
660
+ __wbg_init.__wbindgen_wasm_module = module;
661
+ cachedDataViewMemory0 = null;
662
+ cachedUint8ArrayMemory0 = null;
426
663
 
427
- module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
428
- try {
429
- var state0 = {a: arg0, b: arg1};
430
- var cb0 = (arg0, arg1) => {
431
- const a = state0.a;
432
- state0.a = 0;
433
- try {
434
- return __wbg_adapter_101(a, state0.b, arg0, arg1);
435
- } finally {
436
- state0.a = a;
437
- }
438
- };
439
- const ret = new Promise(cb0);
440
- return addHeapObject(ret);
441
- } finally {
442
- state0.a = state0.b = 0;
664
+
665
+
666
+ return wasm;
667
+ }
668
+
669
+ function initSync(module) {
670
+ if (wasm !== undefined) return wasm;
671
+
672
+
673
+ if (typeof module !== 'undefined') {
674
+ if (Object.getPrototypeOf(module) === Object.prototype) {
675
+ ({module} = module)
676
+ } else {
677
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
678
+ }
443
679
  }
444
- };
445
-
446
- module.exports.__wbg_new_405e22f390576ce2 = function() {
447
- const ret = new Object();
448
- return addHeapObject(ret);
449
- };
450
-
451
- module.exports.__wbg_new_5e0be73521bc8c17 = function() {
452
- const ret = new Map();
453
- return addHeapObject(ret);
454
- };
455
-
456
- module.exports.__wbg_new_78feb108b6472713 = function() {
457
- const ret = new Array();
458
- return addHeapObject(ret);
459
- };
460
-
461
- module.exports.__wbg_new_a12002a7f91c75be = function(arg0) {
462
- const ret = new Uint8Array(getObject(arg0));
463
- return addHeapObject(ret);
464
- };
465
-
466
- module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
467
- var v0 = getCachedStringFromWasm0(arg0, arg1);
468
- const ret = new Function(v0);
469
- return addHeapObject(ret);
470
- };
471
-
472
- module.exports.__wbg_next_25feadfc0913fea9 = function(arg0) {
473
- const ret = getObject(arg0).next;
474
- return addHeapObject(ret);
475
- };
476
-
477
- module.exports.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
478
- const ret = getObject(arg0).next();
479
- return addHeapObject(ret);
480
- }, arguments) };
481
-
482
- module.exports.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
483
- queueMicrotask(getObject(arg0));
484
- };
485
-
486
- module.exports.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
487
- const ret = getObject(arg0).queueMicrotask;
488
- return addHeapObject(ret);
489
- };
490
-
491
- module.exports.__wbg_resolve_4851785c9c5f573d = function(arg0) {
492
- const ret = Promise.resolve(getObject(arg0));
493
- return addHeapObject(ret);
494
- };
495
-
496
- module.exports.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
497
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
498
- };
499
-
500
- module.exports.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
501
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
502
- };
503
-
504
- module.exports.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
505
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
506
- };
507
-
508
- module.exports.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
509
- const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
510
- return addHeapObject(ret);
511
- };
512
-
513
- module.exports.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
514
- const ret = typeof global === 'undefined' ? null : global;
515
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
516
- };
517
-
518
- module.exports.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
519
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
520
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
521
- };
522
-
523
- module.exports.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
524
- const ret = typeof self === 'undefined' ? null : self;
525
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
526
- };
527
-
528
- module.exports.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
529
- const ret = typeof window === 'undefined' ? null : window;
530
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
531
- };
532
-
533
- module.exports.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
534
- const ret = getObject(arg0).then(getObject(arg1));
535
- return addHeapObject(ret);
536
- };
537
-
538
- module.exports.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
539
- const ret = getObject(arg0).value;
540
- return addHeapObject(ret);
541
- };
542
-
543
- module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
544
- const ret = arg0;
545
- return addHeapObject(ret);
546
- };
547
-
548
- module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
549
- const ret = BigInt.asUintN(64, arg0);
550
- return addHeapObject(ret);
551
- };
552
-
553
- module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
554
- const v = getObject(arg1);
555
- const ret = typeof(v) === 'bigint' ? v : undefined;
556
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
557
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
558
- };
559
-
560
- module.exports.__wbindgen_boolean_get = function(arg0) {
561
- const v = getObject(arg0);
562
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
563
- return ret;
564
- };
565
680
 
566
- module.exports.__wbindgen_cb_drop = function(arg0) {
567
- const obj = takeObject(arg0).original;
568
- if (obj.cnt-- == 1) {
569
- obj.a = 0;
570
- return true;
681
+ const imports = __wbg_get_imports();
682
+
683
+ __wbg_init_memory(imports);
684
+
685
+ if (!(module instanceof WebAssembly.Module)) {
686
+ module = new WebAssembly.Module(module);
571
687
  }
572
- const ret = false;
573
- return ret;
574
- };
575
-
576
- module.exports.__wbindgen_closure_wrapper10133 = function(arg0, arg1, arg2) {
577
- const ret = makeMutClosure(arg0, arg1, 533, __wbg_adapter_50);
578
- return addHeapObject(ret);
579
- };
580
-
581
- module.exports.__wbindgen_debug_string = function(arg0, arg1) {
582
- const ret = debugString(getObject(arg1));
583
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
584
- const len1 = WASM_VECTOR_LEN;
585
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
586
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
587
- };
588
-
589
- module.exports.__wbindgen_error_new = function(arg0, arg1) {
590
- const ret = new Error(getStringFromWasm0(arg0, arg1));
591
- return addHeapObject(ret);
592
- };
593
-
594
- module.exports.__wbindgen_in = function(arg0, arg1) {
595
- const ret = getObject(arg0) in getObject(arg1);
596
- return ret;
597
- };
598
688
 
599
- module.exports.__wbindgen_is_bigint = function(arg0) {
600
- const ret = typeof(getObject(arg0)) === 'bigint';
601
- return ret;
602
- };
689
+ const instance = new WebAssembly.Instance(module, imports);
603
690
 
604
- module.exports.__wbindgen_is_function = function(arg0) {
605
- const ret = typeof(getObject(arg0)) === 'function';
606
- return ret;
607
- };
691
+ return __wbg_finalize_init(instance, module);
692
+ }
608
693
 
609
- module.exports.__wbindgen_is_null = function(arg0) {
610
- const ret = getObject(arg0) === null;
611
- return ret;
612
- };
694
+ async function __wbg_init(module_or_path) {
695
+ if (wasm !== undefined) return wasm;
613
696
 
614
- module.exports.__wbindgen_is_object = function(arg0) {
615
- const val = getObject(arg0);
616
- const ret = typeof(val) === 'object' && val !== null;
617
- return ret;
618
- };
619
697
 
620
- module.exports.__wbindgen_is_string = function(arg0) {
621
- const ret = typeof(getObject(arg0)) === 'string';
622
- return ret;
623
- };
698
+ if (typeof module_or_path !== 'undefined') {
699
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
700
+ ({module_or_path} = module_or_path)
701
+ } else {
702
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
703
+ }
704
+ }
624
705
 
625
- module.exports.__wbindgen_is_undefined = function(arg0) {
626
- const ret = getObject(arg0) === undefined;
627
- return ret;
628
- };
706
+ if (typeof module_or_path === 'undefined') {
707
+ module_or_path = new URL('wasm_bg.wasm', import.meta.url);
708
+ }
709
+ const imports = __wbg_get_imports();
629
710
 
630
- module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
631
- const ret = getObject(arg0) === getObject(arg1);
632
- return ret;
633
- };
711
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
712
+ module_or_path = fetch(module_or_path);
713
+ }
634
714
 
635
- module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
636
- const ret = getObject(arg0) == getObject(arg1);
637
- return ret;
638
- };
639
-
640
- module.exports.__wbindgen_memory = function() {
641
- const ret = wasm.memory;
642
- return addHeapObject(ret);
643
- };
644
-
645
- module.exports.__wbindgen_number_get = function(arg0, arg1) {
646
- const obj = getObject(arg1);
647
- const ret = typeof(obj) === 'number' ? obj : undefined;
648
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
649
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
650
- };
651
-
652
- module.exports.__wbindgen_number_new = function(arg0) {
653
- const ret = arg0;
654
- return addHeapObject(ret);
655
- };
656
-
657
- module.exports.__wbindgen_object_clone_ref = function(arg0) {
658
- const ret = getObject(arg0);
659
- return addHeapObject(ret);
660
- };
661
-
662
- module.exports.__wbindgen_object_drop_ref = function(arg0) {
663
- takeObject(arg0);
664
- };
665
-
666
- module.exports.__wbindgen_string_get = function(arg0, arg1) {
667
- const obj = getObject(arg1);
668
- const ret = typeof(obj) === 'string' ? obj : undefined;
669
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
670
- var len1 = WASM_VECTOR_LEN;
671
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
672
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
673
- };
674
-
675
- module.exports.__wbindgen_string_new = function(arg0, arg1) {
676
- const ret = getStringFromWasm0(arg0, arg1);
677
- return addHeapObject(ret);
678
- };
679
-
680
- module.exports.__wbindgen_throw = function(arg0, arg1) {
681
- throw new Error(getStringFromWasm0(arg0, arg1));
682
- };
683
-
684
- const path = require('path').join(__dirname, 'wasm_bg.wasm');
685
- const bytes = require('fs').readFileSync(path);
686
-
687
- const wasmModule = new WebAssembly.Module(bytes);
688
- const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
689
- wasm = wasmInstance.exports;
690
- module.exports.__wasm = wasm;
715
+ __wbg_init_memory(imports);
716
+
717
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
718
+
719
+ return __wbg_finalize_init(instance, module);
720
+ }
691
721
 
722
+ export { initSync };
723
+ export default __wbg_init;
package/wasm_bg.wasm CHANGED
Binary file