CodeVetter · Repo Unpack · System map
preactjs/preact
The repository packages a DOM renderer and several addons under one public npm package. Core rendering owns VNode trees, component instances, and DOM mutations; hooks and compatibility extend it through shared options callbacks. Server rendering crosses into an optional external package, while the demo is a separate Vite application inside the workspace. Rollup, Babel, and Terser produce the distributable modules, and GitHub Actions define validation and staged release workflows.
- src/index.js exports render, hydrate, createElement/h, Fragment, refs, cloning, Component, context, portals, child flattening, and options as the core API.
- The root package is preact 11.0.0; its export map publishes core, compat, debug, devtools, hooks, test-utils, JSX runtimes, and compatibility client/server/scheduler adapters.
- compat and debug manifests are private source/build metadata with separate dist modules; CONTRIBUTING describes addon manifests as publishing metadata rather than workspace projects.
- The pnpm workspace adds only demo; package.json selects pnpm 11.3.0 and Node 22.22.2, and workspace configuration enforces that Node engine.
- render stores the previous root on parentDom._children, while Component owns state and _nextState; these inspected core paths retain runtime state in objects associated with the DOM tree.
- scripts/build.mjs enumerates seven bundles and uses Rollup, Babel property renaming, a custom rest transform, and Terser; addons externalize preact imports.
- Server compatibility exports string, pipeable-stream, and readable-stream rendering from preact-render-to-string; the root declares it an optional peer.
- The demo uses Vite with automatic JSX and source aliases for core, hooks, devtools, JSX runtimes, React, and ReactDOM.
- Repository scripts define build, addon-specific watch modes, lint, formatting, minified Vitest tests, and separate core/compat TypeScript checks.
- Release automation responds to 11.* tags, consumes the tested npm-package artifact, creates a draft GitHub release, and stages npm publication with provenance; CONTRIBUTING describes a subsequent npm review and 2FA step.