@netlify/plugin-nextjs 5.3.2 → 5.3.3-canary-no-cache-fix.0

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.
@@ -28,8 +28,8 @@ import {
28
28
  access,
29
29
  cp,
30
30
  mkdir,
31
- readFile,
32
31
  readdir,
32
+ readFile,
33
33
  readlink,
34
34
  symlink,
35
35
  writeFile
@@ -40,7 +40,6 @@ import { join as posixJoin, sep as posixSep } from "node:path/posix";
40
40
  var import_fast_glob = __toESM(require_out(), 1);
41
41
  var import_semver = __toESM(require_semver(), 1);
42
42
  import { RUN_CONFIG } from "../../run/constants.js";
43
- import { logger } from "../../run/systemlog.cjs";
44
43
  import { verifyNextVersion } from "../verification.js";
45
44
  var tracer = wrapTracer(trace.getTracer("Next runtime"));
46
45
  var toPosixPath = (path) => path.split(sep).join(posixSep);
@@ -227,7 +226,7 @@ var writeTagsManifest = async (ctx) => {
227
226
  tags = meta.headers["x-next-cache-tags"];
228
227
  } catch {
229
228
  if (!definition.dataRoute?.endsWith("/default.rsc")) {
230
- logger.log(`Unable to read cache tags for: ${path}`);
229
+ console.log(`Unable to read cache tags for: ${path}`);
231
230
  }
232
231
  }
233
232
  }
@@ -16,7 +16,7 @@ export default async function (req, context) {
16
16
  tracing.start()
17
17
  }
18
18
 
19
- const requestContext = createRequestContext(req.headers.get('x-next-debug-logging'))
19
+ const requestContext = createRequestContext(req)
20
20
  const tracer = getTracer()
21
21
 
