@netlify/plugin-nextjs 5.2.0 → 5.2.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.
@@ -78,6 +78,7 @@ var Queue = class {
78
78
  };
79
79
 
80
80
  // node_modules/p-limit/index.js
81
+ import { AsyncResource } from "async_hooks";
81
82
  function pLimit(concurrency) {
82
83
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
83
84
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
@@ -90,9 +91,9 @@ function pLimit(concurrency) {
90
91
  queue.dequeue()();
91
92
  }
92
93
  };
93
- const run = async (fn, resolve, args) => {
94
+ const run = async (function_, resolve, arguments_) => {
94
95
  activeCount++;
95
- const result = (async () => fn(...args))();
96
+ const result = (async () => function_(...arguments_))();
96
97
  resolve(result);
97
98
  try {
98
99
  await result;
@@ -100,8 +101,10 @@ function pLimit(concurrency) {
100
101
  }
101
102
  next();
102
103
  };
103
- const enqueue = (fn, resolve, args) => {
104
- queue.enqueue(run.bind(void 0, fn, resolve, args));
104
+ const enqueue = (function_, resolve, arguments_) => {
105
+ queue.enqueue(
106
+ AsyncResource.bind(run.bind(void 0, function_, resolve, arguments_))
107
+ );
105
108
  (async () => {
106
109
  await Promise.resolve();
107
110
  if (activeCount < concurrency && queue.size > 0) {
@@ -109,8 +112,8 @@ function pLimit(concurrency) {
109
112
  }
110
113
  })();
111
114
  };
112
- const generator = (fn, ...args) => new Promise((resolve) => {
113
- enqueue(fn, resolve, args);
115
+ const generator = (function_, ...arguments_) => new Promise((resolve) => {
116
+ enqueue(function_, resolve, arguments_);
114
117
  });
115
118
  Object.defineProperties(generator, {
116
119
  activeCount: {
@@ -120,7 +123,7 @@ function pLimit(concurrency) {
120
123
  get: () => queue.size
121
124
  },
122
125
  clearQueue: {
123
- value: () => {
126
+ value() {
124
127
  queue.clear();
125
128
  }
126
129
  }
@@ -6,7 +6,6 @@
6
6
 
7
7
  import {
8
8
  __commonJS,
9
- __require,
10
9
  __toESM
11
10
  } from "../esm-chunks/chunk-5JVNISGM.js";
12
11
 
@@ -223,20 +222,21 @@ var require_utils = __commonJS({
223
222
  exports.isRegexChar = (str) => str.length === 1 && exports.hasRegexChars(str);
224
223
  exports.escapeRegex = (str) => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, "\\$1");
225
224
  exports.toPosixSlashes = (str) => str.replace(REGEX_BACKSLASH, "/");
225
+ exports.isWindows = () => {
226
+ if (typeof navigator !== "undefined" && navigator.platform) {
227
+ const platform = navigator.platform.toLowerCase();
228
+ return platform === "win32" || platform === "windows";
229
+ }
230
+ if (typeof process !== "undefined" && process.platform) {
231
+ return process.platform === "win32";
232
+ }
233
+ return false;
234
+ };
226
235
  exports.removeBackslashes = (str) => {
227
236
  return str.replace(REGEX_REMOVE_BACKSLASH, (match) => {
228
237
  return match === "\\" ? "" : match;
229
238
  });
230
239
  };
231
- exports.supportsLookbehinds = () => {
232
- if (typeof process !== "undefined") {
233
- const segs = process.version.slice(1).split(".").map(Number);
234
- if (segs.length === 3 && segs[0] >= 9 || segs[0] === 8 && segs[1] >= 10) {
235
- return true;
236
- }
237
- }
238
- return false;
239
- };
240
240
  exports.escapeLast = (input, char, lastIdx) => {
241
241
  const idx = input.lastIndexOf(char, lastIdx);
242
242
  if (idx === -1)
@@ -753,8 +753,8 @@ var require_parse = __commonJS({
753
753
  if (tok.value || tok.output)
754
754
  append(tok);
755
755
  if (prev && prev.type === "text" && tok.type === "text") {
756
+ prev.output = (prev.output || prev.value) + tok.value;
756
757
  prev.value += tok.value;
757
- prev.output = (prev.output || "") + tok.value;
758
758
  return;
759
759
  }
760
760
  tok.prev = prev;
@@ -1091,9 +1091,6 @@ var require_parse = __commonJS({
1091
1091
  if (prev && prev.type === "paren") {
1092
1092
  const next = peek();
1093
1093
  let output = value;
1094
- if (next === "<" && !utils.supportsLookbehinds()) {
1095
- throw new Error("Node.js v10 or higher is required for regex lookbehinds");
1096
- }
1097
1094
  if (prev.value === "(" && !/[!=<:]/.test(next) || next === "<" && !/<([!=]|\w+>)/.test(remaining())) {
1098
1095
  output = `\\${value}`;
1099
1096
  }
@@ -1532,24 +1529,16 @@ var require_picomatch = __commonJS({
1532
1529
  var require_picomatch2 = __commonJS({
1533
1530
  "node_modules/picomatch/index.js"(exports, module) {
1534
1531
  "use strict";
1535
- var os = __require("os");
1536
1532
  var pico = require_picomatch();
1537
- var isWindows = os.platform() === "win32";
1533
+ var utils = require_utils();
1538
1534
  function picomatch(glob, options, returnState = false) {
1539
1535
  if (options && (options.windows === null || options.windows === void 0)) {
1540
- options = { ...options, windows: isWindows };
1536
+ options = { ...options, windows: utils.isWindows() };
1541
1537
  }
1542
1538
  return pico(glob, options, returnState);
1543
1539
  }
1540
+ Object.assign(picomatch, pico);
1544
1541
  module.exports = picomatch;
1545
- module.exports.test = pico.test;
1546
- module.exports.matchBase = pico.matchBase;
1547
- module.exports.isMatch = pico.isMatch;
1548
- module.exports.parse = pico.parse;
1549
- module.exports.scan = pico.scan;
1550
- module.exports.compileRe = pico.compileRe;
1551
- module.exports.toRegex = pico.toRegex;
1552
- module.exports.makeRe = pico.makeRe;
1553
1542
  }
1554
1543
  });
1555
1544
 
@@ -16,9 +16,7 @@ export default async function (req, context) {
16
16
  tracing.start()
17
17
  }
18
18
 
19
- const requestContext = createRequestContext(
20
- req.headers.get('x-nf-debug-logging') || req.headers.get('x-next-debug-logging'),
21
- )
19
+ const requestContext = createRequestContext(req.headers.get('x-next-debug-logging'))
22
20
  const tracer = getTracer()
23
21
 
24
22
  const handlerResponse = await runWithRequestContext(requestContext, () => {
@@ -13,9 +13,7 @@ export default async function handler(req, context) {
13
13
  if (process.env.NETLIFY_OTLP_TRACE_EXPORTER_URL) {
14
14
  tracing.start()
15
15
  }
16
- const requestContext = createRequestContext(
17
- req.headers.get('x-nf-debug-logging') || req.headers.get('x-next-debug-logging'),
18
- )
16
+ const requestContext = createRequestContext(req.headers.get('x-next-debug-logging'))
19
17
  const tracer = getTracer()
20
18
 
21
19
  const handlerResponse = await runWithRequestContext(requestContext, () => {
@@ -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.2.0";
11
+ var version = "5.2.2";
12
12
  var description = "Run Next.js seamlessly on Netlify";
13
13
  var main = "./dist/index.js";
14
14
  var type = "module";
@@ -58,21 +58,21 @@ var homepage = "https://github.com/netlify/next-runtime-minimal#readme";
58
58
  var devDependencies = {
59
59
  "@fastly/http-compute-js": "1.1.4",
60
60
  "@netlify/blobs": "^7.3.0",
61
- "@netlify/build": "^29.41.0",
61
+ "@netlify/build": "^29.41.2",
62
62
  "@netlify/edge-bundler": "^12.0.0",
63
- "@netlify/edge-functions": "^2.5.1",
63
+ "@netlify/edge-functions": "^2.6.1",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
- "@netlify/functions": "^2.5.1",
66
- "@netlify/serverless-functions-api": "^1.10.1",
67
- "@netlify/zip-it-and-ship-it": "^9.32.0",
65
+ "@netlify/functions": "^2.6.3",
66
+ "@netlify/serverless-functions-api": "^1.18.1",
67
+ "@netlify/zip-it-and-ship-it": "^9.32.2",
68
68
  "@opentelemetry/api": "^1.8.0",
69
- "@opentelemetry/exporter-trace-otlp-http": "^0.49.0",
70
- "@opentelemetry/resources": "^1.21.0",
71
- "@opentelemetry/sdk-node": "^0.49.0",
72
- "@opentelemetry/sdk-trace-node": "^1.21.0",
73
- "@opentelemetry/semantic-conventions": "^1.21.0",
74
- "@playwright/test": "^1.40.0",
75
- "@types/node": "^20.9.2",
69
+ "@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
70
+ "@opentelemetry/resources": "^1.24.0",
71
+ "@opentelemetry/sdk-node": "^0.51.0",
72
+ "@opentelemetry/sdk-trace-node": "^1.24.0",
73
+ "@opentelemetry/semantic-conventions": "^1.24.0",
74
+ "@playwright/test": "^1.43.1",
75
+ "@types/node": "^20.12.7",
76
76
  "@types/picomatch": "^2.3.3",
77
77
  "@types/uuid": "^9.0.6",
78
78
  "@vercel/nft": "^0.26.0",
@@ -81,24 +81,24 @@ var devDependencies = {
81
81
  esbuild: "^0.20.0",
82
82
  execa: "^8.0.1",
83
83
  "fast-glob": "^3.3.2",
84
- "fs-monkey": "^1.0.5",
85
- "get-port": "^7.0.0",
86
- "lambda-local": "^2.1.2",
87
- memfs: "^4.6.0",
84
+ "fs-monkey": "^1.0.6",
85
+ "get-port": "^7.1.0",
86
+ "lambda-local": "^2.2.0",
87
+ memfs: "^4.9.2",
88
88
  "mock-require": "^3.0.3",
89
89
  msw: "^2.0.7",
90
90
  next: "^14.0.4",
91
91
  os: "^0.1.2",
92
92
  outdent: "^0.8.0",
93
- "p-limit": "^4.0.0",
93
+ "p-limit": "^5.0.0",
94
94
  "path-to-regexp": "^6.2.1",
95
- picomatch: "^3.0.1",
95
+ picomatch: "^4.0.2",
96
96
  prettier: "^3.2.5",
97
97
  semver: "^7.6.0",
98
- typescript: "^5.1.6",
99
- unionfs: "^4.5.1",
98
+ typescript: "^5.4.5",
99
+ unionfs: "^4.5.4",
100
100
  uuid: "^9.0.1",
101
- vitest: "^1.4.0"
101
+ vitest: "^1.5.3"
102
102
  };
103
103
  var clean_package = {
104
104
  indent: 2,
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __commonJS = (cb, mod) => function __require() {
9
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
- };
11
8
  var __export = (target, all) => {
12
9
  for (var name in all)
13
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -30,230 +27,71 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
30
27
  ));
31
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
29
 
33
- // node_modules/is-promise/index.js
34
- var require_is_promise = __commonJS({
35
- "node_modules/is-promise/index.js"(exports2, module2) {
36
- module2.exports = isPromise;
37
- module2.exports.default = isPromise;
38
- function isPromise(obj) {
39
- return !!obj && (typeof obj === "object" || typeof obj === "function") && typeof obj.then === "function";
40
- }
41
- }
42
- });
43
-
44
- // node_modules/@netlify/functions/dist/lib/consts.js
45
- var require_consts = __commonJS({
46
- "node_modules/@netlify/functions/dist/lib/consts.js"(exports2) {
47
- "use strict";
48
- Object.defineProperty(exports2, "__esModule", { value: true });
49
- exports2.METADATA_VERSION = exports2.HTTP_STATUS_OK = exports2.HTTP_STATUS_METHOD_NOT_ALLOWED = exports2.BUILDER_FUNCTIONS_FLAG = void 0;
50
- var BUILDER_FUNCTIONS_FLAG = true;
51
- exports2.BUILDER_FUNCTIONS_FLAG = BUILDER_FUNCTIONS_FLAG;
52
- var HTTP_STATUS_METHOD_NOT_ALLOWED = 405;
53
- exports2.HTTP_STATUS_METHOD_NOT_ALLOWED = HTTP_STATUS_METHOD_NOT_ALLOWED;
54
- var HTTP_STATUS_OK = 200;
55
- exports2.HTTP_STATUS_OK = HTTP_STATUS_OK;
56
- var METADATA_VERSION = 1;
57
- exports2.METADATA_VERSION = METADATA_VERSION;
58
- }
30
+ // src/run/handlers/cache.cts
31
+ var cache_exports = {};
32
+ __export(cache_exports, {
33
+ NetlifyCacheHandler: () => NetlifyCacheHandler,
34
+ default: () => cache_default
59
35
  });
36
+ module.exports = __toCommonJS(cache_exports);
37
+ var import_node_buffer = require("node:buffer");
60
38
 
61
- // node_modules/@netlify/functions/dist/lib/builder.js
62
- var require_builder = __commonJS({
63
- "node_modules/@netlify/functions/dist/lib/builder.js"(exports2) {
64
- "use strict";
65
- var __importDefault = exports2 && exports2.__importDefault || function(mod) {
66
- return mod && mod.__esModule ? mod : { "default": mod };
67
- };
68
- Object.defineProperty(exports2, "__esModule", { value: true });
69
- exports2.builder = void 0;
70
- var is_promise_1 = __importDefault(require_is_promise());
71
- var consts_js_1 = require_consts();
72
- var augmentResponse = (response) => {
73
- if (!response) {
74
- return response;
75
- }
76
- const metadata = { version: consts_js_1.METADATA_VERSION, builder_function: consts_js_1.BUILDER_FUNCTIONS_FLAG, ttl: response.ttl || 0 };
77
- return {
78
- ...response,
79
- metadata
80
- };
81
- };
82
- var wrapHandler = (handler) => (
83
- // eslint-disable-next-line promise/prefer-await-to-callbacks
84
- (event, context, callback) => {
85
- if (event.httpMethod !== "GET" && event.httpMethod !== "HEAD") {
86
- return Promise.resolve({
87
- body: "Method Not Allowed",
88
- statusCode: consts_js_1.HTTP_STATUS_METHOD_NOT_ALLOWED
89
- });
90
- }
91
- const modifiedEvent = {
92
- ...event,
93
- multiValueQueryStringParameters: {},
94
- queryStringParameters: {}
95
- };
96
- const wrappedCallback = (error, response) => (
97
- // eslint-disable-next-line promise/prefer-await-to-callbacks
98
- callback ? callback(error, augmentResponse(response)) : null
99
- );
100
- const execution = handler(modifiedEvent, context, wrappedCallback);
101
- if ((0, is_promise_1.default)(execution)) {
102
- return execution.then(augmentResponse);
103
- }
104
- return execution;
105
- }
39
+ // node_modules/@netlify/functions/dist/chunk-COIAWFHF.mjs
40
+ var import_process = require("process");
41
+ var purgeCache = async (options = {}) => {
42
+ if (globalThis.fetch === void 0) {
43
+ throw new Error(
44
+ "`fetch` is not available. Please ensure you're using Node.js version 18.0.0 or above. Refer to https://ntl.fyi/functions-runtime for more information."
106
45
  );
107
- exports2.builder = wrapHandler;
108
46
  }
109
- });
110
-
111
- // node_modules/@netlify/functions/dist/lib/purge_cache.js
112
- var require_purge_cache = __commonJS({
113
- "node_modules/@netlify/functions/dist/lib/purge_cache.js"(exports2) {
114
- "use strict";
115
- Object.defineProperty(exports2, "__esModule", { value: true });
116
- exports2.purgeCache = void 0;
117
- var process_1 = require("process");
118
- var purgeCache2 = async (options = {}) => {
119
- if (globalThis.fetch === void 0) {
120
- throw new Error("`fetch` is not available. Please ensure you're using Node.js version 18.0.0 or above. Refer to https://ntl.fyi/functions-runtime for more information.");
121
- }
122
- const payload = {
123
- cache_tags: options.tags,
124
- deploy_alias: options.deployAlias
125
- };
126
- const token = process_1.env.NETLIFY_PURGE_API_TOKEN || options.token;
127
- if ("siteSlug" in options) {
128
- payload.site_slug = options.siteSlug;
129
- } else if ("domain" in options) {
130
- payload.domain = options.domain;
131
- } else {
132
- const siteID = options.siteID || process_1.env.SITE_ID;
133
- if (!siteID) {
134
- throw new Error("The Netlify site ID was not found in the execution environment. Please supply it manually using the `siteID` property.");
135
- }
136
- payload.site_id = siteID;
137
- }
138
- if (!token) {
139
- throw new Error("The cache purge API token was not found in the execution environment. Please supply it manually using the `token` property.");
140
- }
141
- const apiURL = options.apiURL || "https://api.netlify.com";
142
- const response = await fetch(`${apiURL}/api/v1/purge`, {
143
- method: "POST",
144
- headers: {
145
- "Content-Type": "application/json; charset=utf8",
146
- Authorization: `Bearer ${token}`
147
- },
148
- body: JSON.stringify(payload)
149
- });
150
- if (!response.ok) {
151
- throw new Error(`Cache purge API call returned an unexpected status code: ${response.status}`);
152
- }
153
- };
154
- exports2.purgeCache = purgeCache2;
47
+ const payload = {
48
+ cache_tags: options.tags,
49
+ deploy_alias: options.deployAlias
50
+ };
51
+ const token = import_process.env.NETLIFY_PURGE_API_TOKEN || options.token;
52
+ if (import_process.env.NETLIFY_LOCAL && !token) {
53
+ const scope = options.tags?.length ? ` for tags ${options.tags?.join(", ")}` : "";
54
+ console.log(`Skipping purgeCache${scope} in local development.`);
55
+ return;
155
56
  }
156
- });
157
-
158
- // node_modules/@netlify/functions/dist/lib/schedule.js
159
- var require_schedule = __commonJS({
160
- "node_modules/@netlify/functions/dist/lib/schedule.js"(exports2) {
161
- "use strict";
162
- Object.defineProperty(exports2, "__esModule", { value: true });
163
- exports2.schedule = void 0;
164
- var schedule = (cron, handler) => handler;
165
- exports2.schedule = schedule;
57
+ if ("siteSlug" in options) {
58
+ payload.site_slug = options.siteSlug;
59
+ } else if ("domain" in options) {
60
+ payload.domain = options.domain;
61
+ } else {
62
+ const siteID = options.siteID || import_process.env.SITE_ID;
63
+ if (!siteID) {
64
+ throw new Error(
65
+ "The Netlify site ID was not found in the execution environment. Please supply it manually using the `siteID` property."
66
+ );
67
+ }
68
+ payload.site_id = siteID;
166
69
  }
167
- });
168
-
169
- // node_modules/@netlify/functions/dist/lib/stream.js
170
- var require_stream = __commonJS({
171
- "node_modules/@netlify/functions/dist/lib/stream.js"(exports2) {
172
- "use strict";
173
- Object.defineProperty(exports2, "__esModule", { value: true });
174
- exports2.stream = void 0;
175
- var node_stream_1 = require("node:stream");
176
- var node_util_1 = require("node:util");
177
- var pipeline = (0, node_util_1.promisify)(node_stream_1.pipeline);
178
- var stream = (handler) => awslambda.streamifyResponse(async (event, responseStream, context) => {
179
- const { body, ...httpResponseMetadata } = await handler(event, context);
180
- const responseBody = awslambda.HttpResponseStream.from(responseStream, httpResponseMetadata);
181
- if (typeof body === "undefined") {
182
- responseBody.end();
183
- } else if (typeof body === "string") {
184
- responseBody.write(body);
185
- responseBody.end();
186
- } else {
187
- await pipeline(body, responseBody);
188
- }
189
- });
190
- exports2.stream = stream;
70
+ if (!token) {
71
+ throw new Error(
72
+ "The cache purge API token was not found in the execution environment. Please supply it manually using the `token` property."
73
+ );
191
74
  }
192
- });
193
-
194
- // node_modules/@netlify/functions/dist/function/index.js
195
- var require_function = __commonJS({
196
- "node_modules/@netlify/functions/dist/function/index.js"(exports2) {
197
- "use strict";
198
- Object.defineProperty(exports2, "__esModule", { value: true });
75
+ const apiURL = options.apiURL || "https://api.netlify.com";
76
+ const response = await fetch(`${apiURL}/api/v1/purge`, {
77
+ method: "POST",
78
+ headers: {
79
+ "Content-Type": "application/json; charset=utf8",
80
+ Authorization: `Bearer ${token}`
81
+ },
82
+ body: JSON.stringify(payload)
83
+ });
84
+ if (!response.ok) {
85
+ throw new Error(`Cache purge API call returned an unexpected status code: ${response.status}`);
199
86
  }
200
- });
87
+ };
201
88
 
202
- // node_modules/@netlify/functions/dist/main.js
203
- var require_main = __commonJS({
204
- "node_modules/@netlify/functions/dist/main.js"(exports2) {
205
- "use strict";
206
- var __createBinding = exports2 && exports2.__createBinding || (Object.create ? function(o, m, k, k2) {
207
- if (k2 === void 0)
208
- k2 = k;
209
- var desc = Object.getOwnPropertyDescriptor(m, k);
210
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
211
- desc = { enumerable: true, get: function() {
212
- return m[k];
213
- } };
214
- }
215
- Object.defineProperty(o, k2, desc);
216
- } : function(o, m, k, k2) {
217
- if (k2 === void 0)
218
- k2 = k;
219
- o[k2] = m[k];
220
- });
221
- var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
222
- for (var p in m)
223
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p))
224
- __createBinding(exports3, m, p);
225
- };
226
- Object.defineProperty(exports2, "__esModule", { value: true });
227
- exports2.stream = exports2.schedule = exports2.purgeCache = exports2.builder = void 0;
228
- var builder_js_1 = require_builder();
229
- Object.defineProperty(exports2, "builder", { enumerable: true, get: function() {
230
- return builder_js_1.builder;
231
- } });
232
- var purge_cache_js_1 = require_purge_cache();
233
- Object.defineProperty(exports2, "purgeCache", { enumerable: true, get: function() {
234
- return purge_cache_js_1.purgeCache;
235
- } });
236
- var schedule_js_1 = require_schedule();
237
- Object.defineProperty(exports2, "schedule", { enumerable: true, get: function() {
238
- return schedule_js_1.schedule;
239
- } });
240
- var stream_js_1 = require_stream();
241
- Object.defineProperty(exports2, "stream", { enumerable: true, get: function() {
242
- return stream_js_1.stream;
243
- } });
244
- __exportStar(require_function(), exports2);
245
- }
246
- });
89
+ // node_modules/@netlify/functions/dist/chunk-XSZVKDJB.mjs
90
+ var import_stream = require("stream");
91
+ var import_util = require("util");
92
+ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
247
93
 
248
94
  // src/run/handlers/cache.cts
249
- var cache_exports = {};
250
- __export(cache_exports, {
251
- NetlifyCacheHandler: () => NetlifyCacheHandler,
252
- default: () => cache_default
253
- });
254
- module.exports = __toCommonJS(cache_exports);
255
- var import_node_buffer = require("node:buffer");
256
- var import_functions = __toESM(require_main());
257
95
  var import_constants = require("next/dist/lib/constants.js");
258
96
  var import_regional_blob_store = require("../regional-blob-store.cjs");
259
97
  var import_request_context = require("./request-context.cjs");
@@ -391,7 +229,7 @@ var NetlifyCacheHandler = class {
391
229
  if (requestContext?.didPagesRouterOnDemandRevalidate) {
392
230
  const tag = `_N_T_${key === "/index" ? "/" : key}`;
393
231
  console.debug("Purging CDN cache for:", [tag]);
394
- (0, import_functions.purgeCache)({ tags: [tag] }).catch((error) => {
232
+ purgeCache({ tags: [tag] }).catch((error) => {
395
233
  console.error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`, error);
396
234
  });
397
235
  }
@@ -399,18 +237,26 @@ var NetlifyCacheHandler = class {
399
237
  });
400
238
  }
401
239
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
402
- async revalidateTag(tag, ...args) {
403
- console.debug("NetlifyCacheHandler.revalidateTag", tag, args);
240
+ async revalidateTag(tagOrTags, ...args) {
241
+ console.debug("NetlifyCacheHandler.revalidateTag", tagOrTags, args);
242
+ const tags = Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags];
404
243
  const data = {
405
244
  revalidatedAt: Date.now()
406
245
  };
407
- try {
408
- await this.blobStore.setJSON(await this.encodeBlobKey(tag), data);
409
- } catch (error) {
410
- console.warn(`Failed to update tag manifest for ${tag}`, error);
411
- }
412
- (0, import_functions.purgeCache)({ tags: [tag] }).catch((error) => {
413
- console.error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`, error);
246
+ await Promise.all(
247
+ tags.map(async (tag) => {
248
+ try {
249
+ await this.blobStore.setJSON(await this.encodeBlobKey(tag), data);
250
+ } catch (error) {
251
+ console.warn(`Failed to update tag manifest for ${tag}`, error);
252
+ }
253
+ })
254
+ );
255
+ purgeCache({ tags }).catch((error) => {
256
+ console.error(
257
+ `[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`,
258
+ error
259
+ );
414
260
  });
415
261
  }
416
262
  resetRequestCache() {