@srcmap/symbolicate-wasm 0.1.3
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 +43 -0
- package/pkg/package.json +17 -0
- package/pkg/srcmap_symbolicate_wasm.d.ts +18 -0
- package/pkg/srcmap_symbolicate_wasm.js +252 -0
- package/pkg/srcmap_symbolicate_wasm_bg.wasm +0 -0
- package/pkg/srcmap_symbolicate_wasm_bg.wasm.d.ts +10 -0
- package/web/package.json +21 -0
- package/web/srcmap_symbolicate_wasm.d.ts +53 -0
- package/web/srcmap_symbolicate_wasm.js +345 -0
- package/web/srcmap_symbolicate_wasm_bg.wasm +0 -0
- package/web/srcmap_symbolicate_wasm_bg.wasm.d.ts +10 -0
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@srcmap/symbolicate-wasm",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "Stack trace symbolication using source maps, powered by Rust (WebAssembly)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "pkg/srcmap_symbolicate_wasm.js",
|
|
7
|
+
"types": "pkg/srcmap_symbolicate_wasm.d.ts",
|
|
8
|
+
"browser": "web/srcmap_symbolicate_wasm.js",
|
|
9
|
+
"module": "web/srcmap_symbolicate_wasm.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"node": "./pkg/srcmap_symbolicate_wasm.js",
|
|
13
|
+
"browser": "./web/srcmap_symbolicate_wasm.js",
|
|
14
|
+
"default": "./pkg/srcmap_symbolicate_wasm.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"files": [
|
|
19
|
+
"pkg/",
|
|
20
|
+
"web/",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "wasm-pack build --target nodejs --out-dir pkg",
|
|
25
|
+
"build:web": "wasm-pack build --target web --out-dir web",
|
|
26
|
+
"build:bundler": "wasm-pack build --target bundler --out-dir bundler",
|
|
27
|
+
"build:all": "npm run build && npm run build:web"
|
|
28
|
+
},
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "git+https://github.com/BartWaardenburg/srcmap.git"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"sourcemap",
|
|
35
|
+
"source-map",
|
|
36
|
+
"symbolication",
|
|
37
|
+
"stack-trace",
|
|
38
|
+
"rust",
|
|
39
|
+
"wasm",
|
|
40
|
+
"webassembly",
|
|
41
|
+
"browser"
|
|
42
|
+
]
|
|
43
|
+
}
|
package/pkg/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "srcmap-symbolicate-wasm",
|
|
3
|
+
"description": "WebAssembly bindings for srcmap-symbolicate",
|
|
4
|
+
"version": "0.1.3",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/bartwaardenburg/srcmap"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"srcmap_symbolicate_wasm_bg.wasm",
|
|
12
|
+
"srcmap_symbolicate_wasm.js",
|
|
13
|
+
"srcmap_symbolicate_wasm.d.ts"
|
|
14
|
+
],
|
|
15
|
+
"main": "srcmap_symbolicate_wasm.js",
|
|
16
|
+
"types": "srcmap_symbolicate_wasm.d.ts"
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parse a stack trace string into an array of frame objects.
|
|
6
|
+
* Each frame has: {functionName, file, line, column}
|
|
7
|
+
*/
|
|
8
|
+
export function parseStackTrace(input: string): any[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Symbolicate a stack trace using a JavaScript loader function.
|
|
12
|
+
*
|
|
13
|
+
* The loader is called with each unique source file and should return
|
|
14
|
+
* a source map JSON string, or null/undefined if not available.
|
|
15
|
+
*
|
|
16
|
+
* Returns a JSON string with the symbolicated stack.
|
|
17
|
+
*/
|
|
18
|
+
export function symbolicate(input: string, loader: Function): string;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
/* @ts-self-types="./srcmap_symbolicate_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse a stack trace string into an array of frame objects.
|
|
5
|
+
* Each frame has: {functionName, file, line, column}
|
|
6
|
+
* @param {string} input
|
|
7
|
+
* @returns {any[]}
|
|
8
|
+
*/
|
|
9
|
+
function parseStackTrace(input) {
|
|
10
|
+
try {
|
|
11
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
12
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
13
|
+
const len0 = WASM_VECTOR_LEN;
|
|
14
|
+
wasm.parseStackTrace(retptr, ptr0, len0);
|
|
15
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
16
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17
|
+
var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
18
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
19
|
+
return v2;
|
|
20
|
+
} finally {
|
|
21
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.parseStackTrace = parseStackTrace;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Symbolicate a stack trace using a JavaScript loader function.
|
|
28
|
+
*
|
|
29
|
+
* The loader is called with each unique source file and should return
|
|
30
|
+
* a source map JSON string, or null/undefined if not available.
|
|
31
|
+
*
|
|
32
|
+
* Returns a JSON string with the symbolicated stack.
|
|
33
|
+
* @param {string} input
|
|
34
|
+
* @param {Function} loader
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
function symbolicate(input, loader) {
|
|
38
|
+
let deferred2_0;
|
|
39
|
+
let deferred2_1;
|
|
40
|
+
try {
|
|
41
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
42
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
43
|
+
const len0 = WASM_VECTOR_LEN;
|
|
44
|
+
wasm.symbolicate(retptr, ptr0, len0, addBorrowedObject(loader));
|
|
45
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
46
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
47
|
+
deferred2_0 = r0;
|
|
48
|
+
deferred2_1 = r1;
|
|
49
|
+
return getStringFromWasm0(r0, r1);
|
|
50
|
+
} finally {
|
|
51
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
52
|
+
heap[stack_pointer++] = undefined;
|
|
53
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.symbolicate = symbolicate;
|
|
57
|
+
|
|
58
|
+
function __wbg_get_imports() {
|
|
59
|
+
const import0 = {
|
|
60
|
+
__proto__: null,
|
|
61
|
+
__wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
|
|
62
|
+
const ret = getObject(arg0) === null;
|
|
63
|
+
return ret;
|
|
64
|
+
},
|
|
65
|
+
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
66
|
+
const ret = getObject(arg0) === undefined;
|
|
67
|
+
return ret;
|
|
68
|
+
},
|
|
69
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
70
|
+
const obj = getObject(arg1);
|
|
71
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
72
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
73
|
+
var len1 = WASM_VECTOR_LEN;
|
|
74
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
75
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
76
|
+
},
|
|
77
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
78
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
79
|
+
},
|
|
80
|
+
__wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
81
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
82
|
+
return addHeapObject(ret);
|
|
83
|
+
}, arguments); },
|
|
84
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
85
|
+
const ret = new Object();
|
|
86
|
+
return addHeapObject(ret);
|
|
87
|
+
},
|
|
88
|
+
__wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
|
|
89
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
90
|
+
return ret;
|
|
91
|
+
}, arguments); },
|
|
92
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
93
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
94
|
+
const ret = arg0;
|
|
95
|
+
return addHeapObject(ret);
|
|
96
|
+
},
|
|
97
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
98
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
99
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
100
|
+
return addHeapObject(ret);
|
|
101
|
+
},
|
|
102
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
103
|
+
takeObject(arg0);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
__proto__: null,
|
|
108
|
+
"./srcmap_symbolicate_wasm_bg.js": import0,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function addHeapObject(obj) {
|
|
113
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
114
|
+
const idx = heap_next;
|
|
115
|
+
heap_next = heap[idx];
|
|
116
|
+
|
|
117
|
+
heap[idx] = obj;
|
|
118
|
+
return idx;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function addBorrowedObject(obj) {
|
|
122
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
123
|
+
heap[--stack_pointer] = obj;
|
|
124
|
+
return stack_pointer;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function dropObject(idx) {
|
|
128
|
+
if (idx < 1028) return;
|
|
129
|
+
heap[idx] = heap_next;
|
|
130
|
+
heap_next = idx;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
134
|
+
ptr = ptr >>> 0;
|
|
135
|
+
const mem = getDataViewMemory0();
|
|
136
|
+
const result = [];
|
|
137
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
138
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let cachedDataViewMemory0 = null;
|
|
144
|
+
function getDataViewMemory0() {
|
|
145
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
146
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
147
|
+
}
|
|
148
|
+
return cachedDataViewMemory0;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
function getStringFromWasm0(ptr, len) {
|
|
152
|
+
ptr = ptr >>> 0;
|
|
153
|
+
return decodeText(ptr, len);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
let cachedUint8ArrayMemory0 = null;
|
|
157
|
+
function getUint8ArrayMemory0() {
|
|
158
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
159
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
160
|
+
}
|
|
161
|
+
return cachedUint8ArrayMemory0;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
function getObject(idx) { return heap[idx]; }
|
|
165
|
+
|
|
166
|
+
function handleError(f, args) {
|
|
167
|
+
try {
|
|
168
|
+
return f.apply(this, args);
|
|
169
|
+
} catch (e) {
|
|
170
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
let heap = new Array(1024).fill(undefined);
|
|
175
|
+
heap.push(undefined, null, true, false);
|
|
176
|
+
|
|
177
|
+
let heap_next = heap.length;
|
|
178
|
+
|
|
179
|
+
function isLikeNone(x) {
|
|
180
|
+
return x === undefined || x === null;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
184
|
+
if (realloc === undefined) {
|
|
185
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
186
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
187
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
188
|
+
WASM_VECTOR_LEN = buf.length;
|
|
189
|
+
return ptr;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
let len = arg.length;
|
|
193
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
194
|
+
|
|
195
|
+
const mem = getUint8ArrayMemory0();
|
|
196
|
+
|
|
197
|
+
let offset = 0;
|
|
198
|
+
|
|
199
|
+
for (; offset < len; offset++) {
|
|
200
|
+
const code = arg.charCodeAt(offset);
|
|
201
|
+
if (code > 0x7F) break;
|
|
202
|
+
mem[ptr + offset] = code;
|
|
203
|
+
}
|
|
204
|
+
if (offset !== len) {
|
|
205
|
+
if (offset !== 0) {
|
|
206
|
+
arg = arg.slice(offset);
|
|
207
|
+
}
|
|
208
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
209
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
210
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
211
|
+
|
|
212
|
+
offset += ret.written;
|
|
213
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
WASM_VECTOR_LEN = offset;
|
|
217
|
+
return ptr;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
let stack_pointer = 1024;
|
|
221
|
+
|
|
222
|
+
function takeObject(idx) {
|
|
223
|
+
const ret = getObject(idx);
|
|
224
|
+
dropObject(idx);
|
|
225
|
+
return ret;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
229
|
+
cachedTextDecoder.decode();
|
|
230
|
+
function decodeText(ptr, len) {
|
|
231
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const cachedTextEncoder = new TextEncoder();
|
|
235
|
+
|
|
236
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
237
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
238
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
239
|
+
view.set(buf);
|
|
240
|
+
return {
|
|
241
|
+
read: arg.length,
|
|
242
|
+
written: buf.length
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
let WASM_VECTOR_LEN = 0;
|
|
248
|
+
|
|
249
|
+
const wasmPath = `${__dirname}/srcmap_symbolicate_wasm_bg.wasm`;
|
|
250
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
251
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
252
|
+
let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports;
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const parseStackTrace: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const symbolicate: (a: number, b: number, c: number, d: number) => void;
|
|
6
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
7
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
8
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
9
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
10
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|
package/web/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "srcmap-symbolicate-wasm",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WebAssembly bindings for srcmap-symbolicate",
|
|
5
|
+
"version": "0.1.3",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/bartwaardenburg/srcmap"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"srcmap_symbolicate_wasm_bg.wasm",
|
|
13
|
+
"srcmap_symbolicate_wasm.js",
|
|
14
|
+
"srcmap_symbolicate_wasm.d.ts"
|
|
15
|
+
],
|
|
16
|
+
"main": "srcmap_symbolicate_wasm.js",
|
|
17
|
+
"types": "srcmap_symbolicate_wasm.d.ts",
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"./snippets/*"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Parse a stack trace string into an array of frame objects.
|
|
6
|
+
* Each frame has: {functionName, file, line, column}
|
|
7
|
+
*/
|
|
8
|
+
export function parseStackTrace(input: string): any[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Symbolicate a stack trace using a JavaScript loader function.
|
|
12
|
+
*
|
|
13
|
+
* The loader is called with each unique source file and should return
|
|
14
|
+
* a source map JSON string, or null/undefined if not available.
|
|
15
|
+
*
|
|
16
|
+
* Returns a JSON string with the symbolicated stack.
|
|
17
|
+
*/
|
|
18
|
+
export function symbolicate(input: string, loader: Function): string;
|
|
19
|
+
|
|
20
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
21
|
+
|
|
22
|
+
export interface InitOutput {
|
|
23
|
+
readonly memory: WebAssembly.Memory;
|
|
24
|
+
readonly parseStackTrace: (a: number, b: number, c: number) => void;
|
|
25
|
+
readonly symbolicate: (a: number, b: number, c: number, d: number) => void;
|
|
26
|
+
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
27
|
+
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
28
|
+
readonly __wbindgen_export3: (a: number) => void;
|
|
29
|
+
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
30
|
+
readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
37
|
+
* a precompiled `WebAssembly.Module`.
|
|
38
|
+
*
|
|
39
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
40
|
+
*
|
|
41
|
+
* @returns {InitOutput}
|
|
42
|
+
*/
|
|
43
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
47
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
48
|
+
*
|
|
49
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
50
|
+
*
|
|
51
|
+
* @returns {Promise<InitOutput>}
|
|
52
|
+
*/
|
|
53
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
/* @ts-self-types="./srcmap_symbolicate_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parse a stack trace string into an array of frame objects.
|
|
5
|
+
* Each frame has: {functionName, file, line, column}
|
|
6
|
+
* @param {string} input
|
|
7
|
+
* @returns {any[]}
|
|
8
|
+
*/
|
|
9
|
+
export function parseStackTrace(input) {
|
|
10
|
+
try {
|
|
11
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
12
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
13
|
+
const len0 = WASM_VECTOR_LEN;
|
|
14
|
+
wasm.parseStackTrace(retptr, ptr0, len0);
|
|
15
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
16
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
17
|
+
var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
18
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
19
|
+
return v2;
|
|
20
|
+
} finally {
|
|
21
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Symbolicate a stack trace using a JavaScript loader function.
|
|
27
|
+
*
|
|
28
|
+
* The loader is called with each unique source file and should return
|
|
29
|
+
* a source map JSON string, or null/undefined if not available.
|
|
30
|
+
*
|
|
31
|
+
* Returns a JSON string with the symbolicated stack.
|
|
32
|
+
* @param {string} input
|
|
33
|
+
* @param {Function} loader
|
|
34
|
+
* @returns {string}
|
|
35
|
+
*/
|
|
36
|
+
export function symbolicate(input, loader) {
|
|
37
|
+
let deferred2_0;
|
|
38
|
+
let deferred2_1;
|
|
39
|
+
try {
|
|
40
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
41
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
42
|
+
const len0 = WASM_VECTOR_LEN;
|
|
43
|
+
wasm.symbolicate(retptr, ptr0, len0, addBorrowedObject(loader));
|
|
44
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
45
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
46
|
+
deferred2_0 = r0;
|
|
47
|
+
deferred2_1 = r1;
|
|
48
|
+
return getStringFromWasm0(r0, r1);
|
|
49
|
+
} finally {
|
|
50
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
51
|
+
heap[stack_pointer++] = undefined;
|
|
52
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function __wbg_get_imports() {
|
|
57
|
+
const import0 = {
|
|
58
|
+
__proto__: null,
|
|
59
|
+
__wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
|
|
60
|
+
const ret = getObject(arg0) === null;
|
|
61
|
+
return ret;
|
|
62
|
+
},
|
|
63
|
+
__wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
|
|
64
|
+
const ret = getObject(arg0) === undefined;
|
|
65
|
+
return ret;
|
|
66
|
+
},
|
|
67
|
+
__wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
|
|
68
|
+
const obj = getObject(arg1);
|
|
69
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
70
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
71
|
+
var len1 = WASM_VECTOR_LEN;
|
|
72
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
73
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
74
|
+
},
|
|
75
|
+
__wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
|
|
76
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
77
|
+
},
|
|
78
|
+
__wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
|
|
79
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
80
|
+
return addHeapObject(ret);
|
|
81
|
+
}, arguments); },
|
|
82
|
+
__wbg_new_ab79df5bd7c26067: function() {
|
|
83
|
+
const ret = new Object();
|
|
84
|
+
return addHeapObject(ret);
|
|
85
|
+
},
|
|
86
|
+
__wbg_set_7eaa4f96924fd6b3: function() { return handleError(function (arg0, arg1, arg2) {
|
|
87
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
88
|
+
return ret;
|
|
89
|
+
}, arguments); },
|
|
90
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
91
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
92
|
+
const ret = arg0;
|
|
93
|
+
return addHeapObject(ret);
|
|
94
|
+
},
|
|
95
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
96
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
97
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
98
|
+
return addHeapObject(ret);
|
|
99
|
+
},
|
|
100
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
101
|
+
takeObject(arg0);
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
return {
|
|
105
|
+
__proto__: null,
|
|
106
|
+
"./srcmap_symbolicate_wasm_bg.js": import0,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function addHeapObject(obj) {
|
|
111
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
112
|
+
const idx = heap_next;
|
|
113
|
+
heap_next = heap[idx];
|
|
114
|
+
|
|
115
|
+
heap[idx] = obj;
|
|
116
|
+
return idx;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function addBorrowedObject(obj) {
|
|
120
|
+
if (stack_pointer == 1) throw new Error('out of js stack');
|
|
121
|
+
heap[--stack_pointer] = obj;
|
|
122
|
+
return stack_pointer;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function dropObject(idx) {
|
|
126
|
+
if (idx < 1028) return;
|
|
127
|
+
heap[idx] = heap_next;
|
|
128
|
+
heap_next = idx;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
132
|
+
ptr = ptr >>> 0;
|
|
133
|
+
const mem = getDataViewMemory0();
|
|
134
|
+
const result = [];
|
|
135
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
136
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
137
|
+
}
|
|
138
|
+
return result;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
let cachedDataViewMemory0 = null;
|
|
142
|
+
function getDataViewMemory0() {
|
|
143
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
144
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
145
|
+
}
|
|
146
|
+
return cachedDataViewMemory0;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function getStringFromWasm0(ptr, len) {
|
|
150
|
+
ptr = ptr >>> 0;
|
|
151
|
+
return decodeText(ptr, len);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
let cachedUint8ArrayMemory0 = null;
|
|
155
|
+
function getUint8ArrayMemory0() {
|
|
156
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
157
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
158
|
+
}
|
|
159
|
+
return cachedUint8ArrayMemory0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function getObject(idx) { return heap[idx]; }
|
|
163
|
+
|
|
164
|
+
function handleError(f, args) {
|
|
165
|
+
try {
|
|
166
|
+
return f.apply(this, args);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
let heap = new Array(1024).fill(undefined);
|
|
173
|
+
heap.push(undefined, null, true, false);
|
|
174
|
+
|
|
175
|
+
let heap_next = heap.length;
|
|
176
|
+
|
|
177
|
+
function isLikeNone(x) {
|
|
178
|
+
return x === undefined || x === null;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
182
|
+
if (realloc === undefined) {
|
|
183
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
184
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
185
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
186
|
+
WASM_VECTOR_LEN = buf.length;
|
|
187
|
+
return ptr;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
let len = arg.length;
|
|
191
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
192
|
+
|
|
193
|
+
const mem = getUint8ArrayMemory0();
|
|
194
|
+
|
|
195
|
+
let offset = 0;
|
|
196
|
+
|
|
197
|
+
for (; offset < len; offset++) {
|
|
198
|
+
const code = arg.charCodeAt(offset);
|
|
199
|
+
if (code > 0x7F) break;
|
|
200
|
+
mem[ptr + offset] = code;
|
|
201
|
+
}
|
|
202
|
+
if (offset !== len) {
|
|
203
|
+
if (offset !== 0) {
|
|
204
|
+
arg = arg.slice(offset);
|
|
205
|
+
}
|
|
206
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
207
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
208
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
209
|
+
|
|
210
|
+
offset += ret.written;
|
|
211
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
WASM_VECTOR_LEN = offset;
|
|
215
|
+
return ptr;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
let stack_pointer = 1024;
|
|
219
|
+
|
|
220
|
+
function takeObject(idx) {
|
|
221
|
+
const ret = getObject(idx);
|
|
222
|
+
dropObject(idx);
|
|
223
|
+
return ret;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
227
|
+
cachedTextDecoder.decode();
|
|
228
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
229
|
+
let numBytesDecoded = 0;
|
|
230
|
+
function decodeText(ptr, len) {
|
|
231
|
+
numBytesDecoded += len;
|
|
232
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
233
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
234
|
+
cachedTextDecoder.decode();
|
|
235
|
+
numBytesDecoded = len;
|
|
236
|
+
}
|
|
237
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const cachedTextEncoder = new TextEncoder();
|
|
241
|
+
|
|
242
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
243
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
244
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
245
|
+
view.set(buf);
|
|
246
|
+
return {
|
|
247
|
+
read: arg.length,
|
|
248
|
+
written: buf.length
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
let WASM_VECTOR_LEN = 0;
|
|
254
|
+
|
|
255
|
+
let wasmModule, wasm;
|
|
256
|
+
function __wbg_finalize_init(instance, module) {
|
|
257
|
+
wasm = instance.exports;
|
|
258
|
+
wasmModule = module;
|
|
259
|
+
cachedDataViewMemory0 = null;
|
|
260
|
+
cachedUint8ArrayMemory0 = null;
|
|
261
|
+
return wasm;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
async function __wbg_load(module, imports) {
|
|
265
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
266
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
267
|
+
try {
|
|
268
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
269
|
+
} catch (e) {
|
|
270
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
271
|
+
|
|
272
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
273
|
+
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);
|
|
274
|
+
|
|
275
|
+
} else { throw e; }
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
const bytes = await module.arrayBuffer();
|
|
280
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
281
|
+
} else {
|
|
282
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
283
|
+
|
|
284
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
285
|
+
return { instance, module };
|
|
286
|
+
} else {
|
|
287
|
+
return instance;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
function expectedResponseType(type) {
|
|
292
|
+
switch (type) {
|
|
293
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
294
|
+
}
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function initSync(module) {
|
|
300
|
+
if (wasm !== undefined) return wasm;
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
if (module !== undefined) {
|
|
304
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
305
|
+
({module} = module)
|
|
306
|
+
} else {
|
|
307
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
const imports = __wbg_get_imports();
|
|
312
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
313
|
+
module = new WebAssembly.Module(module);
|
|
314
|
+
}
|
|
315
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
316
|
+
return __wbg_finalize_init(instance, module);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
async function __wbg_init(module_or_path) {
|
|
320
|
+
if (wasm !== undefined) return wasm;
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
if (module_or_path !== undefined) {
|
|
324
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
325
|
+
({module_or_path} = module_or_path)
|
|
326
|
+
} else {
|
|
327
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (module_or_path === undefined) {
|
|
332
|
+
module_or_path = new URL('srcmap_symbolicate_wasm_bg.wasm', import.meta.url);
|
|
333
|
+
}
|
|
334
|
+
const imports = __wbg_get_imports();
|
|
335
|
+
|
|
336
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
337
|
+
module_or_path = fetch(module_or_path);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
341
|
+
|
|
342
|
+
return __wbg_finalize_init(instance, module);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export { initSync, __wbg_init as default };
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const parseStackTrace: (a: number, b: number, c: number) => void;
|
|
5
|
+
export const symbolicate: (a: number, b: number, c: number, d: number) => void;
|
|
6
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
7
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
8
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
9
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
10
|
+
export const __wbindgen_export4: (a: number, b: number, c: number) => void;
|