1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Typed server rendering and explicit browser shells for Forma.
//!
//! Load the build's validated manifest and modules, bind every SSR route to its
//! derived handler, then call [`Pages::finalize`] before opening the listener.
//! [`PageHandle::render`] returns a [`PageResponse`] or a coded [`RenderError`];
//! it never substitutes a browser shell for a failure.
//!
//! ```no_run
//! use forma_ir::PageProps;
//! use forma_server::{assets, load_ir_modules, PageHandle, RenderCtx};
//! #[derive(PageProps)]
//! struct HomeProps { title: String }
//! fn start<A: rust_embed::Embed + 'static>() -> Result<PageHandle<HomeProps>, String> {
//! let manifest = assets::load_manifest::<A>()?;
//! let pages = load_ir_modules::<A>(&manifest).map_err(|e| format!("{e:?}"))?;
//! let home = pages.bind("home").map_err(|e| format!("{e:?}"))?;
//! pages.finalize().map_err(|e| format!("{e:?}"))?;
//! Ok(home) // the application may now open its listener
//! }
//! fn home(page: &PageHandle<HomeProps>) -> Result<forma_server::PageResponse, forma_server::RenderError> {
//! page.render(&HomeProps { title:"Hello".into() }, &RenderCtx::new())
//! }
//! ```
//!
//! The response keeps HTML, its fresh nonce, enforced CSP and no-store headers
//! together. Per-request [`RenderCtx`] carries typed policy/head/preload settings,
//! escaped JSON, branding CSS and an explicit [`RawHtml`] prefix, never a nonce
//! or executable handler script. [`render_browser_shell`] accepts only a route
//! explicitly declared Browser. Unreviewed content belongs in [`frame`].
//!
//! In debug builds a corrupt edit keeps the previous module/asset snapshot;
//! changed schemas are rebound, while changed route names or modes require a
//! restart and fresh finalization. Release builds use their embedded snapshot.
//! The old raw SSR entry, tuple loader, PageOutput and caller nonce API are gone.
// Makes README.md's and SECURITY.md's "Zero `unsafe` blocks" a property the
// compiler enforces rather than a claim.
// No `unwrap`, `expect` or `panic!` in the code that ships (DR-12, SR44): a
// render returns its failure. Tests may. Public asset/manifest loading and
// nonce generation also return their errors, including the compatibility aliases.
/// Serving content-hashed files out of the embedded `dist` directory.
/// Content-Security-Policy construction and nonce generation.
/// Compile controls pinning removed response/raw-script bridges.
// Documented by its own `//!` docs (the preview frame, DR-14 tier (c)).
/// Typed homes for the page's head: manifest preloads and head links.
/// Loading and version-checking the per-route `.ir` modules at startup.
/// Bound page contracts and checked handler rendering.
/// Raw HTML: the one named type for markup written unescaped.
/// Request context, errors and the explicit browser shell.
/// The page response: HTML that never leaves without its policy.
// Documented by its own `//!` docs: an outer `///` line here would merge with
// them and resolve their intra-doc links from the crate root.
/// The HTML page template and the SSR render entry points.
/// Document metadata, manifest and declared route modes.
/// Re-exported because it appears in [`assets::asset_bytes`]'s signature.
pub use Bytes;
pub use ;
pub use ;
/// Parser errors and their authoritative `code()` method.
pub use IrError;
/// Derive and trait for declared handler props.
pub use PageProps;
/// Re-exported: [`RenderCtx::with_limits`] takes it.
pub use WalkLimits;
/// Limits inherited by a bound page, with optional per-request overrides.
pub use WalkLimits as Limits;
pub use ;
pub use ;
pub use ;
pub use ;
pub use RawHtml;
pub use ;
pub use CompressedPageResponse;
pub use ;
pub use *;