@imferno/wasm 3.0.2-beta.5ca55af → 3.0.2-beta.67b6b7d

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