@rsvelte/language-server 0.2.0 → 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
@@ -197,6 +232,25 @@ function lint(source, filename) {
197
232
  }
198
233
  exports.lint = lint;
199
234
 
235
+ /**
236
+ * The full catalog of diagnostic ids [`lint`] can emit (see
237
+ * `rsvelte_lint::json_api::lint_rules`).
238
+ * @returns {string}
239
+ */
240
+ function lint_rules() {
241
+ let deferred1_0;
242
+ let deferred1_1;
243
+ try {
244
+ const ret = wasm.lint_rules();
245
+ deferred1_0 = ret[0];
246
+ deferred1_1 = ret[1];
247
+ return getStringFromWasm0(ret[0], ret[1]);
248
+ } finally {
249
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
250
+ }
251
+ }
252
+ exports.lint_rules = lint_rules;
253
+
200
254
  /**
201
255
  * The rsvelte-lint crate version (for the playground UI).
202
256
  * @returns {string}
@@ -275,9 +329,41 @@ exports.version = version;
275
329
  function __wbg_get_imports() {
276
330
  const import0 = {
277
331
  __proto__: null,
278
- __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
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
+ },
357
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
279
358
  throw new Error(getStringFromWasm0(arg0, arg1));
280
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); },
281
367
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
282
368
  let deferred0_0;
283
369
  let deferred0_1;
@@ -289,10 +375,26 @@ function __wbg_get_imports() {
289
375
  wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
290
376
  }
291
377
  },
378
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
379
+ const ret = Reflect.get(arg0, arg1);
380
+ return ret;
381
+ }, arguments); },
292
382
  __wbg_new_227d7c05414eb861: function() {
293
383
  const ret = new Error();
294
384
  return ret;
295
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); },
296
398
  __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
297
399
  const ret = arg1.stack;
298
400
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -300,6 +402,16 @@ function __wbg_get_imports() {
300
402
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
301
403
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
302
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
+ },
303
415
  __wbindgen_init_externref_table: function() {
304
416
  const table = wasm.__wbindgen_externrefs;
305
417
  const offset = table.grow(4);
@@ -316,6 +428,21 @@ function __wbg_get_imports() {
316
428
  };
317
429
  }
318
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
+
319
446
  const CompileResultWasmFinalization = (typeof FinalizationRegistry === 'undefined')
320
447
  ? { register: () => {}, unregister: () => {} }
321
448
  : new FinalizationRegistry(ptr => wasm.__wbg_compileresultwasm_free(ptr, 1));
@@ -323,6 +450,16 @@ const ParseResultWasmFinalization = (typeof FinalizationRegistry === 'undefined'
323
450
  ? { register: () => {}, unregister: () => {} }
324
451
  : new FinalizationRegistry(ptr => wasm.__wbg_parseresultwasm_free(ptr, 1));
325
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
+
326
463
  let cachedDataViewMemory0 = null;
327
464
  function getDataViewMemory0() {
328
465
  if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
@@ -343,6 +480,44 @@ function getUint8ArrayMemory0() {
343
480
  return cachedUint8ArrayMemory0;
344
481
  }
345
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
+
346
521
  function passStringToWasm0(arg, malloc, realloc) {
347
522
  if (realloc === undefined) {
348
523
  const buf = cachedTextEncoder.encode(arg);
@@ -380,6 +555,12 @@ function passStringToWasm0(arg, malloc, realloc) {
380
555
  return ptr;
381
556
  }
382
557
 
558
+ function takeFromExternrefTable0(idx) {
559
+ const value = wasm.__wbindgen_externrefs.get(idx);
560
+ wasm.__externref_table_dealloc(idx);
561
+ return value;
562
+ }
563
+
383
564
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
384
565
  cachedTextDecoder.decode();
385
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.0",
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": {
@@ -30,13 +30,13 @@
30
30
  "dist/vendor/rsvelte_lint_bg.wasm"
31
31
  ],
32
32
  "dependencies": {
33
- "vscode-languageserver": "^9.0.1",
33
+ "vscode-languageserver": "^10.0.0",
34
34
  "vscode-languageserver-textdocument": "^1.0.12"
35
35
  },
36
36
  "devDependencies": {
37
- "@types/node": "^22.10.0",
37
+ "@types/node": "^24.0.0",
38
38
  "esbuild": "^0.28.0",
39
- "typescript": "^5.7.0"
39
+ "typescript": "^7.0.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"