@arborium/arborium 2.13.0 → 2.16.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.
@@ -1,4 +1,277 @@
1
- let wasm;
1
+ /* @ts-self-types="./arborium_host.d.ts" */
2
+
3
+ /**
4
+ * Configuration for highlighting.
5
+ */
6
+ export class HighlightConfig {
7
+ __destroy_into_raw() {
8
+ const ptr = this.__wbg_ptr;
9
+ this.__wbg_ptr = 0;
10
+ HighlightConfigFinalization.unregister(this);
11
+ return ptr;
12
+ }
13
+ free() {
14
+ const ptr = this.__destroy_into_raw();
15
+ wasm.__wbg_highlightconfig_free(ptr, 0);
16
+ }
17
+ constructor() {
18
+ const ret = wasm.highlightconfig_new();
19
+ this.__wbg_ptr = ret >>> 0;
20
+ HighlightConfigFinalization.register(this, this.__wbg_ptr, this);
21
+ return this;
22
+ }
23
+ /**
24
+ * Set HTML format to class names: `<span class="keyword">`, etc.
25
+ */
26
+ setHtmlFormatClassNames() {
27
+ wasm.highlightconfig_setHtmlFormatClassNames(this.__wbg_ptr);
28
+ }
29
+ /**
30
+ * Set HTML format to class names with custom prefix.
31
+ * @param {string} prefix
32
+ */
33
+ setHtmlFormatClassNamesWithPrefix(prefix) {
34
+ const ptr0 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
35
+ const len0 = WASM_VECTOR_LEN;
36
+ wasm.highlightconfig_setHtmlFormatClassNamesWithPrefix(this.__wbg_ptr, ptr0, len0);
37
+ }
38
+ /**
39
+ * Set HTML format to custom elements (default): `<a-k>`, `<a-f>`, etc.
40
+ */
41
+ setHtmlFormatCustomElements() {
42
+ wasm.highlightconfig_setHtmlFormatCustomElements(this.__wbg_ptr);
43
+ }
44
+ /**
45
+ * Set HTML format to custom elements with custom prefix.
46
+ * @param {string} prefix
47
+ */
48
+ setHtmlFormatCustomElementsWithPrefix(prefix) {
49
+ const ptr0 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
50
+ const len0 = WASM_VECTOR_LEN;
51
+ wasm.highlightconfig_setHtmlFormatCustomElementsWithPrefix(this.__wbg_ptr, ptr0, len0);
52
+ }
53
+ /**
54
+ * @param {number} depth
55
+ */
56
+ setMaxInjectionDepth(depth) {
57
+ wasm.highlightconfig_setMaxInjectionDepth(this.__wbg_ptr, depth);
58
+ }
59
+ }
60
+ if (Symbol.dispose) HighlightConfig.prototype[Symbol.dispose] = HighlightConfig.prototype.free;
61
+
62
+ /**
63
+ * Highlight source code, resolving injections recursively.
64
+ *
65
+ * This uses the shared `AsyncHighlighter` from `arborium_highlight`,
66
+ * ensuring the same injection handling logic as Rust native.
67
+ * @param {string} language
68
+ * @param {string} source
69
+ * @returns {Promise<string>}
70
+ */
71
+ export function highlight(language, source) {
72
+ const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
73
+ const len0 = WASM_VECTOR_LEN;
74
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
75
+ const len1 = WASM_VECTOR_LEN;
76
+ const ret = wasm.highlight(ptr0, len0, ptr1, len1);
77
+ return ret;
78
+ }
79
+
80
+ /**
81
+ * Highlight with custom configuration.
82
+ * @param {string} language
83
+ * @param {string} source
84
+ * @param {HighlightConfig} config
85
+ * @returns {Promise<string>}
86
+ */
87
+ export function highlightWithConfig(language, source, config) {
88
+ const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
89
+ const len0 = WASM_VECTOR_LEN;
90
+ const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
91
+ const len1 = WASM_VECTOR_LEN;
92
+ _assertClass(config, HighlightConfig);
93
+ var ptr2 = config.__destroy_into_raw();
94
+ const ret = wasm.highlightWithConfig(ptr0, len0, ptr1, len1, ptr2);
95
+ return ret;
96
+ }
97
+
98
+ /**
99
+ * Check if a language is available for highlighting.
100
+ * @param {string} language
101
+ * @returns {boolean}
102
+ */
103
+ export function isLanguageAvailable(language) {
104
+ const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
105
+ const len0 = WASM_VECTOR_LEN;
106
+ const ret = wasm.isLanguageAvailable(ptr0, len0);
107
+ return ret !== 0;
108
+ }
109
+
110
+ function __wbg_get_imports() {
111
+ const import0 = {
112
+ __proto__: null,
113
+ __wbg___wbindgen_boolean_get_c0f3f60bac5a78d1: function(arg0) {
114
+ const v = arg0;
115
+ const ret = typeof(v) === 'boolean' ? v : undefined;
116
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
117
+ },
118
+ __wbg___wbindgen_is_function_3c846841762788c1: function(arg0) {
119
+ const ret = typeof(arg0) === 'function';
120
+ return ret;
121
+ },
122
+ __wbg___wbindgen_is_null_0b605fc6b167c56f: function(arg0) {
123
+ const ret = arg0 === null;
124
+ return ret;
125
+ },
126
+ __wbg___wbindgen_is_undefined_52709e72fb9f179c: function(arg0) {
127
+ const ret = arg0 === undefined;
128
+ return ret;
129
+ },
130
+ __wbg___wbindgen_number_get_34bb9d9dcfa21373: function(arg0, arg1) {
131
+ const obj = arg1;
132
+ const ret = typeof(obj) === 'number' ? obj : undefined;
133
+ getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
134
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
135
+ },
136
+ __wbg___wbindgen_string_get_395e606bd0ee4427: function(arg0, arg1) {
137
+ const obj = arg1;
138
+ const ret = typeof(obj) === 'string' ? obj : undefined;
139
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
140
+ var len1 = WASM_VECTOR_LEN;
141
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
142
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
143
+ },
144
+ __wbg___wbindgen_throw_6ddd609b62940d55: function(arg0, arg1) {
145
+ throw new Error(getStringFromWasm0(arg0, arg1));
146
+ },
147
+ __wbg__wbg_cb_unref_6b5b6b8576d35cb1: function(arg0) {
148
+ arg0._wbg_cb_unref();
149
+ },
150
+ __wbg_call_2d781c1f4d5c0ef8: function() { return handleError(function (arg0, arg1, arg2) {
151
+ const ret = arg0.call(arg1, arg2);
152
+ return ret;
153
+ }, arguments); },
154
+ __wbg_from_4bdf88943703fd48: function(arg0) {
155
+ const ret = Array.from(arg0);
156
+ return ret;
157
+ },
158
+ __wbg_get_3ef1eba1850ade27: function() { return handleError(function (arg0, arg1) {
159
+ const ret = Reflect.get(arg0, arg1);
160
+ return ret;
161
+ }, arguments); },
162
+ __wbg_get_a8ee5c45dabc1b3b: function(arg0, arg1) {
163
+ const ret = arg0[arg1 >>> 0];
164
+ return ret;
165
+ },
166
+ __wbg_isLanguageAvailable_0c7bc97cdedd9041: function(arg0, arg1) {
167
+ const ret = arboriumHost.isLanguageAvailable(getStringFromWasm0(arg0, arg1));
168
+ return ret;
169
+ },
170
+ __wbg_length_b3416cf66a5452c8: function(arg0) {
171
+ const ret = arg0.length;
172
+ return ret;
173
+ },
174
+ __wbg_loadGrammar_c5e7001e6b435062: function() { return handleError(function (arg0, arg1) {
175
+ const ret = arboriumHost.loadGrammar(getStringFromWasm0(arg0, arg1));
176
+ return ret;
177
+ }, arguments); },
178
+ __wbg_new_typed_aaaeaf29cf802876: function(arg0, arg1) {
179
+ try {
180
+ var state0 = {a: arg0, b: arg1};
181
+ var cb0 = (arg0, arg1) => {
182
+ const a = state0.a;
183
+ state0.a = 0;
184
+ try {
185
+ return wasm_bindgen__convert__closures_____invoke__hd4680ea21377bdcc(a, state0.b, arg0, arg1);
186
+ } finally {
187
+ state0.a = a;
188
+ }
189
+ };
190
+ const ret = new Promise(cb0);
191
+ return ret;
192
+ } finally {
193
+ state0.a = state0.b = 0;
194
+ }
195
+ },
196
+ __wbg_parse_ce02579ee3e01a8d: function(arg0, arg1, arg2) {
197
+ const ret = arboriumHost.parse(arg0 >>> 0, getStringFromWasm0(arg1, arg2));
198
+ return ret;
199
+ },
200
+ __wbg_queueMicrotask_0c399741342fb10f: function(arg0) {
201
+ const ret = arg0.queueMicrotask;
202
+ return ret;
203
+ },
204
+ __wbg_queueMicrotask_a082d78ce798393e: function(arg0) {
205
+ queueMicrotask(arg0);
206
+ },
207
+ __wbg_resolve_ae8d83246e5bcc12: function(arg0) {
208
+ const ret = Promise.resolve(arg0);
209
+ return ret;
210
+ },
211
+ __wbg_static_accessor_GLOBAL_8adb955bd33fac2f: function() {
212
+ const ret = typeof global === 'undefined' ? null : global;
213
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
214
+ },
215
+ __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913: function() {
216
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
217
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
218
+ },
219
+ __wbg_static_accessor_SELF_f207c857566db248: function() {
220
+ const ret = typeof self === 'undefined' ? null : self;
221
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
222
+ },
223
+ __wbg_static_accessor_WINDOW_bb9f1ba69d61b386: function() {
224
+ const ret = typeof window === 'undefined' ? null : window;
225
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
226
+ },
227
+ __wbg_then_098abe61755d12f6: function(arg0, arg1) {
228
+ const ret = arg0.then(arg1);
229
+ return ret;
230
+ },
231
+ __wbg_then_9e335f6dd892bc11: function(arg0, arg1, arg2) {
232
+ const ret = arg0.then(arg1, arg2);
233
+ return ret;
234
+ },
235
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
236
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 17, function: Function { arguments: [Externref], shim_idx: 18, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
237
+ const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__hf4b5e92d38978907, wasm_bindgen__convert__closures_____invoke__haec7b660a6511385);
238
+ return ret;
239
+ },
240
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
241
+ // Cast intrinsic for `Ref(String) -> Externref`.
242
+ const ret = getStringFromWasm0(arg0, arg1);
243
+ return ret;
244
+ },
245
+ __wbindgen_init_externref_table: function() {
246
+ const table = wasm.__wbindgen_externrefs;
247
+ const offset = table.grow(4);
248
+ table.set(0, undefined);
249
+ table.set(offset + 0, undefined);
250
+ table.set(offset + 1, null);
251
+ table.set(offset + 2, true);
252
+ table.set(offset + 3, false);
253
+ },
254
+ };
255
+ return {
256
+ __proto__: null,
257
+ "./arborium_host_bg.js": import0,
258
+ };
259
+ }
260
+
261
+ function wasm_bindgen__convert__closures_____invoke__haec7b660a6511385(arg0, arg1, arg2) {
262
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__haec7b660a6511385(arg0, arg1, arg2);
263
+ if (ret[1]) {
264
+ throw takeFromExternrefTable0(ret[0]);
265
+ }
266
+ }
267
+
268
+ function wasm_bindgen__convert__closures_____invoke__hd4680ea21377bdcc(arg0, arg1, arg2, arg3) {
269
+ wasm.wasm_bindgen__convert__closures_____invoke__hd4680ea21377bdcc(arg0, arg1, arg2, arg3);
270
+ }
271
+
272
+ const HighlightConfigFinalization = (typeof FinalizationRegistry === 'undefined')
273
+ ? { register: () => {}, unregister: () => {} }
274
+ : new FinalizationRegistry(ptr => wasm.__wbg_highlightconfig_free(ptr >>> 0, 1));
2
275
 
