@astrojs/cloudflare@14.2.0
📦 astroView on GitHub →
✨ 2 features🐛 4 fixes🔧 14 symbols
Summary
This release introduces opt-in build-time image optimization for the Cloudflare binding and supports experimental incremental static builds. It also includes several bug fixes related to image handling and type checking.
Migration Steps
- To opt in to build-time image optimization for the `cloudflare-binding` image service, update your `astro.config.js` to use the compound configuration form: `imageService: { build: 'cloudflare-binding', runtime: 'cloudflare-binding' }`.
✨ New Features
- Adds opt-in build-time image optimization for the `cloudflare-binding` image 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.
- Supports Astro's experimental incremental static builds. When `experimental.incrementalBuild` is enabled, the adapter skips unchanged pages between builds.
🐛 Bug Fixes
- Fixes `/_image` returning 500 in dev mode when using `imageService: 'custom'`. The `custom` and fallback cases now use the generic fetch-based endpoint in dev, matching the other image service modes. A user-configured `image.endpoint` is left untouched.
- Fixes a crash on `/_image` cache hits when the Cloudflare cache provider is enabled. The handler now rebuilds the response with mutable headers when needed.
- Fixes `imageService: 'compile'` producing unoptimized images when `prerenderEnvironment` is set to `'node'`
- Fixes a type-checking error when using `app.use(cf())` from `@astrojs/cloudflare/hono` in projects with `wrangler types`-generated `ExecutionContext` declarations