Summary
@stacksjs/stx and bun-plugin each carry the client signals runtime (the browser-side x-if/x-for/x-else engine). bun-plugin bundles its own copy at build time (Bun inlines it from @stacksjs/stx). So when the runtime in @stacksjs/stx/src/signals.ts changes — e.g. #1734 adding reactive x-else / x-else-if — rebuilding @stacksjs/stx updates its dist, but bun-plugin/dist keeps the snapshot from whenever it was last built. Since apps render through bun-plugin-stx/serve, the injected runtime is the stale one, and the new directives silently don't work (x-else is treated as an orphan → branches mis-render).
Evidence (current repo state)
packages/stx/dist—x-elsepresent (rebuilt with #1734): ~650 matchespackages/bun-plugin/dist—x-else: 0 (not rebuilt)- The injected client runtime lives in the bun-plugin bundle —
packages/bun-plugin/dist/ installedbun-plugin-stx/dist/chunk-*.jscontainsbindIf/x-else-if/stx-if-chain. packages/bun-plugin/src/index.tsimports processing/runtime from@stacksjs/stx(processDirectives,renderToString,processSignals, …), so Bun inlines a copy intobun-plugin/distat build time.- Both packages are
0.2.67, and the published@stacksjs/stx@0.2.67/bun-plugin-stx@0.2.67predate #1734 — so no version signals "has x-else", and the two packages can be mutually out of sync at the same version.
Impact
Consumers using bun-plugin-stx/serve (the documented dev/prod path) can't use reactive directives newly added to stx until bun-plugin is independently rebuilt and republished. The lockstep 0.2.67 version makes the staleness invisible — bun install won't fix it.
Repro
@stacksjs/stx/src/signals.tsgainsx-else(#1734); rebuild@stacksjs/stxonly.- Don't rebuild
bun-plugin. - In an app on
bun-plugin-stx/serve, write<div x-if="a">…</div><div x-else>…</div>. - The
x-elsebranch renders as a plain element (orphan warning) — the fix has no effect.
Suggested fixes (any one)
- Rebuild + republish
bun-pluginwhenever the@stacksjs/stxruntime changes; bump both versions together on release. - CI guard that fails if
bun-plugin/dist's runtime diverges from@stacksjs/stx/dist(or rebuildbun-plugininside the stx build pipeline). - Single-source the client runtime: have
bun-pluginload/re-export it from@stacksjs/stxinstead of bundling a private copy, so a stx version bump is sufficient.
Found while adopting #1734 (x-else) in a downstream app — the directive works once bun-plugin is rebuilt, but not via the published bun-plugin-stx.