@arborium/kdl 2.6.1 → 2.18.0

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.
Files changed (3) hide show
  1. package/grammar.js +389 -163
  2. package/grammar_bg.wasm +0 -0
  3. package/package.json +2 -2
package/grammar.js CHANGED
@@ -1,4 +1,296 @@
1
- let wasm;
1
+ /* @ts-self-types="./arborium_kdl_plugin.d.ts" */
2
+
3
+ /**
4
+ * Applies an incremental edit to a session and re-parses its tree incrementally.
5
+ *
6
+ * `new_text` is the full text after the edit; `edit` is an `arborium_wire::Edit`
7
+ * (UTF-8 byte offsets + row/col points). Call `parse` / `parse_utf16` afterwards
8
+ * to read the updated spans — this is what makes editor highlighting fast, since
9
+ * tree-sitter reuses the unchanged parts of the previous tree.
10
+ * @param {number} session
11
+ * @param {string} new_text
12
+ * @param {any} edit
13
+ */
14
+ export function apply_edit(session, new_text, edit) {
15
+ try {
16
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
17
+ const ptr0 = passStringToWasm0(new_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
18
+ const len0 = WASM_VECTOR_LEN;
19
+ wasm.apply_edit(retptr, session, ptr0, len0, addHeapObject(edit));
20
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
21
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
22
+ if (r1) {
23
+ throw takeObject(r0);
24
+ }
25
+ } finally {
26
+ wasm.__wbindgen_add_to_stack_pointer(16);
27
+ }
28
+ }
29
+
30
+ /**
31
+ * Cancels an ongoing parse operation.
32
+ * @param {number} session
33
+ */
34
+ export function cancel(session) {
35
+ wasm.cancel(session);
36
+ }
37
+
38
+ /**
39
+ * Creates a new parser session and returns its ID.
40
+ * @returns {number}
41
+ */
42
+ export function create_session() {
43
+ const ret = wasm.create_session();
44
+ return ret >>> 0;
45
+ }
46
+
47
+ /**
48
+ * Frees a parser session.
49
+ * @param {number} session
50
+ */
51
+ export function free_session(session) {
52
+ wasm.free_session(session);
53
+ }
54
+
55
+ /**
56
+ * Returns the list of languages this grammar can inject into (e.g., for embedded languages).
57
+ * Most grammars return an empty array.
58
+ * @returns {string[]}
59
+ */
60
+ export function injection_languages() {
61
+ try {
62
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
63
+ wasm.injection_languages(retptr);
64
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
65
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
66
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
67
+ wasm.__wbindgen_export3(r0, r1 * 4, 4);
68
+ return v1;
69
+ } finally {
70
+ wasm.__wbindgen_add_to_stack_pointer(16);
71
+ }
72
+ }
73
+
74
+ /**
75
+ * Returns the language ID for this grammar plugin.
76
+ * @returns {string}
77
+ */
78
+ export function language_id() {
79
+ let deferred1_0;
80
+ let deferred1_1;
81
+ try {
82
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
83
+ wasm.language_id(retptr);
84
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
85
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
86
+ deferred1_0 = r0;
87
+ deferred1_1 = r1;
88
+ return getStringFromWasm0(r0, r1);
89
+ } finally {
90
+ wasm.__wbindgen_add_to_stack_pointer(16);
91
+ wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Parses the text in a session and returns spans with UTF-8 byte offsets.
97
+ *
98
+ * Use this for Rust code that needs to slice strings with `&source[start..end]`.
99
+ * For JavaScript interop, use `parse_utf16` instead.
100
+ * @param {number} session
101
+ * @returns {any}
102
+ */
103
+ export function parse(session) {
104
+ try {
105
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
106
+ wasm.parse(retptr, session);
107
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
108
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
109
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
110
+ if (r2) {
111
+ throw takeObject(r1);
112
+ }
113
+ return takeObject(r0);
114
+ } finally {
115
+ wasm.__wbindgen_add_to_stack_pointer(16);
116
+ }
117
+ }
118
+
119
+ /**
120
+ * Parses the text in a session and returns spans with UTF-16 code unit indices.
121
+ *
122
+ * Use this for JavaScript code that needs to use `String.prototype.slice()`.
123
+ * The offsets are compatible with JavaScript string APIs.
124
+ * @param {number} session
125
+ * @returns {any}
126
+ */
127
+ export function parse_utf16(session) {
128
+ try {
129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
130
+ wasm.parse_utf16(retptr, session);
131
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
132
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
133
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
134
+ if (r2) {
135
+ throw takeObject(r1);
136
+ }
137
+ return takeObject(r0);
138
+ } finally {
139
+ wasm.__wbindgen_add_to_stack_pointer(16);
140
+ }
141
+ }
142
+
143
+ /**
144
+ * Sets the text for a parser session.
145
+ * @param {number} session
146
+ * @param {string} text
147
+ */
148
+ export function set_text(session, text) {
149
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
150
+ const len0 = WASM_VECTOR_LEN;
151
+ wasm.set_text(session, ptr0, len0);
152
+ }
153
+
154
+ function __wbg_get_imports() {
155
+ const import0 = {
156
+ __proto__: null,
157
+ __wbg_Error_83742b46f01ce22d: function(arg0, arg1) {
158
+ const ret = Error(getStringFromWasm0(arg0, arg1));
159
+ return addHeapObject(ret);
160
+ },
161
+ __wbg_Number_a5a435bd7bbec835: function(arg0) {
162
+ const ret = Number(getObject(arg0));
163
+ return ret;
164
+ },
165
+ __wbg_String_8564e559799eccda: function(arg0, arg1) {
166
+ const ret = String(getObject(arg1));
167
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
168
+ const len1 = WASM_VECTOR_LEN;
169
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
170
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
171
+ },
172
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
173
+ const v = getObject(arg0);
174
+ const ret = typeof(v) === 'boolean' ? v : undefined;
175
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
176
+ },
177
+ __wbg___wbindgen_debug_string_5398f5bb970e0daa: function(arg0, arg1) {
178
+ const ret = debugString(getObject(arg1));
179
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
180
+ const len1 = WASM_VECTOR_LEN;
181
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
182
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
183
+ },
184
+ __wbg___wbindgen_in_41dbb8413020e076: function(arg0, arg1) {
185
+ const ret = getObject(arg0) in getObject(arg1);
186
+ return ret;
187
+ },
188
+ __wbg___wbindgen_is_object_781bc9f159099513: function(arg0) {
189
+ const val = getObject(arg0);
190
+ const ret = typeof(val) === 'object' && val !== null;
191
+ return ret;
192
+ },
193
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
194
+ const ret = getObject(arg0) === undefined;
195
+ return ret;
196
+ },
197
+ __wbg___wbindgen_jsval_loose_eq_5bcc3bed3c69e72b: function(arg0, arg1) {
198
+ const ret = getObject(arg0) == getObject(arg1);
199
+ return ret;
200
+ },
201
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
202
+ const obj = getObject(arg1);
203
+ const ret = typeof(obj) === 'number' ? obj : undefined;
204
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
205
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
206
+ },
207
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
208
+ const obj = getObject(arg1);
209
+ const ret = typeof(obj) === 'string' ? obj : undefined;
210
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
211
+ var len1 = WASM_VECTOR_LEN;
212
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
213
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
214
+ },
215
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
216
+ throw new Error(getStringFromWasm0(arg0, arg1));
217
+ },
218
+ __wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
219
+ const ret = getObject(arg0)[getObject(arg1)];
220
+ return addHeapObject(ret);
221
+ },
222
+ __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6: function(arg0) {
223
+ let result;
224
+ try {
225
+ result = getObject(arg0) instanceof ArrayBuffer;
226
+ } catch (_) {
227
+ result = false;
228
+ }
229
+ const ret = result;
230
+ return ret;
231
+ },
232
+ __wbg_instanceof_Uint8Array_740438561a5b956d: function(arg0) {
233
+ let result;
234
+ try {
235
+ result = getObject(arg0) instanceof Uint8Array;
236
+ } catch (_) {
237
+ result = false;
238
+ }
239
+ const ret = result;
240
+ return ret;
241
+ },
242
+ __wbg_isSafeInteger_ecd6a7f9c3e053cd: function(arg0) {
243
+ const ret = Number.isSafeInteger(getObject(arg0));
244
+ return ret;
245
+ },
246
+ __wbg_length_ea16607d7b61445b: function(arg0) {
247
+ const ret = getObject(arg0).length;
248
+ return ret;
249
+ },
250
+ __wbg_new_5f486cdf45a04d78: function(arg0) {
251
+ const ret = new Uint8Array(getObject(arg0));
252
+ return addHeapObject(ret);
253
+ },
254
+ __wbg_new_a70fbab9066b301f: function() {
255
+ const ret = new Array();
256
+ return addHeapObject(ret);
257
+ },
258
+ __wbg_new_ab79df5bd7c26067: function() {
259
+ const ret = new Object();
260
+ return addHeapObject(ret);
261
+ },
262
+ __wbg_prototypesetcall_d62e5099504357e6: function(arg0, arg1, arg2) {
263
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
264
+ },
265
+ __wbg_set_282384002438957f: function(arg0, arg1, arg2) {
266
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
267
+ },
268
+ __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
269
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
270
+ },
271
+ __wbindgen_cast_0000000000000001: function(arg0) {
272
+ // Cast intrinsic for `F64 -> Externref`.
273
+ const ret = arg0;
274
+ return addHeapObject(ret);
275
+ },
276
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
277
+ // Cast intrinsic for `Ref(String) -> Externref`.
278
+ const ret = getStringFromWasm0(arg0, arg1);
279
+ return addHeapObject(ret);
280
+ },
281
+ __wbindgen_object_clone_ref: function(arg0) {
282
+ const ret = getObject(arg0);
283
+ return addHeapObject(ret);
284
+ },
285
+ __wbindgen_object_drop_ref: function(arg0) {
286
+ takeObject(arg0);
287
+ },
288
+ };
289
+ return {
290
+ __proto__: null,
291
+ "./arborium_kdl_plugin_bg.js": import0,
292
+ };
293
+ }
2
294
 
