feat(images): expose variant base URL + align next/image sizes (BE-4)#477
Merged
Conversation
Wires the responsive-variant delivery config so the gallery loader (FE-3)
can activate, and provides the storage resolution the preprocessing queue
(BE-3) will use to upload variants.
- server/lib/variant-storage.ts: resolves the configured variant storage
backend (`variant_storage` = s3 | r2; empty disables the pipeline).
- getVariantBaseUrl(): public base URL for variants (no trailing slash,
folder included) — built from the backend's existing public-URL config
(s3 cdn/endpoint/path-style, or r2 public domain). '' when unconfigured.
- resolveVariantStorage(): backend client + bucket + folder + base, for
the BE-3 upload path.
- Open List is intentionally unsupported (no predictable variant URL).
- getDisplayConfig / getAlbumDisplayConfig: fill GalleryDisplayConfig
.variantBaseUrl (the field FE-3 added). Empty -> loader sleeps and falls
back to the preview/blurhash ladder, so this is safe before any backfill.
- next.config: imageSizes [320,480] + deviceSizes [640..2560] aligned to the
pipeline tier ladder so next/image only requests generated widths.
- seed: add the `variant_storage` config key.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
BE-4 — variant delivery config
Part of the image-performance overhaul (parent task #1). This wires the responsive-variant delivery config, which (a) lets the merged FE-3 gallery loader activate, and (b) provides the storage resolution the preprocessing queue (BE-3) will use to upload variants.
What
server/lib/variant-storage.ts— resolves the configured variant storage backend (variant_storage=s3|r2; empty disables the pipeline):getVariantBaseUrl()— public base URL for variants (no trailing slash, storage folder already included), derived from the backend's existing public-URL config (S3 cdn / endpoint / path-style, or R2 public domain). Returns''when unconfigured.resolveVariantStorage()— backend client + bucket + folder + base, for the BE-3 upload path.{key}_{w}.{fmt}pattern the client loader can rebuild) → those images keep the preview/blurhash fallback.getDisplayConfig/getAlbumDisplayConfig— fillGalleryDisplayConfig.variantBaseUrl(the field FE-3 added). Empty → the loader sleeps and falls back to preview/blurhash, so this is safe to merge before any backfill exists.next.config—imageSizes: [320,480]+deviceSizes: [640,800,1080,1280,1920,2560], aligned to the pipeline tier ladder sonext/imageonly ever requests widths the pipeline generates.variant_storageconfig key (default empty).Contract (with FE-3, locked)
Loader builds
{variantBaseUrl}/{image_key}_{w}.{fmt};variantBaseUrlalready includes the storage folder. Matches BE-2'sbuildVariantKey+ tier ladder.Notes / scope
variant_storageand BE-3 backfills variants — until thenvariantBaseUrlis''and the gallery behaves as today (minus the removed 20MB-original fallback from FE-3).buildVariantKeyinto a client-safe module so FE-3's loader imports the same source instead of mirroring the constants.Verification
tsc --noEmit: no errors in changed files.eslint --fix: clean. Rebased on currentmain(incl. FE-3), soGalleryDisplayConfig.variantBaseUrlis the existing field — no type duplication.🤖 Generated with Claude Code