Expand description
Widgets: React components used as capitalized HTML tags in Markdown.
On the server a page’s widget tags become placeholder elements carrying the
widget’s name, its props’ source and its content ([tags]), which comrak
renders as Markdown. In the browser the page script loads React and the
widgets, compiled here from TSX by oxc ([compile]), and mounts each
placeholder. What was read and compiled is kept in a Modules cache.
This module is the widget set a document has: its names, the address
each is served at, what a page loads, and what a request for one of its
modules answers ([request]).
Structs§
- Compiled
- A widget module, compiled, as a request for it is answered.
- Modules
- What was read and compiled, shared by every handle to it.
- Snapshot
- The files a module is made from, each read once: the module and every module its relative imports reach inside the served folder. Its version and its compiled bytes both come from one snapshot, so a save landing between the two can’t serve new bytes under the old version.
- Widgets
- The widgets a document’s pages can use: name → the address its module is served at.
Constants§
- NOTES
- The tag a slide’s speaker notes are written in.
- SIDEBAR
- The widget that is a site’s sidebar: devpage’s own chrome, mounted by the
page script on the sidebar the server rendered, never written in a page.
Its
Devpageprefix keeps it clear of a project’s names: a project may have its ownSidebar. - SYSTEM
- The widgets devpage ships, compiled into the binary.
Functions§
- expand
- Replaces the tags of the widgets named in
knownin Markdown with placeholder elements, leaving code alone, and takes<Notes>out. An unknown capitalized tag, and aTaboutside aTabs, are reported; an unknown tag is replaced by an error in its place rather than passed through as HTML. - is_
widget_ file - Whether
pathis a widget or helper file: a.tsor.tsxdirectly in a widgets folder. - project_
module - The project widget or helper at
pathinfolder’s served folder, compiled, asked for atversion. An import without an extension finds the.tsxor.tsbeside it. It renders by name the widgets of the document whose widgets folder holds it — the entry document’s when no other names it.Errwith why when it, or any helper its imports reach, doesn’t compile — the browser would only say an import failed;Nonewhen no such file is in the served folder. - system
- The source of a system widget, by name.
- system_
address - The address the system widget
nameis served at for the document served undermount, carrying its version. - system_
hash - A system widget’s version: its source, the names it can render and the
build — everything its compiled bytes are made from.
Nonefor a name that isn’t a system widget. - system_
module - The system widget
name—Tabs.tsx— compiled, asked for atversion;Errwith why when it doesn’t compile, andNonefor a name that isn’t a system widget.