@wasm-fmt/json_fmt 0.1.14 → 0.1.15

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/README.md CHANGED
@@ -27,8 +27,26 @@ console.log(formatted);
27
27
 
28
28
  For Vite users:
29
29
 
30
+ Add `"@wasm-fmt/json_fmt"` to `optimizeDeps.exclude` in your vite config:
31
+
32
+ ```JSON
33
+ {
34
+ "optimizeDeps": {
35
+ "exclude": ["@wasm-fmt/json_fmt"]
36
+ }
37
+ }
38
+ ```
39
+
40
+ <details>
41
+ <summary>
42
+ If you cannot change the vite config, you can use another import entry
43
+
44
+ </summary>
45
+
30
46
  ```JavaScript
31
47
  import init, { format } from "@wasm-fmt/json_fmt/vite";
32
48
 
33
49
  // ...
34
50
  ```
51
+
52
+ </details>
package/json_fmt.d.ts CHANGED
@@ -4,25 +4,28 @@ export type Config = LayoutConfig;
4
4
 
5
5
 
6
6
  interface LayoutConfig {
7
- indent_style?: "tab" | "space";
8
- indent_width?: number;
9
- line_width?: number;
10
- line_ending?: "lf" | "crlf";
7
+ indentStyle?: "tab" | "space";
8
+ indentWidth?: number;
9
+ lineWidth?: number;
10
+ lineEnding?: "lf" | "crlf";
11
11
  }
12
12
 
13
13
 
14
+ export function format(src: string, config?: Config | null): string;
15
+
14
16
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
15
17
 
16
18
  export interface InitOutput {
17
19
  readonly memory: WebAssembly.Memory;
18
20
  readonly format: (a: number, b: number, c: number, d: number) => void;
19
- readonly __wbindgen_export_0: (a: number, b: number) => number;
20
- readonly __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
21
+ readonly __wbindgen_export: (a: number, b: number) => number;
22
+ readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
21
23
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
22
- readonly __wbindgen_export_2: (a: number, b: number, c: number) => void;
24
+ readonly __wbindgen_export3: (a: number, b: number, c: number) => void;
23
25
  }
24
26
 
25
27
  export type SyncInitInput = BufferSource | WebAssembly.Module;
