@netlify/plugin-nextjs 5.10.4 → 5.10.6

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.
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../esm-chunks/chunk-GNGHTHMQ.js";
14
14
  import {
15
15
  require_out
16
- } from "../../esm-chunks/chunk-KGYJQ2U2.js";
16
+ } from "../../esm-chunks/chunk-NFOLXH6F.js";
17
17
  import {
18
18
  require_semver
19
19
  } from "../../esm-chunks/chunk-APO262HE.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../esm-chunks/chunk-GNGHTHMQ.js";
14
14
  import {
15
15
  require_out
16
- } from "../../esm-chunks/chunk-KGYJQ2U2.js";
16
+ } from "../../esm-chunks/chunk-NFOLXH6F.js";
17
17
  import {
18
18
  require_semver
19
19
  } from "../../esm-chunks/chunk-APO262HE.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../esm-chunks/chunk-GNGHTHMQ.js";
14
14
  import {
15
15
  require_out
16
- } from "../../esm-chunks/chunk-KGYJQ2U2.js";
16
+ } from "../../esm-chunks/chunk-NFOLXH6F.js";
17
17
  import {
18
18
  __toESM
19
19
  } from "../../esm-chunks/chunk-OEQOKJGE.js";
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "../../esm-chunks/chunk-KGYJQ2U2.js";
9
+ } from "../../esm-chunks/chunk-NFOLXH6F.js";
10
10
  import {
11
11
  __commonJS,
12
12
  __toESM
@@ -13,7 +13,7 @@ import {
13
13
  } from "../../esm-chunks/chunk-GNGHTHMQ.js";
14
14
  import {
15
15
  require_out
16
- } from "../../esm-chunks/chunk-KGYJQ2U2.js";
16
+ } from "../../esm-chunks/chunk-NFOLXH6F.js";
17
17
  import {
18
18
  __toESM
19
19
  } from "../../esm-chunks/chunk-OEQOKJGE.js";
@@ -6,7 +6,7 @@
6
6
 
7
7
  import {
8
8
  require_out
9
- } from "../esm-chunks/chunk-KGYJQ2U2.js";
9
+ } from "../esm-chunks/chunk-NFOLXH6F.js";
10
10
  import {
11
11
  require_semver
12
12
  } from "../esm-chunks/chunk-APO262HE.js";
@@ -3062,7 +3062,7 @@ var require_pattern = __commonJS({
3062
3062
  "node_modules/fast-glob/out/utils/pattern.js"(exports) {
3063
3063
  "use strict";
3064
3064
  Object.defineProperty(exports, "__esModule", { value: true });
3065
- exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
3065
+ exports.isAbsolute = exports.partitionAbsoluteAndRelative = exports.removeDuplicateSlashes = exports.matchAny = exports.convertPatternsToRe = exports.makeRe = exports.getPatternParts = exports.expandBraceExpansion = exports.expandPatternsWithBraceExpansion = exports.isAffectDepthOfReadingPattern = exports.endsWithSlashGlobStar = exports.hasGlobStar = exports.getBaseDirectory = exports.isPatternRelatedToParentDirectory = exports.getPatternsOutsideCurrentDirectory = exports.getPatternsInsideCurrentDirectory = exports.getPositivePatterns = exports.getNegativePatterns = exports.isPositivePattern = exports.isNegativePattern = exports.convertToNegativePattern = exports.convertToPositivePattern = exports.isDynamicPattern = exports.isStaticPattern = void 0;
3066
3066
  var path = __require("path");
3067
3067
  var globParent = require_glob_parent();
3068
3068
  var micromatch = require_micromatch();
@@ -3202,6 +3202,23 @@ var require_pattern = __commonJS({
3202
3202
  return pattern.replace(DOUBLE_SLASH_RE, "/");
3203
3203
  }
3204
3204
  exports.removeDuplicateSlashes = removeDuplicateSlashes;
3205
+ function partitionAbsoluteAndRelative(patterns) {
3206
+ const absolute = [];
3207
+ const relative = [];
3208
+ for (const pattern of patterns) {
3209
+ if (isAbsolute(pattern)) {
3210
+ absolute.push(pattern);
3211
+ } else {
3212
+ relative.push(pattern);
3213
+ }
3214
+ }
3215
+ return [absolute, relative];
3216
+ }
3217
+ exports.partitionAbsoluteAndRelative = partitionAbsoluteAndRelative;
3218
+ function isAbsolute(pattern) {
3219
+ return path.isAbsolute(pattern);
3220
+ }
3221
+ exports.isAbsolute = isAbsolute;
3205
3222
  }
3206
3223
  });
3207
3224
 
@@ -4977,11 +4994,19 @@ var require_entry = __commonJS({
4977
4994
  this.index = /* @__PURE__ */ new Map();
4978
4995
  }
4979
4996
  getFilter(positive, negative) {
4980
- const positiveRe = utils.pattern.convertPatternsToRe(positive, this._micromatchOptions);
4981
- const negativeRe = utils.pattern.convertPatternsToRe(negative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }));
4982
- return (entry) => this._filter(entry, positiveRe, negativeRe);
4997
+ const [absoluteNegative, relativeNegative] = utils.pattern.partitionAbsoluteAndRelative(negative);
4998
+ const patterns = {
4999
+ positive: {
5000
+ all: utils.pattern.convertPatternsToRe(positive, this._micromatchOptions)
5001
+ },
5002
+ negative: {
5003
+ absolute: utils.pattern.convertPatternsToRe(absoluteNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true })),
5004
+ relative: utils.pattern.convertPatternsToRe(relativeNegative, Object.assign(Object.assign({}, this._micromatchOptions), { dot: true }))
5005
+ }
5006
+ };
5007
+ return (entry) => this._filter(entry, patterns);
4983
5008
  }
