Skip to content

feat: first-class design system support#3536

Closed
Adebesin-Cell wants to merge 63 commits into
chakra-ui:v2from
Adebesin-Cell:v2-first-class-design-system
Closed

feat: first-class design system support#3536
Adebesin-Cell wants to merge 63 commits into
chakra-ui:v2from
Adebesin-Cell:v2-first-class-design-system

Conversation

@Adebesin-Cell
Copy link
Copy Markdown

@Adebesin-Cell Adebesin-Cell commented May 7, 2026

superseded by #3537. closing in favor of the unified PR.

#3537 contains all of this branch's commits plus follow-ups: designSystem working at every level of a chain (not just terminal consumers), and a code audit pass. closing here so reviewers don't double-comment on overlapping content.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 7, 2026

🦋 Changeset detected

Latest commit: 2f45540

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 24 packages
Name Type
@pandacss/dev Major
@pandacss/node Major
@pandacss/types Major
@pandacss/config Major
@pandacss/astro-plugin-studio Major
@pandacss/mcp Major
@pandacss/postcss Major
@pandacss/core Major
@pandacss/generator Major
@pandacss/logger Major
@pandacss/parser Major
@pandacss/plugin-lightningcss Major
@pandacss/plugin-svelte Major
@pandacss/plugin-vue Major
@pandacss/preset-atlaskit Major
@pandacss/preset-base Major
@pandacss/preset-open-props Major
@pandacss/preset-panda Major
@pandacss/reporter Major
@pandacss/studio Major
@pandacss/token-dictionary Major
@pandacss/extractor Major
@pandacss/is-valid-prop Major
@pandacss/shared Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
panda-docs Ready Ready Preview May 7, 2026 4:30pm

Request Review

@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 2026

@Adebesin-Cell is attempting to deploy a commit to the Chakra UI Team on Vercel.

A member of the Team first needs to authorize it.

Implements `readLibManifest` in `@pandacss/node` with full TDD coverage.
Resolves `<pkg>/panda.lib.json` via Node module resolution, parses JSON,
and validates the LibManifest shape — throwing descriptive errors for
unresolvable packages, missing exports, malformed JSON, missing fields,
and wrong field types.
Relocate `readLibManifest` (and its tests + fixtures) from `@pandacss/node`
to `@pandacss/config` so that the upcoming `getResolvedConfig` in config can
call the reader without inverting the package dependency direction.

`@pandacss/node` re-exports the symbol from `@pandacss/config` to keep the
existing public surface intact.
Read the manifest via readLibManifest, resolve and bundle the preset,
prepend it to the consumer's preset stack, and concatenate the manifest's
importMap into the consumer's importMap.
When `config.designSystem` is set, PandaContext now reads the lib manifest,
resolves the buildinfo path, and calls `encoder.fromJSON()` to pre-populate
the encoder with the library's extracted hashes. Failures (missing file,
malformed JSON) warn and return without throwing.
Wrap readLibManifest in try/catch so an uninstalled or misconfigured
designSystem package warns gracefully instead of escaping the constructor.
Also replace `cwd as string` cast with nullish coalesce and `parsed as any`
with the precise `EncoderJson` type.
…nSystem path

When the manifest's preset file only has named exports (no default),
bundleNRequire returns the whole module object (e.g. { leafPreset: ... }).
Add extractPresetFromModule() to detect this and pick the first value
that looks like a Preset, so the full depth-3 preset chain resolves.
Replace the four manual knobs (presets import, importMap, buildinfo in
include) with a single designSystem: '@v2-ds-fixture/lib-leaf' field,
validating the new API produces identical CSS output.
adds sandbox/v2-ds-example with three packages (styled-system, lib, app)
demonstrating the designSystem config key, token override semantics, manifest
format, and buildinfo travel.
When config.libraryMode === true, skip hydrateDesignSystemEncoder so
the lib's buildinfo only contains its own hashes, not upstream's.
Adds optional `presetExport?: string` to the `LibManifest` interface,
validates its type in the manifest reader, and covers the new field with
3 tests (reads when present, undefined when omitted, throws on wrong type).
…e 3c

- Export `bundle` from `@pandacss/config` index
- Add `presetExport?` field to `WriteLibManifestOptions`; thread it into the manifest JSON with conditional spread (omitted when undefined)
- Add `findLibPresetName` helper to filter out panda built-ins from `ctx.config.presets`
- Add `detectPresetExport` helper that bundles the preset file and matches exports by `name`
- `buildLib` calls both helpers and passes `presetExport` to `writeLibManifest`
- 2 new manifest-writer tests (writes/omits `presetExport`) + 1 new lib-build test
- Add logger.warn in detectPresetExport catch block so misconfigured preset
  paths surface a diagnostic instead of silently omitting presetExport
- Expand findLibPresetName comment to explain the reverse-walk convention
  and its edge case
- Add test covering module.exports (default-export) preset detection path
…port

The preset path (default '../preset.ts') is manifest-relative, meaning it
should be resolved from <cwd>/<outdir>/ where panda.lib.json lives. The
previous code resolved it from cwd directly, so '../preset.ts' with
cwd='lib/' would incorrectly resolve to 'packages/preset.ts' instead of
'lib/preset.ts'. Now resolves manifest-relative first, falling back to
cwd-relative for backwards compatibility.
Source files for the depth-3 chain regression test (lib → lib-mid → lib-leaf → app).
Each lib has its own preset, panda.config.ts, and src/. App consumes leaf via designSystem.

Pairs with already-committed dist artifacts (panda.lib.json, panda.buildinfo.json) to make
the fixture self-contained for fresh checkouts.
  
  smart-include fixture's no-manifest-pkg/package.json was extended.
  Lockfile reflects sandbox/v2-ds-example/charts.
Trimmed verbose JSDoc and inline comments that described WHAT the code does
(the code already says it). Kept short comments only where the WHY is
non-obvious (bundle-n-require quirks, exports-field workarounds, manifest
relativity). Public LibManifest type keeps one-line JSDoc per field for IDE
hover usefulness.
panda lib output (dist/panda.{buildinfo,lib}.json) and codegen output
under packages/styled-system are reproducible from source. removing
them from git keeps PR review focused on the actual changes.

reviewers can regenerate locally:
- pnpm install
- pnpm panda lib in each lib package
- pnpm panda in the consumer app

the sandbox/v2-ds-example/packages/charts/dist/index.js stays — it
simulates a non-panda external lib for the smart-include glob demo.
Manifest's preset field used to point at the source TypeScript
(../preset.ts). That worked in workspace setups where source ships
alongside dist, but for a real npm-published lib that only includes
dist/ in its files array, the consumer's bundle() couldn't resolve
the preset.

panda lib now compiles preset.ts to dist/preset.mjs via esbuild
(packages: 'external', so npm imports stay external and only relative
paths get inlined). The manifest references ./preset.mjs and the
generated package.json exports map ./preset → ./dist/preset.mjs.

If preset.ts isn't present, the manifest falls back to the user-
supplied preset path with a warning — keeps existing tests
that don't ship a preset source happy.
@Adebesin-Cell
Copy link
Copy Markdown
Author

superseded by #3537 — that PR is the unified version (this branch's commits are all included in #3537 plus the libraryMode-gate drop and audit fixes). closing to avoid reviewers double-commenting on overlapping content.

@Adebesin-Cell Adebesin-Cell changed the title feat: first-class design system support (OSS-2355) feat: first-class design system support May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant