summaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/src
diff options
context:
space:
mode:
authorGravatar Emanuele Stoppa <my.burning@gmail.com> 2023-08-28 17:19:04 +0100
committerGravatar GitHub <noreply@github.com> 2023-08-28 17:19:04 +0100
commit6b03a0c40d0fe12f134d8f064dbfe7bc93301d3f (patch)
tree275d3a953b53853a4bf0dc317bbb25025a174e62 /packages/integrations/cloudflare/src
parent0e288ace06ae22ca58a6a9621ffa5be7be1eeb54 (diff)
downloadastro-6b03a0c40d0fe12f134d8f064dbfe7bc93301d3f.tar.gz
astro-6b03a0c40d0fe12f134d8f064dbfe7bc93301d3f.tar.zst
astro-6b03a0c40d0fe12f134d8f064dbfe7bc93301d3f.zip
refactor: use new Astro internals (#8254)
* refactor: use new Astro internals * chore: update tests --------- Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'packages/integrations/cloudflare/src')
-rw-r--r--packages/integrations/cloudflare/src/runtime.ts45
1 files changed, 0 insertions, 45 deletions
diff --git a/packages/integrations/cloudflare/src/runtime.ts b/packages/integrations/cloudflare/src/runtime.ts
deleted file mode 100644
index 03c15d4a3..000000000
--- a/packages/integrations/cloudflare/src/runtime.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-// TODO: remove `getRuntime()` in Astro 3.0
-import type { Cache, CacheStorage, IncomingRequestCfProperties } from '@cloudflare/workers-types';
-
-export type WorkerRuntime<T = unknown> = {
- name: 'cloudflare';
- env: T;
- waitUntil(promise: Promise<any>): void;
- passThroughOnException(): void;
- caches?: CacheStorage & { default: Cache };
- cf?: IncomingRequestCfProperties;
-};
-
-export type PagesRuntime<T = unknown, U = unknown> = {
- name: 'cloudflare';
- env: T;
- functionPath: string;
- params: Record<string, string>;
- data: U;
- waitUntil(promise: Promise<any>): void;
- next(request: Request): void;
- caches?: CacheStorage & { default: Cache };
- cf?: IncomingRequestCfProperties;
-};
-
-/**
- * @deprecated since version 6.8.0
- * The `getRuntime` utility has been deprecated and should be updated to the new [`Astro.locals`](https://docs.astro.build/en/guides/middleware/#locals) API.
- * ```diff
- * - import { getRuntime } from '@astrojs/cloudflare/runtime';
- * - getRuntime(Astro.request);
- *
- * + const runtime = Astro.locals.runtime;
- * ```
- */
-export function getRuntime<T = unknown, U = unknown>(
- request: Request
-): WorkerRuntime<T> | PagesRuntime<T, U> {
- if (!!request) {
- return Reflect.get(request, Symbol.for('runtime'));
- } else {
- throw new Error(
- 'To retrieve the current cloudflare runtime you need to pass in the Astro request object'
- );
- }
-}