@imferno/wasm 3.0.2-beta.5ca55af → 3.0.2-beta.5e31333
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 +22 -14
- package/codes.d.ts +243 -331
- package/codes.js +243 -331
- package/imferno_wasm.d.ts +22 -482
- package/imferno_wasm.js +180 -150
- 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 +1503 -0
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
|
-
*
|
|
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
|
|
34
|
+
* Format a validation result as a human-readable string.
|
|
30
35
|
*
|
|
31
|
-
* Pass the object returned by `
|
|
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
|
-
|
|
145
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
117
146
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
118
147
|
return ret;
|
|
119
148
|
},
|
|
120
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
178
|
+
__wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
|
|
150
179
|
const ret = arg0 in arg1;
|
|
151
180
|
return ret;
|
|
152
181
|
},
|
|
153
|
-
|
|
182
|
+
__wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
|
|
154
183
|
const ret = typeof(arg0) === 'bigint';
|
|
155
184
|
return ret;
|
|
156
185
|
},
|
|
157
|
-
|
|
186
|
+
__wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
|
|
158
187
|
const ret = typeof(arg0) === 'function';
|
|
159
188
|
return ret;
|
|
160
189
|
},
|
|
161
|
-
|
|
190
|
+
__wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
|
|
162
191
|
const ret = arg0 === null;
|
|
163
192
|
return ret;
|
|
164
193
|
},
|
|
165
|
-
|
|
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
|
-
|
|
199
|
+
__wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
|
|
171
200
|
const ret = typeof(arg0) === 'string';
|
|
172
201
|
return ret;
|
|
173
202
|
},
|
|
174
|
-
|
|
203
|
+
__wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
|
|
175
204
|
const ret = arg0 === undefined;
|
|
176
205
|
return ret;
|
|
177
206
|
},
|
|
178
|
-
|
|
207
|
+
__wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
|
|
179
208
|
const ret = arg0 === arg1;
|
|
180
209
|
return ret;
|
|
181
210
|
},
|
|
182
|
-
|
|
211
|
+
__wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
|
|
183
212
|
const ret = arg0 == arg1;
|
|
184
213
|
return ret;
|
|
185
214
|
},
|
|
186
|
-
|
|
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
|
-
|
|
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
|
-
|
|
229
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
201
230
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
202
231
|
},
|
|
203
|
-
|
|
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
|
-
|
|
236
|
+
__wbg_done_57e08d0be6e30c02: function(arg0) {
|
|
208
237
|
const ret = arg0.done;
|
|
209
238
|
return ret;
|
|
210
239
|
},
|
|
211
|
-
|
|
240
|
+
__wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
|
|
212
241
|
const ret = Object.entries(arg0);
|
|
213
242
|
return ret;
|
|
214
243
|
},
|
|
215
|
-
|
|
244
|
+
__wbg_getTime_edc91481cbc4cd78: function(arg0) {
|
|
216
245
|
const ret = arg0.getTime();
|
|
217
246
|
return ret;
|
|
218
247
|
},
|
|
219
|
-
|
|
220
|
-
const ret = arg0[arg1 >>> 0];
|
|
221
|
-
return ret;
|
|
222
|
-
},
|
|
223
|
-
__wbg_get_9a29be2cb383ed9a: 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
|
-
|
|
252
|
+
__wbg_get_d7176cfb76d71114: function(arg0, arg1) {
|
|
228
253
|
const ret = arg0[arg1 >>> 0];
|
|
229
254
|
return ret;
|
|
230
255
|
},
|
|
231
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
290
|
+
__wbg_isArray_bcf1376d0d732d08: function(arg0) {
|
|
266
291
|
const ret = Array.isArray(arg0);
|
|
267
292
|
return ret;
|
|
268
293
|
},
|
|
269
|
-
|
|
294
|
+
__wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
|
|
270
295
|
const ret = Number.isSafeInteger(arg0);
|
|
271
296
|
return ret;
|
|
272
297
|
},
|
|
273
|
-
|
|
298
|
+
__wbg_iterator_e4c5e8f68ada7b58: function() {
|
|
274
299
|
const ret = Symbol.iterator;
|
|
275
300
|
return ret;
|
|
276
301
|
},
|
|
277
|
-
|
|
302
|
+
__wbg_length_186163212ffe79c3: function(arg0) {
|
|
278
303
|
const ret = arg0.length;
|
|
279
304
|
return ret;
|
|
280
305
|
},
|
|
281
|
-
|
|
306
|
+
__wbg_length_b03a0fabb109b1e9: function(arg0) {
|
|
282
307
|
const ret = arg0.length;
|
|
283
308
|
return ret;
|
|
284
309
|
},
|
|
285
|
-
|
|
310
|
+
__wbg_log_aa187d5265a78e50: function(arg0, arg1) {
|
|
286
311
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
287
312
|
},
|
|
288
|
-
|
|
313
|
+
__wbg_new_0_36d738a0c8cfac43: function() {
|
|
289
314
|
const ret = new Date();
|
|
290
315
|
return ret;
|
|
291
316
|
},
|
|
292
|
-
|
|
293
|
-
const ret = new
|
|
317
|
+
__wbg_new_13de428334042d26: function(arg0) {
|
|
318
|
+
const ret = new Uint8Array(arg0);
|
|
294
319
|
return ret;
|
|
295
320
|
},
|
|
296
|
-
|
|
321
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
322
|
+
const ret = new Array();
|
|
323
|
+
return ret;
|
|
324
|
+
},
|
|
325
|
+
__wbg_new_7075786089b89c5e: function() {
|
|
297
326
|
const ret = new Map();
|
|
298
327
|
return ret;
|
|
299
328
|
},
|
|
300
|
-
|
|
301
|
-
const ret = new
|
|
329
|
+
__wbg_new_cd4348290afae586: function() {
|
|
330
|
+
const ret = new Object();
|
|
302
331
|
return ret;
|
|
303
332
|
},
|
|
304
|
-
|
|
305
|
-
const ret =
|
|
333
|
+
__wbg_next_178c1651c11432b3: function(arg0) {
|
|
334
|
+
const ret = arg0.next;
|
|
306
335
|
return ret;
|
|
307
336
|
},
|
|
308
|
-
|
|
337
|
+
__wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
|
|
309
338
|
const ret = arg0.next();
|
|
310
339
|
return ret;
|
|
311
340
|
}, arguments); },
|
|
312
|
-
|
|
313
|
-
const ret = arg0.next;
|
|
314
|
-
return ret;
|
|
315
|
-
},
|
|
316
|
-
__wbg_prototypesetcall_d721637c7ca66eb8: 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
|
-
|
|
320
|
-
arg0[arg1] = arg2;
|
|
321
|
-
},
|
|
322
|
-
__wbg_set_9a1d61e17de7054c: function(arg0, arg1, arg2) {
|
|
344
|
+
__wbg_set_8282f7e0d2d01336: function(arg0, arg1, arg2) {
|
|
323
345
|
const ret = arg0.set(arg1, arg2);
|
|
324
346
|
return ret;
|
|
325
347
|
},
|
|
326
|
-
|
|
348
|
+
__wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
|
|
327
349
|
arg0[arg1 >>> 0] = arg2;
|
|
328
350
|
},
|
|
329
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
358
|
-
table.set(
|
|
359
|
-
table.set(
|
|
360
|
-
table.set(
|
|
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
|
-
|
|
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';
|
|
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
|
-
|
|
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
|
|
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(
|
|
526
|
-
numBytesDecoded +=
|
|
543
|
+
function decodeText(bytes) {
|
|
544
|
+
numBytesDecoded += bytes.length;
|
|
527
545
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
528
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
546
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
529
547
|
cachedTextDecoder.decode();
|
|
530
|
-
numBytesDecoded =
|
|
548
|
+
numBytesDecoded = bytes.length;
|
|
531
549
|
}
|
|
532
|
-
return cachedTextDecoder.decode(
|
|
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 =
|
|
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) {
|
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;
|