@opennextjs/cloudflare 1.19.4 → 1.19.5

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.
@@ -21,10 +21,11 @@ export class DOQueueHandler extends DurableObject {
21
21
  disableSQLite;
22
22
  constructor(ctx, env) {
23
23
  super(ctx, env);
24
- this.service = env.WORKER_SELF_REFERENCE;
25
24
  // If there is no service binding, we throw an error because we can't revalidate without it
26
- if (!this.service)
25
+ if (!env.WORKER_SELF_REFERENCE) {
27
26
  throw new IgnorableError("No service binding for cache revalidation worker");
27
+ }
28
+ this.service = env.WORKER_SELF_REFERENCE;
28
29
  this.sql = ctx.storage.sql;
29
30
  this.maxRevalidations = env.NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION
30
31
  ? parseInt(env.NEXT_CACHE_DO_QUEUE_MAX_REVALIDATION)
@@ -10,7 +10,7 @@ interface WithFilterOptions {
10
10
  * @param tag The tag to filter.
11
11
  * @returns true if the tag should be forwarded, false otherwise.
12
12
  */
13
- filterFn: (tag: string | NextModeTagCacheWriteInput) => boolean;
13
+ filterFn: (tag: NextModeTagCacheWriteInput) => boolean;
14
14
  }
15
15
  /**
16
16
  * Creates a new tag cache that filters tags based on the provided filter function.
@@ -22,5 +22,5 @@ export declare function withFilter({ tagCache, filterFn }: WithFilterOptions): N
22
22
  * This is used to filter out internal soft tags.
23
23
  * Can be used if `revalidatePath` is not used.
24
24
  */
25
- export declare function softTagFilter(tag: string | NextModeTagCacheWriteInput): boolean;
25
+ export declare function softTagFilter(tag: NextModeTagCacheWriteInput): boolean;
26
26
  export {};
@@ -38,6 +38,19 @@ export async function build(options, config, projectOpts, wranglerConfig, allowU
38
38
  const { aws, cloudflare } = getVersion();
39
39
  logger.info(`@opennextjs/cloudflare version: ${cloudflare}`);
40
40
  logger.info(`@opennextjs/aws version: ${aws}`);
41
+ if (wranglerConfig.compatibility_date) {
42
+ const sixMonthsAgoMs = Date.now() - 6 * 30 * 24 * 60 * 60 * 1000;
43
+ const compatDateMs = new Date(wranglerConfig.compatibility_date).getTime();
44
+ if (!isNaN(compatDateMs)) {
45
+ const dateMessage = `workerd compatibility_date: ${wranglerConfig.compatibility_date}`;
46
+ if (compatDateMs < sixMonthsAgoMs) {
47
+ logger.warn(`${dateMessage}, consider updating your wrangler config to a more recent date to benefit from the latest features and fixes.`);
48
+ }
49
+ else {
50
+ logger.info(`${dateMessage}`);
51
+ }
52
+ }
53
+ }
41
54
  // Clean the output directory before building the Next app.
42
55
  buildHelper.initOutputDir(options);
43
56
  if (projectOpts.skipNextBuild) {
@@ -97,13 +97,20 @@ async function migrateCommand(args) {
97
97
  }
98
98
  catch (error) {
99
99
  logger.error("Failed to update package.json", error.message);
100
- logger.warn("\nPlease ensure that your package.json contains the following scripts:\n" +
101
- console.log([...Object.entries(openNextScripts)].map(([key, value]) => ` - ${key}: ${value}`).join("\n")) +
102
- "\n");
100
+ logger.warn(`Please ensure that your package.json contains the following scripts:
101
+ ${[...Object.entries(openNextScripts)].map(([k, v]) => ` - ${k}: ${v}`).join("\n")}
102
+ `);
103
103
  }
104
104
  const gitIgnoreExists = fs.existsSync(".gitignore");
105
105
  printStepTitle(`${gitIgnoreExists ? "Updating" : "Creating"} .gitignore file`);
106
- conditionalAppendFileSync(".gitignore", "# OpenNext\n.open-next\n", {
106
+ conditionalAppendFileSync(".gitignore", `# OpenNext
107
+ .open-next
108
+
109
+ # wrangler files
110
+ .wrangler
111
+ .dev.vars*
112
+ !.dev.vars.example
113
+ `, {
107
114
  appendIf: (content) => !content.includes(".open-next"),
108
115
  appendPrefix: "\n",
109
116
  });
@@ -34,7 +34,7 @@ export function findWranglerConfig(appDir) {
34
34
  * @returns An object containing a `cachingEnabled` which indicates whether caching has been set up during the wrangler
35
35
  * config file creation or not
36
36
  */
37
- export async function createWranglerConfigFile(projectDir, defaultCompatDate = "2026-02-01") {
37
+ export async function createWranglerConfigFile(projectDir, defaultCompatDate = "2026-04-15") {
38
38
  const workerName = getWorkerName(projectDir);
39
39
  const compatibilityDate = (await getLatestCompatDate()) ?? defaultCompatDate;
40
40
  const wranglerConfigStr = readFileSync(join(getPackageTemplatesDirPath(), "wrangler.jsonc"), "utf8")
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.19.4",
4
+ "version": "1.19.5",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "opennextjs-cloudflare": "dist/cli/index.js"
@@ -78,7 +78,7 @@
78
78
  },
79
79
  "peerDependencies": {
80
80
  "next": ">=15.5.15 <16 || >=16.2.3",
81
- "wrangler": "^4.84.1"
81
+ "wrangler": "^4.86.0"
82
82
  },
83
83
  "scripts": {
84
84
  "clean": "rimraf dist",