@astrojs/cloudflare
π Patch Changes
- Updated dependencies [
1e2499e]:- @astrojs/internal-helpers@0.7.3
- @astrojs/underscore-redirects@1.0.0
- Updated dependencies [
π Patch Changes
-
#14326
c24a8f4Thanks @jsparkdev! - Updatesviteversion to fix CVE -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
-
9ecf359Thanks @alexanderniebuhr! - Improves the image proxy endpoint when using the default compile option to adhere to user configuration regarding the allowed remote domains -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
-
#14259
02366e9Thanks @ascorbic! - Removes warning when using the adapter with a static build.The Cloudflare adapter now has several uses outside of on-demand rendered pages, so this warning is misleading. Similar warnings have already been removed from other adapters.
-
#14234
15b55f3Thanks @yanthomasdev! - Fixes an issue that could cause duplicate exports when configuringworkerEntrypoint.namedExports -
#14240
77b18fbThanks @delucis! - Increases the minimum supported version of Astro to 5.7.0 -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
- Updated dependencies [
4d16de7]:- @astrojs/internal-helpers@0.7.2
- @astrojs/underscore-redirects@1.0.0
- Updated dependencies [
π Patch Changes
-
#14066
7abde79Thanks @alexanderniebuhr! - Refactors the internal solution which powers Astro Sessions when running local development with Λastro devΛ.The adapter now utilizes Cloudflareβs local support for Cloudflare KV. This internal change is a drop-in replacement and does not require any change to your projectct code.
However, you now have the ability to connect to the remote Cloudflare KV Namespace if desired and use production data during local development.
-
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
-
#13894
b36e72fThanks @florian-lefebvre! - Removes special handling of theASTRO_STUDIO_APP_TOKENenvironment variable -
Updated dependencies [
0567fb7]:- @astrojs/internal-helpers@0.7.1
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
- Updated dependencies [
f4e8889]:- @astrojs/internal-helpers@0.7.0
- @astrojs/underscore-redirects@1.0.0
- Updated dependencies [
πΏ Minor Changes
-
#13837
7cef86fThanks @alexanderniebuhr! - Adds new configuration options to allow you to set a customworkerEntryPointfor Cloudflare Workers. This is useful if you want to use features that require handlers (e.g. Durable Objects, Cloudflare Queues, Scheduled Invocations) not supported by the basic generic entry file.This feature is not supported when running the Astro dev server. However, you can run
astro buildfollowed by eitherwrangler deploy(to deploy it) orwrangler devto preview it.The following example configures a custom entry file that registers a Durable Object and a queue handler:
astro.config.ts import cloudflare from '@astrojs/cloudflare';import { defineConfig } from 'astro/config';export default defineConfig({adapter: cloudflare({workerEntryPoint: {path: 'src/worker.ts',namedExports: ['MyDurableObject'],},}),});src/worker.ts import type { SSRManifest } from 'astro';import { App } from 'astro/app';import { handle } from '@astrojs/cloudflare/handler';import { DurableObject } from 'cloudflare:workers';class MyDurableObject extends DurableObject<Env> {constructor(ctx: DurableObjectState, env: Env) {super(ctx, env);}}export function createExports(manifest: SSRManifest) {const app = new App(manifest);return {default: {async fetch(request, env, ctx) {await env.MY_QUEUE.send('log');return handle(manifest, app, request, env, ctx);},async queue(batch, _env) {let messages = JSON.stringify(batch.messages);console.log(`consumed from our queue: ${messages}`);},} satisfies ExportedHandler<Env>,MyDurableObject,};}
π Patch Changes
-
#13963
c667c55Thanks @florian-lefebvre! - Fixes a case where the platform proxy would not be disposed when the dev process ended -
Updated dependencies []:
- @astrojs/underscore-redirects@1.0.0
-
π Patch Changes
-
#13817
b7258f1Thanks @yanthomasdev! - Clarifies and reduces a few logs when starting the dev server with@astrojs/cloudflare.Warnings about sharp support will now be suppressed when you have explicitly set an
imageServiceoption. -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.1
-
π Patch Changes
-
#13792
7910feaThanks @alexeyzimarev! - Unify imported images detection across adapters -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.1
-
π Patch Changes
-
#13731
c3e80c2Thanks @jsparkdev! - update vite to latest version for fixing CVE -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.1
-
π Patch Changes
-
#13591
5dd2d3fThanks @florian-lefebvre! - Removes unused code -
Updated dependencies [
5dd2d3f]:- @astrojs/underscore-redirects@0.6.1
-
πΏ Minor Changes
-
#13527
2fd6a6bThanks @ascorbic! - The experimental session API introduced in Astro 5.1 is now stable and ready for production use.Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:
---export const prerender = false; // Not needed with 'server' outputconst cart = await Astro.session.get('cart');---<a href="/checkout">π {cart?.length ?? 0} items</a>Configuring session storage
Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration.
If you are using an adapter that doesnβt have a default driver, or if you want to choose a different driver, you can configure it using the
sessionconfiguration option:import { defineConfig } from 'astro/config';import vercel from '@astrojs/vercel';export default defineConfig({adapter: vercel(),session: {driver: 'upstash',},});Using sessions
Sessions are available in on-demand rendered pages, API endpoints, actions and middleware.
In pages and components, you can access the session using
Astro.session:---const cart = await Astro.session.get('cart');---<a href="/checkout">π {cart?.length ?? 0} items</a>In endpoints, actions, and middleware, you can access the session using
context.session:export async function GET(context) {const cart = await context.session.get('cart');return Response.json({ cart });}If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be
undefinedand an error will be logged in the console:---export const prerender = true;const cart = await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined---Upgrading from Experimental to Stable
If you were previously using the experimental API, please remove the
experimental.sessionflag from your configuration:import { defineConfig } from 'astro/config';import node from '@astrojs/node';export default defineConfig({adapter: node({mode: "standalone",}),experimental: {session: true,},});See the sessions guide for more information.
π Patch Changes
- Updated dependencies []:
- @astrojs/underscore-redirects@0.6.0
-
π Patch Changes
-
#13596
3752519Thanks @jsparkdev! - update vite to latest version to fix CVE -
#13547
360cb91Thanks @jsparkdev! - Updates vite to the latest version -
Updated dependencies []:
- @astrojs/underscore-redirects@0.6.0
-