@takumi-rs/wasm 0.53.0 → 0.54.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takumi-rs/wasm",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "keywords": [
5
5
  "image",
6
6
  "rendering",
@@ -86,24 +86,21 @@ export interface InitOutput {
86
86
  readonly memory: WebAssembly.Memory;
87
87
  readonly __wbg_animationframesource_free: (a: number, b: number) => void;
88
88
  readonly __wbg_renderer_free: (a: number, b: number) => void;
89
- readonly animationframesource_new: (a: any, b: number) => number;
90
- readonly collectNodeFetchTasks: (a: any) => [number, number];
89
+ readonly animationframesource_new: (a: number, b: number) => number;
90
+ readonly collectNodeFetchTasks: (a: number, b: number) => void;
91
91
  readonly renderer_clearImageStore: (a: number) => void;
92
- readonly renderer_loadFont: (a: number, b: any) => void;
93
- readonly renderer_loadFontWithInfo: (a: number, b: any) => void;
92
+ readonly renderer_loadFont: (a: number, b: number) => void;
93
+ readonly renderer_loadFontWithInfo: (a: number, b: number) => void;
94
94
  readonly renderer_new: () => number;
95
95
  readonly renderer_putPersistentImage: (a: number, b: number, c: number, d: number, e: number) => void;
96
- readonly renderer_render: (a: number, b: any, c: any) => [number, number];
97
- readonly renderer_renderAnimation: (a: number, b: number, c: number, d: any) => [number, number];
98
- readonly renderer_renderAsDataUrl: (a: number, b: any, c: any) => [number, number];
99
- readonly __wbindgen_malloc: (a: number, b: number) => number;
100
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
101
- readonly __wbindgen_exn_store: (a: number) => void;
102
- readonly __externref_table_alloc: () => number;
103
- readonly __wbindgen_externrefs: WebAssembly.Table;
104
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
105
- readonly __externref_drop_slice: (a: number, b: number) => void;
106
- readonly __wbindgen_start: () => void;
96
+ readonly renderer_render: (a: number, b: number, c: number, d: number) => void;
97
+ readonly renderer_renderAnimation: (a: number, b: number, c: number, d: number, e: number) => void;
98
+ readonly renderer_renderAsDataUrl: (a: number, b: number, c: number, d: number) => void;
99
+ readonly __wbindgen_export: (a: number, b: number) => number;
100
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
101
+ readonly __wbindgen_export3: (a: number) => void;
102
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
103
+ readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
107
104
  }
108
105
 
109
106
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -30,58 +30,25 @@ function getStringFromWasm0(ptr, len) {
30
30
  return decodeText(ptr, len);
31
31
  }
32
32
 
