Text.js 让 React 全栈应用直接渲染在 console.log 中

原标题:Text.js: Build full-stack React apps that render inside console.log
58AI 研判分

Text.js 推出 Turbolog 引擎,通过自定义 React 协调器、Yoga 布局、脏行门控与 RLE 编码,把每一帧变更帧转成一次 console.log 调用,避免清屏闪烁。实测 100×32 仪表盘全量重绘约 0.163ms,单行编辑约 0.011ms,空闲帧零调用。

报道正文

本文目录8 个章节

Every changed frame is one console.log call

A commit that changes no cells never reaches the console.

  1. React 19
文本
<Box>
 ├ <Text>
 └ <Text> 1

01Commit

React commits through a custom reconciler. 2. Yoga

02Layout

Yoga lays out boxes on whole cells. 3. CellBuffer

03Paint

Only damaged rows repaint. 4. Row hash9f1c08e2a07e5b3131b2c4d9e8d046fa0 calls · 0 B

04Dirty gate

Unchanged frames stop here. 5. RLE

05Encode

3,200 cells become 149 %c spans. 6. console.log

06Emit

Frames are appended at least 66ms apart.

Changed frame Unchanged frame, 0 calls

Appended frames

Clearing the console before each frame leaves it blank until DevTools paints the next one. Turbolog appends each frame instead.

Read the postclear() + log()70.6% blanklog(), appended1.0% blank0.163msFull repaint (layout, paint, encode)0.011msOne-row edit, such as a keystroke0 callsIdle frame149 spans%c arguments for 3,200 cells100×32 dashboard, mean of 1,000 frames · Apple M5 Pro · Bun 1.4.4Turbolog engine docs