Does ghostty support wasm?
does ghostty support wasm?
I'll search the codebase to see if Ghostty has any WebAssembly (WASM) support.
Yes! Ghostty does support WebAssembly (WASM). Here's what I found:
##WASM Support Summary
-
VT Library as WASM Module: Ghostty can compile its terminal library (
libghostty-vt) to WebAssembly. You can build it with:zig build lib-vt -Dtarget=wasm32-freestanding -
WebAssembly Examples: The codebase includes two interactive WebAssembly examples:
- SGR Parser Example (
example/wasm-sgr/) - Demonstrates parsing terminal SGR (Select Graphic Rendition) sequences - Key Encoder Example (
example/wasm-key-encode/) - Shows encoding key events into terminal escape sequences
- SGR Parser Example (
-
WASM-Specific APIs: Ghostty provides a complete WebAssembly API with memory management functions, including:
ghostty_wasm_alloc_opaque()/ghostty_wasm_free_opaque()ghostty_wasm_alloc_u8_array()/ghostty_wasm_free_u8_array()ghostty_wasm_alloc_sgr_attribute()/ghostty_wasm_free_sgr_attribute()- And several others for various data types
-
Documentation: The WASM API is documented in
include/ghostty/vt/wasm.h, with examples showing how to interact with the WebAssembly module from JavaScript. -
Browser Support: The WASM target is specifically configured for browser environments with canvas-based rendering capabilities.
So Ghostty's terminal library has first-class WASM support primarily for web-based use cases where you need terminal parsing/encoding functionality in the browser.
END OF POST
Claude Haiku 4.5