@fedify/next 2.0.1 → 2.0.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.
package/dist/index.d.cts CHANGED
@@ -7,88 +7,88 @@ interface ContextDataFactory<TContextData> {
7
7
  }
8
8
  type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
9
9
  /**
10
- * Wrapper function for Next.js middleware to integrate with the
11
- * {@link Federation} object.
12
- *
13
- * @template TContextData A type of the context data for the
14
- * {@link Federation} object.
15
- * @param federation A {@link Federation} object to integrate with Next.js.
16
- * @param contextDataFactory A function to create a context data for the
17
- * {@link Federation} object.
18
- * @param errorHandlers A set of error handlers to handle errors during
19
- * the federation fetch.
20
- * @returns A Next.js middleware function to integrate with the
21
- * {@link Federation} object.
22
- *
23
- * @example
24
- * ```ts ignore
25
- * import { fedifyWith } from "@fedify/next";
26
- * import { federation } from "./federation";
27
- *
28
- * export default fedifyWith(federation)(
29
- * function (request: Request) {
30
- * // You can add custom logic here for other requests
31
- * // except federation requests. If there is no custom logic,
32
- * // you can omit this function.
33
- * }
34
- * )
35
- *
36
- * // This config makes middleware process only requests with the
37
- * // "Accept" header matching the federation accept regex.
38
- * // More details: https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional.
39
- * export const config = {
40
- * runtime: "nodejs",
41
- * matcher: [
42
- * {
43
- * source: "/:path*",
44
- * has: [
45
- * {
46
- * type: "header",
47
- * key: "Accept",
48
- * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
49
- * },
50
- * ],
51
- * },
52
- * {
53
- * source: "/:path*",
54
- * has: [
55
- * {
56
- * type: "header",
57
- * key: "content-type",
58
- * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
59
- * },
60
- * ],
61
- * },
62
- * { source: "/.well-known/nodeinfo" },
63
- * { source: "/.well-known/x-nodeinfo2" },
64
- * ],
65
- * };
66
- * ```
67
- */
10
+ * Wrapper function for Next.js middleware to integrate with the
11
+ * {@link Federation} object.
12
+ *
13
+ * @template TContextData A type of the context data for the
14
+ * {@link Federation} object.
15
+ * @param federation A {@link Federation} object to integrate with Next.js.
16
+ * @param contextDataFactory A function to create a context data for the
17
+ * {@link Federation} object.
18
+ * @param errorHandlers A set of error handlers to handle errors during
19
+ * the federation fetch.
20
+ * @returns A Next.js middleware function to integrate with the
21
+ * {@link Federation} object.
22
+ *
23
+ * @example
24
+ * ```ts ignore
25
+ * import { fedifyWith } from "@fedify/next";
26
+ * import { federation } from "./federation";
27
+ *
28
+ * export default fedifyWith(federation)(
29
+ * function (request: Request) {
30
+ * // You can add custom logic here for other requests
31
+ * // except federation requests. If there is no custom logic,
32
+ * // you can omit this function.
33
+ * }
34
+ * )
35
+ *
36
+ * // This config makes middleware process only requests with the
37
+ * // "Accept" header matching the federation accept regex.
38
+ * // More details: https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional.
39
+ * export const config = {
40
+ * runtime: "nodejs",
41
+ * matcher: [
42
+ * {
43
+ * source: "/:path*",
44
+ * has: [
45
+ * {
46
+ * type: "header",
47
+ * key: "Accept",
48
+ * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
49
+ * },
50
+ * ],
51
+ * },
52
+ * {
53
+ * source: "/:path*",
54
+ * has: [
55
+ * {
56
+ * type: "header",
57
+ * key: "content-type",
58
+ * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
59
+ * },
60
+ * ],
61
+ * },
62
+ * { source: "/.well-known/nodeinfo" },
63
+ * { source: "/.well-known/x-nodeinfo2" },
64
+ * ],
65
+ * };
66
+ * ```
67
+ */
68
68
  declare const fedifyWith: <TContextData>(federation: Federation<TContextData>, contextDataFactory?: ContextDataFactory<TContextData>, errorHandlers?: Partial<ErrorHandlers>) => (middleware?: (request: Request) => unknown) => (request: Request) => unknown;
69
69
  declare const isFederationRequest: (request: Request) => boolean;