3
276
  function addToExternrefTable0(obj) {
4
277
  const idx = wasm.__externref_table_alloc();
@@ -115,6 +388,12 @@ function passStringToWasm0(arg, malloc, realloc) {
115
388
  return ptr;
116
389
  }
117
390
 
391
+ function takeFromExternrefTable0(idx) {
392
+ const value = wasm.__wbindgen_externrefs.get(idx);
393
+ wasm.__externref_table_dealloc(idx);
394
+ return value;
395
+ }
396
+
118
397
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
119
398
  cachedTextDecoder.decode();
120
399
  const MAX_SAFARI_DECODE_BYTES = 2146435072;
@@ -139,146 +418,33 @@ if (!('encodeInto' in cachedTextEncoder)) {
139
418
  read: arg.length,
140
419
  written: buf.length
141
420
  };
142
- }
421
+ };
143
422
  }
144
423
 
145
424
  let WASM_VECTOR_LEN = 0;
146
425
 
147
- function wasm_bindgen__convert__closures_____invoke__hb5e94909dc21d284(arg0, arg1, arg2) {
148
- wasm.wasm_bindgen__convert__closures_____invoke__hb5e94909dc21d284(arg0, arg1, arg2);
149
- }
150
-
151
- function wasm_bindgen__convert__closures_____invoke__h494b7762c3471cd1(arg0, arg1, arg2, arg3) {
152
- wasm.wasm_bindgen__convert__closures_____invoke__h494b7762c3471cd1(arg0, arg1, arg2, arg3);
153
- }
154
-
155
- const HighlightConfigFinalization = (typeof FinalizationRegistry === 'undefined')
156
- ? { register: () => {}, unregister: () => {} }
157
- : new FinalizationRegistry(ptr => wasm.__wbg_highlightconfig_free(ptr >>> 0, 1));
158
-
159
- /**
160
- * Configuration for highlighting.
161
- */
162
- export class HighlightConfig {
163
- __destroy_into_raw() {
164
- const ptr = this.__wbg_ptr;
165
- this.__wbg_ptr = 0;
166
- HighlightConfigFinalization.unregister(this);
167
- return ptr;
168
- }
169
- free() {
170
- const ptr = this.__destroy_into_raw();
171
- wasm.__wbg_highlightconfig_free(ptr, 0);
172
- }
173
- /**
174
- * @param {number} depth
175
- */
176
- setMaxInjectionDepth(depth) {
177
- wasm.highlightconfig_setMaxInjectionDepth(this.__wbg_ptr, depth);
178
- }
179
- /**
180
- * Set HTML format to class names: `<span class="keyword">`, etc.
181
- */
182
- setHtmlFormatClassNames() {
183
- wasm.highlightconfig_setHtmlFormatClassNames(this.__wbg_ptr);
184
- }
185
- /**
186
- * Set HTML format to custom elements (default): `<a-k>`, `<a-f>`, etc.
187
- */
188
- setHtmlFormatCustomElements() {
189
- wasm.highlightconfig_setHtmlFormatCustomElements(this.__wbg_ptr);
190
- }
191
- /**
192
- * Set HTML format to class names with custom prefix.
193
- * @param {string} prefix
194
- */
195
- setHtmlFormatClassNamesWithPrefix(prefix) {
196
- const ptr0 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
197
- const len0 = WASM_VECTOR_LEN;
198
- wasm.highlightconfig_setHtmlFormatClassNamesWithPrefix(this.__wbg_ptr, ptr0, len0);
199
- }
200
- constructor() {
201
- const ret = wasm.highlightconfig_new();
202
- this.__wbg_ptr = ret >>> 0;
203
- HighlightConfigFinalization.register(this, this.__wbg_ptr, this);
204
- return this;
205
- }
206
- /**
207
- * Set HTML format to custom elements with custom prefix.
208
- * @param {string} prefix
209
- */
210
- setHtmlFormatCustomElementsWithPrefix(prefix) {
211
- const ptr0 = passStringToWasm0(prefix, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
212
- const len0 = WASM_VECTOR_LEN;
213
- wasm.highlightconfig_setHtmlFormatCustomElementsWithPrefix(this.__wbg_ptr, ptr0, len0);
214
- }
215
- }
216
- if (Symbol.dispose) HighlightConfig.prototype[Symbol.dispose] = HighlightConfig.prototype.free;
217
-
218
- /**
219
- * Highlight source code, resolving injections recursively.
220
- *
221
- * This uses the shared `AsyncHighlighter` from `arborium_highlight`,
222
- * ensuring the same injection handling logic as Rust native.
223
- * @param {string} language
224
- * @param {string} source
225
- * @returns {Promise<string>}
226
- */
227
- export function highlight(language, source) {
228
- const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
229
- const len0 = WASM_VECTOR_LEN;
230
- const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
231
- const len1 = WASM_VECTOR_LEN;
232
- const ret = wasm.highlight(ptr0, len0, ptr1, len1);
233
- return ret;
234
- }
235
-
236
- /**
237
- * Highlight with custom configuration.
238
- * @param {string} language
239
- * @param {string} source
240
- * @param {HighlightConfig} config
241
- * @returns {Promise<string>}
242
- */
243
- export function highlightWithConfig(language, source, config) {
244
- const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
245
- const len0 = WASM_VECTOR_LEN;
246
- const ptr1 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
247
- const len1 = WASM_VECTOR_LEN;
248
- _assertClass(config, HighlightConfig);
249
- var ptr2 = config.__destroy_into_raw();
250
- const ret = wasm.highlightWithConfig(ptr0, len0, ptr1, len1, ptr2);
251
- return ret;
252
- }
253
-
254
- /**
255
- * Check if a language is available for highlighting.
256
- * @param {string} language
257
- * @returns {boolean}
258
- */
259
- export function isLanguageAvailable(language) {
260
- const ptr0 = passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
261
- const len0 = WASM_VECTOR_LEN;
262
- const ret = wasm.isLanguageAvailable(ptr0, len0);
263
- return ret !== 0;
426
+ let wasmModule, wasm;
427
+ function __wbg_finalize_init(instance, module) {
428
+ wasm = instance.exports;
429
+ wasmModule = module;
430
+ cachedDataViewMemory0 = null;
431
+ cachedUint8ArrayMemory0 = null;
432
+ wasm.__wbindgen_start();
433
+ return wasm;
264
434
  }
265
435
 
266
- const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
267
-
268
436
  async function __wbg_load(module, imports) {
269
437
  if (typeof Response === 'function' && module instanceof Response) {
270
438
  if (typeof WebAssembly.instantiateStreaming === 'function') {
271
439
  try {
272
440
  return await WebAssembly.instantiateStreaming(module, imports);
273
441
  } catch (e) {
274
- const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
442
+ const validResponse = module.ok && expectedResponseType(module.type);
275
443
 
276
444
  if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
277
445
  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);
278
446
 
279
- } else {
280
- throw e;
281
- }
447
+ } else { throw e; }
282
448
  }
283
449
  }
284
450
 
@@ -293,180 +459,20 @@ async function __wbg_load(module, imports) {
293
459
  return instance;
294
460
  }
295
461
  }
