Add support for Cloudflare images binding in environment API#14358
Merged
ascorbic merged 8 commits intofeat/environment-apifrom Sep 15, 2025
Merged
Add support for Cloudflare images binding in environment API#14358ascorbic merged 8 commits intofeat/environment-apifrom
ascorbic merged 8 commits intofeat/environment-apifrom
Conversation
|
Base automatically changed from
env-api-content-layer
to
feat/environment-api
September 15, 2025 13:34
florian-lefebvre
approved these changes
Sep 15, 2025
| // @ts-expect-error The Header types between libdom and @cloudflare/workers-types are causing issues | ||
| export const GET: APIRoute = async (ctx) => { | ||
| // @ts-expect-error The runtime locals types are not populated here | ||
| return transform(ctx.request.url, ctx.locals.runtime.env.IMAGES, ctx.locals.runtime.env.ASSETS); |
Member
There was a problem hiding this comment.
I think we should have a similar mechanism for the assets binding, IIUC?
Suggested change
| return transform(ctx.request.url, ctx.locals.runtime.env.IMAGES, ctx.locals.runtime.env.ASSETS); | |
| return transform(ctx.request.url, ctx.locals.runtime.env[__ASTRO_IMAGES_BINDING_NAME], ctx.locals.runtime.env.ASSETS); |
Contributor
Author
Comment on lines
+13
to
+14
| export async function transform(rawUrl: string, images: ImagesBinding, assets: Fetcher) { | ||
| const url = new URL(rawUrl); |
Member
There was a problem hiding this comment.
I think we already pass the url from the endpoint
Suggested change
| export async function transform(rawUrl: string, images: ImagesBinding, assets: Fetcher) { | |
| const url = new URL(rawUrl); | |
| export async function transform(url: URL, images: ImagesBinding, assets: Fetcher) { |
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.
Changes
Adds support for Cloudflare image binding service, from #14027. This is the only service that works with the environment API at the moment. Eventually we'll need to work out what to do with the other services in dev.
Stacked on #14357 so it can use the content layer in testing
Testing
Docs