70
70
  /**
71
- * Check if the request has the header matching the federation
72
- * accept regex.
73
- * @param key The header key to check.
74
- * @param request The request to check.
75
- * @returns `true` if the request has the header matching
76
- * the federation accept regex, `false` otherwise.
77
- */
71
+ * Check if the request has the header matching the federation
72
+ * accept regex.
73
+ * @param key The header key to check.
74
+ * @param request The request to check.
75
+ * @returns `true` if the request has the header matching
76
+ * the federation accept regex, `false` otherwise.
77
+ */
78
78
  declare const hasFederationHeader: (key: string) => (request: Request) => boolean;
79
79
  declare const isNodeInfoRequest: (request: Request) => boolean;
80
80
  /**
81
- * Create a Next.js handler to integrate with the {@link Federation} object.
82
- *
83
- * @template TContextData A type of the context data for the
84
- * {@link Federation} object.
85
- * @param federation A {@link Federation} object to integrate with Next.js.
86
- * @param contextDataFactory A function to create a context data for the
87
- * {@link Federation} object.
88
- * @param errorHandlers A set of error handlers to handle errors during
89
- * the federation fetch.
90
- * @returns A Next.js handler.
91
- */
81
+ * Create a Next.js handler to integrate with the {@link Federation} object.
82
+ *
83
+ * @template TContextData A type of the context data for the
84
+ * {@link Federation} object.
85
+ * @param federation A {@link Federation} object to integrate with Next.js.
86
+ * @param contextDataFactory A function to create a context data for the
87
+ * {@link Federation} object.
88
+ * @param errorHandlers A set of error handlers to handle errors during
89
+ * the federation fetch.
90
+ * @returns A Next.js handler.
91
+ */
92
92
  declare function integrateFederation<TContextData>(federation: Federation<TContextData>, contextDataFactory?: ContextDataFactory<TContextData>, errorHandlers?: Partial<ErrorHandlers>): (request: Request) => Promise<Response>;
93
93
  //#endregion
94
94
  export { fedifyWith, hasFederationHeader, integrateFederation, isFederationRequest, isNodeInfoRequest };
package/dist/index.d.ts CHANGED
@@ -7,88 +7,88 @@ interface ContextDataFactory<TContextData> {
7
7
  }
8
8
  type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
9
9
  /**
10
- * Wrapper function for Next.js middleware to integrate with the
11
- * {@link Federation} object.
12
- *
13
- * @template TContextData A type of the context data for the
14
- * {@link Federation} object.
15
- * @param federation A {@link Federation} object to integrate with Next.js.
16
- * @param contextDataFactory A function to create a context data for the
17
- * {@link Federation} object.
18
- * @param errorHandlers A set of error handlers to handle errors during
19
- * the federation fetch.
20
- * @returns A Next.js middleware function to integrate with the
21
- * {@link Federation} object.
22
- *
23
- * @example
24
- * ```ts ignore
25
- * import { fedifyWith } from "@fedify/next";
26
- * import { federation } from "./federation";
27
- *
28
- * export default fedifyWith(federation)(
29
- * function (request: Request) {
30
- * // You can add custom logic here for other requests
31
- * // except federation requests. If there is no custom logic,
32
- * // you can omit this function.
33
- * }
34
- * )
35
- *
36
- * // This config makes middleware process only requests with the
37
- * // "Accept" header matching the federation accept regex.
38
- * // More details: https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional.
39
- * export const config = {
40
- * runtime: "nodejs",
41
- * matcher: [
42
- * {
43
- * source: "/:path*",
44
- * has: [
45
- * {
46
- * type: "header",
47
- * key: "Accept",
48
- * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
49
- * },
50
- * ],
51
- * },
52
- * {
53
- * source: "/:path*",
54
- * has: [
55
- * {
56
- * type: "header",
57
- * key: "content-type",
58
- * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
59
- * },
60
- * ],
61
- * },
62
- * { source: "/.well-known/nodeinfo" },
63
- * { source: "/.well-known/x-nodeinfo2" },
64
- * ],
65
- * };
66
- * ```
67
- */
10
+ * Wrapper function for Next.js middleware to integrate with the
11
+ * {@link Federation} object.
12
+ *
13
+ * @template TContextData A type of the context data for the
14
+ * {@link Federation} object.
15
+ * @param federation A {@link Federation} object to integrate with Next.js.
16
+ * @param contextDataFactory A function to create a context data for the
17
+ * {@link Federation} object.
18
+ * @param errorHandlers A set of error handlers to handle errors during
19
+ * the federation fetch.
20
+ * @returns A Next.js middleware function to integrate with the
21
+ * {@link Federation} object.
22
+ *
23
+ * @example
24
+ * ```ts ignore
25
+ * import { fedifyWith } from "@fedify/next";
26
+ * import { federation } from "./federation";
27
+ *
28
+ * export default fedifyWith(federation)(
29
+ * function (request: Request) {
30
+ * // You can add custom logic here for other requests
31
+ * // except federation requests. If there is no custom logic,
32
+ * // you can omit this function.
33
+ * }
34
+ * )
35
+ *
36
+ * // This config makes middleware process only requests with the
37
+ * // "Accept" header matching the federation accept regex.
38
+ * // More details: https://nextjs.org/docs/app/api-reference/file-conventions/middleware#config-object-optional.
39
+ * export const config = {
40
+ * runtime: "nodejs",
41
+ * matcher: [
42
+ * {
43
+ * source: "/:path*",
44
+ * has: [
45
+ * {
46
+ * type: "header",
47
+ * key: "Accept",
48
+ * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
49
+ * },
50
+ * ],
51
+ * },
52
+ * {
53
+ * source: "/:path*",
54
+ * has: [
55
+ * {
56
+ * type: "header",
57
+ * key: "content-type",
58
+ * value: ".*application\\/((jrd|activity|ld)\\+json|xrd\\+xml).*",
59
+ * },
60
+ * ],
61
+ * },
62
+ * { source: "/.well-known/nodeinfo" },
63
+ * { source: "/.well-known/x-nodeinfo2" },
64
+ * ],
65
+ * };
66
+ * ```
67
+ */
68
68
  declare const fedifyWith: <TContextData>(federation: Federation<TContextData>, contextDataFactory?: ContextDataFactory<TContextData>, errorHandlers?: Partial<ErrorHandlers>) => (middleware?: (request: Request) => unknown) => (request: Request) => unknown;
