refactor(images): extract client-safe variant tier constants#479
Merged
Conversation
Move the variant tier ladder (VARIANT_TIER_WIDTHS), format helpers (VARIANT_FORMATS, variantContentType), key builder (buildVariantKey) and tierWidthsForSource into a new client-safe module ~/lib/image/variant-tiers with no server-only dependencies. server/lib/image-variants.ts re-exports them (behavior-preserving), so the preprocessing pipeline keeps its existing import surface. The client-side gallery loader (lib/image/loader.ts) can now import the same module instead of mirroring the constants, eliminating the duplicated source of truth that FE-3 had to maintain by hand. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
pull Bot
pushed a commit
to xqd922/PicImpact
that referenced
this pull request
May 30, 2026
besscroft#479 extracted the client-safe variant tier ladder and key helpers into lib/image/variant-tiers.ts (the single source of truth, re-exported by the server-only image-variants.ts). Switch the client loader to import VARIANT_TIER_WIDTHS / buildVariantKey / VariantFormat from it instead of the previously mirrored local copies, eliminating the dual source of truth flagged in the FE-3 review. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Extract client-safe variant tier constants
Follow-up to the variant work (parent task #1), coordinated with @Picimpact-Design.
FE-3's gallery loader (
lib/image/loader.ts) currently mirrors the variant tier ladder andbuildVariantKeyby hand, because they lived inserver/lib/image-variants.tswhich isserver-onlyand can't be imported client-side. That's two sources of truth that can drift.Change
lib/image/variant-tiers.ts(client-safe, noserver-only/sharp/AWS deps):VARIANT_TIER_WIDTHS,VARIANT_FORMATS,VariantFormat,variantContentType,buildVariantKey,tierWidthsForSource.server/lib/image-variants.tsimports + re-exports them (behavior-preserving — its public import surface is unchanged, so the pipeline keeps working).Follow-up
@Picimpact-Design will then update
lib/image/loader.tsto import from this shared module and delete its mirrored constants, removing the drift caveat noted in FE-3 review.Verification
tsc --noEmit: no errors.eslint --fix: clean. Pure move + re-export, no logic change.🤖 Generated with Claude Code