jsontrek 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +15 -0
- package/web.d.ts +40 -0
- package/web.js +218 -0
- package/web_bg.wasm +0 -0
package/package.json
ADDED
package/web.d.ts
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
/* tslint:disable */
|
2
|
+
/* eslint-disable */
|
3
|
+
/**
|
4
|
+
* @param {string} obj
|
5
|
+
* @param {string} path
|
6
|
+
* @returns {string}
|
7
|
+
*/
|
8
|
+
export function parse(obj: string, path: string): string;
|
9
|
+
|
10
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
11
|
+
|
12
|
+
export interface InitOutput {
|
13
|
+
readonly memory: WebAssembly.Memory;
|
14
|
+
readonly parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
15
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
16
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
17
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
18
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
19
|
+
}
|
20
|
+
|
21
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
22
|
+
/**
|
23
|
+
* Instantiates the given `module`, which can either be bytes or
|
24
|
+
* a precompiled `WebAssembly.Module`.
|
25
|
+
*
|
26
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
27
|
+
*
|
28
|
+
* @returns {InitOutput}
|
29
|
+
*/
|
30
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
31
|
+
|
32
|
+
/**
|
33
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
34
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
35
|
+
*
|
36
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
37
|
+
*
|
38
|
+
* @returns {Promise<InitOutput>}
|
39
|
+
*/
|
40
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/web.js
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
let wasm;
|
2
|
+
|
3
|
+
let WASM_VECTOR_LEN = 0;
|
4
|
+
|
5
|
+
let cachedUint8ArrayMemory0 = null;
|
6
|
+
|
7
|
+
function getUint8ArrayMemory0() {
|
8
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
9
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
10
|
+
}
|
11
|
+
return cachedUint8ArrayMemory0;
|
12
|
+
}
|
13
|
+
|
14
|
+
const cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );
|
15
|
+
|
16
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
17
|
+
? function (arg, view) {
|
18
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
19
|
+
}
|
20
|
+
: function (arg, view) {
|
21
|
+
const buf = cachedTextEncoder.encode(arg);
|
22
|
+
view.set(buf);
|
23
|
+
return {
|
24
|
+
read: arg.length,
|
25
|
+
written: buf.length
|
26
|
+
};
|
27
|
+
});
|
28
|
+
|
29
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
30
|
+
|
31
|
+
if (realloc === undefined) {
|
32
|
+
const buf = cachedTextEncoder.encode(arg);
|
33
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
34
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
35
|
+
WASM_VECTOR_LEN = buf.length;
|
36
|
+
return ptr;
|
37
|
+
}
|
38
|
+
|
39
|
+
let len = arg.length;
|
40
|
+
let ptr = malloc(len, 1) >>> 0;
|
41
|
+
|
42
|
+
const mem = getUint8ArrayMemory0();
|
43
|
+
|
44
|
+
let offset = 0;
|
45
|
+
|
46
|
+
for (; offset < len; offset++) {
|
47
|
+
const code = arg.charCodeAt(offset);
|
48
|
+
if (code > 0x7F) break;
|
49
|
+
mem[ptr + offset] = code;
|
50
|
+
}
|
51
|
+
|
52
|
+
if (offset !== len) {
|
53
|
+
if (offset !== 0) {
|
54
|
+
arg = arg.slice(offset);
|
55
|
+
}
|
56
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
57
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
58
|
+
const ret = encodeString(arg, view);
|
59
|
+
|
60
|
+
offset += ret.written;
|
61
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
62
|
+
}
|
63
|
+
|
64
|
+
WASM_VECTOR_LEN = offset;
|
65
|
+
return ptr;
|
66
|
+
}
|
67
|
+
|
68
|
+
let cachedDataViewMemory0 = null;
|
69
|
+
|
70
|
+
function getDataViewMemory0() {
|
71
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
72
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
73
|
+
}
|
74
|
+
return cachedDataViewMemory0;
|
75
|
+
}
|
76
|
+
|
77
|
+
const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
|
78
|
+
|
79
|
+
if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
|
80
|
+
|
81
|
+
function getStringFromWasm0(ptr, len) {
|
82
|
+
ptr = ptr >>> 0;
|
83
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* @param {string} obj
|
87
|
+
* @param {string} path
|
88
|
+
* @returns {string}
|
89
|
+
*/
|
90
|
+
export function parse(obj, path) {
|
91
|
+
let deferred3_0;
|
92
|
+
let deferred3_1;
|
93
|
+
try {
|
94
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
95
|
+
const ptr0 = passStringToWasm0(obj, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
96
|
+
const len0 = WASM_VECTOR_LEN;
|
97
|
+
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
98
|
+
const len1 = WASM_VECTOR_LEN;
|
99
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
100
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
101
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
102
|
+
deferred3_0 = r0;
|
103
|
+
deferred3_1 = r1;
|
104
|
+
return getStringFromWasm0(r0, r1);
|
105
|
+
} finally {
|
106
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
107
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
async function __wbg_load(module, imports) {
|
112
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
113
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
114
|
+
try {
|
115
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
116
|
+
|
117
|
+
} catch (e) {
|
118
|
+
if (module.headers.get('Content-Type') != 'application/wasm') {
|
119
|
+
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);
|
120
|
+
|
121
|
+
} else {
|
122
|
+
throw e;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
}
|
126
|
+
|
127
|
+
const bytes = await module.arrayBuffer();
|
128
|
+
return await WebAssembly.instantiate(bytes, imports);
|
129
|
+
|
130
|
+
} else {
|
131
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
132
|
+
|
133
|
+
if (instance instanceof WebAssembly.Instance) {
|
134
|
+
return { instance, module };
|
135
|
+
|
136
|
+
} else {
|
137
|
+
return instance;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
function __wbg_get_imports() {
|
143
|
+
const imports = {};
|
144
|
+
imports.wbg = {};
|
145
|
+
|
146
|
+
return imports;
|
147
|
+
}
|
148
|
+
|
149
|
+
function __wbg_init_memory(imports, memory) {
|
150
|
+
|
151
|
+
}
|
152
|
+
|
153
|
+
function __wbg_finalize_init(instance, module) {
|
154
|
+
wasm = instance.exports;
|
155
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
156
|
+
cachedDataViewMemory0 = null;
|
157
|
+
cachedUint8ArrayMemory0 = null;
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
return wasm;
|
162
|
+
}
|
163
|
+
|
164
|
+
function initSync(module) {
|
165
|
+
if (wasm !== undefined) return wasm;
|
166
|
+
|
167
|
+
|
168
|
+
if (typeof module !== 'undefined') {
|
169
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
170
|
+
({module} = module)
|
171
|
+
} else {
|
172
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
173
|
+
}
|
174
|
+
}
|
175
|
+
|
176
|
+
const imports = __wbg_get_imports();
|
177
|
+
|
178
|
+
__wbg_init_memory(imports);
|
179
|
+
|
180
|
+
if (!(module instanceof WebAssembly.Module)) {
|
181
|
+
module = new WebAssembly.Module(module);
|
182
|
+
}
|
183
|
+
|
184
|
+
const instance = new WebAssembly.Instance(module, imports);
|
185
|
+
|
186
|
+
return __wbg_finalize_init(instance, module);
|
187
|
+
}
|
188
|
+
|
189
|
+
async function __wbg_init(module_or_path) {
|
190
|
+
if (wasm !== undefined) return wasm;
|
191
|
+
|
192
|
+
|
193
|
+
if (typeof module_or_path !== 'undefined') {
|
194
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
195
|
+
({module_or_path} = module_or_path)
|
196
|
+
} else {
|
197
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
if (typeof module_or_path === 'undefined') {
|
202
|
+
module_or_path = new URL('web_bg.wasm', import.meta.url);
|
203
|
+
}
|
204
|
+
const imports = __wbg_get_imports();
|
205
|
+
|
206
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
207
|
+
module_or_path = fetch(module_or_path);
|
208
|
+
}
|
209
|
+
|
210
|
+
__wbg_init_memory(imports);
|
211
|
+
|
212
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
213
|
+
|
214
|
+
return __wbg_finalize_init(instance, module);
|
215
|
+
}
|
216
|
+
|
217
|
+
export { initSync };
|
218
|
+
export default __wbg_init;
|
package/web_bg.wasm
ADDED
Binary file
|