Skip to content

Commit a6904a4

Browse files
authored
fix: response.validate with the turbo pages runtime (#1017)
1 parent 2200b4b commit a6904a4

File tree

3 files changed

+17
-20
lines changed

3 files changed

+17
-20
lines changed

.changeset/orange-pets-poke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@opennextjs/cloudflare": patch
3+
---
4+
5+
fix: `response.validate` with the turbo pages runtime

examples/e2e/pages-router/next.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const nextConfig: NextConfig = {
99
cleanDistDir: true,
1010
reactStrictMode: true,
1111
output: "standalone",
12-
// outputFileTracingRoot: "../sst",
1312
typescript: {
1413
ignoreBuildErrors: true,
1514
},

packages/cloudflare/src/cli/build/patches/plugins/res-revalidate.ts

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ rule:
1414
kind: if_statement
1515
stopBy: end
1616
has:
17-
kind: parenthesized_expression
18-
has: { kind: property_identifier , stopBy: end, regex: trustHostHeader}
17+
field: condition
18+
stopBy: end
19+
pattern: $$$_.trustHostHeader
1920
has:
2021
kind: call_expression
2122
all:
22-
- has: {kind: identifier, pattern: fetch}
23+
- has: { kind: identifier, pattern: fetch}
2324
- has:
2425
kind: arguments
2526
all:
@@ -29,31 +30,23 @@ rule:
2930
- has:
3031
kind: pair
3132
all:
32-
- has: {kind: property_identifier, regex: method }
33-
- has: {kind: string, regex: 'HEAD'}
33+
- has: { kind: property_identifier, regex: method }
34+
- has: { kind: string, regex: 'HEAD'}
3435
- has:
3536
kind: pair
3637
all:
37-
- has: {kind: property_identifier, regex: headers}
38-
- has: {kind: identifier, pattern: $HEADERS}
38+
- has: { kind: property_identifier, regex: headers}
39+
- has: { kind: identifier, pattern: $HEADERS}
3940
- has:
4041
kind: template_string
4142
all:
42-
- has:
43-
kind: string_fragment
44-
regex: https://
43+
- has: { kind: string_fragment, regex: ^https://$ }
4544
- has:
4645
kind: template_substitution
4746
all:
4847
- has: { kind: identifier, stopBy: end, pattern: $REQ }
49-
- has:
50-
kind: property_identifier
51-
regex: headers
52-
stopBy: end
53-
- has:
54-
kind: property_identifier
55-
regex: host
56-
stopBy: end
48+
- has: { kind: property_identifier, regex: ^headers$, stopBy: end }
49+
- has: { kind: property_identifier, regex: ^host$, stopBy: end }
5750
- has:
5851
kind: template_substitution
5952
pattern: $URL_PATH
@@ -69,7 +62,7 @@ export const patchResRevalidate: CodePatcher = {
6962
{
7063
versions: ">=14.2.0",
7164
pathFilter: getCrossPlatformPathRegex(
72-
String.raw`(pages-api\.runtime\.prod\.js|node/api-resolver\.js)$`,
65+
String.raw`(pages-api(?:-turbo)?\.runtime\.prod\.js|node/api-resolver\.js)$`,
7366
{
7467
escape: false,
7568
}

0 commit comments

Comments
 (0)