mirror of
https://github.com/oven-sh/bun
synced 2026-02-18 06:41:50 +00:00
feat(repl): implement native Zig REPL for bun repl
This implements a new REPL in Zig that replaces the previous bunx-based REPL. The new REPL provides: - Interactive line editing with cursor movement and history navigation - Syntax highlighting using QuickAndDirtyJavaScriptSyntaxHighlighter - Multi-line input with bracket matching detection - REPL commands (.help, .exit, .clear, .load, .save, .editor, .timing) - JavaScript evaluation using the global eval() function - Pretty-printed output for evaluated expressions - Support for both TTY (interactive) and non-TTY (piped) input The REPL properly initializes the JSC VirtualMachine with the API lock held, enabling safe JavaScript execution. It uses Bun's transpiler infrastructure and output formatting. TODO: - Implement REPL transforms for variable persistence across lines - Integrate package installation - Add shell mode integration - Implement JSC-based autocomplete Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1260
src/cli/repl_command.zig
Normal file
1260
src/cli/repl_command.zig
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user