next.js
d630d5be - Implement Phase 4: Syntax highlighting architecture with OXC

Commit
49 days ago
Implement Phase 4: Syntax highlighting architecture with OXC Changes: - Replace SWC with OXC parser for better API accessibility - Implement offset/marker pair approach for style tracking - Extract highlights by visiting OXC AST (strings, numbers, regex, templates) - Split style markers across line boundaries (no spans cross newlines) - Implement apply_line_highlights() for late ANSI code insertion Architecture: - `extract_highlights()` - Parse entire file once with OXC, extract all tokens - `StyleMarker` - Records start/end of styled regions by byte offset - `LineHighlight` - Per-line highlighting info with line-relative offsets - `split_markers_by_line()` - Ensures markers never cross line boundaries - `apply_line_highlights()` - Applies ANSI codes during rendering Benefits: - OXC parser is fast and has accessible public API - Line-oriented rendering never needs to handle newlines in styles - Late insertion prevents column offset issues - Supports multiline tokens (template literals, strings) properly Dependencies added: - oxc_parser, oxc_ast, oxc_span, oxc_allocator (0.42.0) - Removed swc_core dependency Next: Integrate into frame rendering and add ANSI stripping for tests 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
Committer
Parents
Loading