@netlify/plugin-nextjs
Advanced tools
Comparing version 5.6.0 to 5.7.0-canary.0
@@ -479,3 +479,3 @@ | ||
} | ||
const exports = `export default _ENTRIES["middleware_${name}"].default;`; | ||
const exports = `const middlewareEntryKey = Object.keys(_ENTRIES).find(entryKey => entryKey.startsWith("middleware_${name}")); export default _ENTRIES[middlewareEntryKey].default;`; | ||
await mkdir(dirname(join(destDir, `server/${name}.js`)), { recursive: true }); | ||
@@ -482,0 +482,0 @@ await writeFile(join(destDir, `server/${name}.js`), [...parts, exports].join("\n")); |
@@ -65,3 +65,3 @@ | ||
if (ctx.buildConfig.output === "export") { | ||
return copyStaticExport(ctx); | ||
return Promise.all([copyStaticExport(ctx), setImageConfig(ctx)]); | ||
} | ||
@@ -68,0 +68,0 @@ await verifyAdvancedAPIRoutes(ctx); |
@@ -145,8 +145,7 @@ | ||
}; | ||
var setCacheControlHeaders = (headers, request, requestContext, useDurableCache) => { | ||
const durableCacheDirective = useDurableCache ? ", durable" : ""; | ||
var setCacheControlHeaders = (headers, request, requestContext) => { | ||
if (typeof requestContext.routeHandlerRevalidate !== "undefined" && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control")) { | ||
const cdnCacheControl = ( | ||
// if we are serving already stale response, instruct edge to not attempt to cache that response | ||
headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate" : `s-maxage=${requestContext.routeHandlerRevalidate === false ? 31536e3 : requestContext.routeHandlerRevalidate}, stale-while-revalidate=31536000${durableCacheDirective}` | ||
headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate" : `s-maxage=${requestContext.routeHandlerRevalidate === false ? 31536e3 : requestContext.routeHandlerRevalidate}, stale-while-revalidate=31536000, durable` | ||
); | ||
@@ -168,3 +167,3 @@ headers.set("netlify-cdn-cache-control", cdnCacheControl); | ||
), | ||
...useDurableCache ? ["durable"] : [] | ||
"durable" | ||
].join(", ") | ||
@@ -178,3 +177,3 @@ ); | ||
headers.set("cache-control", "public, max-age=0, must-revalidate"); | ||
headers.set("netlify-cdn-cache-control", `max-age=31536000${durableCacheDirective}`); | ||
headers.set("netlify-cdn-cache-control", `max-age=31536000, durable`); | ||
} | ||
@@ -181,0 +180,0 @@ }; |
@@ -119,5 +119,6 @@ import type { Context } from '@netlify/edge-functions' | ||
let rewrite = res.headers.get('x-middleware-rewrite') | ||
let redirect = res.headers.get('location') | ||
let nextRedirect = res.headers.get('x-nextjs-redirect') | ||
// If we have both a redirect and a rewrite, the redirect must take precedence | ||
let rewrite = !redirect && !nextRedirect ? res.headers.get('x-middleware-rewrite') : false | ||
@@ -124,0 +125,0 @@ // Data requests (i.e. requests for /_next/data ) need special handling |
{ | ||
"name": "@netlify/plugin-nextjs", | ||
"version": "5.6.0", | ||
"version": "5.7.0-canary.0", | ||
"description": "Run Next.js seamlessly on Netlify", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5247493
137172
1