@rsvelte/language-server 0.2.1 → 0.2.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.
@@ -131,6 +131,41 @@ class ParseResultWasm {
131
131
  if (Symbol.dispose) ParseResultWasm.prototype[Symbol.dispose] = ParseResultWasm.prototype.free;
132
132
  exports.ParseResultWasm = ParseResultWasm;
133
133
 
134
+ /**
135
+ * Compile a Svelte component with the full compile-options object.
136
+ *
137
+ * Supports the function-form compile options (issue #1680): the `parametric`
138
+ * function forms of `customElement`/`css`/`runes`, a `warningFilter` callback,
139
+ * a constant `cssHashOverride`, and a dynamic `cssHash` callback. Returns the
140
+ * compile result as a JSON string (`{ js, css, warnings, metadata }`);
141
+ * callbacks are input-only. Throws on a parse failure, an invalid option, or a
142
+ * `cssHash` callback that throws.
143
+ * @param {string} source
144
+ * @param {any} options
145
+ * @returns {string}
146
+ */
147
+ function compile(source, options) {
148
+ let deferred3_0;
149
+ let deferred3_1;
150
+ try {
151
+ const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
152
+ const len0 = WASM_VECTOR_LEN;
153
+ const ret = wasm.compile(ptr0, len0, options);
154
+ var ptr2 = ret[0];
155
+ var len2 = ret[1];
156
+ if (ret[3]) {
157
+ ptr2 = 0; len2 = 0;
158
+ throw takeFromExternrefTable0(ret[2]);
159
+ }
160
+ deferred3_0 = ptr2;
161
+ deferred3_1 = len2;
162
+ return getStringFromWasm0(ptr2, len2);
163
+ } finally {
164
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
165
+ }
166
+ }
167
+ exports.compile = compile;
168
+
134
169
  /**
135
170
  * Compile a Svelte component to client-side JavaScript.
136
171
  * @param {string} source
@@ -199,7 +234,7 @@ exports.lint = lint;
199
234
 
200
235
  /**
201
236
  * The full catalog of diagnostic ids [`lint`] can emit (see
202
- * [`crate::json_api::lint_rules`]).
237
+ * `rsvelte_lint::json_api::lint_rules`).
203
238
  * @returns {string}
204
239
  */
205
240
  function lint_rules() {
@@ -294,9 +329,41 @@ exports.version = version;
294
329
  function __wbg_get_imports() {
295
330
  const import0 = {
296
331
  __proto__: null,
332
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
333
+ const v = arg0;
334
+ const ret = typeof(v) === 'boolean' ? v : undefined;
335
+ return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
336
+ },
337
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
338
+ const ret = typeof(arg0) === 'function';
339
+ return ret;
340
+ },
341
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
342
+ const ret = arg0 === null;
343
+ return ret;
344
+ },
345
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
346
+ const ret = arg0 === undefined;
347
+ return ret;
348
+ },
349
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
350
+ const obj = arg1;
351
+ const ret = typeof(obj) === 'string' ? obj : undefined;
352
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
353
+ var len1 = WASM_VECTOR_LEN;
354
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
355
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
356
+ },
297
357
  __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
298
358
  throw new Error(getStringFromWasm0(arg0, arg1));
299
359
  },
360
+ __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
361
+ arg0._wbg_cb_unref();
362
+ },
363
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
364
+ const ret = arg0.call(arg1, arg2);
365
+ return ret;
366
+ }, arguments); },
300
367
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
301
368
  let deferred0_0;
302
369
  let deferred0_1;
@@ -308,10 +375,26 @@ function __wbg_get_imports() {
308
375
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
309
376
  }
310
377
  },
378
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
379
+ const ret = Reflect.get(arg0, arg1);
380
+ return ret;
381
+ }, arguments); },
311
382
  __wbg_new_227d7c05414eb861: function() {
312
383
  const ret = new Error();
313
384
  return ret;
314
385
  },
386
+ __wbg_new_da52cf8fe3429cb2: function() {
387
+ const ret = new Object();
388
+ return ret;
389
+ },
390
+ __wbg_parse_1c0d8a8656d7e016: function() { return handleError(function (arg0, arg1) {
391
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
392
+ return ret;
393
+ }, arguments); },
394
+ __wbg_set_8535240470bf2500: function() { return handleError(function (arg0, arg1, arg2) {
395
+ const ret = Reflect.set(arg0, arg1, arg2);
396
+ return ret;
397
+ }, arguments); },
315
398
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
316
399
  const ret = arg1.stack;
317
400
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -319,6 +402,16 @@ function __wbg_get_imports() {
319
402
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
320
403
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
321
404
  },
