Skip to content

Commit eed8db3

Browse files
committed
feat(node): add Bun support in runtime, CI, and docs
1 parent abef06d commit eed8db3

10 files changed

Lines changed: 117 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,49 @@ jobs:
109109
if: runner.os == 'Windows'
110110
run: npm run test:native:smoke
111111

112+
bun:
113+
name: bun / ubuntu-latest
114+
runs-on: ubuntu-latest
115+
steps:
116+
- name: Checkout (with submodules)
117+
uses: actions/checkout@v4
118+
with:
119+
submodules: recursive
120+
121+
- name: Setup Node
122+
uses: actions/setup-node@v4
123+
with:
124+
node-version: "22"
125+
126+
- name: Setup Bun
127+
uses: oven-sh/setup-bun@v2
128+
with:
129+
bun-version: "1.3.9"
130+
131+
- name: Install
132+
run: bun install
133+
134+
- name: Lint
135+
run: bun run lint
136+
137+
- name: Typecheck
138+
run: bun run typecheck
139+
140+
- name: Build
141+
run: bun run build
142+
143+
- name: Check core portability
144+
run: bun run check:core-portability
145+
146+
- name: Check Unicode pins (submodule sync)
147+
run: bun run check:unicode
148+
149+
- name: Tests
150+
run: bun run test
151+
152+
- name: Terminal e2e (reduced)
153+
run: bun run test:e2e:reduced
154+
112155
docs:
113156
name: docs
114157
runs-on: ubuntu-latest

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
> **Alpha** — under active development; APIs may change between releases.
99
10-
Rezi is a TypeScript/Node.js terminal UI framework with a native rendering engine (Zireael).
10+
Rezi is a TypeScript terminal UI framework for Node.js and Bun, with a native rendering engine (Zireael).
1111
You build UIs in TypeScript while Rezi emits compact drawlists and delegates terminal diff/present to native code.
1212

1313
In our terminal benchmark suite (`120x40`, PTY mode), Rezi is consistently in the same performance class as native TUIs: slightly slower than ratatui (Rust) by a low single-digit multiplier, while remaining substantially faster than classic JS TUI stacks in the same scenarios.
@@ -69,6 +69,8 @@ await app.start();
6969

7070
```bash
7171
npm install @rezi-ui/jsx @rezi-ui/core @rezi-ui/node
72+
# or
73+
bun add @rezi-ui/jsx @rezi-ui/core @rezi-ui/node
7274
```
7375

7476
### 2) Native `ui.*` API
@@ -100,6 +102,8 @@ await app.start();
100102

101103
```bash
102104
npm install @rezi-ui/core @rezi-ui/node
105+
# or
106+
bun add @rezi-ui/core @rezi-ui/node
103107
```
104108

105109
## Performance overview
@@ -144,9 +148,9 @@ flowchart TB
144148
- Widget primitives: box/row/column, text, input, buttons, focus/keyboard handling
145149
- Higher-level widgets: tables, virtual lists, code editor, diff viewer, file picker, command palette
146150
- Protocols: ZRDL (drawlists) and ZREV (event batches)
147-
- Backends: Node worker/inline execution modes, native addon integration
151+
- Backends: Node/Bun worker/inline execution modes, native addon integration
148152

149-
Node.js 18+ required (18.18+ recommended). Prebuilt native binaries are published for Linux, macOS, and Windows (x64/arm64).
153+
Node.js 18+ (18.18+ recommended) or Bun 1.3+ required. Prebuilt native binaries are published for Linux, macOS, and Windows (x64/arm64).
150154

151155
## Packages
152156

