Dodeca Static Site Generator

repository·main·Indexed 42 days ago

https://github.com/bearcove/dodeca

A fully incremental static site generator (SSG) featuring a processor-based architecture and cell-based pipeline for fast, production-identical development. Includes the ddc CLI for building and serving sites, a Wasm-based devtools runtime for live DOM patching and CSS reload, and a cross-platform process sandboxing layer.

Tokens
142.4K
Snippets
465
Records
688
Agent score
52%

What's inside Dodeca

  1. What is livereload-client?

    main
    The livereload-client is a WASM (WebAssembly) client designed for the dodeca live reload system. It enables hot reloading in the browser by connecting to a dodeca devtools server via WebSockets. Instead of performing a full page reload, it receives DOM patch messages encoded with dodeca-protocol and applies them to the current page using hotmeal-wasm.
  2. What is dodeca-devtools?

    main

    dodeca-devtools is the WebAssembly (Wasm) browser runtime specifically designed for the dodeca DevTools. It provides the underlying logic that enables developer experience features during a ddc serve session.

    Key responsibilities of the runtime include:

    • Live DOM patching: Updating the DOM in real-time.
    • CSS reload: Automatically applying style changes.
    • Route subscriptions: Managing and responding to route changes.
    • Dead-link actions: Handling broken links.
    • Open-in-editor actions: Triggering editor commands from the browser.

    Note that while dodeca-devtools provides the Wasm runtime, the visible user interface is a TypeScript bundle located in crates/dodeca/devtools-ui.

  3. Overview of cinereus tree diffing

    main

    cinereus is a Rust crate that provides a generic tree diffing algorithm based on the GumTree approach. It is designed to find differences between two trees and generate a minimal edit script. The algorithm follows a three-step process:

    1. Top-down matching: Identifies identical subtrees using hashes.
    2. Bottom-up matching: Matches the remaining nodes based on structural similarity.
    3. Chawathe edit script generation: Produces a minimal set of operations including INSERT, DELETE, UPDATE, and MOVE.

    It is currently used by the hotmeal project for performing HTML diffing.

  4. Overview of the hotmeal HTML toolkit

    main

    hotmeal is an HTML toolkit designed for advanced DOM manipulation and synchronization. It is built upon facet, html5ever, and cinereus (which provides the diff-patching capabilities).

    Key capabilities include:

    • Patching HTML documents into a DOM following browser-like behavior.
    • Manipulating the DOM structure.
    • Re-serializing the DOM back into HTML.
    • Generating patches that can be applied in an actual browser, which is useful for implementing live-reloading features.
  5. Overview of marq Markdown processing

    main

    marq is a Markdown processing library built on top of pulldown-cmark. It extends standard Markdown capabilities with the following features:

    • Tracey Rules: Recognizes rules defined by the tracey project.
    • Syntax Highlighting: Powered by arborium.
    • Diagrams: Supports diagram rendering using aasvg-rs and pikru.
    • Wiki-style Links: Supports [[Target]] and [[Target|label]] syntax.

    It is designed to be integrated into larger applications like dodeca and tracey.

  6. Overview of dodeca-sandbox

    main

    dodeca-sandbox is a cross-platform process sandboxing layer designed for the dodeca ecosystem. It is used to run untrusted or isolated processes securely by providing a unified API that maps to platform-specific implementations.

    Key Features

    • Cross-platform API: Provides a consistent interface for sandboxing regardless of the host OS.
    • Linux Support: Utilizes hakoniwa for Linux-specific sandboxing implementations.
    • Security-focused: Maintains a minimal surface area to ensure secure process execution.
  7. Overview of hotmeal

    main

    hotmeal is an HTML toolkit designed for high-performance DOM manipulation. It provides a full suite of tools for parsing, diffing, and serializing HTML using an arena-based DOM approach.

    Key capabilities include:

    • HTML5 Parsing: Uses html5ever for full HTML5 tree construction with error recovery.
    • Arena-based DOM: Utilizes efficient arena allocation for the tree to enable zero-copy parsing.
    • Tree Diffing: Implements the GumTree/Chawathe algorithm (via cinereus) to generate efficient DOM patches.
    • Serialization: Supports HTML output with proper escaping and formatting.
  8. Overview of the gingembre template engine

    main

    gingembre is a Jinja-like template engine designed with rich error diagnostics. It is used by the Dodeca project for all HTML templating. The engine supports several advanced templating features including:

    • Template inheritance: Allowing templates to build upon one another.
    • Macros: Reusable template logic.
    • Filters: Data transformation within templates.
    • Lazy data resolution: Efficiently handling data that is only resolved when needed during rendering.
  9. Overview of Picante async incremental query runtime

    main

    Picante is an asynchronous incremental query runtime for Rust, designed specifically for Tokio-first pipelines. Inspired by Salsa, it enables efficient data processing through dependency tracking and caching.

    Key capabilities include:

    • Inputs: Defining the raw data sources for your queries.
    • Interning: Efficiently managing and reusing data.
    • Async Derived Queries: Computing new data from existing inputs asynchronously.
    • Dependency Tracking: Automatically managing the relationships between queries to ensure correctness.
    • Cache Persistence: Saving query results to disk using facet and facet-postcard.
    • Observability: Built-in tools for debugging and monitoring the query lifecycle.
  10. Use hotmeal-wasm for HTML parsing and DOM diffing

    main

    The hotmeal-wasm package provides WebAssembly-powered bindings for the hotmeal HTML toolkit. It is designed for JavaScript/TypeScript applications that need to perform high-performance browser-side HTML parsing, compute minimal patches between two HTML documents, and apply those patches to update the DOM efficiently. It is framework-agnostic and can be used with vanilla JS or any modern JavaScript framework.

    import init, { parse_html, diff_html, apply_patches } from 'hotmeal-wasm';
    
    await init();
    
    const old_html = '<div><p>Hello</p></div>';
    const new_html = '<div><p>World</p></div>';
    
    const patches = diff_html(old_html, new_html);
    // Apply patches to your DOM...