← Back
Bun v1.3.10 launches native REPL, adds ES decorators support, enables self-contained HTML compilation
· releasefeatureplatform · bun.com ↗

New Native REPL

Bun's REPL has been completely rewritten in Zig, replacing the previous third-party npm package implementation. The new REPL starts instantly without downloading any dependencies and includes a full-featured terminal UI with practical developer conveniences.

Key features include:

  • Copy to clipboard — The .copy command copies expressions directly to your clipboard
  • Top-level await — Use async/await natively in the REPL
  • Module loading — Both ESM imports and CommonJS require work seamlessly
  • Syntax highlighting — JavaScript code is colorized as you type
  • Line editing — Emacs keybindings (Ctrl+A/E, Ctrl+K/U, Ctrl+W, Ctrl+L) for efficient navigation
  • Persistent history — Command history saved to ~/.bun_repl_history with Up/Down arrow navigation
  • Tab completion — Auto-complete for object properties and REPL commands
  • Multi-line input — Automatic detection of incomplete expressions with proper continuation

Special variables _ (last result) and _error (last error) are available, and REPL semantics properly handle const/let hoisting, dynamic imports, and object literal detection.

ES Decorators and Browser Compilation

Bun now fully supports TC39 stage-3 standard ES decorators — the modern decorator specification used when experimentalDecorators is disabled in tsconfig.json. This addresses a long-standing feature request dating to 2023. The transpiler now correctly handles decorator metadata via Symbol.metadata, the accessor keyword, and context APIs like ClassMethodDecoratorContext and ClassFieldDecoratorContext.

The --compile --target=browser flag produces self-contained HTML files with all JavaScript, CSS, and assets inlined directly into the output:

  • Supports TypeScript, JSX, React, CSS, ESM, and CJS
  • Useful for distributing .html files that work via file:// URLs without web servers or CORS concerns
  • Converts <script src="..."> to inline <script>, <link rel="stylesheet"> to <style>, and asset references to data: URIs

Usage:

bun build --compile --target=browser ./index.html

All entrypoints must be .html files and cannot use --splitting.