69
69
  declare const isFederationRequest: (request: Request) => boolean;
70
70
  /**
71
- * Check if the request has the header matching the federation
72
- * accept regex.
73
- * @param key The header key to check.
74
- * @param request The request to check.
75
- * @returns `true` if the request has the header matching
76
- * the federation accept regex, `false` otherwise.
77
- */
71
+ * Check if the request has the header matching the federation
72
+ * accept regex.
73
+ * @param key The header key to check.
74
+ * @param request The request to check.
75
+ * @returns `true` if the request has the header matching
76
+ * the federation accept regex, `false` otherwise.
77
+ */
78
78
  declare const hasFederationHeader: (key: string) => (request: Request) => boolean;
79
79
  declare const isNodeInfoRequest: (request: Request) => boolean;
80
80
  /**
81
- * Create a Next.js handler to integrate with the {@link Federation} object.
82
- *
83
- * @template TContextData A type of the context data for the
84
- * {@link Federation} object.
85
- * @param federation A {@link Federation} object to integrate with Next.js.
86
- * @param contextDataFactory A function to create a context data for the
87
- * {@link Federation} object.
88
- * @param errorHandlers A set of error handlers to handle errors during
89
- * the federation fetch.
90
- * @returns A Next.js handler.
91
- */
81
+ * Create a Next.js handler to integrate with the {@link Federation} object.
82
+ *
83
+ * @template TContextData A type of the context data for the
84
+ * {@link Federation} object.
85
+ * @param federation A {@link Federation} object to integrate with Next.js.
86
+ * @param contextDataFactory A function to create a context data for the
87
+ * {@link Federation} object.
88
+ * @param errorHandlers A set of error handlers to handle errors during
89
+ * the federation fetch.
90
+ * @returns A Next.js handler.
91
+ */
92
92
  declare function integrateFederation<TContextData>(federation: Federation<TContextData>, contextDataFactory?: ContextDataFactory<TContextData>, errorHandlers?: Partial<ErrorHandlers>): (request: Request) => Promise<Response>;
93
93
  //#endregion
94
94
  export { fedifyWith, hasFederationHeader, integrateFederation, isFederationRequest, isNodeInfoRequest };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/next",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "Integrate Fedify with Next.js",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -51,7 +51,7 @@
51
51
  ],
52
52
  "peerDependencies": {
53
53
  "next": "^15.4.6",
54
- "@fedify/fedify": "^2.0.1"
54
+ "@fedify/fedify": "^2.0.2"
55
55
  },
56
56
  "devDependencies": {
57
57
  "tsdown": "^0.12.9",