33
- let WASM_VECTOR_LEN = 0;
34
-
35
- const cachedTextEncoder = new TextEncoder();
36
-
37
- if (!('encodeInto' in cachedTextEncoder)) {
38
- cachedTextEncoder.encodeInto = function (arg, view) {
39
- const buf = cachedTextEncoder.encode(arg);
40
- view.set(buf);
41
- return {
42
- read: arg.length,
43
- written: buf.length
44
- };
45
- }
46
- }
47
-
48
- function passStringToWasm0(arg, malloc, realloc) {
49
-
50
- if (realloc === undefined) {
51
- const buf = cachedTextEncoder.encode(arg);
52
- const ptr = malloc(buf.length, 1) >>> 0;
53
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
54
- WASM_VECTOR_LEN = buf.length;
55
- return ptr;
56
- }
57
-
58
- let len = arg.length;
59
- let ptr = malloc(len, 1) >>> 0;
33
+ let heap = new Array(128).fill(undefined);
60
34
 
61
- const mem = getUint8ArrayMemory0();
35
+ heap.push(undefined, null, true, false);
62
36
 
63
- let offset = 0;
37
+ let heap_next = heap.length;
64
38
 
65
- for (; offset < len; offset++) {
66
- const code = arg.charCodeAt(offset);
67
- if (code > 0x7F) break;
68
- mem[ptr + offset] = code;
69
- }
39
+ function addHeapObject(obj) {
40
+ if (heap_next === heap.length) heap.push(heap.length + 1);
41
+ const idx = heap_next;
42
+ heap_next = heap[idx];
70
43
 
71
- if (offset !== len) {
72
- if (offset !== 0) {
73
- arg = arg.slice(offset);
74
- }
75
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
76
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
77
- const ret = cachedTextEncoder.encodeInto(arg, view);
44
+ heap[idx] = obj;
45
+ return idx;
46
+ }
78
47
 
79
- offset += ret.written;
80
- ptr = realloc(ptr, len, offset, 1) >>> 0;
81
- }
48
+ function getObject(idx) { return heap[idx]; }
82
49
 
83
- WASM_VECTOR_LEN = offset;
84
- return ptr;
50
+ function isLikeNone(x) {
51
+ return x === undefined || x === null;
85
52
  }
86
53
 
87
54
  let cachedDataViewMemory0 = null;
@@ -93,10 +60,6 @@ function getDataViewMemory0() {
93
60
  return cachedDataViewMemory0;
94
61
  }
95
62
 
96
- function isLikeNone(x) {
97
- return x === undefined || x === null;
98
- }
99
-
100
63
  function debugString(val) {
101
64
  // primitive types
102
65
  const type = typeof val;
@@ -162,18 +125,77 @@ function debugString(val) {
162
125
  return className;
163
126
  }
164
127
 
165
- function addToExternrefTable0(obj) {
166
- const idx = wasm.__externref_table_alloc();
167
- wasm.__wbindgen_externrefs.set(idx, obj);
168
- return idx;
128
+ let WASM_VECTOR_LEN = 0;
129
+
130
+ const cachedTextEncoder = new TextEncoder();
131
+
132
+ if (!('encodeInto' in cachedTextEncoder)) {
133
+ cachedTextEncoder.encodeInto = function (arg, view) {
134
+ const buf = cachedTextEncoder.encode(arg);
135
+ view.set(buf);
136
+ return {
137
+ read: arg.length,
138
+ written: buf.length
139
+ };
140
+ }
141
+ }
142
+
143
+ function passStringToWasm0(arg, malloc, realloc) {
144
+
145
+ if (realloc === undefined) {
146
+ const buf = cachedTextEncoder.encode(arg);
147
+ const ptr = malloc(buf.length, 1) >>> 0;
148
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
149
+ WASM_VECTOR_LEN = buf.length;
150
+ return ptr;
151
+ }
152
+
153
+ let len = arg.length;
154
+ let ptr = malloc(len, 1) >>> 0;
155
+
156
+ const mem = getUint8ArrayMemory0();
157
+
158
+ let offset = 0;
159
+
160
+ for (; offset < len; offset++) {
161
+ const code = arg.charCodeAt(offset);
162
+ if (code > 0x7F) break;
163
+ mem[ptr + offset] = code;
164
+ }
165
+
166
+ if (offset !== len) {
167
+ if (offset !== 0) {
168
+ arg = arg.slice(offset);
169
+ }
170
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
171
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
172
+ const ret = cachedTextEncoder.encodeInto(arg, view);
173
+
174
+ offset += ret.written;
175
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
176
+ }
177
+
178
+ WASM_VECTOR_LEN = offset;
179
+ return ptr;
180
+ }
181
+
182
+ function dropObject(idx) {
183
+ if (idx < 132) return;
184
+ heap[idx] = heap_next;
185
+ heap_next = idx;
186
+ }
187
+
188
+ function takeObject(idx) {
189
+ const ret = getObject(idx);
190
+ dropObject(idx);
191
+ return ret;
169
192
  }
170
193
 
171
194
  function handleError(f, args) {
172
195
  try {
173
196
  return f.apply(this, args);
174
197
  } catch (e) {
175
- const idx = addToExternrefTable0(e);
176
- wasm.__wbindgen_exn_store(idx);
198
+ wasm.__wbindgen_export3(addHeapObject(e));
177
199
  }
178
200
  }
179
201
 
@@ -187,9 +209,8 @@ function getArrayJsValueFromWasm0(ptr, len) {
187
209
  const mem = getDataViewMemory0();
188
210
  const result = [];
189
211
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
190
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
212
+ result.push(takeObject(mem.getUint32(i, true)));
191
213
  }
192
- wasm.__externref_drop_slice(ptr, len);
193
214
  return result;
194
215
  }
195
216
  /**
@@ -198,17 +219,24 @@ function getArrayJsValueFromWasm0(ptr, len) {
198
219
  * @returns {string[]}
199
220
  */
200
221
  export function collectNodeFetchTasks(node) {
201
- const ret = wasm.collectNodeFetchTasks(node);
202
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
203
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
204
- return v1;
222
+ try {
223
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
224
+ wasm.collectNodeFetchTasks(retptr, addHeapObject(node));
225
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
226
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
227
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
228
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
229
+ return v1;
230
+ } finally {
231
+ wasm.__wbindgen_add_to_stack_pointer(16);
232
+ }
205
233
  }
206
234
 
207
235
  function passArrayJsValueToWasm0(array, malloc) {
208
236
  const ptr = malloc(array.length * 4, 4) >>> 0;
237
+ const mem = getDataViewMemory0();
209
238
  for (let i = 0; i < array.length; i++) {
210
- const add = addToExternrefTable0(array[i]);
211
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
239
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
212
240
  }
213
241
  WASM_VECTOR_LEN = array.length;
214
242
  return ptr;
@@ -250,7 +278,7 @@ export class AnimationFrameSource {
250
278
  * @param {number} durationMs
251
279
  */
252
280
  constructor(node, durationMs) {
253
- const ret = wasm.animationframesource_new(node, durationMs);
281
+ const ret = wasm.animationframesource_new(addHeapObject(node), durationMs);
254
282
  this.__wbg_ptr = ret >>> 0;
255
283
  AnimationFrameSourceFinalization.register(this, this.__wbg_ptr, this);
256
284
  return this;
@@ -281,12 +309,19 @@ export class Renderer {
281
309
  * @returns {Uint8Array}
282
310
  */
283
311
  renderAnimation(frames, options) {
284
- const ptr0 = passArrayJsValueToWasm0(frames, wasm.__wbindgen_malloc);
285
- const len0 = WASM_VECTOR_LEN;
286
- const ret = wasm.renderer_renderAnimation(this.__wbg_ptr, ptr0, len0, options);
287
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
288
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
289
- return v2;
312
+ try {
313
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
314
+ const ptr0 = passArrayJsValueToWasm0(frames, wasm.__wbindgen_export);
315
+ const len0 = WASM_VECTOR_LEN;
316
+ wasm.renderer_renderAnimation(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(options));
317
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
318
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
319
+ var v2 = getArrayU8FromWasm0(r0, r1).slice();
320
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
321
+ return v2;
322
+ } finally {
323
+ wasm.__wbindgen_add_to_stack_pointer(16);
324
+ }
290
325
  }
291
326
  clearImageStore() {
292
327
  wasm.renderer_clearImageStore(this.__wbg_ptr);
@@ -300,12 +335,16 @@ export class Renderer {
300
335
  let deferred1_0;
301
336
  let deferred1_1;
302
337
  try {
303
- const ret = wasm.renderer_renderAsDataUrl(this.__wbg_ptr, node, options);
304
- deferred1_0 = ret[0];
305
- deferred1_1 = ret[1];
306
- return getStringFromWasm0(ret[0], ret[1]);
338
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
339
+ wasm.renderer_renderAsDataUrl(retptr, this.__wbg_ptr, addHeapObject(node), addHeapObject(options));
340
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
341
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
342
+ deferred1_0 = r0;
343
+ deferred1_1 = r1;
344
+ return getStringFromWasm0(r0, r1);
307
345
  } finally {
308
- wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
346
+ wasm.__wbindgen_add_to_stack_pointer(16);
347
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
309
348
  }
310
349
  }
311
350
  /**
@@ -313,16 +352,16 @@ export class Renderer {
313
352
  * @param {Font} font
314
353
  */
315
354
  loadFontWithInfo(font) {
316
- wasm.renderer_loadFontWithInfo(this.__wbg_ptr, font);
355
+ wasm.renderer_loadFontWithInfo(this.__wbg_ptr, addHeapObject(font));
317
356
  }
318
357
  /**
319
358
  * @param {string} src
320
359
  * @param {Uint8Array} data
321
360
  */
322
361
  putPersistentImage(src, data) {
323
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
362
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
324
363
  const len0 = WASM_VECTOR_LEN;
325
- const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
364
+ const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);
326
365
  const len1 = WASM_VECTOR_LEN;
327
366
  wasm.renderer_putPersistentImage(this.__wbg_ptr, ptr0, len0, ptr1, len1);
328
367
  }
@@ -338,16 +377,23 @@ export class Renderer {
338
377
  * @returns {Uint8Array}
339
378
  */
340
379
  render(node, options) {
341
- const ret = wasm.renderer_render(this.__wbg_ptr, node, options);
342
- var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
343
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
344
- return v1;
380
+ try {
381
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
382
+ wasm.renderer_render(retptr, this.__wbg_ptr, addHeapObject(node), addHeapObject(options));
383
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
384
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
385
+ var v1 = getArrayU8FromWasm0(r0, r1).slice();
386
+ wasm.__wbindgen_export4(r0, r1 * 1, 1);
387
+ return v1;
388
+ } finally {
389
+ wasm.__wbindgen_add_to_stack_pointer(16);
390
+ }
345
391
  }
346
392
  /**
347
393
  * @param {Font} font
348
394
  */
349
395
  loadFont(font) {
350
- wasm.renderer_loadFont(this.__wbg_ptr, font);
396
+ wasm.renderer_loadFont(this.__wbg_ptr, addHeapObject(font));
351
397
  }
352
398
  }
353
399
  if (Symbol.dispose) Renderer.prototype[Symbol.dispose] = Renderer.prototype.free;
@@ -392,80 +438,73 @@ function __wbg_get_imports() {
392
438
  imports.wbg = {};
393
439
  imports.wbg.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
394
440
  const ret = Error(getStringFromWasm0(arg0, arg1));
395
- return ret;
441
+ return addHeapObject(ret);
396
442
  };
397
443
  imports.wbg.__wbg_Number_bb48ca12f395cd08 = function(arg0) {
398
- const ret = Number(arg0);
444
+ const ret = Number(getObject(arg0));
399
445
  return ret;
400
446
  };
401
- imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
402
- const ret = String(arg1);
403
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
404
- const len1 = WASM_VECTOR_LEN;
405
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
406
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
407
- };
408
447
  imports.wbg.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
409
- const v = arg1;
448
+ const v = getObject(arg1);
410
449
  const ret = typeof(v) === 'bigint' ? v : undefined;
411
450
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
412
451
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
413
452
  };
414
453
  imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
415
- const v = arg0;
454
+ const v = getObject(arg0);
416
455
  const ret = typeof(v) === 'boolean' ? v : undefined;
417
456
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
418
457
  };
419
458
  imports.wbg.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
420
- const ret = debugString(arg1);
421
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
459
+ const ret = debugString(getObject(arg1));
460
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
422
461
  const len1 = WASM_VECTOR_LEN;
423
462
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
424
463
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
425
464
  };
426
465
  imports.wbg.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
427
- const ret = arg0 in arg1;
466
+ const ret = getObject(arg0) in getObject(arg1);
428
467
  return ret;
429
468
  };
430
469
  imports.wbg.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
431
- const ret = typeof(arg0) === 'bigint';
470
+ const ret = typeof(getObject(arg0)) === 'bigint';
432
471
  return ret;
433
472
  };