28
+
26
29
  /**
27
30
  * Instantiates the given `module`, which can either be bytes or
28
31
  * a precompiled `WebAssembly.Module`.
package/json_fmt.js CHANGED
@@ -1,87 +1,5 @@
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
-
9
- let WASM_VECTOR_LEN = 0;
10
-
11
- let cachedUint8ArrayMemory0 = null;
12
-
13
- function getUint8ArrayMemory0() {
14
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
15
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
16
- }
17
- return cachedUint8ArrayMemory0;
18
- }
19
-
20
- const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
21
-
22
- const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
23
- ? function (arg, view) {
24
- return cachedTextEncoder.encodeInto(arg, view);
25
- }
26
- : function (arg, view) {
27
- const buf = cachedTextEncoder.encode(arg);
28
- view.set(buf);
29
- return {
30
- read: arg.length,
31
- written: buf.length
32
- };
33
- });
34
-
35
- function passStringToWasm0(arg, malloc, realloc) {
36
-
37
- if (realloc === undefined) {
38
- const buf = cachedTextEncoder.encode(arg);
39
- const ptr = malloc(buf.length, 1) >>> 0;
40
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
41
- WASM_VECTOR_LEN = buf.length;
42
- return ptr;
43
- }
44
-
45
- let len = arg.length;
46
- let ptr = malloc(len, 1) >>> 0;
47
-
48
- const mem = getUint8ArrayMemory0();
49
-
50
- let offset = 0;
51
-
52
- for (; offset < len; offset++) {
53
- const code = arg.charCodeAt(offset);
54
- if (code > 0x7F) break;
55
- mem[ptr + offset] = code;
56
- }
57
-
58
- if (offset !== len) {
59
- if (offset !== 0) {
60
- arg = arg.slice(offset);
61
- }
62
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
63
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
64
- const ret = encodeString(arg, view);
65
-
66
- offset += ret.written;
67
- ptr = realloc(ptr, len, offset, 1) >>> 0;
68
- }
69
-
70
- WASM_VECTOR_LEN = offset;
71
- return ptr;
72
- }
73
-
74
- let cachedDataViewMemory0 = null;
75
-
76
- function getDataViewMemory0() {
77
- if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
78
- cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
79
- }
80
- return cachedDataViewMemory0;
81
- }
82
-
83
- let heap_next = heap.length;
84
-
85
3
  function addHeapObject(obj) {
86
4
  if (heap_next === heap.length) heap.push(heap.length + 1);
87
5
  const idx = heap_next;
@@ -156,23 +74,84 @@ function debugString(val) {
156
74
  return className;
157
75
  }
158
76
 
159
- const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
77
+ function dropObject(idx) {
78
+ if (idx < 132) return;
79
+ heap[idx] = heap_next;
80
+ heap_next = idx;
81
+ }
160
82
 
161
- if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
83
+ function getArrayU8FromWasm0(ptr, len) {
84
+ ptr = ptr >>> 0;
85
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
86
+ }
87
+
88
+ let cachedDataViewMemory0 = null;
89
+ function getDataViewMemory0() {
90
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
91
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
92
+ }
93
+ return cachedDataViewMemory0;
94
+ }
162
95
 
163
96
  function getStringFromWasm0(ptr, len) {
164
97
  ptr = ptr >>> 0;
165
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
98
+ return decodeText(ptr, len);
99
+ }
100
+
101
+ let cachedUint8ArrayMemory0 = null;
102
+ function getUint8ArrayMemory0() {
103
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
104
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
105
+ }
106
+ return cachedUint8ArrayMemory0;
166
107
  }
167
108
 
109
+ function getObject(idx) { return heap[idx]; }
110
+
111
+ let heap = new Array(128).fill(undefined);
112
+ heap.push(undefined, null, true, false);
113
+
114
+ let heap_next = heap.length;
115
+
168
116
  function isLikeNone(x) {
169
117
  return x === undefined || x === null;
170
118
  }
171
119
 
172
- function dropObject(idx) {
173
- if (idx < 132) return;
174
- heap[idx] = heap_next;
175
- heap_next = idx;
120
+ function passStringToWasm0(arg, malloc, realloc) {
121
+ if (realloc === undefined) {
122
+ const buf = cachedTextEncoder.encode(arg);
123
+ const ptr = malloc(buf.length, 1) >>> 0;
124
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
125
+ WASM_VECTOR_LEN = buf.length;
126
+ return ptr;
127
+ }
128
+
129
+ let len = arg.length;
130
+ let ptr = malloc(len, 1) >>> 0;
131
+
132
+ const mem = getUint8ArrayMemory0();
133
+
134
+ let offset = 0;
135
+
136
+ for (; offset < len; offset++) {
137
+ const code = arg.charCodeAt(offset);
138
+ if (code > 0x7F) break;
139
+ mem[ptr + offset] = code;
140
+ }
141
+ if (offset !== len) {
142
+ if (offset !== 0) {
143
+ arg = arg.slice(offset);
144
+ }
145
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
146
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
147
+ const ret = cachedTextEncoder.encodeInto(arg, view);
148
+
149
+ offset += ret.written;
150
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
151
+ }
152
+
153
+ WASM_VECTOR_LEN = offset;
154
+ return ptr;
176
155
  }
177
156
 
178
157
  function takeObject(idx) {
@@ -180,9 +159,39 @@ function takeObject(idx) {
180
159
  dropObject(idx);
181
160
  return ret;
182
161
  }
162
+
163
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
164
+ cachedTextDecoder.decode();
165
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
166
+ let numBytesDecoded = 0;
167
+ function decodeText(ptr, len) {
168
+ numBytesDecoded += len;
169
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
170
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
171
+ cachedTextDecoder.decode();
172
+ numBytesDecoded = len;
173
+ }
174
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
175
+ }
176
+
177
+ const cachedTextEncoder = new TextEncoder();
178
+
179
+ if (!('encodeInto' in cachedTextEncoder)) {
180
+ cachedTextEncoder.encodeInto = function (arg, view) {
181
+ const buf = cachedTextEncoder.encode(arg);
182
+ view.set(buf);
183
+ return {
184
+ read: arg.length,
185
+ written: buf.length
186
+ };
187
+ }
188
+ }
189
+
190
+ let WASM_VECTOR_LEN = 0;
191
+
183
192
  /**
184
193
  * @param {string} src
185
- * @param {Config | undefined} [config]
194
+ * @param {Config | null} [config]
186
195
  * @returns {string}
187
196
  */