3
295
  function addHeapObject(obj) {
4
296
  if (heap_next === heap.length) heap.push(heap.length + 1);
@@ -9,8 +301,73 @@ function addHeapObject(obj) {
9
301
  return idx;
10
302
  }
11
303
 
304
+ function debugString(val) {
305
+ // primitive types
306
+ const type = typeof val;
307
+ if (type == 'number' || type == 'boolean' || val == null) {
308
+ return `${val}`;
309
+ }
310
+ if (type == 'string') {
311
+ return `"${val}"`;
312
+ }
313
+ if (type == 'symbol') {
314
+ const description = val.description;
315
+ if (description == null) {
316
+ return 'Symbol';
317
+ } else {
318
+ return `Symbol(${description})`;
319
+ }
320
+ }
321
+ if (type == 'function') {
322
+ const name = val.name;
323
+ if (typeof name == 'string' && name.length > 0) {
324
+ return `Function(${name})`;
325
+ } else {
326
+ return 'Function';
327
+ }
328
+ }
329
+ // objects
330
+ if (Array.isArray(val)) {
331
+ const length = val.length;
332
+ let debug = '[';
333
+ if (length > 0) {
334
+ debug += debugString(val[0]);
335
+ }
336
+ for(let i = 1; i < length; i++) {
337
+ debug += ', ' + debugString(val[i]);
338
+ }
339
+ debug += ']';
340
+ return debug;
341
+ }
342
+ // Test for built-in
343
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
344
+ let className;
345
+ if (builtInMatches && builtInMatches.length > 1) {
346
+ className = builtInMatches[1];
347
+ } else {
348
+ // Failed to match the standard '[object ClassName]'
349
+ return toString.call(val);
350
+ }
351
+ if (className == 'Object') {
352
+ // we're a user defined class or Object
353
+ // JSON.stringify avoids problems with cycles, and is generally much
354
+ // easier than looping through ownProperties of `val`.
355
+ try {
356
+ return 'Object(' + JSON.stringify(val) + ')';
357
+ } catch (_) {
358
+ return 'Object';
359
+ }
360
+ }
361
+ // errors
362
+ if (val instanceof Error) {
363
+ return `${val.name}: ${val.message}\n${val.stack}`;
364
+ }
365
+ // TODO we could test for more things here, like `Set`s and `Map`s.
366
+ return className;
367
+ }
368
+
12
369
  function dropObject(idx) {
13
- if (idx < 132) return;
370
+ if (idx < 1028) return;
14
371
  heap[idx] = heap_next;
15
372
  heap_next = idx;
16
373
  }
@@ -25,6 +382,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
25
382
  return result;
26
383
  }
