mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #385] [CLOSED] fix(image): align next/image API with Next.js 16.0.0 #533
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#533
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/385
Author: @Divkix
Created: 3/9/2026
Status: ❌ Closed
Base:
main← Head:fix/align-image-api-nextjs-16📝 Commits (10+)
bef7956fix(image): align next/image API surface with Next.js 16.0.0e75dcf5fix(image): address PR #385 review feedback6409016fix(image): remove dead allowedQualities param, fix remote data:image/ placeholder00283e6fix(image): add missing fetchPriority to custom loader path, add AVIF/preload tests4c7efb8fix(image): align next/image contract with next 16122d968fix(image): address lint warnings9161747fix(image): stabilize parity test falloutaf91d37fix(image): tighten optimizer securityf49db87fix(image): address PR review feedbacke8b4b08test(image): add security-critical test coverage for image optimization📊 Changes
27 files changed (+6789 additions, -1306 deletions)
View changed files
📝
.agents/skills/migrate-to-vinext/references/compatibility.md(+25 -25)📝
README.md(+30 -30)📝
examples/app-router-cloudflare/worker/index.ts(+25 -3)📝
packages/vinext/src/config/next-config.ts(+157 -15)📝
packages/vinext/src/deploy.ts(+35 -9)📝
packages/vinext/src/global.d.ts(+28 -1)📝
packages/vinext/src/index.ts(+42 -1)📝
packages/vinext/src/server/image-optimization.ts(+652 -188)📝
packages/vinext/src/server/prod-server.ts(+69 -61)➕
packages/vinext/src/shims/image-blur-svg.ts(+36 -0)📝
packages/vinext/src/shims/image-config.ts(+133 -67)📝
packages/vinext/src/shims/image.tsx(+807 -415)📝
packages/vinext/src/shims/next-shims.d.ts(+22 -38)📝
tests/__snapshots__/entry-templates.test.ts.snap(+1 -1)📝
tests/deploy.test.ts(+1 -1)📝
tests/fixtures/ecosystem/next-intl/vite.config.ts(+6 -0)📝
tests/fixtures/ecosystem/nuqs/vite.config.ts(+11 -0)📝
tests/fixtures/ecosystem/validator/vite.config.ts(+3 -0)➕
tests/image-blur-svg.test.ts(+166 -0)📝
tests/image-component.test.ts(+1262 -357)...and 7 more files
📄 Description
Closes #386
Summary
Aligns vinext's
next/imageimplementation with the Next.js 16.0.0 API surface. Any library or app code written against Next.js 16's image API should now work on vinext without modification.Changes
blurWidthandblurHeightoptional fields16→[32, 48, 64, 96, 128, 256, 384](matches Next.js 16)"inline"→"attachment"(security — prevents XSS via image endpoint)preloadprop: New prop replacing deprecatedpriority(both now triggerloading="eager"+fetchPriority="high")qualitiesconfig: Addimages.qualitiessupport withfindClosestQuality()rounding and server-side validationMath.max(quality - 20, 1)for AVIF inhandleImageOptimization(matches Next.js)onLoadingComplete,layout,objectFit,objectPosition,lazyBoundary,lazyRoot"blur" | "empty" | \data:image/${string}``number | \${number}`` with automatic string→number parsingStaticRequire,StaticImport,ImageLoaderProps,ImagePropsparseImageParamsWhat's deferred
localPatterns,minimumCacheTTL,loader/loaderFileglobal config,disableStaticImages,maximumRedirects,dangerouslyAllowLocalIP,images.unoptimizedglobal,@hapi/acceptnegotiation, and strictw/qrequired params — these are either not yet needed or would break existing vinext users.Test plan
pnpm test tests/image-component.test.ts— 41 tests pass (new tests for preload, deprecated props, string dims, data placeholder, StaticImport, type exports)pnpm test tests/image-imports.test.ts— 20 tests passpnpm test tests/shims.test.ts— 577 pass (updated DEFAULT_IMAGE_SIZES and contentDisposition default assertions)pnpm test tests/deploy.test.ts— 193 tests passpnpm test tests/image-config.test.ts— 33 tests passpnpm run typecheck— no new errors (pre-existing__NEXT_DATA__errors only)pnpm run lint— clean🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.