@astrojs/cloudflare@14.2.0
Minor Changes
-
#16194
2a59663Thanks @Daedalus-Icarus! - Adds opt-in build-time image optimization for thecloudflare-bindingimage service.When enabled, the Cloudflare IMAGES binding transforms static images in the workerd prerender environment, and the optimized bytes are written directly to the output directory. If the binding fails, it falls back to Sharp.
To opt in, use the compound configuration form:
export default defineConfig({ adapter: cloudflare({ imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' }, }), });
The string shorthand
imageService: 'cloudflare-binding'preserves the current runtime-only behavior and is unaffected. -
#16871
90c98aeThanks @adamchal! - Whensession: falseis set inastro.config, the adapter no longer auto-wires the Cloudflare KV session driver. Combined with the matchingastrochange, this lets the session runtime tree-shake out of the Worker bundle. -
#17084
961bbe5Thanks @matthewp! - Supports Astro's experimental incremental static builds. Whenexperimental.incrementalBuildis enabled, the adapter skips unchanged pages between builds.
Patch Changes
-
#17576
0a79753Thanks @alexanderniebuhr! - Fixes/_imagereturning 500 in dev mode when usingimageService: 'custom'. Astro's default dev image endpoint importsviteandnode:fs, which cannot be loaded inside workerd. Thecustomand fallback cases now use the generic fetch-based endpoint in dev, matching the other image service modes. A user-configuredimage.endpointis left untouched.Additionally, a dev-time warning is now logged when
imageService: 'custom'resolves to the Sharp service (including when noimage.serviceis configured), since Sharp's native binding cannot run inside workerd in dev or production. -
#17481
0c32649Thanks @ondraulehla! - Fixes a crash on/_imagecache hits when the Cloudflare cache provider is enabled. Responses served from the Workers Cache API have immutable headers, and the request handler crashed with "Can't modify immutable headers" when applying its defaultCloudflare-CDN-Cache-Control: no-storeheader to them. The handler now rebuilds the response with mutable headers when needed. -
#17347
ce83c39Thanks @astrobot-houston! - FixesimageService: 'compile'producing unoptimized images whenprerenderEnvironmentis set to'node' -
#17594
2b8915aThanks @astrobot-houston! - Fixes a type-checking error when usingapp.use(cf())from@astrojs/cloudflare/honoin projects withwrangler types-generatedExecutionContextdeclarations -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.3