434
473
  imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
435
- const ret = typeof(arg0) === 'function';
474
+ const ret = typeof(getObject(arg0)) === 'function';
436
475
  return ret;
437
476
  };
438
477
  imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
439
- const val = arg0;
478
+ const val = getObject(arg0);
440
479
  const ret = typeof(val) === 'object' && val !== null;
441
480
  return ret;
442
481
  };
443
482
  imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
444
- const ret = typeof(arg0) === 'string';
483
+ const ret = typeof(getObject(arg0)) === 'string';
445
484
  return ret;
446
485
  };
447
486
  imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
448
- const ret = arg0 === undefined;
487
+ const ret = getObject(arg0) === undefined;
449
488
  return ret;
450
489
  };
451
490
  imports.wbg.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
452
- const ret = arg0 === arg1;
491
+ const ret = getObject(arg0) === getObject(arg1);
453
492
  return ret;
454
493
  };
455
494
  imports.wbg.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
456
- const ret = arg0 == arg1;
495
+ const ret = getObject(arg0) == getObject(arg1);
457
496
  return ret;
458
497
  };
459
498
  imports.wbg.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
460
- const obj = arg1;
499
+ const obj = getObject(arg1);
461
500
  const ret = typeof(obj) === 'number' ? obj : undefined;
462
501
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
463
502
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
464
503
  };
