@tombi-toml/wasm-lib 0.0.0-bootstrap.0 → 1.4.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/dist/index.d.ts CHANGED
@@ -59,6 +59,6 @@ export function lint(
59
59
  ): Promise<LintResult>;
60
60
 
61
61
  /** An error reported when an operation cannot be executed. */
62
- export interface TombiWasmError {
63
- error: string;
62
+ export interface TombiWasmError extends Error {
63
+ readonly name: "TombiWasmError";
64
64
  }
package/dist/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "ya7010 <ya7010@outlook.com>"
6
6
  ],
7
7
  "description": "Tombi formatter, linter, and language server for WebAssembly",
8
- "version": "0.0.0-dev",
8
+ "version": "1.4.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- export function start(): void;
4
- export function lint(source: string, source_path: string, options: any): Promise<any>;
5
3
  export function format(source: string, source_path: string, options: any): Promise<any>;
4
+ export function lint(source: string, source_path: string, options: any): Promise<any>;
5
+ export function start(): void;
6
6
  export class Diagnostic {
7
7
  private constructor();
8
8
  free(): void;
@@ -24,29 +24,27 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
24
24
 
25
25
  export interface InitOutput {
26
26
  readonly memory: WebAssembly.Memory;
27
+ readonly format: (a: number, b: number, c: number, d: number, e: number) => number;
28
+ readonly lint: (a: number, b: number, c: number, d: number, e: number) => number;
27
29
  readonly start: () => void;
28
- readonly format: (a: number, b: number, c: number, d: number, e: any) => any;
29
- readonly lint: (a: number, b: number, c: number, d: number, e: any) => any;
30
30
  readonly __wbg_diagnostic_free: (a: number, b: number) => void;
31
31
  readonly __wbg_get_position_column: (a: number) => number;
32
32
  readonly __wbg_get_position_line: (a: number) => number;
33
- readonly __wbg_position_free: (a: number, b: number) => void;
34
- readonly __wbg_set_position_column: (a: number, b: number) => void;
35
- readonly __wbg_set_position_line: (a: number, b: number) => void;
36
33
  readonly __wbg_get_range_end: (a: number) => number;
37
34
  readonly __wbg_get_range_start: (a: number) => number;
35
+ readonly __wbg_position_free: (a: number, b: number) => void;
38
36
  readonly __wbg_range_free: (a: number, b: number) => void;
37
+ readonly __wbg_set_position_column: (a: number, b: number) => void;
38
+ readonly __wbg_set_position_line: (a: number, b: number) => void;
39
39
  readonly __wbg_set_range_end: (a: number, b: number) => void;
40
40
  readonly __wbg_set_range_start: (a: number, b: number) => void;
41
- readonly __wbindgen_malloc: (a: number, b: number) => number;
42
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
43
- readonly __wbindgen_exn_store: (a: number) => void;
44
- readonly __externref_table_alloc: () => number;
41
+ readonly __wbindgen_export_0: (a: number, b: number) => number;
42
+ readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
43
+ readonly __wbindgen_export_2: (a: number) => void;
44
+ readonly __wbindgen_export_3: (a: number, b: number, c: number) => void;
45
45
  readonly __wbindgen_export_4: WebAssembly.Table;
46
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
47
- readonly __wbindgen_export_6: WebAssembly.Table;
48
- readonly closure2776_externref_shim: (a: number, b: number, c: any) => void;
49
- readonly closure2805_externref_shim: (a: number, b: number, c: any, d: any) => void;
46
+ readonly __wbindgen_export_5: (a: number, b: number, c: number) => void;
47
+ readonly __wbindgen_export_6: (a: number, b: number, c: number, d: number) => void;
50
48
  readonly __wbindgen_start: () => void;
51
49
  }
52
50
 
@@ -1,5 +1,11 @@
1
1
  let wasm;
2
2
 
3
+ const heap = new Array(128).fill(undefined);
4
+
5
+ heap.push(undefined, null, true, false);
6
+
7
+ function getObject(idx) { return heap[idx]; }
8
+
3
9
  let WASM_VECTOR_LEN = 0;
4
10
 
5
11
  let cachedUint8ArrayMemory0 = null;
@@ -74,9 +80,14 @@ function getDataViewMemory0() {
74
80
  return cachedDataViewMemory0;
75
81
  }
76
82
 
77
- function addToExternrefTable0(obj) {
78
- const idx = wasm.__externref_table_alloc();
79
- wasm.__wbindgen_export_4.set(idx, obj);
83
+ let heap_next = heap.length;
84
+
85
+ function addHeapObject(obj) {
86
+ if (heap_next === heap.length) heap.push(heap.length + 1);
87
+ const idx = heap_next;
88
+ heap_next = heap[idx];
89
+
90
+ heap[idx] = obj;
80
91
  return idx;
81
92
  }
82
93
 
@@ -84,8 +95,7 @@ function handleError(f, args) {
84
95
  try {
85
96
  return f.apply(this, args);
86
97
  } catch (e) {
87
- const idx = addToExternrefTable0(e);
88
- wasm.__wbindgen_exn_store(idx);
98
+ wasm.__wbindgen_export_2(addHeapObject(e));
89
99
  }
90
100
  }
91
101
 
@@ -103,6 +113,18 @@ function getArrayU8FromWasm0(ptr, len) {
103
113
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
104
114
  }
105
115
 
116
+ function dropObject(idx) {
117
+ if (idx < 132) return;
118
+ heap[idx] = heap_next;
119
+ heap_next = idx;
120
+ }
121
+
122
+ function takeObject(idx) {
123
+ const ret = getObject(idx);
124
+ dropObject(idx);
125
+ return ret;
126
+ }
127
+
106
128
  function isLikeNone(x) {
107
129
  return x === undefined || x === null;
108
130
  }
@@ -110,7 +132,7 @@ function isLikeNone(x) {
110
132
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
111
133
  ? { register: () => {}, unregister: () => {} }
112
134
  : new FinalizationRegistry(state => {
113
- wasm.__wbindgen_export_6.get(state.dtor)(state.a, state.b)
135
+ wasm.__wbindgen_export_4.get(state.dtor)(state.a, state.b)
114
136
  });
115
137
 
116
138
  function makeMutClosure(arg0, arg1, dtor, f) {
@@ -126,7 +148,7 @@ function makeMutClosure(arg0, arg1, dtor, f) {
126
148
  return f(a, state.b, ...args);
127
149
  } finally {
128
150
  if (--state.cnt === 0) {
129
- wasm.__wbindgen_export_6.get(state.dtor)(a, state.b);
151
+ wasm.__wbindgen_export_4.get(state.dtor)(a, state.b);
130
152
  CLOSURE_DTORS.unregister(state);
131
153
  } else {
132
154
  state.a = a;
@@ -202,24 +224,19 @@ function debugString(val) {
202
224
  // TODO we could test for more things here, like `Set`s and `Map`s.
203
225
  return className;
204
226
  }
205
-
206
- export function start() {
207
- wasm.start();
208
- }
209
-
210
227
  /**
211
228
  * @param {string} source
212
229
  * @param {string} source_path
213
230
  * @param {any} options
214
231
  * @returns {Promise<any>}
215
232
  */
216
- export function lint(source, source_path, options) {
217
- const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
233
+ export function format(source, source_path, options) {
234
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
218
235
  const len0 = WASM_VECTOR_LEN;
219
- const ptr1 = passStringToWasm0(source_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
236
+ const ptr1 = passStringToWasm0(source_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
220
237
  const len1 = WASM_VECTOR_LEN;
221
- const ret = wasm.lint(ptr0, len0, ptr1, len1, options);
222
- return ret;
238
+ const ret = wasm.format(ptr0, len0, ptr1, len1, addHeapObject(options));
239
+ return takeObject(ret);
223
240
  }
224
241
 
225
242
  /**
@@ -228,13 +245,17 @@ export function lint(source, source_path, options) {
228
245
  * @param {any} options
229
246
  * @returns {Promise<any>}
230
247
  */
231
- export function format(source, source_path, options) {
232
- const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
248
+ export function lint(source, source_path, options) {
249
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
233
250
  const len0 = WASM_VECTOR_LEN;
234
- const ptr1 = passStringToWasm0(source_path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
251
+ const ptr1 = passStringToWasm0(source_path, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
235
252
  const len1 = WASM_VECTOR_LEN;
236
- const ret = wasm.format(ptr0, len0, ptr1, len1, options);
237
- return ret;
253
+ const ret = wasm.lint(ptr0, len0, ptr1, len1, addHeapObject(options));
254
+ return takeObject(ret);
255
+ }
256
+
257
+ export function start() {
258
+ wasm.start();
238
259
  }
239
260
 
240
261
  function _assertClass(instance, klass) {
@@ -242,12 +263,12 @@ function _assertClass(instance, klass) {
242
263
  throw new Error(`expected instance of ${klass.name}`);
243
264
  }
244
265
  }
245
- function __wbg_adapter_52(arg0, arg1, arg2) {
246
- wasm.closure2776_externref_shim(arg0, arg1, arg2);
266
+ function __wbg_adapter_50(arg0, arg1, arg2) {
267
+ wasm.__wbindgen_export_5(arg0, arg1, addHeapObject(arg2));
247
268
  }
248
269
 
249
- function __wbg_adapter_148(arg0, arg1, arg2, arg3) {
250
- wasm.closure2805_externref_shim(arg0, arg1, arg2, arg3);
270
+ function __wbg_adapter_150(arg0, arg1, arg2, arg3) {
271
+ wasm.__wbindgen_export_6(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
251
272
  }
252
273
 
253
274
  const DiagnosticFinalization = (typeof FinalizationRegistry === 'undefined')
@@ -406,35 +427,35 @@ function __wbg_get_imports() {
406
427
  const imports = {};
407
428
  imports.wbg = {};
408
429
  imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
409
- const ret = String(arg1);
410
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
430
+ const ret = String(getObject(arg1));
431
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
411
432
  const len1 = WASM_VECTOR_LEN;
412
433
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
413
434
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
414
435
  };
415
436
  imports.wbg.__wbg_arrayBuffer_d1b44c4390db422f = function() { return handleError(function (arg0) {
416
- const ret = arg0.arrayBuffer();
417
- return ret;
437
+ const ret = getObject(arg0).arrayBuffer();
438
+ return addHeapObject(ret);
418
439
  }, arguments) };
419
440
  imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) {
420
- const ret = arg0.buffer;
421
- return ret;
441
+ const ret = getObject(arg0).buffer;
442
+ return addHeapObject(ret);
422
443
  };
423
444
  imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
424
- const ret = arg0.call(arg1);
425
- return ret;
445
+ const ret = getObject(arg0).call(getObject(arg1));
446
+ return addHeapObject(ret);
426
447
  }, arguments) };
427
448
  imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) {
428
- const ret = arg0.call(arg1, arg2);
429
- return ret;
449
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
450
+ return addHeapObject(ret);
430
451
  }, arguments) };
431
452
  imports.wbg.__wbg_done_769e5ede4b31c67b = function(arg0) {
432
- const ret = arg0.done;
453
+ const ret = getObject(arg0).done;
433
454
  return ret;
434
455
  };
435
456
  imports.wbg.__wbg_entries_3265d4158b33e5dc = function(arg0) {
436
- const ret = Object.entries(arg0);
437
- return ret;
457
+ const ret = Object.entries(getObject(arg0));
458
+ return addHeapObject(ret);
438
459
  };
439
460
  imports.wbg.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
440
461
  let deferred0_0;
@@ -444,32 +465,32 @@ function __wbg_get_imports() {
444
465
  deferred0_1 = arg1;
445
466
  console.error(getStringFromWasm0(arg0, arg1));
446
467
  } finally {
447
- wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
468
+ wasm.__wbindgen_export_3(deferred0_0, deferred0_1, 1);
448
469
  }
449
470
  };
450
471
  imports.wbg.__wbg_fetch_a9bc66c159c18e19 = function(arg0) {
451
- const ret = fetch(arg0);
452
- return ret;
472
+ const ret = fetch(getObject(arg0));
473
+ return addHeapObject(ret);
453
474
  };
454
475
  imports.wbg.__wbg_getRandomValues_3c9c0d586e575a16 = function() { return handleError(function (arg0, arg1) {
455
476
  globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
456
477
  }, arguments) };
457
478
  imports.wbg.__wbg_get_67b2ba62fc30de12 = function() { return handleError(function (arg0, arg1) {
458
- const ret = Reflect.get(arg0, arg1);
459
- return ret;
479
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
480
+ return addHeapObject(ret);
460
481
  }, arguments) };
461
482
  imports.wbg.__wbg_get_b9b93047fe3cf45b = function(arg0, arg1) {
462
- const ret = arg0[arg1 >>> 0];
463
- return ret;
483
+ const ret = getObject(arg0)[arg1 >>> 0];
484
+ return addHeapObject(ret);
464
485
  };
465
486
  imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
466
- const ret = arg0[arg1];
467
- return ret;
487
+ const ret = getObject(arg0)[getObject(arg1)];
488
+ return addHeapObject(ret);
468
489
  };
469
490
  imports.wbg.__wbg_instanceof_ArrayBuffer_e14585432e3737fc = function(arg0) {
470
491
  let result;
471
492
  try {
472
- result = arg0 instanceof ArrayBuffer;
493
+ result = getObject(arg0) instanceof ArrayBuffer;
473
494
  } catch (_) {
474
495
  result = false;
475
496
  }
@@ -479,7 +500,7 @@ function __wbg_get_imports() {
479
500
  imports.wbg.__wbg_instanceof_Error_4d54113b22d20306 = function(arg0) {
480
501
  let result;
481
502
  try {
482
- result = arg0 instanceof Error;
503
+ result = getObject(arg0) instanceof Error;
483
504
  } catch (_) {
484
505
  result = false;
485
506
  }
@@ -489,7 +510,7 @@ function __wbg_get_imports() {
489
510
  imports.wbg.__wbg_instanceof_Map_f3469ce2244d2430 = function(arg0) {
490
511
  let result;
491
512
  try {
492
- result = arg0 instanceof Map;
513
+ result = getObject(arg0) instanceof Map;
493
514
  } catch (_) {
494
515
  result = false;
495
516
  }
@@ -499,7 +520,7 @@ function __wbg_get_imports() {
499
520
  imports.wbg.__wbg_instanceof_Response_f2cc20d9f7dfd644 = function(arg0) {
500
521
  let result;
501
522
  try {
502
- result = arg0 instanceof Response;
523
+ result = getObject(arg0) instanceof Response;
503
524
  } catch (_) {
504
525
  result = false;
505
526
  }
@@ -509,7 +530,7 @@ function __wbg_get_imports() {
509
530
  imports.wbg.__wbg_instanceof_Uint8Array_17156bcf118086a9 = function(arg0) {
510
531
  let result;
511
532
  try {
512
- result = arg0 instanceof Uint8Array;
533
+ result = getObject(arg0) instanceof Uint8Array;
513
534
  } catch (_) {
514
535
  result = false;
515
536
  }
@@ -517,36 +538,36 @@ function __wbg_get_imports() {
517
538
  return ret;
518
539
  };
519
540
  imports.wbg.__wbg_isArray_a1eab7e0d067391b = function(arg0) {
520
- const ret = Array.isArray(arg0);
541
+ const ret = Array.isArray(getObject(arg0));
521
542
  return ret;
522
543
  };
523
544
  imports.wbg.__wbg_isSafeInteger_343e2beeeece1bb0 = function(arg0) {
524
- const ret = Number.isSafeInteger(arg0);
545
+ const ret = Number.isSafeInteger(getObject(arg0));
525
546
  return ret;
526
547
  };
527
548
  imports.wbg.__wbg_iterator_9a24c88df860dc65 = function() {
528
549
  const ret = Symbol.iterator;
529
- return ret;
550
+ return addHeapObject(ret);
530
551
  };
531
552
  imports.wbg.__wbg_length_a446193dc22c12f8 = function(arg0) {
532
- const ret = arg0.length;
553
+ const ret = getObject(arg0).length;
533
554
  return ret;
534
555
  };
535
556
  imports.wbg.__wbg_length_e2d2a49132c1b256 = function(arg0) {
536
- const ret = arg0.length;
557
+ const ret = getObject(arg0).length;
537
558
  return ret;
538
559
  };
539
560
  imports.wbg.__wbg_message_97a2af9b89d693a3 = function(arg0) {
540
- const ret = arg0.message;
541
- return ret;
561
+ const ret = getObject(arg0).message;
562
+ return addHeapObject(ret);
542
563
  };
543
564
  imports.wbg.__wbg_name_0b327d569f00ebee = function(arg0) {
544
- const ret = arg0.name;
545
- return ret;
565
+ const ret = getObject(arg0).name;
566
+ return addHeapObject(ret);
546
567
  };
547
568
  imports.wbg.__wbg_new_018dcc2d6c8c2f6a = function() { return handleError(function () {
548
569
  const ret = new Headers();
549
- return ret;
570
+ return addHeapObject(ret);
550
571
  }, arguments) };
551
572
  imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
552
573
  try {
@@ -555,184 +576,191 @@ function __wbg_get_imports() {
555
576
  const a = state0.a;
556
577
  state0.a = 0;
557
578
  try {
558
- return __wbg_adapter_148(a, state0.b, arg0, arg1);
579
+ return __wbg_adapter_150(a, state0.b, arg0, arg1);
559
580
  } finally {
560
581
  state0.a = a;
561
582
  }
562
583
  };
563
584
  const ret = new Promise(cb0);
564
- return ret;
585
+ return addHeapObject(ret);
565
586
  } finally {
566
587
  state0.a = state0.b = 0;
567
588
  }
568
589
  };
569
590
  imports.wbg.__wbg_new_405e22f390576ce2 = function() {
570
591
  const ret = new Object();
571
- return ret;
592
+ return addHeapObject(ret);
572
593
  };
573
594
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
574
595
  const ret = new Map();
575
- return ret;
596
+ return addHeapObject(ret);
576
597
  };
577
598
  imports.wbg.__wbg_new_78feb108b6472713 = function() {
578
599
  const ret = new Array();
579
- return ret;
600
+ return addHeapObject(ret);
580
601
  };
581
602
  imports.wbg.__wbg_new_80bf4ee74f41ff92 = function() { return handleError(function () {
582
603
  const ret = new URLSearchParams();
583
- return ret;
604
+ return addHeapObject(ret);
584
605
  }, arguments) };
585
606
  imports.wbg.__wbg_new_8a6f238a6ece86ea = function() {
586
607
  const ret = new Error();
587
- return ret;
608
+ return addHeapObject(ret);
588
609
  };
589
610
  imports.wbg.__wbg_new_9ffbe0a71eff35e3 = function() { return handleError(function (arg0, arg1) {
590
611
  const ret = new URL(getStringFromWasm0(arg0, arg1));
591
- return ret;
612
+ return addHeapObject(ret);
592
613
  }, arguments) };
593
614
  imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) {
594
- const ret = new Uint8Array(arg0);
595
- return ret;
615
+ const ret = new Uint8Array(getObject(arg0));
616
+ return addHeapObject(ret);
617
+ };
618
+ imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
619
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
620
+ return addHeapObject(ret);
596
621
  };
597
622
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
598
623
  const ret = new Function(getStringFromWasm0(arg0, arg1));
599
- return ret;
624
+ return addHeapObject(ret);
600
625
  };
601
626
  imports.wbg.__wbg_newwithstr_78e86e03c4ae814e = function() { return handleError(function (arg0, arg1) {
602
627
  const ret = new Request(getStringFromWasm0(arg0, arg1));
603
- return ret;
628
+ return addHeapObject(ret);
604
629
  }, arguments) };
605
630
  imports.wbg.__wbg_newwithstrandinit_06c535e0a867c635 = function() { return handleError(function (arg0, arg1, arg2) {
606
- const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
607
- return ret;
631
+ const ret = new Request(getStringFromWasm0(arg0, arg1), getObject(arg2));
632
+ return addHeapObject(ret);
608
633
  }, arguments) };
609
634
  imports.wbg.__wbg_next_25feadfc0913fea9 = function(arg0) {
610
- const ret = arg0.next;
611
- return ret;
635
+ const ret = getObject(arg0).next;
636
+ return addHeapObject(ret);
612
637
  };
613
638
  imports.wbg.__wbg_next_6574e1a8a62d1055 = function() { return handleError(function (arg0) {
614
- const ret = arg0.next();
615
- return ret;
639
+ const ret = getObject(arg0).next();
640
+ return addHeapObject(ret);
616
641
  }, arguments) };
617
642
  imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) {
618
- queueMicrotask(arg0);
643
+ queueMicrotask(getObject(arg0));
619
644
  };
620
645
  imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) {
621
- const ret = arg0.queueMicrotask;
622
- return ret;
646
+ const ret = getObject(arg0).queueMicrotask;
647
+ return addHeapObject(ret);
623
648
  };
624
649
  imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) {
625
- const ret = Promise.resolve(arg0);
626
- return ret;
650
+ const ret = Promise.resolve(getObject(arg0));
651
+ return addHeapObject(ret);
627
652
  };
628
653
  imports.wbg.__wbg_search_e0e79cfe010c5c23 = function(arg0, arg1) {
629
- const ret = arg1.search;
630
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
654
+ const ret = getObject(arg1).search;
655
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
631
656
  const len1 = WASM_VECTOR_LEN;
632
657
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
633
658
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
634
659
  };
635
660
  imports.wbg.__wbg_set_37837023f3d740e8 = function(arg0, arg1, arg2) {
636
- arg0[arg1 >>> 0] = arg2;
661
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
637
662
  };
638
663
  imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
639
- arg0[arg1] = arg2;
664
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
640
665
  };
641
666
  imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) {
642
- arg0.set(arg1, arg2 >>> 0);
667
+ getObject(arg0).set(getObject(arg1), arg2 >>> 0);
643
668
  };
644
669
  imports.wbg.__wbg_set_8fc6bf8a5b1071d1 = function(arg0, arg1, arg2) {
645
- const ret = arg0.set(arg1, arg2);
646
- return ret;
670
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
671
+ return addHeapObject(ret);
647
672
  };
648
673
  imports.wbg.__wbg_set_bb8cecf6a62b9f46 = function() { return handleError(function (arg0, arg1, arg2) {
649
- const ret = Reflect.set(arg0, arg1, arg2);
674
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
650
675
  return ret;
651
676
  }, arguments) };
652
677
  imports.wbg.__wbg_setheaders_834c0bdb6a8949ad = function(arg0, arg1) {
653
- arg0.headers = arg1;
678
+ getObject(arg0).headers = getObject(arg1);
654
679
  };
655
680
  imports.wbg.__wbg_setmethod_3c5280fe5d890842 = function(arg0, arg1, arg2) {
656
- arg0.method = getStringFromWasm0(arg1, arg2);
681
+ getObject(arg0).method = getStringFromWasm0(arg1, arg2);
682
+ };
683
+ imports.wbg.__wbg_setname_6df54b7ebf9404a9 = function(arg0, arg1, arg2) {
684
+ getObject(arg0).name = getStringFromWasm0(arg1, arg2);
657
685
  };
658
686
  imports.wbg.__wbg_setsearch_609451e9e712f3c6 = function(arg0, arg1, arg2) {
659
- arg0.search = getStringFromWasm0(arg1, arg2);
687
+ getObject(arg0).search = getStringFromWasm0(arg1, arg2);
660
688
  };
661
689
  imports.wbg.__wbg_stack_0ed75d68575b0f3c = function(arg0, arg1) {
662
- const ret = arg1.stack;
663
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
690
+ const ret = getObject(arg1).stack;
691
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
664
692
  const len1 = WASM_VECTOR_LEN;
665
693
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
666
694
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
667
695
  };
668
696
  imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() {
669
697
  const ret = typeof global === 'undefined' ? null : global;
670
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
698
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
671
699
  };
672
700
  imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() {
673
701
  const ret = typeof globalThis === 'undefined' ? null : globalThis;
674
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
702
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
675
703
  };
676
704
  imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() {
677
705
  const ret = typeof self === 'undefined' ? null : self;
678
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
706
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
679
707
  };
680
708
  imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() {
681
709
  const ret = typeof window === 'undefined' ? null : window;
682
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
710
+ return isLikeNone(ret) ? 0 : addHeapObject(ret);
683
711
  };
684
712
  imports.wbg.__wbg_status_f6360336ca686bf0 = function(arg0) {
685
- const ret = arg0.status;
713
+ const ret = getObject(arg0).status;
686
714
  return ret;
687
715
  };
688
716
  imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) {
689
- const ret = arg0.then(arg1);
690
- return ret;
717
+ const ret = getObject(arg0).then(getObject(arg1));
718
+ return addHeapObject(ret);
691
719
  };
692
720
  imports.wbg.__wbg_then_48b406749878a531 = function(arg0, arg1, arg2) {
693
- const ret = arg0.then(arg1, arg2);
694
- return ret;
721
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
722
+ return addHeapObject(ret);
695
723
  };
696
724
  imports.wbg.__wbg_toString_5285597960676b7b = function(arg0) {
697
- const ret = arg0.toString();
698
- return ret;
725
+ const ret = getObject(arg0).toString();
726
+ return addHeapObject(ret);
699
727
  };
700
728
  imports.wbg.__wbg_toString_c813bbd34d063839 = function(arg0) {
701
- const ret = arg0.toString();
702
- return ret;
729
+ const ret = getObject(arg0).toString();
730
+ return addHeapObject(ret);
703
731
  };
704
732
  imports.wbg.__wbg_url_8f9653b899456042 = function(arg0, arg1) {
705
- const ret = arg1.url;
706
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
733
+ const ret = getObject(arg1).url;
734
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
707
735
  const len1 = WASM_VECTOR_LEN;
708
736
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
709
737
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
710
738
  };
711
739
  imports.wbg.__wbg_value_cd1ffa7b1ab794f1 = function(arg0) {
712
- const ret = arg0.value;
713
- return ret;
740
+ const ret = getObject(arg0).value;
741
+ return addHeapObject(ret);
714
742
  };
715
743
  imports.wbg.__wbindgen_bigint_from_i64 = function(arg0) {
716
744
  const ret = arg0;
717
- return ret;
745
+ return addHeapObject(ret);
718
746
  };
719
747
  imports.wbg.__wbindgen_bigint_from_u64 = function(arg0) {
720
748
  const ret = BigInt.asUintN(64, arg0);
721
- return ret;
749
+ return addHeapObject(ret);
722
750
  };
723
751
  imports.wbg.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
724
- const v = arg1;
752
+ const v = getObject(arg1);
725
753
  const ret = typeof(v) === 'bigint' ? v : undefined;
726
754
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
727
755
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
728
756
  };
729
757
  imports.wbg.__wbindgen_boolean_get = function(arg0) {
730
- const v = arg0;
758
+ const v = getObject(arg0);
731
759
  const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
732
760
  return ret;
733
761
  };
734
762
  imports.wbg.__wbindgen_cb_drop = function(arg0) {
735
- const obj = arg0.original;
763
+ const obj = takeObject(arg0).original;
736
764
  if (obj.cnt-- == 1) {
737
765
  obj.a = 0;
738
766
  return true;
@@ -740,93 +768,90 @@ function __wbg_get_imports() {
740
768
  const ret = false;
741
769
  return ret;
742
770
  };
743
- imports.wbg.__wbindgen_closure_wrapper8036 = function(arg0, arg1, arg2) {
744
- const ret = makeMutClosure(arg0, arg1, 2777, __wbg_adapter_52);
745
- return ret;
771
+ imports.wbg.__wbindgen_closure_wrapper8096 = function(arg0, arg1, arg2) {
772
+ const ret = makeMutClosure(arg0, arg1, 2787, __wbg_adapter_50);
773
+ return addHeapObject(ret);
746
774
  };
747
775
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
748
- const ret = debugString(arg1);
749
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
776
+ const ret = debugString(getObject(arg1));
777
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
750
778
  const len1 = WASM_VECTOR_LEN;
751
779
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
752
780
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
753
781
  };
754
782
  imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
755
783
  const ret = new Error(getStringFromWasm0(arg0, arg1));
756
- return ret;
784
+ return addHeapObject(ret);
757
785
  };
758
786
  imports.wbg.__wbindgen_in = function(arg0, arg1) {
759
- const ret = arg0 in arg1;
787
+ const ret = getObject(arg0) in getObject(arg1);
760
788
  return ret;
761
789
  };
762
- imports.wbg.__wbindgen_init_externref_table = function() {
763
- const table = wasm.__wbindgen_export_4;
764
- const offset = table.grow(4);
765
- table.set(0, undefined);
766
- table.set(offset + 0, undefined);
767
- table.set(offset + 1, null);
768
- table.set(offset + 2, true);
769
- table.set(offset + 3, false);
770
- ;
771
- };
772
790
  imports.wbg.__wbindgen_is_bigint = function(arg0) {
773
- const ret = typeof(arg0) === 'bigint';
791
+ const ret = typeof(getObject(arg0)) === 'bigint';
774
792
  return ret;
775
793
  };
776
794
  imports.wbg.__wbindgen_is_function = function(arg0) {
777
- const ret = typeof(arg0) === 'function';
795
+ const ret = typeof(getObject(arg0)) === 'function';
778
796
  return ret;
779
797
  };
780
798
  imports.wbg.__wbindgen_is_null = function(arg0) {
781
- const ret = arg0 === null;
799
+ const ret = getObject(arg0) === null;
782
800
  return ret;
783
801
  };
784
802
  imports.wbg.__wbindgen_is_object = function(arg0) {
785
- const val = arg0;
803
+ const val = getObject(arg0);
786
804
  const ret = typeof(val) === 'object' && val !== null;
787
805
  return ret;
788
806
  };
789
807
  imports.wbg.__wbindgen_is_string = function(arg0) {
790
- const ret = typeof(arg0) === 'string';
808
+ const ret = typeof(getObject(arg0)) === 'string';
791
809
  return ret;
792
810
  };
793
811
  imports.wbg.__wbindgen_is_undefined = function(arg0) {
794
- const ret = arg0 === undefined;
812
+ const ret = getObject(arg0) === undefined;
795
813
  return ret;
796
814
  };
797
815
  imports.wbg.__wbindgen_jsval_eq = function(arg0, arg1) {
798
- const ret = arg0 === arg1;
816
+ const ret = getObject(arg0) === getObject(arg1);
799
817
  return ret;
800
818
  };
801
819
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
802
- const ret = arg0 == arg1;
820
+ const ret = getObject(arg0) == getObject(arg1);
803
821
  return ret;
804
822
  };
805
823
  imports.wbg.__wbindgen_memory = function() {
806
824
  const ret = wasm.memory;
807
- return ret;
825
+ return addHeapObject(ret);
808
826
  };
809
827
  imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
810
- const obj = arg1;
828
+ const obj = getObject(arg1);
811
829
  const ret = typeof(obj) === 'number' ? obj : undefined;
812
830
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
813
831
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
814
832
  };
815
833
  imports.wbg.__wbindgen_number_new = function(arg0) {
816
834
  const ret = arg0;
817
- return ret;
835
+ return addHeapObject(ret);
836
+ };
837
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
838
+ const ret = getObject(arg0);
839
+ return addHeapObject(ret);
840
+ };
841
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
842
+ takeObject(arg0);
818
843
  };
