@wasm-fmt/json_fmt 0.1.11 → 0.1.13

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/json_fmt.js CHANGED
@@ -6,20 +6,6 @@ heap.push(undefined, null, true, false);
6
6
 
7
7
  function getObject(idx) { return heap[idx]; }
8
8
 
9
- let heap_next = heap.length;
10
-
11
- function dropObject(idx) {
12
- if (idx < 132) return;
13
- heap[idx] = heap_next;
14
- heap_next = idx;
15
- }
16
-
17
- function takeObject(idx) {
18
- const ret = getObject(idx);
19
- dropObject(idx);
20
- return ret;
21
- }
22
-
23
9
  let WASM_VECTOR_LEN = 0;
24
10
 
25
11
  let cachedUint8ArrayMemory0 = null;
@@ -85,10 +71,6 @@ function passStringToWasm0(arg, malloc, realloc) {
85
71
  return ptr;
86
72
  }
87
73
 
88
- function isLikeNone(x) {
89
- return x === undefined || x === null;
90
- }
91
-
92
74
  let cachedDataViewMemory0 = null;
93
75
 
94
76
  function getDataViewMemory0() {
@@ -98,6 +80,8 @@ function getDataViewMemory0() {
98
80
  return cachedDataViewMemory0;
99
81
  }
100
82
 
83
+ let heap_next = heap.length;
84
+
101
85
  function addHeapObject(obj) {
102
86
  if (heap_next === heap.length) heap.push(heap.length + 1);
103
87
  const idx = heap_next;
@@ -107,15 +91,6 @@ function addHeapObject(obj) {
107
91
  return idx;
108
92
  }
109
93
 
110
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
111
-
112
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
113
-
114
- function getStringFromWasm0(ptr, len) {
115
- ptr = ptr >>> 0;
116
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
117
- }
118
-
119
94
  function debugString(val) {
120
95
  // primitive types
121
96
  const type = typeof val;
@@ -157,7 +132,7 @@ function debugString(val) {
157
132
  // Test for built-in
158
133
  const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
159
134
  let className;
160
- if (builtInMatches.length > 1) {
135
+ if (builtInMatches && builtInMatches.length > 1) {
161
136
  className = builtInMatches[1];
162
137
  } else {
163
138
  // Failed to match the standard '[object ClassName]'
@@ -180,6 +155,31 @@ function debugString(val) {
180
155
  // TODO we could test for more things here, like `Set`s and `Map`s.
181
156
  return className;
182
157
  }
158
+
159
+ const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
160
+
161
+ if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
162
+
163
+ function getStringFromWasm0(ptr, len) {
164
+ ptr = ptr >>> 0;
165
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
166
+ }
167
+
168
+ function isLikeNone(x) {
169
+ return x === undefined || x === null;
170
+ }
171
+
172
+ function dropObject(idx) {
173
+ if (idx < 132) return;
174
+ heap[idx] = heap_next;
175
+ heap_next = idx;
176
+ }
177
+
178
+ function takeObject(idx) {
179
+ const ret = getObject(idx);
180
+ dropObject(idx);
181
+ return ret;
182
+ }
183
183
  /**
184
184
  * @param {string} src
185
185
  * @param {Config | undefined} [config]
@@ -246,85 +246,30 @@ async function __wbg_load(module, imports) {
246
246
  function __wbg_get_imports() {
247
247
  const imports = {};
248
248
  imports.wbg = {};
249
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
250
- takeObject(arg0);
251
- };
252
- imports.wbg.__wbindgen_is_undefined = function(arg0) {
253
- const ret = getObject(arg0) === undefined;
254
- return ret;
255
- };
256
- imports.wbg.__wbindgen_in = function(arg0, arg1) {
257
- const ret = getObject(arg0) in getObject(arg1);
258
- return ret;
259
- };
260
- imports.wbg.__wbindgen_is_string = function(arg0) {
261
- const ret = typeof(getObject(arg0)) === 'string';
262
- return ret;
263
- };
264
- imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
265
- const obj = getObject(arg1);
266
- const ret = typeof(obj) === 'string' ? obj : undefined;
267
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
268
- var len1 = WASM_VECTOR_LEN;
269
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
270
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
271
- };
272
- imports.wbg.__wbindgen_is_object = function(arg0) {
273
- const val = getObject(arg0);
274
- const ret = typeof(val) === 'object' && val !== null;
275
- return ret;
276
- };
277
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
278
- const ret = getObject(arg0);
279
- return addHeapObject(ret);
280
- };
281
- imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
282
- const ret = getStringFromWasm0(arg0, arg1);
283
- return addHeapObject(ret);
284
- };
285
- imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
286
- const ret = getObject(arg0) == getObject(arg1);
287
- return ret;
288
- };
289
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
290
- const v = getObject(arg0);
291
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
292
- return ret;
293
- };
294
- imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
295
- const obj = getObject(arg1);
296
- const ret = typeof(obj) === 'number' ? obj : undefined;
297
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
298
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
299
- };
300
- imports.wbg.__wbindgen_as_number = function(arg0) {
301
- const ret = +getObject(arg0);
302
- return ret;
303
- };
304
- imports.wbg.__wbg_String_b9412f8799faab3e = function(arg0, arg1) {
249
+ imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
305
250
  const ret = String(getObject(arg1));
306
251
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
307
252
  const len1 = WASM_VECTOR_LEN;
308
253
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
309
254
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
310
255
  };
311
- imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
312
- const ret = new Error(getStringFromWasm0(arg0, arg1));
256
+ imports.wbg.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
257
+ const ret = getObject(arg0).buffer;
313
258
  return addHeapObject(ret);
314
259
  };
315
- imports.wbg.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
316
- const ret = getObject(arg0)[getObject(arg1)];
260
+ imports.wbg.__wbg_entries_4f2bb9b0d701c0f6 = function(arg0) {
261
+ const ret = Object.entries(getObject(arg0));
317
262
  return addHeapObject(ret);
318
263
  };
319
- imports.wbg.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
264
+ imports.wbg.__wbg_get_9aa3dff3f0266054 = function(arg0, arg1) {
320
265
  const ret = getObject(arg0)[arg1 >>> 0];
321
266
  return addHeapObject(ret);
322
267
  };
323
- imports.wbg.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
324
- const ret = getObject(arg0).length;
325
- return ret;
268
+ imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
269
+ const ret = getObject(arg0)[getObject(arg1)];
270
+ return addHeapObject(ret);
326
271
  };
327
- imports.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
272
+ imports.wbg.__wbg_instanceof_ArrayBuffer_670ddde44cdb2602 = function(arg0) {
328
273
  let result;
329
274
  try {
330
275
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -334,37 +279,42 @@ function __wbg_get_imports() {
334
279
  const ret = result;
335
280
  return ret;
336
281
  };
337
- imports.wbg.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
282
+ imports.wbg.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function(arg0) {
283
+ let result;
284
+ try {
285
+ result = getObject(arg0) instanceof Uint8Array;
286
+ } catch (_) {
287
+ result = false;
288
+ }
289
+ const ret = result;
290
+ return ret;
291
+ };
292
+ imports.wbg.__wbg_isSafeInteger_12f5549b2fca23f4 = function(arg0) {
338
293
  const ret = Number.isSafeInteger(getObject(arg0));
339
294
  return ret;
340
295
  };
341
- imports.wbg.__wbg_entries_c02034de337d3ee2 = function(arg0) {
342
- const ret = Object.entries(getObject(arg0));
343
- return addHeapObject(ret);
296
+ imports.wbg.__wbg_length_65d1cd11729ced11 = function(arg0) {
297
+ const ret = getObject(arg0).length;
298
+ return ret;
344
299
  };
345
- imports.wbg.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
346
- const ret = getObject(arg0).buffer;
347
- return addHeapObject(ret);
300
+ imports.wbg.__wbg_length_d65cf0786bfc5739 = function(arg0) {
301
+ const ret = getObject(arg0).length;
302
+ return ret;
348
303
  };
349
- imports.wbg.__wbg_new_fec2611eb9180f95 = function(arg0) {
304
+ imports.wbg.__wbg_new_3ff5b33b1ce712df = function(arg0) {
350
305
  const ret = new Uint8Array(getObject(arg0));
351
306
  return addHeapObject(ret);
352
307
  };
353
- imports.wbg.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
308
+ imports.wbg.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) {
354
309
  getObject(arg0).set(getObject(arg1), arg2 >>> 0);
355
310
  };
356
- imports.wbg.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
357
- const ret = getObject(arg0).length;
311
+ imports.wbg.__wbindgen_as_number = function(arg0) {
312
+ const ret = +getObject(arg0);
358
313
  return ret;
359
314
  };
360
- imports.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
361
- let result;
362
- try {
363
- result = getObject(arg0) instanceof Uint8Array;
364
- } catch (_) {
365
- result = false;
366
- }
367
- const ret = result;
315
+ imports.wbg.__wbindgen_boolean_get = function(arg0) {
316
+ const v = getObject(arg0);
317
+ const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
368
318
  return ret;
369
319
  };
370
320
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
@@ -374,13 +324,63 @@ function __wbg_get_imports() {
374
324
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
375
325
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
376
326
  };
377
- imports.wbg.__wbindgen_throw = function(arg0, arg1) {
378
- throw new Error(getStringFromWasm0(arg0, arg1));
327
+ imports.wbg.__wbindgen_error_new = function(arg0, arg1) {
328
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
329
+ return addHeapObject(ret);
330
+ };
331
+ imports.wbg.__wbindgen_in = function(arg0, arg1) {
332
+ const ret = getObject(arg0) in getObject(arg1);
333
+ return ret;
334
+ };
335
+ imports.wbg.__wbindgen_is_object = function(arg0) {
336
+ const val = getObject(arg0);
337
+ const ret = typeof(val) === 'object' && val !== null;
338
+ return ret;
339
+ };
340
+ imports.wbg.__wbindgen_is_string = function(arg0) {
341
+ const ret = typeof(getObject(arg0)) === 'string';
342
+ return ret;
343
+ };
344
+ imports.wbg.__wbindgen_is_undefined = function(arg0) {
345
+ const ret = getObject(arg0) === undefined;
346
+ return ret;
347
+ };
348
+ imports.wbg.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
349
+ const ret = getObject(arg0) == getObject(arg1);
350
+ return ret;
379
351
  };
380
352
  imports.wbg.__wbindgen_memory = function() {
381
353
  const ret = wasm.memory;
382
354
  return addHeapObject(ret);
383
355
  };
356
+ imports.wbg.__wbindgen_number_get = function(arg0, arg1) {
357
+ const obj = getObject(arg1);
358
+ const ret = typeof(obj) === 'number' ? obj : undefined;
359
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
360
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
361
+ };
362
+ imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
363
+ const ret = getObject(arg0);
364
+ return addHeapObject(ret);
365
+ };
366
+ imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
367
+ takeObject(arg0);
368
+ };
369
+ imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
370
+ const obj = getObject(arg1);
371
+ const ret = typeof(obj) === 'string' ? obj : undefined;
372
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
373
+ var len1 = WASM_VECTOR_LEN;
374
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
375
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
376
+ };
377
+ imports.wbg.__wbindgen_string_new = function(arg0, arg1) {
378
+ const ret = getStringFromWasm0(arg0, arg1);
379
+ return addHeapObject(ret);
380
+ };
381
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
382
+ throw new Error(getStringFromWasm0(arg0, arg1));
383
+ };
384
384
 
385
385
  return imports;
386
386
  }
package/json_fmt_bg.wasm CHANGED
Binary file
@@ -1,8 +1,8 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export function format(a: number, b: number, c: number, d: number): void;
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
- export function __wbindgen_add_to_stack_pointer(a: number): number;
8
- export function __wbindgen_export_2(a: number, b: number, c: number): void;
4
+ export const format: (a: number, b: number, c: number, d: number) => void;
5
+ export const __wbindgen_export_0: (a: number, b: number) => number;
6
+ export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
7
+ export const __wbindgen_add_to_stack_pointer: (a: number) => number;
8
+ export const __wbindgen_export_2: (a: number, b: number, c: number) => void;
package/json_fmt_node.js CHANGED
@@ -3,7 +3,7 @@ import initAsync from "./json_fmt.js";
3
3
 
4
4
  const wasm = new URL("./json_fmt_bg.wasm", import.meta.url);
5
5
 
6
- export default function __wbg_init(init = fs.readFile(wasm)) {
6
+ export default function __wbg_init(init = { module_or_path: fs.readFile(wasm) }) {
7
7
  return initAsync(init);
8
8
  }
9
9
 
package/json_fmt_vite.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import initAsync from "./json_fmt.js";
2
2
  import wasm from "./json_fmt_bg.wasm?url";
3
3
 
4
- export default function __wbg_init(input = wasm) {
4
+ export default function __wbg_init(input = { module_or_path: wasm }) {
5
5
  return initAsync(input);
6
6
  }
7
7
 
package/jsr.jsonc CHANGED
@@ -5,7 +5,7 @@
5
5
  "magic-akari <akari.ccino@gmail.com>"
6
6
  ],
7
7
  "description": "JSON formatter powered by WASM ported from Biome",
8
- "version": "0.1.11",
8
+ "version": "0.1.13",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "magic-akari <akari.ccino@gmail.com>"
6
6
  ],
7
7
  "description": "JSON formatter powered by WASM ported from Biome",
8
- "version": "0.1.11",
8
+ "version": "0.1.13",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
Binary file
Binary file