13.6.0
Minor Changes
-
#16729
01aa164Thanks @matthewp! - Adds@astrojs/cloudflare/fetchand@astrojs/cloudflare/honoexports for composing Cloudflare-specific setup with Astro's advanced routing handlers.@astrojs/cloudflare/fetchFor use with
astro/fetchin a custom fetch handler:import { astro, FetchState } from 'astro/fetch'; import { cf } from '@astrojs/cloudflare/fetch'; export default { async fetch(request: Request, env: Env, ctx: ExecutionContext) { const state = new FetchState(request); const asset = await cf(state, env, ctx); if (asset) return asset; return astro(state); }, };
@astrojs/cloudflare/honoFor use with
astro/honoas Hono middleware:import { Hono } from 'hono'; import { actions, middleware, pages, i18n } from 'astro/hono'; import { cf } from '@astrojs/cloudflare/hono'; const app = new Hono<{ Bindings: Env }>(); app.use(cf()); app.use(actions()); app.use(middleware()); app.use(pages()); app.use(i18n()); export default app;
Both handlers configure SESSION KV bindings, static asset serving via the ASSETS binding,
locals.cfContext, client address,waitUntil, and prerendered error page fetch.
Patch Changes
-
#16868
f9bae95Thanks @helio-cf! - Fixes user options passed tocloudflare({...})(remoteBindings,inspectorPort,persistState,configPath,auxiliaryWorkers) being silently ignored duringastro preview. The adapter now resolves the full@cloudflare/vite-pluginconfig once at integration setup time and reuses that single resolved value across the dev/build plugin, the prerenderer's preview server, and theastro previewentrypoint, so user options can no longer be dropped at one of the call sites. -
#16468
4cff3a1Thanks @matthewp! - Fixes static Cloudflare builds with server islands or image endpoints that failed at preview time due to mismatched output directories. -
Updated dependencies [
f732f3c]:- @astrojs/internal-helpers@0.10.0
- @astrojs/underscore-redirects@1.0.3