@rsvelte/compiler 0.7.16 → 0.8.1

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 CHANGED
@@ -26,6 +26,24 @@ The package is a `wasm-pack` (`--target web`) module — the WebAssembly binary
26
26
  ships with the package, so it runs anywhere WebAssembly does (modern browsers,
27
27
  Node.js, Deno, Bun) with no native binaries and no `optionalDependencies`.
28
28
 
29
+ If you need the raw `.wasm` bytes yourself (for example to drive the synchronous
30
+ `initSync` on Node), import them from the stable **`@rsvelte/compiler/wasm`**
31
+ subpath rather than the internal artifact filename:
32
+
33
+ ```js
34
+ import { createRequire } from 'node:module';
35
+ import { readFileSync } from 'node:fs';
36
+ import { initSync } from '@rsvelte/compiler';
37
+
38
+ const require = createRequire(import.meta.url);
39
+ const bytes = readFileSync(require.resolve('@rsvelte/compiler/wasm'));
40
+ initSync({ module: bytes });
41
+ ```
42
+
43
+ `@rsvelte/compiler/wasm` is the supported path for the wasm binary and stays
44
+ stable across releases; the on-disk filename is an internal build detail and may
45
+ change.
46
+
29
47
  ## Usage
30
48
 
31
49
  ```js
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@rsvelte/compiler",
3
3
  "type": "module",
4
- "description": "Fast native Svelte linter built on the rsvelte compiler (validator wrap + native rule engine)",
5
- "version": "0.7.16",
4
+ "description": "A high-performance Rust implementation of the Svelte compiler",
5
+ "version": "0.8.1",
6
6
  "license": "MIT",
7
7
  "files": [
8
8
  "rsvelte_lint_bg.wasm",
@@ -27,5 +27,14 @@
27
27
  "compiler",
28
28
  "rust",
29
29
  "wasm"
30
- ]
30
+ ],
31
+ "exports": {
32
+ ".": {
33
+ "types": "./rsvelte_lint.d.ts",
34
+ "default": "./rsvelte_lint.js"
35
+ },
36
+ "./wasm": "./rsvelte_lint_bg.wasm",
37
+ "./package.json": "./package.json",
38
+ "./*": "./*"
39
+ }
31
40
  }
package/rsvelte_lint.d.ts CHANGED
@@ -48,6 +48,12 @@ export function init(): void;
48
48
  */
49
49
  export function lint(source: string, filename: string): string;
50
50
 
51
+ /**
52
+ * The full catalog of diagnostic ids [`lint`] can emit (see
53
+ * [`crate::json_api::lint_rules`]).
54
+ */
55
+ export function lint_rules(): string;
56
+
51
57
  /**
52
58
  * The rsvelte-lint crate version (for the playground UI).
53
59
  */
@@ -76,6 +82,7 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
76
82
  export interface InitOutput {
77
83
  readonly memory: WebAssembly.Memory;
78
84
  readonly lint: (a: number, b: number, c: number, d: number) => [number, number];
85
+ readonly lint_rules: () => [number, number];
79
86
  readonly lint_version: () => [number, number];
80
87
  readonly __wbg_compileresultwasm_free: (a: number, b: number) => void;
81
88
  readonly __wbg_parseresultwasm_free: (a: number, b: number) => void;
package/rsvelte_lint.js CHANGED
@@ -191,6 +191,24 @@ export function lint(source, filename) {
191
191
  }
192
192
  }
193
193
 
194
+ /**
195
+ * The full catalog of diagnostic ids [`lint`] can emit (see
196
+ * [`crate::json_api::lint_rules`]).
197
+ * @returns {string}
198
+ */
199
+ export function lint_rules() {
200
+ let deferred1_0;
201
+ let deferred1_1;
202
+ try {
203
+ const ret = wasm.lint_rules();
204
+ deferred1_0 = ret[0];
205
+ deferred1_1 = ret[1];
206
+ return getStringFromWasm0(ret[0], ret[1]);
207
+ } finally {
208
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
209
+ }
210
+ }
211
+
194
212
  /**
195
213
  * The rsvelte-lint crate version (for the playground UI).
196
214
  * @returns {string}
@@ -265,7 +283,7 @@ export function version() {
265
283
  function __wbg_get_imports() {
266
284
  const import0 = {
267
285
  __proto__: null,
268
- __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
286
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
269
287
  throw new Error(getStringFromWasm0(arg0, arg1));
270
288
  },
271
289
  __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) {
Binary file