Skip to content

feat(dev): add a bundleable define entry point [Panda v1] - #3810

Open
castrog wants to merge 3 commits into
chakra-ui:mainfrom
castrog:fix/dev-define-entrypoint
Open

castrog wants to merge 3 commits into
chakra-ui:mainfrom
castrog:fix/dev-define-entrypoint

Conversation

@castrog

@castrog castrog commented Sep 10, 2026

Copy link
Copy Markdown

Summary

  • Add a runtime-dependency-free @pandacss/dev/define entry point for configuration helpers.
  • Preserve existing @pandacss/dev imports through root re-exports.
  • Preserve flat and namespaced token APIs such as defineTokens.colors().
  • Document how published libraries can bundle the entry point with tsup.

Why

I use Panda’s definition helpers in a published design-system package. When the library build externalizes @pandacss/dev, calls such as definePattern(...) remain in the emitted JavaScript. Production SSR then requires a package that was only installed for development and fails with ERR_MODULE_NOT_FOUND when it is absent.

Bundlers externalize modules rather than individual exports. The dedicated entry point allows a library to bundle these small helpers while continuing to externalize the rest of @pandacss/dev:

import { definePattern } from '@pandacss/dev/define'
import { defineConfig } from 'tsup'

export default defineConfig({
  noExternal: ['@pandacss/dev/define']
})

defineParts remains on the root entry point because it depends on PandaError. Including it would add an @pandacss/shared runtime dependency to the new entry point. Existing root imports and behavior remain unchanged.

If this API direction works for the project, I can follow with the equivalent v2 change so design systems can use the same import path while migrating.

Verification

  • pnpm --filter @pandacss/dev... build-fast
  • pnpm --filter @pandacss/dev build
  • pnpm test packages/cli
  • Prettier and git diff --check
  • Built a tsup consumer with noExternal: ['@pandacss/dev/define']; the output contained only the imported helper, retained no Panda imports, and ran successfully.

RetriggerConfidence Score: 4/5

The implementation appears safe to merge, with a non-blocking test coverage gap around the generated package entry point.

Fix All in Claude CodeFindings

  1. P2 Published Entry Remains Untested
Fix with agent prompt
### Issue 1
packages/cli/__tests__/define.test.ts:1-2
These imports resolve through Vitest's source aliases, so this test does not exercise the new `dist/define.*` export targets used by published consumers. A build that omits or misconfigures those files could pass this test while `@pandacss/dev/define` fails after publication. Add a smoke test against the built or packed package to cover the new entry point's distribution contract.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

  • Adds package export targets and a minor changeset for the new entry point.
  • Moves dependency-free helpers into src/define.ts, leaving defineParts on the root entry point.
  • Documents bundling the subpath into published component libraries with tsup.
  • Adds source-level API compatibility tests, but does not test the generated package artifacts.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Library[Published design-system source] -->|imports helpers| Define["@pandacss/dev/define"]
  Define --> Helpers["Dependency-free define helpers"]
  Library -->|tsup noExternal| Bundle[Bundled library output]
  Helpers --> Bundle
  Root["@pandacss/dev root entry"] -->|re-exports| Helpers
  Root --> Parts["defineParts and PandaError dependency"]
Loading

Reviews (1) · Last reviewed commit: "feat(dev): add a bundleable define entry..."

Allow published design systems to bundle configuration helpers without retaining a runtime dependency on @pandacss/dev.
@changeset-bot

changeset-bot Bot commented Sep 10, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 72f15ca

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 Minor
@pandacss/astro-plugin-studio Minor
@pandacss/config Minor
@pandacss/core Minor
@pandacss/extractor Minor
@pandacss/generator Minor
@pandacss/is-valid-prop Minor
@pandacss/logger Minor
@pandacss/mcp Minor
@pandacss/node Minor
@pandacss/parser Minor
@pandacss/plugin-lightningcss Minor
@pandacss/plugin-svelte Minor
@pandacss/plugin-vue Minor
@pandacss/postcss Minor
@pandacss/preset-atlaskit Minor
@pandacss/preset-base Minor
@pandacss/preset-open-props Minor
@pandacss/preset-panda Minor
@pandacss/reporter Minor
@pandacss/shared Minor
@pandacss/studio Minor
@pandacss/token-dictionary Minor
@pandacss/types Minor

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

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
panda-docs Ignored Ignored Preview Sep 10, 2026 11:50pm UTC

Request Review

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

@castrog is attempting to deploy a commit to the Chakra UI Team on Vercel.

A member of the Team first needs to authorize it.

Comment thread packages/cli/__tests__/define.test.ts
Exercise the built ESM and CommonJS package exports so source aliases cannot hide a missing or misconfigured distribution artifact.
@castrog castrog changed the title feat(dev): add a bundleable define entry point feat(dev): add a bundleable define entry point [Panda v1] Sep 10, 2026
Generate the package export fixture in a temporary directory so the test cannot depend on missing or stale dist output.

This branch has not been deployed

No deployments
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