Skip to content

feat(compiler): design-system manifest value + engine gen/load#3604

Open
Adebesin-Cell wants to merge 15 commits into
chakra-ui:v2from
Adebesin-Cell:design-system-manifest
Open

feat(compiler): design-system manifest value + engine gen/load#3604
Adebesin-Cell wants to merge 15 commits into
chakra-ui:v2from
Adebesin-Cell:design-system-manifest

Conversation

@Adebesin-Cell

@Adebesin-Cell Adebesin-Cell commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

what

introduce first-class design systems, starting with the manifest.

  • a design note for the whole feature: designSystem: '@acme/ds' backed by a panda.lib.json manifest that ties a library's preset, build info, import paths, and its own parent design system into one resolvable unit.
  • the engine primitives over that manifest, exposed as compiler.designSystem across the native and wasm bindings:
    • create — produce a manifest from a built project (panda lib, later).
    • validate — schema check.
    • load — the consumer side: validate the manifest, then hydrate the library's pre-extracted styles, tree-shaken to the consumer's imports.
    • resolveChain — the composition case: order a chain of parent design systems root-first, deduping shared ancestors and reporting cycles.

why

adopting a design system today means hand-wiring presets + importMap + include + a buildinfo path, and re-extracting every imported component in every app. the manifest collapses that to one field.

the hard logic — generation, consumption, and the parent-chain walk — is pure compiler methods over in-memory values. the engine owns it, the host owns fs + module resolution. so the bug-prone parts (version guard, resolve + hydrate, and the cycle guard in the chain walk) are testable without touching disk.

notes

  • engine primitives only. no designSystem config field, no panda lib CLI yet. the config field, host module resolution, smart include, and panda lib are later phases — laid out in the design note.
  • load covers the build-info half of consumption. the preset + importMap merge into the consumer config is the host's job: the value layer can't execute the preset module. on any incompatibility load returns { ok: false, reason } so the host falls back to re-extracting the manifest's files.
  • resolveChain takes the manifests the host already read and returns the root-first merge/hydrate order (or a cycle path). a parent absent from the set is a chain boundary — the host owns parent-not-found via module resolution.
  • create stamps the schema version and carries host-supplied fields today; importMap and the parent designSystem come from resolved config in phase 2. the input shape already allows them, so that lands without a signature change.
  • the design note resolves the prior open questions as decisions (manifest location, stale-buildinfo fallback, token conflict, condition reconciliation, staticCss, layer ordering). three genuinely-open items remain.

test plan

  • cargo test -p pandacss_project --test integration design_system — manifest value (stamp + carry, optional omission, json round-trip) + chain resolution (depth-n order, shared-parent dedup, absent-parent boundary, cycle path, empty set)
  • native vitest design-system (15: create/validate, load hydrate + tree-shake + mismatch, resolveChain order/dedup/cycle) + build-info (17, no regression)
  • wasm vitest design-system (9: create/validate + load + resolveChain over the boundary) + build-info (3)
  • pnpm typecheck
  • cargo fmt --all --check; clippy on pandacss_project, compiler_napi, compiler_wasm
  • rebuilt compiler.node + wasm bundle so the binding tests ran against the new methods

phase 1 of designSystem support. adds the panda.lib.json manifest type and
Project::design_system_manifest, exposed as compiler.designSystem (create +
validate) across native and wasm. pure (no fs); no config field or CLI yet.
@changeset-bot

changeset-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: d6b24be

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

This PR includes changesets to release 15 packages
Name Type
@pandacss/compiler Patch
@pandacss/compiler-wasm Patch
@pandacss/compiler-shared Patch
@pandacss/cli Patch
@pandacss/dev Patch
@pandacss/eslint-plugin Patch
@pandacss/mcp Patch
@pandacss/postcss Patch
@pandacss/vite Patch
playground Patch
@pandacss/config Patch
website Patch
@pandacss/preset-base Patch
@pandacss/preset-panda Patch
@pandacss/types Patch

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 Jun 18, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
panda-docs Error Error Jun 23, 2026 1:27am

Request Review

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@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.

The wasm binding had no manifest coverage; native had no error-path coverage.
Add a wasm design-system suite mirroring native (create/stamp, importMap
object parity, optional omission, validate) plus missing-required, unknown-field,
and empty-files edges on native.
ac3eba5 made normalize_leaf a no-op so utility class names keep authored
segments; atoms() now carries authored values (CSS still resolves at emit).
The native callbacks test was updated then; the wasm one was missed.
Add load() to the compiler.designSystem namespace: the consumer side of
the design-system manifest. It validates the manifest, then resolves and
hydrates the library's pre-extracted styles, tree-shaken to the consumer's
imports. Composed over the existing buildInfo primitives so the resolve +
hydrate logic stays in one place; the preset/importMap merge is the host's,
since the value layer can't execute the preset module.

Covered on native + wasm bindings and the fallback.
Add resolveChain to the compiler.designSystem namespace: the composition
case. Given the manifests the host already read, order a chain of parent
design systems root-first, dedup shared ancestors, and report cycles —
pure value logic (resolve_chain in pandacss_project) with no fs, so the
recursion + cycle guard are exercised in-memory.

Exposed across native + wasm bindings and the fallback.
# Conflicts:
#	packages/compiler/src/index.ts
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