296
- }
297
462
 
298
- function __wbg_get_imports() {
299
- const imports = {};
300
- imports.wbg = {};
301
- imports.wbg.__wbg___wbindgen_boolean_get_dea25b33882b895b = function(arg0) {
302
- const v = arg0;
303
- const ret = typeof(v) === 'boolean' ? v : undefined;
304
- return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
305
- };
306
- imports.wbg.__wbg___wbindgen_is_function_8d400b8b1af978cd = function(arg0) {
307
- const ret = typeof(arg0) === 'function';
308
- return ret;
309
- };
310
- imports.wbg.__wbg___wbindgen_is_null_dfda7d66506c95b5 = function(arg0) {
311
- const ret = arg0 === null;
312
- return ret;
313
- };
314
- imports.wbg.__wbg___wbindgen_is_undefined_f6b95eab589e0269 = function(arg0) {
315
- const ret = arg0 === undefined;
316
- return ret;
317
- };
318
- imports.wbg.__wbg___wbindgen_number_get_9619185a74197f95 = function(arg0, arg1) {
319
- const obj = arg1;
320
- const ret = typeof(obj) === 'number' ? obj : undefined;
321
- getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
322
- getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
323
- };
324
- imports.wbg.__wbg___wbindgen_string_get_a2a31e16edf96e42 = function(arg0, arg1) {
325
- const obj = arg1;
326
- const ret = typeof(obj) === 'string' ? obj : undefined;
327
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
328
- var len1 = WASM_VECTOR_LEN;
329
- getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
330
- getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
331
- };
332
- imports.wbg.__wbg___wbindgen_throw_dd24417ed36fc46e = function(arg0, arg1) {
333
- throw new Error(getStringFromWasm0(arg0, arg1));
334
- };
335
- imports.wbg.__wbg__wbg_cb_unref_87dfb5aaa0cbcea7 = function(arg0) {
336
- arg0._wbg_cb_unref();
337
- };
338
- imports.wbg.__wbg_call_3020136f7a2d6e44 = function() { return handleError(function (arg0, arg1, arg2) {
339
- const ret = arg0.call(arg1, arg2);
340
- return ret;
341
- }, arguments) };
342
- imports.wbg.__wbg_call_abb4ff46ce38be40 = function() { return handleError(function (arg0, arg1) {
343
- const ret = arg0.call(arg1);
344
- return ret;
345
- }, arguments) };
346
- imports.wbg.__wbg_from_29a8414a7a7cd19d = function(arg0) {
347
- const ret = Array.from(arg0);
348
- return ret;
349
- };
350
- imports.wbg.__wbg_get_6b7bd52aca3f9671 = function(arg0, arg1) {
351
- const ret = arg0[arg1 >>> 0];
352
- return ret;
353
- };
354
- imports.wbg.__wbg_get_af9dab7e9603ea93 = function() { return handleError(function (arg0, arg1) {
355
- const ret = Reflect.get(arg0, arg1);
356
- return ret;
357
- }, arguments) };
358
- imports.wbg.__wbg_isLanguageAvailable_ea299ec763ed86d5 = function(arg0, arg1) {
359
- const ret = arboriumHost.isLanguageAvailable(getStringFromWasm0(arg0, arg1));
360
- return ret;
361
- };
362
- imports.wbg.__wbg_length_d45040a40c570362 = function(arg0) {
363
- const ret = arg0.length;
364
- return ret;
365
- };
366
- imports.wbg.__wbg_loadGrammar_54fb4c72d153389a = function() { return handleError(function (arg0, arg1) {
367
- const ret = arboriumHost.loadGrammar(getStringFromWasm0(arg0, arg1));
368
- return ret;
369
- }, arguments) };
370
- imports.wbg.__wbg_new_ff12d2b041fb48f1 = function(arg0, arg1) {
371
- try {
372
- var state0 = {a: arg0, b: arg1};
373
- var cb0 = (arg0, arg1) => {
374
- const a = state0.a;
375
- state0.a = 0;
376
- try {
377
- return wasm_bindgen__convert__closures_____invoke__h494b7762c3471cd1(a, state0.b, arg0, arg1);
378
- } finally {
379
- state0.a = a;
380
- }
381
- };
382
- const ret = new Promise(cb0);
383
- return ret;
384
- } finally {
385
- state0.a = state0.b = 0;
463
+ function expectedResponseType(type) {
464
+ switch (type) {
465
+ case 'basic': case 'cors': case 'default': return true;
386
466
  }
387
- };
388
- imports.wbg.__wbg_new_no_args_cb138f77cf6151ee = function(arg0, arg1) {
389
- const ret = new Function(getStringFromWasm0(arg0, arg1));
390
- return ret;
391
- };
392
- imports.wbg.__wbg_parse_67c1dc5cc944dbc9 = function(arg0, arg1, arg2) {
393
- const ret = arboriumHost.parse(arg0 >>> 0, getStringFromWasm0(arg1, arg2));
394
- return ret;
395
- };
396
- imports.wbg.__wbg_queueMicrotask_9b549dfce8865860 = function(arg0) {
397
- const ret = arg0.queueMicrotask;
398
- return ret;
399
- };
400
- imports.wbg.__wbg_queueMicrotask_fca69f5bfad613a5 = function(arg0) {
401
- queueMicrotask(arg0);
402
- };
403
- imports.wbg.__wbg_resolve_fd5bfbaa4ce36e1e = function(arg0) {
404
- const ret = Promise.resolve(arg0);
405
- return ret;
406
- };
407
- imports.wbg.__wbg_static_accessor_GLOBAL_769e6b65d6557335 = function() {
408
- const ret = typeof global === 'undefined' ? null : global;
409
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
410
- };
411
- imports.wbg.__wbg_static_accessor_GLOBAL_THIS_60cf02db4de8e1c1 = function() {
412
- const ret = typeof globalThis === 'undefined' ? null : globalThis;
413
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
414
- };
415
- imports.wbg.__wbg_static_accessor_SELF_08f5a74c69739274 = function() {
416
- const ret = typeof self === 'undefined' ? null : self;
417
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
418
- };
419
- imports.wbg.__wbg_static_accessor_WINDOW_a8924b26aa92d024 = function() {
420
- const ret = typeof window === 'undefined' ? null : window;
421
- return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
422
- };
423
- imports.wbg.__wbg_then_429f7caf1026411d = function(arg0, arg1, arg2) {
424
- const ret = arg0.then(arg1, arg2);
425
- return ret;
426
- };
427
- imports.wbg.__wbg_then_4f95312d68691235 = function(arg0, arg1) {
428
- const ret = arg0.then(arg1);
429
- return ret;
430
- };
431
- imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
432
- // Cast intrinsic for `Ref(String) -> Externref`.
433
- const ret = getStringFromWasm0(arg0, arg1);
434
- return ret;
435
- };
436
- imports.wbg.__wbindgen_cast_3b1a32895b770b74 = function(arg0, arg1) {
437
- // Cast intrinsic for `Closure(Closure { dtor_idx: 10, function: Function { arguments: [Externref], shim_idx: 11, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
438
- const ret = makeMutClosure(arg0, arg1, wasm.wasm_bindgen__closure__destroy__h57df993f72574015, wasm_bindgen__convert__closures_____invoke__hb5e94909dc21d284);
439
- return ret;
440
- };
441
- imports.wbg.__wbindgen_init_externref_table = function() {
442
- const table = wasm.__wbindgen_externrefs;
443
- const offset = table.grow(4);
444
- table.set(0, undefined);
445
- table.set(offset + 0, undefined);
446
- table.set(offset + 1, null);
447
- table.set(offset + 2, true);
448
- table.set(offset + 3, false);
449
- };
450
-
451
- return imports;
452
- }
453
-
454
- function __wbg_finalize_init(instance, module) {
455
- wasm = instance.exports;
456
- __wbg_init.__wbindgen_wasm_module = module;
457
- cachedDataViewMemory0 = null;
458
- cachedUint8ArrayMemory0 = null;
459
-
460
-
461
- wasm.__wbindgen_start();
462
- return wasm;
467
+ return false;
468
+ }
463
469
  }