27
384
 
385
+ function getArrayU8FromWasm0(ptr, len) {
386
+ ptr = ptr >>> 0;
387
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
388
+ }
389
+
28
390
  let cachedDataViewMemory0 = null;
29
391
  function getDataViewMemory0() {
30
392
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -48,11 +410,15 @@ function getUint8ArrayMemory0() {
48
410
 
49
411
  function getObject(idx) { return heap[idx]; }
50
412
 
51
- let heap = new Array(128).fill(undefined);
413
+ let heap = new Array(1024).fill(undefined);
52
414
  heap.push(undefined, null, true, false);
53
415
 
54
416
  let heap_next = heap.length;
55
417
 
418
+ function isLikeNone(x) {
419
+ return x === undefined || x === null;
420
+ }
421
+
56
422
  function passStringToWasm0(arg, malloc, realloc) {
57
423
  if (realloc === undefined) {
58
424
  const buf = cachedTextEncoder.encode(arg);
@@ -120,126 +486,32 @@ if (!('encodeInto' in cachedTextEncoder)) {
120
486
  read: arg.length,
121
487
  written: buf.length
122
488
  };
123
- }
489
+ };
124
490
  }
125
491
 
126
492
  let WASM_VECTOR_LEN = 0;
127
493
 
128
- /**
129
- * Cancels an ongoing parse operation.
130
- * @param {number} session
131
- */
132
- export function cancel(session) {
133
- wasm.cancel(session);
134
- }
135
-
136
- /**
137
- * Creates a new parser session and returns its ID.
138
- * @returns {number}
139
- */
140
- export function create_session() {
141
- const ret = wasm.create_session();
142
- return ret >>> 0;
143
- }
144
-
145
- /**
146
- * Frees a parser session.
147
- * @param {number} session
148
- */
149
- export function free_session(session) {
150
- wasm.free_session(session);
151
- }
152
-
153
- /**
154
- * Returns the list of languages this grammar can inject into (e.g., for embedded languages).
155
- * Most grammars return an empty array.
156
- * @returns {string[]}
157
- */
158
- export function injection_languages() {
159
- try {
160
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
161
- wasm.injection_languages(retptr);
162
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
163
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
164
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
165
- wasm.__wbindgen_export(r0, r1 * 4, 4);
166
- return v1;
167
- } finally {
168
- wasm.__wbindgen_add_to_stack_pointer(16);
169
- }
170
- }
171
-
172
- /**
173
- * Returns the language ID for this grammar plugin.
174
- * @returns {string}
175
- */
176
- export function language_id() {
177
- let deferred1_0;
178
- let deferred1_1;
179
- try {
180
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
181
- wasm.language_id(retptr);
182
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
183
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
184
- deferred1_0 = r0;
185
- deferred1_1 = r1;
186
- return getStringFromWasm0(r0, r1);
187
- } finally {
188
- wasm.__wbindgen_add_to_stack_pointer(16);
189
- wasm.__wbindgen_export(deferred1_0, deferred1_1, 1);
190
- }
191
- }
192
-
193
- /**
194
- * Parses the text in a session and returns the result as a JS value.
195
- *
196
- * The result is a JavaScript object representation of ParseResult containing spans and injections.
197
- * @param {number} session
198
- * @returns {any}
199
- */
200
- export function parse(session) {
201
- try {
202
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
203
- wasm.parse(retptr, session);
204
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
205
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
206
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
207
- if (r2) {
208
- throw takeObject(r1);
209
- }
210
- return takeObject(r0);
211
- } finally {
212
- wasm.__wbindgen_add_to_stack_pointer(16);
213
- }
214
- }
215
-
216
- /**
217
- * Sets the text for a parser session.
218
- * @param {number} session
219
- * @param {string} text
220
- */
221
- export function set_text(session, text) {
222
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export2, wasm.__wbindgen_export3);
223
- const len0 = WASM_VECTOR_LEN;
224
- wasm.set_text(session, ptr0, len0);
494
+ let wasmModule, wasm;
495
+ function __wbg_finalize_init(instance, module) {
496
+ wasm = instance.exports;
497
+ wasmModule = module;
498
+ cachedDataViewMemory0 = null;
499
+ cachedUint8ArrayMemory0 = null;
500
+ return wasm;
225
501
  }
226
502
 
227
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
228
-
229
503
  async function __wbg_load(module, imports) {
230
504
  if (typeof Response === 'function' && module instanceof Response) {
231
505
  if (typeof WebAssembly.instantiateStreaming === 'function') {
232
506
  try {
233
507
  return await WebAssembly.instantiateStreaming(module, imports);
234
508
  } catch (e) {
235
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
509
+ const validResponse = module.ok && expectedResponseType(module.type);
236
510
 
237
511
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
238
512
  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);
239
513
 
240
- } else {
241
- throw e;
242
- }
514
+ } else { throw e; }
243
515
  }
244
516
  }
