diff options
author | 2023-08-10 14:38:51 -0400 | |
---|---|---|
committer | 2023-08-10 14:38:51 -0400 | |
commit | 2ee418e06ab1f7855dee0078afbad0b06de3b183 (patch) | |
tree | 3af0e146c29c9b41ed79b097cc6276dbcb09a402 /packages/integrations/netlify/src/netlify-edge-functions.ts | |
parent | 9cc4e48e6a858d3a12e6373a5e287b32d24a1c5a (diff) | |
download | astro-2ee418e06ab1f7855dee0078afbad0b06de3b183.tar.gz astro-2ee418e06ab1f7855dee0078afbad0b06de3b183.tar.zst astro-2ee418e06ab1f7855dee0078afbad0b06de3b183.zip |
Remove the Nelify Edge adapter (#8029)
Diffstat (limited to 'packages/integrations/netlify/src/netlify-edge-functions.ts')
-rw-r--r-- | packages/integrations/netlify/src/netlify-edge-functions.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/packages/integrations/netlify/src/netlify-edge-functions.ts b/packages/integrations/netlify/src/netlify-edge-functions.ts deleted file mode 100644 index 5e95035a6..000000000 --- a/packages/integrations/netlify/src/netlify-edge-functions.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { Context } from '@netlify/edge-functions'; -import type { SSRManifest } from 'astro'; -import { App } from 'astro/app'; - -const clientAddressSymbol = Symbol.for('astro.clientAddress'); - -export function createExports(manifest: SSRManifest) { - const app = new App(manifest); - - const handler = async (request: Request, context: Context): Promise<Response | void> => { - const url = new URL(request.url); - - // If this matches a static asset, just return and Netlify will forward it - // to its static asset handler. - if (manifest.assets.has(url.pathname)) { - return; - } - const routeData = app.match(request); - const ip = - request.headers.get('x-nf-client-connection-ip') || - context?.ip || - (context as any)?.remoteAddr?.hostname; - Reflect.set(request, clientAddressSymbol, ip); - const response = await app.render(request, routeData); - if (app.setCookieHeaders) { - for (const setCookieHeader of app.setCookieHeaders(response)) { - response.headers.append('Set-Cookie', setCookieHeader); - } - } - return response; - }; - - return { default: handler }; -} |