@wasm-fmt/biome_fmt 0.1.8 → 0.1.10

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/biome_fmt.d.ts CHANGED
@@ -36,11 +36,11 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
36
36
  export interface InitOutput {
37
37
  readonly memory: WebAssembly.Memory;
38
38
  readonly format: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
39
- readonly __wbindgen_malloc: (a: number, b: number) => number;
40
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
39
+ readonly __wbindgen_export_0: (a: number, b: number) => number;
40
+ readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
41
41
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
42
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
43
- readonly __wbindgen_exn_store: (a: number) => void;
42
+ readonly __wbindgen_export_2: (a: number, b: number, c: number) => void;
43
+ readonly __wbindgen_export_3: (a: number) => void;
44
44
  }
45
45
 
46
46
  export type SyncInitInput = BufferSource | WebAssembly.Module;
package/biome_fmt.js CHANGED
@@ -1,13 +1,40 @@
1
1
  let wasm;
2
2
 
3
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
4
+
5
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
6
+
7
+ let cachedUint8Memory0 = null;
8
+
9
+ function getUint8Memory0() {
10
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
11
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
12
+ }
13
+ return cachedUint8Memory0;
14
+ }
15
+
16
+ function getStringFromWasm0(ptr, len) {
17
+ ptr = ptr >>> 0;
18
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
19
+ }
20
+
3
21
  const heap = new Array(128).fill(undefined);
4
22
 
5
23
  heap.push(undefined, null, true, false);
6
24
 
7
- function getObject(idx) { return heap[idx]; }
8
-
9
25
  let heap_next = heap.length;
10
26
 
27
+ function addHeapObject(obj) {
28
+ if (heap_next === heap.length) heap.push(heap.length + 1);
29
+ const idx = heap_next;
30
+ heap_next = heap[idx];
31
+
32
+ heap[idx] = obj;
33
+ return idx;
34
+ }
35
+
36
+ function getObject(idx) { return heap[idx]; }
37
+
11
38
  function dropObject(idx) {
12
39
  if (idx < 132) return;
13
40
  heap[idx] = heap_next;
@@ -42,26 +69,8 @@ function getInt32Memory0() {
42
69
  return cachedInt32Memory0;
43
70
  }
44
71
 
45
- function addHeapObject(obj) {
46
- if (heap_next === heap.length) heap.push(heap.length + 1);
47
- const idx = heap_next;
48
- heap_next = heap[idx];
49
-
50
- heap[idx] = obj;
51
- return idx;
52
- }
53
-
54
72
  let WASM_VECTOR_LEN = 0;
55
73
 
56
- let cachedUint8Memory0 = null;
57
-
58
- function getUint8Memory0() {
59
- if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
60
- cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
61
- }
62
- return cachedUint8Memory0;
63
- }
64
-
65
74
  const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
66
75
 
67
76
  const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
@@ -116,15 +125,6 @@ function passStringToWasm0(arg, malloc, realloc) {
116
125
  return ptr;
117
126
  }
118
127
 
119
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
120
-
121
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
122
-
123
- function getStringFromWasm0(ptr, len) {
124
- ptr = ptr >>> 0;
125
- return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
126
- }
127
-
128
128
  let cachedBigInt64Memory0 = null;
129
129
 
