feat(config): nested designSystem chains and smart include#3629
Merged
segunadebayo merged 7 commits intoJun 29, 2026
Conversation
A manifest's designSystem field links to its parent. loadDesignSystemChain walks the chain, resolving each parent against the previous manifest's directory, guards cycles, and merges presets root-first. The driver hydrates each level under its own name. Diagnostics: cycle, parent-not-found.
🦋 Changeset detectedLatest commit: 101fbc4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@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. |
Name a package in `include` and Panda resolves it via Node resolution. A library that uses Panda but isn't a design system auto-globs its source and excludes the package's own node_modules. A package shipping panda.lib.json is redirected to designSystem with a batched error. The CLI --include override flows through the same resolution.
The smart-include exclude merge was injecting **/*.d.ts as a base, duplicating a default scan_exclude() already guarantees. Drop it and route the CLI --include override through the same mergeExcludes helper so both paths merge excludes one way.
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.
Two related additions to how
designSystemandincluderesolve. Both replace a hand-writtennode_modulespath with a single named field, and they stay distinct:designSystemanswers "what is my design language?",includeanswers "which files use it?".Nested designSystem chains
A design system can now build on another. You set
designSystemonce; if that design system was itself built on a parent, Panda pulls the parent in for you. Noimport { parentPreset }, no second entry inpresets.This builds on the single-level
designSystemfield (#3627), which rejected nested chains with "not supported yet". The rejection is replaced with the walk.How it resolves.
loadDesignSystemChain(packages/config) walks the parent links on disk:The node driver (
hydrateDesignSystem) hydrates each level's pre-extracted styles under its own name, so no design system in the chain is re-extracted.Diagnostics name the package and the fix:
Design-system cycle: @a → @b → @a. A design system can't depend on itself.designSystem "@acme/marketing" extends "@acme/foundations", which isn't installed alongside it.Smart include
Name a package in
includeand Panda resolves it for you. A library that uses Panda but isn't a design system — say a charts package built on@acme/ds— goes straight inincludeas a bare specifier:Panda resolves the package, globs its source so its styles land in your CSS, and appends a
node_modulesexclude so the package's own dependencies aren't scanned. No hand-written./node_modules/...glob. Plain globs and local folder names pass through untouched. The CLI--includeoverride flows through the same resolution.If you point
includeat an actual design system (a package shippingpanda.lib.json), Panda stops and tells you to move it todesignSystem— reporting every offender at once, not one per run. The redirect is what keeps the two fields from blurring: manifest-bearing belongs indesignSystem, everything else ininclude.Notes
package.jsonis registered as a config dep today; live source watch is a separate open item.Tests
packages/config/__tests__/design-system.test.ts— depth-2 merge order, one importMap root per design system, resolve-against-manifest-dir, cycle + parent-not-found diagnostics, chain linked by specifier.packages/config/__tests__/smart-include.test.ts— package vs glob vs path discrimination,exports-hiddenpackage.jsonand on-disk manifest detection, manifest redirect (batched), auto-glob + nested-node_modulesexclude,resolveSmartInclude(--includepath), no-op whenincludeis empty.pnpm typecheck,pnpm test packages/config, and the compiler design-system/lifecycle suites pass.