@imferno/wasm 3.0.2-beta.af1c617 → 3.0.2-beta.b86ffac

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/imferno_wasm.js CHANGED
@@ -11,7 +11,7 @@
11
11
  *
12
12
  * Options (all optional):
13
13
  * - `coreSpec`: `"auto"` | `"v2013"` | `"v2016"` | `"v2020"`
14
- * - `app2eSpec`: `"auto"` | `"none"` | `"v2020"` | `"v2021"` | `"v2023"`
14
+ * - `app2eSpec`: `"auto"` | `"none"` | `"v2014"` | `"v2016"` | `"v2020"` | `"v2023"` | `"v2026"`
15
15
  * - `rules`: ESLint-style rules configuration object
16
16
  * @param {any} files
17
17
  * @param {any} options
@@ -26,10 +26,9 @@ export function buildReport(files, options) {
26
26
  }
27
27
 
28
28
  /**
29
- * Format a previously built `ImfReport` as a human-readable string.
29
+ * Format a validation result as a human-readable string.
30
30
  *
31
- * Pass the object returned by `buildReport()` (or any valid `ImfReport` JSON).
32
- * Returns the same output as `imferno report` on the CLI.
31
+ * Pass the object returned by `validate()`, or (legacy) by `buildReport()`.
33
32
  * @param {any} report
34
33
  * @returns {string}
35
34
  */
@@ -76,6 +75,18 @@ export function init() {
76
75
  wasm.init();
77
76
  }
78
77
 
