Expand description
§wabot-ui-bundler
Build-time bundler for Preact (or any JSX) islands, for apps
that want real components in the browser while Rust keeps rendering
every page. Port of the discovery + entry-generation half of
wabot-ts’s UiBundler, delegating the actual bundling to esbuild.
This is a build dependency, not a runtime one — nothing here ends up in your binary.
ⓘ
// build.rs
fn main() {
wabot_ui_bundler::IslandBundler::new("islands", "static/islands")
.public_base("/static/islands")
.run_or_warn();
}ⓘ
// src/main.rs — ids and module URLs, checked by the compiler
include!(concat!(env!("OUT_DIR"), "/islands.rs"));
island_module(islands::CLICKS_ID, islands::CLICKS_MODULE, &props, html! { … })§What it does
- Finds
*.island.tsx/*.island.jsxunder the source directory. - Derives a stable id from the filename:
NotesForm.island.tsx→notes-form. That id is what the Rust view passes toisland()and what the generated entry registers, so the two always agree. - Writes one entry per island that hydrates the default export into
its
<wabot-island>host and returns a teardown. - Runs esbuild over all entries with code splitting, so Preact itself lands in one shared chunk instead of being copied into every island.
- Emits
islands.rswith an id + module-URL constant per island, so renaming a.tsxfile breaks the Rust build instead of silently producing a dead island.
§Degrading without Node
IslandBundler::run_or_warn turns a missing toolchain into a
cargo:warning rather than a failed build, so a checkout without
Node still compiles — you just need the previously-built bundles
present (committing them is reasonable for an example or a
deploy artifact).
Re-exports§
pub use css::CssModule;pub use css::CssModuleBundler;
Modules§
- css
- CSS modules: scoped class names, with the same names on both sides of the language boundary.
Structs§
- Asset
Embedder - Walks a directory at build time and generates a Rust manifest that
include_bytes!s every file, so the binary carries its own assets. - Bundle
Report - What a successful run produced.
- Island
- One discovered island source file.
- Island
Bundler - View
Bundler - Bundles
*.view.tsxinto one JavaScript file that QuickJS evaluates at startup, exposing__wabot_render(view, propsJson).
Enums§
Functions§
- island_
stem Counter.island.tsx→Some("Counter"); anything else →None.- kebab_
case NotesForm→notes-form,HTTPStatus→http-status.- screaming_
case NotesForm→NOTES_FORM.- view_
stem Dashboard.view.tsx→Some("Dashboard"). Server-rendered views, as opposed to client islands.