@databio/peprs 0.1.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/package.json +19 -0
- package/peprs_wasm.d.ts +64 -0
- package/peprs_wasm.js +425 -0
- package/peprs_wasm_bg.wasm +0 -0
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@databio/peprs",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"files": [
|
|
6
|
+
"peprs_wasm_bg.wasm",
|
|
7
|
+
"peprs_wasm.js",
|
|
8
|
+
"peprs_wasm.d.ts"
|
|
9
|
+
],
|
|
10
|
+
"main": "peprs_wasm.js",
|
|
11
|
+
"types": "peprs_wasm.d.ts",
|
|
12
|
+
"sideEffects": [
|
|
13
|
+
"./snippets/*"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/khoroshevskyi/peprs"
|
|
18
|
+
}
|
|
19
|
+
}
|
package/peprs_wasm.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
export class WasmProject {
|
|
5
|
+
free(): void;
|
|
6
|
+
[Symbol.dispose](): void;
|
|
7
|
+
get_description(): string | undefined;
|
|
8
|
+
get_name(): string | undefined;
|
|
9
|
+
is_empty(): boolean;
|
|
10
|
+
len(): number;
|
|
11
|
+
constructor(json_str: string);
|
|
12
|
+
to_csv(): string;
|
|
13
|
+
to_json(): string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function init(): void;
|
|
17
|
+
|
|
18
|
+
export function validate(project: WasmProject, schema_json: string): any;
|
|
19
|
+
|
|
20
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
21
|
+
|
|
22
|
+
export interface InitOutput {
|
|
23
|
+
readonly memory: WebAssembly.Memory;
|
|
24
|
+
readonly __wbg_wasmproject_free: (a: number, b: number) => void;
|
|
25
|
+
readonly init: () => void;
|
|
26
|
+
readonly validate: (a: number, b: number, c: number) => [number, number, number];
|
|
27
|
+
readonly wasmproject_get_description: (a: number) => [number, number];
|
|
28
|
+
readonly wasmproject_get_name: (a: number) => [number, number];
|
|
29
|
+
readonly wasmproject_is_empty: (a: number) => number;
|
|
30
|
+
readonly wasmproject_len: (a: number) => number;
|
|
31
|
+
readonly wasmproject_new: (a: number, b: number) => [number, number, number];
|
|
32
|
+
readonly wasmproject_to_csv: (a: number) => [number, number, number, number];
|
|
33
|
+
readonly wasmproject_to_json: (a: number) => [number, number, number, number];
|
|
34
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
35
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
36
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
37
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
38
|
+
readonly __externref_table_alloc: () => number;
|
|
39
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
40
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
41
|
+
readonly __wbindgen_start: () => void;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
48
|
+
* a precompiled `WebAssembly.Module`.
|
|
49
|
+
*
|
|
50
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
51
|
+
*
|
|
52
|
+
* @returns {InitOutput}
|
|
53
|
+
*/
|
|
54
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
58
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
59
|
+
*
|
|
60
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
61
|
+
*
|
|
62
|
+
* @returns {Promise<InitOutput>}
|
|
63
|
+
*/
|
|
64
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/peprs_wasm.js
ADDED
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
/* @ts-self-types="./peprs_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
export class WasmProject {
|
|
4
|
+
__destroy_into_raw() {
|
|
5
|
+
const ptr = this.__wbg_ptr;
|
|
6
|
+
this.__wbg_ptr = 0;
|
|
7
|
+
WasmProjectFinalization.unregister(this);
|
|
8
|
+
return ptr;
|
|
9
|
+
}
|
|
10
|
+
free() {
|
|
11
|
+
const ptr = this.__destroy_into_raw();
|
|
12
|
+
wasm.__wbg_wasmproject_free(ptr, 0);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @returns {string | undefined}
|
|
16
|
+
*/
|
|
17
|
+
get_description() {
|
|
18
|
+
const ret = wasm.wasmproject_get_description(this.__wbg_ptr);
|
|
19
|
+
let v1;
|
|
20
|
+
if (ret[0] !== 0) {
|
|
21
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
22
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
23
|
+
}
|
|
24
|
+
return v1;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* @returns {string | undefined}
|
|
28
|
+
*/
|
|
29
|
+
get_name() {
|
|
30
|
+
const ret = wasm.wasmproject_get_name(this.__wbg_ptr);
|
|
31
|
+
let v1;
|
|
32
|
+
if (ret[0] !== 0) {
|
|
33
|
+
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
|
34
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
35
|
+
}
|
|
36
|
+
return v1;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @returns {boolean}
|
|
40
|
+
*/
|
|
41
|
+
is_empty() {
|
|
42
|
+
const ret = wasm.wasmproject_is_empty(this.__wbg_ptr);
|
|
43
|
+
return ret !== 0;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @returns {number}
|
|
47
|
+
*/
|
|
48
|
+
len() {
|
|
49
|
+
const ret = wasm.wasmproject_len(this.__wbg_ptr);
|
|
50
|
+
return ret >>> 0;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @param {string} json_str
|
|
54
|
+
*/
|
|
55
|
+
constructor(json_str) {
|
|
56
|
+
const ptr0 = passStringToWasm0(json_str, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
57
|
+
const len0 = WASM_VECTOR_LEN;
|
|
58
|
+
const ret = wasm.wasmproject_new(ptr0, len0);
|
|
59
|
+
if (ret[2]) {
|
|
60
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
61
|
+
}
|
|
62
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
63
|
+
WasmProjectFinalization.register(this, this.__wbg_ptr, this);
|
|
64
|
+
return this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @returns {string}
|
|
68
|
+
*/
|
|
69
|
+
to_csv() {
|
|
70
|
+
let deferred2_0;
|
|
71
|
+
let deferred2_1;
|
|
72
|
+
try {
|
|
73
|
+
const ret = wasm.wasmproject_to_csv(this.__wbg_ptr);
|
|
74
|
+
var ptr1 = ret[0];
|
|
75
|
+
var len1 = ret[1];
|
|
76
|
+
if (ret[3]) {
|
|
77
|
+
ptr1 = 0; len1 = 0;
|
|
78
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
79
|
+
}
|
|
80
|
+
deferred2_0 = ptr1;
|
|
81
|
+
deferred2_1 = len1;
|
|
82
|
+
return getStringFromWasm0(ptr1, len1);
|
|
83
|
+
} finally {
|
|
84
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @returns {string}
|
|
89
|
+
*/
|
|
90
|
+
to_json() {
|
|
91
|
+
let deferred2_0;
|
|
92
|
+
let deferred2_1;
|
|
93
|
+
try {
|
|
94
|
+
const ret = wasm.wasmproject_to_json(this.__wbg_ptr);
|
|
95
|
+
var ptr1 = ret[0];
|
|
96
|
+
var len1 = ret[1];
|
|
97
|
+
if (ret[3]) {
|
|
98
|
+
ptr1 = 0; len1 = 0;
|
|
99
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
100
|
+
}
|
|
101
|
+
deferred2_0 = ptr1;
|
|
102
|
+
deferred2_1 = len1;
|
|
103
|
+
return getStringFromWasm0(ptr1, len1);
|
|
104
|
+
} finally {
|
|
105
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (Symbol.dispose) WasmProject.prototype[Symbol.dispose] = WasmProject.prototype.free;
|
|
110
|
+
|
|
111
|
+
export function init() {
|
|
112
|
+
wasm.init();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @param {WasmProject} project
|
|
117
|
+
* @param {string} schema_json
|
|
118
|
+
* @returns {any}
|
|
119
|
+
*/
|
|
120
|
+
export function validate(project, schema_json) {
|
|
121
|
+
_assertClass(project, WasmProject);
|
|
122
|
+
const ptr0 = passStringToWasm0(schema_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
123
|
+
const len0 = WASM_VECTOR_LEN;
|
|
124
|
+
const ret = wasm.validate(project.__wbg_ptr, ptr0, len0);
|
|
125
|
+
if (ret[2]) {
|
|
126
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
127
|
+
}
|
|
128
|
+
return takeFromExternrefTable0(ret[0]);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function __wbg_get_imports() {
|
|
132
|
+
const import0 = {
|
|
133
|
+
__proto__: null,
|
|
134
|
+
__wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
|
|
135
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
136
|
+
return ret;
|
|
137
|
+
},
|
|
138
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
139
|
+
const ret = String(arg1);
|
|
140
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
141
|
+
const len1 = WASM_VECTOR_LEN;
|
|
142
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
143
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
144
|
+
},
|
|
145
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
146
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
147
|
+
},
|
|
148
|
+
__wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
|
|
149
|
+
let deferred0_0;
|
|
150
|
+
let deferred0_1;
|
|
151
|
+
try {
|
|
152
|
+
deferred0_0 = arg0;
|
|
153
|
+
deferred0_1 = arg1;
|
|
154
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
155
|
+
} finally {
|
|
156
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
__wbg_getRandomValues_3f44b700395062e5: function() { return handleError(function (arg0, arg1) {
|
|
160
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
161
|
+
}, arguments); },
|
|
162
|
+
__wbg_getRandomValues_d49329ff89a07af1: function() { return handleError(function (arg0, arg1) {
|
|
163
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
164
|
+
}, arguments); },
|
|
165
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
166
|
+
const ret = new Error();
|
|
167
|
+
return ret;
|
|
168
|
+
},
|
|
169
|
+
__wbg_new_a70fbab9066b301f: function() {
|
|
170
|
+
const ret = new Array();
|
|
171
|
+
return ret;
|
|
172
|
+
},
|
|
173
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
174
|
+
const ret = new Object();
|
|
175
|
+
return ret;
|
|
176
|
+
},
|
|
177
|
+
__wbg_set_282384002438957f: function(arg0, arg1, arg2) {
|
|
178
|
+
arg0[arg1 >>> 0] = arg2;
|
|
179
|
+
},
|
|
180
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
181
|
+
arg0[arg1] = arg2;
|
|
182
|
+
},
|
|
183
|
+
__wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
|
|
184
|
+
const ret = arg1.stack;
|
|
185
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
186
|
+
const len1 = WASM_VECTOR_LEN;
|
|
187
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
188
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
189
|
+
},
|
|
190
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
191
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
192
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
193
|
+
return ret;
|
|
194
|
+
},
|
|
195
|
+
__wbindgen_init_externref_table: function() {
|
|
196
|
+
const table = wasm.__wbindgen_externrefs;
|
|
197
|
+
const offset = table.grow(4);
|
|
198
|
+
table.set(0, undefined);
|
|
199
|
+
table.set(offset + 0, undefined);
|
|
200
|
+
table.set(offset + 1, null);
|
|
201
|
+
table.set(offset + 2, true);
|
|
202
|
+
table.set(offset + 3, false);
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
return {
|
|
206
|
+
__proto__: null,
|
|
207
|
+
"./peprs_wasm_bg.js": import0,
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const WasmProjectFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
212
|
+
? { register: () => {}, unregister: () => {} }
|
|
213
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wasmproject_free(ptr >>> 0, 1));
|
|
214
|
+
|
|
215
|
+
function addToExternrefTable0(obj) {
|
|
216
|
+
const idx = wasm.__externref_table_alloc();
|
|
217
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
218
|
+
return idx;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function _assertClass(instance, klass) {
|
|
222
|
+
if (!(instance instanceof klass)) {
|
|
223
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
228
|
+
ptr = ptr >>> 0;
|
|
229
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
let cachedDataViewMemory0 = null;
|
|
233
|
+
function getDataViewMemory0() {
|
|
234
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
235
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
236
|
+
}
|
|
237
|
+
return cachedDataViewMemory0;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function getStringFromWasm0(ptr, len) {
|
|
241
|
+
ptr = ptr >>> 0;
|
|
242
|
+
return decodeText(ptr, len);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
let cachedUint8ArrayMemory0 = null;
|
|
246
|
+
function getUint8ArrayMemory0() {
|
|
247
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
248
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
249
|
+
}
|
|
250
|
+
return cachedUint8ArrayMemory0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function handleError(f, args) {
|
|
254
|
+
try {
|
|
255
|
+
return f.apply(this, args);
|
|
256
|
+
} catch (e) {
|
|
257
|
+
const idx = addToExternrefTable0(e);
|
|
258
|
+
wasm.__wbindgen_exn_store(idx);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
263
|
+
if (realloc === undefined) {
|
|
264
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
265
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
266
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
267
|
+
WASM_VECTOR_LEN = buf.length;
|
|
268
|
+
return ptr;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
let len = arg.length;
|
|
272
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
273
|
+
|
|
274
|
+
const mem = getUint8ArrayMemory0();
|
|
275
|
+
|
|
276
|
+
let offset = 0;
|
|
277
|
+
|
|
278
|
+
for (; offset < len; offset++) {
|
|
279
|
+
const code = arg.charCodeAt(offset);
|
|
280
|
+
if (code > 0x7F) break;
|
|
281
|
+
mem[ptr + offset] = code;
|
|
282
|
+
}
|
|
283
|
+
if (offset !== len) {
|
|
284
|
+
if (offset !== 0) {
|
|
285
|
+
arg = arg.slice(offset);
|
|
286
|
+
}
|
|
287
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
288
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
289
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
290
|
+
|
|
291
|
+
offset += ret.written;
|
|
292
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
WASM_VECTOR_LEN = offset;
|
|
296
|
+
return ptr;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function takeFromExternrefTable0(idx) {
|
|
300
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
301
|
+
wasm.__externref_table_dealloc(idx);
|
|
302
|
+
return value;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
306
|
+
cachedTextDecoder.decode();
|
|
307
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
308
|
+
let numBytesDecoded = 0;
|
|
309
|
+
function decodeText(ptr, len) {
|
|
310
|
+
numBytesDecoded += len;
|
|
311
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
312
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
313
|
+
cachedTextDecoder.decode();
|
|
314
|
+
numBytesDecoded = len;
|
|
315
|
+
}
|
|
316
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const cachedTextEncoder = new TextEncoder();
|
|
320
|
+
|
|
321
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
322
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
323
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
324
|
+
view.set(buf);
|
|
325
|
+
return {
|
|
326
|
+
read: arg.length,
|
|
327
|
+
written: buf.length
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
let WASM_VECTOR_LEN = 0;
|
|
333
|
+
|
|
334
|
+
let wasmModule, wasm;
|
|
335
|
+
function __wbg_finalize_init(instance, module) {
|
|
336
|
+
wasm = instance.exports;
|
|
337
|
+
wasmModule = module;
|
|
338
|
+
cachedDataViewMemory0 = null;
|
|
339
|
+
cachedUint8ArrayMemory0 = null;
|
|
340
|
+
wasm.__wbindgen_start();
|
|
341
|
+
return wasm;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
async function __wbg_load(module, imports) {
|
|
345
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
346
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
347
|
+
try {
|
|
348
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
349
|
+
} catch (e) {
|
|
350
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
351
|
+
|
|
352
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
353
|
+
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);
|
|
354
|
+
|
|
355
|
+
} else { throw e; }
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
const bytes = await module.arrayBuffer();
|
|
360
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
361
|
+
} else {
|
|
362
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
363
|
+
|
|
364
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
365
|
+
return { instance, module };
|
|
366
|
+
} else {
|
|
367
|
+
return instance;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function expectedResponseType(type) {
|
|
372
|
+
switch (type) {
|
|
373
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
374
|
+
}
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function initSync(module) {
|
|
380
|
+
if (wasm !== undefined) return wasm;
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
if (module !== undefined) {
|
|
384
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
385
|
+
({module} = module)
|
|
386
|
+
} else {
|
|
387
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
const imports = __wbg_get_imports();
|
|
392
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
393
|
+
module = new WebAssembly.Module(module);
|
|
394
|
+
}
|
|
395
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
396
|
+
return __wbg_finalize_init(instance, module);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async function __wbg_init(module_or_path) {
|
|
400
|
+
if (wasm !== undefined) return wasm;
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
if (module_or_path !== undefined) {
|
|
404
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
405
|
+
({module_or_path} = module_or_path)
|
|
406
|
+
} else {
|
|
407
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
if (module_or_path === undefined) {
|
|
412
|
+
module_or_path = new URL('peprs_wasm_bg.wasm', import.meta.url);
|
|
413
|
+
}
|
|
414
|
+
const imports = __wbg_get_imports();
|
|
415
|
+
|
|
416
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
417
|
+
module_or_path = fetch(module_or_path);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
421
|
+
|
|
422
|
+
return __wbg_finalize_init(instance, module);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|