245
517
 
@@ -254,65 +526,20 @@ async function __wbg_load(module, imports) {
254
526
  return instance;
255
527
  }
256
528
  }
257
- }
258
529
 
259
- function __wbg_get_imports() {
260
- const imports = {};
261
- imports.wbg = {};
262
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
263
- throw new Error(getStringFromWasm0(arg0, arg1));
264
- };
265
- imports.wbg.__wbg_new_1ba21ce319a06297 = function() {
266
- const ret = new Object();
267
- return addHeapObject(ret);
268
- };
269
- imports.wbg.__wbg_new_25f239778d6112b9 = function() {
270
- const ret = new Array();
271
- return addHeapObject(ret);
272
- };
273
- imports.wbg.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
274
- getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
275
- };
276
- imports.wbg.__wbg_set_7df433eea03a5c14 = function(arg0, arg1, arg2) {
277
- getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
278
- };
279
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
280
- // Cast intrinsic for `Ref(String) -> Externref`.
281
- const ret = getStringFromWasm0(arg0, arg1);
282
- return addHeapObject(ret);
283
- };
284
- imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
285
- // Cast intrinsic for `F64 -> Externref`.
286
- const ret = arg0;
287
- return addHeapObject(ret);
288
- };
289
- imports.wbg.__wbindgen_object_clone_ref = function(arg0) {
290
- const ret = getObject(arg0);
291
- return addHeapObject(ret);
292
- };
293
- imports.wbg.__wbindgen_object_drop_ref = function(arg0) {
294
- takeObject(arg0);
295
- };
296
-
297
- return imports;
298
- }
299
-
300
- function __wbg_finalize_init(instance, module) {
301
- wasm = instance.exports;
302
- __wbg_init.__wbindgen_wasm_module = module;
303
- cachedDataViewMemory0 = null;
304
- cachedUint8ArrayMemory0 = null;
305
-
306
-
307
-
308
- return wasm;
530
+ function expectedResponseType(type) {
531
+ switch (type) {
532
+ case 'basic': case 'cors': case 'default': return true;
533
+ }
534
+ return false;
535
+ }
309
536
  }
