Skip to content

Split @bearbones/vite into @klinking/panda-markers + @klinking/panda-shorthand#11

Merged
dogmar merged 3 commits into
mainfrom
claude/nervous-thompson-c451ea
May 4, 2026
Merged

Split @bearbones/vite into @klinking/panda-markers + @klinking/panda-shorthand#11
dogmar merged 3 commits into
mainfrom
claude/nervous-thompson-c451ea

Conversation

@dogmar
Copy link
Copy Markdown
Collaborator

@dogmar dogmar commented May 4, 2026

Summary

Splits the monolithic @bearbones/vite package into two independent Panda plugins under the @klinking scope so consumers can install only the feature they want.

  • @klinking/panda-utils (renamed from @bearbones/utils, expanded private workspace) — hosts the shared codegen-patch contributor API, AST anchor locator, transform-skeleton helpers, and the inline-templates Vite plugin (on a separate ./build entry). Inlined into both plugin packages via deps.alwaysBundle.
  • @klinking/panda-shorthand (renamed from @bearbones/vite, marker code stripped) — owns css() utility-string lowering only.
  • @klinking/panda-markers (new package) — owns marker() declarations + relational-chain key lowering. Folds in the _dark/_light conditions from the now-deleted @bearbones/preset.

Each plugin exports four shapes per the Panda hook-sharing pattern (https://panda-css.com/docs/concepts/hooks#sharing-hooks):

  • *Preset()definePreset() for theme/conditions.
  • *Plugin()definePlugin() named plugin bundling hooks.
  • *Hooks() — raw hooks object for hand-wired configs.
  • *VitePlugin() — dev-server transform.

Architecture

The shared codegen-patch is contributor-style: each plugin builds its own CssDtsPatch[] / CssMjsPatch[] and the shared appliers in @klinking/panda-utils compose them via magic-string. The two plugins commute on disjoint AST node types — markers replaces computed property keys and the marker() RHS, shorthand replaces string-literal arg values — so install order doesn't matter.

apps/website migrated to the new API:

// panda.config.ts
import { markersPreset, markersPlugin } from "@klinking/panda-markers";
import { shorthandPlugin } from "@klinking/panda-shorthand";

export default defineConfig({
  conditions: markersPreset().conditions,
  plugins: [markersPlugin(), shorthandPlugin()],
  // ...
});

// vite.config.ts
plugins: [markersVitePlugin(), shorthandVitePlugin(), react()]

Root vite.config.ts task DAG updated for the new package names.

Follow-up

#10 tracks eliminating both Vite plugins by patching css.mjs with a runtime css() shim (utility-string lowering at runtime) — would make these packages bundler-agnostic, working anywhere Panda works without per-bundler integrations. Out of scope for this PR; current Vite-plugin architecture is preserved.

Test plan

  • vp run -r build succeeds across all 5 workspaces
  • vp run -r test — all 88 unit tests pass (49 markers + 22 shorthand + 17 utils)
  • vp check clean (formatting + lint + types)
  • apps/website panda codegen emits a css.d.ts with both feature splices (17 Bearbones* references) and css.mjs with the marker stub
  • Website tsc passes (type-tests still match against the patched css.d.ts)
  • Website vp build produces a clean bundle
  • Smoke-test vp dev end-to-end in a browser

🤖 Generated with Claude Code

dogmar and others added 3 commits May 3, 2026 21:36
Splits the monolithic @bearbones/vite package into two independent Panda
plugins so consumers can install only the feature they want, and aligns
the npm names with the @Klinking scope.

- packages/panda-utils (renamed from @bearbones/utils, expanded private
  workspace): now hosts the shared codegen-patch contributor API, the AST
  anchor locator, transform-skeleton helpers, and the inline-templates
  Vite plugin (separate ./build entry). Inlined into both plugins via
  deps.alwaysBundle.

- packages/panda-shorthand (renamed from @bearbones/vite, marker code
  stripped): owns the css() utility-string lowering only. Exports
  shorthandPreset(), shorthandPlugin() (definePlugin), shorthandHooks()
  (raw hooks bundle), and shorthandVitePlugin().

- packages/panda-markers (new): owns marker() declarations + relational-
  chain key lowering (StyleX-style .is.<relation>). Same four-shape API.
  Folds in the _dark/_light conditions from the now-deleted
  @bearbones/preset.

The shared codegen-patch is now contributor-style: each plugin emits
CssDtsPatch[] / CssMjsPatch[] and the shared appliers compose them via
magic-string. The two plugins commute on disjoint AST nodes — markers
replaces computed keys + the marker() RHS, shorthand replaces string-
literal arg values — so order between the two doesn't change output.

apps/website migrated to the new API. The current Vite-plugin
architecture is preserved; #10 tracks the follow-up that would eliminate
both Vite plugins via a runtime css() shim in the patched css.mjs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI was failing because the root package.json check script still used
`--filter '@bearbones/*'` after the package rename. Also cleaned up
stale @bearbones comment references in marker-registry and template.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dogmar dogmar merged commit f9d75e6 into main May 4, 2026
2 checks passed
@dogmar dogmar deleted the claude/nervous-thompson-c451ea branch May 4, 2026 07:31
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