@opennextjs/cloudflare 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/overrides/queue/memory-queue.js +1 -4
- package/dist/cli/build/open-next/compileDurableObjects.js +1 -1
- package/dist/cli/build/patches/plugins/res-revalidate.d.ts +1 -1
- package/dist/cli/build/patches/plugins/res-revalidate.js +12 -19
- package/package.json +5 -5
- package/templates/wrangler.jsonc +6 -1
|
@@ -27,13 +27,10 @@ export class MemoryQueue {
|
|
|
27
27
|
let response;
|
|
28
28
|
try {
|
|
29
29
|
const protocol = host.includes("localhost") ? "http" : "https";
|
|
30
|
-
// TODO: Drop the import - https://github.com/opennextjs/opennextjs-cloudflare/issues/361
|
|
31
|
-
// @ts-ignore
|
|
32
|
-
const manifest = await import("./.next/prerender-manifest.json");
|
|
33
30
|
response = await service.fetch(`${protocol}://${host}${url}`, {
|
|
34
31
|
method: "HEAD",
|
|
35
32
|
headers: {
|
|
36
|
-
"x-prerender-revalidate":
|
|
33
|
+
"x-prerender-revalidate": process.env.NEXT_PREVIEW_MODE_ID,
|
|
37
34
|
"x-isr": "1",
|
|
38
35
|
},
|
|
39
36
|
// We want to timeout the revalidation to avoid hanging the queue
|
|
@@ -11,7 +11,7 @@ export function compileDurableObjects(buildOpts) {
|
|
|
11
11
|
];
|
|
12
12
|
const buildOutputDotNextDir = path.join(buildOpts.appBuildOutputPath, ".next");
|
|
13
13
|
const prerenderManifest = loadPrerenderManifest(buildOutputDotNextDir);
|
|
14
|
-
const previewModeId = prerenderManifest
|
|
14
|
+
const previewModeId = prerenderManifest?.preview?.previewModeId;
|
|
15
15
|
const BUILD_ID = loadBuildId(buildOutputDotNextDir);
|
|
16
16
|
return esbuildSync({
|
|
17
17
|
entryPoints,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { CodePatcher } from "@opennextjs/aws/build/patch/codePatcher.js";
|
|
2
|
-
export declare const rule = "\nrule:\n kind: await_expression\n inside:\n kind: if_statement\n stopBy: end\n has:\n
|
|
2
|
+
export declare const rule = "\nrule:\n kind: await_expression\n inside:\n kind: if_statement\n stopBy: end\n has:\n field: condition\n stopBy: end\n pattern: $$$_.trustHostHeader\n has:\n kind: call_expression\n all:\n - has: { kind: identifier, pattern: fetch}\n - has:\n kind: arguments\n all:\n - has:\n kind: object\n all:\n - has:\n kind: pair\n all:\n - has: { kind: property_identifier, regex: method }\n - has: { kind: string, regex: 'HEAD'}\n - has:\n kind: pair\n all:\n - has: { kind: property_identifier, regex: headers}\n - has: { kind: identifier, pattern: $HEADERS}\n - has:\n kind: template_string\n all:\n - has: { kind: string_fragment, regex: ^https://$ }\n - has:\n kind: template_substitution\n all:\n - has: { kind: identifier, stopBy: end, pattern: $REQ }\n - has: { kind: property_identifier, regex: ^headers$, stopBy: end }\n - has: { kind: property_identifier, regex: ^host$, stopBy: end }\n - has:\n kind: template_substitution\n pattern: $URL_PATH\n has:\n kind: identifier\n\nfix: await (await import(\"@opennextjs/cloudflare\")).getCloudflareContext().env.WORKER_SELF_REFERENCE.fetch(`${$REQ.headers.host.includes(\"localhost\") ? \"http\":\"https\" }://${$REQ.headers.host}$URL_PATH`,{method:'HEAD', headers:$HEADERS})\n";
|
|
3
3
|
export declare const patchResRevalidate: CodePatcher;
|
|
@@ -12,12 +12,13 @@ rule:
|
|
|
12
12
|
kind: if_statement
|
|
13
13
|
stopBy: end
|
|
14
14
|
has:
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
field: condition
|
|
16
|
+
stopBy: end
|
|
17
|
+
pattern: $$$_.trustHostHeader
|
|
17
18
|
has:
|
|
18
19
|
kind: call_expression
|
|
19
20
|
all:
|
|
20
|
-
- has: {kind: identifier, pattern: fetch}
|
|
21
|
+
- has: { kind: identifier, pattern: fetch}
|
|
21
22
|
- has:
|
|
22
23
|
kind: arguments
|
|
23
24
|
all:
|
|
@@ -27,31 +28,23 @@ rule:
|
|
|
27
28
|
- has:
|
|
28
29
|
kind: pair
|
|
29
30
|
all:
|
|
30
|
-
- has: {kind: property_identifier, regex: method }
|
|
31
|
-
- has: {kind: string, regex: 'HEAD'}
|
|
31
|
+
- has: { kind: property_identifier, regex: method }
|
|
32
|
+
- has: { kind: string, regex: 'HEAD'}
|
|
32
33
|
- has:
|
|
33
34
|
kind: pair
|
|
34
35
|
all:
|
|
35
|
-
- has: {kind: property_identifier, regex: headers}
|
|
36
|
-
- has: {kind: identifier, pattern: $HEADERS}
|
|
36
|
+
- has: { kind: property_identifier, regex: headers}
|
|
37
|
+
- has: { kind: identifier, pattern: $HEADERS}
|
|
37
38
|
- has:
|
|
38
39
|
kind: template_string
|
|
39
40
|
all:
|
|
40
|
-
- has:
|
|
41
|
-
kind: string_fragment
|
|
42
|
-
regex: https://
|
|
41
|
+
- has: { kind: string_fragment, regex: ^https://$ }
|
|
43
42
|
- has:
|
|
44
43
|
kind: template_substitution
|
|
45
44
|
all:
|
|
46
45
|
- has: { kind: identifier, stopBy: end, pattern: $REQ }
|
|
47
|
-
- has:
|
|
48
|
-
|
|
49
|
-
regex: headers
|
|
50
|
-
stopBy: end
|
|
51
|
-
- has:
|
|
52
|
-
kind: property_identifier
|
|
53
|
-
regex: host
|
|
54
|
-
stopBy: end
|
|
46
|
+
- has: { kind: property_identifier, regex: ^headers$, stopBy: end }
|
|
47
|
+
- has: { kind: property_identifier, regex: ^host$, stopBy: end }
|
|
55
48
|
- has:
|
|
56
49
|
kind: template_substitution
|
|
57
50
|
pattern: $URL_PATH
|
|
@@ -65,7 +58,7 @@ export const patchResRevalidate = {
|
|
|
65
58
|
patches: [
|
|
66
59
|
{
|
|
67
60
|
versions: ">=14.2.0",
|
|
68
|
-
pathFilter: getCrossPlatformPathRegex(String.raw `(pages-api
|
|
61
|
+
pathFilter: getCrossPlatformPathRegex(String.raw `(pages-api(?:-turbo)?\.runtime\.prod\.js|node/api-resolver\.js)$`, {
|
|
69
62
|
escape: false,
|
|
70
63
|
}),
|
|
71
64
|
contentFilter: /\.trustHostHeader/,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opennextjs/cloudflare",
|
|
3
3
|
"description": "Cloudflare builder for next apps",
|
|
4
|
-
"version": "1.14.
|
|
4
|
+
"version": "1.14.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"opennextjs-cloudflare": "dist/cli/index.js"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ast-grep/napi": "0.40.0",
|
|
46
46
|
"@dotenvx/dotenvx": "1.31.0",
|
|
47
|
-
"@opennextjs/aws": "3.9.
|
|
47
|
+
"@opennextjs/aws": "3.9.1",
|
|
48
48
|
"cloudflare": "^4.4.1",
|
|
49
49
|
"enquirer": "^2.4.1",
|
|
50
50
|
"glob": "^12.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"yargs": "^18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@cloudflare/workers-types": "^4.
|
|
55
|
+
"@cloudflare/workers-types": "^4.20251118.0",
|
|
56
56
|
"@eslint/js": "^9.11.1",
|
|
57
57
|
"@tsconfig/strictest": "^2.0.5",
|
|
58
58
|
"@types/mock-fs": "^4.13.4",
|
|
@@ -67,11 +67,11 @@
|
|
|
67
67
|
"eslint-plugin-unicorn": "^55.0.0",
|
|
68
68
|
"globals": "^15.9.0",
|
|
69
69
|
"mock-fs": "^5.4.1",
|
|
70
|
-
"next": "~
|
|
70
|
+
"next": "~15.5.6",
|
|
71
71
|
"picomatch": "^4.0.2",
|
|
72
72
|
"rimraf": "^6.0.1",
|
|
73
73
|
"typescript": "^5.9.3",
|
|
74
|
-
"typescript-eslint": "^8.
|
|
74
|
+
"typescript-eslint": "^8.48.0",
|
|
75
75
|
"vitest": "^2.1.1"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
package/templates/wrangler.jsonc
CHANGED
|
@@ -18,5 +18,10 @@
|
|
|
18
18
|
// See https://developers.cloudflare.com/workers/wrangler/commands/#r2-bucket-create
|
|
19
19
|
"bucket_name": "cache"
|
|
20
20
|
}
|
|
21
|
-
]
|
|
21
|
+
],
|
|
22
|
+
"images": {
|
|
23
|
+
// Enable image optimization
|
|
24
|
+
// see https://opennext.js.org/cloudflare/howtos/image
|
|
25
|
+
"binding": "IMAGES"
|
|
26
|
+
}
|
|
22
27
|
}
|