How 0trebor0/buildhtml works
@trebor/buildhtml is a Node.js library that turns server-authored pages into complete HTML, with browser JavaScript generated only when reactive features are used. The principal workflow is application code → page/document and element construction → rendering and optional client-code compilation → HTML response. Additional capabilities include reusable components, JSON construction, templates, SPA routing, CSS compilation, streaming, middleware caching, and metrics. Source excerpts support the core construction and rendering relationships; several secondary capabilities are documented or indexed but not fully sampled.
Main entry points: document.js Page document · index.js Public API · renderer.js HTML and client renderer · element.js Element tree
Components 18
Page authoring
- Public API
lib/index.js - Page document
lib/document.js - Element tree
lib/element.js - Components
lib/components.js - JSON builder
lib/builder.js - Templates
lib/template.js
Rendering and reactivity
- SPA features
lib/live.js - HTML and client renderer
lib/renderer.js - CSS compiler
lib/css.js - Document head
lib/head.js
Delivery and operations
- HTTP middleware
lib/middleware.js - Render cache
lib/cache.js - Metrics
lib/metrics.js - Object pools
lib/pools.js
Shared foundations
- Configuration
lib/config.js - Safety utilities
lib/utils.js
Other components
- Node application
- HTML response
Connections 27
- Node application → Public API: uses
README.md - Public API → Page document: creates pages
lib/index.js - Public API → JSON builder: builds JSON
lib/index.js - Public API → Templates: exposes templates
lib/index.js - Public API → HTTP middleware: exposes middleware
lib/index.js - Public API → SPA features: exposes SPA tools
lib/index.js - Page document → Element tree: creates elements
lib/document.js - Page document → Components: applies components
lib/document.js - Element tree → Components: applies components
lib/element.js - JSON builder → Components: applies components
lib/builder.js - JSON builder → SPA features: compiles lists
lib/builder.js - Page document → Document head: builds head
lib/document.js - Page document → HTML and client renderer: renders page
lib/document.js - HTML and client renderer → CSS compiler: embeds client CSS
lib/renderer.js - Element tree → CSS compiler: compiles styles
lib/element.js - Element tree → Safety utilities: sanitizes values
lib/element.js - HTML and client renderer → Safety utilities: escapes output
lib/renderer.js - Page document → Render cache: reads cache
lib/document.js - HTTP middleware → Page document: renders documents
lib/middleware.js - HTTP middleware → Metrics: records metrics
lib/middleware.js - Page document → Object pools: recycles objects
lib/document.js - Object pools → Metrics: counts reuse
lib/pools.js - Render cache → Metrics: records cache stats
lib/cache.js - Page document → Configuration: reads settings
lib/document.js - HTML and client renderer → Configuration: reads settings
lib/renderer.js - CSS compiler → Configuration: reads settings
lib/css.js - HTML and client renderer → HTML response: produces HTML
README.md