@@ -167,6 +171,12 @@ cd my-app
167171
npm start
168172
```
169173

174+
```bash
175+
bun create rezi my-app
176+
cd my-app
177+
bun start
178+
```
179+
170180
Templates: `dashboard`, `form-app`, `file-browser`, `streaming-viewer`.
171181

172182
## Documentation

docs/getting-started/faq.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
### What is Rezi?
66

7-
Rezi is a code-first terminal UI framework for Node.js. It provides a declarative widget API for building rich terminal applications with features like automatic focus management, theming, and keyboard navigation.
7+
Rezi is a code-first terminal UI framework for Node.js and Bun. It provides a declarative widget API for building rich terminal applications with features like automatic focus management, theming, and keyboard navigation.
88

99
### Is Rezi like React for the terminal?
1010

@@ -27,9 +27,12 @@ Rezi supports:
2727

2828
Prebuilt native binaries are included for all supported platforms.
2929

30-
### What Node.js versions are supported?
30+
### What runtime versions are supported?
3131

32-
Rezi requires Node.js 18 or later (18.18+ recommended).
32+
Rezi supports:
33+
34+
- Node.js 18+ (18.18+ recommended)
35+
- Bun 1.3+
3336

3437
## Architecture
3538

@@ -48,7 +51,7 @@ This architecture enables high performance while keeping the TypeScript code por
4851

4952
`@rezi-ui/core` is runtime-agnostic by design. It contains no Node.js-specific APIs (no `Buffer`, `worker_threads`, `fs`, etc.).
5053

51-
The Node.js integration is provided by `@rezi-ui/node`. Additional backends for other runtimes (Deno, Bun, etc.) could be implemented using the same core package.
54+
Node.js and Bun integration is provided by `@rezi-ui/node`. Additional backends for other runtimes (for example Deno) could be implemented using the same core package.
5255

5356
### What is the binary protocol?
5457

docs/getting-started/install.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Install Rezi packages from npm to start building terminal applications.
44

55
## Requirements
66

7-
- **Node.js**: 18.18.0 or later
7+
- **Runtime**: Node.js 18.18.0+ or Bun 1.3.0+
88
- **Operating System**: Linux, macOS, or Windows
99
- **Terminal**: Any terminal emulator with 256-color or true-color support
1010

@@ -63,7 +63,7 @@ If a prebuilt binary is not available for your platform, the package will attemp
6363
| Package | Description | Required |
6464
|---------|-------------|----------|
6565
| `@rezi-ui/core` | Widgets, layout, themes, forms, keybindings | Yes |
66-
| `@rezi-ui/node` | Node.js backend with native rendering | Yes |
66+
| `@rezi-ui/node` | Node.js/Bun backend with native rendering | Yes |
6767
| `@rezi-ui/testkit` | Testing utilities and fixtures | Optional |
6868

6969
## Optional packages
@@ -164,6 +164,12 @@ Run with:
164164
npx tsx test.ts
165165
```
166166

167+
Or with Bun:
168+
169+
```bash
170+
bun run test.ts
171+
```
172+
167173
You should see "Rezi is working!" displayed in your terminal.
168174

169175
## Building from Source

docs/getting-started/quickstart.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ cd my-tui-app
1212
npm start
1313
```
1414

15+
With Bun:
16+
17+
```bash
18+
bun create rezi my-tui-app
19+
cd my-tui-app
20+
bun start
21+
```
22+
1523
Select a template when prompted (dashboard, form-app, file-browser, or streaming-viewer), or pass `--template` to choose directly:
1624

1725
```bash
@@ -26,6 +34,15 @@ npm init -y
2634
npm install @rezi-ui/core @rezi-ui/node typescript tsx
2735
```
2836

37+
With Bun:
38+
39+
```bash
40+
mkdir my-tui-app && cd my-tui-app
41+
bun init -y
42+
bun add @rezi-ui/core @rezi-ui/node
43+
bun add -d typescript tsx
44+
```
45+
2946
## Minimal Example
3047

3148
Create `index.ts`:
@@ -77,6 +94,12 @@ Run with:
7794
npx tsx index.ts
7895
```
7996

97+
Or with Bun:
98+
99+
```bash
100+
bun run index.ts
101+
```
102+
80103
You should see a counter UI. Use Tab to navigate between buttons, Enter to activate them, and 'q' to quit. You can also click the buttons with the mouse if your terminal supports mouse tracking.
81104