130
130
  function getBigInt64Memory0() {
@@ -209,9 +209,9 @@ export function format(src, filename, config) {
209
209
  let deferred4_1;
210
210
  try {
211
211
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
212
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
212
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
213
213
  const len0 = WASM_VECTOR_LEN;
214
- const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
214
+ const ptr1 = passStringToWasm0(filename, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
215
215
  const len1 = WASM_VECTOR_LEN;
216
216
  wasm.format(retptr, ptr0, len0, ptr1, len1, isLikeNone(config) ? 0 : addHeapObject(config));
217
217
  var r0 = getInt32Memory0()[retptr / 4 + 0];
@@ -229,7 +229,7 @@ export function format(src, filename, config) {
229
229
  return getStringFromWasm0(ptr3, len3);
230
230
  } finally {
231
231
  wasm.__wbindgen_add_to_stack_pointer(16);
232
- wasm.__wbindgen_free(deferred4_0, deferred4_1, 1);
232
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
233
233
  }
234
234
  }
235
235
 
@@ -237,7 +237,7 @@ function handleError(f, args) {
237
237
  try {
238
238
  return f.apply(this, args);
239
239
  } catch (e) {
240
- wasm.__wbindgen_exn_store(addHeapObject(e));
240
+ wasm.__wbindgen_export_3(addHeapObject(e));
241
241
  }
242
242
  }
243
243
 
@@ -275,6 +275,10 @@ async function __wbg_load(module, imports) {
275
275
  function __wbg_get_imports() {
276
276
  const imports = {};
277
277
  imports.wbg = {};
278
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
279
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
280
+ return addHeapObject(ret);
281
+ };
278
282
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
279
283
  takeObject(arg0);
280
284
  };
@@ -304,7 +308,7 @@ function __wbg_get_imports() {
304
308
  imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
305
309
  const obj = getObject(arg1);
306
310
  const ret = typeof(obj) === 'string' ? obj : undefined;
307
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
311
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
308
312
  var len1 = WASM_VECTOR_LEN;
309
313
  getInt32Memory0()[arg0 / 4 + 1] = len1;
310
314
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
@@ -330,26 +334,22 @@ function __wbg_get_imports() {
330
334
  const ret = getStringFromWasm0(arg0, arg1);
331
335
  return addHeapObject(ret);
332
336
  };
333
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
334
- const ret = new Error(getStringFromWasm0(arg0, arg1));
335
- return addHeapObject(ret);
336
- };
337
337
  imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
338
338
  const ret = getObject(arg0) == getObject(arg1);
339
339
  return ret;
340
340
  };
341
- imports.wbg.__wbg_String_917f38a1211cf44b = function(arg0, arg1) {
341
+ imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
342
342
  const ret = String(getObject(arg1));
343
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
344
344
  const len1 = WASM_VECTOR_LEN;
345
345
  getInt32Memory0()[arg0 / 4 + 1] = len1;
346
346
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
347
347
  };
348
- imports.wbg.__wbg_get_44be0491f933a435 = function(arg0, arg1) {
348
+ imports.wbg.__wbg_get_bd8e338fbd5f5cc8 = function(arg0, arg1) {
349
349
  const ret = getObject(arg0)[arg1 >>> 0];
350
350
  return addHeapObject(ret);
351
351
  };
352
- imports.wbg.__wbg_length_fff51ee6522a1a18 = function(arg0) {
352
+ imports.wbg.__wbg_length_cd7af8117672b8b8 = function(arg0) {
353
353
  const ret = getObject(arg0).length;
354
354
  return ret;
355
355
  };
@@ -357,39 +357,39 @@ function __wbg_get_imports() {
357
357
  const ret = typeof(getObject(arg0)) === 'function';
358
358
  return ret;
359
359
  };
360
- imports.wbg.__wbg_next_526fc47e980da008 = function(arg0) {
360
+ imports.wbg.__wbg_next_40fc327bfc8770e6 = function(arg0) {
361
361
  const ret = getObject(arg0).next;
362
362
  return addHeapObject(ret);
363
363
  };
364
- imports.wbg.__wbg_next_ddb3312ca1c4e32a = function() { return handleError(function (arg0) {
364
+ imports.wbg.__wbg_next_196c84450b364254 = function() { return handleError(function (arg0) {
365
365
  const ret = getObject(arg0).next();
366
366
  return addHeapObject(ret);
367
367
  }, arguments) };
368
- imports.wbg.__wbg_done_5c1f01fb660d73b5 = function(arg0) {
368
+ imports.wbg.__wbg_done_298b57d23c0fc80c = function(arg0) {
369
369
  const ret = getObject(arg0).done;
370
370
  return ret;
371
371
  };
372
- imports.wbg.__wbg_value_1695675138684bd5 = function(arg0) {
372
+ imports.wbg.__wbg_value_d93c65011f51a456 = function(arg0) {
373
373
  const ret = getObject(arg0).value;
374
374
  return addHeapObject(ret);
375
375
  };
376
- imports.wbg.__wbg_iterator_97f0c81209c6c35a = function() {
376
+ imports.wbg.__wbg_iterator_2cee6dadfd956dfa = function() {
377
377
  const ret = Symbol.iterator;
378
378
  return addHeapObject(ret);
379
379
  };
380
- imports.wbg.__wbg_get_97b561fb56f034b5 = function() { return handleError(function (arg0, arg1) {
380
+ imports.wbg.__wbg_get_e3c254076557e348 = function() { return handleError(function (arg0, arg1) {
381
381
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
382
382
  return addHeapObject(ret);
383
383
  }, arguments) };
384
- imports.wbg.__wbg_call_cb65541d95d71282 = function() { return handleError(function (arg0, arg1) {
384
+ imports.wbg.__wbg_call_27c0f87801dedf93 = function() { return handleError(function (arg0, arg1) {
385
385
  const ret = getObject(arg0).call(getObject(arg1));
386
386
  return addHeapObject(ret);
387
387
  }, arguments) };
388
- imports.wbg.__wbg_isArray_4c24b343cb13cfb1 = function(arg0) {
388
+ imports.wbg.__wbg_isArray_2ab64d95e09ea0ae = function(arg0) {
389
389
  const ret = Array.isArray(getObject(arg0));
390
390
  return ret;
391
391
  };
392
- imports.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb = function(arg0) {
392
+ imports.wbg.__wbg_instanceof_ArrayBuffer_836825be07d4c9d2 = function(arg0) {
393
393
  let result;
394
394
  try {
395
395
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -399,30 +399,40 @@ function __wbg_get_imports() {
399
399
  const ret = result;
400
400
  return ret;
401
401
  };
402
- imports.wbg.__wbg_isSafeInteger_bb8e18dd21c97288 = function(arg0) {
402
+ imports.wbg.__wbg_instanceof_Map_87917e0a7aaf4012 = function(arg0) {
403
+ let result;
404
+ try {
405
+ result = getObject(arg0) instanceof Map;
406
+ } catch (_) {
407
+ result = false;
408
+ }
409
+ const ret = result;
410
+ return ret;
411
+ };
412
+ imports.wbg.__wbg_isSafeInteger_f7b04ef02296c4d2 = function(arg0) {
403
413
  const ret = Number.isSafeInteger(getObject(arg0));
404
414
  return ret;
405
415
  };
406
- imports.wbg.__wbg_entries_e51f29c7bba0c054 = function(arg0) {
416
+ imports.wbg.__wbg_entries_95cc2c823b285a09 = function(arg0) {
407
417
  const ret = Object.entries(getObject(arg0));
408
418
  return addHeapObject(ret);
409
419
  };
410
- imports.wbg.__wbg_buffer_085ec1f694018c4f = function(arg0) {
420
+ imports.wbg.__wbg_buffer_12d079cc21e14bdb = function(arg0) {
411
421
  const ret = getObject(arg0).buffer;
412
422
  return addHeapObject(ret);
413
423
  };
414
- imports.wbg.__wbg_new_8125e318e6245eed = function(arg0) {
424
+ imports.wbg.__wbg_new_63b92bc8671ed464 = function(arg0) {
415
425
  const ret = new Uint8Array(getObject(arg0));
416
426
  return addHeapObject(ret);
417
427
  };
418
- imports.wbg.__wbg_set_5cf90238115182c3 = function(arg0, arg1, arg2) {
428
+ imports.wbg.__wbg_set_a47bac70306a19a7 = function(arg0, arg1, arg2) {
419
429
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
420
430
  };
421
- imports.wbg.__wbg_length_72e2208bbc0efc61 = function(arg0) {
431
+ imports.wbg.__wbg_length_c20a40f15020d68a = function(arg0) {
422
432
  const ret = getObject(arg0).length;
423
433
  return ret;
424
434
  };
425
- imports.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4 = function(arg0) {
435
+ imports.wbg.__wbg_instanceof_Uint8Array_2b3bbecd033d19f6 = function(arg0) {
426
436
  let result;
427
437
  try {
428
438
  result = getObject(arg0) instanceof Uint8Array;
@@ -440,7 +450,7 @@ function __wbg_get_imports() {
440
450
  };
441
451
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
442
452
  const ret = debugString(getObject(arg1));
443
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
453
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
444
454
  const len1 = WASM_VECTOR_LEN;
445
455
  getInt32Memory0()[arg0 / 4 + 1] = len1;
446
456
  getInt32Memory0()[arg0 / 4 + 0] = ptr1;
package/biome_fmt_bg.wasm CHANGED
Binary file
@@ -2,8 +2,8 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export function format(a: number, b: number, c: number, d: number, e: number, f: number): void;
5
- export function __wbindgen_malloc(a: number, b: number): number;
6
- export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
5
+ export function __wbindgen_export_0(a: number, b: number): number;
6
+ export function __wbindgen_export_1(a: number, b: number, c: number, d: number): number;
7
7
  export function __wbindgen_add_to_stack_pointer(a: number): number;
8
- export function __wbindgen_free(a: number, b: number, c: number): void;
9
- export function __wbindgen_exn_store(a: number): void;
8
+ export function __wbindgen_export_2(a: number, b: number, c: number): void;
9
+ export function __wbindgen_export_3(a: number): void;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "magic-akari <akari.ccino@gmail.com>"
5
5
  ],
6
6
  "description": "JavaScript/TypeScript formatter powered by WASM ported from Biome",
7
- "version": "0.1.8",
7
+ "version": "0.1.10",
8
8
  "license": "MIT",
9
9
  "repository": {
10
10
  "type": "git",
package/jsr.jsonc DELETED
@@ -1,36 +0,0 @@
1
- {
2
- "name": "@fmt/biome-fmt",
3
- "collaborators": [
4
- "magic-akari <akari.ccino@gmail.com>"
5
- ],
6
- "description": "JavaScript/TypeScript formatter powered by WASM ported from Biome",
7
- "version": "0.1.8",
8
- "license": "MIT",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/wasm-fmt/web_fmt"
12
- },
13
- "module": "biome_fmt.js",
14
- "homepage": "https://github.com/wasm-fmt/web_fmt",
15
- "types": "biome_fmt.d.ts",
16
- "sideEffects": [
17
- "./snippets/*"
18
- ],
19
- "keywords": [
20
- "wasm",
21
- "formatter",
22
- "javascript",
23
- "typescript",
24
- "biome"
25
- ],
26
- "main": "biome_fmt.js",
27
- "type": "module",
28
- "publishConfig": {
29
- "access": "public"
30
- },
31
- "exports": "./biome_fmt.js",
32
- "exclude": [
33
- "!**",
34
- "*.tgz"
35
- ]
36
- }