@netlify/plugin-nextjs 5.9.1 → 5.9.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.
@@ -9,8 +9,8 @@ var __esm = (fn, res) => function __init() {
9
9
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
10
10
  };
11
11
  var __export = (target, all) => {
12
- for (var name in all)
13
- __defProp(target, name, { get: all[name], enumerable: true });
12
+ for (var name2 in all)
13
+ __defProp(target, name2, { get: all[name2], enumerable: true });
14
14
  };
15
15
  var __copyProps = (to, from, except, desc) => {
16
16
  if (from && typeof from === "object" || typeof from === "function") {
@@ -66,64 +66,145 @@ var import_node_buffer2 = require("node:buffer");
66
66
  var import_node_path = require("node:path");
67
67
  var import_posix = require("node:path/posix");
68
68
 
69
- // node_modules/@netlify/functions/dist/chunk-COIAWFHF.mjs
70
- var import_process = require("process");
71
- var purgeCache = async (options = {}) => {
72
- if (globalThis.fetch === void 0) {
73
- throw new Error(
74
- "`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."
75
- );
76
- }
77
- const payload = {
78
- cache_tags: options.tags,
79
- deploy_alias: options.deployAlias
80
- };
81
- const token = import_process.env.NETLIFY_PURGE_API_TOKEN || options.token;
82
- if (import_process.env.NETLIFY_LOCAL && !token) {
83
- const scope = options.tags?.length ? ` for tags ${options.tags?.join(", ")}` : "";
84
- console.log(`Skipping purgeCache${scope} in local development.`);
85
- return;
86
- }
87
- if ("siteSlug" in options) {
88
- payload.site_slug = options.siteSlug;
89
- } else if ("domain" in options) {
90
- payload.domain = options.domain;
91
- } else {
92
- const siteID = options.siteID || import_process.env.SITE_ID;
93
- if (!siteID) {
94
- throw new Error(
95
- "The Netlify site ID was not found in the execution environment. Please supply it manually using the `siteID` property."
96
- );
97
- }
98
- payload.site_id = siteID;
69
+ // node_modules/@netlify/functions/dist/chunk-C6P2IO65.mjs
70
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
71
+ var __esm2 = (fn, res) => function __init() {
72
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
73
+ };
74
+
75
+ // node_modules/@netlify/functions/dist/chunk-7VFCQORF.mjs
76
+ var BUILDER_FUNCTIONS_FLAG;
77
+ var HTTP_STATUS_METHOD_NOT_ALLOWED;
78
+ var HTTP_STATUS_OK;
79
+ var METADATA_VERSION;
80
+ var init_consts = __esm2({
81
+ "src/lib/consts.ts"() {
82
+ BUILDER_FUNCTIONS_FLAG = true;
83
+ HTTP_STATUS_METHOD_NOT_ALLOWED = 405;
84
+ HTTP_STATUS_OK = 200;
85
+ METADATA_VERSION = 1;
99
86
  }
100
- if (!token) {
101
- throw new Error(
102
- "The cache purge API token was not found in the execution environment. Please supply it manually using the `token` property."
87
+ });
88
+
89
+ // node_modules/@netlify/functions/dist/chunk-6V4VUZWK.mjs
90
+ var augmentResponse;
91
+ var wrapHandler;
92
+ var init_builder = __esm2({
93
+ "src/lib/builder.ts"() {
94
+ init_consts();
95
+ augmentResponse = (response) => {
96
+ if (!response) {
97
+ return response;
98
+ }
99
+ const metadata = { version: METADATA_VERSION, builder_function: BUILDER_FUNCTIONS_FLAG, ttl: response.ttl || 0 };
100
+ return {
101
+ ...response,
102
+ metadata
103
+ };
104
+ };
105
+ wrapHandler = (handler) => (
106
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
107
+ (event, context2, callback) => {
108
+ if (event.httpMethod !== "GET" && event.httpMethod !== "HEAD") {
109
+ return Promise.resolve({
110
+ body: "Method Not Allowed",
111
+ statusCode: HTTP_STATUS_METHOD_NOT_ALLOWED
112
+ });
113
+ }
114
+ const modifiedEvent = {
115
+ ...event,
116
+ multiValueQueryStringParameters: {},
117
+ queryStringParameters: {}
118
+ };
119
+ const wrappedCallback = (error, response) => (
120
+ // eslint-disable-next-line promise/prefer-await-to-callbacks
121
+ callback ? callback(error, augmentResponse(response)) : null
122
+ );
123
+ const execution = handler(modifiedEvent, context2, wrappedCallback);
124
+ if (typeof execution === "object" && typeof execution.then === "function") {
125
+ return execution.then(augmentResponse);
126
+ }
127
+ return execution;
128
+ }
103
129
  );
104
130
  }
105
- const apiURL = options.apiURL || "https://api.netlify.com";
106
- const response = await fetch(`${apiURL}/api/v1/purge`, {
107
- method: "POST",
108
- headers: {
109
- "Content-Type": "application/json; charset=utf8",
110
- Authorization: `Bearer ${token}`
111
- },
112
- body: JSON.stringify(payload)
113
- });
114
- if (!response.ok) {
115
- throw new Error(`Cache purge API call returned an unexpected status code: ${response.status}`);
131
+ });
132
+
133
+ // node_modules/@netlify/functions/dist/chunk-SURWFFYE.mjs
134
+ var import_process = require("process");
135
+ var purgeCache;
136
+ var init_purge_cache = __esm2({
137
+ "src/lib/purge_cache.ts"() {
138
+ purgeCache = async (options = {}) => {
139
+ if (globalThis.fetch === void 0) {
140
+ throw new Error(
141
+ "`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."
142
+ );
143
+ }
144
+ const payload = {
145
+ cache_tags: options.tags,
146
+ deploy_alias: options.deployAlias
147
+ };
148
+ const token = import_process.env.NETLIFY_PURGE_API_TOKEN || options.token;
149
+ if (import_process.env.NETLIFY_LOCAL && !token) {
150
+ const scope = options.tags?.length ? ` for tags ${options.tags?.join(", ")}` : "";
151
+ console.log(`Skipping purgeCache${scope} in local development.`);
152
+ return;
153
+ }
154
+ if ("siteSlug" in options) {
155
+ payload.site_slug = options.siteSlug;
156
+ } else if ("domain" in options) {
157
+ payload.domain = options.domain;
158
+ } else {
159
+ const siteID = options.siteID || import_process.env.SITE_ID;
160
+ if (!siteID) {
161
+ throw new Error(
162
+ "The Netlify site ID was not found in the execution environment. Please supply it manually using the `siteID` property."
163
+ );
164
+ }
165
+ payload.site_id = siteID;
166
+ }
167
+ if (!token) {
168
+ throw new Error(
169
+ "The cache purge API token was not found in the execution environment. Please supply it manually using the `token` property."
170
+ );
171
+ }
172
+ const headers = {
173
+ "Content-Type": "application/json; charset=utf8",
174
+ Authorization: `Bearer ${token}`
175
+ };
176
+ if (options.userAgent) {
177
+ headers["user-agent"] = options.userAgent;
178
+ }
179
+ const apiURL = options.apiURL || "https://api.netlify.com";
180
+ const response = await fetch(`${apiURL}/api/v1/purge`, {
181
+ method: "POST",
182
+ headers,
183
+ body: JSON.stringify(payload)
184
+ });
185
+ if (!response.ok) {
186
+ throw new Error(`Cache purge API call returned an unexpected status code: ${response.status}`);
187
+ }
188
+ };
116
189
  }
117
- };
190
+ });
191
+
192
+ // node_modules/@netlify/functions/dist/chunk-MMCOWF6U.mjs
193
+ var import_node_stream = require("node:stream");
194
+ var import_node_util = require("node:util");
195
+ var pipeline = (0, import_node_util.promisify)(import_node_stream.pipeline);
118
196
 
119
- // node_modules/@netlify/functions/dist/chunk-XSZVKDJB.mjs
120
- var import_stream = require("stream");
121
- var import_util = require("util");
122
- var pipeline = (0, import_util.promisify)(import_stream.pipeline);
197
+ // node_modules/@netlify/functions/dist/main.mjs
198
+ init_builder();
199
+ init_purge_cache();
123
200
 
124
201
  // src/run/handlers/cache.cts
125
202
  var import_constants = require("next/dist/lib/constants.js");
126
203
 
204
+ // package.json
205
+ var name = "@netlify/plugin-nextjs";
206
+ var version = "5.9.2";
207
+
127
208
  // src/shared/cache-types.cts
128
209
  var isCachedPageValue = (value) => value.kind === "PAGE" || value.kind === "PAGES";
129
210
  var isCachedRouteValue = (value) => value.kind === "ROUTE" || value.kind === "APP_ROUTE";
@@ -449,11 +530,11 @@ var Store = class _Store {
449
530
  this.client = options.client;
450
531
  if ("deployID" in options) {
451
532
  _Store.validateDeployID(options.deployID);
452
- let name = DEPLOY_STORE_PREFIX + options.deployID;
533
+ let name2 = DEPLOY_STORE_PREFIX + options.deployID;
453
534
  if (options.name) {
454
- name += `:${options.name}`;
535
+ name2 += `:${options.name}`;
455
536
  }
456
- this.name = name;
537
+ this.name = name2;
457
538
  } else if (options.name.startsWith(LEGACY_STORE_INTERNAL_PREFIX)) {
458
539
  const storeName = options.name.slice(LEGACY_STORE_INTERNAL_PREFIX.length);
459
540
  _Store.validateStoreName(storeName);
@@ -626,11 +707,11 @@ var Store = class _Store {
626
707
  throw new Error(`'${deployID}' is not a valid Netlify deploy ID.`);
627
708
  }
628
709
  }
629
- static validateStoreName(name) {
630
- if (name.includes("/") || name.includes("%2F")) {
710
+ static validateStoreName(name2) {
711
+ if (name2.includes("/") || name2.includes("%2F")) {
631
712
  throw new Error("Store name must not contain forward slashes (/).");
632
713
  }
633
- if (new TextEncoder().encode(name).length > 64) {
714
+ if (new TextEncoder().encode(name2).length > 64) {
634
715
  throw new Error(
635
716
  "Store name must be a sequence of Unicode characters whose UTF-8 encoding is at most 64 bytes long."
636
717
  );
@@ -730,66 +811,91 @@ var getRegionalBlobStore = (args = {}) => {
730
811
  // src/run/handlers/request-context.cts
731
812
  var import_node_async_hooks = require("node:async_hooks");
732
813
 
733
- // node_modules/@netlify/functions/dist/chunk-HYMERDCV.mjs
814
+ // node_modules/@netlify/functions/dist/chunk-ATZ7N7EG.mjs
734
815
  var import_process2 = require("process");
735
- var systemLogTag = "__nfSystemLog";
736
- var serializeError = (error) => {
737
- const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
738
- return {
739
- error: error.message,
740
- error_cause: cause,
741
- error_stack: error.stack
742
- };
743
- };
744
- var SystemLogger = class _SystemLogger {
745
- fields;
746
- logLevel;
747
- constructor(fields = {}, logLevel = 2) {
748
- this.fields = fields;
749
- this.logLevel = logLevel;
750
- }
751
- doLog(logger, message) {
752
- if (import_process2.env.NETLIFY_DEV && !import_process2.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
753
- return;
754
- }
755
- logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
756
- }
757
- log(message) {
758
- if (this.logLevel > 2) {
759
- return;
760
- }
761
- this.doLog(console.log, message);
762
- }
763
- debug(message) {
764
- if (this.logLevel > 1) {
765
- return;
766
- }
767
- this.doLog(console.debug, message);
768
- }
769
- error(message) {
770
- if (this.logLevel > 3) {
771
- return;
772
- }
773
- this.doLog(console.error, message);
774
- }
775
- withLogLevel(level) {
776
- return new _SystemLogger(this.fields, level);
777
- }
778
- withFields(fields) {
779
- return new _SystemLogger(
780
- {
781
- ...this.fields,
782
- ...fields
783
- },
784
- this.logLevel
785
- );
816
+ var systemLogTag;
817
+ var serializeError;
818
+ var LogLevel;
819
+ var SystemLogger;
820
+ var systemLogger;
821
+ var init_system_logger = __esm2({
822
+ "src/lib/system_logger.ts"() {
823
+ systemLogTag = "__nfSystemLog";
824
+ serializeError = (error) => {
825
+ const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
826
+ return {
827
+ error: error.message,
828
+ error_cause: cause,
829
+ error_stack: error.stack
830
+ };
831
+ };
832
+ LogLevel = /* @__PURE__ */ ((LogLevel2) => {
833
+ LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
834
+ LogLevel2[LogLevel2["Log"] = 2] = "Log";
835
+ LogLevel2[LogLevel2["Error"] = 3] = "Error";
836
+ return LogLevel2;
837
+ })(LogLevel || {});
838
+ SystemLogger = class _SystemLogger {
839
+ fields;
840
+ logLevel;
841
+ constructor(fields = {}, logLevel = 2) {
842
+ this.fields = fields;
843
+ this.logLevel = logLevel;
844
+ }
845
+ doLog(logger, message) {
846
+ if (import_process2.env.NETLIFY_DEV && !import_process2.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
847
+ return;
848
+ }
849
+ logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
850
+ }
851
+ log(message) {
852
+ if (this.logLevel > 2) {
853
+ return;
854
+ }
855
+ this.doLog(console.log, message);
856
+ }
857
+ debug(message) {
858
+ if (this.logLevel > 1) {
859
+ return;
860
+ }
861
+ this.doLog(console.debug, message);
862
+ }
863
+ error(message) {
864
+ if (this.logLevel > 3) {
865
+ return;
866
+ }
867
+ this.doLog(console.error, message);
868
+ }
869
+ withLogLevel(level) {
870
+ return new _SystemLogger(this.fields, level);
871
+ }
872
+ withFields(fields) {
873
+ return new _SystemLogger(
874
+ {
875
+ ...this.fields,
876
+ ...fields
877
+ },
878
+ this.logLevel
879
+ );
880
+ }
881
+ withError(error) {
882
+ const fields = error instanceof Error ? serializeError(error) : { error };
883
+ return this.withFields(fields);
884
+ }
885
+ };
886
+ systemLogger = new SystemLogger();
786
887
  }
787
- withError(error) {
788
- const fields = error instanceof Error ? serializeError(error) : { error };
789
- return this.withFields(fields);
888
+ });
889
+
890
+ // node_modules/@netlify/functions/dist/chunk-7ANA32NV.mjs
891
+ var init_internal = __esm2({
892
+ "src/internal.ts"() {
893
+ init_system_logger();
790
894
  }
791
- };
792
- var systemLogger = new SystemLogger();
895
+ });
896
+
897
+ // node_modules/@netlify/functions/dist/internal.mjs
898
+ init_internal();
793
899
 
794
900
  // src/run/handlers/request-context.cts
795
901
  var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
@@ -1388,7 +1494,7 @@ var NoopTracer = (
1388
1494
  function() {
1389
1495
  function NoopTracer2() {
1390
1496
  }
1391
- NoopTracer2.prototype.startSpan = function(name, options, context2) {
1497
+ NoopTracer2.prototype.startSpan = function(name2, options, context2) {
1392
1498
  if (context2 === void 0) {
1393
1499
  context2 = contextApi.active();
1394
1500
  }
@@ -1403,7 +1509,7 @@ var NoopTracer = (
1403
1509
  return new NonRecordingSpan();
1404
1510
  }
1405
1511
  };
1406
- NoopTracer2.prototype.startActiveSpan = function(name, arg2, arg3, arg4) {
1512
+ NoopTracer2.prototype.startActiveSpan = function(name2, arg2, arg3, arg4) {
1407
1513
  var opts;
1408
1514
  var ctx;
1409
1515
  var fn;
@@ -1420,7 +1526,7 @@ var NoopTracer = (
1420
1526
  fn = arg4;
1421
1527
  }
1422
1528
  var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
1423
- var span = this.startSpan(name, opts, parentContext);
1529
+ var span = this.startSpan(name2, opts, parentContext);
1424
1530
  var contextWithSpanSet = setSpan(parentContext, span);
1425
1531
  return contextApi.with(contextWithSpanSet, fn, void 0, span);
1426
1532
  };
@@ -1436,14 +1542,14 @@ var NOOP_TRACER = new NoopTracer();
1436
1542
  var ProxyTracer = (
1437
1543
  /** @class */
1438
1544
  function() {
1439
- function ProxyTracer2(_provider, name, version, options) {
1545
+ function ProxyTracer2(_provider, name2, version2, options) {
1440
1546
  this._provider = _provider;
1441
- this.name = name;
1442
- this.version = version;
1547
+ this.name = name2;
1548
+ this.version = version2;
1443
1549
  this.options = options;
1444
1550
  }
1445
- ProxyTracer2.prototype.startSpan = function(name, options, context2) {
1446
- return this._getTracer().startSpan(name, options, context2);
1551
+ ProxyTracer2.prototype.startSpan = function(name2, options, context2) {
1552
+ return this._getTracer().startSpan(name2, options, context2);
1447
1553
  };
1448
1554
  ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
1449
1555
  var tracer2 = this._getTracer();
@@ -1484,9 +1590,9 @@ var ProxyTracerProvider = (
1484
1590
  function() {
1485
1591
  function ProxyTracerProvider2() {
1486
1592
  }
1487
- ProxyTracerProvider2.prototype.getTracer = function(name, version, options) {
1593
+ ProxyTracerProvider2.prototype.getTracer = function(name2, version2, options) {
1488
1594
  var _a;
1489
- return (_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options);
1595
+ return (_a = this.getDelegateTracer(name2, version2, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name2, version2, options);
1490
1596
  };
1491
1597
  ProxyTracerProvider2.prototype.getDelegate = function() {
1492
1598
  var _a;
@@ -1495,9 +1601,9 @@ var ProxyTracerProvider = (
1495
1601
  ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
1496
1602
  this._delegate = delegate;
1497
1603
  };
1498
- ProxyTracerProvider2.prototype.getDelegateTracer = function(name, version, options) {
1604
+ ProxyTracerProvider2.prototype.getDelegateTracer = function(name2, version2, options) {
1499
1605
  var _a;
1500
- return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
1606
+ return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name2, version2, options);
1501
1607
  };
1502
1608
  return ProxyTracerProvider2;
1503
1609
  }()
@@ -1546,8 +1652,8 @@ var TraceAPI = (
1546
1652
  TraceAPI2.prototype.getTracerProvider = function() {
1547
1653
  return getGlobal(API_NAME3) || this._proxyTracerProvider;
1548
1654
  };
1549
- TraceAPI2.prototype.getTracer = function(name, version) {
1550
- return this.getTracerProvider().getTracer(name, version);
1655
+ TraceAPI2.prototype.getTracer = function(name2, version2) {
1656
+ return this.getTracerProvider().getTracer(name2, version2);
1551
1657
  };
1552
1658
  TraceAPI2.prototype.disable = function() {
1553
1659
  unregisterGlobal(API_NAME3, DiagAPI.instance());
@@ -1578,15 +1684,15 @@ var SugaredTracer = (
1578
1684
  this.startSpan = tracer2.startSpan.bind(this._tracer);
1579
1685
  this.startActiveSpan = tracer2.startActiveSpan.bind(this._tracer);
1580
1686
  }
1581
- SugaredTracer3.prototype.withActiveSpan = function(name, arg2, arg3, arg4) {
1687
+ SugaredTracer3.prototype.withActiveSpan = function(name2, arg2, arg3, arg4) {
1582
1688
  var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
1583
- return this._tracer.startActiveSpan(name, opts, ctx, function(span) {
1689
+ return this._tracer.startActiveSpan(name2, opts, ctx, function(span) {
1584
1690
  return handleFn(span, opts, fn);
1585
1691
  });
1586
1692
  };
1587
- SugaredTracer3.prototype.withSpan = function(name, arg2, arg3, arg4) {
1693
+ SugaredTracer3.prototype.withSpan = function(name2, arg2, arg3, arg4) {
1588
1694
  var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
1589
- var span = this._tracer.startSpan(name, opts, ctx);
1695
+ var span = this._tracer.startSpan(name2, opts, ctx);
1590
1696
  return handleFn(span, opts, fn);
1591
1697
  };
1592
1698
  return SugaredTracer3;
@@ -1667,7 +1773,7 @@ function getTracer() {
1667
1773
  };
1668
1774
  const startActiveSpan = baseTracer.startActiveSpan.bind(baseTracer);
1669
1775
  baseTracer.startActiveSpan = (...args) => {
1670
- const [name, ...restOfArgs] = args;
1776
+ const [name2, ...restOfArgs] = args;
1671
1777
  const augmentedArgs = restOfArgs.map((arg) => {
1672
1778
  if (typeof arg === "function") {
1673
1779
  return (span) => {
@@ -1678,7 +1784,7 @@ function getTracer() {
1678
1784
  }
1679
1785
  return arg;
1680
1786
  });
1681
- return startActiveSpan(name, ...augmentedArgs);
1787
+ return startActiveSpan(name2, ...augmentedArgs);
1682
1788
  };
1683
1789
  tracer = wrapTracer(baseTracer);
1684
1790
  }
@@ -1686,6 +1792,7 @@ function getTracer() {
1686
1792
  }
1687
1793
 
1688
1794
  // src/run/handlers/cache.cts
1795
+ var purgeCacheUserAgent = `${name}@${version}`;
1689
1796
  var NetlifyCacheHandler = class {
1690
1797
  options;
1691
1798
  revalidatedTags;
@@ -1907,9 +2014,13 @@ var NetlifyCacheHandler = class {
1907
2014
  const requestContext = getRequestContext();
1908
2015
  if (requestContext?.didPagesRouterOnDemandRevalidate) {
1909
2016
  const tag = `_N_T_${key === "/index" ? "/" : encodeURI(key)}`;
2017
+ const tags = tag.split(/,|%2c/gi).filter(Boolean);
2018
+ if (tags.length === 0) {
2019
+ return;
2020
+ }
1910
2021
  getLogger().debug(`Purging CDN cache for: [${tag}]`);
1911
2022
  requestContext.trackBackgroundWork(
1912
- purgeCache({ tags: tag.split(/,|%2c/gi) }).catch((error) => {
2023
+ purgeCache({ tags, userAgent: purgeCacheUserAgent }).catch((error) => {
1913
2024
  getLogger().withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`);
1914
2025
  })
1915
2026
  );
@@ -1929,9 +2040,10 @@ var NetlifyCacheHandler = class {
1929
2040
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1930
2041
  async doRevalidateTag(tagOrTags, ...args) {
1931
2042
  getLogger().withFields({ tagOrTags, args }).debug("NetlifyCacheHandler.revalidateTag");
1932
- const tags = (Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags]).flatMap(
1933
- (tag) => tag.split(/,|%2c/gi)
1934
- );
2043
+ const tags = (Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags]).flatMap((tag) => tag.split(/,|%2c/gi)).filter(Boolean);
2044
+ if (tags.length === 0) {
2045
+ return;
2046
+ }
1935
2047
  const data = {
1936
2048
  revalidatedAt: Date.now()
1937
2049
  };
@@ -1944,7 +2056,7 @@ var NetlifyCacheHandler = class {
1944
2056
  }
1945
2057
  })
1946
2058
  );
1947
- await purgeCache({ tags }).catch((error) => {
2059
+ await purgeCache({ tags, userAgent: purgeCacheUserAgent }).catch((error) => {
1948
2060
  getLogger().withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`);
1949
2061
  });
1950
2062
  }