@veripublica/epubsana-wasm 0.37.0 → 0.38.0
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/epubsana_wasm.d.ts +2 -2
- package/epubsana_wasm_bg.js +37 -30
- package/epubsana_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/epubsana_wasm.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ export class Session {
|
|
|
216
216
|
/**
|
|
217
217
|
* Load an EPUB from its raw bytes, detect its defects, and plan the fixes.
|
|
218
218
|
*/
|
|
219
|
-
static load(bytes: Uint8Array): Session;
|
|
219
|
+
static load(bytes: Uint8Array | number[]): Session;
|
|
220
220
|
/**
|
|
221
221
|
* The session's plan: the starting counts and every proposed fix (each with
|
|
222
222
|
* its current `outcome`). Cheap — it re-validates nothing.
|
|
@@ -237,7 +237,7 @@ export class Session {
|
|
|
237
237
|
* different selection replaces the previous run. An index out of range is
|
|
238
238
|
* an error and changes nothing.
|
|
239
239
|
*/
|
|
240
|
-
repair(approved: Uint32Array, goal?: string | null): Report;
|
|
240
|
+
repair(approved: Uint32Array | number[], goal?: string | null): Report;
|
|
241
241
|
/**
|
|
242
242
|
* **Re-validate** the current EPUB with epubveri and return the result in
|
|
243
243
|
* the shared envelope shape — the same independent check the CLI reports.
|
package/epubsana_wasm_bg.js
CHANGED
|
@@ -20,7 +20,7 @@ export class Session {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Load an EPUB from its raw bytes, detect its defects, and plan the fixes.
|
|
23
|
-
* @param {Uint8Array} bytes
|
|
23
|
+
* @param {Uint8Array | number[]} bytes
|
|
24
24
|
* @returns {Session}
|
|
25
25
|
*/
|
|
26
26
|
static load(bytes) {
|
|
@@ -58,15 +58,22 @@ export class Session {
|
|
|
58
58
|
* Starts from the book as loaded every time, so calling it again with a
|
|
59
59
|
* different selection replaces the previous run. An index out of range is
|
|
60
60
|
* an error and changes nothing.
|
|
61
|
-
* @param {Uint32Array} approved
|
|
61
|
+
* @param {Uint32Array | number[]} approved
|
|
62
62
|
* @param {string | null} [goal]
|
|
63
63
|
* @returns {Report}
|
|
64
64
|
*/
|
|
65
65
|
repair(approved, goal) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
let ptr0, len0, ptr1, len1;
|
|
67
|
+
try {
|
|
68
|
+
ptr0 = passArray32ToWasm0(approved, wasm.__wbindgen_malloc);
|
|
69
|
+
len0 = WASM_VECTOR_LEN;
|
|
70
|
+
ptr1 = isLikeNone(goal) ? 0 : passStringToWasm0(goal, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
71
|
+
len1 = WASM_VECTOR_LEN;
|
|
72
|
+
} catch (e) {
|
|
73
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
74
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 4, 4); }
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
70
77
|
const ret = wasm.session_repair(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
71
78
|
if (ret[2]) {
|
|
72
79
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -140,7 +147,7 @@ export function version() {
|
|
|
140
147
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
141
148
|
}
|
|
142
149
|
}
|
|
143
|
-
export function
|
|
150
|
+
export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
|
|
144
151
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
145
152
|
return ret;
|
|
146
153
|
}
|
|
@@ -148,26 +155,26 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
148
155
|
const ret = String(arg1);
|
|
149
156
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
150
157
|
const len1 = WASM_VECTOR_LEN;
|
|
151
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
152
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
158
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
159
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
153
160
|
}
|
|
154
|
-
export function
|
|
161
|
+
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
155
162
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
156
163
|
}
|
|
157
|
-
export function
|
|
158
|
-
const ret = new Object();
|
|
159
|
-
return ret;
|
|
160
|
-
}
|
|
161
|
-
export function __wbg_new_ee2291f50781bf1d() {
|
|
164
|
+
export function __wbg_new_37eb45aaf5eeb820() {
|
|
162
165
|
const ret = new Array();
|
|
163
166
|
return ret;
|
|
164
167
|
}
|
|
165
|
-
export function
|
|
166
|
-
|
|
168
|
+
export function __wbg_new_cd4348290afae586() {
|
|
169
|
+
const ret = new Object();
|
|
170
|
+
return ret;
|
|
167
171
|
}
|
|
168
|
-
export function
|
|
172
|
+
export function __wbg_set_d2d33b52458e984a(arg0, arg1, arg2) {
|
|
169
173
|
arg0[arg1 >>> 0] = arg2;
|
|
170
174
|
}
|
|
175
|
+
export function __wbg_set_e4b9a833d288759a(arg0, arg1, arg2) {
|
|
176
|
+
arg0[arg1] = arg2;
|
|
177
|
+
}
|
|
171
178
|
export function __wbindgen_generic_0000000000000001(arg0) {
|
|
172
179
|
// Cast intrinsic for `F64 -> Externref`.
|
|
173
180
|
const ret = arg0;
|
|
@@ -185,12 +192,11 @@ export function __wbindgen_generic_0000000000000003(arg0) {
|
|
|
185
192
|
}
|
|
186
193
|
export function __wbindgen_init_externref_table() {
|
|
187
194
|
const table = wasm.__wbindgen_externrefs;
|
|
188
|
-
const offset = table.grow(4);
|
|
189
195
|
table.set(0, undefined);
|
|
190
|
-
table.set(
|
|
191
|
-
table.set(
|
|
192
|
-
table.set(
|
|
193
|
-
table.set(
|
|
196
|
+
table.set(1024, undefined);
|
|
197
|
+
table.set(1025, null);
|
|
198
|
+
table.set(1026, true);
|
|
199
|
+
table.set(1027, false);
|
|
194
200
|
}
|
|
195
201
|
const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
196
202
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -210,7 +216,8 @@ function getDataViewMemory0() {
|
|
|
210
216
|
}
|
|
211
217
|
|
|
212
218
|
function getStringFromWasm0(ptr, len) {
|
|
213
|
-
|
|
219
|
+
ptr = ptr >>> 0;
|
|
220
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
214
221
|
}
|
|
215
222
|
|
|
216
223
|
let cachedUint32ArrayMemory0 = null;
|
|
@@ -290,18 +297,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
290
297
|
return value;
|
|
291
298
|
}
|
|
292
299
|
|
|
293
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
300
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
294
301
|
cachedTextDecoder.decode();
|
|
295
302
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
296
303
|
let numBytesDecoded = 0;
|
|
297
|
-
function decodeText(
|
|
298
|
-
numBytesDecoded +=
|
|
304
|
+
function decodeText(bytes) {
|
|
305
|
+
numBytesDecoded += bytes.length;
|
|
299
306
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
300
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
307
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
301
308
|
cachedTextDecoder.decode();
|
|
302
|
-
numBytesDecoded =
|
|
309
|
+
numBytesDecoded = bytes.length;
|
|
303
310
|
}
|
|
304
|
-
return cachedTextDecoder.decode(
|
|
311
|
+
return cachedTextDecoder.decode(bytes);
|
|
305
312
|
}
|
|
306
313
|
|
|
307
314
|
const cachedTextEncoder = new TextEncoder();
|
package/epubsana_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@veripublica/epubsana-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for epubsana — repair EPUB defects in the browser, no upload.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.38.0",
|
|
6
6
|
"license": "AGPL-3.0-only OR LicenseRef-veripublica-Commercial",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|