@0xbigboss/ghostty-web 0.4.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Coder
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,87 @@
1
+ # ghostty-web
2
+
3
+ [![NPM Version](https://img.shields.io/npm/v/ghostty-web)](https://npmjs.com/package/ghostty-web) [![NPM Downloads](https://img.shields.io/npm/dw/ghostty-web)](https://npmjs.com/package/ghostty-web) [![npm bundle size](https://img.shields.io/bundlephobia/minzip/ghostty-web)](https://npmjs.com/package/ghostty-web) [![license](https://img.shields.io/github/license/coder/ghostty-web)](./LICENSE)
4
+
5
+ [Ghostty](https://github.com/ghostty-org/ghostty) for the web with [xterm.js](https://github.com/xtermjs/xterm.js) API compatibility — giving you a proper VT100 implementation in the browser.
6
+
7
+ - Migrate from xterm by changing your import: `@xterm/xterm` → `ghostty-web`
8
+ - WASM-compiled parser from Ghostty—the same code that runs the native app
9
+ - Zero runtime dependencies, ~400KB WASM bundle
10
+
11
+ Originally created for [Mux](https://github.com/coder/mux) (a desktop app for isolated, parallel agentic development), but designed to be used anywhere.
12
+
13
+ ## Try It
14
+
15
+ - [Live Demo](https://ghostty.ondis.co) on an ephemeral VM (thank you to Greg from [disco.cloud](https://disco.cloud) for hosting).
16
+
17
+ - On your computer:
18
+
19
+ ```bash
20
+ npx @ghostty-web/demo@next
21
+ ```
22
+
23
+ This starts a local HTTP server with a real shell on `http://localhost:8080`. Works best on Linux and macOS.
24
+
25
+ ![ghostty](https://github.com/user-attachments/assets/aceee7eb-d57b-4d89-ac3d-ee1885d0187a)
26
+
27
+ ## Comparison with xterm.js
28
+
29
+ xterm.js is everywhere—VS Code, Hyper, countless web terminals. But it has fundamental issues:
30
+
31
+ | Issue | xterm.js | ghostty-web |
32
+ | ---------------------------------------- | ---------------------------------------------------------------- | -------------------------- |
33
+ | **Complex scripts** (Devanagari, Arabic) | Rendering issues | ✓ Proper grapheme handling |
34
+ | **XTPUSHSGR/XTPOPSGR** | [Not supported](https://github.com/xtermjs/xterm.js/issues/2570) | ✓ Full support |
35
+
36
+ xterm.js reimplements terminal emulation in JavaScript. Every escape sequence, every edge case, every Unicode quirk—all hand-coded. Ghostty's emulator is the same battle-tested code that runs the native Ghostty app.
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ npm install ghostty-web
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ghostty-web aims to be API-compatible with the xterm.js API.
47
+
48
+ ```javascript
49
+ import { init, Terminal } from 'ghostty-web';
50
+
51
+ await init();
52
+
53
+ const term = new Terminal({
54
+ fontSize: 14,
55
+ theme: {
56
+ background: '#1a1b26',
57
+ foreground: '#a9b1d6',
58
+ },
59
+ });
60
+
61
+ term.open(document.getElementById('terminal'));
62
+ term.onData((data) => websocket.send(data));
63
+ websocket.onmessage = (e) => term.write(e.data);
64
+ ```
65
+
66
+ For a comprehensive client <-> server example, refer to the [demo](./demo/index.html#L141).
67
+
68
+ ## Development
69
+
70
+ ghostty-web builds from Ghostty's source with a [patch](./patches/ghostty-wasm-api.patch) to expose additional
71
+ functionality.
72
+
73
+ > Requires Zig and Bun.
74
+
75
+ ```bash
76
+ bun run build
77
+ ```
78
+
79
+ Mitchell Hashimoto (author of Ghostty) has [been working](https://mitchellh.com/writing/libghostty-is-coming) on `libghostty` which makes this all possible. The patches are very minimal thanks to the work the Ghostty team has done, and we expect them to get smaller.
80
+
81
+ This library will eventually consume a native Ghostty WASM distribution once available, and will continue to provide an xterm.js compatible API.
82
+
83
+ At Coder we're big fans of Ghostty, so kudos to that team for all the amazing work.
84
+
85
+ ## License
86
+
87
+ [MIT](./LICENSE)
@@ -0,0 +1,4 @@
1
+ const e = {};
2
+ export {
3
+ e as default
4
+ };
Binary file