REST (HTTP-transport) renderer for CaravelaSvelte.
Turns a {name, props} pair into either a full-document HTML
response (first hit on a URL) or an Inertia-compatible JSON
navigation response (subsequent Inertia-client fetches).
Shares the SSR pipeline with CaravelaSvelte.Live via
CaravelaSvelte.SSR. Shares no socket/diff machinery: every REST
response carries the full prop payload, because there's no
persistent connection to diff against.
Controllers typically don't call this module directly — they
call CaravelaSvelte.render/4, which picks the renderer, runs
SSR, constructs the page object, and sends the right response
shape per the CaravelaSvelte.Protocol.
Scope
Phase B.2 ships:
- SSR-backed rendering (fires on every non-Inertia first load)
- Full-document + navigation response shapes
- Version-mismatch 409 handling
Deferred (B.3 and later):
useForm/navigateclient helpers- SSE real-time (B.4)
- Partial / lazy / async props (post-1.0)
Summary
Functions
Render a Svelte component as a REST response. Returns a
%Plug.Conn{} ready to send.
Functions
@spec render(Plug.Conn.t(), String.t(), map(), keyword()) :: Plug.Conn.t()
Render a Svelte component as a REST response. Returns a
%Plug.Conn{} ready to send.
Options
:layout— a 2-arity functionfn conn, assigns -> iodata endthat wraps the data-page<div>in an HTML layout. Only used on first-load (non-Inertia) responses. When omitted, renders a minimal built-in shell that loads/assets/app.jsand/assets/app.css.:version— override the server's asset version (defaults toCaravelaSvelte.Protocol.asset_version/0).:ssr— set tofalseto skip SSR (useful in dev or tests).:url— override the URL stamped on the page object (defaults to the conn's request path + query string).