22
22
  const handlerResponse = await runWithRequestContext(requestContext, () => {
@@ -13,7 +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(req.headers.get('x-next-debug-logging'))
16
+ const requestContext = createRequestContext(req)
17
17
  const tracer = getTracer()
18
18
 
19
19
  const handlerResponse = await runWithRequestContext(requestContext, () => {
@@ -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.3.2";
11
+ var version = "5.3.3-canary-no-cache-fix.0";
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.43.0",
61
+ "@netlify/build": "^29.47.2",
62
62
  "@netlify/edge-bundler": "^12.0.1",
63
63
  "@netlify/edge-functions": "^2.8.1",
64
64
  "@netlify/eslint-config-node": "^7.0.1",
65
65
  "@netlify/functions": "^2.7.0",
66
- "@netlify/serverless-functions-api": "^1.18.2",
67
- "@netlify/zip-it-and-ship-it": "^9.33.2",
66
+ "@netlify/serverless-functions-api": "^1.18.4",
67
+ "@netlify/zip-it-and-ship-it": "^9.34.3",
68
68
  "@opentelemetry/api": "^1.8.0",
69
69
  "@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
70
70
  "@opentelemetry/resources": "^1.24.0",
@@ -35,6 +35,8 @@ __export(cache_exports, {
35
35
  });
36
36
  module.exports = __toCommonJS(cache_exports);
37
37
  var import_node_buffer = require("node:buffer");
38
+ var import_node_path = require("node:path");
39
+ var import_posix = require("node:path/posix");
38
40
 
39
41
  // node_modules/@netlify/functions/dist/chunk-COIAWFHF.mjs
40
42
  var import_process = require("process");
@@ -93,8 +95,9 @@ var pipeline = (0, import_util.promisify)(import_stream.pipeline);
93
95
 
94
96
  // src/run/handlers/cache.cts
95
97
  var import_constants = require("next/dist/lib/constants.js");
98
+ var import_load_manifest = require("next/dist/server/load-manifest.js");
99
+ var import_normalize_page_path = require("next/dist/shared/lib/page-path/normalize-page-path.js");
96
100
  var import_regional_blob_store = require("../regional-blob-store.cjs");
97
- var import_systemlog = require("../systemlog.cjs");
98
101
  var import_request_context = require("./request-context.cjs");
99
102
  var import_tracer = require("./tracer.cjs");
100
103
  var NetlifyCacheHandler = class {
@@ -154,10 +157,26 @@ var NetlifyCacheHandler = class {
154
157
  }
155
158
  return restOfRouteValue;
156
159
  }
160
+ injectEntryToPrerenderManifest(key, revalidate) {
161
+ if (this.options.serverDistDir && (typeof revalidate === "number" || revalidate === false)) {
162
+ const prerenderManifest = (0, import_load_manifest.loadManifest)(
163
+ (0, import_node_path.join)(this.options.serverDistDir, "..", "prerender-manifest.json")
164
+ );
165
+ prerenderManifest.routes[key] = {
166
+ experimentalPPR: void 0,
167
+ dataRoute: (0, import_posix.join)("/_next/data", `${(0, import_normalize_page_path.normalizePagePath)(key)}.json`),
168
+ srcRoute: null,
169
+ // FIXME: provide actual source route, however, when dynamically appending it doesn't really matter
170
+ initialRevalidateSeconds: revalidate,
171
+ // Pages routes do not have a prefetch data route.
172
+ prefetchDataRoute: void 0
173
+ };
174
+ }
175
+ }
157
176
  async get(...args) {
158
177
  return this.tracer.withActiveSpan("get cache key", async (span) => {
159
178
  const [key, ctx = {}] = args;
160
- import_systemlog.logger.debug(`[NetlifyCacheHandler.get]: ${key}`);
179
+ (0, import_request_context.getLogger)().debug(`[NetlifyCacheHandler.get]: ${key}`);
161
180
  const blobKey = await this.encodeBlobKey(key);
162
181
  span.setAttributes({ key, blobKey });
163
182
  const blob = await this.tracer.withActiveSpan("blobStore.get", async (blobGetSpan) => {
@@ -194,33 +213,45 @@ var NetlifyCacheHandler = class {
194
213
  }
195
214
  };
196
215
  }
197
- case "PAGE":
216
+ case "PAGE": {
198
217
  span.addEvent("PAGE", { lastModified: blob.lastModified });
218
+ const { revalidate, ...restOfPageValue } = blob.value;
219
+ this.injectEntryToPrerenderManifest(key, revalidate);
199
220
  return {
200
221
  lastModified: blob.lastModified,
201
- value: blob.value
222
+ value: restOfPageValue
202
223
  };
224
+ }
203
225
  default:
204
226
  span.recordException(new Error(`Unknown cache entry kind: ${blob.value?.kind}`));
205
227
  }
206
228
  return null;
207
229
  });
208
230
  }
231
+ transformToStorableObject(data, context) {
232
+ if (data?.kind === "ROUTE") {
233
+ return {
234
+ ...data,
235
+ revalidate: context.revalidate,
236
+ body: data.body.toString("base64")
237
+ };
238
+ }
239
+ if (data?.kind === "PAGE") {
240
+ return {
241
+ ...data,
242
+ revalidate: context.revalidate
243
+ };
244
+ }
245
+ return data;
246
+ }
209
247
  async set(...args) {
210
248
  return this.tracer.withActiveSpan("set cache key", async (span) => {
211
249
  const [key, data, context] = args;
212
250
  const blobKey = await this.encodeBlobKey(key);
213
251
  const lastModified = Date.now();
214
252
  span.setAttributes({ key, lastModified, blobKey });
215
- import_systemlog.logger.debug(`[NetlifyCacheHandler.set]: ${key}`);
216
- const value = data?.kind === "ROUTE" ? (
217
- // don't mutate data, as it's used for the initial response - instead create a new object
218
- {
219
- ...data,
220
- revalidate: context.revalidate,
221
- body: data.body.toString("base64")
222
- }
223
- ) : data;
253
+ (0, import_request_context.getLogger)().debug(`[NetlifyCacheHandler.set]: ${key}`);
254
+ const value = this.transformToStorableObject(data, context);
224
255
  await this.blobStore.setJSON(blobKey, {
225
256
  lastModified,
226
257
  value
@@ -229,9 +260,9 @@ var NetlifyCacheHandler = class {
229
260
  const requestContext = (0, import_request_context.getRequestContext)();
230
261
  if (requestContext?.didPagesRouterOnDemandRevalidate) {
231
262
  const tag = `_N_T_${key === "/index" ? "/" : key}`;
232
- import_systemlog.logger.debug(`Purging CDN cache for: [${tag}]`);
263
+ (0, import_request_context.getLogger)().debug(`Purging CDN cache for: [${tag}]`);
233
264
  purgeCache({ tags: [tag] }).catch((error) => {
234
- import_systemlog.logger.withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`);
265
+ (0, import_request_context.getLogger)().withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tag ${tag} failed`);
235
266
  });
236
267
  }
237
268
  }
@@ -239,7 +270,7 @@ var NetlifyCacheHandler = class {
239
270
  }
240
271
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
241
272
  async revalidateTag(tagOrTags, ...args) {
242
- import_systemlog.logger.withFields({ tagOrTags, args }).debug("NetlifyCacheHandler.revalidateTag");
273
+ (0, import_request_context.getLogger)().withFields({ tagOrTags, args }).debug("NetlifyCacheHandler.revalidateTag");
243
274
  const tags = Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags];
244
275
  const data = {
245
276
  revalidatedAt: Date.now()
@@ -249,12 +280,12 @@ var NetlifyCacheHandler = class {
249
280
  try {
250
281
  await this.blobStore.setJSON(await this.encodeBlobKey(tag), data);
251
282
  } catch (error) {
252
- import_systemlog.logger.withError(error).log(`Failed to update tag manifest for ${tag}`);
283
+ (0, import_request_context.getLogger)().withError(error).log(`Failed to update tag manifest for ${tag}`);
253
284
  }
254
285
  })
255
286
  );
256
287
  purgeCache({ tags }).catch((error) => {
257
- import_systemlog.logger.withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`);
288
+ (0, import_request_context.getLogger)().withError(error).error(`[NetlifyCacheHandler]: Purging the cache for tags ${tags.join(", ")} failed`);
258
289
  });
259
290
  }
260
291
  resetRequestCache() {
@@ -21,21 +21,94 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var request_context_exports = {};
22
22
  __export(request_context_exports, {
23
23
  createRequestContext: () => createRequestContext,
24
+ getLogger: () => getLogger,
24
25
  getRequestContext: () => getRequestContext,
25
26
  runWithRequestContext: () => runWithRequestContext
26
27
  });
27
28
  module.exports = __toCommonJS(request_context_exports);
28
29
  var import_node_async_hooks = require("node:async_hooks");
29
- function createRequestContext(debug = false) {
30
+
31
+ // node_modules/@netlify/functions/dist/chunk-HYMERDCV.mjs
32
+ var import_process = require("process");
33
+ var systemLogTag = "__nfSystemLog";
34
+ var serializeError = (error) => {
35
+ const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
36
+ return {
37
+ error: error.message,
38
+ error_cause: cause,
39
+ error_stack: error.stack
40
+ };
41
+ };
42
+ var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
43
+ LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
44
+ LogLevel2[LogLevel2["Log"] = 2] = "Log";
45
+ LogLevel2[LogLevel2["Error"] = 3] = "Error";
46
+ return LogLevel2;
47
+ })(LogLevel || {});
48
+ var SystemLogger = class _SystemLogger {
49
+ fields;
50
+ logLevel;
51
+ constructor(fields = {}, logLevel = 2) {
52
+ this.fields = fields;
53
+ this.logLevel = logLevel;
54
+ }
55
+ doLog(logger, message) {
56
+ if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
57
+ return;
58
+ }
59
+ logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
60
+ }
61
+ log(message) {
62
+ if (this.logLevel > 2) {
63
+ return;
64
+ }
65
+ this.doLog(console.log, message);
66
+ }
67
+ debug(message) {
68
+ if (this.logLevel > 1) {
69
+ return;
70
+ }
71
+ this.doLog(console.debug, message);
72
+ }
73
+ error(message) {
74
+ if (this.logLevel > 3) {
75
+ return;
76
+ }
77
+ this.doLog(console.error, message);
78
+ }
79
+ withLogLevel(level) {
80
+ return new _SystemLogger(this.fields, level);
81
+ }
82
+ withFields(fields) {
83
+ return new _SystemLogger(
84
+ {
85
+ ...this.fields,
86
+ ...fields
87
+ },
88
+ this.logLevel
89
+ );
90
+ }
91
+ withError(error) {
92
+ const fields = error instanceof Error ? serializeError(error) : { error };
93
+ return this.withFields(fields);
94
+ }
95
+ };
96
+ var systemLogger = new SystemLogger();
97
+
98
+ // src/run/handlers/request-context.cts
99
+ function createRequestContext(request) {
30
100
  const backgroundWorkPromises = [];
31
101
  return {
32
- debug,
102
+ captureServerTiming: request?.headers.has("x-next-debug-logging") ?? false,
33
103
  trackBackgroundWork: (promise) => {
34
104
  backgroundWorkPromises.push(promise);
35
105
  },
36
106
  get backgroundWorkPromise() {
37
107
  return Promise.allSettled(backgroundWorkPromises);
38
- }
108
+ },
109
+ logger: systemLogger.withLogLevel(
110
+ request?.headers.has("x-nf-debug-logging") || request?.headers.has("x-next-debug-logging") ? LogLevel.Debug : LogLevel.Log
111
+ )
39
112
  };
40
113
  }
41
114
  var REQUEST_CONTEXT_GLOBAL_KEY = Symbol.for("nf-request-context-async-local-storage");
@@ -57,9 +130,13 @@ var getRequestContext = () => getRequestContextAsyncLocalStorage().getStore();
57
130
  function runWithRequestContext(requestContext, fn) {
58
131
  return getRequestContextAsyncLocalStorage().run(requestContext, fn);
59
132
  }
133
+ function getLogger() {
134
+ return getRequestContext()?.logger ?? systemLogger;
135
+ }
60
136
  // Annotate the CommonJS export names for ESM import in node:
61
137
  0 && (module.exports = {
62
138
  createRequestContext,
139
+ getLogger,
63
140
  getRequestContext,
64
141
  runWithRequestContext
65
142
  });
@@ -3100,8 +3100,7 @@ import {
3100
3100
  setVaryHeaders
3101
3101
  } from "../headers.js";
3102
3102
  import { nextResponseProxy } from "../revalidate.js";
3103
- import { logger } from "../systemlog.cjs";
3104
- import { createRequestContext, getRequestContext } from "./request-context.cjs";
3103
+ import { createRequestContext, getLogger, getRequestContext } from "./request-context.cjs";
3105
3104
  import { getTracer } from "./tracer.cjs";
3106
3105
  var nextImportPromise = import("../next.cjs");
3107
3106
  var nextHandler;
@@ -3163,7 +3162,7 @@ var server_default = async (request, context) => {
3163
3162
  const requestContext = getRequestContext() ?? createRequestContext();
3164
3163
  const resProxy = nextResponseProxy(res, requestContext);
3165
3164
  const nextHandlerPromise = nextHandler(req, resProxy).catch((error) => {
3166
- logger.withError(error).error("next handler error");
3165
+ getLogger().withError(error).error("next handler error");
3167
3166
  console.error(error);
3168
3167
  resProxy.statusCode = 500;
3169
3168
  span.setAttribute("http.status_code", 500);
@@ -856,7 +856,7 @@ function spanHook(span) {
856
856
  const meta = spanMeta.get(span);
857
857
  if (meta) {
858
858
  const requestContext = (0, import_request_context.getRequestContext)();
859
- if (requestContext?.debug) {
859
+ if (requestContext?.captureServerTiming) {
860
860
  const duration = (typeof endTime === "number" ? endTime : performance.now()) - meta.start;
861
861
  const serverTiming = requestContext.serverTiming ?? "";
862
862
  const currentRequestSpanCounter = spanCounter.get(requestContext) ?? 1;
@@ -25421,7 +25421,7 @@ var require_shimmer = __commonJS({
25421
25421
  function isFunction(funktion) {
25422
25422
  return typeof funktion === "function";
25423
25423
  }
25424
- var logger2 = console.error.bind(console);
25424
+ var logger = console.error.bind(console);
25425
25425
  function defineProperty(obj, name2, value) {
25426
25426
  var enumerable = !!obj[name2] && obj.propertyIsEnumerable(name2);
25427
25427
  Object.defineProperty(obj, name2, {
@@ -25433,22 +25433,22 @@ var require_shimmer = __commonJS({
25433
25433
  }
25434
25434
  function shimmer(options) {
25435
25435
  if (options && options.logger) {
25436
- if (!isFunction(options.logger)) logger2("new logger isn't a function, not replacing");
25437
- else logger2 = options.logger;
25436
+ if (!isFunction(options.logger)) logger("new logger isn't a function, not replacing");
25437
+ else logger = options.logger;
25438
25438
  }
25439
25439
  }
25440
25440
  function wrap(nodule, name2, wrapper) {
25441
25441
  if (!nodule || !nodule[name2]) {
25442
- logger2("no original function " + name2 + " to wrap");
25442
+ logger("no original function " + name2 + " to wrap");
25443
25443
  return;
25444
25444
  }
25445
25445
  if (!wrapper) {
25446
- logger2("no wrapper function");
25447
- logger2(new Error().stack);
25446
+ logger("no wrapper function");
25447
+ logger(new Error().stack);
25448
25448
  return;
25449
25449
  }
25450
25450
  if (!isFunction(nodule[name2]) || !isFunction(wrapper)) {
25451
- logger2("original object and wrapper must be functions");
25451
+ logger("original object and wrapper must be functions");
25452
25452
  return;
25453
25453
  }
25454
25454
  var original = nodule[name2];
@@ -25463,14 +25463,14 @@ var require_shimmer = __commonJS({
25463
25463
  }
25464
25464
  function massWrap(nodules, names, wrapper) {
25465
25465
  if (!nodules) {
25466
- logger2("must provide one or more modules to patch");
25467
- logger2(new Error().stack);
25466
+ logger("must provide one or more modules to patch");
25467
+ logger(new Error().stack);
25468
25468
  return;
25469
25469
  } else if (!Array.isArray(nodules)) {
25470
25470
  nodules = [nodules];
25471
25471
  }
25472
25472
  if (!(names && Array.isArray(names))) {
25473
- logger2("must provide one or more functions to wrap on modules");
25473
+ logger("must provide one or more functions to wrap on modules");
25474
25474
  return;
25475
25475
  }
25476
25476
  nodules.forEach(function(nodule) {
@@ -25481,26 +25481,26 @@ var require_shimmer = __commonJS({
25481
25481
  }
25482
25482
  function unwrap(nodule, name2) {
25483
25483
  if (!nodule || !nodule[name2]) {
25484
- logger2("no function to unwrap.");
25485
- logger2(new Error().stack);
25484
+ logger("no function to unwrap.");
25485
+ logger(new Error().stack);
25486
25486
  return;
25487
25487
  }
25488
25488
  if (!nodule[name2].__unwrap) {
25489
- logger2("no original to unwrap to -- has " + name2 + " already been unwrapped?");
25489
+ logger("no original to unwrap to -- has " + name2 + " already been unwrapped?");
25490
25490
  } else {
25491
25491
  return nodule[name2].__unwrap();
25492
25492
  }
25493
25493
  }
25494
25494
  function massUnwrap(nodules, names) {
25495
25495
  if (!nodules) {
25496
- logger2("must provide one or more modules to patch");
25497
- logger2(new Error().stack);
25496
+ logger("must provide one or more modules to patch");
25497
+ logger(new Error().stack);
25498
25498
  return;
25499
25499
  } else if (!Array.isArray(nodules)) {
25500
25500
  nodules = [nodules];
25501
25501
  }
25502
25502
  if (!(names && Array.isArray(names))) {
25503
- logger2("must provide one or more functions to unwrap on modules");
25503
+ logger("must provide one or more functions to unwrap on modules");
25504
25504
  return;
25505
25505
  }
25506
25506
  nodules.forEach(function(nodule) {
@@ -39342,12 +39342,12 @@ var require_logging = __commonJS({
39342
39342
  break;
39343
39343
  default:
39344
39344
  }
39345
- var getLogger = () => {
39345
+ var getLogger2 = () => {
39346
39346
  return _logger;
39347
39347
  };
39348
- exports2.getLogger = getLogger;
39349
- var setLogger = (logger2) => {
39350
- _logger = logger2;
39348
+ exports2.getLogger = getLogger2;
39349
+ var setLogger = (logger) => {
39350
+ _logger = logger;
39351
39351
  };
39352
39352
  exports2.setLogger = setLogger;
39353
39353
  var setLoggerVerbosity = (verbosity) => {
@@ -45546,7 +45546,24 @@ var require_parse = __commonJS({
45546
45546
  else
45547
45547
  target.push([start = parseId(next()), skip("to", true) ? parseId(next()) : start]);
45548
45548
  } while (skip(",", true));
45549
- skip(";");
45549
+ var dummy = { options: void 0 };
45550
+ dummy.setOption = function(name2, value) {
45551
+ if (this.options === void 0) this.options = {};
45552
+ this.options[name2] = value;
45553
+ };
45554
+ ifBlock(
45555
+ dummy,
45556
+ function parseRange_block(token3) {
45557
+ if (token3 === "option") {
45558
+ parseOption(dummy, token3);
45559
+ skip(";");
45560
+ } else
45561
+ throw illegal(token3);
45562
+ },
45563
+ function parseRange_line() {
45564
+ parseInlineOptions(dummy);
45565
+ }
45566
+ );
45550
45567
  }
45551
45568
  function parseNumber(token2, insideTryCatch) {
45552
45569
  var sign = 1;
@@ -56753,8 +56770,8 @@ var require_src31 = __commonJS({
56753
56770
  throw new Error("Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead");
56754
56771
  };
56755
56772
  exports2.load = load;
56756
- var setLogger = (logger2) => {
56757
- logging.setLogger(logger2);
56773
+ var setLogger = (logger) => {
56774
+ logging.setLogger(logger);
56758
56775
  };
56759
56776
  exports2.setLogger = setLogger;
56760
56777
  var setLogVerbosity = (verbosity) => {
@@ -67365,10 +67382,10 @@ var import_resources = __toESM(require_src5(), 1);
67365
67382
  var import_sdk_node = __toESM(require_src36(), 1);
67366
67383
  var import_sdk_trace_node = __toESM(require_src20(), 1);
67367
67384
  var import_semantic_conventions = __toESM(require_src(), 1);
67368
- import { logger } from "../systemlog.cjs";
67385
+ import { getLogger } from "./request-context.cjs";
67369
67386
  var {
67370
67387
  default: { version, name }
67371
- } = await import("../../esm-chunks/package-NUPTPA44.js");
67388
+ } = await import("../../esm-chunks/package-VUTYVNOL.js");
67372
67389
  var sdk = new import_sdk_node.NodeSDK({
67373
67390
  resource: new import_resources.Resource({
67374
67391
  [import_semantic_conventions.SEMRESATTRS_SERVICE_NAME]: name,
@@ -67386,7 +67403,7 @@ process.on("SIGTERM", () => {
67386
67403
  // eslint-disable-next-line @typescript-eslint/no-empty-function
67387
67404
  () => {
67388
67405
  },
67389
- (error) => logger.withError(error).log("Error shutting down OpenTelemetry NodeSDK")
67406
+ (error) => getLogger().withError(error).log("Error shutting down OpenTelemetry NodeSDK")
67390
67407
  ).finally(() => process.exit(0));
67391
67408
  });
67392
67409
  export {
@@ -10,7 +10,7 @@ import type { Key } from '../vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts'
10
10
  import { compile, pathToRegexp } from '../vendor/deno.land/x/path_to_regexp@v6.2.1/index.ts'
11
11
  import { getCookies } from '../vendor/deno.land/std@0.175.0/http/cookie.ts'
12
12
 
13
- /*
13
+ /*
14
14
  ┌─────────────────────────────────────────────────────────────────────────┐
15
15
  │ Inlined/re-implemented types │
16
16
  └─────────────────────────────────────────────────────────────────────────┘
@@ -86,7 +86,7 @@ export type RoutesManifest = {
86
86
  dynamicRoutes: DynamicRoute[]
87
87
  }
88
88
 
89
- /*
89
+ /*
90
90
  ┌─────────────────────────────────────────────────────────────────────────┐
91
91
  │ packages/next/src/shared/lib/escape-regexp.ts │
92
92
  └─────────────────────────────────────────────────────────────────────────┘
@@ -104,7 +104,7 @@ export function escapeStringRegexp(str: string) {
104
104
  return str
105
105
  }
106
106
 
107
- /*
107
+ /*
108
108
  ┌─────────────────────────────────────────────────────────────────────────┐
109
109
  │ packages/next/src/shared/lib/router/utils/querystring.ts │
110
110
  └─────────────────────────────────────────────────────────────────────────┘
@@ -125,7 +125,7 @@ export function searchParamsToUrlQuery(searchParams: URLSearchParams): ParsedUrl
125
125
  return query
126
126
  }
127
127
 
128
- /*
128
+ /*
129
129
  ┌─────────────────────────────────────────────────────────────────────────┐
130
130
  │ packages/next/src/shared/lib/router/utils/parse-url.ts │
131
131
  └─────────────────────────────────────────────────────────────────────────┘
@@ -156,7 +156,7 @@ export function parseUrl(url: string): ParsedUrl {
156
156
  }
157
157
  }
158
158
 
159
- /*
159
+ /*
160
160
  ┌─────────────────────────────────────────────────────────────────────────┐
161
161
  │ packages/next/src/shared/lib/router/utils/prepare-destination.ts │
162
162
  │ — Changed to use WHATWG Fetch `Request` instead of │
@@ -392,7 +392,7 @@ function unescapeSegments(str: string) {
392
392
  return str.replace(/__ESC_COLON_/gi, ':')
393
393
  }
394
394
 
395
- /*
395
+ /*
396
396
  ┌─────────────────────────────────────────────────────────────────────────┐
397
397
  │ packages/next/src/shared/lib/router/utils/is-dynamic.ts │
398
398
  └─────────────────────────────────────────────────────────────────────────┘
@@ -404,7 +404,7 @@ export function isDynamicRoute(route: string): boolean {
404
404
  return TEST_ROUTE.test(route)
405
405
  }
406
406
 
407
- /*
407
+ /*
408
408
  ┌─────────────────────────────────────────────────────────────────────────┐
409
409
  │ packages/next/shared/lib/router/utils/middleware-route-matcher.ts │
410
410
  └─────────────────────────────────────────────────────────────────────────┘
@@ -1,7 +1,7 @@
1
1
  import type { Context } from '@netlify/edge-functions'
2
2
 
3
- import matchers from './matchers.json' assert { type: 'json' }
4
- import nextConfig from './next.config.json' assert { type: 'json' }
3
+ import matchers from './matchers.json' with { type: 'json' }
4
+ import nextConfig from './next.config.json' with { type: 'json' }
5
5
 
6
6
  import { InternalHeaders } from './lib/headers.ts'
7
7
  import { logger, LogLevel } from './lib/logging.ts'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.3.2",
3
+ "version": "5.3.3-canary-no-cache-fix.0",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -1,98 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
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
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/run/systemlog.cts
21
- var systemlog_exports = {};
22
- __export(systemlog_exports, {
23
- LogLevel: () => LogLevel,
24
- logger: () => systemLogger
25
- });
26
- module.exports = __toCommonJS(systemlog_exports);
27
-
28
- // node_modules/@netlify/functions/dist/chunk-HYMERDCV.mjs
29
- var import_process = require("process");
30
- var systemLogTag = "__nfSystemLog";
31
- var serializeError = (error) => {
32
- const cause = error?.cause instanceof Error ? serializeError(error.cause) : error.cause;
33
- return {
34
- error: error.message,
35
- error_cause: cause,
36
- error_stack: error.stack
37
- };
38
- };
39
- var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
40
- LogLevel2[LogLevel2["Debug"] = 1] = "Debug";
41
- LogLevel2[LogLevel2["Log"] = 2] = "Log";
42
- LogLevel2[LogLevel2["Error"] = 3] = "Error";
43
- return LogLevel2;
44
- })(LogLevel || {});
45
- var SystemLogger = class _SystemLogger {
46
- fields;
47
- logLevel;
48
- constructor(fields = {}, logLevel = 2) {
49
- this.fields = fields;
50
- this.logLevel = logLevel;
51
- }
52
- doLog(logger, message) {
53
- if (import_process.env.NETLIFY_DEV && !import_process.env.NETLIFY_ENABLE_SYSTEM_LOGGING) {
54
- return;
55
- }
56
- logger(systemLogTag, JSON.stringify({ msg: message, fields: this.fields }));
57
- }
58
- log(message) {
59
- if (this.logLevel > 2) {
60
- return;
61
- }
62
- this.doLog(console.log, message);
63
- }
64
- debug(message) {
65
- if (this.logLevel > 1) {
66
- return;
67
- }
68
- this.doLog(console.debug, message);
69
- }
70
- error(message) {
71
- if (this.logLevel > 3) {
72
- return;
73
- }
74
- this.doLog(console.error, message);
75
- }
76
- withLogLevel(level) {
77
- return new _SystemLogger(this.fields, level);
78
- }
79
- withFields(fields) {
80
- return new _SystemLogger(
81
- {
82
- ...this.fields,
83
- ...fields
84
- },
85
- this.logLevel
86
- );
87
- }
88
- withError(error) {
89
- const fields = error instanceof Error ? serializeError(error) : { error };
90
- return this.withFields(fields);
91
- }
92
- };
93
- var systemLogger = new SystemLogger();
94
- // Annotate the CommonJS export names for ESM import in node:
95
- 0 && (module.exports = {
96
- LogLevel,
97
- logger
98
- });