@netlify/plugin-nextjs 5.7.0 → 5.7.2

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.
@@ -16,7 +16,7 @@ import {
16
16
  } from "../../esm-chunks/chunk-FHR56UHE.js";
17
17
  import {
18
18
  require_semver
19
- } from "../../esm-chunks/chunk-EFGWM7RS.js";
19
+ } from "../../esm-chunks/chunk-APO262HE.js";
20
20
  import {
21
21
  __toESM
22
22
  } from "../../esm-chunks/chunk-OEQOKJGE.js";
@@ -148,8 +148,8 @@ var writeCacheEntry = async (route, value, lastModified, ctx) => {
148
148
  await writeFile(path, entry, "utf-8");
149
149
  };
150
150
  var routeToFilePath = (path) => path === "/" ? "/index" : path;
151
- var buildPagesCacheValue = async (path) => ({
152
- kind: "PAGE",
151
+ var buildPagesCacheValue = async (path, shouldUseEnumKind) => ({
152
+ kind: shouldUseEnumKind ? "PAGES" : "PAGE",
153
153
  html: await readFile(`${path}.html`, "utf-8"),
154
154
  pageData: JSON.parse(await readFile(`${path}.json`, "utf-8")),
155
155
  headers: void 0,
@@ -181,8 +181,8 @@ var buildAppCacheValue = async (path, shouldUseAppPageKind) => {
181
181
  ...meta
182
182
  };
183
183
  };
184
- var buildRouteCacheValue = async (path, initialRevalidateSeconds) => ({
185
- kind: "ROUTE",
184
+ var buildRouteCacheValue = async (path, initialRevalidateSeconds, shouldUseEnumKind) => ({
185
+ kind: shouldUseEnumKind ? "APP_ROUTE" : "ROUTE",
186
186
  body: await readFile(`${path}.body`, "base64"),
187
187
  ...JSON.parse(await readFile(`${path}.meta`, "utf-8")),
188
188
  revalidate: initialRevalidateSeconds
@@ -200,6 +200,9 @@ var copyPrerenderedContent = async (ctx) => {
200
200
  const shouldUseAppPageKind = ctx.nextVersion ? (0, import_semver.satisfies)(ctx.nextVersion, ">=15.0.0-canary.13 <15.0.0-d || >15.0.0-rc.0", {
201
201
  includePrerelease: true
202
202
  }) : false;
203
+ const shouldUseEnumKind = ctx.nextVersion ? (0, import_semver.satisfies)(ctx.nextVersion, ">=15.0.0-canary.114 <15.0.0-d || >15.0.0-rc.0", {
204
+ includePrerelease: true
205
+ }) : false;
203
206
  await Promise.all(
204
207
  Object.entries(manifest.routes).map(
205
208
  ([route, meta]) => limitConcurrentPrerenderContentHandling(async () => {
@@ -207,13 +210,17 @@ var copyPrerenderedContent = async (ctx) => {
207
210
  const key = routeToFilePath(route);
208
211
  let value;
209
212
  switch (true) {
213
+ // Parallel route default layout has no prerendered page
210
214
  case (meta.dataRoute?.endsWith("/default.rsc") && !existsSync(join(ctx.publishDir, "server/app", `${key}.html`))):
211
215
  return;
212
216
  case meta.dataRoute?.endsWith(".json"):
213
217
  if (manifest.notFoundRoutes.includes(route)) {
214
218
  return;
215
219
  }
216
- value = await buildPagesCacheValue(join(ctx.publishDir, "server/pages", key));
220
+ value = await buildPagesCacheValue(
221
+ join(ctx.publishDir, "server/pages", key),
222
+ shouldUseEnumKind
223
+ );
217
224
  break;
218
225
  case meta.dataRoute?.endsWith(".rsc"):
219
226
  value = await buildAppCacheValue(
@@ -224,13 +231,14 @@ var copyPrerenderedContent = async (ctx) => {
224
231
  case meta.dataRoute === null:
225
232
  value = await buildRouteCacheValue(
226
233
  join(ctx.publishDir, "server/app", key),
227
- meta.initialRevalidateSeconds
234
+ meta.initialRevalidateSeconds,
235
+ shouldUseEnumKind
228
236
  );
229
237
  break;
230
238
  default:
231
239
  throw new Error(`Unrecognized content: ${route}`);
232
240
  }
233
- if (value.kind === "PAGE" || value.kind === "APP_PAGE") {
241
+ if (value.kind === "PAGE" || value.kind === "PAGES" || value.kind === "APP_PAGE") {
234
242
  verifyNetlifyForms(ctx, value.html);
235
243
  }
236
244
  await writeCacheEntry(key, value, lastModified, ctx);
@@ -16,7 +16,7 @@ import {
16
16
  } from "../../esm-chunks/chunk-FHR56UHE.js";
17
17
  import {
18
18
  require_semver
19
- } from "../../esm-chunks/chunk-EFGWM7RS.js";
19
+ } from "../../esm-chunks/chunk-APO262HE.js";
20
20
  import {
21
21
  __toESM
22
22
  } from "../../esm-chunks/chunk-OEQOKJGE.js";
@@ -390,8 +390,10 @@ var require_dist = __commonJS({
390
390
  var import_fast_glob = __toESM(require_out(), 1);
391
391
  var import_path_to_regexp = __toESM(require_dist(), 1);
392
392
  import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
393
- import { dirname, join } from "node:path";
393
+ import { dirname, join, relative, sep } from "node:path";
394
+ import { sep as posixSep } from "node:path/posix";
394
395
  import { EDGE_HANDLER_NAME } from "../plugin-context.js";
396
+ var toPosixPath = (path) => path.split(sep).join(posixSep);
395
397
  var writeEdgeManifest = async (ctx, manifest) => {
396
398
  await mkdir(ctx.edgeFunctionsDir, { recursive: true });
397
399
  await writeFile(join(ctx.edgeFunctionsDir, "manifest.json"), JSON.stringify(manifest, null, 2));
@@ -458,10 +460,16 @@ var copyHandlerDependencies = async (ctx, { name, files, wasm }) => {
458
460
  const shimPath = join(edgeRuntimeDir, "shim/index.js");
459
461
  const shim = await readFile(shimPath, "utf8");
460
462
  const parts = [shim];
463
+ const outputFile = join(destDir, `server/${name}.js`);
461
464
  if (wasm?.length) {
462
- parts.push(
463
- `import { decode as _base64Decode } from "../edge-runtime/vendor/deno.land/std@0.175.0/encoding/base64.ts";`
465
+ const base64ModulePath = join(
466
+ destDir,
467
+ "edge-runtime/vendor/deno.land/std@0.175.0/encoding/base64.ts"
464
468
  );
469
+ const base64ModulePathRelativeToOutputFile = toPosixPath(
470
+ relative(dirname(outputFile), base64ModulePath)
471
+ );
472
+ parts.push(`import { decode as _base64Decode } from "${base64ModulePathRelativeToOutputFile}";`);
465
473
  for (const wasmChunk of wasm ?? []) {
466
474
  const data = await readFile(join(srcDir, wasmChunk.filePath));
467
475
  parts.push(
@@ -477,8 +485,8 @@ var copyHandlerDependencies = async (ctx, { name, files, wasm }) => {
477
485
  `, entrypoint);
478
486
  }
479
487
  const exports = `const middlewareEntryKey = Object.keys(_ENTRIES).find(entryKey => entryKey.startsWith("middleware_${name}")); export default _ENTRIES[middlewareEntryKey].default;`;
480
- await mkdir(dirname(join(destDir, `server/${name}.js`)), { recursive: true });
481
- await writeFile(join(destDir, `server/${name}.js`), [...parts, exports].join("\n"));
488
+ await mkdir(dirname(outputFile), { recursive: true });
489
+ await writeFile(outputFile, [...parts, exports].join("\n"));
482
490
  };
483
491
  var createEdgeHandler = async (ctx, definition) => {
484
492
  await copyHandlerDependencies(ctx, definition);
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  require_semver
9
- } from "../esm-chunks/chunk-EFGWM7RS.js";
9
+ } from "../esm-chunks/chunk-APO262HE.js";
10
10
  import {
11
11
  __toESM
12
12
  } from "../esm-chunks/chunk-OEQOKJGE.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "../esm-chunks/chunk-FHR56UHE.js";
10
10
  import {
11
11
  require_semver
12
- } from "../esm-chunks/chunk-EFGWM7RS.js";
12
+ } from "../esm-chunks/chunk-APO262HE.js";
13
13
  import {
14
14
  __toESM
15
15
  } from "../esm-chunks/chunk-OEQOKJGE.js";
@@ -336,6 +336,8 @@ var require_semver = __commonJS({
336
336
  this.inc("patch", identifier, identifierBase);
337
337
  this.inc("pre", identifier, identifierBase);
338
338
  break;
339
+ // If the input is a non-prerelease version, this acts the same as
340
+ // prepatch.
339
341
  case "prerelease":
340
342
  if (this.prerelease.length === 0) {
341
343
  this.inc("patch", identifier, identifierBase);
@@ -363,6 +365,8 @@ var require_semver = __commonJS({
363
365
  }
364
366
  this.prerelease = [];
365
367
  break;
368
+ // This probably shouldn't be used publicly.
369
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
366
370
  case "pre": {
367
371
  const base = Number(identifierBase) ? 1 : 0;
368
372
  if (!identifier && identifierBase === false) {
@@ -811,6 +815,7 @@ var require_lrucache = __commonJS({
811
815
  // node_modules/semver/classes/range.js
812
816
  var require_range = __commonJS({
813
817
  "node_modules/semver/classes/range.js"(exports, module) {
818
+ var SPACE_CHARACTERS = /\s+/g;
814
819
  var Range = class _Range {
815
820
  constructor(range, options) {
816
821
  options = parseOptions(options);
@@ -824,13 +829,13 @@ var require_range = __commonJS({
824
829
  if (range instanceof Comparator) {
825
830
  this.raw = range.value;
826
831
  this.set = [[range]];
827
- this.format();
832
+ this.formatted = void 0;
828
833
  return this;
829
834
  }
830
835
  this.options = options;
831
836
  this.loose = !!options.loose;
832
837
  this.includePrerelease = !!options.includePrerelease;
833
- this.raw = range.trim().split(/\s+/).join(" ");
838
+ this.raw = range.trim().replace(SPACE_CHARACTERS, " ");
834
839
  this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
835
840
  if (!this.set.length) {
836
841
  throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
@@ -849,10 +854,27 @@ var require_range = __commonJS({
849
854
  }
850
855
  }
851
856
  }
852
- this.format();
857
+ this.formatted = void 0;
858
+ }
859
+ get range() {
860
+ if (this.formatted === void 0) {
861
+ this.formatted = "";
862
+ for (let i = 0; i < this.set.length; i++) {
863
+ if (i > 0) {
864
+ this.formatted += "||";
865
+ }
866
+ const comps = this.set[i];
867
+ for (let k = 0; k < comps.length; k++) {
868
+ if (k > 0) {
869
+ this.formatted += " ";
870
+ }
871
+ this.formatted += comps[k].toString().trim();
872
+ }
873
+ }
874
+ }
875
+ return this.formatted;
853
876
  }
854
877
  format() {
855
- this.range = this.set.map((comps) => comps.join(" ").trim()).join("||").trim();
856
878
  return this.range;
857
879
  }
858
880
  toString() {
@@ -1388,6 +1410,7 @@ var require_min_version = __commonJS({
1388
1410
  compver.prerelease.push(0);
1389
1411
  }
1390
1412
  compver.raw = compver.format();
1413
+ /* fallthrough */
1391
1414
  case "":
1392
1415
  case ">=":
1393
1416
  if (!setMin || gt(compver, setMin)) {
@@ -1397,6 +1420,7 @@ var require_min_version = __commonJS({
1397
1420
  case "<":
1398
1421
  case "<=":
1399
1422
  break;
1423
+ /* istanbul ignore next */
1400
1424
  default:
1401
1425
  throw new Error(`Unexpected operation: ${comparator.operator}`);
1402
1426
  }
@@ -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.7.0";
11
+ var version = "5.7.2";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -57,14 +57,14 @@ var bugs = {
57
57
  var homepage = "https://github.com/netlify/next-runtime#readme";
58
58
  var devDependencies = {
59
59
  "@fastly/http-compute-js": "1.1.4",
60
- "@netlify/blobs": "^7.3.0",
61
- "@netlify/build": "^29.50.2",
62
- "@netlify/edge-bundler": "^12.1.1",
60
+ "@netlify/blobs": "^7.4.0",
61
+ "@netlify/build": "^29.54.2",
62
+ "@netlify/edge-bundler": "^12.2.3",
63
63
  "@netlify/edge-functions": "^2.10.0",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
65
  "@netlify/functions": "^2.8.1",
66
- "@netlify/serverless-functions-api": "^1.22.0",
67
- "@netlify/zip-it-and-ship-it": "^9.37.3",
66
+ "@netlify/serverless-functions-api": "^1.23.0",
67
+ "@netlify/zip-it-and-ship-it": "^9.39.0",
68
68
  "@opentelemetry/api": "^1.8.0",
69
69
  "@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
70
70
  "@opentelemetry/resources": "^1.24.0",
@@ -78,7 +78,7 @@ var devDependencies = {
78
78
  "@vercel/nft": "^0.27.0",
79
79
  cheerio: "^1.0.0-rc.12",
80
80
  "clean-package": "^2.2.0",
81
- esbuild: "^0.21.0",
81
+ esbuild: "^0.23.0",
82
82
  execa: "^8.0.1",
83
83
  "fast-glob": "^3.3.2",
84
84
  "fs-monkey": "^1.0.6",
@@ -95,6 +95,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
95
95
 
96
96
  // src/run/handlers/cache.cts
97
97
  var import_constants = require("next/dist/lib/constants.js");
98
+ var import_cache_types = require("../../shared/cache-types.cjs");
98
99
  var import_regional_blob_store = require("../regional-blob-store.cjs");
99
100
  var import_request_context = require("./request-context.cjs");
100
101
  var import_tracer = require("./tracer.cjs");
@@ -166,11 +167,11 @@ var NetlifyCacheHandler = class {
166
167
  if (requestContext.responseCacheTags) {
167
168
  return;
168
169
  }
169
- if (cacheValue.kind === "PAGE" || cacheValue.kind === "APP_PAGE" || cacheValue.kind === "ROUTE") {
170
+ if (cacheValue.kind === "PAGE" || cacheValue.kind === "PAGES" || cacheValue.kind === "APP_PAGE" || cacheValue.kind === "ROUTE" || cacheValue.kind === "APP_ROUTE") {
170
171
  if (cacheValue.headers?.[import_constants.NEXT_CACHE_TAGS_HEADER]) {
171
172
  const cacheTags = cacheValue.headers[import_constants.NEXT_CACHE_TAGS_HEADER].split(",");
172
173
  requestContext.responseCacheTags = cacheTags;
173
- } else if (cacheValue.kind === "PAGE" && typeof cacheValue.pageData === "object") {
174
+ } else if ((cacheValue.kind === "PAGE" || cacheValue.kind === "PAGES") && typeof cacheValue.pageData === "object") {
174
175
  const cacheTags = [`_N_T_${key === "/index" ? "/" : key}`];
175
176
  requestContext.responseCacheTags = cacheTags;
176
177
  }
@@ -233,8 +234,12 @@ var NetlifyCacheHandler = class {
233
234
  lastModified: blob.lastModified,
234
235
  value: blob.value
235
236
  };
236
- case "ROUTE": {
237
- span.addEvent("ROUTE", { lastModified: blob.lastModified, status: blob.value.status });
237
+ case "ROUTE":
238
+ case "APP_ROUTE": {
239
+ span.addEvent(blob.value?.kind, {
240
+ lastModified: blob.lastModified,
241
+ status: blob.value.status
242
+ });
238
243
  const valueWithoutRevalidate = this.captureRouteRevalidateAndRemoveFromObject(blob.value);
239
244
  return {
240
245
  lastModified: blob.lastModified,
@@ -244,8 +249,9 @@ var NetlifyCacheHandler = class {
244
249
  }
245
250
  };
246
251
  }
247
- case "PAGE": {
248
- span.addEvent("PAGE", { lastModified: blob.lastModified });
252
+ case "PAGE":
253
+ case "PAGES": {
254
+ span.addEvent(blob.value?.kind, { lastModified: blob.lastModified });
249
255
  const { revalidate, ...restOfPageValue } = blob.value;
250
256
  await this.injectEntryToPrerenderManifest(key, revalidate);
251
257
  return {
@@ -254,7 +260,7 @@ var NetlifyCacheHandler = class {
254
260
  };
255
261
  }
256
262
  case "APP_PAGE": {
257
- span.addEvent("APP_PAGE", { lastModified: blob.lastModified });
263
+ span.addEvent(blob.value?.kind, { lastModified: blob.lastModified });
258
264
  const { revalidate, rscData, ...restOfPageValue } = blob.value;
259
265
  await this.injectEntryToPrerenderManifest(key, revalidate);
260
266
  return {
@@ -272,14 +278,17 @@ var NetlifyCacheHandler = class {
272
278
  });
273
279
  }
274
280
  transformToStorableObject(data, context) {
275
- if (data?.kind === "ROUTE") {
281
+ if (!data) {
282
+ return null;
283
+ }
284
+ if ((0, import_cache_types.isCachedRouteValue)(data)) {
276
285
  return {
277
286
  ...data,
278
287
  revalidate: context.revalidate,
279
288
  body: data.body.toString("base64")
280
289
  };
281
290
  }
282
- if (data?.kind === "PAGE") {
291
+ if ((0, import_cache_types.isCachedPageValue)(data)) {
283
292
  return {
284
293
  ...data,
285
294
  revalidate: context.revalidate
@@ -307,7 +316,7 @@ var NetlifyCacheHandler = class {
307
316
  lastModified,
308
317
  value
309
318
  });
310
- if (data?.kind === "PAGE") {
319
+ if (data?.kind === "PAGE" || data?.kind === "PAGES") {
311
320
  const requestContext = (0, import_request_context.getRequestContext)();
312
321
  if (requestContext?.didPagesRouterOnDemandRevalidate) {
313
322
  const tag = `_N_T_${key === "/index" ? "/" : key}`;
@@ -360,7 +369,7 @@ var NetlifyCacheHandler = class {
360
369
  let cacheTags = [];
361
370
  if (cacheEntry.value?.kind === "FETCH") {
362
371
  cacheTags = [...tags, ...softTags];
363
- } else if (cacheEntry.value?.kind === "PAGE" || cacheEntry.value?.kind === "APP_PAGE" || cacheEntry.value?.kind === "ROUTE") {
372
+ } else if (cacheEntry.value?.kind === "PAGE" || cacheEntry.value?.kind === "PAGES" || cacheEntry.value?.kind === "APP_PAGE" || cacheEntry.value?.kind === "ROUTE" || cacheEntry.value?.kind === "APP_ROUTE") {
364
373
  cacheTags = cacheEntry.value.headers?.[import_constants.NEXT_CACHE_TAGS_HEADER]?.split(",") || [];
365
374
  } else {
366
375
  return false;
@@ -10,7 +10,7 @@ import {
10
10
  } from "../../esm-chunks/chunk-GNGHTHMQ.js";
11
11
  import {
12
12
  require_semver
13
- } from "../../esm-chunks/chunk-EFGWM7RS.js";
13
+ } from "../../esm-chunks/chunk-APO262HE.js";
14
14
  import {
15
15
  __commonJS,
16
16
  __esm,
@@ -30409,6 +30409,7 @@ var require_reader = __commonJS({
30409
30409
  case 5:
30410
30410
  this.skip(4);
30411
30411
  break;
30412
+ /* istanbul ignore next */
30412
30413
  default:
30413
30414
  throw Error("invalid wire type " + wireType + " at offset " + this.pos);
30414
30415
  }
@@ -44014,6 +44015,7 @@ var require_converter = __commonJS({
44014
44015
  break;
44015
44016
  case "uint64":
44016
44017
  isUnsigned = true;
44018
+ // eslint-disable-next-line no-fallthrough
44017
44019
  case "int64":
44018
44020
  case "sint64":
44019
44021
  case "fixed64":
@@ -44085,6 +44087,7 @@ var require_converter = __commonJS({
44085
44087
  break;
44086
44088
  case "uint64":
44087
44089
  isUnsigned = true;
44090
+ // eslint-disable-next-line no-fallthrough
44088
44091
  case "int64":
44089
44092
  case "sint64":
44090
44093
  case "fixed64":
@@ -45632,6 +45635,7 @@ var require_parse = __commonJS({
45632
45635
  break;
45633
45636
  case "public":
45634
45637
  next();
45638
+ // eslint-disable-next-line no-fallthrough
45635
45639
  default:
45636
45640
  whichImports = imports || (imports = []);
45637
45641
  break;
@@ -45809,6 +45813,7 @@ var require_parse = __commonJS({
45809
45813
  case "enum":
45810
45814
  parseEnum(type, token2);
45811
45815
  break;
45816
+ /* istanbul ignore next */
45812
45817
  default:
45813
45818
  throw illegal(token2);
45814
45819
  }
@@ -47368,6 +47373,7 @@ var require_descriptor2 = __commonJS({
47368
47373
  fieldType = fromDescriptorType(descriptor.type);
47369
47374
  var fieldRule;
47370
47375
  switch (descriptor.label) {
47376
+ // 0 is reserved for errors
47371
47377
  case 1:
47372
47378
  fieldRule = void 0;
47373
47379
  break;
@@ -47429,7 +47435,9 @@ var require_descriptor2 = __commonJS({
47429
47435
  } else {
47430
47436
  switch (descriptor.type = toDescriptorType(this.type, this.resolve().resolvedType)) {
47431
47437
  case 10:
47438
+ // group
47432
47439
  case 11:
47440
+ // type
47433
47441
  case 14:
47434
47442
  descriptor.typeName = this.resolvedType ? shortname(this.parent, this.resolvedType) : this.type;
47435
47443
  break;
@@ -47552,6 +47560,7 @@ var require_descriptor2 = __commonJS({
47552
47560
  };
47553
47561
  function fromDescriptorType(type) {
47554
47562
  switch (type) {
47563
+ // 0 is reserved for errors
47555
47564
  case 1:
47556
47565
  return "double";
47557
47566
  case 2:
@@ -47588,18 +47597,31 @@ var require_descriptor2 = __commonJS({
47588
47597
  function packableDescriptorType(type) {
47589
47598
  switch (type) {
47590
47599
  case 1:
47600
+ // double
47591
47601
  case 2:
47602
+ // float
47592
47603
  case 3:
47604
+ // int64
47593
47605
  case 4:
47606
+ // uint64
47594
47607
  case 5:
47608
+ // int32
47595
47609
  case 6:
47610
+ // fixed64
47596
47611
  case 7:
47612
+ // fixed32
47597
47613
  case 8:
47614
+ // bool
47598
47615
  case 13:
47616
+ // uint32
47599
47617
  case 14:
47618
+ // enum (!)
47600
47619
  case 15:
47620
+ // sfixed32
47601
47621
  case 16:
47622
+ // sfixed64
47602
47623
  case 17:
47624
+ // sint32
47603
47625
  case 18:
47604
47626
  return true;
47605
47627
  }
@@ -47607,6 +47629,7 @@ var require_descriptor2 = __commonJS({
47607
47629
  }
47608
47630
  function toDescriptorType(type, resolvedType) {
47609
47631
  switch (type) {
47632
+ // 0 is reserved for errors
47610
47633
  case "double":
47611
47634
  return 1;
47612
47635
  case "float":
@@ -50243,6 +50266,7 @@ var require_subchannel_call = __commonJS({
50243
50266
  }
50244
50267
  this.trace("Received server headers:\n" + headersString);
50245
50268
  switch (headers[":status"]) {
50269
+ // TODO(murgatroid99): handle 100 and 101
50246
50270
  case 400:
50247
50271
  this.mappedStatusCode = constants_1.Status.INTERNAL;
50248
50272
  break;
@@ -67385,7 +67409,7 @@ var import_semantic_conventions = __toESM(require_src(), 1);
67385
67409
  import { getLogger } from "./request-context.cjs";
67386
67410
  var {
67387
67411
  default: { version, name }
67388
- } = await import("../../esm-chunks/package-KXKB2T7U.js");
67412
+ } = await import("../../esm-chunks/package-NNKZAPVX.js");
67389
67413
  var sdk = new import_sdk_node.NodeSDK({
67390
67414
  resource: new import_resources.Resource({
67391
67415
  [import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
@@ -146,7 +146,7 @@ var setCacheControlHeaders = (headers, request, requestContext) => {
146
146
  if (typeof requestContext.routeHandlerRevalidate !== "undefined" && ["GET", "HEAD"].includes(request.method) && !headers.has("cdn-cache-control") && !headers.has("netlify-cdn-cache-control")) {
147
147
  const cdnCacheControl = (
148
148
  // if we are serving already stale response, instruct edge to not attempt to cache that response
149
- 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`
149
+ headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate, durable" : `s-maxage=${requestContext.routeHandlerRevalidate === false ? 31536e3 : requestContext.routeHandlerRevalidate}, stale-while-revalidate=31536000, durable`
150
150
  );
151
151
  headers.set("netlify-cdn-cache-control", cdnCacheControl);
152
152
  return;
@@ -159,7 +159,7 @@ var setCacheControlHeaders = (headers, request, requestContext) => {
159
159
  ]);
160
160
  const cdnCacheControl = (
161
161
  // if we are serving already stale response, instruct edge to not attempt to cache that response
162
- headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate" : [
162
+ headers.get("x-nextjs-cache") === "STALE" ? "public, max-age=0, must-revalidate, durable" : [
163
163
  ...getHeaderValueArray(cacheControl).map(
164
164
  (value) => value === "stale-while-revalidate" ? "stale-while-revalidate=31536000" : value
165
165
  ),
package/dist/run/next.cjs CHANGED
@@ -494,6 +494,7 @@ var import_fs_monkey = __toESM(require_lib());
494
494
  var import_request_context = require("./handlers/request-context.cjs");
495
495
  var import_tracer = require("./handlers/tracer.cjs");
496
496
  var import_regional_blob_store = require("./regional-blob-store.cjs");
497
+ process.env.NODE_ENV = "production";
497
498
  console.time("import next server");
498
499
  var { getRequestHandlers } = require("next/dist/server/lib/start-server.js");
499
500
  var ResponseCache = require("next/dist/server/response-cache/index.js").default;
@@ -328,7 +328,11 @@ var Store = class _Store {
328
328
  this.client = options.client;
329
329
  if ("deployID" in options) {
330
330
  _Store.validateDeployID(options.deployID);
331
- this.name = DEPLOY_STORE_PREFIX + options.deployID;
331
+ let name = DEPLOY_STORE_PREFIX + options.deployID;
332
+ if (options.name) {
333
+ name += `:${options.name}`;
334
+ }
335
+ this.name = name;
332
336
  } else if (options.name.startsWith(LEGACY_STORE_INTERNAL_PREFIX)) {
333
337
  const storeName = options.name.slice(LEGACY_STORE_INTERNAL_PREFIX.length);
334
338
  _Store.validateStoreName(storeName);
@@ -558,8 +562,9 @@ var Store = class _Store {
558
562
  };
559
563
  }
560
564
  };
561
- var getDeployStore = (options = {}) => {
565
+ var getDeployStore = (input = {}) => {
562
566
  const context = getEnvironmentContext();
567
+ const options = typeof input === "string" ? { name: input } : input;
563
568
  const deployID = options.deployID ?? context.deployID;
564
569
  if (!deployID) {
565
570
  throw new MissingBlobsEnvironmentError(["deployID"]);
@@ -581,14 +586,15 @@ var getDeployStore = (options = {}) => {
581
586
  clientOptions.region = options.experimentalRegion;
582
587
  }
583
588
  const client = new Client(clientOptions);
584
- return new Store({ client, deployID });
589
+ return new Store({ client, deployID, name: options.name });
585
590
  };
586
591
 
587
592
  // src/run/regional-blob-store.cts
588
593
  var fetchBeforeNextPatchedIt = globalThis.fetch;
589
594
  var getRegionalBlobStore = (args = {}) => {
595
+ const options = typeof args === "string" ? { name: args } : args;
590
596
  return getDeployStore({
591
- ...args,
597
+ ...options,
592
598
  fetch: fetchBeforeNextPatchedIt,
593
599
  experimentalRegion: process.env.USE_REGIONAL_BLOBS?.toUpperCase() === "TRUE" ? "context" : void 0
594
600
  });
@@ -3,6 +3,10 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
6
10
  var __copyProps = (to, from, except, desc) => {
7
11
  if (from && typeof from === "object" || typeof from === "function") {
8
12
  for (let key of __getOwnPropNames(from))
@@ -15,4 +19,15 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
15
19
 
16
20
  // src/shared/cache-types.cts
17
21
  var cache_types_exports = {};
22
+ __export(cache_types_exports, {
23
+ isCachedPageValue: () => isCachedPageValue,
24
+ isCachedRouteValue: () => isCachedRouteValue
25
+ });
18
26
  module.exports = __toCommonJS(cache_types_exports);
27
+ var isCachedPageValue = (value) => value.kind === "PAGE" || value.kind === "PAGES";
28
+ var isCachedRouteValue = (value) => value.kind === "ROUTE" || value.kind === "APP_ROUTE";
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ isCachedPageValue,
32
+ isCachedRouteValue
33
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.7.0",
3
+ "version": "5.7.2",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",