@netlify/plugin-nextjs 5.11.2 → 5.11.4

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.
@@ -215,7 +215,26 @@ var replaceMiddlewareManifest = async (sourcePath, destPath) => {
215
215
  const manifest = JSON.parse(data);
216
216
  const newManifest = {
217
217
  ...manifest,
218
- middleware: {}
218
+ middleware: Object.fromEntries(
219
+ Object.entries(manifest.middleware).map(([key, edgeFunctionDefinition]) => {
220
+ return [
221
+ key,
222
+ {
223
+ ...edgeFunctionDefinition,
224
+ matchers: edgeFunctionDefinition.matchers.map((matcher) => {
225
+ return {
226
+ ...matcher,
227
+ // matcher that won't match on anything
228
+ // this is meant to disable actually running middleware in the server handler,
229
+ // while still allowing next server to enable some middleware specific handling
230
+ // such as _next/data normalization ( https://github.com/vercel/next.js/blob/7bb72e508572237fe0d4aac5418546d4b4b3a363/packages/next/src/server/lib/router-utils/resolve-routes.ts#L395 )
231
+ regexp: "(?!.*)"
232
+ };
233
+ })
234
+ }
235
+ ];
236
+ })
237
+ )
219
238
  };
220
239
  const newData = JSON.stringify(newManifest);
221
240
  await writeFile(destPath, newData);
@@ -141,13 +141,23 @@ var NetlifyCacheHandler = class {
141
141
  try {
142
142
  const prerenderManifest = await this.getPrerenderManifest(this.options.serverDistDir);
143
143
  if (typeof cacheControl !== "undefined") {
144
- const { SharedCacheControls } = await import(
145
- // @ts-expect-error supporting multiple next version, this module is not resolvable with currently used dev dependency
146
- // eslint-disable-next-line import/no-unresolved, n/no-missing-import
147
- "next/dist/server/lib/incremental-cache/shared-cache-controls.js"
148
- );
149
- const sharedCacheControls = new SharedCacheControls(prerenderManifest);
150
- sharedCacheControls.set(key, cacheControl);
144
+ try {
145
+ const { SharedCacheControls } = await import(
146
+ // @ts-expect-error supporting multiple next version, this module is not resolvable with currently used dev dependency
147
+ // eslint-disable-next-line import/no-unresolved, n/no-missing-import
148
+ "next/dist/server/lib/incremental-cache/shared-cache-controls.external.js"
149
+ );
150
+ const sharedCacheControls = new SharedCacheControls(prerenderManifest);
151
+ sharedCacheControls.set(key, cacheControl);
152
+ } catch {
153
+ const { SharedCacheControls } = await import(
154
+ // @ts-expect-error supporting multiple next version, this module is not resolvable with currently used dev dependency
155
+ // eslint-disable-next-line import/no-unresolved, n/no-missing-import
156
+ "next/dist/server/lib/incremental-cache/shared-cache-controls.js"
157
+ );
158
+ const sharedCacheControls = new SharedCacheControls(prerenderManifest);
159
+ sharedCacheControls.set(key, cacheControl);
160
+ }
151
161
  } else if (typeof revalidate === "number" || revalidate === false) {
152
162
  try {
153
163
  const { normalizePagePath } = await import("next/dist/shared/lib/page-path/normalize-page-path.js");
@@ -86,7 +86,7 @@ var pipeline = (0, import_node_util.promisify)(import_node_stream.pipeline);
86
86
 
87
87
  // package.json
88
88
  var name = "@netlify/plugin-nextjs";
89
- var version = "5.11.2";
89
+ var version = "5.11.4";
90
90
 
91
91
  // src/run/handlers/tags-handler.cts
92
92
  var import_storage = require("../storage/storage.cjs");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.11.2",
3
+ "version": "5.11.4",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",