@streamdown/code@2.0.0

asheshgoplani/agent-deck@streamdown/code@2.0.0Sep 30, 2026by github-actions[bot]

Upgrading?

AI Summary

@streamdown/code 2.0.0 is a major release that upgrades Shiki to v4 and requires Node.js 20 or newer. It improves streaming code-block highlighting by tokenizing only new lines and bounding the highlight cache. Cache lookups now compare full code and avoid caching transient streaming results.

Key Highlights

  • Upgrades Shiki to v4 and requires Node.js 20+
  • Tokenizes only new lines while a code block streams
  • Bounds the highlight cache with an LRU limit of 5,000 results and size-based eviction
  • Avoids caching transient streaming results and compares full code on lookup

Breaking Changes

  • Upgrade to Shiki v4
  • Node.js 20 or newer is required when using @streamdown/code

New Features

  • Incremental tokenization of newly streamed lines
  • Bounded LRU cache for finished code-block highlights
  • Full-code cache lookup to avoid incorrect token reuse

Full Release Notes

### Major Changes

- db6fefc: Upgrade Shiki to v4. Node.js 20 or newer is now required when using `@streamdown/code`.

### Patch Changes

- 0ea9e64: Tokenize only the new lines of a code block while it streams instead of re-tokenizing the whole block on every update.
- 4ec5639: Bound the code highlight cache. Results of streaming code blocks are no longer cached (each is superseded by the next update), and finished code blocks are kept in a least-recently-used cache bounded by their size (tokens, lines and characters) and by a limit of 5,000 results. Lookups compare the full code, so blocks that differ only in the middle no longer share tokens. A code block also ignores highlight results for code it has already moved past.

Related Repositories