ghostty-web 0.2.1 → 0.3.0-next.0.g4ef099b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -28
- package/dist/ghostty-vt.wasm +0 -0
- package/dist/ghostty-web.js +847 -580
- package/dist/ghostty-web.umd.cjs +13 -4
- package/dist/index.d.ts +120 -24
- package/ghostty-vt.wasm +0 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
# ghostty-web
|
|
2
2
|
|
|
3
|
-

|
|
4
4
|
|
|
5
|
-
`ghostty-web` is a
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
`ghostty-web` is a web terminal developed for [mux](https://github.com/coder/mux) that leverages
|
|
6
|
+
[Ghostty's](https://github.com/ghostty-org/ghostty)
|
|
7
|
+
terminal emulation core via WebAssembly. Because it leans on Ghostty to handle the complexity of terminal
|
|
8
|
+
emulation, `ghostty-web` can deliver fast, robust terminal emulation in the browser. The intent is
|
|
9
|
+
for this project to become a drop-in replacement for xterm.js. Under heavy development, no compatibility guarantees yet.
|
|
9
10
|
|
|
10
11
|
## Live Demo
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
Try ghostty-web yourself with:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @ghostty-web/demo@next
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This starts a local demo server with a real shell session. The demo server works best when run from Linux, but you can also try
|
|
20
|
+
it on macOS. Windows is not supported (yet).
|
|
21
|
+
|
|
22
|
+
<details>
|
|
23
|
+
<summary>Development setup (building from source)</summary>
|
|
13
24
|
|
|
14
|
-
> [!NOTE]
|
|
15
25
|
> Requires Zig and Bun, see [Development](#development)
|
|
16
26
|
|
|
17
27
|
```bash
|
|
@@ -19,16 +29,11 @@ git clone https://github.com/coder/ghostty-web
|
|
|
19
29
|
cd ghostty-web
|
|
20
30
|
bun install
|
|
21
31
|
bun run build # Builds the WASM module and library
|
|
22
|
-
|
|
23
|
-
# Terminal 1: Start PTY Server
|
|
24
|
-
cd demo/server
|
|
25
|
-
bun install
|
|
26
|
-
bun run start
|
|
27
|
-
|
|
28
|
-
# Terminal 2: Start web server
|
|
29
|
-
bun run start # http://localhost:8000/demo/
|
|
32
|
+
bun run demo:dev # http://localhost:8000/demo/
|
|
30
33
|
```
|
|
31
34
|
|
|
35
|
+
</details>
|
|
36
|
+
|
|
32
37
|
## Getting Started
|
|
33
38
|
|
|
34
39
|
Install the module via npm
|
|
@@ -45,9 +50,11 @@ After install, using `ghostty-web` is as simple as
|
|
|
45
50
|
<body>
|
|
46
51
|
<div id="terminal"></div>
|
|
47
52
|
<script type="module">
|
|
48
|
-
import { Terminal } from 'ghostty-web';
|
|
53
|
+
import { init, Terminal } from 'ghostty-web';
|
|
54
|
+
|
|
55
|
+
await init();
|
|
49
56
|
const term = new Terminal();
|
|
50
|
-
|
|
57
|
+
term.open(document.getElementById('terminal'));
|
|
51
58
|
term.write('Hello from \x1B[1;3;31mghostty-web\x1B[0m $ ');
|
|
52
59
|
</script>
|
|
53
60
|
</body>
|
|
@@ -71,7 +78,6 @@ machine, and screen buffer) to WebAssembly, providing:
|
|
|
71
78
|
|
|
72
79
|
- Text selection and clipboard integration
|
|
73
80
|
- Mouse tracking modes
|
|
74
|
-
- Kitty keyboard protocol support
|
|
75
81
|
- Custom key/wheel event handlers
|
|
76
82
|
|
|
77
83
|
**API & Integration:**
|
|
@@ -86,18 +92,15 @@ machine, and screen buffer) to WebAssembly, providing:
|
|
|
86
92
|
- Zero runtime dependencies (just ghostty-web + bundled WASM)
|
|
87
93
|
- Parser/state machine from Ghostty
|
|
88
94
|
|
|
89
|
-
## Why ghostty-web?
|
|
90
|
-
|
|
91
|
-
- **Don't reimplement VT100 parsing** – it's thousands of edge cases refined over years. Instead, leverage Ghostty's battle-tested terminal emulator that's proven by thousands of daily users.
|
|
92
|
-
- **Drop-in xterm.js replacement** – for many use cases, ghostty-web can replace xterm.js with minimal code changes
|
|
93
|
-
- **Modern & maintained** – Built on Ghostty, an actively developed modern terminal emulator, ensuring continued improvements and bug fixes.
|
|
94
|
-
|
|
95
95
|
## Usage Examples
|
|
96
96
|
|
|
97
97
|
### Basic Terminal
|
|
98
98
|
|
|
99
99
|
```typescript
|
|
100
|
-
import { Terminal, FitAddon } from 'ghostty-web';
|
|
100
|
+
import { init, Terminal, FitAddon } from 'ghostty-web';
|
|
101
|
+
|
|
102
|
+
// Initialize WASM (call once at app startup)
|
|
103
|
+
await init();
|
|
101
104
|
|
|
102
105
|
const term = new Terminal({
|
|
103
106
|
cursorBlink: true,
|
|
@@ -111,7 +114,7 @@ const term = new Terminal({
|
|
|
111
114
|
const fitAddon = new FitAddon();
|
|
112
115
|
term.loadAddon(fitAddon);
|
|
113
116
|
|
|
114
|
-
|
|
117
|
+
term.open(document.getElementById('terminal'));
|
|
115
118
|
fitAddon.fit();
|
|
116
119
|
|
|
117
120
|
// Handle user input
|
|
@@ -130,8 +133,8 @@ term.onData((data) => {
|
|
|
130
133
|
|
|
131
134
|
### Building WASM
|
|
132
135
|
|
|
133
|
-
`ghostty-web` builds a custom WASM binary from Ghostty's source with
|
|
134
|
-
|
|
136
|
+
`ghostty-web` builds a custom WASM binary from Ghostty's source with a patch to expose additional
|
|
137
|
+
functionality
|
|
135
138
|
|
|
136
139
|
```bash
|
|
137
140
|
bun run build
|
package/dist/ghostty-vt.wasm
CHANGED
|
Binary file
|