purwa_inertia/lib.rs
1//! Inertia.js **protocol v1.3** adapter for Purwa (first-party; no third-party Inertia crate).
2//!
3//! # MVP (Sprint 6)
4//!
5//! - [`InertiaRequest`] extractor: reads `X-Inertia`, version, and partial-reload headers.
6//! - [`InertiaRequest::respond`]: returns **JSON** for Inertia visits or an **HTML skeleton** for
7//! the first full-page load (embeds the page object in a `<script type="application/json">`).
8//! - **409 Conflict** on **GET** when `X-Inertia-Version` differs from the server asset version
9//! ([`purwa_core::InertiaSection::asset_version`]), with `X-Inertia-Location` set for a full reload.
10//! - **Partial reloads**: `X-Inertia-Partial-Component` must match the rendered component; then
11//! `X-Inertia-Partial-Except` wins over `X-Inertia-Partial-Data`; `errors` is always included.
12//! - [`SharedProps`] + [`shared::ensure_shared_props`] middleware merge props into every page.
13//!
14//! **Vite + Svelte:** use [`vite_manifest`] for full-page `<script>` / `<link>` tags and
15//! [`InertiaRenderContext::html_body_injection`](crate::InertiaRenderContext::html_body_injection) in [`InertiaRequest::respond`](crate::InertiaRequest::respond).
16//!
17//! **Errors (Sprint 10):** [`InertiaRequest::respond_purwa_error`](crate::InertiaRequest::respond_purwa_error) renders [`purwa_core::PurwaError`] as the shared [`INERTIA_ERROR_COMPONENT`] page (e.g. `Pages/Error.svelte`).
18
19pub mod headers;
20mod request;
21pub mod shared;
22pub mod vite_manifest;
23
24pub use request::{INERTIA_ERROR_COMPONENT, InertiaRenderContext, InertiaRequest};
25pub use shared::{SharedProps, ensure_shared_props, seed_shared_props_from_config};