jsontrek 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/bundle.d.ts +8 -0
- package/bundle.js +4 -0
- package/bundle_bg.js +118 -0
- package/package.json +8 -6
- package/web.d.ts +0 -40
- package/web.js +0 -218
- /package/{web_bg.wasm → bundle_bg.wasm} +0 -0
package/bundle.d.ts
ADDED
package/bundle.js
ADDED
package/bundle_bg.js
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
let wasm;
|
2
|
+
export function __wbg_set_wasm(val) {
|
3
|
+
wasm = val;
|
4
|
+
}
|
5
|
+
|
6
|
+
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
8
|
+
|
9
|
+
let cachedUint8ArrayMemory0 = null;
|
10
|
+
|
11
|
+
function getUint8ArrayMemory0() {
|
12
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
13
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
14
|
+
}
|
15
|
+
return cachedUint8ArrayMemory0;
|
16
|
+
}
|
17
|
+
|
18
|
+
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
19
|
+
|
20
|
+
let cachedTextEncoder = new lTextEncoder('utf-8');
|
21
|
+
|
22
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
23
|
+
? function (arg, view) {
|
24
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
25
|
+
}
|
26
|
+
: function (arg, view) {
|
27
|
+
const buf = cachedTextEncoder.encode(arg);
|
28
|
+
view.set(buf);
|
29
|
+
return {
|
30
|
+
read: arg.length,
|
31
|
+
written: buf.length
|
32
|
+
};
|
33
|
+
});
|
34
|
+
|
35
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
36
|
+
|
37
|
+
if (realloc === undefined) {
|
38
|
+
const buf = cachedTextEncoder.encode(arg);
|
39
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
40
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
41
|
+
WASM_VECTOR_LEN = buf.length;
|
42
|
+
return ptr;
|
43
|
+
}
|
44
|
+
|
45
|
+
let len = arg.length;
|
46
|
+
let ptr = malloc(len, 1) >>> 0;
|
47
|
+
|
48
|
+
const mem = getUint8ArrayMemory0();
|
49
|
+
|
50
|
+
let offset = 0;
|
51
|
+
|
52
|
+
for (; offset < len; offset++) {
|
53
|
+
const code = arg.charCodeAt(offset);
|
54
|
+
if (code > 0x7F) break;
|
55
|
+
mem[ptr + offset] = code;
|
56
|
+
}
|
57
|
+
|
58
|
+
if (offset !== len) {
|
59
|
+
if (offset !== 0) {
|
60
|
+
arg = arg.slice(offset);
|
61
|
+
}
|
62
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
63
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
64
|
+
const ret = encodeString(arg, view);
|
65
|
+
|
66
|
+
offset += ret.written;
|
67
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
68
|
+
}
|
69
|
+
|
70
|
+
WASM_VECTOR_LEN = offset;
|
71
|
+
return ptr;
|
72
|
+
}
|
73
|
+
|
74
|
+
let cachedDataViewMemory0 = null;
|
75
|
+
|
76
|
+
function getDataViewMemory0() {
|
77
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
78
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
79
|
+
}
|
80
|
+
return cachedDataViewMemory0;
|
81
|
+
}
|
82
|
+
|
83
|
+
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
84
|
+
|
85
|
+
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
86
|
+
|
87
|
+
cachedTextDecoder.decode();
|
88
|
+
|
89
|
+
function getStringFromWasm0(ptr, len) {
|
90
|
+
ptr = ptr >>> 0;
|
91
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
92
|
+
}
|
93
|
+
/**
|
94
|
+
* @param {string} obj
|
95
|
+
* @param {string} path
|
96
|
+
* @returns {string}
|
97
|
+
*/
|
98
|
+
export function parse(obj, path) {
|
99
|
+
let deferred3_0;
|
100
|
+
let deferred3_1;
|
101
|
+
try {
|
102
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
103
|
+
const ptr0 = passStringToWasm0(obj, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
104
|
+
const len0 = WASM_VECTOR_LEN;
|
105
|
+
const ptr1 = passStringToWasm0(path, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
106
|
+
const len1 = WASM_VECTOR_LEN;
|
107
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
108
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
109
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
110
|
+
deferred3_0 = r0;
|
111
|
+
deferred3_1 = r1;
|
112
|
+
return getStringFromWasm0(r0, r1);
|
113
|
+
} finally {
|
114
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
115
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
package/package.json
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "jsontrek",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.1.
|
4
|
+
"version": "0.1.1",
|
5
5
|
"files": [
|
6
|
-
"
|
7
|
-
"
|
8
|
-
"
|
6
|
+
"bundle_bg.wasm",
|
7
|
+
"bundle.js",
|
8
|
+
"bundle_bg.js",
|
9
|
+
"bundle.d.ts"
|
9
10
|
],
|
10
|
-
"main": "
|
11
|
-
"types": "
|
11
|
+
"main": "bundle.js",
|
12
|
+
"types": "bundle.d.ts",
|
12
13
|
"sideEffects": [
|
14
|
+
"./bundle.js",
|
13
15
|
"./snippets/*"
|
14
16
|
]
|
15
17
|
}
|
package/web.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
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
DELETED
@@ -1,218 +0,0 @@
|
|
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;
|
File without changes
|