Crate split #
Status: step 2, burokku-core and the burokku facade, is built on
refactor/burokku-core, and step 3, Registry::on_shutdown and
burokku-llrt, on refactor/burokku-llrt above it; see Built. The Decided
items were settled on 2026-10-26, except 16, settled on 2026-10-27. The test
API in test-api.md changed first, as the user decided on
2026-10-27, and is merged.
Decided marks what the user settled; Proposed marks my recommendations that still need a decision.
Why #
Everything lives in crates/burokku today: the engine, Burokku's own
features in src/features/, and the application API. Inside one crate the
features can reach any pub(crate) item of the engine, and they do, so
"features use the public API" is a review rule the compiler does not check.
Nor can anyone tell from the crates which one provides a feature.
The goal is a split of responsibility so clear that a user can tell which crate provides each feature.
Decided #
-
One crate per feature, under
crates/features/. -
burokkuis the public API; every other crate is internal and unstable. Applications depend onburokkualone. -
Burokku's own features use the public API as much as possible. Some may not, the window for one.
-
The engine never names a feature.
-
LLRT is not part of the engine.
burokku-llrttakesinstall_llrt_globals,llrt_lifecycle.js, and thellrt_modulesandllrt_utilsgit dependencies, and core drops LLRT. -
A public shutdown hook replaces the host's knowledge of LLRT.
Registry::on_shutdowntakes an async closure over the runtime, and hooks run in reverse registration order, before the runtime is dropped. Every hook runs: one extension's failure does not affect the next. Todayprepare_llrt_shutdown(crates/burokku/src/app.rs) evaluatesglobalThis.__burokkuShutdown()and sleeps 10 ms for LLRT's timer task; that becomes LLRT's own hook:registry.on_shutdown(async |runtime: &Runtime| { runtime.eval::<()>("globalThis.__burokkuShutdown()").await?; // LLRT's timer task releases its callbacks before the context drops. tokio::time::sleep(Duration::from_millis(10)).await; Ok(()) });It is a
Registryclosure rather than anExtensionmethod because an async trait method cannot be called onBox<dyn Extension>. -
llrtis a cargo feature, on by default for now. The React and Solid examples need its timers. It may leave the defaults later; an app without it gets bare QuickJS.burokkuforwardsllrt-default,llrt-console, and the rest toburokku-llrt. -
Text, scroll, and the resize observer get no cargo features. They are too small to split that way, so they are always on.
-
No feature's own types are public.
-
LLRT's tests move with it. The tests that hold a
setIntervalto check cleanup at shutdown move toburokku-llrtorburokku/tests; core keeps a test that a test extension's shutdown hook runs. -
div, flex, and grid are declared in a crate of their own,
burokku-containers.Builtin<S>, the generic definition that declares them today, is a temporary name and is not made public. -
The window's
resizeTo,close, andopenmove intoWindowDefinition::define_class. -
textandinputstay inside core for now, coupled as they are today, and split out asburokku-textonce the API they need is defined. Until then that API is simply the current state. They are the one exception to 4. -
Scroll leaves core.
-
The code becomes easier to test, rather than tests being moved around it.
-
Extension::beforeorders LLRT ahead of the UI tree. LLRT and the DOM both define a globalCustomEvent, and a later plugin's global replaces an earlier one's. Nodes dispatch only the UI tree's, so it must win; LLRT's cannot be reused, since core cannot depend on an optional crate.beforelists the extensions that must register after this one, and LLRT namesUI_TREEthere. Chosen by the user on 2026-10-27.
Proposed #
My recommendations, not decided yet:
- The window stays in core, as the engine's own element rather than a feature (see Window).
- How 2 and 3 of Decided are enforced (see Rules).
- The crate docs of core and of each feature crate say that it is
internal, carries no semver promise, and that apps depend on
burokku. - A feature crate exports only its extension and its
NAME, for the facade to register. - Extension names move to their crates (
burokku_llrt::NAMEand so on). Core keepsUI_TREE, andTEXTwhile text lives in core. - The containers are always on too, like text, scroll, and the resize observer.
- A failing shutdown hook is still reported, as LLRT's cleanup failure is today.
- The style types stay in core and become public in
element:CommonStyle,FlexContainer,GridContainer,FlexStyle,GridStyle,ContainerLayout. The layout stage reads them, and a third-party element may then lay out as flex or grid too. - taffy's geometry is re-exported as
burokku::geometry. The public API already passes taffy's types (Point,Size,AbsoluteAxis), so the features take them from it instead of depending on taffy. Asked "re-export taffy's types, or define our own?", the user answered "yes"; this reads it as re-export.
Layout #
The crates follow the Decided items; the details rest on the Proposed ones.
Cargo.toml members = ["crates/burokku", "crates/core", "crates/native", "crates/runtime",
"crates/test_macro", "crates/features/*", "example/*"]
(listed by name: "crates/*" would match crates/features, which has
no Cargo.toml, and break the workspace)
crates/
├── native/ runtime/ test_macro/ internal, unchanged; test_macro is
│ published as burokku-test-macro, since
│ burokku::test re-exports ui_tree!
│
├── core/ burokku-core internal. The engine; its `pub` IS the public API
│ ├── Cargo.toml features: internal, test-support, bench (no LLRT)
│ ├── src/
│ │ ├── lib.rs #![deny(unreachable_pub)]; pub use runtime;
│ │ │ `pub mod` only for:
│ │ │ ── public: burokku re-exports these modules whole ──
│ │ ├── app.rs CoreBuilder, Backend, NativeBackend, errors;
│ │ │ runs the shutdown hooks
│ │ ├── extension.rs Extension, Registry (+ on_shutdown),
│ │ │ ExtensionError, UI_TREE, TEXT (for now)
│ │ ├── element.rs ElementDefinition, ElementInstance, PaintList,
│ │ │ layers, style traits and style types,
│ │ │ paragraph surface, script helpers
│ │ ├── feature.rs FeatureSlot, TreeFeature, DispatchStep, give/take
│ │ ├── events.rs + events/ pointer, keyboard, mouse, editing
│ │ ├── view.rs TreeView, NodeView, NodeLayout
│ │ ├── geometry.rs taffy's Point, Size, Rect, AbsoluteAxis…
│ │ ├── test.rs cfg(test-support): TestApp, TestBackend
│ │ │ ── for exceptions, never re-exported ──
│ │ ├── internal.rs cfg(feature = "internal"), #[doc(hidden)]; empty
│ │ │ ── private, pub(crate) only ──
│ │ ├── tree.rs + tree/ UITree, Node, absorb, content, slots, styles
│ │ │ ├── window.rs <window>, the only element core declares
│ │ │ ├── testing.rs cfg(test): div/flex/grid for core's unit tests
│ │ │ └── js.rs + js/ DOM API + scripts/
│ │ ├── interaction.rs + interaction/ focus, selection, editing, pointer
│ │ ├── text.rs + text/ the text engine
│ │ ├── layout.rs + layout/ scene.rs + scene/
│ │ ├── request.rs HostRequest; features push through give
│ │ │ context methods
│ │ ├── host.rs + host/ one turn: input → dispatch → stages →
│ │ │ present → drain requests
│ │ │ ── here for now, until burokku-text splits out ──
│ │ └── features.rs + features/
│ │ ├── text.rs + text/ <text>; imports core's public modules only
│ │ └── input.rs <input>
│ └── tests/ integration tests on stand-in extensions
│
├── features/ internal. Each depends on burokku-core without
│ │ `internal` and exports its extension + NAME
│ ├── containers/ burokku-containers <div> <flex> <grid>
│ ├── llrt/ burokku-llrt LLRT globals, lifecycle.js,
│ │ shutdown hook; llrt-* features
│ ├── scroll/ burokku-scroll
│ └── resize_observer/ burokku-resize-observer
│
└── burokku/ burokku the public API: the only crate apps name
├── Cargo.toml containers, scroll, resize-observer always on;
│ default = ["llrt"], the only cargo feature;
│ llrt-* forward to burokku-llrt
├── src/
│ ├── lib.rs pub use burokku_core::{app items, extension,
│ │ element, feature, events, view, geometry,
│ │ runtime}; Plugin, RuntimeBuilder at the root
│ ├── app.rs Burokku::builder() = CoreBuilder + built-ins
│ │ (+ llrt when on)
│ └── test.rs core's TestApp + native's test types
└── tests/main.rs + … cross-feature tests, one binary, burokku:: only
CoreBuilder registers one extension of its own, UI_TREE, which brings
the window and the DOM API, and, while it lives in core, text. Everything
else comes from the facade. Shared dependency versions (taffy, rquickjs,
native) move to [workspace.dependencies].
Rules #
Proposed: how 2 and 3 of Decided are enforced. The crate boundary is what makes "features use the public API" a compile error.
- Only
burokkuis public. Core declares only its public modules aspub modand deniesunreachable_pub, so everypubitem in core is reachable from one of them.burokkure-exports those modules whole, never item lists, so the two cannot drift. - Features use the public API. A feature crate depends on
burokku-corewithoutinternal. CI checks each feature crate on its own withcargo check -p, since a workspace-wide build unifies cargo features and would hide an undeclared use. - An exception is declared in a manifest. A crate that needs internals
writes
burokku-core = { …, features = ["internal"] }, so every exception is one line to grep for.internalstarts empty: no crate needs it today.
Window #
Proposed, except item 2, which is Decided (12).
The window stays in core. The host already reads its own types: window sync
(crates/burokku/src/ui/host/window.rs) reads WindowStyle,
WindowInstance, and the title, width, and height attributes; layout
treats ElementRole::Root specially; the registry refuses Root and
Parents::App to any other type. Moving it out would need a public native
window API for the host to read windows through.
It still registers as an application's element does:
UI_TREEregistersWindowDefinitionthrough the publicRegistry::element.Registry::builtin_elementis deleted.resizeTo,close, andopenmove intoWindowDefinition::define_class. Core's DOM setup stops creating theWindowclass and copying them onto it (crates/burokku/src/ui/js_bindings/facade.rs); the generic class setup creates the class fromclass_name().ElementTag::WINDOWkeeps id 0, and the registry keeps asserting that the window registers first and alone holds the window's place.
Text and input stay in core for now #
That they stay, and split out once their API is defined, is Decided (13). The rest of this section is Proposed.
text and input stay inside core, in core/src/features/, until the
engine offers editing to extensions. Today input's value,
selectionStart, selectionEnd, and setSelectionRange are core's own
code, which reaches selection in Interaction, the native text input
context, and script wrapper bookkeeping, and core's DOM setup attaches them
to the InputElement class by name. Until the split this stays as it is.
While they live in core:
- They import only core's public modules, so the split stays a move,
checked by a CI step that greps
core/src/features/for imports of private modules. CoreBuilderregisters them itself, as it registersUI_TREE.- The leaks they have today wait for the split:
input.rsreachesui::events::editing,traits::StyleProperties, andPropertyError, and core's text-engine tests importfeatures::text::testing::paragraph_input.
burokku-text splits out when:
- the engine offers editing to extensions through the public API, designed
then, so that
burokku-textwrites the four members itself inInputDefinition::define_class; and - core's text and editing tests no longer need
textorinput(see Testing).
Testing #
That the code becomes easier to test is Decided (15). How is Proposed:
- Core tests the engine's mechanisms on stand-ins. Where a test needs
an element or a feature, it uses a minimal stand-in extension instead of
a real feature: a slot that records its hooks instead of scroll, a
minimal editable leaf instead of
input. Core's tests use<text>about 189 times,<input>about 15 times, andoverflow: scrollabout 42 times today. The stand-ins are written on the public API incore/tests/, where the compiler allows nothing else; tests that need internals stay unit tests, andtree/testing.rskeeps div, flex, and grid for them undercfg(test). A stand-in that cannot be written on the public API marks a gap in it. - Each feature crate tests itself on
CoreBuilderand itself alone. - Cross-feature behavior is tested in
burokku/tests, one binary. - None of this works on today's test API, which builds fixtures on
&mut UITreethroughTestApp::with_ui_treeandui_tree!;UITreebecomes private to core.test-api.mdplans the public tier these tests build on: aFixturethat offers only what script can already do,ui_tree!unchanged on it, a test app from chosen extensions, and fixed fonts.
Core cannot take a feature crate as a dev-dependency: the cycle compiles core twice, and the two copies' traits do not match.
What moves #
Proposed: what each move takes, beyond what Decided says.
burokku-llrt.install_llrt_globalsandllrt_lifecycle.jsfromcrates/burokku/src/extension/builtin.rs; the LLRT git dependencies and thellrt-*cargo features; the two shutdown tests that hold asetInterval(shutdown_stops_runtime_and_driverinapp.rs, and the test inui/host/test/tests.rsthat cleans up LLRT before a panicking test body unwinds). Core keeps a test that a stand-in extension's shutdown hook runs.builder_options_present_layers_and_input_reaches_jsin the same file runstext,ResizeObserver, and asetIntervaltogether, so it moves toburokku/tests.burokku-containers. The div, flex, and grid declarations, written on public items (ContentModel's fields are already public).ElementTag::DIV,FLEX,GRID, andBUILTINSgo; every use is in a test.default_definitions()shrinks to the window, and text and input while they live in core. Core's DOM setup stops creatingDiv,Flex, andGrid.burokku-scroll. Scroll's code reaches nothing private outside one test helper,scroll_to, which takes&mut UITreeand is rewritten onTestApp. It does importnative::compositor's layer types and taffy's geometry directly; it takes them fromelementandgeometryinstead (see 7). Core's scene tests that importfeatures::scrollmove with it; core tests whose result depends on scrolling move toburokku/tests; tests that only mentionoverflow: scrollstay in core, where it is a style value that does not scroll. Its helpers on core'sSlotGiveare methods of a private trait first (extension-traits.md), so they move unchanged.burokku-resize-observer. Uses taffy'sSizethroughburokku::geometry.TestApp::with_ui_tree(ui/host/test.rs) leaves the public API: it hands out&mut UITree, which becomes private. It stayspub(crate)for core's unit tests, and the public tier builds fixtures throughFixtureinstead (test-api.md).AGENTS.mdand the reference docs follow the new paths.- Feature crates depend on no internal crate but core. They take
native's layer types fromelement, which re-exports them already, rquickjs fromruntime, which core re-exports asburokkudoes today, and taffy's types fromgeometry. A crate's own private dependencies, such as the resize observer'sslotmap, stay its own.
Rejected #
Rejected by the user on 2026-10-26, with why:
- A public installer for
input's members (adefine_editing_methods(context, prototype)that copies core's methods onto a class). It hands core's implementation of a feature's surface to the feature through the public API: rule 3 holds only on paper, and the members' semantics become a stable promise. Public API is capabilities an extension builds on. - Keeping scroll in core because core's tests use it. Test coupling is what the split removes, by moving tests; it is never a reason to keep a feature in core. Text stays only for a gap in the API.
- A cargo feature per built-in for text, scroll, the resize observer, and the containers. They are too small to split that way.
- Making
Builtin<S>public as aContainerDefinition<S>.Builtin<S>is a temporary name, not a design; it survives only in core'scfg(test)helper. - Public feature types, such as reading a node's scroll state from another extension.
- LLRT inside core. It registers through the public API already; only the host's shutdown call tied it to the engine.
Steps #
Proposed order, after the test API in test-api.md:
- Core's tests on stand-ins, independent of text, input, and scroll where they test the engine's mechanisms.
burokku-coreand theburokkufacade: core's public modules,geometry, the rules and CI checks.Registry::on_shutdownandburokku-llrt.burokku-containers, with the window's methods moving into itsdefine_class.burokku-scroll.burokku-resize-observer.- Later, once the engine offers editing:
burokku-text.
Built #
Proposed: what I chose while building, beyond the items above, for review. Each pull request adds its own rows.
Pull request on refactor/burokku-core (step 2):
| Item | Choice | Why |
|---|---|---|
| the move | crates/burokku moves to crates/core in a commit of its own; the facade comes in the next |
git follows every file's history across the move |
| core's modules | element, feature, events, view, geometry, and extension; test with test-support; bench and internal hidden |
the Layout's list |
NodeId, ScrollExtent |
in view |
a feature reads them from the tree; neither defines an element or a feature |
| script helpers | with_slot, with_tree_feature, with_instance, node_id, node_layout, reveal, and element_promise stay in element |
the Layout puts them there; an element's script class calls them |
events |
one file: the input a slot or tree feature hears, such as PointerInput, KeyInput, and CaptureInput, and native's WheelPhase |
the DOM events in ui/events are the engine's, not an extension's |
| the private tree | ui/ keeps its layout; the Layout's tree/, interaction/, text/, layout/, and host/ wait |
this pull request changes what is public, not where private code lives |
core's test and bench |
stay inline in lib.rs, as on main |
they only re-export |
| the style types | public in element (Proposed 8), flat beside CommonStyle: the containers' styles, their value types such as Dimension, RgbaColor, and the align, flex, and grid types, the Justify* and AlignSelf aliases, StyleProperties, and PropertyError |
with ui private, nothing outside core could name the types CommonStyle's fields and ElementStyle name, so no crate could write a style of its own; on main, burokku::ui was public and named them |
ElementRegistryError, StyleRevisions, Line |
in extension, view, and geometry |
ExtensionError::Elements, NodeRevisions::style, and ItemStyle's grid lines name them |
Node::kind, Element::tag |
pub(crate) |
NodeKind is how the tree stores a node, and ElementTag names div, flex, and grid; nothing outside the engine read them, and Node::element and Node::text remain |
| what stays unnameable | the sealed traits, DispatchInstance and the two Sealeds, and what only they reach: UITree, InstanceCall, the lent types |
an outside crate can neither implement nor call them; -W unnameable_types lists only these |
| bench's re-exports | ElementTag and UITree carry cfg_attr(not(feature = "bench"), allow(unreachable_pub)) |
only the hidden bench module re-exports them, so without bench nothing reaches them |
| doc tests | core's start with a hidden # extern crate burokku_core as burokku; |
they read as an app's code does, burokku::… |
| core's crate doc | says core is internal, carries no semver promise, and that apps depend on burokku (Proposed 3) |
|
| the facade | only lib.rs: pub use burokku_core::{element, events, extension, feature, geometry, runtime, view}, the app types and Plugin and RuntimeBuilder at the root, and test, TestApp, and TestBackend with test-support; no app.rs yet |
Burokku::builder() stays core's until LLRT and the containers move out, in steps 3 and 4 |
| the facade's features | default = ["llrt-default"], test-support, llrt-default, and llrt-console, each forwarding to core, which keeps them |
LLRT leaves core in step 3 |
[workspace.dependencies] |
only what two or more crates share: llrt_modules, llrt_utils, native, rquickjs, runtime, thiserror, and tokio |
taffy is core's alone until scroll moves out, since FeatureSlot::style takes taffy's Style; the examples keep their own burokku path, since each sets its own default features |
| the CI check | a step in the clippy job runs cargo check --locked --manifest-path on core's, burokku's, and each crates/features/* manifest, before the JavaScript build |
Rule 2 says cargo check -p; checking one package either way unifies no other crate's features, and a manifest glob checks each feature crate once it exists, without naming it in CI; no library crate embeds an example's bundle |
burokku-native's dev-dependency |
still burokku, now the facade |
nothing in native uses it, as on main; removing it is not this step's |
Pull request on refactor/burokku-llrt (step 3):
| Item | Choice | Why |
|---|---|---|
Extension::before |
names that must register after this one; a name no extension has is not an error, unlike requires; a name several extensions share places this one before all of them; a cycle through requires or before is the existing RequirementCycle |
an extension that is absent orders nothing; RequirementCycle already says "the order cannot be satisfied" |
Registry::on_shutdown |
takes impl AsyncFnOnce(&Runtime) -> runtime::Result<()> + 'static, erased through a private RunOnShutdown trait |
Decided 6's async closure, stored without a public boxed-future type |
| a failing hook | reported as shutdown hook of extension "<name>" failed: <error>; several failures are joined with ; into the one RuntimeStatus::Failed (Proposed 7) |
names the extension, as LLRT's cleanup failure did; every hook still runs (Decided 6) |
| hooks on a script failure | run too, and their failures are dropped | LLRT's timers must still be released; the script's error is the one reported |
| core's builder | core keeps Burokku::builder() with the extensions it holds; BurokkuBuilder::new, Default, build, run, and Burokku<TestBackend>::run_test become pub(crate) |
the Layout's CoreBuilder would rename a type about 290 call sites name; new and Default equal core's builder(), which lacks LLRT, and an app runs through BurokkuBuilder::run alone |
the facade's Burokku |
a type of its own in app.rs: builder() calls core's and adds burokku_llrt::LlrtExtension with the llrt feature |
the Layout's app.rs |
| the facade's features | default = ["llrt-default"]; llrt gates the dependency, and llrt-default and llrt-console turn it on and forward |
the Layout says default = ["llrt"], which would drop the LLRT modules main has on by default |
burokku-llrt's exports |
NAME and LlrtExtension (Proposed 4, 5); extension::LLRT leaves core |
the facade registers it by type |
burokku-llrt's features |
default = ["llrt-default"] of its own; the facade depends on it with default-features = false |
its own tests run with main's modules; the facade's features decide for apps |
burokku-llrt's tests |
on BurokkuBuilder::core() and LlrtExtension alone: the two shutdown tests, the panicking test body, and that a node dispatches the DOM's CustomEvent beside LLRT's |
Testing 2; the last fails without before |
BurokkuBuilder::core() |
no longer has LLRT's globals, so no timers | Decided 5 |
| cross-feature tests | builder_options_present_layers_and_input_reaches_js and settling_shows_what_an_observer_changed_after_the_layout move to burokku/tests/main.rs; the facade dev-depends on itself with test-support |
the second also needs setTimeout and the resize observer; a self dev-dependency is how an integration test turns on a feature of its own crate |
| core's shutdown tests | a stand-in hook reads the runtime before it stops; hooks run last-registered first and a failure is reported; a panicking test body runs them before unwinding | Testing 1, Decided 10 |
a_script_queued_before_shutdown_never_runs |
counts the scripts run in Rust instead of evaluating after shutdown | it evaluated in the 10 ms LLRT's hook sleeps, so it failed once core lost LLRT |
| workspace members | crates/features/* is listed |
the Layout's list |
[workspace.dependencies] |
unchanged; llrt_modules and llrt_utils are now shared by native and burokku-llrt |