@rsvelte/compiler 0.3.1 → 0.4.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.
- package/README.md +13 -1
- package/package.json +1 -1
- package/svelte_compiler_rust_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -168,6 +168,18 @@ println!("{}", result.js.code);
|
|
|
168
168
|
|
|
169
169
|
The Rust API is the same surface OXC will eventually wire `oxlint` / `oxfmt` into. Unlike the JS surface, the Rust `CompileOptions` honours **every** field — including `css_hash` and `warning_filter` as real Rust closures.
|
|
170
170
|
|
|
171
|
+
### Call from C / Go / PHP / Ruby / Zig / Java / …
|
|
172
|
+
|
|
173
|
+
A `cdylib` exposing a stable C ABI ships in [`crates/rsvelte_capi`](crates/rsvelte_capi). One shared library + one cbindgen-generated header (`rsvelte.h`) lets any language with a C FFI drive the same compiler — UTF-8 JSON in, UTF-8 JSON out, no per-language schema generation.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
cargo build -p rsvelte_capi --release
|
|
177
|
+
# → target/release/librsvelte_capi.{dylib,so,a}, rsvelte_capi.dll
|
|
178
|
+
# → crates/rsvelte_capi/include/rsvelte.h (regenerated via cbindgen)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Ready-to-run smoke tests are shipped — and run in CI on every PR — for **C, Go, Python, Ruby, Zig, PHP, and Java (JDK 22+ FFM)**. Drift in the generated header or any `CompileOption` deserializer is caught by 35 cargo integration tests + a `RSVELTE_CAPI_CHECK_HEADER=1` build guard. See [`crates/rsvelte_capi/README.md`](crates/rsvelte_capi/README.md) for the full API, JSON envelope shape, memory ownership rules, and the per-language quick-start table.
|
|
182
|
+
|
|
171
183
|
## Compiler option compatibility
|
|
172
184
|
|
|
173
185
|
The JS-facing surfaces (`@rsvelte/compiler` wasm bundle, `@rsvelte/vite-plugin-svelte-native` NAPI bindings) accept the full `svelte/compiler#CompileOptions` shape, but **function-valued** options can't currently cross the language boundary. The Rust core has no way to call back into JavaScript, so callback-shaped fields are accepted (so the TypeScript types stay drop-in compatible with upstream Svelte) and then **silently ignored**.
|
|
@@ -201,7 +213,7 @@ A single-threaded **100× speedup** over the JS compiler is one of this project'
|
|
|
201
213
|
## Compatibility
|
|
202
214
|
|
|
203
215
|
<!-- svelte-target-version -->
|
|
204
|
-
**Targeting Svelte `v5.
|
|
216
|
+
**Targeting Svelte `v5.52.0`** ([`cbf4e246fc0d`](https://github.com/sveltejs/svelte/commit/cbf4e246fc0d)) — automatically maintained by `pnpm run update-docs`.
|
|
205
217
|
<!-- /svelte-target-version -->
|
|
206
218
|
|
|
207
219
|
Current compatibility with the official Svelte compiler test suite:
|
package/package.json
CHANGED
|
Binary file
|