405
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
406
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [String], shim_idx: 164, ret: String, inner_ret: Some(String) }, mutable: false }) -> Externref`.
407
+ const ret = makeClosure(arg0, arg1, wasm_bindgen_b67232e9c19c9ca6___convert__closures_____invoke___alloc_a941a2cfab7efbc4___string__String__alloc_a941a2cfab7efbc4___string__String__true_);
408
+ return ret;
409
+ },
410
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
411
+ // Cast intrinsic for `Ref(String) -> Externref`.
412
+ const ret = getStringFromWasm0(arg0, arg1);
413
+ return ret;
414
+ },
322
415
  __wbindgen_init_externref_table: function() {
323
416
  const table = wasm.__wbindgen_externrefs;
324
417
  const offset = table.grow(4);
@@ -335,6 +428,21 @@ function __wbg_get_imports() {
335
428
  };
336
429
  }
337
430
 
431
+ function wasm_bindgen_b67232e9c19c9ca6___convert__closures_____invoke___alloc_a941a2cfab7efbc4___string__String__alloc_a941a2cfab7efbc4___string__String__true_(arg0, arg1, arg2) {
432
+ let deferred2_0;
433
+ let deferred2_1;
434
+ try {
435
+ const ptr0 = passStringToWasm0(arg2, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
436
+ const len0 = WASM_VECTOR_LEN;
437
+ const ret = wasm.wasm_bindgen_b67232e9c19c9ca6___convert__closures_____invoke___alloc_a941a2cfab7efbc4___string__String__alloc_a941a2cfab7efbc4___string__String__true_(arg0, arg1, ptr0, len0);
438
+ deferred2_0 = ret[0];
439
+ deferred2_1 = ret[1];
440
+ return getStringFromWasm0(ret[0], ret[1]);
441
+ } finally {
442
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
443
+ }
444
+ }
445
+
338
446
  const CompileResultWasmFinalization = (typeof FinalizationRegistry === 'undefined')
339
447
  ? { register: () => {}, unregister: () => {} }
340
448
  : new FinalizationRegistry(ptr => wasm.__wbg_compileresultwasm_free(ptr, 1));
@@ -342,6 +450,16 @@ const ParseResultWasmFinalization = (typeof FinalizationRegistry === 'undefined'
342
450
  ? { register: () => {}, unregister: () => {} }
343
451
  : new FinalizationRegistry(ptr => wasm.__wbg_parseresultwasm_free(ptr, 1));
344
452
 
453
+ function addToExternrefTable0(obj) {
454
+ const idx = wasm.__externref_table_alloc();
455
+ wasm.__wbindgen_externrefs.set(idx, obj);
456
+ return idx;
457
+ }
458
+
459
+ const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
460
+ ? { register: () => {}, unregister: () => {} }
461
+ : new FinalizationRegistry(state => wasm.__wbindgen_destroy_closure(state.a, state.b));
462
+
345
463
  let cachedDataViewMemory0 = null;
346
464
  function getDataViewMemory0() {
347
465
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -362,6 +480,44 @@ function getUint8ArrayMemory0() {
362
480
  return cachedUint8ArrayMemory0;
363
481
  }
364
482
 
483
+ function handleError(f, args) {
484
+ try {
485
+ return f.apply(this, args);
486
+ } catch (e) {
487
+ const idx = addToExternrefTable0(e);
488
+ wasm.__wbindgen_exn_store(idx);
489
+ }
490
+ }
491
+
492
+ function isLikeNone(x) {
493
+ return x === undefined || x === null;
494
+ }
495
+
496
+ function makeClosure(arg0, arg1, f) {
497
+ const state = { a: arg0, b: arg1, cnt: 1 };
498
+ const real = (...args) => {
499
+
500
+ // First up with a closure we increment the internal reference
501
+ // count. This ensures that the Rust closure environment won't
502
+ // be deallocated while we're invoking it.
503
+ state.cnt++;
504
+ try {
505
+ return f(state.a, state.b, ...args);
506
+ } finally {
507
+ real._wbg_cb_unref();
508
+ }
509
+ };
510
+ real._wbg_cb_unref = () => {
511
+ if (--state.cnt === 0) {
512
+ wasm.__wbindgen_destroy_closure(state.a, state.b);
513
+ state.a = 0;
514
+ CLOSURE_DTORS.unregister(state);
515
+ }
516
+ };
517
+ CLOSURE_DTORS.register(real, state, state);
518
+ return real;
519
+ }
520
+
365
521
  function passStringToWasm0(arg, malloc, realloc) {
366
522
  if (realloc === undefined) {
367
523
  const buf = cachedTextEncoder.encode(arg);
@@ -399,6 +555,12 @@ function passStringToWasm0(arg, malloc, realloc) {
399
555
  return ptr;
400
556
  }
401
557
 
558
+ function takeFromExternrefTable0(idx) {
559
+ const value = wasm.__wbindgen_externrefs.get(idx);
560
+ wasm.__externref_table_dealloc(idx);
561
+ return value;
562
+ }
563
+
402
564
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
403
565
  cachedTextDecoder.decode();
404
566
  function decodeText(ptr, len) {
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsvelte/language-server",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Language Server for rsvelte — formatting (native rsvelte-fmt) and linting (bundled rsvelte_lint wasm)",
5
5
  "license": "MIT",
6
6
  "repository": {