feat: lightweight react-reconciler-compatible reconciler - #107
Conversation
…l clone Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Original prompt from Aiden Bai
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
commit: |
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Co-Authored-By: Aiden Bai <aiden.bai05@gmail.com>
Summary
Adds
bippy/reconciler: a compactreact-reconciler-compatible reconciler (~13.7 kB ESM / 5.2 kB gzip vs react-reconciler's ~398 kB min / 65 kB gzip), inspired by Cody Bennett's react-nylon.isFiber, plus DevTools-hook injection (getRDTHook().inject+onCommitFiberRoot), so bippyinstrument()observes custom renderers built on it.__CLIENT_INTERNALS...with legacy__SECRET_INTERNALS...fallback) with a broad hook dispatcher (useState/useReducer/useEffect/useLayoutEffect/useInsertionEffect/useContext/useSyncExternalStore/useTransition/useOptimistic/use/...).Context.Consumerrender props), portals, error boundaries, basic thenable/Suspense handling,flushSync/act.componentDidMount/componentDidUpdate/componentWillUnmount(including for class components nested inside host instances — deletion now walks the whole subtree for effect cleanup/lifecycles viacommitDeletionEffects, separate from host-node removal).props.ref(never the deprecated warningelement.refgetter) and stripped from host props.Compatibility
Not 1:1 with React's reconciler — lanes/priorities, hydration, and host context are intentionally omitted to stay tiny. Representative tests ported from
react-reconciler's suite (ReactFragment,ReactFiberRefs, class components/setState callback/lifecycles,ReactHooksWithNoopRenderer,ReactNewContext,ReactFlushSync,ReactIncrementalSideEffects,ReactMemo) run against a noop host config intests/react-reconciler-compat.test.tsx— all pass. Porting them surfaced and fixed real gaps:queue.lastRenderedStateinstead of a stale fiber'smemoizedState_contextlost inupdateElement)Context.Consumerelement types were collapsed to their$$typeofsymbol and never renderedref={ref1}→ref={ref2}) now detach the old ref, and refs only re-attach when changed (callback refs no longer re-fire every commit)Testing
pnpm --filter bippy test: 629 passed, 2 skippedpnpm check,tsc --noEmit,pnpm --filter bippy buildall greenLink to Devin session: https://app.devin.ai/sessions/0965b0b326de4f2fa5da504f2d60cd55
Open in Devin Desktop: https://app.devin.ai/desktop/session/0965b0b326de4f2fa5da504f2d60cd55?variant=devin
Requested by: @aidenybai