82105
## Understanding the Code
@@ -91,7 +114,7 @@ const app = createApp<State>({
91114
```
92115

93116
- `createApp<State>` creates a typed application instance
94-
- `backend` specifies the rendering backend (Node.js in this case)
117+
- `backend` specifies the rendering backend (`@rezi-ui/node` for Node.js and Bun)
95118
- `initialState` provides the initial application state
96119

97120
### Defining the View

docs/packages/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ flowchart TB
2424
| Package | Description | npm |
2525
|---------|-------------|-----|
2626
| [@rezi-ui/core](core.md) | Widgets, layout, themes, forms, keybindings | `npm i @rezi-ui/core` |
27-
| [@rezi-ui/node](node.md) | Node.js backend with worker threads | `npm i @rezi-ui/node` |
27+
| [@rezi-ui/node](node.md) | Node.js/Bun backend with worker threads | `npm i @rezi-ui/node` |
2828
| [@rezi-ui/native](native.md) | Native addon (napi-rs + Zireael) | Bundled with node |
2929
| [@rezi-ui/jsx](jsx.md) | JSX runtime for Rezi widgets | `npm i @rezi-ui/jsx` |
3030
| [@rezi-ui/testkit](testkit.md) | Testing utilities and fixtures | `npm i -D @rezi-ui/testkit` |
@@ -54,9 +54,9 @@ import { createApp, ui, rgb, darkTheme } from "@rezi-ui/core";
5454

5555
## @rezi-ui/node
5656

57-
**Node.js runtime backend**
57+
**Node.js/Bun runtime backend**
5858

59-
The Node.js backend provides the runtime integration:
59+
The `@rezi-ui/node` backend provides the runtime integration:
6060

6161
- Worker thread management for async rendering
6262
- Event loop integration

docs/packages/node.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# `@rezi-ui/node`
22

3-
Node backend package:
3+
Node/Bun backend package:
44

55
- worker-thread engine ownership
66
- transfer of drawlists/events between core and native
@@ -10,6 +10,8 @@ Node backend package:
1010

1111
```bash
1212
npm i @rezi-ui/node
13+
# or
14+
bun add @rezi-ui/node
1315
```
1416

1517
## What you get
@@ -29,7 +31,7 @@ const backend = createNodeBackend({
2931
});
3032
```
3133

32-
Pass the backend into `createApp` from `@rezi-ui/core`.
34+
Pass the backend into `createApp` from `@rezi-ui/core`. This backend is supported in Node.js and Bun runtimes.
3335

3436
## Native engine config passthrough
3537

mkdocs.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ markdown_extensions:
5858
- tables
5959
- def_list
6060
- pymdownx.details
61+
- pymdownx.emoji:
62+
emoji_index: !!python/name:material.extensions.emoji.twemoji
63+
emoji_generator: !!python/name:material.extensions.emoji.to_svg
6164
- pymdownx.highlight:
6265
anchor_linenums: true
6366
line_spans: __span

packages/node/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# @rezi-ui/node
22

3-
Node.js backend for Rezi. This package owns:
3+
Node.js/Bun backend for Rezi. This package owns:
44

55
- worker-thread engine ownership (native engine is never called on the main thread)
66
- frame scheduling and buffer pooling
@@ -13,5 +13,12 @@ import { createApp, ui } from "@rezi-ui/core";
1313
import { createNodeBackend } from "@rezi-ui/node";
1414
```
1515

16-
Docs: `https://rtlzeromemory.github.io/Rezi/`
16+
Install:
17+
18+
```bash
19+
npm i @rezi-ui/node
20+
# or
21+
bun add @rezi-ui/node
22+
```
1723

24+
Docs: `https://rtlzeromemory.github.io/Rezi/`

packages/node/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@rezi-ui/node",
33
"version": "0.1.0-alpha.0",
4-
"description": "Node.js backend for Rezi (worker-thread engine ownership, scheduling, IO).",
4+
"description": "Node.js/Bun backend for Rezi (worker-thread engine ownership, scheduling, IO).",
55
"license": "Apache-2.0",
66
"homepage": "https://rtlzeromemory.github.io/Rezi/",
77
"repository": {
@@ -22,7 +22,8 @@
2222
},
2323
"files": ["dist/", "README.md"],
2424
"engines": {
25-
"node": ">=18"
25+
"node": ">=18",
26+
"bun": ">=1.3.0"
2627
},
2728
"dependencies": {
2829
"@rezi-ui/core": "0.1.0-alpha.0",

0 commit comments

Comments
 (0)