Skip to main content

Crate devpage_core

Crate devpage_core 

Source
Expand description

devpage’s core: what a document is, how its pages render, what is wrong with them, who comments on them and how its designs resolve — with no I/O runtime. The crate depends on no tokio, axum, notify, tonic, reqwest or chromiumoxide, so the compiler refuses a core that reaches for one. What it needs from outside — the network for external links, somewhere to run in the background, where changes go, where comments are kept, where problems are reported — it asks for through a port, and the devpage binary plugs in the adapters.

Modules§

addresses
Content addresses: the one place an address devpage serves for a page to load is made.
answer
What a request is answered with: a page, a redirect, a file’s bytes, a design’s or a slide’s PNG, a widget’s module, or why there is none. Decided here from the documents alone, so every route is tested without a socket; the HTTP server only turns an Answer into a response — its headers, the file’s bytes read, the PNGs it names drawn.
cache
What server mode’s cache keeps, and the port that chooses what it lets go. The cache itself — files on the PVC — is the binary’s; deciding which entries to delete when it is past its limit is a pure function of them.
changes
What open pages hear: a change is typed — refresh the page, or fetch a page’s comments again. Anything may publish through the Publish port: the file watcher, a comment store, the external-link checker. The bus that carries changes to open pages is the devpage binary’s, and a bus serves one set of documents — a local devpage’s served folder, or one published document in server mode — so every page on it hears every change on it.
check
Link checking: every link, image and diagram target a page holds must reach a file in the served folder — and a heading on it, when it names one — every external address must answer, and every diagram must draw.
code
The code reference: a page for every module, type and function of the code a site names, in the style of DocC — made from the code itself, live, and never written to disk.
comments
Comments: threads readers leave on a page, kept by a comment store. Comments is the only way a thread is written — from a page, from the API, or by a publish carrying threads onto a new version — and it holds every rule of a write: the page key, a new thread’s page being a file in the served or version folder, replies and resolves going by thread id, where a carry moves each thread, and the one announcement each write makes on the change bus. A carry is the one write it hands over: the publish commits it together with the version, so both land or neither does. Identity says who writes. The Store port is only where threads are kept, by thread id: the YAML files under .devpage/comments/ (yaml), server mode’s SQLite store, and memory for tests ([memory]). anchor finds a carried thread’s quote in the new version’s text.
designs
The design store: every design asked for kept resolved in memory and resolved again only when a save touched what it read, its problems and its PNG. The canvas page that shows a design is page::canvas; the watch stream that keeps it current is the binary’s, in http::watch_stream.
diagrams
The diagram engine: every Mermaid fence drawn to SVG on the server, by the vendored pele bundle running in QuickJS.
document
A document: what a document file says to show — a site, a doc or slides — or a lone Markdown file, which is a doc of one chapter.
extensions
Extension contracts and captured state; the executable installs the native loader.
external
External links: whether each address a page links to outside devpage answers. devpage check asks each address once (twice if it can’t be reached); the preview asks in the background and shows what it has heard, announcing on the change bus when that changes.
folder
The served folder and what is in it: the boundary every path and URL is judged against, its document files by kind, its .gitignore rules, the entry document devpage was started with, which document owns a page or a widgets folder, and what a change to its files means — for open pages and for the folders to watch. Documents are loaded per call: the folder keeps the document index and the entry, and no other Document.
page
A page, rendered in two phases. The content phase turns one file’s Markdown into Rendered: its HTML and every link it holds, by file and line. The preview and devpage check judge that, and the frame phase puts it inside its document’s frame — a site’s page, a doc, a deck — with the problems found listed above it. ids answers which ids a link into another page can land on, from that page’s content phase, without building its frame. Also the canvas page, a design alone in the window, and the page of a document file that can’t be loaded.
problem
A problem: one broken thing a document holds, where it was found — the value link checking, the navbar, widgets and comments report, and the page lists above itself. A leaf: it depends on nothing else in devpage.
requirements
A site’s requirements, checked against its tests: the requirements system extension. A page of type constraint is a requirement a test can check; a test points at it by its id — the id of the page’s front matter — which the site’s own pattern reads out of its test files. A constraint no test points at is a problem, and so is a test pointing at no constraint. Each suite’s run command prints its results as JUnit XML, which junit reads; the command itself is run by the binary.
search
Full-text search over what the served document publishes: the pages its nav reaches, and the chapters and slides of every document those reach, split at their headings into sections, in a tantivy index held in memory. Built at start beside the served folder’s document index and kept current by the watcher a page at a time, so a search never reads a file; or, over files that never change, built once and frozen, with no writer left.
structure
A site’s structure: the page types its structure folder defines, and what is wrong with a page against them — no type, a type the folder lacks, a parent its type doesn’t allow, a missing section. devpage has no page types of its own: every one is a type file’s.
watch
Local mode’s one ordered response to saved files. The binary’s watcher turns the platform’s file events into bursts of changed paths and hands each burst here; everything that follows from it is decided here, in one order: the folder follows the paths, the design store and the widget modules forget what they read of them, the slide PNGs kept forget each slide whose deck a path is part of, open pages hear what changed — a page’s comments for each thread another hand changed, then at most one refresh — and last the search index reads them again, so indexing text never holds up a refresh. Server mode has none of this: a published version never changes.
widgets
Widgets: React components used as capitalized HTML tags in Markdown.