preactjs/preact
53.7
Adequate · 13 November 2026
7.2k
lines of production code
JavaScript
primary language
7
measurements over time
What this system is
Features
Demo app migrated to Vite with new and updated examples
The demo application has been rebuilt using Vite, replacing the previous build setup. This migration introduces several new interactive examples, including a contenteditable component, a MobX integration using mobx-react, a Zustand store example, and a Redux Toolkit counter. The existing People Browser demo has been integrated and updated to use TypeScript and MobX State Tree for state management, while the Suspense and lazy-loading demos have been expanded to demonstrate nested lazy components and error boundaries. Additionally, the Context and Devtools demos have been added to showcase React/Preact context usage and profiling capabilities.
demo · high confidence
Initial release of the Preact core library
This change introduces the foundational source files for the Preact library, establishing the core rendering engine and component model. It defines the \Component\ base class with \setState\ and \forceUpdate\ methods, the \VNode\ structure for the virtual DOM, and the \createElement\ and \cloneElement\ APIs for building UI trees. The implementation includes the diffing algorithm, context management via \createContext\, and support for portals through \createPortal\. Additionally, it provides comprehensive TypeScript type definitions (\index.d.ts\, \dom.d.ts\) to ensure type safety for consumers.
src · high confidence
Introduce Preact 11 devtools integration and custom hook naming
The devtools module now initializes the Preact 11.0.0-rc.2 devtools bridge, using globalThis with a window fallback to register the library. It also exposes an addHookName function that allows developers to customize the display name of useState, useReducer, or useRef hooks in the devtools panel.
devtools/src · high confidence
Introduce Preact Hooks API with TypeScript definitions
This change adds the core implementation and TypeScript definitions for the Preact Hooks API. It introduces support for state and side-effect management through hooks such as useState, useReducer, useEffect, useLayoutEffect, useRef, useContext, useMemo, useCallback, useImperativeHandle, useDebugValue, useErrorBoundary, and useId. The implementation hooks into Preact's lifecycle (diff, render, commit, unmount) to manage hook state, effect ordering, and cleanup, providing a React-compatible API for functional components.
hooks/src · high confidence
Introduce dedicated jsx-runtime sub-package
The JSX runtime is now available as a standalone sub-package (\jsx-runtime\) with its own implementation and TypeScript definitions. This provides a dedicated, optimized entry point for Babel's automatic JSX runtime API (\jsx\, \jsxs\, \jsxDEV\) and adds support for precompiled JSX transforms via new helper functions (\jsxTemplate\, \jsxAttr\, \jsxEscape\).
jsx-runtime/src · high confidence
Introduce dedicated preact/debug package with component stack and prop validation
The debug utilities have been restructured into a standalone \preact/debug\ package, introducing a new \component-stack.js\ module that tracks component ownership and renders detailed stack traces (including file/line info via \@babel/plugin-transform-react-jsx-source\) for errors and warnings. A new \check-props.js\ module provides a simplified, dependency-free implementation of \prop-types\ validation that logs failures once per message. The package exports helper functions like \captureOwnerStack\, \getDisplayName\, and \resetPropWarnings\ to support debugging and devtools integration, while \initDebug()\ hooks into Preact's lifecycle options to enforce these checks during rendering.
debug/src · high confidence
Introduce preact/compat module for React API compatibility
A new \preact/compat\ module has been added to provide a React-compatible API layer, allowing libraries and applications built for React to run on Preact. This module exports React-standard components and hooks such as \Component\, \PureComponent\, \memo\, \forwardRef\, \Suspense\, and \lazy\, alongside React-specific hooks like \useTransition\, \useDeferredValue\, and \useSyncExternalStore\. It also includes utility functions like \Children.map\, \createPortal\, and \flushSync\, and implements necessary behaviors such as \className\ normalization, \UNSAFE\\\ lifecycle aliases, and event propagation shims to ensure compatibility with existing React ecosystems.
compat/src · high confidence
New compat entry points for client, server, scheduler, and JSX runtimes
The compat package now exposes dedicated entry points for \client\, \server\, \scheduler\, and \jsx-runtime\ (including \jsx-dev-runtime\), along with \test-utils\. The \client\ entry provides \createRoot\ and \hydrateRoot\ wrappers to align with React's concurrent API, while the \server\ entry re-exports \renderToString\, \renderToPipeableStream\, and \renderToReadableStream\ from \preact-render-to-string\ with improved error messaging if the dependency is missing. The \scheduler\ entry shims React's unstable priority APIs, and the JSX runtime entries ensure the correct Preact runtime is used when an alias is present. These changes support modern React patterns and tooling compatibility.
compat · high confidence
Architecture
Refactor core diffing engine into modular files
The core diffing logic has been reorganized from a single monolithic file into four distinct modules: \index.js\ (main diff loop), \children.js\ (child reconciliation), \props.js\ (property and event handling), and \catch-error.js\ (error boundary propagation). This structural change improves code maintainability and tree-shakeability without altering the external API or runtime behavior.
src/diff · high confidence
Behavioural changes
Add WeakKey type definitions
A new \types/weak-key.d.ts\ file has been added to define the \WeakKey\ type and the \WeakKeyTypes\ interface, enabling proper type checking for weak keys in the application.
types · medium confidence
Adopts modern Rollup and Babel build pipeline
The build system has been replaced with a modern setup using Rollup and Babel, removing previous UMD and CommonJS output formats in favor of ES modules. This change introduces a custom Babel plugin to optimize rest parameter handling and integrates Terser for minification, resulting in a streamlined build process that targets specific browser versions.
scripts · high confidence
Build fails if compatibility files are missing from package.json
A new configuration script (config/compat-entries.js) now validates that all JavaScript files in the compat directory are listed in the package.json files entry. If any file is missing, the build process will fail with an error, ensuring that compatibility assets are correctly included in the published package.
config · high confidence
Extracted test utilities for act, setupRerender, and teardown
The test utilities previously embedded in the main library have been extracted into a dedicated \test-utils\ package. This change introduces explicit exports for \act\, \setupRerender\, and \teardown\, providing users with a cleaner separation between production code and testing infrastructure. The \act\ function now supports nested calls and asynchronous callbacks, ensuring that effects and rerenders are properly flushed and cleaned up, while \setupRerender\ allows manual draining of the pending render queue and \teardown\ resets Preact's internal test state.
test-utils/src · high confidence
Migrate to pnpm workspaces and Vitest with oxlint/oxfmt tooling
The repository has switched its package manager from npm to pnpm, organizing the codebase into a pnpm workspace that includes the root library and the demo application. The test runner has been migrated from Mocha to Vitest, and the build/test configuration now uses oxlint and oxfmt for linting and formatting, replacing the previous ESLint and Prettier setup. This change also introduces a new \mangle.json\ configuration to control property mangling for minified builds and updates the development environment to require Node.js 22.
(repo-wide) · high confidence
Updated pre-commit hook to use nano-staged
The pre-commit hook in the .husky directory has been updated to execute \pnpm exec nano-staged\ instead of the previous command. This change aligns with the migration to Husky v9 and the replacement of npm-run-all and lint-staged, ensuring that staged files are processed correctly using the new nano-staged tooling within the pnpm workspace.
.husky · high confidence
Test coverage
14 commits adding/updating tests in debug/test; 50 commits adding/updating tests in test/browser; Added Preact fixture for testing; Added TypeScript type tests for Preact compat; Added TypeScript type tests for Preact components, VNodes, and custom elements; Added browser tests for Preact hooks; Added test coverage for component lifecycle methods; Added test coverage for core Preact APIs; Added test for build artifact exports; Added test utility for scheduling effect assertions; Added tests for JSX runtime functions and precompiled JSX support; Added tests for act() cleanup and rerender teardown behavior; Added tests for the addHookName devtools utility; Expanded test coverage for preact/compat browser APIs; New test utility modules for DOM validation and lifecycle spying.
Dependencies
Preact 11.0.0-rc.2: Sub-package exports and modernized build tooling
This release introduces a comprehensive package structure for Preact 11, defining individual sub-packages for compat, debug, devtools, hooks, jsx-runtime, and test-utils, each with its own package.json and peer dependency on preact ^10.0.0. The main package.json is updated to version 11.0.0-rc.2 and implements a detailed Node.js 'exports' map to expose these sub-packages (including compat/client, compat/server, and compat/scheduler) alongside the core library. The build tooling has been modernized by replacing Babel, UglifyJS, and JSHint with Rollup, esbuild, oxlint, and oxfmt, and the test suite has migrated from Mocha to Vitest with Playwright for browser testing. The demo application has been updated to use Vite and includes examples for Redux, MobX, Zustand, and other state management libraries.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 54 → 54 (-0.5)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.3) — scores are not directly comparable.
Lenses
- Code Health 54 → 53 (-1.0)
- Architecture 61 → 61 (-0.6)
- Maturity 62 → 58 (-3.2)
- Readiness 47 → 48 (+0.4)
- Security 68 → 69 (+1.1)
- Performance 100 → 100 (+0.0)
Resolved (18)
- Base-context workflow trigger runs with an unscoped token (.github/workflows/pr-reporter.yml)
- Duplicate cloneElement with inconsistent signatures. compat.index.cloneElement likely mimics React's behavior (props merging), while create-element.cloneElement takes explicit props and children. This leads to confusion for users migrating from React.
- Duplicate core rendering operation with inconsistent signatures. Both modules expose a render function for mounting VNodes, but the compat version accepts an optional callback while the src version does not. This creates confusion about which entry point to use for standard rendering.
- Duplicate hydration operation with inconsistent signatures. Similar to render, compat.src.render.hydrate accepts a callback while src.render.hydrate does not.
- Duplicate portal creation function. Both modules expose createPortal with identical signatures. This suggests redundant exports across different entry points.
- High secret: WD-SECRET-0005 (demo/package-lock.json)
- Inconsistent naming for memo-related operations. compat.src.memo uses memo as a function to create a memoized component, while compat.index uses isMemo to check if an element is a memo. While distinct operations, the lack of a createMemo or similar in src (relying on createElement or memo in compat) creates a fragmented API for memoization.
- Medium: security finding (details withheld)
- Off-boarding risk: anonymized user #1
- PR-triggered workflow without a permissions block (.github/workflows/ci.yml)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Workflow token permissions not restricted (.github/workflows/benchmarks.yml)
- babel-plugin-fast-rest.fastRestTransform (cognitive 16) (scripts/babel-plugin-fast-rest.mjs)
- diff (cognitive 231) (src/diff/index.js)
- diff (cyclomatic 95) (src/diff/index.js)
New (12)
- Medium CVE: [GHSA redacted] (pnpm-lock.yaml)
- Off-boarding risk: anonymized user #1
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- Skipped (documented): (unnamed test) (test/browser/render.test.jsx)
- diff (cognitive 220) (src/diff/index.js)
- diff (cyclomatic 94) (src/diff/index.js)
- doc comments repeat the names (src/constants.js)
- initSuspenseHooks (cognitive 16) (compat/src/suspense.js)
- redundant comment (src/diff/index.js)
Changes since last survey
- 49 commits — 40 feature/other, 9 fixes
By area
- (repo) — 19 commits
- src/diff — 7 commits
- (root) — 6 commits
- test/browser — 3 commits
- test/ts — 3 commits
- .github/workflows — 2 commits
- compat/src — 2 commits
- hooks/src — 2 commits
- src/dom.d.ts — 2 commits
- compat/scheduler.mjs — 1 commit
- compat/test — 1 commit
- debug/src — 1 commit
Notable commits
- fix: Fix template in alternative namespaces
- fix: Merge pull request #5331 from playlikeboy/fix/input-list-attribute-types-5330
- fix: Merge pull request #5338 from b84330808/fix/template-shadowroot-types
- fix: Merge pull request #5339 from preactjs/fix/template-namespace-content
- fix: Merge pull request #5345 from preactjs/fix/ignore-non-function-event-props
- fix: Merge pull request #5347 from jonkwheeler/fix/throw-null-then
- fix: fix(types): add declarative shadow DOM attributes to <template>
- fix: fix(types): allow list attribute on all valid input types (#5330)
- fix: fix: avoid String coercion when diffing symbol-marked VNodes
- change: 11.1.0
- change: 11.1.1
- change: 11.2.0
- change: Apply suggestion for newProps.registry
- change: Drop the type tests, per review
- change: Golf a couple of hooks closures
- change: Golf the component render loop and suspended range scan
- change: Harden vnode recognition
- change: Ignore non-function values for on* props
- change: Inherit scoped custom element registry when creating elements
- change: Merge branch 'main' into JoviDeCroock/prop-removal-remove-attribute
- …and 29 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
preactjs/preact was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 13 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit a2e03dbc6a4a239552d43edb6580ecf86886cc39 — the exact code this score is about.
- Scored under rubric-2026.11.3 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.61+preprod-f3449e6eb431.