Repository navigation
chore(build): apply signaliumPreset to lib build (vite.config.ts) - #34
Closed
jimmy-phantom wants to merge 1 commit into
Closed
jimmy-phantom wants to merge 1 commit into
jimmy-phantom wants to merge 1 commit into
Conversation
Mirror the vitest react-project config: pass
{ babel: { presets: [signaliumPreset()] } } to react() in vite.config.ts
so fetchium's own reactive callsites are transformed in the published
bundle, consistent with how the test environment transforms them.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
jimmy-phantom
force-pushed
the
fix-lib-build-signalium-preset
branch
from
May 22, 2026 22:04
46c9cee to
b4ab225
Compare
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.
Context
Today the Signalium Babel preset is configured in
packages/fetchium/vitest.config.ts(test environment) but NOT inpackages/fetchium/vite.config.ts(lib build). The publisheddist/ships fetchium's source untransformed. Consumers can't fix this from their side because bundlers don't recompilenode_modulesby default.What this PR does
Adds
signaliumPreset()tovite.config.ts'sreact()plugin, mirroring the vitest react-project config:That's the entire functional change. A
patchchangeset is included with a hygiene-only framing.What this PR does NOT fix
PR #33 (
fix(react): stabilize useQuery thunk identity across re-renders) addressed a downstream consumer bug whereuseQueryproduced a fresh signal per render under React 18 / React Native commit ordering. That PR's fix lives at the source level (useMemo+hashValue(args)) and works regardless of whether the preset runs.Applying the preset alone does NOT fix that bug. The preset would produce
useReactive(useCallback(fn, [QueryClass, args])), butargsis the rest collection (fresh array literal per call), soObject.isdeps compare false every render anduseCallbackreturns a new fn anyway. This was confirmed empirically by a downstream consumer who built fetchium with the preset applied and re-ran the original repro: the bug still fired with structurally-identical traces.So this PR is purely about lib-build/vitest-config consistency, not about fixing any specific runtime issue.
Caveats worth reviewer attention
The preset rewrites all inline arrows at fetchium's reactive callsites:
relay(state => ...),reactiveSignal(() => ...),reactiveMethod(proxy, methods[prop].bind(proxy)), etc. Fetchium has roughly 12 such sites acrossEntityInstance.ts,QueryResult.ts,LiveCollection.ts. After this change the published bundle's behavior at those sites changes from "inline arrow per call" to "preset-rewritten form" (whatever the callback/async/promise/useReactive transforms produce).I have NOT done a diff-the-bundle audit at each affected callsite to confirm semantics are preserved. The test suite (1235 tests) passes with the preset applied, which is some signal but not conclusive — the tests already run against transformed code, so they don't reveal transformed-vs-untransformed parity gaps.
Open question for the Signalium team
Is lib-ships-untransformed the intended design, with consumers expected to configure their bundler to also transform fetchium's
node_modulespath? Or is the convention that lib authors should apply the preset in their own build?If the latter, this PR is straightforward and we should ship after the bundle audit. If the former, this PR should close.
🤖 Generated with Claude Code