feat: add React 19 support and modernize build tooling - #2
Open
samiashi wants to merge 6 commits into
Open
Conversation
Bump the package to 4.0.0 (major) and modernize the full build stack: - Widen peerDependencies to React ^18.2.0 || ^19.0.0 so existing React 18 consumers keep working while React 19 is now supported; move devDependencies to current versions (react/react-dom ^19.2.8, @babel/* 8, jest 30, jest-environment-jsdom 30, prettier 3, TypeScript 7). - Replace the unmaintained babel-preset-airbnb with the maintained @babel/preset-env and @babel/preset-react on Babel 8. - Force modules: "commonjs" in .babelrc: Babel 8's CLI self-reports ESM support, so the default 'auto' mode would leave ESM in lib/ and break CommonJS consumers of main: lib/index.js. - Add engines: node >=18 and typecheck/check scripts that typecheck the shipped TypeScript typings with tsc. - Add @types/react and jest-environment-jsdom devDependencies for the typecheck and client-hydration test suite.
react-dom/client guarantees hydrateRoot in React 18+, so the guarded createRoot().render() fallback was dead code. Render each server-serialized instance with hydrateRoot directly; renderToString stays the server path, so behavior is otherwise unchanged.
Serialize a server-rendered Hypernova payload (via renderToString + serialize), render it into a jsdom document, then call renderReact's client branch and assert the component resumes on the server node with the server-provided props under React 19. Uses jest-environment-jsdom since the hypernova() client path runs only when a DOM is present.
- Replace the commented-out single server signature with real overloads for both the server and client branches of renderReact, plus the exported ServerRenderedComponent (props -> HTML string) mapping. - Add tsconfig.json (strict, React JSX, NodeNext module resolution) so the package's own declarations are verified by tsc --noEmit on TypeScript 7 via the npm run typecheck script.
- Bump checkout and setup-node to v4 in both CI and publish workflows. - Test across the current active Node LTS lines (20.x, 22.x, 24.x) instead of the old 16.x-20.x matrix, and publish on Node 24. - CI now runs an explicit build plus tsc typecheck before the jest suite so compile output, type checking, and tests are all verified.
Update the README tagline to reflect the widened peer dependency range.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds React 19 support to
@lyst/hypernova-reactand modernizes the toolchain. The package was last released in July 2023, pinned to React 18 with a Babel stack that no longer works against the maintained Babel 8. This brings everything up to date while keeping backward compatibility with existing React 18 consumers.What changed
React 19 support
renderReactnow hydrates withhydrateRootunconditionally (the React 18/19react-dom/clientAPI), removing the deadcreateRootfallback.renderToStringremains the server path.peerDependencieswidened toreact/react-dom^18.2.0 || ^19.0.0— React 18 apps keep working, React 19 apps are newly supported.Toolchain modernization
babel-preset-airbnbwith maintained@babel/preset-env+@babel/preset-reacton Babel 8, upgrading@babel/core/@babel/clito 8.x."modules": "commonjs"in Babel config — Babel 8 defaults to leaving ESM inlib/, which would have silently broken CommonJS consumers ofmain: lib/index.js.@types/reactandjest-environment-jsdom.actions/checkout@v4/setup-node@v4, Node 20/22/24 matrix, explicit build + typecheck + test run.