@netlify/plugin-nextjs 5.10.2 → 5.10.3
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.
- package/dist/esm-chunks/{package-7HACW4PO.js → package-AKXSA3EX.js} +3 -3
- package/dist/run/handlers/cache.cjs +22 -10
- package/dist/run/handlers/server.js +1 -1
- package/dist/run/handlers/tracing.js +1 -1
- package/dist/run/headers.js +7 -8
- package/dist/run/revalidate.js +2 -2
- package/package.json +1 -1
|
@@ -8,7 +8,7 @@ import "./chunk-OEQOKJGE.js";
|
|
|
8
8
|
|
|
9
9
|
// package.json
|
|
10
10
|
var name = "@netlify/plugin-nextjs";
|
|
11
|
-
var version = "5.10.
|
|
11
|
+
var version = "5.10.3";
|
|
12
12
|
var description = "Run Next.js seamlessly on Netlify";
|
|
13
13
|
var main = "./dist/index.js";
|
|
14
14
|
var type = "module";
|
|
@@ -58,7 +58,7 @@ var homepage = "https://opennext.js.org/netlify";
|
|
|
58
58
|
var devDependencies = {
|
|
59
59
|
"@fastly/http-compute-js": "1.1.5",
|
|
60
60
|
"@netlify/blobs": "^8.1.2",
|
|
61
|
-
"@netlify/build": "^30.1.
|
|
61
|
+
"@netlify/build": "^30.1.1",
|
|
62
62
|
"@netlify/edge-bundler": "^12.4.0",
|
|
63
63
|
"@netlify/edge-functions": "^2.11.1",
|
|
64
64
|
"@netlify/eslint-config-node": "^7.0.1",
|
|
@@ -88,7 +88,7 @@ var devDependencies = {
|
|
|
88
88
|
memfs: "^4.9.2",
|
|
89
89
|
"mock-require": "^3.0.3",
|
|
90
90
|
msw: "^2.0.7",
|
|
91
|
-
"netlify-cli": "^19.1.
|
|
91
|
+
"netlify-cli": "^19.1.5",
|
|
92
92
|
next: "^15.0.0-canary.28",
|
|
93
93
|
os: "^0.1.2",
|
|
94
94
|
outdent: "^0.8.0",
|
|
@@ -195,7 +195,7 @@ var import_constants = require("next/dist/lib/constants.js");
|
|
|
195
195
|
|
|
196
196
|
// package.json
|
|
197
197
|
var name = "@netlify/plugin-nextjs";
|
|
198
|
-
var version = "5.10.
|
|
198
|
+
var version = "5.10.3";
|
|
199
199
|
|
|
200
200
|
// src/run/handlers/cache.cts
|
|
201
201
|
var import_cache_types = require("../../shared/cache-types.cjs");
|
|
@@ -259,9 +259,6 @@ var NetlifyCacheHandler = class {
|
|
|
259
259
|
return restOfRouteValue;
|
|
260
260
|
}
|
|
261
261
|
captureCacheTags(cacheValue, key) {
|
|
262
|
-
if (!cacheValue) {
|
|
263
|
-
return;
|
|
264
|
-
}
|
|
265
262
|
const requestContext = (0, import_request_context.getRequestContext)();
|
|
266
263
|
if (!requestContext) {
|
|
267
264
|
return;
|
|
@@ -269,6 +266,11 @@ var NetlifyCacheHandler = class {
|
|
|
269
266
|
if (requestContext.responseCacheTags) {
|
|
270
267
|
return;
|
|
271
268
|
}
|
|
269
|
+
if (!cacheValue) {
|
|
270
|
+
const cacheTags = [`_N_T_${key === "/index" ? "/" : encodeURI(key)}`];
|
|
271
|
+
requestContext.responseCacheTags = cacheTags;
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
272
274
|
if (cacheValue.kind === "PAGE" || cacheValue.kind === "PAGES" || cacheValue.kind === "APP_PAGE" || cacheValue.kind === "ROUTE" || cacheValue.kind === "APP_ROUTE") {
|
|
273
275
|
if (cacheValue.headers?.[import_constants.NEXT_CACHE_TAGS_HEADER]) {
|
|
274
276
|
const cacheTags = cacheValue.headers[import_constants.NEXT_CACHE_TAGS_HEADER].split(/,|%2c/gi);
|
|
@@ -318,7 +320,7 @@ var NetlifyCacheHandler = class {
|
|
|
318
320
|
}
|
|
319
321
|
async get(...args) {
|
|
320
322
|
return this.tracer.withActiveSpan("get cache key", async (span) => {
|
|
321
|
-
const [key,
|
|
323
|
+
const [key, context = {}] = args;
|
|
322
324
|
(0, import_request_context.getLogger)().debug(`[NetlifyCacheHandler.get]: ${key}`);
|
|
323
325
|
span.setAttributes({ key });
|
|
324
326
|
const blob = await this.cacheStore.get(key, "blobStore.get");
|
|
@@ -340,18 +342,25 @@ var NetlifyCacheHandler = class {
|
|
|
340
342
|
);
|
|
341
343
|
return null;
|
|
342
344
|
}
|
|
343
|
-
const staleByTags = await this.checkCacheEntryStaleByTags(
|
|
345
|
+
const staleByTags = await this.checkCacheEntryStaleByTags(
|
|
346
|
+
blob,
|
|
347
|
+
context.tags,
|
|
348
|
+
context.softTags
|
|
349
|
+
);
|
|
344
350
|
if (staleByTags) {
|
|
345
351
|
span.addEvent("Stale", { staleByTags, key, ttl });
|
|
346
352
|
return null;
|
|
347
353
|
}
|
|
348
354
|
this.captureResponseCacheLastModified(blob, key, span);
|
|
349
|
-
|
|
355
|
+
const isDataRequest = Boolean(context.fetchUrl);
|
|
356
|
+
if (!isDataRequest) {
|
|
357
|
+
this.captureCacheTags(blob.value, key);
|
|
358
|
+
}
|
|
350
359
|
switch (blob.value?.kind) {
|
|
351
360
|
case "FETCH":
|
|
352
361
|
span.addEvent("FETCH", {
|
|
353
362
|
lastModified: blob.lastModified,
|
|
354
|
-
revalidate:
|
|
363
|
+
revalidate: context.revalidate,
|
|
355
364
|
ttl
|
|
356
365
|
});
|
|
357
366
|
return {
|
|
@@ -443,9 +452,12 @@ var NetlifyCacheHandler = class {
|
|
|
443
452
|
span.setAttributes({ key, lastModified });
|
|
444
453
|
(0, import_request_context.getLogger)().debug(`[NetlifyCacheHandler.set]: ${key}`);
|
|
445
454
|
const value = this.transformToStorableObject(data, context);
|
|
446
|
-
|
|
455
|
+
const isDataReq = Boolean(context.fetchUrl);
|
|
456
|
+
if (!isDataReq) {
|
|
457
|
+
this.captureCacheTags(value, key);
|
|
458
|
+
}
|
|
447
459
|
await this.cacheStore.set(key, { lastModified, value }, "blobStore.set");
|
|
448
|
-
if (data?.kind === "PAGE" || data?.kind === "PAGES") {
|
|
460
|
+
if (!data && !isDataReq || data?.kind === "PAGE" || data?.kind === "PAGES") {
|
|
449
461
|
const requestContext = (0, import_request_context.getRequestContext)();
|
|
450
462
|
if (requestContext?.didPagesRouterOnDemandRevalidate) {
|
|
451
463
|
const tag = `_N_T_${key === "/index" ? "/" : encodeURI(key)}`;
|
|
@@ -3177,7 +3177,7 @@ var server_default = async (request, _context, topLevelSpan, requestContext) =>
|
|
|
3177
3177
|
requestContext
|
|
3178
3178
|
});
|
|
3179
3179
|
}
|
|
3180
|
-
setCacheControlHeaders(response, request, requestContext
|
|
3180
|
+
setCacheControlHeaders(response, request, requestContext);
|
|
3181
3181
|
setCacheTagsHeaders(response.headers, requestContext);
|
|
3182
3182
|
setVaryHeaders(response.headers, request, nextConfig);
|
|
3183
3183
|
setCacheStatusHeader(response.headers, nextCache);
|
|
@@ -68866,7 +68866,7 @@ var import_semantic_conventions = __toESM(require_src(), 1);
|
|
|
68866
68866
|
import { getLogger } from "./request-context.cjs";
|
|
68867
68867
|
var {
|
|
68868
68868
|
default: { version, name }
|
|
68869
|
-
} = await import("../../esm-chunks/package-
|
|
68869
|
+
} = await import("../../esm-chunks/package-AKXSA3EX.js");
|
|
68870
68870
|
var sdk = new import_sdk_node.NodeSDK({
|
|
68871
68871
|
resource: new import_resources.Resource({
|
|
68872
68872
|
[import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
|
package/dist/run/headers.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
import "../esm-chunks/chunk-OEQOKJGE.js";
|
|
8
8
|
|
|
9
9
|
// src/run/headers.ts
|
|
10
|
-
import { getLogger } from "./handlers/request-context.cjs";
|
|
11
10
|
import { recordWarning } from "./handlers/tracer.cjs";
|
|
12
11
|
import { getMemoizedKeyValueStoreBackedByRegionalBlobStore } from "./storage/storage.cjs";
|
|
13
12
|
var ALL_VARIATIONS = Symbol.for("ALL_VARIATIONS");
|
|
@@ -126,15 +125,11 @@ function setCacheControlFromRequestContext(headers, revalidate) {
|
|
|
126
125
|
);
|
|
127
126
|
headers.set("netlify-cdn-cache-control", cdnCacheControl);
|
|
128
127
|
}
|
|
129
|
-
var setCacheControlHeaders = ({ headers, status }, request, requestContext
|
|
128
|
+
var setCacheControlHeaders = ({ headers, status }, request, requestContext) => {
|
|
130
129
|
if (typeof requestContext.routeHandlerRevalidate !== "undefined" && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control")) {
|
|
131
130
|
setCacheControlFromRequestContext(headers, requestContext.routeHandlerRevalidate);
|
|
132
131
|
return;
|
|
133
132
|
}
|
|
134
|
-
if (status === 308 && request.url.endsWith("/") !== nextConfig.trailingSlash) {
|
|
135
|
-
getLogger().withFields({ trailingSlash: nextConfig.trailingSlash, location: headers.get("location") }).log("NetlifyHeadersHandler.trailingSlashRedirect");
|
|
136
|
-
}
|
|
137
|
-
const cacheControl = headers.get("cache-control");
|
|
138
133
|
if (status === 404) {
|
|
139
134
|
if (request.url.endsWith(".php")) {
|
|
140
135
|
headers.set("cache-control", "public, max-age=0, must-revalidate");
|
|
@@ -146,6 +141,7 @@ var setCacheControlHeaders = ({ headers, status }, request, requestContext, next
|
|
|
146
141
|
return;
|
|
147
142
|
}
|
|
148
143
|
}
|
|
144
|
+
const cacheControl = headers.get("cache-control");
|
|
149
145
|
if (cacheControl !== null && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control")) {
|
|
150
146
|
const browserCacheControl = omitHeaderValues(cacheControl, [
|
|
151
147
|
"s-maxage",
|
|
@@ -164,13 +160,16 @@ var setCacheControlHeaders = ({ headers, status }, request, requestContext, next
|
|
|
164
160
|
headers.set("netlify-cdn-cache-control", cdnCacheControl);
|
|
165
161
|
return;
|
|
166
162
|
}
|
|
167
|
-
if (cacheControl === null && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control") && requestContext.usedFsReadForNonFallback) {
|
|
163
|
+
if (cacheControl === null && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control") && requestContext.usedFsReadForNonFallback && !requestContext.didPagesRouterOnDemandRevalidate) {
|
|
168
164
|
headers.set("cache-control", "public, max-age=0, must-revalidate");
|
|
169
165
|
headers.set("netlify-cdn-cache-control", `max-age=31536000, durable`);
|
|
170
166
|
}
|
|
171
167
|
};
|
|
172
168
|
var setCacheTagsHeaders = (headers, requestContext) => {
|
|
173
|
-
if (
|
|
169
|
+
if (!headers.has("cache-control") && !headers.has("netlify-cdn-cache-control")) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (requestContext.responseCacheTags) {
|
|
174
173
|
headers.set("netlify-cache-tag", requestContext.responseCacheTags.join(","));
|
|
175
174
|
}
|
|
176
175
|
};
|
package/dist/run/revalidate.js
CHANGED
|
@@ -11,8 +11,8 @@ import { isPromise } from "node:util/types";
|
|
|
11
11
|
function isRevalidateMethod(key, nextResponseField) {
|
|
12
12
|
return key === "revalidate" && typeof nextResponseField === "function";
|
|
13
13
|
}
|
|
14
|
-
var nextResponseProxy = (
|
|
15
|
-
return new Proxy(
|
|
14
|
+
var nextResponseProxy = (response, requestContext) => {
|
|
15
|
+
return new Proxy(response, {
|
|
16
16
|
get(target, key) {
|
|
17
17
|
const originalValue = Reflect.get(target, key);
|
|
18
18
|
if (isRevalidateMethod(key, originalValue)) {
|