@veripublica/kepubverto-wasm 0.3.1 → 0.5.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/kepubverto_wasm.d.ts +1 -1
- package/kepubverto_wasm_bg.js +44 -36
- package/kepubverto_wasm_bg.wasm +0 -0
- package/package.json +1 -1
package/kepubverto_wasm.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ export interface Conversion {
|
|
|
48
48
|
* `extra CSS:`, plus `value N` when there are several), and when the book
|
|
49
49
|
* cannot be read at all.
|
|
50
50
|
*/
|
|
51
|
-
export function convert(epub: Uint8Array, hyphens?: string | null, css?: string[] | null): Conversion;
|
|
51
|
+
export function convert(epub: Uint8Array | number[], hyphens?: string | null, css?: string[] | null): Conversion;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* The crate version, with the git hash it was built from.
|
package/kepubverto_wasm_bg.js
CHANGED
|
@@ -6,18 +6,26 @@
|
|
|
6
6
|
* `hyphens` value, on a refused `css` value (the message says why, prefixed
|
|
7
7
|
* `extra CSS:`, plus `value N` when there are several), and when the book
|
|
8
8
|
* cannot be read at all.
|
|
9
|
-
* @param {Uint8Array} epub
|
|
9
|
+
* @param {Uint8Array | number[]} epub
|
|
10
10
|
* @param {string | null} [hyphens]
|
|
11
11
|
* @param {string[] | null} [css]
|
|
12
12
|
* @returns {Conversion}
|
|
13
13
|
*/
|
|
14
14
|
export function convert(epub, hyphens, css) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
let ptr0, len0, ptr1, len1, ptr2, len2;
|
|
16
|
+
try {
|
|
17
|
+
ptr0 = passArray8ToWasm0(epub, wasm.__wbindgen_malloc);
|
|
18
|
+
len0 = WASM_VECTOR_LEN;
|
|
19
|
+
ptr1 = isLikeNone(hyphens) ? 0 : passStringToWasm0(hyphens, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
20
|
+
len1 = WASM_VECTOR_LEN;
|
|
21
|
+
ptr2 = isLikeNone(css) ? 0 : passArrayJsValueToWasm0(css, wasm.__wbindgen_malloc);
|
|
22
|
+
len2 = WASM_VECTOR_LEN;
|
|
23
|
+
} catch (e) {
|
|
24
|
+
if (ptr2) { wasm.__externref_drop_slice(ptr2, len2); wasm.__wbindgen_free(ptr2, len2 * 4, 4); }
|
|
25
|
+
if (ptr1) { wasm.__wbindgen_free(ptr1, len1 * 1, 1); }
|
|
26
|
+
if (ptr0) { wasm.__wbindgen_free(ptr0, len0 * 1, 1); }
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
21
29
|
const ret = wasm.convert(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
22
30
|
if (ret[2]) {
|
|
23
31
|
throw takeFromExternrefTable0(ret[1]);
|
|
@@ -41,7 +49,7 @@ export function version() {
|
|
|
41
49
|
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
42
50
|
}
|
|
43
51
|
}
|
|
44
|
-
export function
|
|
52
|
+
export function __wbg_Error_208446807d0d1e30(arg0, arg1) {
|
|
45
53
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
46
54
|
return ret;
|
|
47
55
|
}
|
|
@@ -49,42 +57,42 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
49
57
|
const ret = String(arg1);
|
|
50
58
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
51
59
|
const len1 = WASM_VECTOR_LEN;
|
|
52
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
53
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
60
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
61
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
54
62
|
}
|
|
55
|
-
export function
|
|
63
|
+
export function __wbg___wbindgen_string_get_7ce8eee7fd327545(arg0, arg1) {
|
|
56
64
|
const obj = arg1;
|
|
57
65
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
58
66
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
59
67
|
var len1 = WASM_VECTOR_LEN;
|
|
60
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
61
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
68
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 1, len1, true);
|
|
69
|
+
getDataViewMemory0().setInt32((arg0 >>> 0) + 4 * 0, ptr1, true);
|
|
62
70
|
}
|
|
63
|
-
export function
|
|
71
|
+
export function __wbg___wbindgen_throw_4c88d8bf264fd984(arg0, arg1) {
|
|
64
72
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
65
73
|
}
|
|
66
|
-
export function
|
|
74
|
+
export function __wbg_from_eac91875c8a5ffa4(arg0) {
|
|
67
75
|
const ret = Array.from(arg0);
|
|
68
76
|
return ret;
|
|
69
77
|
}
|
|
70
|
-
export function
|
|
78
|
+
export function __wbg_new_13de428334042d26(arg0) {
|
|
71
79
|
const ret = new Uint8Array(arg0);
|
|
72
80
|
return ret;
|
|
73
81
|
}
|
|
74
|
-
export function
|
|
75
|
-
const ret = new Object();
|
|
76
|
-
return ret;
|
|
77
|
-
}
|
|
78
|
-
export function __wbg_new_ee2291f50781bf1d() {
|
|
82
|
+
export function __wbg_new_37eb45aaf5eeb820() {
|
|
79
83
|
const ret = new Array();
|
|
80
84
|
return ret;
|
|
81
85
|
}
|
|
82
|
-
export function
|
|
83
|
-
|
|
86
|
+
export function __wbg_new_cd4348290afae586() {
|
|
87
|
+
const ret = new Object();
|
|
88
|
+
return ret;
|
|
84
89
|
}
|
|
85
|
-
export function
|
|
90
|
+
export function __wbg_set_d2d33b52458e984a(arg0, arg1, arg2) {
|
|
86
91
|
arg0[arg1 >>> 0] = arg2;
|
|
87
92
|
}
|
|
93
|
+
export function __wbg_set_e4b9a833d288759a(arg0, arg1, arg2) {
|
|
94
|
+
arg0[arg1] = arg2;
|
|
95
|
+
}
|
|
88
96
|
export function __wbindgen_generic_0000000000000001(arg0) {
|
|
89
97
|
// Cast intrinsic for `F64 -> Externref`.
|
|
90
98
|
const ret = arg0;
|
|
@@ -107,12 +115,11 @@ export function __wbindgen_generic_0000000000000004(arg0) {
|
|
|
107
115
|
}
|
|
108
116
|
export function __wbindgen_init_externref_table() {
|
|
109
117
|
const table = wasm.__wbindgen_externrefs;
|
|
110
|
-
const offset = table.grow(4);
|
|
111
118
|
table.set(0, undefined);
|
|
112
|
-
table.set(
|
|
113
|
-
table.set(
|
|
114
|
-
table.set(
|
|
115
|
-
table.set(
|
|
119
|
+
table.set(1024, undefined);
|
|
120
|
+
table.set(1025, null);
|
|
121
|
+
table.set(1026, true);
|
|
122
|
+
table.set(1027, false);
|
|
116
123
|
}
|
|
117
124
|
function addToExternrefTable0(obj) {
|
|
118
125
|
const idx = wasm.__externref_table_alloc();
|
|
@@ -134,7 +141,8 @@ function getDataViewMemory0() {
|
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
function getStringFromWasm0(ptr, len) {
|
|
137
|
-
|
|
144
|
+
ptr = ptr >>> 0;
|
|
145
|
+
return decodeText(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
138
146
|
}
|
|
139
147
|
|
|
140
148
|
let cachedUint8ArrayMemory0 = null;
|
|
@@ -209,18 +217,18 @@ function takeFromExternrefTable0(idx) {
|
|
|
209
217
|
return value;
|
|
210
218
|
}
|
|
211
219
|
|
|
212
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
220
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
213
221
|
cachedTextDecoder.decode();
|
|
214
222
|
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
215
223
|
let numBytesDecoded = 0;
|
|
216
|
-
function decodeText(
|
|
217
|
-
numBytesDecoded +=
|
|
224
|
+
function decodeText(bytes) {
|
|
225
|
+
numBytesDecoded += bytes.length;
|
|
218
226
|
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
219
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true
|
|
227
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true });
|
|
220
228
|
cachedTextDecoder.decode();
|
|
221
|
-
numBytesDecoded =
|
|
229
|
+
numBytesDecoded = bytes.length;
|
|
222
230
|
}
|
|
223
|
-
return cachedTextDecoder.decode(
|
|
231
|
+
return cachedTextDecoder.decode(bytes);
|
|
224
232
|
}
|
|
225
233
|
|
|
226
234
|
const cachedTextEncoder = new TextEncoder();
|
package/kepubverto_wasm_bg.wasm
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@veripublica/kepubverto-wasm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "WebAssembly bindings for kepubverto — convert EPUB to KEPUB in the browser, no upload.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.5.0",
|
|
6
6
|
"license": "AGPL-3.0-only OR LicenseRef-veripublica-Commercial",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|