swls-wasm 0.3.1 → 0.3.2-alpha.2
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/client.d.ts +10 -0
- package/client.js +21 -0
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +32 -9
- package/pump.d.ts +24 -0
- package/pump.js +36 -0
- package/swls_wasm.d.ts +50 -1
- package/swls_wasm.js +691 -8
- package/swls_wasm_bg.wasm +0 -0
- package/worker.js +29 -0
- package/swls_wasm_bg.js +0 -591
package/worker.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* swls-wasm semantic-web language server as a Web Worker.
|
|
3
|
+
*
|
|
4
|
+
* This is the worker entry {@link createSwlsWorker} (see `swls-wasm/client`)
|
|
5
|
+
* points a `new Worker(...)` at. It wires the host-agnostic
|
|
6
|
+
* {@link createSwlsServer} pump to the worker's `postMessage`/`onmessage`
|
|
7
|
+
* globals: both ends speak whole JSON-RPC messages (no `Content-Length`
|
|
8
|
+
* framing). Incoming messages that arrive before wasm finishes initializing
|
|
9
|
+
* are queued; once ready, the worker announces itself with a `swls/ready`
|
|
10
|
+
* notification (clients buffer outgoing traffic until they see it).
|
|
11
|
+
*/
|
|
12
|
+
import { createSwlsServer } from "./pump.js";
|
|
13
|
+
|
|
14
|
+
let feed = null;
|
|
15
|
+
const queue = [];
|
|
16
|
+
|
|
17
|
+
createSwlsServer((message) => postMessage(message), {
|
|
18
|
+
debug: (message) => console.log(message),
|
|
19
|
+
}).then((send) => {
|
|
20
|
+
feed = send;
|
|
21
|
+
for (const data of queue) send(data);
|
|
22
|
+
queue.length = 0;
|
|
23
|
+
postMessage({ jsonrpc: "2.0", method: "swls/ready" });
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
onmessage = ({ data }) => {
|
|
27
|
+
if (feed) feed(data);
|
|
28
|
+
else queue.push(data);
|
|
29
|
+
};
|
package/swls_wasm_bg.js
DELETED
|
@@ -1,591 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A self-contained WASM LSP instance that JS can create.
|
|
3
|
-
*/
|
|
4
|
-
export class WasmLsp {
|
|
5
|
-
__destroy_into_raw() {
|
|
6
|
-
const ptr = this.__wbg_ptr;
|
|
7
|
-
this.__wbg_ptr = 0;
|
|
8
|
-
WasmLspFinalization.unregister(this);
|
|
9
|
-
return ptr;
|
|
10
|
-
}
|
|
11
|
-
free() {
|
|
12
|
-
const ptr = this.__destroy_into_raw();
|
|
13
|
-
wasm.__wbg_wasmlsp_free(ptr, 0);
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* JS must pass a callback for receiving messages from Rust/WASM.
|
|
17
|
-
* @param {Function} post_message_cb
|
|
18
|
-
* @param {Function | null} [debug_cb]
|
|
19
|
-
*/
|
|
20
|
-
constructor(post_message_cb, debug_cb) {
|
|
21
|
-
const ret = wasm.wasmlsp_new(post_message_cb, isLikeNone(debug_cb) ? 0 : addToExternrefTable0(debug_cb));
|
|
22
|
-
this.__wbg_ptr = ret >>> 0;
|
|
23
|
-
WasmLspFinalization.register(this, this.__wbg_ptr, this);
|
|
24
|
-
return this;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Send a message from JS → LSP.
|
|
28
|
-
* @param {string} msg
|
|
29
|
-
*/
|
|
30
|
-
send(msg) {
|
|
31
|
-
const ptr0 = passStringToWasm0(msg, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
32
|
-
const len0 = WASM_VECTOR_LEN;
|
|
33
|
-
wasm.wasmlsp_send(this.__wbg_ptr, ptr0, len0);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (Symbol.dispose) WasmLsp.prototype[Symbol.dispose] = WasmLsp.prototype.free;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @returns {Promise<void>}
|
|
40
|
-
*/
|
|
41
|
-
export function start_wasm_lsp() {
|
|
42
|
-
wasm.start_wasm_lsp();
|
|
43
|
-
}
|
|
44
|
-
export function __wbg_Error_960c155d3d49e4c2(arg0, arg1) {
|
|
45
|
-
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
46
|
-
return ret;
|
|
47
|
-
}
|
|
48
|
-
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
49
|
-
const ret = String(arg1);
|
|
50
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
51
|
-
const len1 = WASM_VECTOR_LEN;
|
|
52
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
53
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
54
|
-
}
|
|
55
|
-
export function __wbg___wbindgen_boolean_get_6ea149f0a8dcc5ff(arg0) {
|
|
56
|
-
const v = arg0;
|
|
57
|
-
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
58
|
-
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
59
|
-
}
|
|
60
|
-
export function __wbg___wbindgen_debug_string_ab4b34d23d6778bd(arg0, arg1) {
|
|
61
|
-
const ret = debugString(arg1);
|
|
62
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
63
|
-
const len1 = WASM_VECTOR_LEN;
|
|
64
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
65
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
66
|
-
}
|
|
67
|
-
export function __wbg___wbindgen_is_function_3baa9db1a987f47d(arg0) {
|
|
68
|
-
const ret = typeof(arg0) === 'function';
|
|
69
|
-
return ret;
|
|
70
|
-
}
|
|
71
|
-
export function __wbg___wbindgen_is_object_63322ec0cd6ea4ef(arg0) {
|
|
72
|
-
const val = arg0;
|
|
73
|
-
const ret = typeof(val) === 'object' && val !== null;
|
|
74
|
-
return ret;
|
|
75
|
-
}
|
|
76
|
-
export function __wbg___wbindgen_is_string_6df3bf7ef1164ed3(arg0) {
|
|
77
|
-
const ret = typeof(arg0) === 'string';
|
|
78
|
-
return ret;
|
|
79
|
-
}
|
|
80
|
-
export function __wbg___wbindgen_is_undefined_29a43b4d42920abd(arg0) {
|
|
81
|
-
const ret = arg0 === undefined;
|
|
82
|
-
return ret;
|
|
83
|
-
}
|
|
84
|
-
export function __wbg___wbindgen_jsval_loose_eq_cac3565e89b4134c(arg0, arg1) {
|
|
85
|
-
const ret = arg0 == arg1;
|
|
86
|
-
return ret;
|
|
87
|
-
}
|
|
88
|
-
export function __wbg___wbindgen_number_get_c7f42aed0525c451(arg0, arg1) {
|
|
89
|
-
const obj = arg1;
|
|
90
|
-
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
91
|
-
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
92
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
93
|
-
}
|
|
94
|
-
export function __wbg___wbindgen_string_get_7ed5322991caaec5(arg0, arg1) {
|
|
95
|
-
const obj = arg1;
|
|
96
|
-
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
97
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
98
|
-
var len1 = WASM_VECTOR_LEN;
|
|
99
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
100
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
101
|
-
}
|
|
102
|
-
export function __wbg___wbindgen_throw_6b64449b9b9ed33c(arg0, arg1) {
|
|
103
|
-
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
104
|
-
}
|
|
105
|
-
export function __wbg__wbg_cb_unref_b46c9b5a9f08ec37(arg0) {
|
|
106
|
-
arg0._wbg_cb_unref();
|
|
107
|
-
}
|
|
108
|
-
export function __wbg_call_14b169f759b26747() { return handleError(function (arg0, arg1) {
|
|
109
|
-
const ret = arg0.call(arg1);
|
|
110
|
-
return ret;
|
|
111
|
-
}, arguments); }
|
|
112
|
-
export function __wbg_call_a24592a6f349a97e() { return handleError(function (arg0, arg1, arg2) {
|
|
113
|
-
const ret = arg0.call(arg1, arg2);
|
|
114
|
-
return ret;
|
|
115
|
-
}, arguments); }
|
|
116
|
-
export function __wbg_done_9158f7cc8751ba32(arg0) {
|
|
117
|
-
const ret = arg0.done;
|
|
118
|
-
return ret;
|
|
119
|
-
}
|
|
120
|
-
export function __wbg_entries_e0b73aa8571ddb56(arg0) {
|
|
121
|
-
const ret = Object.entries(arg0);
|
|
122
|
-
return ret;
|
|
123
|
-
}
|
|
124
|
-
export function __wbg_error_a6fa202b58aa1cd3(arg0, arg1) {
|
|
125
|
-
let deferred0_0;
|
|
126
|
-
let deferred0_1;
|
|
127
|
-
try {
|
|
128
|
-
deferred0_0 = arg0;
|
|
129
|
-
deferred0_1 = arg1;
|
|
130
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
131
|
-
} finally {
|
|
132
|
-
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
export function __wbg_fetch_8e155876ef1ec371() { return handleError(function (arg0, arg1) {
|
|
136
|
-
const ret = fetch(arg0, arg1);
|
|
137
|
-
return ret;
|
|
138
|
-
}, arguments); }
|
|
139
|
-
export function __wbg_getRandomValues_3f44b700395062e5() { return handleError(function (arg0, arg1) {
|
|
140
|
-
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
141
|
-
}, arguments); }
|
|
142
|
-
export function __wbg_get_1affdbdd5573b16a() { return handleError(function (arg0, arg1) {
|
|
143
|
-
const ret = Reflect.get(arg0, arg1);
|
|
144
|
-
return ret;
|
|
145
|
-
}, arguments); }
|
|
146
|
-
export function __wbg_get_8360291721e2339f(arg0, arg1) {
|
|
147
|
-
const ret = arg0[arg1 >>> 0];
|
|
148
|
-
return ret;
|
|
149
|
-
}
|
|
150
|
-
export function __wbg_get_unchecked_17f53dad852b9588(arg0, arg1) {
|
|
151
|
-
const ret = arg0[arg1 >>> 0];
|
|
152
|
-
return ret;
|
|
153
|
-
}
|
|
154
|
-
export function __wbg_headers_6022deb4e576fb8e(arg0) {
|
|
155
|
-
const ret = arg0.headers;
|
|
156
|
-
return ret;
|
|
157
|
-
}
|
|
158
|
-
export function __wbg_instanceof_ArrayBuffer_7c8433c6ed14ffe3(arg0) {
|
|
159
|
-
let result;
|
|
160
|
-
try {
|
|
161
|
-
result = arg0 instanceof ArrayBuffer;
|
|
162
|
-
} catch (_) {
|
|
163
|
-
result = false;
|
|
164
|
-
}
|
|
165
|
-
const ret = result;
|
|
166
|
-
return ret;
|
|
167
|
-
}
|
|
168
|
-
export function __wbg_instanceof_Response_9b2d111407865ff2(arg0) {
|
|
169
|
-
let result;
|
|
170
|
-
try {
|
|
171
|
-
result = arg0 instanceof Response;
|
|
172
|
-
} catch (_) {
|
|
173
|
-
result = false;
|
|
174
|
-
}
|
|
175
|
-
const ret = result;
|
|
176
|
-
return ret;
|
|
177
|
-
}
|
|
178
|
-
export function __wbg_instanceof_Uint8Array_152ba1f289edcf3f(arg0) {
|
|
179
|
-
let result;
|
|
180
|
-
try {
|
|
181
|
-
result = arg0 instanceof Uint8Array;
|
|
182
|
-
} catch (_) {
|
|
183
|
-
result = false;
|
|
184
|
-
}
|
|
185
|
-
const ret = result;
|
|
186
|
-
return ret;
|
|
187
|
-
}
|
|
188
|
-
export function __wbg_iterator_013bc09ec998c2a7() {
|
|
189
|
-
const ret = Symbol.iterator;
|
|
190
|
-
return ret;
|
|
191
|
-
}
|
|
192
|
-
export function __wbg_length_3d4ecd04bd8d22f1(arg0) {
|
|
193
|
-
const ret = arg0.length;
|
|
194
|
-
return ret;
|
|
195
|
-
}
|
|
196
|
-
export function __wbg_length_9f1775224cf1d815(arg0) {
|
|
197
|
-
const ret = arg0.length;
|
|
198
|
-
return ret;
|
|
199
|
-
}
|
|
200
|
-
export function __wbg_log_7e1aa9064a1dbdbd(arg0) {
|
|
201
|
-
console.log(arg0);
|
|
202
|
-
}
|
|
203
|
-
export function __wbg_new_0c7403db6e782f19(arg0) {
|
|
204
|
-
const ret = new Uint8Array(arg0);
|
|
205
|
-
return ret;
|
|
206
|
-
}
|
|
207
|
-
export function __wbg_new_227d7c05414eb861() {
|
|
208
|
-
const ret = new Error();
|
|
209
|
-
return ret;
|
|
210
|
-
}
|
|
211
|
-
export function __wbg_new_34d45cc8e36aaead() {
|
|
212
|
-
const ret = new Map();
|
|
213
|
-
return ret;
|
|
214
|
-
}
|
|
215
|
-
export function __wbg_new_682678e2f47e32bc() {
|
|
216
|
-
const ret = new Array();
|
|
217
|
-
return ret;
|
|
218
|
-
}
|
|
219
|
-
export function __wbg_new_aa8d0fa9762c29bd() {
|
|
220
|
-
const ret = new Object();
|
|
221
|
-
return ret;
|
|
222
|
-
}
|
|
223
|
-
export function __wbg_new_from_slice_b5ea43e23f6008c0(arg0, arg1) {
|
|
224
|
-
const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
|
|
225
|
-
return ret;
|
|
226
|
-
}
|
|
227
|
-
export function __wbg_new_typed_323f37fd55ab048d(arg0, arg1) {
|
|
228
|
-
try {
|
|
229
|
-
var state0 = {a: arg0, b: arg1};
|
|
230
|
-
var cb0 = (arg0, arg1) => {
|
|
231
|
-
const a = state0.a;
|
|
232
|
-
state0.a = 0;
|
|
233
|
-
try {
|
|
234
|
-
return wasm_bindgen__convert__closures_____invoke__h09947889d53665a4(a, state0.b, arg0, arg1);
|
|
235
|
-
} finally {
|
|
236
|
-
state0.a = a;
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
const ret = new Promise(cb0);
|
|
240
|
-
return ret;
|
|
241
|
-
} finally {
|
|
242
|
-
state0.a = 0;
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
export function __wbg_next_0340c4ae324393c3() { return handleError(function (arg0) {
|
|
246
|
-
const ret = arg0.next();
|
|
247
|
-
return ret;
|
|
248
|
-
}, arguments); }
|
|
249
|
-
export function __wbg_next_7646edaa39458ef7(arg0) {
|
|
250
|
-
const ret = arg0.next;
|
|
251
|
-
return ret;
|
|
252
|
-
}
|
|
253
|
-
export function __wbg_now_a9b7df1cbee90986() {
|
|
254
|
-
const ret = Date.now();
|
|
255
|
-
return ret;
|
|
256
|
-
}
|
|
257
|
-
export function __wbg_prototypesetcall_a6b02eb00b0f4ce2(arg0, arg1, arg2) {
|
|
258
|
-
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
259
|
-
}
|
|
260
|
-
export function __wbg_queueMicrotask_5d15a957e6aa920e(arg0) {
|
|
261
|
-
queueMicrotask(arg0);
|
|
262
|
-
}
|
|
263
|
-
export function __wbg_queueMicrotask_f8819e5ffc402f36(arg0) {
|
|
264
|
-
const ret = arg0.queueMicrotask;
|
|
265
|
-
return ret;
|
|
266
|
-
}
|
|
267
|
-
export function __wbg_resolve_e6c466bc1052f16c(arg0) {
|
|
268
|
-
const ret = Promise.resolve(arg0);
|
|
269
|
-
return ret;
|
|
270
|
-
}
|
|
271
|
-
export function __wbg_set_3bf1de9fab0cd644(arg0, arg1, arg2) {
|
|
272
|
-
arg0[arg1 >>> 0] = arg2;
|
|
273
|
-
}
|
|
274
|
-
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
275
|
-
arg0[arg1] = arg2;
|
|
276
|
-
}
|
|
277
|
-
export function __wbg_set_fde2cec06c23692b(arg0, arg1, arg2) {
|
|
278
|
-
const ret = arg0.set(arg1, arg2);
|
|
279
|
-
return ret;
|
|
280
|
-
}
|
|
281
|
-
export function __wbg_stack_3b0d974bbf31e44f(arg0, arg1) {
|
|
282
|
-
const ret = arg1.stack;
|
|
283
|
-
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
284
|
-
const len1 = WASM_VECTOR_LEN;
|
|
285
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
286
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
287
|
-
}
|
|
288
|
-
export function __wbg_static_accessor_GLOBAL_8cfadc87a297ca02() {
|
|
289
|
-
const ret = typeof global === 'undefined' ? null : global;
|
|
290
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
291
|
-
}
|
|
292
|
-
export function __wbg_static_accessor_GLOBAL_THIS_602256ae5c8f42cf() {
|
|
293
|
-
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
294
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
295
|
-
}
|
|
296
|
-
export function __wbg_static_accessor_SELF_e445c1c7484aecc3() {
|
|
297
|
-
const ret = typeof self === 'undefined' ? null : self;
|
|
298
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
299
|
-
}
|
|
300
|
-
export function __wbg_static_accessor_WINDOW_f20e8576ef1e0f17() {
|
|
301
|
-
const ret = typeof window === 'undefined' ? null : window;
|
|
302
|
-
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
303
|
-
}
|
|
304
|
-
export function __wbg_status_43e0d2f15b22d69f(arg0) {
|
|
305
|
-
const ret = arg0.status;
|
|
306
|
-
return ret;
|
|
307
|
-
}
|
|
308
|
-
export function __wbg_text_595ef75535aa25c1() { return handleError(function (arg0) {
|
|
309
|
-
const ret = arg0.text();
|
|
310
|
-
return ret;
|
|
311
|
-
}, arguments); }
|
|
312
|
-
export function __wbg_then_792e0c862b060889(arg0, arg1, arg2) {
|
|
313
|
-
const ret = arg0.then(arg1, arg2);
|
|
314
|
-
return ret;
|
|
315
|
-
}
|
|
316
|
-
export function __wbg_then_8e16ee11f05e4827(arg0, arg1) {
|
|
317
|
-
const ret = arg0.then(arg1);
|
|
318
|
-
return ret;
|
|
319
|
-
}
|
|
320
|
-
export function __wbg_value_ee3a06f4579184fa(arg0) {
|
|
321
|
-
const ret = arg0.value;
|
|
322
|
-
return ret;
|
|
323
|
-
}
|
|
324
|
-
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
325
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 4882, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
326
|
-
const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h799ee35745318780);
|
|
327
|
-
return ret;
|
|
328
|
-
}
|
|
329
|
-
export function __wbindgen_cast_0000000000000002(arg0) {
|
|
330
|
-
// Cast intrinsic for `F64 -> Externref`.
|
|
331
|
-
const ret = arg0;
|
|
332
|
-
return ret;
|
|
333
|
-
}
|
|
334
|
-
export function __wbindgen_cast_0000000000000003(arg0) {
|
|
335
|
-
// Cast intrinsic for `I64 -> Externref`.
|
|
336
|
-
const ret = arg0;
|
|
337
|
-
return ret;
|
|
338
|
-
}
|
|
339
|
-
export function __wbindgen_cast_0000000000000004(arg0, arg1) {
|
|
340
|
-
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
341
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
342
|
-
return ret;
|
|
343
|
-
}
|
|
344
|
-
export function __wbindgen_cast_0000000000000005(arg0) {
|
|
345
|
-
// Cast intrinsic for `U64 -> Externref`.
|
|
346
|
-
const ret = BigInt.asUintN(64, arg0);
|
|
347
|
-
return ret;
|
|
348
|
-
}
|
|
349
|
-
export function __wbindgen_init_externref_table() {
|
|
350
|
-
const table = wasm.__wbindgen_externrefs;
|
|
351
|
-
const offset = table.grow(4);
|
|
352
|
-
table.set(0, undefined);
|
|
353
|
-
table.set(offset + 0, undefined);
|
|
354
|
-
table.set(offset + 1, null);
|
|
355
|
-
table.set(offset + 2, true);
|
|
356
|
-
table.set(offset + 3, false);
|
|
357
|
-
}
|
|
358
|
-
function wasm_bindgen__convert__closures_____invoke__h799ee35745318780(arg0, arg1, arg2) {
|
|
359
|
-
const ret = wasm.wasm_bindgen__convert__closures_____invoke__h799ee35745318780(arg0, arg1, arg2);
|
|
360
|
-
if (ret[1]) {
|
|
361
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function wasm_bindgen__convert__closures_____invoke__h09947889d53665a4(arg0, arg1, arg2, arg3) {
|
|
366
|
-
wasm.wasm_bindgen__convert__closures_____invoke__h09947889d53665a4(arg0, arg1, arg2, arg3);
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
const WasmLspFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
370
|
-
? { register: () => {}, unregister: () => {} }
|
|
371
|
-
: new FinalizationRegistry(ptr => wasm.__wbg_wasmlsp_free(ptr >>> 0, 1));
|
|
372
|
-
|
|
373
|
-
function addToExternrefTable0(obj) {
|
|
374
|
-
const idx = wasm.__externref_table_alloc();
|
|
375
|
-
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
376
|
-
return idx;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
380
|
-
? { register: () => {}, unregister: () => {} }
|
|
381
|
-
: new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
|
|
382
|
-
|
|
383
|
-
function debugString(val) {
|
|
384
|
-
// primitive types
|
|
385
|
-
const type = typeof val;
|
|
386
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
387
|
-
return `${val}`;
|
|
388
|
-
}
|
|
389
|
-
if (type == 'string') {
|
|
390
|
-
return `"${val}"`;
|
|
391
|
-
}
|
|
392
|
-
if (type == 'symbol') {
|
|
393
|
-
const description = val.description;
|
|
394
|
-
if (description == null) {
|
|
395
|
-
return 'Symbol';
|
|
396
|
-
} else {
|
|
397
|
-
return `Symbol(${description})`;
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
if (type == 'function') {
|
|
401
|
-
const name = val.name;
|
|
402
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
403
|
-
return `Function(${name})`;
|
|
404
|
-
} else {
|
|
405
|
-
return 'Function';
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
// objects
|
|
409
|
-
if (Array.isArray(val)) {
|
|
410
|
-
const length = val.length;
|
|
411
|
-
let debug = '[';
|
|
412
|
-
if (length > 0) {
|
|
413
|
-
debug += debugString(val[0]);
|
|
414
|
-
}
|
|
415
|
-
for(let i = 1; i < length; i++) {
|
|
416
|
-
debug += ', ' + debugString(val[i]);
|
|
417
|
-
}
|
|
418
|
-
debug += ']';
|
|
419
|
-
return debug;
|
|
420
|
-
}
|
|
421
|
-
// Test for built-in
|
|
422
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
423
|
-
let className;
|
|
424
|
-
if (builtInMatches && builtInMatches.length > 1) {
|
|
425
|
-
className = builtInMatches[1];
|
|
426
|
-
} else {
|
|
427
|
-
// Failed to match the standard '[object ClassName]'
|
|
428
|
-
return toString.call(val);
|
|
429
|
-
}
|
|
430
|
-
if (className == 'Object') {
|
|
431
|
-
// we're a user defined class or Object
|
|
432
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
433
|
-
// easier than looping through ownProperties of `val`.
|
|
434
|
-
try {
|
|
435
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
436
|
-
} catch (_) {
|
|
437
|
-
return 'Object';
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
// errors
|
|
441
|
-
if (val instanceof Error) {
|
|
442
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
443
|
-
}
|
|
444
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
445
|
-
return className;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
449
|
-
ptr = ptr >>> 0;
|
|
450
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
let cachedDataViewMemory0 = null;
|
|
454
|
-
function getDataViewMemory0() {
|
|
455
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
456
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
457
|
-
}
|
|
458
|
-
return cachedDataViewMemory0;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
function getStringFromWasm0(ptr, len) {
|
|
462
|
-
ptr = ptr >>> 0;
|
|
463
|
-
return decodeText(ptr, len);
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
let cachedUint8ArrayMemory0 = null;
|
|
467
|
-
function getUint8ArrayMemory0() {
|
|
468
|
-
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
469
|
-
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
470
|
-
}
|
|
471
|
-
return cachedUint8ArrayMemory0;
|
|
472
|
-
}
|
|
473
|
-
|
|
474
|
-
function handleError(f, args) {
|
|
475
|
-
try {
|
|
476
|
-
return f.apply(this, args);
|
|
477
|
-
} catch (e) {
|
|
478
|
-
const idx = addToExternrefTable0(e);
|
|
479
|
-
wasm.__wbindgen_exn_store(idx);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
function isLikeNone(x) {
|
|
484
|
-
return x === undefined || x === null;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function makeMutClosure(arg0, arg1, f) {
|
|
488
|
-
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
489
|
-
const real = (...args) => {
|
|
490
|
-
|
|
491
|
-
// First up with a closure we increment the internal reference
|
|
492
|
-
// count. This ensures that the Rust closure environment won't
|
|
493
|
-
// be deallocated while we're invoking it.
|
|
494
|
-
state.cnt++;
|
|
495
|
-
const a = state.a;
|
|
496
|
-
state.a = 0;
|
|
497
|
-
try {
|
|
498
|
-
return f(a, state.b, ...args);
|
|
499
|
-
} finally {
|
|
500
|
-
state.a = a;
|
|
501
|
-
real._wbg_cb_unref();
|
|
502
|
-
}
|
|
503
|
-
};
|
|
504
|
-
real._wbg_cb_unref = () => {
|
|
505
|
-
if (--state.cnt === 0) {
|
|
506
|
-
wasm.__wbindgen_destroy_closure(state.a, state.b);
|
|
507
|
-
state.a = 0;
|
|
508
|
-
CLOSURE_DTORS.unregister(state);
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
CLOSURE_DTORS.register(real, state, state);
|
|
512
|
-
return real;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
function passStringToWasm0(arg, malloc, realloc) {
|
|
516
|
-
if (realloc === undefined) {
|
|
517
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
518
|
-
const ptr = malloc(buf.length, 1) >>> 0;
|
|
519
|
-
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
520
|
-
WASM_VECTOR_LEN = buf.length;
|
|
521
|
-
return ptr;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
let len = arg.length;
|
|
525
|
-
let ptr = malloc(len, 1) >>> 0;
|
|
526
|
-
|
|
527
|
-
const mem = getUint8ArrayMemory0();
|
|
528
|
-
|
|
529
|
-
let offset = 0;
|
|
530
|
-
|
|
531
|
-
for (; offset < len; offset++) {
|
|
532
|
-
const code = arg.charCodeAt(offset);
|
|
533
|
-
if (code > 0x7F) break;
|
|
534
|
-
mem[ptr + offset] = code;
|
|
535
|
-
}
|
|
536
|
-
if (offset !== len) {
|
|
537
|
-
if (offset !== 0) {
|
|
538
|
-
arg = arg.slice(offset);
|
|
539
|
-
}
|
|
540
|
-
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
541
|
-
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
542
|
-
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
543
|
-
|
|
544
|
-
offset += ret.written;
|
|
545
|
-
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
WASM_VECTOR_LEN = offset;
|
|
549
|
-
return ptr;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
function takeFromExternrefTable0(idx) {
|
|
553
|
-
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
554
|
-
wasm.__externref_table_dealloc(idx);
|
|
555
|
-
return value;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
559
|
-
cachedTextDecoder.decode();
|
|
560
|
-
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
561
|
-
let numBytesDecoded = 0;
|
|
562
|
-
function decodeText(ptr, len) {
|
|
563
|
-
numBytesDecoded += len;
|
|
564
|
-
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
565
|
-
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
566
|
-
cachedTextDecoder.decode();
|
|
567
|
-
numBytesDecoded = len;
|
|
568
|
-
}
|
|
569
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
const cachedTextEncoder = new TextEncoder();
|
|
573
|
-
|
|
574
|
-
if (!('encodeInto' in cachedTextEncoder)) {
|
|
575
|
-
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
576
|
-
const buf = cachedTextEncoder.encode(arg);
|
|
577
|
-
view.set(buf);
|
|
578
|
-
return {
|
|
579
|
-
read: arg.length,
|
|
580
|
-
written: buf.length
|
|
581
|
-
};
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
let WASM_VECTOR_LEN = 0;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
let wasm;
|
|
589
|
-
export function __wbg_set_wasm(val) {
|
|
590
|
-
wasm = val;
|
|
591
|
-
}
|