@imferno/wasm 3.0.2-beta.f424a0b → 3.0.2-beta.f5a3d3f
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 +17 -11
- package/codes.d.ts +200 -64
- package/codes.js +200 -64
- package/imferno_wasm.d.ts +4 -481
- package/imferno_wasm.js +146 -146
- package/imferno_wasm_bg.wasm +0 -0
- package/imferno_wasm_bg.wasm.d.ts +1 -1
- package/index.d.ts +41 -48
- package/index.js +11 -4
- package/package.json +4 -1
- package/types.d.ts +1341 -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
|
*/
|
|
@@ -113,11 +112,11 @@ export function validate(files, options) {
|
|
|
113
112
|
function __wbg_get_imports() {
|
|
114
113
|
const import0 = {
|
|
115
114
|
__proto__: null,
|
|
116
|
-
|
|
115
|
+
__wbg_Error_208446807d0d1e30: function(arg0, arg1) {
|
|
117
116
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
118
117
|
return ret;
|
|
119
118
|
},
|
|
120
|
-
|
|
119
|
+
__wbg_Number_ff192a72a0dcdf6d: function(arg0) {
|
|
121
120
|
const ret = Number(arg0);
|
|
122
121
|
return ret;
|
|
123
122
|
},
|
|
@@ -125,114 +124,110 @@ function __wbg_get_imports() {
|
|
|
125
124
|
const ret = String(arg1);
|
|
126
125
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
127
126
|
const len1 = WASM_VECTOR_LEN;
|
|
128
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
129
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
127
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
128
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
130
129
|
},
|
|
131
|
-
|
|
130
|
+
__wbg___wbindgen_bigint_get_as_i64_11da4b52cd0aedef: function(arg0, arg1) {
|
|
132
131
|
const v = arg1;
|
|
133
132
|
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);
|
|
133
|
+
getDataViewMemory0().setBigInt64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
134
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
|
|
136
135
|
},
|
|
137
|
-
|
|
136
|
+
__wbg___wbindgen_boolean_get_4f1baf9a00be3c74: function(arg0) {
|
|
138
137
|
const v = arg0;
|
|
139
138
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
140
139
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
141
140
|
},
|
|
142
|
-
|
|
141
|
+
__wbg___wbindgen_debug_string_f249a2a76caa9a55: function(arg0, arg1) {
|
|
143
142
|
const ret = debugString(arg1);
|
|
144
143
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
145
144
|
const len1 = WASM_VECTOR_LEN;
|
|
146
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
147
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
145
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
146
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
148
147
|
},
|
|
149
|
-
|
|
148
|
+
__wbg___wbindgen_in_3f58a9d3b3a7eed2: function(arg0, arg1) {
|
|
150
149
|
const ret = arg0 in arg1;
|
|
151
150
|
return ret;
|
|
152
151
|
},
|
|
153
|
-
|
|
152
|
+
__wbg___wbindgen_is_bigint_5fa10641e039d3ef: function(arg0) {
|
|
154
153
|
const ret = typeof(arg0) === 'bigint';
|
|
155
154
|
return ret;
|
|
156
155
|
},
|
|
157
|
-
|
|
156
|
+
__wbg___wbindgen_is_function_741ff2bb612836f5: function(arg0) {
|
|
158
157
|
const ret = typeof(arg0) === 'function';
|
|
159
158
|
return ret;
|
|
160
159
|
},
|
|
161
|
-
|
|
160
|
+
__wbg___wbindgen_is_null_c22311b1cc228e3a: function(arg0) {
|
|
162
161
|
const ret = arg0 === null;
|
|
163
162
|
return ret;
|
|
164
163
|
},
|
|
165
|
-
|
|
164
|
+
__wbg___wbindgen_is_object_8b968c3ab8e96595: function(arg0) {
|
|
166
165
|
const val = arg0;
|
|
167
166
|
const ret = typeof(val) === 'object' && val !== null;
|
|
168
167
|
return ret;
|
|
169
168
|
},
|
|
170
|
-
|
|
169
|
+
__wbg___wbindgen_is_string_fc456fee5d3317de: function(arg0) {
|
|
171
170
|
const ret = typeof(arg0) === 'string';
|
|
172
171
|
return ret;
|
|
173
172
|
},
|
|
174
|
-
|
|
173
|
+
__wbg___wbindgen_is_undefined_be5b34249ff1fc15: function(arg0) {
|
|
175
174
|
const ret = arg0 === undefined;
|
|
176
175
|
return ret;
|
|
177
176
|
},
|
|
178
|
-
|
|
177
|
+
__wbg___wbindgen_jsval_eq_38d7bfbe4cc84039: function(arg0, arg1) {
|
|
179
178
|
const ret = arg0 === arg1;
|
|
180
179
|
return ret;
|
|
181
180
|
},
|
|
182
|
-
|
|
181
|
+
__wbg___wbindgen_jsval_loose_eq_b2f214e2e4b30e36: function(arg0, arg1) {
|
|
183
182
|
const ret = arg0 == arg1;
|
|
184
183
|
return ret;
|
|
185
184
|
},
|
|
186
|
-
|
|
185
|
+
__wbg___wbindgen_number_get_934b640d0889af78: function(arg0, arg1) {
|
|
187
186
|
const obj = arg1;
|
|
188
187
|
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);
|
|
188
|
+
getDataViewMemory0().setFloat64((arg0 >>> 0) + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
189
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, !isLikeNone(ret), true);
|
|
191
190
|
},
|
|
192
|
-
|
|
191
|
+
__wbg___wbindgen_string_get_7ce8eee7fd327545: function(arg0, arg1) {
|
|
193
192
|
const obj = arg1;
|
|
194
193
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
195
194
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
196
195
|
var len1 = WASM_VECTOR_LEN;
|
|
197
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
198
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
196
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
197
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
199
198
|
},
|
|
200
|
-
|
|
199
|
+
__wbg___wbindgen_throw_4c88d8bf264fd984: function(arg0, arg1) {
|
|
201
200
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
202
201
|
},
|
|
203
|
-
|
|
202
|
+
__wbg_call_40b008ba32f73991: function() { return handleError(function (arg0, arg1) {
|
|
204
203
|
const ret = arg0.call(arg1);
|
|
205
204
|
return ret;
|
|
206
205
|
}, arguments); },
|
|
207
|
-
|
|
206
|
+
__wbg_done_57e08d0be6e30c02: function(arg0) {
|
|
208
207
|
const ret = arg0.done;
|
|
209
208
|
return ret;
|
|
210
209
|
},
|
|
211
|
-
|
|
210
|
+
__wbg_entries_7bb1459bd9b5c2b9: function(arg0) {
|
|
212
211
|
const ret = Object.entries(arg0);
|
|
213
212
|
return ret;
|
|
214
213
|
},
|
|
215
|
-
|
|
214
|
+
__wbg_getTime_edc91481cbc4cd78: function(arg0) {
|
|
216
215
|
const ret = arg0.getTime();
|
|
217
216
|
return ret;
|
|
218
217
|
},
|
|
219
|
-
|
|
220
|
-
const ret = arg0[arg1 >>> 0];
|
|
221
|
-
return ret;
|
|
222
|
-
},
|
|
223
|
-
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
218
|
+
__wbg_get_635eea311fa1a291: function() { return handleError(function (arg0, arg1) {
|
|
224
219
|
const ret = Reflect.get(arg0, arg1);
|
|
225
220
|
return ret;
|
|
226
221
|
}, arguments); },
|
|
227
|
-
|
|
222
|
+
__wbg_get_d7176cfb76d71114: function(arg0, arg1) {
|
|
228
223
|
const ret = arg0[arg1 >>> 0];
|
|
229
224
|
return ret;
|
|
230
225
|
},
|
|
231
|
-
|
|
232
|
-
const ret = arg0[arg1];
|
|
226
|
+
__wbg_get_unchecked_e6325ad374eff861: function(arg0, arg1) {
|
|
227
|
+
const ret = arg0[arg1 >>> 0];
|
|
233
228
|
return ret;
|
|
234
229
|
},
|
|
235
|
-
|
|
230
|
+
__wbg_instanceof_ArrayBuffer_12cdaa4161423e6b: function(arg0) {
|
|
236
231
|
let result;
|
|
237
232
|
try {
|
|
238
233
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -242,7 +237,7 @@ function __wbg_get_imports() {
|
|
|
242
237
|
const ret = result;
|
|
243
238
|
return ret;
|
|
244
239
|
},
|
|
245
|
-
|
|
240
|
+
__wbg_instanceof_Map_0b4fc8b62e73f163: function(arg0) {
|
|
246
241
|
let result;
|
|
247
242
|
try {
|
|
248
243
|
result = arg0 instanceof Map;
|
|
@@ -252,7 +247,7 @@ function __wbg_get_imports() {
|
|
|
252
247
|
const ret = result;
|
|
253
248
|
return ret;
|
|
254
249
|
},
|
|
255
|
-
|
|
250
|
+
__wbg_instanceof_Uint8Array_d7aeb0dcb3108fea: function(arg0) {
|
|
256
251
|
let result;
|
|
257
252
|
try {
|
|
258
253
|
result = arg0 instanceof Uint8Array;
|
|
@@ -262,102 +257,101 @@ function __wbg_get_imports() {
|
|
|
262
257
|
const ret = result;
|
|
263
258
|
return ret;
|
|
264
259
|
},
|
|
265
|
-
|
|
260
|
+
__wbg_isArray_bcf1376d0d732d08: function(arg0) {
|
|
266
261
|
const ret = Array.isArray(arg0);
|
|
267
262
|
return ret;
|
|
268
263
|
},
|
|
269
|
-
|
|
264
|
+
__wbg_isSafeInteger_1a35ba4d31e71d38: function(arg0) {
|
|
270
265
|
const ret = Number.isSafeInteger(arg0);
|
|
271
266
|
return ret;
|
|
272
267
|
},
|
|
273
|
-
|
|
268
|
+
__wbg_iterator_e4c5e8f68ada7b58: function() {
|
|
274
269
|
const ret = Symbol.iterator;
|
|
275
270
|
return ret;
|
|
276
271
|
},
|
|
277
|
-
|
|
272
|
+
__wbg_length_186163212ffe79c3: function(arg0) {
|
|
278
273
|
const ret = arg0.length;
|
|
279
274
|
return ret;
|
|
280
275
|
},
|
|
281
|
-
|
|
276
|
+
__wbg_length_b03a0fabb109b1e9: function(arg0) {
|
|
282
277
|
const ret = arg0.length;
|
|
283
278
|
return ret;
|
|
284
279
|
},
|
|
285
|
-
|
|
280
|
+
__wbg_log_aa187d5265a78e50: function(arg0, arg1) {
|
|
286
281
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
287
282
|
},
|
|
288
|
-
|
|
283
|
+
__wbg_new_0_36d738a0c8cfac43: function() {
|
|
289
284
|
const ret = new Date();
|
|
290
285
|
return ret;
|
|
291
286
|
},
|
|
292
|
-
|
|
293
|
-
const ret = new
|
|
287
|
+
__wbg_new_13de428334042d26: function(arg0) {
|
|
288
|
+
const ret = new Uint8Array(arg0);
|
|
294
289
|
return ret;
|
|
295
290
|
},
|
|
296
|
-
|
|
297
|
-
const ret = new
|
|
291
|
+
__wbg_new_37eb45aaf5eeb820: function() {
|
|
292
|
+
const ret = new Array();
|
|
298
293
|
return ret;
|
|
299
294
|
},
|
|
300
|
-
|
|
301
|
-
const ret = new
|
|
295
|
+
__wbg_new_7075786089b89c5e: function() {
|
|
296
|
+
const ret = new Map();
|
|
302
297
|
return ret;
|
|
303
298
|
},
|
|
304
|
-
|
|
299
|
+
__wbg_new_cd4348290afae586: function() {
|
|
305
300
|
const ret = new Object();
|
|
306
301
|
return ret;
|
|
307
302
|
},
|
|
308
|
-
|
|
303
|
+
__wbg_next_178c1651c11432b3: function(arg0) {
|
|
309
304
|
const ret = arg0.next;
|
|
310
305
|
return ret;
|
|
311
306
|
},
|
|
312
|
-
|
|
307
|
+
__wbg_next_af5ac6a08bb0a717: function() { return handleError(function (arg0) {
|
|
313
308
|
const ret = arg0.next();
|
|
314
309
|
return ret;
|
|
315
310
|
}, arguments); },
|
|
316
|
-
|
|
311
|
+
__wbg_prototypesetcall_13162965d1fe7aa3: function(arg0, arg1, arg2) {
|
|
317
312
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
318
313
|
},
|
|
319
|
-
|
|
314
|
+
__wbg_set_8282f7e0d2d01336: function(arg0, arg1, arg2) {
|
|
320
315
|
const ret = arg0.set(arg1, arg2);
|
|
321
316
|
return ret;
|
|
322
317
|
},
|
|
323
|
-
|
|
324
|
-
arg0[arg1] = arg2;
|
|
325
|
-
},
|
|
326
|
-
__wbg_set_8a16b38e4805b298: function(arg0, arg1, arg2) {
|
|
318
|
+
__wbg_set_d2d33b52458e984a: function(arg0, arg1, arg2) {
|
|
327
319
|
arg0[arg1 >>> 0] = arg2;
|
|
328
320
|
},
|
|
329
|
-
|
|
321
|
+
__wbg_set_e4b9a833d288759a: function(arg0, arg1, arg2) {
|
|
322
|
+
arg0[arg1] = arg2;
|
|
323
|
+
},
|
|
324
|
+
__wbg_value_e0f328965e184931: function(arg0) {
|
|
330
325
|
const ret = arg0.value;
|
|
331
326
|
return ret;
|
|
332
327
|
},
|
|
333
|
-
|
|
328
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
334
329
|
// Cast intrinsic for `F64 -> Externref`.
|
|
335
330
|
const ret = arg0;
|
|
336
331
|
return ret;
|
|
337
332
|
},
|
|
338
|
-
|
|
333
|
+
__wbindgen_generic_0000000000000002: function(arg0) {
|
|
339
334
|
// Cast intrinsic for `I64 -> Externref`.
|
|
340
335
|
const ret = arg0;
|
|
341
336
|
return ret;
|
|
342
337
|
},
|
|
343
|
-
|
|
338
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
344
339
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
345
340
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
346
341
|
return ret;
|
|
347
342
|
},
|
|
348
|
-
|
|
343
|
+
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
349
344
|
// Cast intrinsic for `U64 -> Externref`.
|
|
350
345
|
const ret = BigInt.asUintN(64, arg0);
|
|
351
346
|
return ret;
|
|
352
347
|
},
|
|
353
348
|
__wbindgen_init_externref_table: function() {
|
|
354
349
|
const table = wasm.__wbindgen_externrefs;
|
|
355
|
-
const offset = table.grow(4);
|
|
356
350
|
table.set(0, undefined);
|
|
357
|
-
table.set(
|
|
358
|
-
table.set(
|
|
359
|
-
table.set(
|
|
360
|
-
table.set(
|
|
351
|
+
table.set(1024, undefined);
|
|
352
|
+
table.set(1025, null);
|
|
353
|
+
table.set(1026, true);
|
|
354
|
+
table.set(1027, false);
|
|
361
355
|
},
|
|
362
356
|
};
|
|
363
357
|
return {
|
|
@@ -373,68 +367,61 @@ function addToExternrefTable0(obj) {
|
|
|
373
367
|
}
|
|
374
368
|
|
|
375
369
|
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';
|
|
370
|
+
switch (typeof val) {
|
|
371
|
+
// primitive types
|
|
372
|
+
case 'number':
|
|
373
|
+
case 'boolean':
|
|
374
|
+
case 'undefined':
|
|
375
|
+
return `${val}`;
|
|
376
|
+
case 'string':
|
|
377
|
+
return JSON.stringify(val);
|
|
378
|
+
case 'bigint':
|
|
379
|
+
return `${val}n`;
|
|
380
|
+
case 'symbol':
|
|
381
|
+
return val.description !== undefined
|
|
382
|
+
? `Symbol(${val.description})`
|
|
383
|
+
: 'Symbol';
|
|
384
|
+
case 'function':
|
|
385
|
+
return typeof val.name === 'string' && val.name !== ''
|
|
386
|
+
? `Function(${val.name})`
|
|
387
|
+
: 'Function';
|
|
388
|
+
case 'object': {
|
|
389
|
+
if (val === null) {
|
|
390
|
+
return 'null';
|
|
391
|
+
}
|
|
392
|
+
// objects
|
|
393
|
+
if (Array.isArray(val)) {
|
|
394
|
+
return '[' + Array.from(val, debugString).join(', ') + ']';
|
|
395
|
+
}
|
|
396
|
+
// errors
|
|
397
|
+
if (val instanceof Error) {
|
|
398
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
const toStringOutput = toString.call(val);
|
|
402
|
+
// Test for built-in
|
|
403
|
+
const className = /\[object ([^\]]+)\]/.exec(toStringOutput)?.[1];
|
|
404
|
+
|
|
405
|
+
// Failed to match the standard '[object ClassName]'
|
|
406
|
+
if (className === undefined) {
|
|
407
|
+
return toStringOutput;
|
|
408
|
+
}
|
|
409
|
+
if (className === 'Object') {
|
|
410
|
+
// we're a user defined class or Object
|
|
411
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
412
|
+
// easier than looping through ownProperties of `val`.
|
|
413
|
+
try {
|
|
414
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
415
|
+
} catch (_) {
|
|
416
|
+
return 'Object';
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
420
|
+
return className;
|
|
430
421
|
}
|
|
422
|
+
// Per MDN: 'This list of values is exhaustive.'
|
|
423
|
+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof#description
|
|
431
424
|
}
|
|
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
425
|
}
|
|
439
426
|
|
|
440
427
|
function getArrayU8FromWasm0(ptr, len) {
|
|
@@ -451,7 +438,8 @@ function getDataViewMemory0() {
|
|
|
451
438
|
}
|
|
452
439
|
|
|
453
440
|
function getStringFromWasm0(ptr, len) {
|
|
454
|
-
|
|
441
|
+
ptr = ptr >>> 0;
|
|
442
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
455
443
|
}
|
|
456
444
|
|
|
457
445
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -518,18 +506,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
518
506
|
return value;
|
|
519
507
|
}
|
|
520
508
|
|
|
521
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
509
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
522
510
|
cachedTextDecoder.decode();
|
|
523
511
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
524
512
|
let numBytesDecoded = 0;
|
|
525
|
-
function decodeText(
|
|
526
|
-
numBytesDecoded +=
|
|
513
|
+
function decodeText(bytes) {
|
|
514
|
+
numBytesDecoded += bytes.length;
|
|
527
515
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
528
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
516
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
529
517
|
cachedTextDecoder.decode();
|
|
530
|
-
numBytesDecoded =
|
|
518
|
+
numBytesDecoded = bytes.length;
|
|
531
519
|
}
|
|
532
|
-
return cachedTextDecoder.decode(
|
|
520
|
+
return cachedTextDecoder.decode(bytes);
|
|
533
521
|
}
|
|
534
522
|
|
|
535
523
|
const cachedTextEncoder = new TextEncoder();
|
|
@@ -560,11 +548,15 @@ function __wbg_finalize_init(instance, module) {
|
|
|
560
548
|
|
|
561
549
|
async function __wbg_load(module, imports) {
|
|
562
550
|
if (typeof Response === 'function' && module instanceof Response) {
|
|
551
|
+
if (!module.ok) {
|
|
552
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
553
|
+
}
|
|
554
|
+
|
|
563
555
|
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
564
556
|
try {
|
|
565
557
|
return await WebAssembly.instantiateStreaming(module, imports);
|
|
566
558
|
} catch (e) {
|
|
567
|
-
const validResponse =
|
|
559
|
+
const validResponse = expectedResponseType(module.type);
|
|
568
560
|
|
|
569
561
|
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
570
562
|
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 +605,17 @@ function initSync(module) {
|
|
|
613
605
|
return __wbg_finalize_init(instance, module);
|
|
614
606
|
}
|
|
615
607
|
|
|
608
|
+
let __wbg_init_promise;
|
|
616
609
|
async function __wbg_init(module_or_path) {
|
|
617
610
|
if (wasm !== undefined) return wasm;
|
|
611
|
+
if (__wbg_init_promise === undefined) {
|
|
612
|
+
__wbg_init_promise = __wbg_init_once(module_or_path);
|
|
613
|
+
__wbg_init_promise.catch(() => { __wbg_init_promise = undefined; });
|
|
614
|
+
}
|
|
615
|
+
return __wbg_init_promise;
|
|
616
|
+
}
|
|
618
617
|
|
|
618
|
+
async function __wbg_init_once(module_or_path) {
|
|
619
619
|
|
|
620
620
|
if (module_or_path !== undefined) {
|
|
621
621
|
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
package/imferno_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -9,9 +9,9 @@ export const parsePackage: (a: any) => [number, number, number];
|
|
|
9
9
|
export const validate: (a: any, b: any) => [number, number, number];
|
|
10
10
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
11
11
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
12
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
12
13
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
13
14
|
export const __externref_table_alloc: () => number;
|
|
14
15
|
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
15
16
|
export const __externref_table_dealloc: (a: number) => void;
|
|
16
|
-
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
17
17
|
export const __wbindgen_start: () => void;
|
package/index.d.ts
CHANGED
|
@@ -1,68 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Auto-initializing
|
|
2
|
+
* Auto-initializing imferno WASM bindings.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Every function initialises the WASM module on first use, so all of them
|
|
5
|
+
* return Promises. Value types (`ValidationResult`, `Imferno`, `ImfReport`,
|
|
6
|
+
* `ValidateOptions`, ...) live in ./types.d.ts, generated from the Rust types
|
|
7
|
+
* by `cargo xtask generate-types-ts` and shared verbatim with @imferno/node.
|
|
5
8
|
*/
|
|
6
9
|
|
|
7
|
-
|
|
8
|
-
export function parseAssetmapTyped(xmlContent: string): Promise<any>;
|
|
10
|
+
import type { ImfReport, Imferno, ValidateOptions, ValidationResult } from './types.js';
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
export function parseCplTyped(xmlContent: string): Promise<any>;
|
|
12
|
+
export * from './types.js';
|
|
12
13
|
|
|
13
|
-
/**
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** ESLint-style rules configuration */
|
|
26
|
-
rules?: Record<string, string>;
|
|
27
|
-
}
|
|
14
|
+
/**
|
|
15
|
+
* Parse and validate an IMF package. This is the recommended entry point.
|
|
16
|
+
*
|
|
17
|
+
* Parse failures are reported as findings in `validation`, not thrown.
|
|
18
|
+
* @param files Object mapping filenames to XML string content
|
|
19
|
+
* @param options Optional validation options (spec selection, rules)
|
|
20
|
+
* @returns `{ package, validation }` — the full parsed package and all findings.
|
|
21
|
+
*/
|
|
22
|
+
export function validate(
|
|
23
|
+
files: Record<string, string>,
|
|
24
|
+
options?: ValidateOptions | null,
|
|
25
|
+
): Promise<ValidationResult>;
|
|
28
26
|
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** Parsed AssetMap (null if parsing failed) */
|
|
36
|
-
assetMap: any | null;
|
|
37
|
-
/** Parsed Packing Lists */
|
|
38
|
-
packingLists: any[];
|
|
39
|
-
/** Parsed Volume Index (null if parsing failed) */
|
|
40
|
-
volumeIndex: any | null;
|
|
41
|
-
/** Assets in the AssetMap with no CPL or SCM reference */
|
|
42
|
-
unreferencedAssets: { id: string; path: string }[];
|
|
43
|
-
/** Sidecar assets declared in SCMs */
|
|
44
|
-
declaredSidecars: { id: string; cplIds: string[] }[];
|
|
45
|
-
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse an IMF package without validating it.
|
|
29
|
+
* @param files Object mapping filenames to XML string content
|
|
30
|
+
* @returns The full parsed package. Rejects if the package cannot be parsed.
|
|
31
|
+
*/
|
|
32
|
+
export function parsePackage(files: Record<string, string>): Promise<Imferno>;
|
|
46
33
|
|
|
47
34
|
/**
|
|
48
|
-
*
|
|
35
|
+
* Legacy: validate and return the lossy `ImfReport` summary. Prefer `validate`.
|
|
49
36
|
* @param files Object mapping filenames to XML string content
|
|
50
37
|
* @param options Optional validation options (spec selection, rules)
|
|
51
|
-
* @returns
|
|
38
|
+
* @returns Rejects if the package cannot be parsed.
|
|
52
39
|
*/
|
|
53
|
-
export function
|
|
40
|
+
export function buildReport(
|
|
54
41
|
files: Record<string, string>,
|
|
55
|
-
options?: ValidateOptions,
|
|
56
|
-
): Promise<
|
|
42
|
+
options?: ValidateOptions | null,
|
|
43
|
+
): Promise<ImfReport>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Pretty-print a validation result as a human-readable string.
|
|
47
|
+
* @param report The object `validate()` returned, or (legacy) `buildReport()`'s.
|
|
48
|
+
*/
|
|
49
|
+
export function formatReport(report: ValidationResult | ImfReport): Promise<string>;
|
|
57
50
|
|
|
58
51
|
/** Get the library version */
|
|
59
52
|
export function getVersion(): Promise<string>;
|
|
60
53
|
|
|
61
|
-
/**
|
|
62
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Initialise the WASM module explicitly. Optional: every function initialises
|
|
56
|
+
* on first use. Pass the `.wasm` bytes to avoid fetching them.
|
|
57
|
+
*/
|
|
58
|
+
export function init(wasmBytes?: ArrayBuffer | ArrayBufferView): Promise<void>;
|
|
63
59
|
|
|
64
60
|
/** Typed validation code constants for use in rules config */
|
|
65
61
|
export { codes } from './codes.js';
|
|
66
|
-
|
|
67
|
-
/** Raw WASM bindings (for advanced use) */
|
|
68
|
-
export declare const wasm: typeof import('./imferno_wasm.js');
|