lumen_runtime/lib.rs
1//! `lumen-runtime` - the "lumen.so core": the ECS run loop, the default
2//! plugin stack, script-command machinery, hot reload, file-based pages, and
3//! the AOT-artifact / from-source app loaders.
4//!
5//! Carved out of `lumenc` so the SDKs (`lumenui`, the C-ABI `lumen`, and
6//! everything downstream) depend on the runtime without pulling the compiler
7//! front-end. The markup / CSS parser stays in `lumenc`; the runtime reaches
8//! it only through the injected [`SourceParser`] hook (see
9//! [`source_parser`]), so `lumen-runtime` links no parser and no `lumenc`.
10//!
11//! The IR data model - [`LayoutIR`](lumen_ir::layout_ir::LayoutIR), the CSS
12//! AST + Cascade-5 application, the shared value parsers, the `var()`
13//! resolver, and the AOT [`artifact`](lumen_ir::artifact) container - lives in
14//! `lumen-ir` and is used here directly.
15
16#![forbid(unsafe_code)]
17#![warn(missing_docs)]
18
19/// SDK app-kind detection + external (Rust/C++/Python) build/run dispatch.
20pub mod app_kind;
21
22/// Runtime modules: the `[dependencies]` schema and, behind the `modules`
23/// feature, the version-locked dylib loader `build_app` runs it through.
24pub use lumen_modules as modules;
25
26/// Where an app keeps its code: `lumen.toml` at the root, everything the
27/// compiler front-end reads under `src/`.
28pub mod app_layout;
29/// Per-app `lumen.toml` configuration model.
30pub mod config;
31/// The app's compiled fragments and what an instance of one carries.
32pub use lumen_scene::fragments;
33/// `[[hooks]]` runner - executes an app's declared `prebuild` / `prerun`
34/// build/setup commands. See [`config::HookCfg`] for the schema.
35pub mod hooks;
36
37// The backends and optional subsystems this composition ships, each through the crate
38// that registers it before `main`; the run loop installs whatever that list
39// holds. Naming a crate here is what puts it on the link line, and nothing
40// else in the runtime refers to any of them, so a link that does not ask for
41// one carries none of it: `lumenc package` relinking the shared engine for an
42// app from the engine kit, and `lumenc package --static` replaying the link
43// kit.
44#[cfg(feature = "async")]
45use lumen_async_tokio_capability as _;
46#[cfg(feature = "devtools")]
47use lumen_devtools_capability as _;
48#[cfg(feature = "http-fetch")]
49use lumen_http_ureq_capability as _;
50use lumen_layout_taffy_capability as _;
51#[cfg(feature = "mcp")]
52use lumen_mcp_capability as _;
53use lumen_os_filedialog_capability as _;
54use lumen_os_hotkey_capability as _;
55use lumen_os_launcher_capability as _;
56use lumen_os_lifecycle_capability as _;
57use lumen_os_notify_capability as _;
58use lumen_os_power_capability as _;
59use lumen_os_tray_capability as _;
60use lumen_render_cpu_capability as _;
61use lumen_render_gpu_capability as _;
62use lumen_window_winit_capability as _;
63/// File-based pages - multi-`.lmn` discovery, `<if>`-reconciler page mount,
64/// and the navigation resolver reachable from every embedding surface.
65pub mod pages;
66/// `--profile chrome|stderr|tracy` profiler install (feature-gated).
67pub mod profile;
68/// The ECS run loop, `RunOptions`/`RunError`, `build_app`, hot reload,
69/// and the script-command machinery.
70pub mod run;
71/// Rendered offscreen headless mode (`lumenc run --headless`).
72pub mod run_headless;
73/// Embedded user-agent skin stylesheets.
74pub mod skins;
75/// The injected compiler-plugin boundary. See
76/// [`compiler_plugins::CompilerPlugins`].
77pub use lumen_scene::compiler_plugins;
78/// The injected markup/CSS parser boundary. See [`SourceParser`].
79pub use lumen_scene::source_parser;
80/// IR -> ECS spawner and the `<for>` / `<if>` reconcilers.
81pub use lumen_scene::spawn;
82/// Windowed geometry persistence (`[window] remember_state`).
83pub mod window_state;
84
85pub use compiler_plugins::CompilerPlugins;
86pub use config::{ConfigError, LumenToml};
87#[cfg(all(feature = "runtime-parse", feature = "modules"))]
88pub use run::module_surface;
89pub use run::{
90 AppHook, CheckReport, PluginInstaller, RunError, RunOptions, WindowSetup, build_headless_app,
91 run_app, run_app_headless,
92};
93#[cfg(feature = "runtime-parse")]
94pub use run::{CompileDeps, ModuleSurface, check_app, compile_app, compile_app_with_skin};
95pub use run_headless::{HeadlessOptions, run_app_headless_rendered};
96pub use source_parser::SourceParser;