@streamdown/code@2.0.0

vanna-ai/vanna@streamdown/code@2.0.0Sep 30, 2026by github-actions[bot]

Upgrading?

AI Summary

This release upgrades the syntax highlighting library Shiki to version 4 and introduces performance optimizations for streaming code blocks by tokenizing only new lines and implementing a bounded LRU cache.

Key Highlights

  • Upgrade Shiki to v4
  • Tokenize only new lines while streaming instead of re-tokenizing the whole block
  • Bound the code highlight cache using a Least-Recently-Used (LRU) strategy
  • Blocks differing only in the middle no longer share tokens

New Features

  • Tokenize only the new lines of a code block while it streams
  • Bound the code highlight cache with size limits

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