[image-optimization] Expose `next/image-optimizer-transform` as a public subpath (#99312)
Vercel's proxy service runs the image optimizer transform step in a child process and imports `next/dist/server/image-optimizer/transform` directly, which pins an internal file layout that should be free to change. This PR exposes the module as the public subpath `next/image-optimizer-transform`, following the existing `next/og` pattern of a root-level pass-through plus a type stub registered in the package `files` array. The new entry also re-exports `ImageError` and `getMaxAge` (both already in the module's dependency graph) so consumers can drop every deep `next/dist/server/image-optimizer/*` import, and the module header now states that its location and export surface are a stable contract. The existing unit test imports the module through the new subpath to keep it exercised, and a new API reference page documents `imageOptimizerTransform`, `optimizeImage`, `getSharp`, `getMaxAge`, and `ImageError`. Verified with `pnpm test-unit test/unit/image-optimizer/transform.test.ts` (passes through the new subpath), `pnpm --filter=next types`, and an `npm pack --dry-run` confirming both stub files ship in the tarball. The 22 failures in the broader unit run reproduce on clean canary and are unrelated to this change.
Showing
This diff is collapsed.
Please
register
or
sign in
to comment