Replace textual-serve with direct xterm.js 6.0 bundle

- Add package.json with @xterm/xterm 6.0 and all addons
- Create terminal.ts client with WebSocket protocol support
- Bundle with Bun (bun run build -> terminal.js)
- Remove textual-serve dependency from pyproject.toml
- Remove canvas monkey-patch workaround (no longer needed)
- Add scrollback support (configurable via data-scrollback)
- Update static file routing to serve from /static/
- Add Makefile targets: bundle, bundle-watch, bundle-clean
- Update tests for new static path structure

Benefits:
- Full control over xterm.js configuration
- Scrollback history now works (default 1000 lines)
- Custom font family without workarounds
- Smaller footprint (no unused Roboto Mono fonts)
- Latest xterm.js 6.0 features available
This commit is contained in:
GitHub Copilot
2026-01-25 12:45:50 +00:00
parent 8b0e7f5bbe
commit 6f624b8565
12 changed files with 1049 additions and 112 deletions
+7 -7
View File
@@ -3,22 +3,22 @@
from __future__ import annotations
from textual_webterm.config import App, Config
from textual_webterm.local_server import STATIC_PATH, LocalServer
from textual_webterm.local_server import WEBTERM_STATIC_PATH, LocalServer
class TestLocalServer:
"""Tests for LocalServer."""
def test_static_path_exists(self) -> None:
"""Test that static path is set from textual-serve."""
assert STATIC_PATH is not None
assert STATIC_PATH.exists()
"""Test that static path exists."""
assert WEBTERM_STATIC_PATH is not None
assert WEBTERM_STATIC_PATH.exists()
def test_static_path_has_required_files(self) -> None:
"""Test that static path contains required assets."""
assert STATIC_PATH is not None
assert (STATIC_PATH / "js" / "textual.js").exists()
assert (STATIC_PATH / "css" / "xterm.css").exists()
assert WEBTERM_STATIC_PATH is not None
assert (WEBTERM_STATIC_PATH / "js" / "terminal.js").exists()
assert (WEBTERM_STATIC_PATH / "css" / "xterm.css").exists()
def test_create_server(self, tmp_path) -> None:
"""Test creating a LocalServer instance."""