188
197
  export function format(src, config) {
@@ -190,7 +199,7 @@ export function format(src, config) {
190
199
  let deferred3_1;
191
200
  try {
192
201
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
193
- const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
202
+ const ptr0 = passStringToWasm0(src, wasm.__wbindgen_export, wasm.__wbindgen_export2);
194
203
  const len0 = WASM_VECTOR_LEN;
195
204
  wasm.format(retptr, ptr0, len0, isLikeNone(config) ? 0 : addHeapObject(config));
196
205
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
@@ -208,18 +217,21 @@ export function format(src, config) {
208
217
  return getStringFromWasm0(ptr2, len2);
209
218
  } finally {
210
219
  wasm.__wbindgen_add_to_stack_pointer(16);
211
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
220
+ wasm.__wbindgen_export3(deferred3_0, deferred3_1, 1);
212
221
  }
213
222
  }
214
223
 
224
+ const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
225
+
215
226
  async function __wbg_load(module, imports) {
216
227
  if (typeof Response === 'function' && module instanceof Response) {
217
228
  if (typeof WebAssembly.instantiateStreaming === 'function') {
218
229
  try {
219
230
  return await WebAssembly.instantiateStreaming(module, imports);
220
-
221
231
  } catch (e) {
222
- if (module.headers.get('Content-Type') != 'application/wasm') {
232
+ const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
233
+
234
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
223
235
  console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
224
236
 
225
237
  } else {
@@ -230,13 +242,11 @@ async function __wbg_load(module, imports) {
230
242
 
231
243
  const bytes = await module.arrayBuffer();
232
244
  return await WebAssembly.instantiate(bytes, imports);
233
-
234
245
  } else {
235
246
  const instance = await WebAssembly.instantiate(module, imports);
236
247
 
237
248
  if (instance instanceof WebAssembly.Instance) {
238
249
  return { instance, module };
239
-
240
250
  } else {
241
251
  return instance;
242
252
  }
@@ -246,30 +256,84 @@ async function __wbg_load(module, imports) {
246
256
  function __wbg_get_imports() {
247
257
  const imports = {};
248
258
  imports.wbg = {};
259
+ imports.wbg.__wbg_Error_52673b7de5a0ca89 = function(arg0, arg1) {
260
+ const ret = Error(getStringFromWasm0(arg0, arg1));
261
+ return addHeapObject(ret);
262
+ };
263
+ imports.wbg.__wbg_Number_2d1dcfcf4ec51736 = function(arg0) {
264
+ const ret = Number(getObject(arg0));
265
+ return ret;
266
+ };
249
267
  imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
250
268
  const ret = String(getObject(arg1));
251
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
269
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
252
270
  const len1 = WASM_VECTOR_LEN;
253
271
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
254
272
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
255
273
  };
256
- imports.wbg.__wbg_buffer_61b7ce01341d7f88 = function(arg0) {
257
- const ret = getObject(arg0).buffer;
258
- return addHeapObject(ret);
274
+ imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
275
+ const v = getObject(arg0);
276
+ const ret = typeof(v) === 'boolean' ? v : undefined;
277
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
278
+ };
279
+ imports.wbg.__wbg___wbindgen_debug_string_adfb662ae34724b6 = function(arg0, arg1) {
280
+ const ret = debugString(getObject(arg1));
281
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
282
+ const len1 = WASM_VECTOR_LEN;
283
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
284
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
285
+ };
286
+ imports.wbg.__wbg___wbindgen_in_0d3e1e8f0c669317 = function(arg0, arg1) {
287
+ const ret = getObject(arg0) in getObject(arg1);
288
+ return ret;
289
+ };
290
+ imports.wbg.__wbg___wbindgen_is_object_ce774f3490692386 = function(arg0) {
291
+ const val = getObject(arg0);
292
+ const ret = typeof(val) === 'object' && val !== null;
293
+ return ret;
294
+ };
295
+ imports.wbg.__wbg___wbindgen_is_string_704ef9c8fc131030 = function(arg0) {
296
+ const ret = typeof(getObject(arg0)) === 'string';
297
+ return ret;
298
+ };
299
+ imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
300
+ const ret = getObject(arg0) === undefined;
301
+ return ret;
302
+ };
303
+ imports.wbg.__wbg___wbindgen_jsval_loose_eq_766057600fdd1b0d = function(arg0, arg1) {
304
+ const ret = getObject(arg0) == getObject(arg1);
305
+ return ret;
306
+ };
307
+ imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
308
+ const obj = getObject(arg1);
309
+ const ret = typeof(obj) === 'number' ? obj : undefined;
310
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
311
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
259
312
  };
260
- imports.wbg.__wbg_entries_4f2bb9b0d701c0f6 = function(arg0) {
313
+ imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
314
+ const obj = getObject(arg1);
315
+ const ret = typeof(obj) === 'string' ? obj : undefined;
316
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
317
+ var len1 = WASM_VECTOR_LEN;
318
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
319
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
320
+ };
321
+ imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
322
+ throw new Error(getStringFromWasm0(arg0, arg1));
323
+ };
324
+ imports.wbg.__wbg_entries_83c79938054e065f = function(arg0) {
261
325
  const ret = Object.entries(getObject(arg0));
262
326
  return addHeapObject(ret);
263
327
  };
264
- imports.wbg.__wbg_get_9aa3dff3f0266054 = function(arg0, arg1) {
328
+ imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
265
329
  const ret = getObject(arg0)[arg1 >>> 0];
266
330
  return addHeapObject(ret);
267
331
  };
268
- imports.wbg.__wbg_getwithrefkey_1dc361bd10053bfe = function(arg0, arg1) {
332
+ imports.wbg.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
269
333
  const ret = getObject(arg0)[getObject(arg1)];
270
334
  return addHeapObject(ret);
271
335
  };
272
- imports.wbg.__wbg_instanceof_ArrayBuffer_670ddde44cdb2602 = function(arg0) {
336
+ imports.wbg.__wbg_instanceof_ArrayBuffer_f3320d2419cd0355 = function(arg0) {
273
337
  let result;
274
338
  try {
275
339
  result = getObject(arg0) instanceof ArrayBuffer;
@@ -279,7 +343,7 @@ function __wbg_get_imports() {
279
343
  const ret = result;
280
344
  return ret;
281
345
  };
282
- imports.wbg.__wbg_instanceof_Uint8Array_28af5bc19d6acad8 = function(arg0) {
346
+ imports.wbg.__wbg_instanceof_Uint8Array_da54ccc9d3e09434 = function(arg0) {
283
347
  let result;
284
348
  try {
285
349
  result = getObject(arg0) instanceof Uint8Array;
@@ -289,76 +353,30 @@ function __wbg_get_imports() {
289
353
  const ret = result;
290
354
  return ret;
291
355
  };
292
- imports.wbg.__wbg_isSafeInteger_12f5549b2fca23f4 = function(arg0) {
356
+ imports.wbg.__wbg_isSafeInteger_ae7d3f054d55fa16 = function(arg0) {
293
357
  const ret = Number.isSafeInteger(getObject(arg0));
294
358
  return ret;
295
359
  };
296
- imports.wbg.__wbg_length_65d1cd11729ced11 = function(arg0) {
360
+ imports.wbg.__wbg_length_22ac23eaec9d8053 = function(arg0) {
297
361
  const ret = getObject(arg0).length;
298
362
  return ret;
299
363
  };
300
- imports.wbg.__wbg_length_d65cf0786bfc5739 = function(arg0) {
364
+ imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
301
365
  const ret = getObject(arg0).length;
302
366
  return ret;
303
367
  };
304
- imports.wbg.__wbg_new_3ff5b33b1ce712df = function(arg0) {
368
+ imports.wbg.__wbg_new_6421f6084cc5bc5a = function(arg0) {
305
369
  const ret = new Uint8Array(getObject(arg0));
306
370
  return addHeapObject(ret);
307
371
  };
308
- imports.wbg.__wbg_set_23d69db4e5c66a6e = function(arg0, arg1, arg2) {
309
- getObject(arg0).set(getObject(arg1), arg2 >>> 0);
372
+ imports.wbg.__wbg_prototypesetcall_dfe9b766cdc1f1fd = function(arg0, arg1, arg2) {
373
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
310
374
  };
311
- imports.wbg.__wbindgen_as_number = function(arg0) {
312
- const ret = +getObject(arg0);
313
- return ret;
314
- };
315
- imports.wbg.__wbindgen_boolean_get = function(arg0) {
316
- const v = getObject(arg0);
317
- const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
318
- return ret;
319
- };
320
- imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
321
- const ret = debugString(getObject(arg1));
322
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
323
- const len1 = WASM_VECTOR_LEN;
324
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
325
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
326
- };
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;
351
- };
352
- imports.wbg.__wbindgen_memory = function() {
353
- const ret = wasm.memory;
375
+ imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
376
+ // Cast intrinsic for `Ref(String) -> Externref`.
377
+ const ret = getStringFromWasm0(arg0, arg1);
354
378
  return addHeapObject(ret);
355
379
  };
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
380
  imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
363
381
  const ret = getObject(arg0);
364
382
  return addHeapObject(ret);
@@ -366,29 +384,10 @@ function __wbg_get_imports() {
366
384
  imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
367
385
  takeObject(arg0);
368
386
  };
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
387
 
385
388
  return imports;
386
389
  }
387
390
 
388
- function __wbg_init_memory(imports, memory) {
389
-
390
- }
391
-
392
391
  function __wbg_finalize_init(instance, module) {
393
392
  wasm = instance.exports;
394
393
  __wbg_init.__wbindgen_wasm_module = module;
@@ -413,15 +412,10 @@ function initSync(module) {
413
412
  }
414
413
 
415
414
  const imports = __wbg_get_imports();
416
-
417
- __wbg_init_memory(imports);
418
-
419
415
  if (!(module instanceof WebAssembly.Module)) {
420
416
  module = new WebAssembly.Module(module);
421
417
  }
422
-
423
418
  const instance = new WebAssembly.Instance(module, imports);
424
-
425
419
  return __wbg_finalize_init(instance, module);
426
420
  }
427
421
 
@@ -446,8 +440,6 @@ async function __wbg_init(module_or_path) {
446
440
  module_or_path = fetch(module_or_path);
447
441
  }
448
442
 
449
- __wbg_init_memory(imports);
450
-
451
443
  const { instance, module } = await __wbg_load(await module_or_path, imports);
452
444
 
453
445
  return __wbg_finalize_init(instance, module);
package/json_fmt_bg.wasm CHANGED
Binary file
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
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;
5
+ export const __wbindgen_export: (a: number, b: number) => number;
6
+ export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
7
7
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
8
- export const __wbindgen_export_2: (a: number, b: number, c: number) => void;
8
+ export const __wbindgen_export3: (a: number, b: number, c: number) => void;
package/jsr.jsonc CHANGED
@@ -1,33 +1,33 @@
1
1
  {
2
- "name": "@fmt/json-fmt",
3
- "type": "module",
4
- "collaborators": [
5
- "magic-akari <akari.ccino@gmail.com>"
6
- ],
7
- "description": "JSON formatter powered by WASM ported from Biome",
8
- "version": "0.1.14",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/wasm-fmt/web_fmt"
13
- },
14
- "homepage": "https://github.com/wasm-fmt/web_fmt",
15
- "types": "json_fmt.d.ts",
16
- "sideEffects": [
17
- "./snippets/*"
18
- ],
19
- "keywords": [
20
- "wasm",
21
- "formatter",
22
- "json",
23
- "biome"
24
- ],
25
- "publishConfig": {
26
- "access": "public"
27
- },
28
- "exports": "./json_fmt.js",
29
- "exclude": [
30
- "!**",
31
- "*.tgz"
32
- ]
2
+ "name": "@fmt/json-fmt",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "magic-akari <akari.ccino@gmail.com>"
6
+ ],
7
+ "description": "JSON formatter powered by WASM ported from Biome",
8
+ "version": "0.1.15",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/wasm-fmt/web_fmt"
13
+ },
14
+ "homepage": "https://github.com/wasm-fmt/web_fmt",
15
+ "types": "json_fmt.d.ts",
16
+ "sideEffects": [
17
+ "./snippets/*"
18
+ ],
19
+ "keywords": [
20
+ "wasm",
21
+ "formatter",
22
+ "json",
23
+ "biome"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "exports": "./json_fmt.js",
29
+ "exclude": [
30
+ "!**",
31
+ "*.tgz"
32
+ ]
33
33
  }
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
- "name": "@wasm-fmt/json_fmt",
3
- "type": "module",
4
- "collaborators": [
5
- "magic-akari <akari.ccino@gmail.com>"
6
- ],
7
- "description": "JSON formatter powered by WASM ported from Biome",
8
- "version": "0.1.14",
9
- "license": "MIT",
10
- "repository": {
11
- "type": "git",
12
- "url": "https://github.com/wasm-fmt/web_fmt"
13
- },
14
- "homepage": "https://github.com/wasm-fmt/web_fmt",
15
- "types": "json_fmt.d.ts",
16
- "sideEffects": [
17
- "./snippets/*"
18
- ],
19
- "keywords": [
20
- "wasm",
21
- "formatter",
22
- "json",
23
- "biome"
24
- ],
25
- "publishConfig": {
26
- "access": "public"
27
- },
28
- "exports": {
29
- ".": {
30
- "types": "./json_fmt.d.ts",
31
- "node": "./json_fmt_node.js",
32
- "default": "./json_fmt.js"
33
- },
34
- "./vite": {
35
- "types": "./json_fmt.d.ts",
36
- "default": "./json_fmt_vite.js"
37
- },
38
- "./package.json": "./package.json",
39
- "./*": "./*"
40
- }
2
+ "name": "@wasm-fmt/json_fmt",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "magic-akari <akari.ccino@gmail.com>"
6
+ ],
7
+ "description": "JSON formatter powered by WASM ported from Biome",
8
+ "version": "0.1.15",
9
+ "license": "MIT",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/wasm-fmt/web_fmt"
13
+ },
14
+ "homepage": "https://github.com/wasm-fmt/web_fmt",
15
+ "types": "json_fmt.d.ts",
16
+ "sideEffects": [
17
+ "./snippets/*"
18
+ ],
19
+ "keywords": [
20
+ "wasm",
21
+ "formatter",
22
+ "json",
23
+ "biome"
24
+ ],
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "exports": {
29
+ ".": {
30
+ "types": "./json_fmt.d.ts",
31
+ "node": "./json_fmt_node.js",
32
+ "default": "./json_fmt.js"
33
+ },
34
+ "./vite": {
35
+ "types": "./json_fmt.d.ts",
36
+ "default": "./json_fmt_vite.js"
37
+ },
38
+ "./package.json": "./package.json",
39
+ "./*": "./*"
40
+ }
41
41
  }
Binary file
Binary file