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