465
504
  imports.wbg.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
466
- const obj = arg1;
505
+ const obj = getObject(arg1);
467
506
  const ret = typeof(obj) === 'string' ? obj : undefined;
468
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
469
508
  var len1 = WASM_VECTOR_LEN;
470
509
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
471
510
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -474,20 +513,20 @@ function __wbg_get_imports() {
474
513
  throw new Error(getStringFromWasm0(arg0, arg1));
475
514
  };
476
515
  imports.wbg.__wbg_animationframesource_unwrap = function(arg0) {
477
- const ret = AnimationFrameSource.__unwrap(arg0);
516
+ const ret = AnimationFrameSource.__unwrap(takeObject(arg0));
478
517
  return ret;
479
518
  };
480
519
  imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
481
- const ret = arg0.call(arg1);
482
- return ret;
520
+ const ret = getObject(arg0).call(getObject(arg1));
521
+ return addHeapObject(ret);
483
522
  }, arguments) };
484
523
  imports.wbg.__wbg_done_2042aa2670fb1db1 = function(arg0) {
485
- const ret = arg0.done;
524
+ const ret = getObject(arg0).done;
486
525
  return ret;
487
526
  };
488
527
  imports.wbg.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
489
- const ret = Object.entries(arg0);
490
- return ret;
528
+ const ret = Object.entries(getObject(arg0));
529
+ return addHeapObject(ret);
491
530
  };
