Commit 4d9c089
committed
feat: fiber architecture rewrite with lane-based scheduler and type safety
BREAKING CHANGE: Replaces the old hook-based reconciler with a full fiber
architecture modeled after React's internals. The public API surface remains
compatible, but the internal reconciliation engine is completely new.
## New Architecture
- **Fiber tree**: work-in-progress / current dual tree for interruptible renders
- **Work loop**: and
- **Begin / Complete work**: separate phases for building and finalizing fibers
- **Commit phase**: mutation + layout effects, then passive effects flush
- **Lane-based priority system**: 16-bit branded / with merge,
intersect, highest-priority selection, and entanglement
- **Scheduler**: binary min-heap () with ,
, and priority-based task ordering
- **Concurrent rendering groundwork**: time-slicing ready, sync path still default
## Type Safety Hardening
- Centralised unsafe-cast boundary: — all /
/ conversions live here; zero stray elsewhere
- alias resolves impossible branded-type incompatibilities
- (bitwise OR produces naturally)
- Compile-time enforcement: with
directives
## New Modules
- — branded type conversion helpers
- — binary min-heap for scheduler task queue
- — work loop + sync + concurrent rendering paths
- — begin work phase
- — complete work phase
- — DOM mutation helpers
- — commit root orchestration
- — priority task scheduler
- — lane priority system
- — child reconciliation with key-based diff
- — hook implementations for fiber architecture
- — effect collection and execution
- — WIP tree management
- — fiber factory functions
- — runtime type guards and assertions
- — SSR hydration support
- — serialization / deserialization for SSR
- — live Vite-powered browser demo
## Tests
- 9 new test modules covering previously untested internals
- 473 tests, 0 failures, 1,526 expectations across 38 files
## Verification
```bash
bun test # 473 pass, 0 fail
bun run typecheck # 0 errors
```1 parent 12c42ee commit 4d9c089
100 files changed
Lines changed: 14496 additions & 5651 deletions
File tree
- .github/workflows
- .trae/rules
- examples/interactive-showcase
- example
- public
- src
- src
- context
- core
- dom-renderer
- events
- fiber
- fragments
- hooks
- jsx-runtime
- reconciler
- tests
- fiber
- helpers
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | 25 | | |
29 | 26 | | |
30 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
74 | 75 | | |
75 | | - | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
79 | | - | |
80 | | - | |
81 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
82 | 83 | | |
83 | | - | |
| 84 | + | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
| |||
378 | 379 | | |
379 | 380 | | |
380 | 381 | | |
381 | | - | |
| 382 | + | |
382 | 383 | | |
383 | 384 | | |
384 | 385 | | |
| |||
581 | 582 | | |
582 | 583 | | |
583 | 584 | | |
584 | | - | |
| 585 | + | |
585 | 586 | | |
586 | 587 | | |
587 | 588 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments