@imferno/wasm 3.0.2-beta.40c3306 → 3.0.2-beta.43d9cf9

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