Hasty Briefsbeta

Ghostty compiled to WASM with xterm.js API compatibility

10 days ago
  • #terminal-emulator
  • #web-development
  • #WASM
  • Ghostty for the web offers xterm.js API compatibility with a proper VT100 implementation in the browser.
  • Migration from xterm.js involves changing the import from '@xterm/xterm' to 'ghostty-web'.
  • Features a WASM-compiled parser from Ghostty, the same code used in the native app.
  • Zero runtime dependencies with a ~400KB WASM bundle.
  • Originally created for Mux, designed for isolated, parallel agentic development.
  • Demo available via 'npx @ghostty-web/demo@next', starting a local HTTP server with a real shell.
  • Works best on Linux and macOS.
  • Addresses xterm.js issues like RTL languages, complex scripts, and XTPUSHSGR/XTPOPSGR support.
  • Ghostty's emulator uses battle-tested code from the native Ghostty app.
  • Install via 'npm install ghostty-web' and aims for API compatibility with xterm.js.
  • Example usage includes initializing a terminal with custom fonts and themes.
  • Built from Ghostty's source with minimal patches, requires Zig and Bun for building.
  • Mitchell Hashimoto's libghostty makes this possible, with plans to consume a native Ghostty WASM distribution.
  • Coder acknowledges the Ghostty team's contributions.