492
531
  imports.wbg.__wbg_error_a49d63f573cdc73c = function(arg0, arg1) {
493
532
  let deferred0_0;
@@ -497,25 +536,25 @@ function __wbg_get_imports() {
497
536
  deferred0_1 = arg1;
498
537
  console.error(getStringFromWasm0(arg0, arg1));
499
538
  } finally {
500
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
539
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
501
540
  }
502
541
  };
503
542
  imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
504
- const ret = arg0[arg1 >>> 0];
505
- return ret;
543
+ const ret = getObject(arg0)[arg1 >>> 0];
544
+ return addHeapObject(ret);
506
545
  };
507
546
  imports.wbg.__wbg_get_efcb449f58ec27c2 = function() { return handleError(function (arg0, arg1) {
508
- const ret = Reflect.get(arg0, arg1);
509
- return ret;
547
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
548
+ return addHeapObject(ret);
510
549
  }, arguments) };
511
550
  imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
512
- const ret = arg0[arg1];
513
- return ret;
551
+ const ret = getObject(arg0)[getObject(arg1)];
552
+ return addHeapObject(ret);
514
553
  };
515
554
  imports.wbg.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
516
555
  let result;
517
556
  try {
518
- result = arg0 instanceof ArrayBuffer;
557
+ result = getObject(arg0) instanceof ArrayBuffer;
519
558
  } catch (_) {
520
559
  result = false;
521
560
  }
@@ -525,7 +564,7 @@ function __wbg_get_imports() {
525
564
  imports.wbg.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
526
565
  let result;
527
566
  try {
528
- result = arg0 instanceof Map;
567
+ result = getObject(arg0) instanceof Map;
529
568
  } catch (_) {
530
569
  result = false;
531
570
  }
@@ -535,7 +574,7 @@ function __wbg_get_imports() {
535
574
  imports.wbg.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
536
575
  let result;
537
576
  try {
538
- result = arg0 instanceof Uint8Array;
577
+ result = getObject(arg0) instanceof Uint8Array;
539
578
  } catch (_) {
540
579
  result = false;
541
580
  }
@@ -543,68 +582,65 @@ function __wbg_get_imports() {
543
582
  return ret;
544
583
  };
545
584
  imports.wbg.__wbg_isArray_96e0af9891d0945d = function(arg0) {
546
- const ret = Array.isArray(arg0);
585
+ const ret = Array.isArray(getObject(arg0));
547
586
  return ret;
548
587
  };
549
588
  imports.wbg.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
550
- const ret = Number.isSafeInteger(arg0);
589
+ const ret = Number.isSafeInteger(getObject(arg0));
551
590
  return ret;
552
591
  };
553
592
  imports.wbg.__wbg_iterator_e5822695327a3c39 = function() {
554
593
  const ret = Symbol.iterator;
555
- return ret;
594
+ return addHeapObject(ret);
556
595
  };
557
596
  imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
558
- const ret = arg0.length;
597
+ const ret = getObject(arg0).length;
559
598
  return ret;
560
599
  };
561
600
  imports.wbg.__wbg_length_cdd215e10d9dd507 = function(arg0) {
562
- const ret = arg0.length;
601
+ const ret = getObject(arg0).length;
563
602
  return ret;
564
603
  };
565
604
  imports.wbg.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
566
- const ret = new Uint8Array(arg0);
567
- return ret;
605
+ const ret = new Uint8Array(getObject(arg0));
606
+ return addHeapObject(ret);
568
607
  };
