@fedify/fastify 2.2.0-dev.613 → 2.2.0-dev.628

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.cjs CHANGED
@@ -1,5 +1,8 @@
1
- Object.defineProperty(exports, '__esModule', { value: true });
2
- //#region rolldown:runtime
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ //#region \0rolldown/runtime.js
3
6
  var __create = Object.create;
4
7
  var __defProp = Object.defineProperty;
5
8
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -20,11 +23,10 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
20
23
  value: mod,
21
24
  enumerable: true
22
25
  }) : target, mod));
23
-
24
26
  //#endregion
25
- const fastify_plugin = __toESM(require("fastify-plugin"));
26
- const node_stream = __toESM(require("node:stream"));
27
-
27
+ let fastify_plugin = require("fastify-plugin");
28
+ fastify_plugin = __toESM(fastify_plugin);
29
+ let node_stream = require("node:stream");
28
30
  //#region src/index.ts
29
31
  /**
30
32
  * Fastify plugin that integrates with a Federation instance.
@@ -88,9 +90,7 @@ const createDefaultNotAcceptableResponse = () => new Response("Not Acceptable",
88
90
  * Convert Fastify request to Web API Request.
89
91
  */
90
92
  function toWebRequest(fastifyReq) {
91
- const protocol = fastifyReq.protocol;
92
- const host = fastifyReq.headers.host ?? fastifyReq.hostname;
93
- const url = `${protocol}://${host}${fastifyReq.url}`;
93
+ const url = `${fastifyReq.protocol}://${fastifyReq.headers.host ?? fastifyReq.hostname}${fastifyReq.url}`;
94
94
  const headers = new Headers();
95
95
  for (const [key, value] of Object.entries(fastifyReq.raw.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
96
96
  else if (value !== void 0) headers.set(key, String(value));
@@ -101,8 +101,6 @@ function toWebRequest(fastifyReq) {
101
101
  body
102
102
  });
103
103
  }
104
- var src_default = fedifyPlugin;
105
-
106
104
  //#endregion
107
- exports.default = src_default;
108
- exports.fedifyPlugin = fedifyPlugin;
105
+ exports.default = fedifyPlugin;
106
+ exports.fedifyPlugin = fedifyPlugin;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,6 @@ import { Federation, FederationFetchOptions } from "@fedify/fedify";
2
2
  import { FastifyPluginAsync, FastifyPluginOptions, FastifyRequest } from "fastify";
3
3
 
4
4
  //#region src/index.d.ts
5
-
6
5
  type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
7
6
  /**
8
7
  * A factory function that creates context data for the Federation instance.
@@ -16,7 +15,6 @@ interface FedifyPluginOptions<TContextData> extends FastifyPluginOptions {
16
15
  contextDataFactory?: ContextDataFactory<TContextData>;
17
16
  errorHandlers?: Partial<ErrorHandlers>;
18
17
  }
19
- // Wrap with fastify-plugin to bypass encapsulation
20
18
  declare const fedifyPlugin: FastifyPluginAsync<FedifyPluginOptions<unknown>>;
21
19
  //#endregion
22
20
  export { ContextDataFactory, FedifyPluginOptions, fedifyPlugin as default, fedifyPlugin };
package/dist/index.d.ts CHANGED
@@ -2,7 +2,6 @@ import { Federation, FederationFetchOptions } from "@fedify/fedify";
2
2
  import { FastifyPluginAsync, FastifyPluginOptions, FastifyRequest } from "fastify";
3
3
 
4
4
  //#region src/index.d.ts
5
-
6
5
  type ErrorHandlers = Omit<FederationFetchOptions<unknown>, "contextData">;
7
6
  /**
8
7
  * A factory function that creates context data for the Federation instance.
@@ -16,7 +15,6 @@ interface FedifyPluginOptions<TContextData> extends FastifyPluginOptions {
16
15
  contextDataFactory?: ContextDataFactory<TContextData>;
17
16
  errorHandlers?: Partial<ErrorHandlers>;
18
17
  }
19
- // Wrap with fastify-plugin to bypass encapsulation
20
18
  declare const fedifyPlugin: FastifyPluginAsync<FedifyPluginOptions<unknown>>;
21
19
  //#endregion
22
20
  export { ContextDataFactory, FedifyPluginOptions, fedifyPlugin as default, fedifyPlugin };
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  import fp from "fastify-plugin";
2
2
  import { Readable } from "node:stream";
3
-
4
3
  //#region src/index.ts
5
4
  /**
6
5
  * Fastify plugin that integrates with a Federation instance.
@@ -64,9 +63,7 @@ const createDefaultNotAcceptableResponse = () => new Response("Not Acceptable",
64
63
  * Convert Fastify request to Web API Request.
65
64
  */
66
65
  function toWebRequest(fastifyReq) {
67
- const protocol = fastifyReq.protocol;
68
- const host = fastifyReq.headers.host ?? fastifyReq.hostname;
69
- const url = `${protocol}://${host}${fastifyReq.url}`;
66
+ const url = `${fastifyReq.protocol}://${fastifyReq.headers.host ?? fastifyReq.hostname}${fastifyReq.url}`;
70
67
  const headers = new Headers();
71
68
  for (const [key, value] of Object.entries(fastifyReq.raw.headers)) if (Array.isArray(value)) for (const v of value) headers.append(key, v);
72
69
  else if (value !== void 0) headers.set(key, String(value));
@@ -77,7 +74,5 @@ function toWebRequest(fastifyReq) {
77
74
  body
78
75
  });
79
76
  }
80
- var src_default = fedifyPlugin;
81
-
82
77
  //#endregion
83
- export { src_default as default, fedifyPlugin };
78
+ export { fedifyPlugin as default, fedifyPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fastify",
3
- "version": "2.2.0-dev.613+cf8cd122",
3
+ "version": "2.2.0-dev.628+7f7a1e9b",
4
4
  "description": "Integrate Fedify with Fastify",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -48,12 +48,12 @@
48
48
  },
49
49
  "peerDependencies": {
50
50
  "fastify": "^5.2.0",
51
- "@fedify/fedify": "^2.2.0-dev.613+cf8cd122"
51
+ "@fedify/fedify": "^2.2.0-dev.628+7f7a1e9b"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^22.17.0",
55
- "tsdown": "^0.12.9",
56
- "typescript": "^5.9.3"
55
+ "tsdown": "^0.21.6",
56
+ "typescript": "^5.9.2"
57
57
  },
58
58
  "scripts": {
59
59
  "build:self": "tsdown",