4984
- _filter(entry, positiveRe, negativeRe) {
5009
+ _filter(entry, patterns) {
4985
5010
  const filepath = utils.path.removeLeadingDotSegment(entry.path);
4986
5011
  if (this._settings.unique && this._isDuplicateEntry(filepath)) {
4987
5012
  return false;
@@ -4989,11 +5014,7 @@ var require_entry = __commonJS({
4989
5014
  if (this._onlyFileFilter(entry) || this._onlyDirectoryFilter(entry)) {
4990
5015
  return false;
4991
5016
  }
4992
- if (this._isSkippedByAbsoluteNegativePatterns(filepath, negativeRe)) {
4993
- return false;
4994
- }
4995
- const isDirectory = entry.dirent.isDirectory();
4996
- const isMatched = this._isMatchToPatterns(filepath, positiveRe, isDirectory) && !this._isMatchToPatterns(filepath, negativeRe, isDirectory);
5017
+ const isMatched = this._isMatchToPatternsSet(filepath, patterns, entry.dirent.isDirectory());
4997
5018
  if (this._settings.unique && isMatched) {
4998
5019
  this._createIndexRecord(filepath);
4999
5020
  }
@@ -5011,14 +5032,32 @@ var require_entry = __commonJS({
5011
5032
  _onlyDirectoryFilter(entry) {
5012
5033
  return this._settings.onlyDirectories && !entry.dirent.isDirectory();
5013
5034
  }
5014
- _isSkippedByAbsoluteNegativePatterns(entryPath, patternsRe) {
5015
- if (!this._settings.absolute) {
5035
+ _isMatchToPatternsSet(filepath, patterns, isDirectory) {
5036
+ const isMatched = this._isMatchToPatterns(filepath, patterns.positive.all, isDirectory);
5037
+ if (!isMatched) {
5016
5038
  return false;
5017
5039
  }
5018
- const fullpath = utils.path.makeAbsolute(this._settings.cwd, entryPath);
5019
- return utils.pattern.matchAny(fullpath, patternsRe);
5040
+ const isMatchedByRelativeNegative = this._isMatchToPatterns(filepath, patterns.negative.relative, isDirectory);
5041
+ if (isMatchedByRelativeNegative) {
5042
+ return false;
5043
+ }
5044
+ const isMatchedByAbsoluteNegative = this._isMatchToAbsoluteNegative(filepath, patterns.negative.absolute, isDirectory);
5045
+ if (isMatchedByAbsoluteNegative) {
5046
+ return false;
5047
+ }
5048
+ return true;
5049
+ }
5050
+ _isMatchToAbsoluteNegative(filepath, patternsRe, isDirectory) {
5051
+ if (patternsRe.length === 0) {
5052
+ return false;
5053
+ }
5054
+ const fullpath = utils.path.makeAbsolute(this._settings.cwd, filepath);
5055
+ return this._isMatchToPatterns(fullpath, patternsRe, isDirectory);
5020
5056
  }
5021
5057
  _isMatchToPatterns(filepath, patternsRe, isDirectory) {
5058
+ if (patternsRe.length === 0) {
5059
+ return false;
5060
+ }
5022
5061
  const isMatched = utils.pattern.matchAny(filepath, patternsRe);
5023
5062
  if (!isMatched && isDirectory) {
5024
5063
  return utils.pattern.matchAny(filepath + "/", patternsRe);
@@ -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.4";
11
+ var version = "5.10.6";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -58,13 +58,13 @@ 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.1",
62
- "@netlify/edge-bundler": "^12.4.0",
61
+ "@netlify/build": "^32.0.0",
62
+ "@netlify/edge-bundler": "^13.0.2",
63
63
  "@netlify/edge-functions": "^2.11.1",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
65
  "@netlify/functions": "^3.0.4",
66
- "@netlify/serverless-functions-api": "^1.36.0",
67
- "@netlify/zip-it-and-ship-it": "^10.0.4",
66
+ "@netlify/serverless-functions-api": "^1.37.0",
67
+ "@netlify/zip-it-and-ship-it": "^10.0.6",
68
68
  "@opentelemetry/api": "^1.8.0",
69
69
  "@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
70
70
  "@opentelemetry/resources": "^1.24.0",
@@ -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.5",
91
+ "netlify-cli": "^20.0.0",
92
92
  next: "^15.0.0-canary.28",
93
93
  os: "^0.1.2",
94
94
  outdent: "^0.8.0",
@@ -100,7 +100,7 @@ var devDependencies = {
100
100
  typescript: "^5.4.5",
101
101
  unionfs: "^4.5.4",
102
102
  uuid: "^10.0.0",
103
- vitest: "^1.5.3"
103
+ vitest: "^3.0.0"
104
104
  };
105
105
  var clean_package = {
106
106
  indent: 2,
@@ -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.4";
198
+ var version = "5.10.6";
199
199
 
200
200
  // src/run/handlers/cache.cts
201
201
  var import_cache_types = require("../../shared/cache-types.cjs");
@@ -3185,7 +3185,7 @@ var server_default = async (request, _context, topLevelSpan, requestContext) =>
3185
3185
  netlifyVary,
3186
3186
  netlifyCdnCacheControl
3187
3187
  });
3188
- if (requestContext.isCacheableAppPage) {
3188
+ if (requestContext.isCacheableAppPage && response.status !== 304) {
3189
3189
  const isRSCRequest = request.headers.get("rsc") === "1";
3190
3190
  const contentType = response.headers.get("content-type") ?? void 0;
3191
3191
  const isExpectedContentType = (isRSCRequest && contentType?.includes("text/x-component") || !isRSCRequest && contentType?.includes("text/html")) ?? false;
@@ -26995,50 +26995,64 @@ var require_common3 = __commonJS({
26995
26995
  createDebug.namespaces = namespaces;
26996
26996
  createDebug.names = [];
26997
26997
  createDebug.skips = [];
26998
- let i;
26999
- const split = (typeof namespaces === "string" ? namespaces : "").split(/[\s,]+/);
27000
- const len = split.length;
27001
- for (i = 0; i < len; i++) {
27002
- if (!split[i]) {
27003
- continue;
26998
+ const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(" ", ",").split(",").filter(Boolean);
26999
+ for (const ns of split) {
27000
+ if (ns[0] === "-") {
27001
+ createDebug.skips.push(ns.slice(1));
27002
+ } else {
27003
+ createDebug.names.push(ns);
27004
27004
  }
27005
- namespaces = split[i].replace(/\*/g, ".*?");
27006
- if (namespaces[0] === "-") {
27007
- createDebug.skips.push(new RegExp("^" + namespaces.slice(1) + "$"));
27005
+ }
27006
+ }
27007
+ function matchesTemplate(search, template) {
27008
+ let searchIndex = 0;
27009
+ let templateIndex = 0;
27010
+ let starIndex = -1;
27011
+ let matchIndex = 0;
27012
+ while (searchIndex < search.length) {
27013
+ if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
27014
+ if (template[templateIndex] === "*") {
27015
+ starIndex = templateIndex;
27016
+ matchIndex = searchIndex;
27017
+ templateIndex++;
27018
+ } else {
27019
+ searchIndex++;
27020
+ templateIndex++;
27021
+ }
27022
+ } else if (starIndex !== -1) {
27023
+ templateIndex = starIndex + 1;
27024
+ matchIndex++;
27025
+ searchIndex = matchIndex;
27008
27026
  } else {
27009
- createDebug.names.push(new RegExp("^" + namespaces + "$"));
27027
+ return false;
27010
27028
  }
27011
27029
  }
27030
+ while (templateIndex < template.length && template[templateIndex] === "*") {
27031
+ templateIndex++;
27032
+ }
27033
+ return templateIndex === template.length;
27012
27034
  }
27013
27035
  function disable() {
27014
27036
  const namespaces = [
27015
- ...createDebug.names.map(toNamespace),
27016
- ...createDebug.skips.map(toNamespace).map((namespace) => "-" + namespace)
27037
+ ...createDebug.names,
27038
+ ...createDebug.skips.map((namespace) => "-" + namespace)
27017
27039
  ].join(",");
27018
27040
  createDebug.enable("");
27019
27041
  return namespaces;
27020
27042
  }
27021
27043
  function enabled(name2) {
27022
- if (name2[name2.length - 1] === "*") {
27023
- return true;
27024
- }
27025
- let i;
27026
- let len;
27027
- for (i = 0, len = createDebug.skips.length; i < len; i++) {
27028
- if (createDebug.skips[i].test(name2)) {
27044
+ for (const skip of createDebug.skips) {
27045
+ if (matchesTemplate(name2, skip)) {
27029
27046
  return false;
27030
27047
  }
27031
27048
  }
27032
- for (i = 0, len = createDebug.names.length; i < len; i++) {
27033
- if (createDebug.names[i].test(name2)) {
27049
+ for (const ns of createDebug.names) {
27050
+ if (matchesTemplate(name2, ns)) {
27034
27051
  return true;
27035
27052
  }
27036
27053
  }
27037
27054
  return false;
27038
27055
  }
27039
- function toNamespace(regexp) {
27040
- return regexp.toString().substring(2, regexp.toString().length - 2).replace(/\.\*\?$/, "*");
27041
- }
27042
27056
  function coerce(val) {
27043
27057
  if (val instanceof Error) {
27044
27058
  return val.stack || val.message;
@@ -27157,10 +27171,11 @@ var require_browser2 = __commonJS({
27157
27171
  if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
27158
27172
  return false;
27159
27173
  }
27174
+ let m;
27160
27175
  return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773
27161
27176
  typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31?
27162
27177
  // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
27163
- typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
27178
+ typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
27164
27179
  typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
27165
27180
  }
27166
27181
  function formatArgs(args) {
@@ -27501,7 +27516,7 @@ var require_node16 = __commonJS({
27501
27516
  return (/* @__PURE__ */ new Date()).toISOString() + " ";
27502
27517
  }
27503
27518
  function log(...args) {
27504
- return process.stderr.write(util.format(...args) + "\n");
27519
+ return process.stderr.write(util.formatWithOptions(exports2.inspectOpts, ...args) + "\n");
27505
27520
  }
27506
27521
  function save(namespaces) {
27507
27522
  if (namespaces) {
@@ -68866,7 +68881,7 @@ var import_semantic_conventions = __toESM(require_src(), 1);
68866
68881
  import { getLogger } from "./request-context.cjs";
68867
68882
  var {
68868
68883
  default: { version, name }
68869
- } = await import("../../esm-chunks/package-GF3YXDC5.js");
68884
+ } = await import("../../esm-chunks/package-GOVVBALR.js");
68870
68885
  var sdk = new import_sdk_node.NodeSDK({
68871
68886
  resource: new import_resources.Resource({
68872
68887
  [import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
@@ -28,7 +28,17 @@ var generateNetlifyVaryValues = ({
28
28
  }
29
29
  }
30
30
  if (header.length !== 0) {
31
- values.push(`header=${header.join(`|`)}`);
31
+ const uniqueHeaderNames = [
32
+ ...new Set(
33
+ header.map(
34
+ (headerName) => (
35
+ // header names are case insensitive
36
+ headerName.toLowerCase()
37
+ )
38
+ )
39
+ )
40
+ ];
41
+ values.push(`header=${uniqueHeaderNames.join(`|`)}`);
32
42
  }
33
43
  if (language.length !== 0) {
34
44
  values.push(`language=${language.join(`|`)}`);
@@ -53,10 +63,22 @@ var omitHeaderValues = (header, values) => {
53
63
  };
54
64
  var setVaryHeaders = (headers, request, { basePath, i18n }) => {
55
65
  const netlifyVaryValues = {
56
- header: ["x-nextjs-data", "x-next-debug-logging"],
66
+ header: [
67
+ "x-nextjs-data",
68
+ "x-next-debug-logging",
69
+ // using _rsc query param might not be enough because it is stripped for middleware redirect and rewrites
70
+ // so adding all request headers that are used to produce the _rsc query param
71
+ // https://github.com/vercel/next.js/blob/e5fe535ed17cee5e1d5576ccc33e4c49b5da1273/packages/next/src/client/components/router-reducer/set-cache-busting-search-param.ts#L32-L39
72
+ "Next-Router-Prefetch",
73
+ "Next-Router-Segment-Prefetch",
74
+ "Next-Router-State-Tree",
75
+ "Next-Url",
76
+ // and exact header that actually instruct Next.js to produce RSC response
77
+ "RSC"
78
+ ],
57
79
  language: [],
58
80
  cookie: ["__prerender_bypass", "__next_preview_data"],
59
- query: ["__nextDataReq"],
81
+ query: ["__nextDataReq", "_rsc"],
60
82
  country: []
61
83
  };
62
84
  const vary = headers.get("vary");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.10.4",
3
+ "version": "5.10.6",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",