Skip to content

Commit

Permalink
feat: support astro v4 (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
mseele authored Jan 30, 2024
1 parent bf856f3 commit 3ead88c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@
"@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",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
},
"peerDependencies": {
"astro": ">=1"
"astro": ">=4"
},
"engines": {
"node": "18.x || 20.x"
Expand Down
7 changes: 3 additions & 4 deletions packages/adapter/src/lambda/handlers/edge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,9 @@ const createExports = (

const handleRequest = async (
request: Request,
matchNotFound: boolean,
def: CloudFrontRequestResult | CloudFrontResponseResult,
): Promise<CloudFrontRequestResult | CloudFrontResponseResult> => {
const routeData = app.match(request, { matchNotFound })
const routeData = app.match(request)

if (!routeData) {
return def
Expand Down Expand Up @@ -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
Expand All @@ -159,7 +158,7 @@ const createExports = (

const request = new Request(url, requestInit)

return handleRequest(request, false, cloudFrontRequest)
return handleRequest(request, cloudFrontRequest)
}

return {
Expand Down
4 changes: 2 additions & 2 deletions packages/adapter/src/lambda/handlers/ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -144,7 +144,7 @@ const createExports = (
},
)

routeData = app.match(request404, { matchNotFound: true })
routeData = app.match(request404)

if (!routeData) {
return {
Expand Down

0 comments on commit 3ead88c

Please sign in to comment.