464
470
 
465
471
  function initSync(module) {
466
472
  if (wasm !== undefined) return wasm;
467
473
 
468
474
 
469
- if (typeof module !== 'undefined') {
475
+ if (module !== undefined) {
470
476
  if (Object.getPrototypeOf(module) === Object.prototype) {
471
477
  ({module} = module)
472
478
  } else {
@@ -486,7 +492,7 @@ async function __wbg_init(module_or_path) {
486
492
  if (wasm !== undefined) return wasm;
487
493
 
488
494
 
489
- if (typeof module_or_path !== 'undefined') {
495
+ if (module_or_path !== undefined) {
490
496
  if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
491
497
  ({module_or_path} = module_or_path)
492
498
  } else {
@@ -494,7 +500,7 @@ async function __wbg_init(module_or_path) {
494
500
  }
495
501
  }
496
502
 
497
- if (typeof module_or_path === 'undefined') {
503
+ if (module_or_path === undefined) {
498
504
  module_or_path = new URL('arborium_host_bg.wasm', import.meta.url);
499
505
  }
500
506
  const imports = __wbg_get_imports();
@@ -508,5 +514,4 @@ async function __wbg_init(module_or_path) {
508
514
  return __wbg_finalize_init(instance, module);
509
515
  }
510
516
 
511
- export { initSync };
512
- export default __wbg_init;
517
+ export { initSync, __wbg_init as default };
Binary file
@@ -1,6 +1,6 @@
1
1
  import { Highlight } from './types.js';
2
2
  /** Version of plugin packages (all @arborium/* packages share this version) */
3
- export declare const pluginVersion = "2.13.0";
3
+ export declare const pluginVersion = "2.16.0";
4
4
  /** All available languages */
5
5
  export declare const availableLanguages: string[];
6
6
  /** All possible highlights and their short tags */