From 3ead88c9b561b09ef2b76df7dd1e779a54a6fdbb Mon Sep 17 00:00:00 2001 From: Michael Seele Date: Tue, 30 Jan 2024 03:38:26 +0100 Subject: [PATCH] feat: support astro v4 (#123) --- packages/adapter/package.json | 4 ++-- packages/adapter/src/lambda/handlers/edge.ts | 7 +++---- packages/adapter/src/lambda/handlers/ssr.ts | 4 ++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/packages/adapter/package.json b/packages/adapter/package.json index c001218..1a06a3a 100644 --- a/packages/adapter/package.json +++ b/packages/adapter/package.json @@ -83,7 +83,7 @@ "@faker-js/faker": "^8.3.1", "@types/aws-lambda": "^8.10.126", "@types/node": "^18.18.0", - "astro": "^3.5.5", + "astro": "^4.2.4", "aws-lambda": "^1.0.7", "eslint": "^8.53.0", "prettier": "^3.1.0", @@ -91,7 +91,7 @@ "vitest": "^0.34.6" }, "peerDependencies": { - "astro": ">=1" + "astro": ">=4" }, "engines": { "node": "18.x || 20.x" diff --git a/packages/adapter/src/lambda/handlers/edge.ts b/packages/adapter/src/lambda/handlers/edge.ts index e1e8810..4d3400e 100644 --- a/packages/adapter/src/lambda/handlers/edge.ts +++ b/packages/adapter/src/lambda/handlers/edge.ts @@ -85,10 +85,9 @@ const createExports = ( const handleRequest = async ( request: Request, - matchNotFound: boolean, def: CloudFrontRequestResult | CloudFrontResponseResult, ): Promise => { - const routeData = app.match(request, { matchNotFound }) + const routeData = app.match(request) if (!routeData) { return def @@ -136,7 +135,7 @@ const createExports = ( const request = new Request(url, requestInit) - return handleRequest(request, true, record.response) + return handleRequest(request, record.response) } return record.response @@ -159,7 +158,7 @@ const createExports = ( const request = new Request(url, requestInit) - return handleRequest(request, false, cloudFrontRequest) + return handleRequest(request, cloudFrontRequest) } return { diff --git a/packages/adapter/src/lambda/handlers/ssr.ts b/packages/adapter/src/lambda/handlers/ssr.ts index 92f4f55..74a7f97 100644 --- a/packages/adapter/src/lambda/handlers/ssr.ts +++ b/packages/adapter/src/lambda/handlers/ssr.ts @@ -128,7 +128,7 @@ const createExports = ( method: event.requestContext.http.method, }) - let routeData = app.match(request, { matchNotFound: true }) + let routeData = app.match(request) if (!routeData) { const request404 = new Request( @@ -144,7 +144,7 @@ const createExports = ( }, ) - routeData = app.match(request404, { matchNotFound: true }) + routeData = app.match(request404) if (!routeData) { return {