@opennextjs/cloudflare 1.14.0 → 1.14.2

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.
@@ -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": manifest.preview.previewModeId,
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.preview.previewModeId;
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 kind: parenthesized_expression\n has: { kind: property_identifier , stopBy: end, regex: 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:\n kind: string_fragment\n regex: https://\n - has:\n kind: template_substitution\n all:\n - has: { kind: identifier, stopBy: end, pattern: $REQ }\n - has:\n kind: property_identifier\n regex: headers\n stopBy: end\n - has:\n kind: property_identifier\n regex: host\n 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";
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
- kind: parenthesized_expression
16
- has: { kind: property_identifier , stopBy: end, regex: trustHostHeader}
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
- kind: property_identifier
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\.runtime\.prod\.js|node/api-resolver\.js)$`, {
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.0",
4
+ "version": "1.14.2",
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.0",
47
+ "@opennextjs/aws": "3.9.3",
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.20250917.0",
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,15 +67,16 @@
67
67
  "eslint-plugin-unicorn": "^55.0.0",
68
68
  "globals": "^15.9.0",
69
69
  "mock-fs": "^5.4.1",
70
- "next": "~14.2.24",
70
+ "next": "~15.5.7",
71
71
  "picomatch": "^4.0.2",
72
72
  "rimraf": "^6.0.1",
73
73
  "typescript": "^5.9.3",
74
- "typescript-eslint": "^8.37.0",
74
+ "typescript-eslint": "^8.48.0",
75
75
  "vitest": "^2.1.1"
76
76
  },
77
77
  "peerDependencies": {
78
- "wrangler": "^4.49.1"
78
+ "wrangler": "^4.49.1",
79
+ "next": "14 - 14.2 || 14.3.0-canary.0 - 14.3.0-canary.76 || ~15.0.5 || ~15.1.9 || ~15.3.6 || ~15.4.8 || ~15.5.7 || ^16.0.7"
79
80
  },
80
81
  "scripts": {
81
82
  "clean": "rimraf dist",
@@ -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
  }