@netlify/plugin-nextjs 5.10.7 → 5.11.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.
Files changed (34) hide show
  1. package/dist/build/advanced-api-routes.js +1 -1
  2. package/dist/build/cache.js +1 -1
  3. package/dist/build/content/prerendered.js +47 -21
  4. package/dist/build/content/server.js +22 -15
  5. package/dist/build/content/static.js +4 -8
  6. package/dist/build/functions/edge.js +2 -2
  7. package/dist/build/functions/server.js +4 -8
  8. package/dist/build/image-cdn.js +1 -1
  9. package/dist/build/plugin-context.js +2 -2
  10. package/dist/build/templates/handler-monorepo.tmpl.js +0 -5
  11. package/dist/build/templates/handler.tmpl.js +0 -4
  12. package/dist/build/verification.js +3 -3
  13. package/dist/esm-chunks/{chunk-OEQOKJGE.js → chunk-6BT4RYQJ.js} +1 -12
  14. package/dist/esm-chunks/{chunk-APO262HE.js → chunk-F7NTXMLE.js} +26 -10
  15. package/dist/esm-chunks/chunk-FKDTZJRV.js +832 -0
  16. package/dist/esm-chunks/{chunk-NFOLXH6F.js → chunk-YUXQHOYO.js} +1 -1
  17. package/dist/index.js +3 -7
  18. package/dist/run/config.js +3 -3
  19. package/dist/run/constants.js +3 -3
  20. package/dist/run/handlers/cache.cjs +24 -234
  21. package/dist/run/handlers/request-context.cjs +63 -88
  22. package/dist/run/handlers/server.js +9 -6
  23. package/dist/run/handlers/tags-handler.cjs +192 -0
  24. package/dist/run/handlers/tracer.cjs +4 -4
  25. package/dist/run/handlers/use-cache-handler.js +1553 -0
  26. package/dist/run/headers.js +1 -1
  27. package/dist/run/revalidate.js +1 -1
  28. package/dist/shared/blobkey.js +1 -1
  29. package/edge-runtime/lib/routing.ts +12 -2
  30. package/package.json +1 -1
  31. package/dist/esm-chunks/chunk-5QSXBV7L.js +0 -89
  32. package/dist/esm-chunks/chunk-GNGHTHMQ.js +0 -1624
  33. package/dist/esm-chunks/package-SGSU42JZ.js +0 -148
  34. package/dist/run/handlers/tracing.js +0 -68968
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-OEQOKJGE.js";
7
+ import "../esm-chunks/chunk-6BT4RYQJ.js";
8
8
 
9
9
  // src/run/headers.ts
10
10
  import { recordWarning } from "./handlers/tracer.cjs";
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-OEQOKJGE.js";
7
+ import "../esm-chunks/chunk-6BT4RYQJ.js";
8
8
 
9
9
  // src/run/revalidate.ts
10
10
  import { isPromise } from "node:util/types";
@@ -4,7 +4,7 @@
4
4
  return createRequire(import.meta.url);
5
5
  })();
6
6
 
7
- import "../esm-chunks/chunk-OEQOKJGE.js";
7
+ import "../esm-chunks/chunk-6BT4RYQJ.js";
8
8
 
9
9
  // src/shared/blobkey.ts
10
10
  import { Buffer } from "node:buffer";
@@ -424,14 +424,24 @@ export interface MiddlewareMatcher {
424
424
  missing?: RouteHas[]
425
425
  }
426
426
 
427
+ const decodeMaybeEncodedPath = (path: string): string => {
428
+ try {
429
+ return decodeURIComponent(path)
430
+ } catch {
431
+ return path
432
+ }
433
+ }
434
+
427
435
  export function getMiddlewareRouteMatcher(matchers: MiddlewareMatcher[]): MiddlewareRouteMatch {
428
436
  return (
429
- pathname: string | null | undefined,
437
+ unsafePathname: string | null | undefined,
430
438
  req: Pick<Request, 'headers' | 'url'>,
431
439
  query: Params,
432
440
  ) => {
441
+ const pathname = decodeMaybeEncodedPath(unsafePathname ?? '')
442
+
433
443
  for (const matcher of matchers) {
434
- const routeMatch = new RegExp(matcher.regexp).exec(pathname!)
444
+ const routeMatch = new RegExp(matcher.regexp).exec(pathname)
435
445
  if (!routeMatch) {
436
446
  continue
437
447
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netlify/plugin-nextjs",
3
- "version": "5.10.7",
3
+ "version": "5.11.1",
4
4
  "description": "Run Next.js seamlessly on Netlify",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",
@@ -1,89 +0,0 @@
1
-
2
- var require = await (async () => {
3
- var { createRequire } = await import("node:module");
4
- return createRequire(import.meta.url);
5
- })();
6
-
7
- import {
8
- SpanStatusCode,
9
- context,
10
- init_esm
11
- } from "./chunk-GNGHTHMQ.js";
12
-
13
- // node_modules/@opentelemetry/api/build/esm/experimental/trace/SugaredTracer.js
14
- init_esm();
15
- var defaultOnException = function(e, span) {
16
- span.recordException(e);
17
- span.setStatus({
18
- code: SpanStatusCode.ERROR
19
- });
20
- };
21
- function wrapTracer(tracer) {
22
- return new SugaredTracer(tracer);
23
- }
24
- var SugaredTracer = (
25
- /** @class */
26
- function() {
27
- function SugaredTracer2(tracer) {
28
- this._tracer = tracer;
29
- this.startSpan = tracer.startSpan.bind(this._tracer);
30
- this.startActiveSpan = tracer.startActiveSpan.bind(this._tracer);
31
- }
32
- SugaredTracer2.prototype.withActiveSpan = function(name, arg2, arg3, arg4) {
33
- var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
34
- return this._tracer.startActiveSpan(name, opts, ctx, function(span) {
35
- return handleFn(span, opts, fn);
36
- });
37
- };
38
- SugaredTracer2.prototype.withSpan = function(name, arg2, arg3, arg4) {
39
- var _a = massageParams(arg2, arg3, arg4), opts = _a.opts, ctx = _a.ctx, fn = _a.fn;
40
- var span = this._tracer.startSpan(name, opts, ctx);
41
- return handleFn(span, opts, fn);
42
- };
43
- return SugaredTracer2;
44
- }()
45
- );
46
- function massageParams(arg, arg2, arg3) {
47
- var opts;
48
- var ctx;
49
- var fn;
50
- if (!arg2 && !arg3) {
51
- fn = arg;
52
- } else if (!arg3) {
53
- opts = arg;
54
- fn = arg2;
55
- } else {
56
- opts = arg;
57
- ctx = arg2;
58
- fn = arg3;
59
- }
60
- opts = opts !== null && opts !== void 0 ? opts : {};
61
- ctx = ctx !== null && ctx !== void 0 ? ctx : context.active();
62
- return { opts, ctx, fn };
63
- }
64
- function handleFn(span, opts, fn) {
65
- var _a;
66
- var onException = (_a = opts.onException) !== null && _a !== void 0 ? _a : defaultOnException;
67
- var errorHandler = function(e) {
68
- onException(e, span);
69
- span.end();
70
- throw e;
71
- };
72
- try {
73
- var ret = fn(span);
74
- if (typeof (ret === null || ret === void 0 ? void 0 : ret.then) === "function") {
75
- return ret.then(function(val) {
76
- span.end();
77
- return val;
78
- }, errorHandler);
79
- }
80
- span.end();
81
- return ret;
82
- } catch (e) {
83
- throw errorHandler(e);
84
- }
85
- }
86
-
87
- export {
88
- wrapTracer
89
- };