summaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/src/runtime.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/cloudflare/src/runtime.ts')
-rw-r--r--packages/integrations/cloudflare/src/runtime.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/src/runtime.ts b/packages/integrations/cloudflare/src/runtime.ts
index cd3dfff47..03c15d4a3 100644
--- a/packages/integrations/cloudflare/src/runtime.ts
+++ b/packages/integrations/cloudflare/src/runtime.ts
@@ -1,3 +1,4 @@
+// TODO: remove `getRuntime()` in Astro 3.0
import type { Cache, CacheStorage, IncomingRequestCfProperties } from '@cloudflare/workers-types';
export type WorkerRuntime<T = unknown> = {
@@ -21,6 +22,16 @@ export type PagesRuntime<T = unknown, U = unknown> = {
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> {