@netlify/plugin-nextjs 5.2.2 → 5.3.1

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.
@@ -7,7 +7,7 @@
7
7
  import {
8
8
  __esm,
9
9
  __export
10
- } from "./chunk-5JVNISGM.js";
10
+ } from "./chunk-OEQOKJGE.js";
11
11
 
12
12
  // node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js
13
13
  var _globalThis;
@@ -201,34 +201,28 @@ var init_NoopContextManager = __esm({
201
201
  init_context();
202
202
  __read = function(o, n) {
203
203
  var m = typeof Symbol === "function" && o[Symbol.iterator];
204
- if (!m)
205
- return o;
204
+ if (!m) return o;
206
205
  var i = m.call(o), r, ar = [], e;
207
206
  try {
208
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
209
- ar.push(r.value);
207
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
210
208
  } catch (error) {
211
209
  e = { error };
212
210
  } finally {
213
211
  try {
214
- if (r && !r.done && (m = i["return"]))
215
- m.call(i);
212
+ if (r && !r.done && (m = i["return"])) m.call(i);
216
213
  } finally {
217
- if (e)
218
- throw e.error;
214
+ if (e) throw e.error;
219
215
  }
220
216
  }
221
217
  return ar;
222
218
  };
223
219
  __spreadArray = function(to, from, pack) {
224
- if (pack || arguments.length === 2)
225
- for (var i = 0, l = from.length, ar; i < l; i++) {
226
- if (ar || !(i in from)) {
227
- if (!ar)
228
- ar = Array.prototype.slice.call(from, 0, i);
229
- ar[i] = from[i];
230
- }
220
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
221
+ if (ar || !(i in from)) {
222
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
223
+ ar[i] = from[i];
231
224
  }
225
+ }
232
226
  return to.concat(ar || Array.prototype.slice.call(from));
233
227
  };
234
228
  NoopContextManager = /** @class */
@@ -274,34 +268,28 @@ var init_ComponentLogger = __esm({
274
268
  init_global_utils();
275
269
  __read2 = function(o, n) {
276
270
  var m = typeof Symbol === "function" && o[Symbol.iterator];
277
- if (!m)
278
- return o;
271
+ if (!m) return o;
279
272
  var i = m.call(o), r, ar = [], e;
280
273
  try {
281
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
282
- ar.push(r.value);
274
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
283
275
  } catch (error) {
284
276
  e = { error };
285
277
  } finally {
286
278
  try {
287
- if (r && !r.done && (m = i["return"]))
288
- m.call(i);
279
+ if (r && !r.done && (m = i["return"])) m.call(i);
289
280
  } finally {
290
- if (e)
291
- throw e.error;
281
+ if (e) throw e.error;
292
282
  }
293
283
  }
294
284
  return ar;
295
285
  };
296
286
  __spreadArray2 = function(to, from, pack) {
297
- if (pack || arguments.length === 2)
298
- for (var i = 0, l = from.length, ar; i < l; i++) {
299
- if (ar || !(i in from)) {
300
- if (!ar)
301
- ar = Array.prototype.slice.call(from, 0, i);
302
- ar[i] = from[i];
303
- }
287
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
288
+ if (ar || !(i in from)) {
289
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
290
+ ar[i] = from[i];
304
291
  }
292
+ }
305
293
  return to.concat(ar || Array.prototype.slice.call(from));
306
294
  };
307
295
  DiagComponentLogger = /** @class */
@@ -405,34 +393,28 @@ var init_diag = __esm({
405
393
  init_global_utils();
406
394
  __read3 = function(o, n) {
407
395
  var m = typeof Symbol === "function" && o[Symbol.iterator];
408
- if (!m)
409
- return o;
396
+ if (!m) return o;
410
397
  var i = m.call(o), r, ar = [], e;
411
398
  try {
412
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
413
- ar.push(r.value);
399
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
414
400
  } catch (error) {
415
401
  e = { error };
416
402
  } finally {
417
403
  try {
418
- if (r && !r.done && (m = i["return"]))
419
- m.call(i);
404
+ if (r && !r.done && (m = i["return"])) m.call(i);
420
405
  } finally {
421
- if (e)
422
- throw e.error;
406
+ if (e) throw e.error;
423
407
  }
424
408
  }
425
409
  return ar;
426
410
  };
427
411
  __spreadArray3 = function(to, from, pack) {
428
- if (pack || arguments.length === 2)
429
- for (var i = 0, l = from.length, ar; i < l; i++) {
430
- if (ar || !(i in from)) {
431
- if (!ar)
432
- ar = Array.prototype.slice.call(from, 0, i);
433
- ar[i] = from[i];
434
- }
412
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
413
+ if (ar || !(i in from)) {
414
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
415
+ ar[i] = from[i];
435
416
  }
417
+ }
436
418
  return to.concat(ar || Array.prototype.slice.call(from));
437
419
  };
438
420
  API_NAME = "diag";
@@ -509,34 +491,28 @@ var init_context2 = __esm({
509
491
  init_diag();
510
492
  __read4 = function(o, n) {
511
493
  var m = typeof Symbol === "function" && o[Symbol.iterator];
512
- if (!m)
513
- return o;
494
+ if (!m) return o;
514
495
  var i = m.call(o), r, ar = [], e;
515
496
  try {
516
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
517
- ar.push(r.value);
497
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
518
498
  } catch (error) {
519
499
  e = { error };
520
500
  } finally {
521
501
  try {
522
- if (r && !r.done && (m = i["return"]))
523
- m.call(i);
502
+ if (r && !r.done && (m = i["return"])) m.call(i);
524
503
  } finally {
525
- if (e)
526
- throw e.error;
504
+ if (e) throw e.error;
527
505
  }
528
506
  }
529
507
  return ar;
530
508
  };
531
509
  __spreadArray4 = function(to, from, pack) {
532
- if (pack || arguments.length === 2)
533
- for (var i = 0, l = from.length, ar; i < l; i++) {
534
- if (ar || !(i in from)) {
535
- if (!ar)
536
- ar = Array.prototype.slice.call(from, 0, i);
537
- ar[i] = from[i];
538
- }
510
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
511
+ if (ar || !(i in from)) {
512
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
513
+ ar[i] = from[i];
539
514
  }
515
+ }
540
516
  return to.concat(ar || Array.prototype.slice.call(from));
541
517
  };
542
518
  API_NAME2 = "context";
@@ -910,37 +886,30 @@ var init_baggage_impl = __esm({
910
886
  "node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js"() {
911
887
  __read5 = function(o, n) {
912
888
  var m = typeof Symbol === "function" && o[Symbol.iterator];
913
- if (!m)
914
- return o;
889
+ if (!m) return o;
915
890
  var i = m.call(o), r, ar = [], e;
916
891
  try {
917
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done)
918
- ar.push(r.value);
892
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
919
893
  } catch (error) {
920
894
  e = { error };
921
895
  } finally {
922
896
  try {
923
- if (r && !r.done && (m = i["return"]))
924
- m.call(i);
897
+ if (r && !r.done && (m = i["return"])) m.call(i);
925
898
  } finally {
926
- if (e)
927
- throw e.error;
899
+ if (e) throw e.error;
928
900
  }
929
901
  }
930
902
  return ar;
931
903
  };
932
904
  __values = function(o) {
933
905
  var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
934
- if (m)
935
- return m.call(o);
936
- if (o && typeof o.length === "number")
937
- return {
938
- next: function() {
939
- if (o && i >= o.length)
940
- o = void 0;
941
- return { value: o && o[i++], done: !o };
942
- }
943
- };
906
+ if (m) return m.call(o);
907
+ if (o && typeof o.length === "number") return {
908
+ next: function() {
909
+ if (o && i >= o.length) o = void 0;
910
+ return { value: o && o[i++], done: !o };
911
+ }
912
+ };
944
913
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
945
914
  };
946
915
  BaggageImpl = /** @class */
@@ -987,11 +956,9 @@ var init_baggage_impl = __esm({
987
956
  e_1 = { error: e_1_1 };
988
957
  } finally {
989
958
  try {
990
- if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return))
991
- _a.call(keys_1);
959
+ if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
992
960
  } finally {
993
- if (e_1)
994
- throw e_1.error;
961
+ if (e_1) throw e_1.error;
995
962
  }
996
963
  }
997
964
  return newBaggage;
@@ -1093,9 +1060,7 @@ var init_NoopMeter = __esm({
1093
1060
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
1094
1061
  d2.__proto__ = b2;
1095
1062
  } || function(d2, b2) {
1096
- for (var p in b2)
1097
- if (Object.prototype.hasOwnProperty.call(b2, p))
1098
- d2[p] = b2[p];
1063
+ for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
1099
1064
  };
1100
1065
  return extendStatics(d, b);
1101
1066
  };
@@ -13,8 +13,7 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
13
13
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
14
14
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
15
15
  }) : x)(function(x) {
16
- if (typeof require !== "undefined")
17
- return require.apply(this, arguments);
16
+ if (typeof require !== "undefined") return require.apply(this, arguments);
18
17
  throw Error('Dynamic require of "' + x + '" is not supported');
19
18
  });
20
19
  var __esm = (fn, res) => function __init() {
@@ -4,11 +4,11 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "./chunk-5JVNISGM.js";
7
+ import "./chunk-OEQOKJGE.js";
8
8
 
9
9
  // package.json
10
10
  var name = "@netlify/plugin-nextjs";
11
- var version = "5.2.2";
11
+ var version = "5.3.1";
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://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.2",
62
- "@netlify/edge-bundler": "^12.0.0",
63
- "@netlify/edge-functions": "^2.6.1",
61
+ "@netlify/build": "^29.42.1",
62
+ "@netlify/edge-bundler": "^12.0.1",
63
+ "@netlify/edge-functions": "^2.8.1",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
- "@netlify/functions": "^2.6.3",
65
+ "@netlify/functions": "^2.7.0",
66
66
  "@netlify/serverless-functions-api": "^1.18.1",
67
- "@netlify/zip-it-and-ship-it": "^9.32.2",
67
+ "@netlify/zip-it-and-ship-it": "^9.33.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",
@@ -75,10 +75,10 @@ var devDependencies = {
75
75
  "@types/node": "^20.12.7",
76
76
  "@types/picomatch": "^2.3.3",
77
77
  "@types/uuid": "^9.0.6",
78
- "@vercel/nft": "^0.26.0",
78
+ "@vercel/nft": "^0.27.0",
79
79
  cheerio: "^1.0.0-rc.12",
80
80
  "clean-package": "^2.2.0",
81
- esbuild: "^0.20.0",
81
+ esbuild: "^0.21.0",
82
82
  execa: "^8.0.1",
83
83
  "fast-glob": "^3.3.2",
84
84
  "fs-monkey": "^1.0.6",
package/dist/index.js CHANGED
@@ -6,12 +6,12 @@
6
6
 
7
7
  import {
8
8
  wrapTracer
9
- } from "./esm-chunks/chunk-PDPDW32D.js";
9
+ } from "./esm-chunks/chunk-5QSXBV7L.js";
10
10
  import {
11
11
  init_esm,
12
12
  trace
13
- } from "./esm-chunks/chunk-Y3K5Q6FP.js";
14
- import "./esm-chunks/chunk-5JVNISGM.js";
13
+ } from "./esm-chunks/chunk-GNGHTHMQ.js";
14
+ import "./esm-chunks/chunk-OEQOKJGE.js";
15
15
 
16
16
  // src/index.ts
17
17
  init_esm();
@@ -29,11 +29,7 @@ import { createEdgeHandlers } from "./build/functions/edge.js";
29
29
  import { createServerHandler } from "./build/functions/server.js";
30
30
  import { setImageConfig } from "./build/image-cdn.js";
31
31
  import { PluginContext } from "./build/plugin-context.js";
32
- import {
33
- verifyBuildConfig,
34
- verifyNoAdvancedAPIRoutes,
35
- verifyPublishDir
36
- } from "./build/verification.js";
32
+ import { verifyNoAdvancedAPIRoutes, verifyPublishDir } from "./build/verification.js";
37
33
  var tracer = wrapTracer(trace.getTracer("Next.js runtime"));
38
34
  var onPreDev = async (options) => {
39
35
  await tracer.withActiveSpan("onPreDev", async () => {
@@ -53,7 +49,6 @@ var onBuild = async (options) => {
53
49
  await tracer.withActiveSpan("onBuild", async (span) => {
54
50
  const ctx = new PluginContext(options);
55
51
  verifyPublishDir(ctx);
56
- verifyBuildConfig(ctx);
57
52
  span.setAttribute("next.buildConfig", JSON.stringify(ctx.buildConfig));
58
53
  if (!options.constants.IS_LOCAL) {
59
54
  await saveBuildCache(ctx);
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-5JVNISGM.js";
7
+ import "../esm-chunks/chunk-OEQOKJGE.js";
8
8
 
9
9
  // src/run/config.ts
10
10
  import { existsSync } from "node:fs";
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-5JVNISGM.js";
7
+ import "../esm-chunks/chunk-OEQOKJGE.js";
8
8
 
9
9
  // src/run/constants.ts
10
10
  import { resolve } from "node:path";
@@ -94,6 +94,7 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
94
94
  // src/run/handlers/cache.cts
95
95
  var import_constants = require("next/dist/lib/constants.js");
96
96
  var import_regional_blob_store = require("../regional-blob-store.cjs");
97
+ var import_systemlog = require("../systemlog.cjs");
97
98
  var import_request_context = require("./request-context.cjs");
98
99
  var import_tracer = require("./tracer.cjs");
99
100
  var NetlifyCacheHandler = class {
@@ -156,7 +157,7 @@ var NetlifyCacheHandler = class {
156
157
  async get(...args) {
157
158
  return this.tracer.withActiveSpan("get cache key", async (span) => {
158
159
  const [key, ctx = {}] = args;
159
- console.debug(`[NetlifyCacheHandler.get]: ${key}`);
160
+ import_systemlog.logger.debug(`[NetlifyCacheHandler.get]: ${key}`);
160
161
  const blobKey = await this.encodeBlobKey(key);
161
162
  span.setAttributes({ key, blobKey });
162
163
  const blob = await this.tracer.withActiveSpan("blobStore.get", async (blobGetSpan) => {
@@ -211,7 +212,7 @@ var NetlifyCacheHandler = class {
211
212
  const blobKey = await this.encodeBlobKey(key);
212
213
  const lastModified = Date.now();
213
214
  span.setAttributes({ key, lastModified, blobKey });
214
- console.debug(`[NetlifyCacheHandler.set]: ${key}`);
215
+ import_systemlog.logger.debug(`[NetlifyCacheHandler.set]: ${key}`);
215
216
  const value = data?.kind === "ROUTE" ? (
216
217
  // don't mutate data, as it's used for the initial response - instead create a new object
217
218
  {
@@ -228,9 +229,9 @@ var NetlifyCacheHandler = class {
228
229
  const requestContext = (0, import_request_context.getRequestContext)();
229
230
  if (requestContext?.didPagesRouterOnDemandRevalidate) {
230
231
  const tag = `_N_T_${key === "/index" ? "/" : key}`;
231
- console.debug("Purging CDN cache for:", [tag]);
232
+ import_systemlog.logger.debug(`Purging CDN cache for: [${tag}]`);
232
233
  purgeCache({ tags: [tag] }).catch((error) => {
233
- console.error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`, error);
234
+ import_systemlog.logger.withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`);
234
235
  });
235
236
  }
236
237
  }
@@ -238,7 +239,7 @@ var NetlifyCacheHandler = class {
238
239
  }
239
240
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
240
241
  async revalidateTag(tagOrTags, ...args) {
241
- console.debug("NetlifyCacheHandler.revalidateTag", tagOrTags, args);
242
+ import_systemlog.logger.withFields({ tagOrTags, args }).debug("NetlifyCacheHandler.revalidateTag");
242
243
  const tags = Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags];
243
244
  const data = {
244
245
  revalidatedAt: Date.now()
@@ -248,15 +249,12 @@ var NetlifyCacheHandler = class {
248
249
  try {
249
250
  await this.blobStore.setJSON(await this.encodeBlobKey(tag), data);
250
251
  } catch (error) {
251
- console.warn(`Failed to update tag manifest for ${tag}`, error);
252
+ import_systemlog.logger.withError(error).log(`Failed to update tag manifest for ${tag}`);
252
253
  }
253
254
  })
254
255
  );
255
256
  purgeCache({ tags }).catch((error) => {
256
- console.error(
257
- `[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`,
258
- error
259
- );
257
+ import_systemlog.logger.withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`);
260
258
  });
261
259
  }
262
260
  resetRequestCache() {