Replace full AST re-transformation with per-block caching strategy. Previously, each streaming chunk triggered processor.run() on the entire document (12 rehype/remark plugins including KaTeX and highlight.js). Now transforms individual MDAST nodes and caches results by position hash. In append-only streaming mode, stable blocks are reused directly from cache, only the unstable trailing block is re-transformed. - Add SvelteMap FIFO cache (5000 blocks, evicts oldest 1000 on overflow) - Add getMdastNodeHash() for MDAST node fingerprinting by position - Add isAppendMode() to detect streaming append patterns - Add transformMdastNode() for single-node transformation with cache lookup - Remove stringifyProcessedNode() (dead code after refactor) Reduces streaming complexity from O(N × transforms) to O(1) for stable blocks. Targets 200K token contexts without UI degradation on mobile devices. |
||
|---|---|---|
| .. | ||
| lib | ||
| routes | ||
| styles | ||
| app.css | ||
| app.d.ts | ||
| app.html | ||