310
537
 
311
538
  function initSync(module) {
312
539
  if (wasm !== undefined) return wasm;
313
540
 
314
541
 
315
- if (typeof module !== 'undefined') {
542
+ if (module !== undefined) {
316
543
  if (Object.getPrototypeOf(module) === Object.prototype) {
317
544
  ({module} = module)
318
545
  } else {
@@ -332,7 +559,7 @@ async function __wbg_init(module_or_path) {
332
559
  if (wasm !== undefined) return wasm;
333
560
 
334
561
 
335
- if (typeof module_or_path !== 'undefined') {
562
+ if (module_or_path !== undefined) {
336
563
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
337
564
  ({module_or_path} = module_or_path)
338
565
  } else {
@@ -340,7 +567,7 @@ async function __wbg_init(module_or_path) {
340
567
  }
341
568
  }
342
569
 
343
- if (typeof module_or_path === 'undefined') {
570
+ if (module_or_path === undefined) {
344
571
  module_or_path = new URL('arborium_kdl_plugin_bg.wasm', import.meta.url);
345
572
  }
346
573
  const imports = __wbg_get_imports();
@@ -354,5 +581,4 @@ async function __wbg_init(module_or_path) {
354
581
  return __wbg_finalize_init(instance, module);
355
582
  }
356
583
 
357
- export { initSync };
358
- export default __wbg_init;
584
+ export { initSync, __wbg_init as default };
package/grammar_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -29,7 +29,7 @@
29
29
  "KDL",
30
30
  "wasm"
31
31
  ],
32
- "license": "MIT OR Apache-2.0",
32
+ "license": "MIT",
33
33
  "main": "./grammar.js",
34
34
  "module": "./grammar.js",
35
35
  "name": "@arborium/kdl",
@@ -42,5 +42,5 @@
42
42
  },
43
43
  "sideEffects": false,
44
44
  "type": "module",
45
- "version": "2.6.1"
45
+ "version": "2.18.0"
46
46
  }