@kerebron/odt-wasm 0.0.7
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/lib/rs_lib.d.ts +14 -0
- package/lib/rs_lib.internal.js +370 -0
- package/lib/rs_lib.js +12 -0
- package/lib/rs_lib.wasm +0 -0
- package/package.json +15 -0
package/lib/rs_lib.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @generated file from wasmbuild -- do not edit
|
|
2
|
+
// deno-lint-ignore-file
|
|
3
|
+
// deno-fmt-ignore-file
|
|
4
|
+
|
|
5
|
+
export function echo(zip_data: Uint8Array): Uint8Array;
|
|
6
|
+
export function unzip(zip_data: Uint8Array): any;
|
|
7
|
+
export function parse_content(xml_bytes: Uint8Array): any;
|
|
8
|
+
export function parse_styles(xml_bytes: Uint8Array): any;
|
|
9
|
+
export function add(a: number, b: number): number;
|
|
10
|
+
export class Greeter {
|
|
11
|
+
free(): void;
|
|
12
|
+
constructor(name: string);
|
|
13
|
+
greet(): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
// @generated file from wasmbuild -- do not edit
|
|
2
|
+
// @ts-nocheck: generated
|
|
3
|
+
// deno-lint-ignore-file
|
|
4
|
+
// deno-fmt-ignore-file
|
|
5
|
+
|
|
6
|
+
let wasm;
|
|
7
|
+
export function __wbg_set_wasm(val) {
|
|
8
|
+
wasm = val;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function debugString(val) {
|
|
12
|
+
// primitive types
|
|
13
|
+
const type = typeof val;
|
|
14
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
15
|
+
return `${val}`;
|
|
16
|
+
}
|
|
17
|
+
if (type == 'string') {
|
|
18
|
+
return `"${val}"`;
|
|
19
|
+
}
|
|
20
|
+
if (type == 'symbol') {
|
|
21
|
+
const description = val.description;
|
|
22
|
+
if (description == null) {
|
|
23
|
+
return 'Symbol';
|
|
24
|
+
} else {
|
|
25
|
+
return `Symbol(${description})`;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (type == 'function') {
|
|
29
|
+
const name = val.name;
|
|
30
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
31
|
+
return `Function(${name})`;
|
|
32
|
+
} else {
|
|
33
|
+
return 'Function';
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// objects
|
|
37
|
+
if (Array.isArray(val)) {
|
|
38
|
+
const length = val.length;
|
|
39
|
+
let debug = '[';
|
|
40
|
+
if (length > 0) {
|
|
41
|
+
debug += debugString(val[0]);
|
|
42
|
+
}
|
|
43
|
+
for (let i = 1; i < length; i++) {
|
|
44
|
+
debug += ', ' + debugString(val[i]);
|
|
45
|
+
}
|
|
46
|
+
debug += ']';
|
|
47
|
+
return debug;
|
|
48
|
+
}
|
|
49
|
+
// Test for built-in
|
|
50
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
51
|
+
let className;
|
|
52
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
53
|
+
className = builtInMatches[1];
|
|
54
|
+
} else {
|
|
55
|
+
// Failed to match the standard '[object ClassName]'
|
|
56
|
+
return toString.call(val);
|
|
57
|
+
}
|
|
58
|
+
if (className == 'Object') {
|
|
59
|
+
// we're a user defined class or Object
|
|
60
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
61
|
+
// easier than looping through ownProperties of `val`.
|
|
62
|
+
try {
|
|
63
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
64
|
+
} catch (_) {
|
|
65
|
+
return 'Object';
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
// errors
|
|
69
|
+
if (val instanceof Error) {
|
|
70
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
71
|
+
}
|
|
72
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
73
|
+
return className;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let WASM_VECTOR_LEN = 0;
|
|
77
|
+
|
|
78
|
+
let cachedUint8ArrayMemory0 = null;
|
|
79
|
+
|
|
80
|
+
function getUint8ArrayMemory0() {
|
|
81
|
+
if (
|
|
82
|
+
cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0
|
|
83
|
+
) {
|
|
84
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
85
|
+
}
|
|
86
|
+
return cachedUint8ArrayMemory0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const lTextEncoder = typeof TextEncoder === 'undefined'
|
|
90
|
+
? (0, module.require)('util').TextEncoder
|
|
91
|
+
: TextEncoder;
|
|
92
|
+
|
|
93
|
+
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
94
|
+
|
|
95
|
+
const encodeString = typeof cachedTextEncoder.encodeInto === 'function'
|
|
96
|
+
? function (arg, view) {
|
|
97
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
98
|
+
}
|
|
99
|
+
: function (arg, view) {
|
|
100
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
101
|
+
view.set(buf);
|
|
102
|
+
return {
|
|
103
|
+
read: arg.length,
|
|
104
|
+
written: buf.length,
|
|
105
|
+
};
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
109
|
+
if (realloc === undefined) {
|
|
110
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
111
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
112
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
113
|
+
WASM_VECTOR_LEN = buf.length;
|
|
114
|
+
return ptr;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
let len = arg.length;
|
|
118
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
119
|
+
|
|
120
|
+
const mem = getUint8ArrayMemory0();
|
|
121
|
+
|
|
122
|
+
let offset = 0;
|
|
123
|
+
|
|
124
|
+
for (; offset < len; offset++) {
|
|
125
|
+
const code = arg.charCodeAt(offset);
|
|
126
|
+
if (code > 0x7F) break;
|
|
127
|
+
mem[ptr + offset] = code;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (offset !== len) {
|
|
131
|
+
if (offset !== 0) {
|
|
132
|
+
arg = arg.slice(offset);
|
|
133
|
+
}
|
|
134
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
135
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
136
|
+
const ret = encodeString(arg, view);
|
|
137
|
+
|
|
138
|
+
offset += ret.written;
|
|
139
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
WASM_VECTOR_LEN = offset;
|
|
143
|
+
return ptr;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
let cachedDataViewMemory0 = null;
|
|
147
|
+
|
|
148
|
+
function getDataViewMemory0() {
|
|
149
|
+
if (
|
|
150
|
+
cachedDataViewMemory0 === null ||
|
|
151
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
152
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
153
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
154
|
+
) {
|
|
155
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
156
|
+
}
|
|
157
|
+
return cachedDataViewMemory0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const lTextDecoder = typeof TextDecoder === 'undefined'
|
|
161
|
+
? (0, module.require)('util').TextDecoder
|
|
162
|
+
: TextDecoder;
|
|
163
|
+
|
|
164
|
+
let cachedTextDecoder = new lTextDecoder('utf-8', {
|
|
165
|
+
ignoreBOM: true,
|
|
166
|
+
fatal: true,
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
cachedTextDecoder.decode();
|
|
170
|
+
|
|
171
|
+
function getStringFromWasm0(ptr, len) {
|
|
172
|
+
ptr = ptr >>> 0;
|
|
173
|
+
return cachedTextDecoder.decode(
|
|
174
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + len),
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
179
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
180
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
181
|
+
WASM_VECTOR_LEN = arg.length;
|
|
182
|
+
return ptr;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
186
|
+
ptr = ptr >>> 0;
|
|
187
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* @param {Uint8Array} zip_data
|
|
191
|
+
* @returns {Uint8Array}
|
|
192
|
+
*/
|
|
193
|
+
export function echo(zip_data) {
|
|
194
|
+
const ptr0 = passArray8ToWasm0(zip_data, wasm.__wbindgen_malloc);
|
|
195
|
+
const len0 = WASM_VECTOR_LEN;
|
|
196
|
+
const ret = wasm.echo(ptr0, len0);
|
|
197
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
198
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
199
|
+
return v2;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @param {Uint8Array} zip_data
|
|
204
|
+
* @returns {any}
|
|
205
|
+
*/
|
|
206
|
+
export function unzip(zip_data) {
|
|
207
|
+
const ptr0 = passArray8ToWasm0(zip_data, wasm.__wbindgen_malloc);
|
|
208
|
+
const len0 = WASM_VECTOR_LEN;
|
|
209
|
+
const ret = wasm.unzip(ptr0, len0);
|
|
210
|
+
return ret;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @param {Uint8Array} xml_bytes
|
|
215
|
+
* @returns {any}
|
|
216
|
+
*/
|
|
217
|
+
export function parse_content(xml_bytes) {
|
|
218
|
+
const ptr0 = passArray8ToWasm0(xml_bytes, wasm.__wbindgen_malloc);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
const ret = wasm.parse_content(ptr0, len0);
|
|
221
|
+
return ret;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* @param {Uint8Array} xml_bytes
|
|
226
|
+
* @returns {any}
|
|
227
|
+
*/
|
|
228
|
+
export function parse_styles(xml_bytes) {
|
|
229
|
+
const ptr0 = passArray8ToWasm0(xml_bytes, wasm.__wbindgen_malloc);
|
|
230
|
+
const len0 = WASM_VECTOR_LEN;
|
|
231
|
+
const ret = wasm.parse_styles(ptr0, len0);
|
|
232
|
+
return ret;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* @param {number} a
|
|
237
|
+
* @param {number} b
|
|
238
|
+
* @returns {number}
|
|
239
|
+
*/
|
|
240
|
+
export function add(a, b) {
|
|
241
|
+
const ret = wasm.add(a, b);
|
|
242
|
+
return ret;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const GreeterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
246
|
+
? { register: () => {}, unregister: () => {} }
|
|
247
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_greeter_free(ptr >>> 0, 1));
|
|
248
|
+
|
|
249
|
+
export class Greeter {
|
|
250
|
+
__destroy_into_raw() {
|
|
251
|
+
const ptr = this.__wbg_ptr;
|
|
252
|
+
this.__wbg_ptr = 0;
|
|
253
|
+
GreeterFinalization.unregister(this);
|
|
254
|
+
return ptr;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
free() {
|
|
258
|
+
const ptr = this.__destroy_into_raw();
|
|
259
|
+
wasm.__wbg_greeter_free(ptr, 0);
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* @param {string} name
|
|
263
|
+
*/
|
|
264
|
+
constructor(name) {
|
|
265
|
+
const ptr0 = passStringToWasm0(
|
|
266
|
+
name,
|
|
267
|
+
wasm.__wbindgen_malloc,
|
|
268
|
+
wasm.__wbindgen_realloc,
|
|
269
|
+
);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
const ret = wasm.greeter_new(ptr0, len0);
|
|
272
|
+
this.__wbg_ptr = ret >>> 0;
|
|
273
|
+
GreeterFinalization.register(this, this.__wbg_ptr, this);
|
|
274
|
+
return this;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @returns {string}
|
|
278
|
+
*/
|
|
279
|
+
greet() {
|
|
280
|
+
let deferred1_0;
|
|
281
|
+
let deferred1_1;
|
|
282
|
+
try {
|
|
283
|
+
const ret = wasm.greeter_greet(this.__wbg_ptr);
|
|
284
|
+
deferred1_0 = ret[0];
|
|
285
|
+
deferred1_1 = ret[1];
|
|
286
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
287
|
+
} finally {
|
|
288
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export function __wbg_new_405e22f390576ce2() {
|
|
294
|
+
const ret = new Object();
|
|
295
|
+
return ret;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export function __wbg_new_5e0be73521bc8c17() {
|
|
299
|
+
const ret = new Map();
|
|
300
|
+
return ret;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export function __wbg_new_78feb108b6472713() {
|
|
304
|
+
const ret = new Array();
|
|
305
|
+
return ret;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
|
|
309
|
+
arg0[arg1 >>> 0] = arg2;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
313
|
+
arg0[arg1] = arg2;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
export function __wbg_set_8fc6bf8a5b1071d1(arg0, arg1, arg2) {
|
|
317
|
+
const ret = arg0.set(arg1, arg2);
|
|
318
|
+
return ret;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export function __wbindgen_as_number(arg0) {
|
|
322
|
+
const ret = +arg0;
|
|
323
|
+
return ret;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export function __wbindgen_debug_string(arg0, arg1) {
|
|
327
|
+
const ret = debugString(arg1);
|
|
328
|
+
const ptr1 = passStringToWasm0(
|
|
329
|
+
ret,
|
|
330
|
+
wasm.__wbindgen_malloc,
|
|
331
|
+
wasm.__wbindgen_realloc,
|
|
332
|
+
);
|
|
333
|
+
const len1 = WASM_VECTOR_LEN;
|
|
334
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
335
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export function __wbindgen_error_new(arg0, arg1) {
|
|
339
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
340
|
+
return ret;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export function __wbindgen_init_externref_table() {
|
|
344
|
+
const table = wasm.__wbindgen_export_2;
|
|
345
|
+
const offset = table.grow(4);
|
|
346
|
+
table.set(0, undefined);
|
|
347
|
+
table.set(offset + 0, undefined);
|
|
348
|
+
table.set(offset + 1, null);
|
|
349
|
+
table.set(offset + 2, true);
|
|
350
|
+
table.set(offset + 3, false);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export function __wbindgen_is_string(arg0) {
|
|
354
|
+
const ret = typeof arg0 === 'string';
|
|
355
|
+
return ret;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export function __wbindgen_number_new(arg0) {
|
|
359
|
+
const ret = arg0;
|
|
360
|
+
return ret;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
|
364
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
365
|
+
return ret;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export function __wbindgen_throw(arg0, arg1) {
|
|
369
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
370
|
+
}
|
package/lib/rs_lib.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// @generated file from wasmbuild -- do not edit
|
|
2
|
+
// @ts-nocheck: generated
|
|
3
|
+
// deno-lint-ignore-file
|
|
4
|
+
// deno-fmt-ignore-file
|
|
5
|
+
// @ts-self-types="./rs_lib.d.ts"
|
|
6
|
+
|
|
7
|
+
// source-hash: e9904349404c7a6929936cd09f1afe6a8454b782
|
|
8
|
+
import * as wasm from "./rs_lib.wasm";
|
|
9
|
+
export * from "./rs_lib.internal.js";
|
|
10
|
+
import { __wbg_set_wasm } from "./rs_lib.internal.js";
|
|
11
|
+
__wbg_set_wasm(wasm);
|
|
12
|
+
wasm.__wbindgen_start();
|
package/lib/rs_lib.wasm
ADDED
|
Binary file
|