@opennextjs/cloudflare 1.14.7 → 1.14.9

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.
@@ -31,7 +31,7 @@ export async function build(options, config, projectOpts, wranglerConfig) {
31
31
  buildHelper.checkRunningInsideNextjsApp(options);
32
32
  logger.info(`App directory: ${options.appPath}`);
33
33
  buildHelper.printNextjsVersion(options);
34
- ensureNextjsVersionSupported(options);
34
+ await ensureNextjsVersionSupported(options);
35
35
  const { aws, cloudflare } = getVersion();
36
36
  logger.info(`@opennextjs/cloudflare version: ${cloudflare}`);
37
37
  logger.info(`@opennextjs/aws version: ${aws}`);
@@ -72,12 +72,21 @@ export async function build(options, config, projectOpts, wranglerConfig) {
72
72
  await bundleServer(options, projectOpts);
73
73
  logger.info("OpenNext build complete.");
74
74
  }
75
- function ensureNextjsVersionSupported(options) {
76
- if (buildHelper.compareSemver(options.nextVersion, "<", "14.2.0")) {
75
+ async function ensureNextjsVersionSupported({ nextVersion }) {
76
+ if (buildHelper.compareSemver(nextVersion, "<", "14.2.0")) {
77
77
  logger.error("Next.js version unsupported, please upgrade to version 14.2 or greater.");
78
78
  process.exit(1);
79
79
  }
80
- if (buildHelper.compareSemver(options.nextVersion, ">=", "16")) {
80
+ if (buildHelper.compareSemver(nextVersion, ">=", "16")) {
81
81
  logger.warn("Next.js 16 is not fully supported yet! Some features may not work as expected.");
82
82
  }
83
+ const { default: { version: wranglerVersion }, } = await import("wrangler/package.json", { with: { type: "json" } });
84
+ // We need a version of workerd that has a fix for setImmediate for Next.js 16.1+
85
+ // See:
86
+ // - https://github.com/cloudflare/workerd/pull/5869
87
+ // - https://github.com/opennextjs/opennextjs-cloudflare/issues/1049
88
+ if (buildHelper.compareSemver(nextVersion, ">=", "16.1.0") &&
89
+ buildHelper.compareSemver(wranglerVersion, "<", "4.59.2")) {
90
+ logger.warn(`Next.js 16.1+ requires wrangler 4.59.2 or greater (${wranglerVersion} detected).`);
91
+ }
83
92
  }
@@ -133,7 +133,7 @@ export async function bundleServer(buildOpts, projectOpts) {
133
133
  banner: {
134
134
  // We need to import them here, assigning them to `globalThis` does not work because node:timers use `globalThis` and thus create an infinite loop
135
135
  // See https://github.com/cloudflare/workerd/blob/d6a764c/src/node/internal/internal_timers.ts#L56-L70
136
- js: `import {setInterval, clearInterval, setTimeout, clearTimeout, setImmediate, clearImmediate} from "node:timers"`,
136
+ js: `import {setInterval, clearInterval, setTimeout, clearTimeout} from "node:timers"`,
137
137
  },
138
138
  platform: "node",
139
139
  });
@@ -130,7 +130,14 @@ async function populateR2IncrementalCache(buildOpts, config, populateCacheOption
130
130
  const listFile = path.join(tempDir, `r2-bulk-list.json`);
131
131
  fs.writeFileSync(listFile, JSON.stringify(objectList));
132
132
  const concurrency = Math.max(1, populateCacheOptions.cacheChunkSize ?? 50);
133
- runWrangler(buildOpts, ["r2 bulk put", bucket, `--filename ${quoteShellMeta(listFile)}`, `--concurrency ${concurrency}`], {
133
+ const jurisdiction = binding.jurisdiction ? `--jurisdiction ${binding.jurisdiction}` : "";
134
+ runWrangler(buildOpts, [
135
+ "r2 bulk put",
136
+ bucket,
137
+ `--filename ${quoteShellMeta(listFile)}`,
138
+ `--concurrency ${concurrency}`,
139
+ jurisdiction,
140
+ ], {
134
141
  target: populateCacheOptions.target,
135
142
  configPath: populateCacheOptions.wranglerConfigPath,
136
143
  // R2 does not support the environment flag and results in the following error:
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.7",
4
+ "version": "1.14.9",
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.7",
47
+ "@opennextjs/aws": "3.9.8",
48
48
  "cloudflare": "^4.4.1",
49
49
  "enquirer": "^2.4.1",
50
50
  "glob": "^12.0.0",
@@ -75,7 +75,7 @@
75
75
  "vitest": "^2.1.1"
76
76
  },
77
77
  "peerDependencies": {
78
- "wrangler": "^4.53.0",
78
+ "wrangler": "^4.59.2",
79
79
  "next": "^14.2.35 || ~15.0.7 || ~15.1.11 || ~15.2.8 || ~15.3.8 || ~15.4.10 || ~15.5.9 || ^16.0.10"
80
80
  },
81
81
  "scripts": {