78
+ /**
79
+ * The rule catalogue: one entry per rule with its per-edition table.
80
+ * @returns {any}
81
+ */
82
+ export function listRules() {
83
+ const ret = wasm.listRules();
84
+ if (ret[2]) {
85
+ throw takeFromExternrefTable0(ret[1]);
86
+ }
87
+ return takeFromExternrefTable0(ret[0]);
88
+ }
89
+
79
90
  /**
80
91
  * Parse an IMF package from in-memory files, returning the full parsed package.
81
92
  *
@@ -92,6 +103,19 @@ export function parsePackage(files) {
92
103
  return takeFromExternrefTable0(ret[0]);
93
104
  }
94
105
 
106
+ /**
107
+ * Convert a validation result (or its `validation` report) to a SARIF 2.1.0 log.
108
+ * @param {any} report
109
+ * @returns {any}
110
+ */
111
+ export function toSarif(report) {
112
+ const ret = wasm.toSarif(report);
113
+ if (ret[2]) {
114
+ throw takeFromExternrefTable0(ret[1]);
115
+ }
116
+ return takeFromExternrefTable0(ret[0]);
117
+ }
118
+
95
119
  /**
96
120
  * Parse and validate an IMF package in one call.
97
121
  *
@@ -113,11 +137,11 @@ export function validate(files, options) {
113
137
  function __wbg_get_imports() {
114
138
  const import0 = {
115
139
  __proto__: null,
116
- __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
140
+ __wbg_Error_208446807d0d1e30: function(arg0, arg1) {
117
141
  const ret = Error(getStringFromWasm0(arg0, arg1));
118
142
  return ret;
119
143
  },
120
- __wbg_Number_9a4e0ecb0fa16705: function(arg0) {
144
+ __wbg_Number_ff192a72a0dcdf6d: function(arg0) {
121
145
  const ret = Number(arg0);
122
146
  return ret;
123
147
  },
@@ -125,114 +149,110 @@ function __wbg_get_imports() {
125
149
  const ret = String(arg1);
126
150
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
127
151
  const len1 = WASM_VECTOR_LEN;
128
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
129
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
152
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
153
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
130
154
  },
131
- __wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
155
+ __wbg___wbindgen_bigint_get_as_i64_11da4b52cd0aedef: function(arg0, arg1) {
132
156
  const v = arg1;
133
157
  const ret = typeof(v) === 'bigint' ? v : undefined;
134
- getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
135
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
158
+ getDataViewMemory0().setBigInt64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
159
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
136
160
  },
137
- __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
161
+ __wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
138
162
  const v = arg0;
139
163
  const ret = typeof(v) === 'boolean' ? v : undefined;
140
164
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
141
165
  },
142
- __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
166
+ __wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
143
167
  const ret = debugString(arg1);
144
168
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
145
169
  const len1 = WASM_VECTOR_LEN;
146
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
147
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
170
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
171
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
148
172
  },
149
- __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
173
+ __wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
150
174
  const ret = arg0 in arg1;
151
175
  return ret;
152
176
  },
153
- __wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
177
+ __wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
154
178
  const ret = typeof(arg0) === 'bigint';
155
179
  return ret;
156
180
  },
157
- __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
181
+ __wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
158
182
  const ret = typeof(arg0) === 'function';
159
183
  return ret;
160
184
  },
161
- __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
185
+ __wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
162
186
  const ret = arg0 === null;
163
187
  return ret;
164
188
  },
165
- __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
189
+ __wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
166
190
  const val = arg0;
167
191
  const ret = typeof(val) === 'object' && val !== null;
168
192
  return ret;
169
193
  },
170
- __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
194
+ __wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
171
195
  const ret = typeof(arg0) === 'string';
172
196
  return ret;
173
197
  },
174
- __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
198
+ __wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
175
199
  const ret = arg0 === undefined;
176
200
  return ret;
177
201
  },
178
- __wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
202
+ __wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
179
203
  const ret = arg0 === arg1;
180
204
  return ret;
181
205
  },
182
- __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
206
+ __wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
183
207
  const ret = arg0 == arg1;
184
208
  return ret;
185
209
  },
186
- __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
210
+ __wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
187
211
  const obj = arg1;
188
212
  const ret = typeof(obj) === 'number' ? obj : undefined;
189
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
190
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
213
+ getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
214
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
191
215
  },
192
- __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
216
+ __wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
193
217
  const obj = arg1;
194
218
  const ret = typeof(obj) === 'string' ? obj : undefined;
195
219
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
196
220
  var len1 = WASM_VECTOR_LEN;
197
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
198
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
221
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
222
+ getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
199
223
  },
200
- __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
224
+ __wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
201
225
  throw new Error(getStringFromWasm0(arg0, arg1));
202
226
  },
203
- __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
227
+ __wbg_call_40b008ba32f73991: function() { return handleError(function (arg0, arg1) {
204
228
  const ret = arg0.call(arg1);
205
229
  return ret;
206
230
  }, arguments); },
207
- __wbg_done_89b2b13e91a60321: function(arg0) {
231
+ __wbg_done_57e08d0be6e30c02: function(arg0) {
208
232
  const ret = arg0.done;
209
233
  return ret;
210
234
  },
211
- __wbg_entries_015dc610cd81ede0: function(arg0) {
235
+ __wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
212
236
  const ret = Object.entries(arg0);
213
237
  return ret;
214
238
  },
215
- __wbg_getTime_d6f070c088c9b5ed: function(arg0) {
239
+ __wbg_getTime_edc91481cbc4cd78: function(arg0) {
216
240
  const ret = arg0.getTime();
217
241
  return ret;
218
242
  },
219
- __wbg_get_507a50627bffa49b: function(arg0, arg1) {
220
- const ret = arg0[arg1 >>> 0];
221
- return ret;
222
- },
223
- __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
243
+ __wbg_get_635eea311fa1a291: function() { return handleError(function (arg0, arg1) {
224
244
  const ret = Reflect.get(arg0, arg1);
225
245
  return ret;
226
246
  }, arguments); },
227
- __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
247
+ __wbg_get_d7176cfb76d71114: function(arg0, arg1) {
228
248
  const ret = arg0[arg1 >>> 0];
229
249
  return ret;
230
250
  },
231
- __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
232
- const ret = arg0[arg1];
251
+ __wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
252
+ const ret = arg0[arg1 >>> 0];
233
253
  return ret;
234
254
  },
235
- __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
255
+ __wbg_instanceof_ArrayBuffer_12cdaa4161423e6b: function(arg0) {
236
256
  let result;
237
257
  try {
238
258
  result = arg0 instanceof ArrayBuffer;
@@ -242,7 +262,7 @@ function __wbg_get_imports() {
242
262
  const ret = result;
243
263
  return ret;
244
264
  },
245
- __wbg_instanceof_Map_e5b5e3db98422fcc: function(arg0) {
265
+ __wbg_instanceof_Map_0b4fc8b62e73f163: function(arg0) {
246
266
  let result;
247
267
  try {
248
268
  result = arg0 instanceof Map;
@@ -252,7 +272,7 @@ function __wbg_get_imports() {
252
272
  const ret = result;
253
273
  return ret;
254
274
  },
255
- __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
275
+ __wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
256
276
  let result;
257
277
  try {
258
278
  result = arg0 instanceof Uint8Array;
@@ -262,102 +282,101 @@ function __wbg_get_imports() {
262
282
  const ret = result;
263
283
  return ret;
264
284
  },
265
- __wbg_isArray_0677c962b281d01a: function(arg0) {
285
+ __wbg_isArray_bcf1376d0d732d08: function(arg0) {
266
286
  const ret = Array.isArray(arg0);
267
287
  return ret;
268
288
  },
269
- __wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
289
+ __wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
270
290
  const ret = Number.isSafeInteger(arg0);
271
291
  return ret;
272
292
  },
273
- __wbg_iterator_6f722e4a93058b71: function() {
293
+ __wbg_iterator_e4c5e8f68ada7b58: function() {
274
294
  const ret = Symbol.iterator;
275
295
  return ret;
276
296
  },
277
- __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
297
+ __wbg_length_186163212ffe79c3: function(arg0) {
278
298
  const ret = arg0.length;
279
299
  return ret;
280
300
  },
281
- __wbg_length_370319915dc99107: function(arg0) {
301
+ __wbg_length_b03a0fabb109b1e9: function(arg0) {
282
302
  const ret = arg0.length;
283
303
  return ret;
284
304
  },
285
- __wbg_log_9010caac6e5891c3: function(arg0, arg1) {
305
+ __wbg_log_aa187d5265a78e50: function(arg0, arg1) {
286
306
  console.log(getStringFromWasm0(arg0, arg1));
287
307
  },
288
- __wbg_new_0_3da9e97f24fc69be: function() {
308
+ __wbg_new_0_36d738a0c8cfac43: function() {
289
309
  const ret = new Date();
290
310
  return ret;
291
311
  },
292
- __wbg_new_32b398fb48b6d94a: function() {
293
- const ret = new Array();
312
+ __wbg_new_13de428334042d26: function(arg0) {
313
+ const ret = new Uint8Array(arg0);
294
314
  return ret;
295
315
  },
296
- __wbg_new_7796ffc7ed656783: function() {
297
- const ret = new Map();
316
+ __wbg_new_37eb45aaf5eeb820: function() {
317
+ const ret = new Array();
298
318
  return ret;
299
319
  },
300
- __wbg_new_cd45aabdf6073e84: function(arg0) {
301
- const ret = new Uint8Array(arg0);
320
+ __wbg_new_7075786089b89c5e: function() {
321
+ const ret = new Map();
302
322
  return ret;
303
323
  },
304
- __wbg_new_da52cf8fe3429cb2: function() {
324
+ __wbg_new_cd4348290afae586: function() {
305
325
  const ret = new Object();
306
326
  return ret;
307
327
  },
308
- __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
328
+ __wbg_next_178c1651c11432b3: function(arg0) {
309
329
  const ret = arg0.next;
310
330
  return ret;
311
331
  },
312
- __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
332
+ __wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
313
333
  const ret = arg0.next();
314
334
  return ret;
315
335
  }, arguments); },
316
- __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
336
+ __wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
317
337
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
318
338
  },
319
- __wbg_set_575dd786d51585f8: function(arg0, arg1, arg2) {
339
+ __wbg_set_8282f7e0d2d01336: function(arg0, arg1, arg2) {
320
340
  const ret = arg0.set(arg1, arg2);
321
341
  return ret;
322
342
  },
323
- __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
324
- arg0[arg1] = arg2;
325
- },
326
- __wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
343
+ __wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
327
344
  arg0[arg1 >>> 0] = arg2;
328
345
  },
329
- __wbg_value_a5d5488a9589444a: function(arg0) {
346
+ __wbg_set_e4b9a833d288759a: function(arg0, arg1, arg2) {
347
+ arg0[arg1] = arg2;
348
+ },
349
+ __wbg_value_e0f328965e184931: function(arg0) {
330
350
  const ret = arg0.value;
331
351
  return ret;
332
352
  },
333
- __wbindgen_cast_0000000000000001: function(arg0) {
353
+ __wbindgen_generic_0000000000000001: function(arg0) {
334
354
  // Cast intrinsic for `F64 -> Externref`.
335
355
  const ret = arg0;
336
356
  return ret;
337
357
  },
338
- __wbindgen_cast_0000000000000002: function(arg0) {
358
+ __wbindgen_generic_0000000000000002: function(arg0) {
339
359
  // Cast intrinsic for `I64 -> Externref`.
340
360
  const ret = arg0;
341
361
  return ret;
342
362
  },
343
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
363
+ __wbindgen_generic_0000000000000003: function(arg0, arg1) {
344
364
  // Cast intrinsic for `Ref(String) -> Externref`.
345
365
  const ret = getStringFromWasm0(arg0, arg1);
346
366
  return ret;
347
367
  },
348
- __wbindgen_cast_0000000000000004: function(arg0) {
368
+ __wbindgen_generic_0000000000000004: function(arg0) {
349
369
  // Cast intrinsic for `U64 -> Externref`.
350
370
  const ret = BigInt.asUintN(64, arg0);
351
371
  return ret;
352
372
  },
353
373
  __wbindgen_init_externref_table: function() {
354
374
  const table = wasm.__wbindgen_externrefs;
355
- const offset = table.grow(4);
356
375
  table.set(0, undefined);
357
- table.set(offset + 0, undefined);
358
- table.set(offset + 1, null);
359
- table.set(offset + 2, true);
360
- table.set(offset + 3, false);
376
+ table.set(1024, undefined);
377
+ table.set(1025, null);
378
+ table.set(1026, true);
379
+ table.set(1027, false);
361
380
  },
362
381
  };
363
382
  return {
@@ -373,68 +392,61 @@ function addToExternrefTable0(obj) {
373
392
  }
374
393
 
375
394
  function debugString(val) {
376
- // primitive types
377
- const type = typeof val;
378
- if (type == 'number' || type == 'boolean' || val == null) {
379
- return `${val}`;
380
- }
381
- if (type == 'string') {
382
- return `"${val}"`;
383
- }
384
- if (type == 'symbol') {
385
- const description = val.description;
386
- if (description == null) {
387
- return 'Symbol';
388
- } else {
389
- return `Symbol(${description})`;
390
- }
391
- }
392
- if (type == 'function') {
393
- const name = val.name;
394
- if (typeof name == 'string' && name.length > 0) {
395
- return `Function(${name})`;
396
- } else {
397
- return 'Function';
398
- }
399
- }
400
- // objects
401
- if (Array.isArray(val)) {
402
- const length = val.length;
403
- let debug = '[';
404
- if (length > 0) {
405
- debug += debugString(val[0]);
406
- }
407
- for(let i = 1; i < length; i++) {
408
- debug += ', ' + debugString(val[i]);
409
- }
410
- debug += ']';
411
- return debug;
412
- }
413
- // Test for built-in
414
- const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
415
- let className;
416
- if (builtInMatches && builtInMatches.length > 1) {
417
- className = builtInMatches[1];
418
- } else {
419
- // Failed to match the standard '[object ClassName]'
420
- return toString.call(val);
421
- }
422
- if (className == 'Object') {
423
- // we're a user defined class or Object
424
- // JSON.stringify avoids problems with cycles, and is generally much
425
- // easier than looping through ownProperties of `val`.
426
- try {
427
- return 'Object(' + JSON.stringify(val) + ')';
428
- } catch (_) {
429
- return 'Object';
395
+ switch (typeof val) {
396
+ // primitive types
397
+ case 'number':
398
+ case 'boolean':
399
+ case 'undefined':
400
+ return `${val}`;
401
+ case 'string':
402
+ return JSON.stringify(val);
403
+ case 'bigint':
404
+ return `${val}n`;
405
+ case 'symbol':
406
+ return val.description !== undefined
407
+ ? `Symbol(${val.description})`
408
+ : 'Symbol';
409
+ case 'function':
410
+ return typeof val.name === 'string' && val.name !== ''
411
+ ? `Function(${val.name})`
412
+ : 'Function';
413
+ case 'object': {
414
+ if (val === null) {
415
+ return 'null';
416
+ }
417
+ // objects
418
+ if (Array.isArray(val)) {
419
+ return '[' + Array.from(val, debugString).join(', ') + ']';
420
+ }
421
+ // errors
422
+ if (val instanceof Error) {
423
+ return `${val.name}: ${val.message}\n${val.stack}`;
424
+ }
425
+
426
+ const toStringOutput = toString.call(val);
427
+ // Test for built-in
428
+ const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
429
+
430
+ // Failed to match the standard '[object ClassName]'
431
+ if (className === undefined) {
432
+ return toStringOutput;
433
+ }
434
+ if (className === 'Object') {
435
+ // we're a user defined class or Object
436
+ // JSON.stringify avoids problems with cycles, and is generally much
437
+ // easier than looping through ownProperties of `val`.
438
+ try {
439
+ return 'Object(' + JSON.stringify(val) + ')';
440
+ } catch (_) {
441
+ return 'Object';
442
+ }
443
+ }
444
+ // TODO we could test for more things here, like `Set`s and `Map`s.
445
+ return className;
430
446
  }
447
+ // Per MDN: 'This list of values is exhaustive.'
448
+ // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
431
449
  }
432
- // errors
433
- if (val instanceof Error) {
434
- return `${val.name}: ${val.message}\n${val.stack}`;
435
- }
436
- // TODO we could test for more things here, like `Set`s and `Map`s.
437
- return className;
438
450
  }
439
451
 
440
452
  function getArrayU8FromWasm0(ptr, len) {
@@ -451,7 +463,8 @@ function getDataViewMemory0() {
451
463
  }
452
464
 
453
465
  function getStringFromWasm0(ptr, len) {
454
- return decodeText(ptr >>> 0, len);
466
+ ptr = ptr >>> 0;
467
+ return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
455
468
  }
456
469
 
457
470
  let cachedUint8ArrayMemory0 = null;
@@ -518,18 +531,18 @@ function takeFromExternrefTable0(idx) {
518
531
  return value;
519
532
  }
520
533
 
521
- let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
534
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
522
535
  cachedTextDecoder.decode();
523
536
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
524
537
  let numBytesDecoded = 0;
525
- function decodeText(ptr, len) {
526
- numBytesDecoded += len;
538
+ function decodeText(bytes) {
539
+ numBytesDecoded += bytes.length;
527
540
  if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
528
- cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
541
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
529
542
  cachedTextDecoder.decode();
530
- numBytesDecoded = len;
543
+ numBytesDecoded = bytes.length;
531
544
  }
532
- return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
545
+ return cachedTextDecoder.decode(bytes);
533
546
  }
534
547
 
535
548
  const cachedTextEncoder = new TextEncoder();
@@ -560,11 +573,15 @@ function __wbg_finalize_init(instance, module) {
560
573
 
561
574
  async function __wbg_load(module, imports) {
562
575
  if (typeof Response === 'function' && module instanceof Response) {
576
+ if (!module.ok) {
577
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
578
+ }
579
+
563
580
  if (typeof WebAssembly.instantiateStreaming === 'function') {
564
581
  try {
565
582
  return await WebAssembly.instantiateStreaming(module, imports);
566
583
  } catch (e) {
567
- const validResponse = module.ok && expectedResponseType(module.type);
584
+ const validResponse = expectedResponseType(module.type);
568
585
 
569
586
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
570
587
  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);
@@ -613,9 +630,17 @@ function initSync(module) {
613
630
  return __wbg_finalize_init(instance, module);
614
631
  }
615
632
 
633
+ let __wbg_init_promise;
616
634
  async function __wbg_init(module_or_path) {
617
635
  if (wasm !== undefined) return wasm;
636
+ if (__wbg_init_promise === undefined) {
637
+ __wbg_init_promise = __wbg_init_once(module_or_path);
638
+ __wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
639
+ }
640
+ return __wbg_init_promise;
641
+ }
618
642
 
643
+ async function __wbg_init_once(module_or_path) {
619
644
 
620
645
  if (module_or_path !== undefined) {
621
646
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
Binary file
@@ -5,13 +5,15 @@ export const buildReport: (a: any, b: any) => [number, number, number];
5
5
  export const formatReport: (a: any) => [number, number, number, number];
6
6
  export const getVersion: () => [number, number];
7
7
  export const init: () => void;
8
+ export const listRules: () => [number, number, number];
8
9
  export const parsePackage: (a: any) => [number, number, number];
10
+ export const toSarif: (a: any) => [number, number, number];
9
11
  export const validate: (a: any, b: any) => [number, number, number];
10
12
  export const __wbindgen_malloc: (a: number, b: number) => number;
11
13
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
14
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
12
15
  export const __wbindgen_exn_store: (a: number) => void;
13
16
  export const __externref_table_alloc: () => number;
14
17
  export const __wbindgen_externrefs: WebAssembly.Table;
15
18
  export const __externref_table_dealloc: (a: number) => void;
16
- export const __wbindgen_free: (a: number, b: number, c: number) => void;
17
19
  export const __wbindgen_start: () => void;