Skip to content

Kudzu 0.7.0 - React-source migration preview

Choose a tag to compare

@bunzzeok bunzzeok released this 31 Jul 01:39

Kudzu Releases

0.7.0 - React-source migration preview

Kudzu 0.7.0 begins the migration track for ordinary React-shaped landing pages. Existing source may retain conventional supported imports from react; Kudzu rewrites those imports to compile-time APIs, pre-renders complete HTML, and emits only the route capabilities that are actually used. React, a virtual DOM, hydration, and a browser component tree are never emitted or executed.

import React, { useState } from "react"

export default function Header() {
  const [open, setOpen] = useState(false)

  return <React.Fragment>
    <button onClick={() => setOpen(!open)}>{open ? "Close" : "Menu"}</button>
    {open && <nav>Navigation</nav>}
  </React.Fragment>
}

New in 0.7.0

  • Conventional unaliased named imports of supported hooks from react compile through Kudzu without loading React.
  • Default, namespace, and named Fragment imports are accepted for migration source.
  • Relative function components, props, children, conditions, attributes, text, and event handlers keep their familiar TSX shape.
  • Static routes using the accepted React import forms still ship zero JavaScript.
  • Interactive routes ship direct DOM capabilities only; the landing-page acceptance fixture adds state, text, attribute, condition, and menu-handler capabilities.
  • Emitted modules are checked for surviving runtime React references, and side-effect React imports fail with a source location.
  • Keyed collections now support analyzable filter, direct-property flatMap, Array.from, positional keys, recursively deep sibling child maps, nested conditions, latest-item handlers, multiple serializable row states, effects, and null object refs.

Current boundary

This is source migration support, not a React compatibility runtime. Aliased hooks, member hook calls such as React.useState, memo, useMemo, useCallback, React classes, React Router, Next-specific components, React UI packages, side-effect imports, and dynamic React imports remain unsupported. Migrate a real route, reduce the first unsupported pattern to a fixture, and extend the compiler one proven blocker at a time.

Measured fixture

The two-route landing fixture retains React imports across relative components. Its static route has no script, while its interactive mobile-menu route emits 10,245 B raw / 5,030 B aggregate gzip JavaScript across seven capability files. Seven clean builds after one warm-up measured a 310.0 ms median on the development machine described in MIGRATION_ROADMAP.md.

Upgrade

npm install @kudzujs/core@^0.7.0

New Kudzu source should continue importing APIs from @kudzujs/core. Retaining react imports is intended for migration input where minimizing source edits matters.