@fedify/koa 2.0.8 → 2.0.9

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,28 +1,5 @@
1
- //#region rolldown:runtime
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
-
23
- //#endregion
24
- const node_stream = __toESM(require("node:stream"));
25
-
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let node_stream = require("node:stream");
26
3
  //#region src/index.ts
27
4
  /**
28
5
  * Create a Koa middleware to integrate with the {@link Federation} object.
@@ -80,8 +57,7 @@ function setResponse(ctx, response) {
80
57
  ctx.status = response.status;
81
58
  response.headers.forEach((value, key) => ctx.set(key, value));
82
59
  if (response.body == null) return;
83
- const body = response.body;
84
- const reader = body.getReader();
60
+ const reader = response.body.getReader();
85
61
  ctx.body = new node_stream.Readable({ async read() {
86
62
  const { done, value } = await reader.read();
87
63
  if (done) {
@@ -90,6 +66,5 @@ function setResponse(ctx, response) {
90
66
  } else this.push(value);
91
67
  } });
92
68
  }
93
-
94
69
  //#endregion
95
- exports.createMiddleware = createMiddleware;
70
+ exports.createMiddleware = createMiddleware;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Federation } from "@fedify/fedify/federation";
2
2
 
3
3
  //#region src/index.d.ts
4
-
5
4
  /**
6
5
  * A factory function to create context data for the {@link Federation} object.
7
6
  *
@@ -12,7 +11,6 @@ import { Federation } from "@fedify/fedify/federation";
12
11
  * @returns A context data for the {@link Federation} object.
13
12
  * @since 1.9.0
14
13
  */
15
- // deno-lint-ignore no-explicit-any
16
14
  type ContextDataFactory<TContextData, TKoaContext = any> = (context: TKoaContext) => TContextData | Promise<TContextData>;
17
15
  /**
18
16
  * Create a Koa middleware to integrate with the {@link Federation} object.
@@ -26,7 +24,6 @@ type ContextDataFactory<TContextData, TKoaContext = any> = (context: TKoaContext
26
24
  * @returns A Koa middleware.
27
25
  * @since 1.9.0
28
26
  */
29
- // deno-lint-ignore no-explicit-any
30
27
  declare function createMiddleware<TContextData, TKoaContext = any>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, TKoaContext>): (ctx: TKoaContext, next: () => Promise<void>) => Promise<void>;
31
28
  //#endregion
32
29
  export { ContextDataFactory, createMiddleware };
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { Federation } from "@fedify/fedify/federation";
2
2
 
3
3
  //#region src/index.d.ts
4
-
5
4
  /**
6
5
  * A factory function to create context data for the {@link Federation} object.
7
6
  *
@@ -12,7 +11,6 @@ import { Federation } from "@fedify/fedify/federation";
12
11
  * @returns A context data for the {@link Federation} object.
13
12
  * @since 1.9.0
14
13
  */
15
- // deno-lint-ignore no-explicit-any
16
14
  type ContextDataFactory<TContextData, TKoaContext = any> = (context: TKoaContext) => TContextData | Promise<TContextData>;
17
15
  /**
18
16
  * Create a Koa middleware to integrate with the {@link Federation} object.
@@ -26,7 +24,6 @@ type ContextDataFactory<TContextData, TKoaContext = any> = (context: TKoaContext
26
24
  * @returns A Koa middleware.
27
25
  * @since 1.9.0
28
26
  */
29
- // deno-lint-ignore no-explicit-any
30
27
  declare function createMiddleware<TContextData, TKoaContext = any>(federation: Federation<TContextData>, contextDataFactory: ContextDataFactory<TContextData, TKoaContext>): (ctx: TKoaContext, next: () => Promise<void>) => Promise<void>;
31
28
  //#endregion
32
29
  export { ContextDataFactory, createMiddleware };
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { Readable } from "node:stream";
2
-
3
2
  //#region src/index.ts
4
3
  /**
5
4
  * Create a Koa middleware to integrate with the {@link Federation} object.
@@ -57,8 +56,7 @@ function setResponse(ctx, response) {
57
56
  ctx.status = response.status;
58
57
  response.headers.forEach((value, key) => ctx.set(key, value));
59
58
  if (response.body == null) return;
60
- const body = response.body;
61
- const reader = body.getReader();
59
+ const reader = response.body.getReader();
62
60
  ctx.body = new Readable({ async read() {
63
61
  const { done, value } = await reader.read();
64
62
  if (done) {
@@ -67,6 +65,5 @@ function setResponse(ctx, response) {
67
65
  } else this.push(value);
68
66
  } });
69
67
  }
70
-
71
68
  //#endregion
72
- export { createMiddleware };
69
+ export { createMiddleware };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/koa",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Integrate Fedify with Koa",
5
5
  "keywords": [
6
6
  "Fedify",
@@ -50,13 +50,13 @@
50
50
  ],
51
51
  "peerDependencies": {
52
52
  "koa": "^2.0.0 || ^3.0.0",
53
- "@fedify/fedify": "^2.0.8"
53
+ "@fedify/fedify": "^2.0.9"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@types/koa": "^2.15.0",
57
57
  "@types/node": "^22.17.0",
58
- "tsdown": "^0.12.9",
59
- "typescript": "^5.9.3"
58
+ "tsdown": "^0.21.6",
59
+ "typescript": "^5.9.2"
60
60
  },
61
61
  "scripts": {
62
62
  "build:self": "tsdown",