819
844
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
820
- const obj = arg1;
845
+ const obj = getObject(arg1);
821
846
  const ret = typeof(obj) === 'string' ? obj : undefined;
822
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
847
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
823
848
  var len1 = WASM_VECTOR_LEN;
824
849
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
825
850
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
826
851
  };
827
852
  imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
828
853
  const ret = getStringFromWasm0(arg0, arg1);
829
- return ret;
854
+ return addHeapObject(ret);
830
855
  };
831
856
  imports.wbg.__wbindgen_throw = function(arg0, arg1) {
832
857
  throw new Error(getStringFromWasm0(arg0, arg1));
Binary file
@@ -1,27 +1,25 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const format: (a: number, b: number, c: number, d: number, e: number) => number;
5
+ export const lint: (a: number, b: number, c: number, d: number, e: number) => number;
4
6
  export const start: () => void;
5
- export const format: (a: number, b: number, c: number, d: number, e: any) => any;
6
- export const lint: (a: number, b: number, c: number, d: number, e: any) => any;
7
7
  export const __wbg_diagnostic_free: (a: number, b: number) => void;
8
8
  export const __wbg_get_position_column: (a: number) => number;
9
9
  export const __wbg_get_position_line: (a: number) => number;
10
- export const __wbg_position_free: (a: number, b: number) => void;
11
- export const __wbg_set_position_column: (a: number, b: number) => void;
12
- export const __wbg_set_position_line: (a: number, b: number) => void;
13
10
  export const __wbg_get_range_end: (a: number) => number;
14
11
  export const __wbg_get_range_start: (a: number) => number;
12
+ export const __wbg_position_free: (a: number, b: number) => void;
15
13
  export const __wbg_range_free: (a: number, b: number) => void;
14
+ export const __wbg_set_position_column: (a: number, b: number) => void;
15
+ export const __wbg_set_position_line: (a: number, b: number) => void;
16
16
  export const __wbg_set_range_end: (a: number, b: number) => void;
17
17
  export const __wbg_set_range_start: (a: number, b: number) => void;
18
- export const __wbindgen_malloc: (a: number, b: number) => number;
19
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
20
- export const __wbindgen_exn_store: (a: number) => void;
21
- export const __externref_table_alloc: () => number;
18
+ export const __wbindgen_export_0: (a: number, b: number) => number;
19
+ export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
20
+ export const __wbindgen_export_2: (a: number) => void;
21
+ export const __wbindgen_export_3: (a: number, b: number, c: number) => void;
22
22
  export const __wbindgen_export_4: WebAssembly.Table;
23
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
24
- export const __wbindgen_export_6: WebAssembly.Table;
25
- export const closure2776_externref_shim: (a: number, b: number, c: any) => void;
26
- export const closure2805_externref_shim: (a: number, b: number, c: any, d: any) => void;
23
+ export const __wbindgen_export_5: (a: number, b: number, c: number) => void;
24
+ export const __wbindgen_export_6: (a: number, b: number, c: number, d: number) => void;
27
25
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@tombi-toml/wasm-lib",
3
- "version": "0.0.0-bootstrap.0",
3
+ "version": "1.4.0",
4
4
  "description": "Tombi formatter and linter for WebAssembly",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/tombi-toml/tombi.git",
8
+ "directory": "typescript/@tombi-toml/wasm-lib"
9
+ },
5
10
  "type": "module",
6
11
  "files": [
7
12
  "dist"