From 0ac0d4ba05402fbd8608f9187200e5ee6ff10560 Mon Sep 17 00:00:00 2001 From: Alexander Niebuhr <45965090+alexanderniebuhr@users.noreply.github.com> Date: Sat, 9 May 2026 08:59:05 +0200 Subject: [PATCH] chore: remove deprecation warning for Astro locals Signed-off-by: Alexander Niebuhr <45965090+alexanderniebuhr@users.noreply.github.com> --- .changeset/silly-spoons-write.md | 5 ++++ .../cloudflare/src/utils/handler.ts | 25 ------------------- 2 files changed, 5 insertions(+), 25 deletions(-) create mode 100644 .changeset/silly-spoons-write.md diff --git a/.changeset/silly-spoons-write.md b/.changeset/silly-spoons-write.md new file mode 100644 index 000000000000..776dbf661d98 --- /dev/null +++ b/.changeset/silly-spoons-write.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': patch +--- + +Removes deprecations warnings added in Astro v6 for Cloudflare specific Astro.locals properties. diff --git a/packages/integrations/cloudflare/src/utils/handler.ts b/packages/integrations/cloudflare/src/utils/handler.ts index f9cb6f5fc3e0..6b03d3cdadf3 100644 --- a/packages/integrations/cloudflare/src/utils/handler.ts +++ b/packages/integrations/cloudflare/src/utils/handler.ts @@ -94,31 +94,6 @@ export async function handle( const locals: Runtime = { cfContext: context, }; - Object.defineProperty(locals, 'runtime', { - enumerable: false, - value: { - get env(): never { - throw new Error( - `Astro.locals.runtime.env has been removed in Astro v6. Use 'import { env } from "cloudflare:workers"' instead.`, - ); - }, - get cf(): never { - throw new Error( - `Astro.locals.runtime.cf has been removed in Astro v6. Use 'Astro.request.cf' instead.`, - ); - }, - get caches(): never { - throw new Error( - `Astro.locals.runtime.caches has been removed in Astro v6. Use the global 'caches' object instead.`, - ); - }, - get ctx(): never { - throw new Error( - `Astro.locals.runtime.ctx has been removed in Astro v6. Use 'Astro.locals.cfContext' instead.`, - ); - }, - }, - }); const waitUntil: RenderOptions['waitUntil'] = context.waitUntil.bind(context);