569
608
  imports.wbg.__wbg_next_020810e0ae8ebcb0 = function() { return handleError(function (arg0) {
570
- const ret = arg0.next();
571
- return ret;
609
+ const ret = getObject(arg0).next();
610
+ return addHeapObject(ret);
572
611
  }, arguments) };
573
612
  imports.wbg.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
574
- const ret = arg0.next;
575
- return ret;
613
+ const ret = getObject(arg0).next;
614
+ return addHeapObject(ret);
576
615
  };
577
616
  imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
578
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
617
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
579
618
  };
580
619
  imports.wbg.__wbg_value_692627309814bb8c = function(arg0) {
581
- const ret = arg0.value;
582
- return ret;
620
+ const ret = getObject(arg0).value;
621
+ return addHeapObject(ret);
583
622
  };
584
623
  imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
585
624
  // Cast intrinsic for `Ref(String) -> Externref`.
586
625
  const ret = getStringFromWasm0(arg0, arg1);
587
- return ret;
626
+ return addHeapObject(ret);
588
627
  };
589
628
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
590
629
  // Cast intrinsic for `U64 -> Externref`.
591
630
  const ret = BigInt.asUintN(64, arg0);
592
- return ret;
631
+ return addHeapObject(ret);
593
632
  };
594
633
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
595
634
  // Cast intrinsic for `I64 -> Externref`.
596
635
  const ret = arg0;
597
- return ret;
636
+ return addHeapObject(ret);
598
637
  };
599
- imports.wbg.__wbindgen_init_externref_table = function() {
600
- const table = wasm.__wbindgen_externrefs;
601
- const offset = table.grow(4);
602
- table.set(0, undefined);
603
- table.set(offset + 0, undefined);
604
- table.set(offset + 1, null);
605
- table.set(offset + 2, true);
606
- table.set(offset + 3, false);
607
- ;
638
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
639
+ const ret = getObject(arg0);
640
+ return addHeapObject(ret);
641
+ };
642
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
643
+ takeObject(arg0);
608
644
  };
609
645
 
610
646
  return imports;
@@ -617,7 +653,7 @@ function __wbg_finalize_init(instance, module) {
617
653
  cachedUint8ArrayMemory0 = null;
618
654
 
619
655
 
620
- wasm.__wbindgen_start();
656
+
621
657
  return wasm;
622
658
  }
623
659
 
Binary file
@@ -3,21 +3,18 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const __wbg_animationframesource_free: (a: number, b: number) => void;
5
5
  export const __wbg_renderer_free: (a: number, b: number) => void;
6
- export const animationframesource_new: (a: any, b: number) => number;
7
- export const collectNodeFetchTasks: (a: any) => [number, number];
6
+ export const animationframesource_new: (a: number, b: number) => number;
7
+ export const collectNodeFetchTasks: (a: number, b: number) => void;
8
8
  export const renderer_clearImageStore: (a: number) => void;
9
- export const renderer_loadFont: (a: number, b: any) => void;
10
- export const renderer_loadFontWithInfo: (a: number, b: any) => void;
9
+ export const renderer_loadFont: (a: number, b: number) => void;
10
+ export const renderer_loadFontWithInfo: (a: number, b: number) => void;
11
11
  export const renderer_new: () => number;
12
12
  export const renderer_putPersistentImage: (a: number, b: number, c: number, d: number, e: number) => void;
13
- export const renderer_render: (a: number, b: any, c: any) => [number, number];
14
- export const renderer_renderAnimation: (a: number, b: number, c: number, d: any) => [number, number];
15
- export const renderer_renderAsDataUrl: (a: number, b: any, c: any) => [number, number];
16
- export const __wbindgen_malloc: (a: number, b: number) => number;
17
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
18
- export const __wbindgen_exn_store: (a: number) => void;
19
- export const __externref_table_alloc: () => number;
20
- export const __wbindgen_externrefs: WebAssembly.Table;
21
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
22
- export const __externref_drop_slice: (a: number, b: number) => void;
23
- export const __wbindgen_start: () => void;
13
+ export const renderer_render: (a: number, b: number, c: number, d: number) => void;
14
+ export const renderer_renderAnimation: (a: number, b: number, c: number, d: number, e: number) => void;
15
+ export const renderer_renderAsDataUrl: (a: number, b: number, c: number, d: number) => void;
16
+ export const __wbindgen_export: (a: number, b: number) => number;
17
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
18
+ export const __wbindgen_export3: (a: number) => void;
19
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
20
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;