farm-plugin-rsx
v0.1.1
Published
FarmFE plugin for Rust-React interop: import .rs files, compile to WASM, use RSX components
Downloads
26
Readme
farm-plugin-rsx
FarmFE plugin for importing .rs modules as browser-side WASM modules.
What It Does
- resolves
.rsimports from app source - builds Rust source to
wasm32-unknown-unknown - runs
wasm-bindgen - caches generated crate inputs, glue, wasm, and source-hash metadata under
.rsx-cache - returns a JS module that inlines the generated wasm
Current Runtime Model
This package now owns the RSX cache bootstrap workflow.
Package-level commands:
pnpm --filter farm-plugin-rsx prebuild:rsx -- --root /abs/path/to/app
pnpm --filter farm-plugin-rsx clean:rsx -- --root /abs/path/to/appApp-level wrappers can call those commands instead of duplicating the bootstrap logic.
Cache Policy
- valid cache: reuse
- missing or stale cache: rebuild
- rebuild unavailable: fail
That is intentional. RSX cache bootstrap is treated as required build state, not best-effort optional behavior.
Generated Output
The cache is stored under .rsx-cache/ in the target app root:
.rsx-cache/wasm: generated wasm-bindgen JS + wasm.rsx-cache/crates: generated temporary Cargo crate/build scaffolding
Both are disposable generated build output.
Requirements
cargowasm-bindgen- access to the
rsx-reactcrate in the workspace Rust tree reactin the consuming app, because generated JS modules import React
Notes
The package runtime plugin and the prebuild CLI share the same cache/bootstrap implementation.
The workspace verifies the publish/install contract through pnpm run test:farm-plugin-rsx:pack, which installs the packed package into a temp consumer project, checks the plugin's config/resolve contract, and runs the empty-project prebuild:rsx / clean:rsx CLI paths.
