@imferno/wasm 3.0.2-beta.a74d1f3 → 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/README.md +19 -13
- package/codes.d.ts +250 -332
- package/codes.js +250 -332
- package/imferno_wasm.d.ts +16 -481
- package/imferno_wasm.js +174 -149
- package/imferno_wasm_bg.wasm +0 -0
- package/imferno_wasm_bg.wasm.d.ts +3 -1
- package/index.d.ts +67 -49
- package/index.js +23 -4
- package/package.json +4 -1
- package/types.d.ts +1478 -0
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"` | `"
|
|
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
|
|
29
|
+
* Format a validation result as a human-readable string.
|
|
30
30
|
*
|
|
31
|
-
* Pass the object returned by `
|
|
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
|
-
|
|
140
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
117
141
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
118
142
|
return ret;
|
|
119
143
|
},
|
|
120
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
173
|
+
__wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
|
|
150
174
|
const ret = arg0 in arg1;
|
|
151
175
|
return ret;
|
|
152
176
|
},
|
|
153
|
-
|
|
177
|
+
__wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
|
|
154
178
|
const ret = typeof(arg0) === 'bigint';
|
|
155
179
|
return ret;
|
|
156
180
|
},
|
|
157
|
-
|
|
181
|
+
__wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
|
|
158
182
|
const ret = typeof(arg0) === 'function';
|
|
159
183
|
return ret;
|
|
160
184
|
},
|
|
161
|
-
|
|
185
|
+
__wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
|
|
162
186
|
const ret = arg0 === null;
|
|
163
187
|
return ret;
|
|
164
188
|
},
|
|
165
|
-
|
|
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
|
-
|
|
194
|
+
__wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
|
|
171
195
|
const ret = typeof(arg0) === 'string';
|
|
172
196
|
return ret;
|
|
173
197
|
},
|
|
174
|
-
|
|
198
|
+
__wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
|
|
175
199
|
const ret = arg0 === undefined;
|
|
176
200
|
return ret;
|
|
177
201
|
},
|
|
178
|
-
|
|
202
|
+
__wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
|
|
179
203
|
const ret = arg0 === arg1;
|
|
180
204
|
return ret;
|
|
181
205
|
},
|
|
182
|
-
|
|
206
|
+
__wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
|
|
183
207
|
const ret = arg0 == arg1;
|
|
184
208
|
return ret;
|
|
185
209
|
},
|
|
186
|
-
|
|
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
|
-
|
|
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
|
-
|
|
224
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
201
225
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
202
226
|
},
|
|
203
|
-
|
|
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
|
-
|
|
231
|
+
__wbg_done_57e08d0be6e30c02: function(arg0) {
|
|
208
232
|
const ret = arg0.done;
|
|
209
233
|
return ret;
|
|
210
234
|
},
|
|
211
|
-
|
|
235
|
+
__wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
|
|
212
236
|
const ret = Object.entries(arg0);
|
|
213
237
|
return ret;
|
|
214
238
|
},
|
|
215
|
-
|
|
239
|
+
__wbg_getTime_edc91481cbc4cd78: function(arg0) {
|
|
216
240
|
const ret = arg0.getTime();
|
|
217
241
|
return ret;
|
|
218
242
|
},
|
|
219
|
-
|
|
220
|
-
const ret = arg0[arg1 >>> 0];
|
|
221
|
-
return ret;
|
|
222
|
-
},
|
|
223
|
-
__wbg_get_9a29be2cb383ed9a: 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
|
-
|
|
247
|
+
__wbg_get_d7176cfb76d71114: function(arg0, arg1) {
|
|
228
248
|
const ret = arg0[arg1 >>> 0];
|
|
229
249
|
return ret;
|
|
230
250
|
},
|
|
231
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
285
|
+
__wbg_isArray_bcf1376d0d732d08: function(arg0) {
|
|
266
286
|
const ret = Array.isArray(arg0);
|
|
267
287
|
return ret;
|
|
268
288
|
},
|
|
269
|
-
|
|
289
|
+
__wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
|
|
270
290
|
const ret = Number.isSafeInteger(arg0);
|
|
271
291
|
return ret;
|
|
272
292
|
},
|
|
273
|
-
|
|
293
|
+
__wbg_iterator_e4c5e8f68ada7b58: function() {
|
|
274
294
|
const ret = Symbol.iterator;
|
|
275
295
|
return ret;
|
|
276
296
|
},
|
|
277
|
-
|
|
297
|
+
__wbg_length_186163212ffe79c3: function(arg0) {
|
|
278
298
|
const ret = arg0.length;
|
|
279
299
|
return ret;
|
|
280
300
|
},
|
|
281
|
-
|
|
301
|
+
__wbg_length_b03a0fabb109b1e9: function(arg0) {
|
|
282
302
|
const ret = arg0.length;
|
|
283
303
|
return ret;
|
|
284
304
|
},
|
|
285
|
-
|
|
305
|
+
__wbg_log_aa187d5265a78e50: function(arg0, arg1) {
|
|
286
306
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
287
307
|
},
|
|
288
|
-
|
|
308
|
+
__wbg_new_0_36d738a0c8cfac43: function() {
|
|
289
309
|
const ret = new Date();
|
|
290
310
|
return ret;
|
|
291
311
|
},
|
|
292
|
-
|
|
293
|
-
const ret = new
|
|
312
|
+
__wbg_new_13de428334042d26: function(arg0) {
|
|
313
|
+
const ret = new Uint8Array(arg0);
|
|
294
314
|
return ret;
|
|
295
315
|
},
|
|
296
|
-
|
|
316
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
317
|
+
const ret = new Array();
|
|
318
|
+
return ret;
|
|
319
|
+
},
|
|
320
|
+
__wbg_new_7075786089b89c5e: function() {
|
|
297
321
|
const ret = new Map();
|
|
298
322
|
return ret;
|
|
299
323
|
},
|
|
300
|
-
|
|
301
|
-
const ret = new
|
|
324
|
+
__wbg_new_cd4348290afae586: function() {
|
|
325
|
+
const ret = new Object();
|
|
302
326
|
return ret;
|
|
303
327
|
},
|
|
304
|
-
|
|
305
|
-
const ret =
|
|
328
|
+
__wbg_next_178c1651c11432b3: function(arg0) {
|
|
329
|
+
const ret = arg0.next;
|
|
306
330
|
return ret;
|
|
307
331
|
},
|
|
308
|
-
|
|
332
|
+
__wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
|
|
309
333
|
const ret = arg0.next();
|
|
310
334
|
return ret;
|
|
311
335
|
}, arguments); },
|
|
312
|
-
|
|
313
|
-
const ret = arg0.next;
|
|
314
|
-
return ret;
|
|
315
|
-
},
|
|
316
|
-
__wbg_prototypesetcall_d721637c7ca66eb8: 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
|
-
|
|
320
|
-
arg0[arg1] = arg2;
|
|
321
|
-
},
|
|
322
|
-
__wbg_set_9a1d61e17de7054c: function(arg0, arg1, arg2) {
|
|
339
|
+
__wbg_set_8282f7e0d2d01336: function(arg0, arg1, arg2) {
|
|
323
340
|
const ret = arg0.set(arg1, arg2);
|
|
324
341
|
return ret;
|
|
325
342
|
},
|
|
326
|
-
|
|
343
|
+
__wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
|
|
327
344
|
arg0[arg1 >>> 0] = arg2;
|
|
328
345
|
},
|
|
329
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
358
|
-
table.set(
|
|
359
|
-
table.set(
|
|
360
|
-
table.set(
|
|
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
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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
|
-
|
|
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
|
|
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(
|
|
526
|
-
numBytesDecoded +=
|
|
538
|
+
function decodeText(bytes) {
|
|
539
|
+
numBytesDecoded += bytes.length;
|
|
527
540
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
528
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
541
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
529
542
|
cachedTextDecoder.decode();
|
|
530
|
-
numBytesDecoded =
|
|
543
|
+
numBytesDecoded = bytes.length;
|
|
531
544
|
}
|
|
532
|
-
return cachedTextDecoder.decode(
|
|
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 =
|
|
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) {
|
package/imferno_wasm_bg.wasm
CHANGED
|
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;
|