@netlify/plugin-nextjs 5.1.0 → 5.1.1
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.
|
@@ -540,16 +540,35 @@ var getDeployStore = (options = {}) => {
|
|
|
540
540
|
};
|
|
541
541
|
|
|
542
542
|
// src/run/headers.ts
|
|
543
|
-
var
|
|
543
|
+
var ALL_VARIATIONS = Symbol.for("ALL_VARIATIONS");
|
|
544
|
+
var NetlifyVaryKeys = /* @__PURE__ */ new Set(["header", "language", "cookie", "query", "country"]);
|
|
545
|
+
var isNetlifyVaryKey = (key) => NetlifyVaryKeys.has(key);
|
|
546
|
+
var generateNetlifyVaryValues = ({
|
|
547
|
+
header,
|
|
548
|
+
language,
|
|
549
|
+
cookie,
|
|
550
|
+
query,
|
|
551
|
+
country
|
|
552
|
+
}) => {
|
|
544
553
|
const values = [];
|
|
545
|
-
if (
|
|
546
|
-
|
|
554
|
+
if (query.length !== 0) {
|
|
555
|
+
if (query.includes(ALL_VARIATIONS)) {
|
|
556
|
+
values.push(`query`);
|
|
557
|
+
} else {
|
|
558
|
+
values.push(`query=${query.join(`|`)}`);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
if (header.length !== 0) {
|
|
562
|
+
values.push(`header=${header.join(`|`)}`);
|
|
547
563
|
}
|
|
548
|
-
if (
|
|
549
|
-
values.push(`language=${
|
|
564
|
+
if (language.length !== 0) {
|
|
565
|
+
values.push(`language=${language.join(`|`)}`);
|
|
550
566
|
}
|
|
551
|
-
if (
|
|
552
|
-
values.push(`cookie=${
|
|
567
|
+
if (cookie.length !== 0) {
|
|
568
|
+
values.push(`cookie=${cookie.join(`|`)}`);
|
|
569
|
+
}
|
|
570
|
+
if (country.length !== 0) {
|
|
571
|
+
values.push(`country=${country.join(`|`)}`);
|
|
553
572
|
}
|
|
554
573
|
return values.join(",");
|
|
555
574
|
};
|
|
@@ -570,19 +589,33 @@ var mapHeaderValues = (header, callback) => {
|
|
|
570
589
|
};
|
|
571
590
|
var setVaryHeaders = (headers, request, { basePath, i18n }) => {
|
|
572
591
|
const netlifyVaryValues = {
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
592
|
+
header: ["x-nextjs-data"],
|
|
593
|
+
language: [],
|
|
594
|
+
cookie: ["__prerender_bypass", "__next_preview_data"],
|
|
595
|
+
query: [],
|
|
596
|
+
country: []
|
|
576
597
|
};
|
|
577
598
|
const vary = headers.get("vary");
|
|
578
599
|
if (vary !== null) {
|
|
579
|
-
netlifyVaryValues.
|
|
600
|
+
netlifyVaryValues.header.push(...getHeaderValueArray(vary));
|
|
580
601
|
}
|
|
581
602
|
const path = new URL(request.url).pathname;
|
|
582
603
|
const locales = i18n && i18n.localeDetection !== false ? i18n.locales : [];
|
|
583
604
|
if (locales.length > 1 && (path === "/" || path === basePath)) {
|
|
584
|
-
netlifyVaryValues.
|
|
585
|
-
netlifyVaryValues.
|
|
605
|
+
netlifyVaryValues.language.push(...locales);
|
|
606
|
+
netlifyVaryValues.cookie.push(`NEXT_LOCALE`);
|
|
607
|
+
}
|
|
608
|
+
const userNetlifyVary = headers.get("netlify-vary");
|
|
609
|
+
if (userNetlifyVary) {
|
|
610
|
+
const directives = getHeaderValueArray(userNetlifyVary);
|
|
611
|
+
for (const directive of directives) {
|
|
612
|
+
const [key, value] = directive.split("=");
|
|
613
|
+
if (key === "query" && !value) {
|
|
614
|
+
netlifyVaryValues.query.push(ALL_VARIATIONS);
|
|
615
|
+
} else if (value && isNetlifyVaryKey(key)) {
|
|
616
|
+
netlifyVaryValues[key].push(...value.split("|"));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
586
619
|
}
|
|
587
620
|
headers.set(`netlify-vary`, generateNetlifyVaryValues(netlifyVaryValues));
|
|
588
621
|
};
|
|
@@ -647,7 +680,7 @@ var adjustDateHeader = async ({
|
|
|
647
680
|
headers.set("date", lastModifiedDate.toUTCString());
|
|
648
681
|
};
|
|
649
682
|
var setCacheControlHeaders = (headers, request, requestContext) => {
|
|
650
|
-
if (typeof requestContext.routeHandlerRevalidate !== "undefined" && ["GET", "HEAD"].includes(request.method) && !headers.has("netlify-cdn-cache-control")) {
|
|
683
|
+
if (typeof requestContext.routeHandlerRevalidate !== "undefined" && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control")) {
|
|
651
684
|
const cdnCacheControl = (
|
|
652
685
|
// if we are serving already stale response, instruct edge to not attempt to cache that response
|
|
653
686
|
headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate" : `s-maxage=${requestContext.routeHandlerRevalidate === false ? 31536e3 : requestContext.routeHandlerRevalidate}, stale-while-revalidate=31536000`
|
|
@@ -8,7 +8,7 @@ import "./chunk-5JVNISGM.js";
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "@netlify/plugin-nextjs";
|
|
11
|
-
var version = "5.1.
|
|
11
|
+
var version = "5.1.1";
|
|
12
12
|
var description = "Run Next.js seamlessly on Netlify";
|
|
13
13
|
var main = "./dist/index.js";
|
|
14
14
|
var type = "module";
|
|
@@ -59,7 +59,7 @@ var devDependencies = {
|
|
|
59
59
|
"@fastly/http-compute-js": "1.1.4",
|
|
60
60
|
"@netlify/blobs": "^7.0.1",
|
|
61
61
|
"@netlify/build": "^29.37.2",
|
|
62
|
-
"@netlify/edge-bundler": "^11.
|
|
62
|
+
"@netlify/edge-bundler": "^11.4.0",
|
|
63
63
|
"@netlify/edge-functions": "^2.3.1",
|
|
64
64
|
"@netlify/eslint-config-node": "^7.0.1",
|
|
65
65
|
"@netlify/functions": "^2.5.1",
|
|
@@ -51202,7 +51202,7 @@ var import_sdk_trace_node = __toESM(require_src14(), 1);
|
|
|
51202
51202
|
var import_semantic_conventions = __toESM(require_src(), 1);
|
|
51203
51203
|
var {
|
|
51204
51204
|
default: { version, name }
|
|
51205
|
-
} = await import("../../esm-chunks/package-
|
|
51205
|
+
} = await import("../../esm-chunks/package-YB7ERSH4.js");
|
|
51206
51206
|
var sdk = new import_sdk_node.NodeSDK({
|
|
51207
51207
|
resource: new import_resources.Resource({
|
|
51208
51208
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|
package/dist/run/headers.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
setCacheStatusHeader,
|
|
11
11
|
setCacheTagsHeaders,
|
|
12
12
|
setVaryHeaders
|
|
13
|
-
} from "../esm-chunks/chunk-
|
|
13
|
+
} from "../esm-chunks/chunk-PMRBBOBY.js";
|
|
14
14
|
import "../esm-chunks/chunk-TYCYFZ22.js";
|
|
15
15
|
import "../esm-chunks/chunk-5JVNISGM.js";
|
|
16
16
|
export {
|