keryx 0.14.0 → 0.14.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keryx",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -110,17 +110,15 @@ export async function compressResponse(
110
110
 
111
111
  // Compress the buffered body
112
112
  const format: Bun.CompressionFormat = encoding === "br" ? "brotli" : "gzip";
113
- // @ts-ignore CompressionStream types from stream/web vs node:stream/web are incompatible with some bun-types versions
114
- const stream = new Blob([body])
115
- .stream()
116
- .pipeThrough(new CompressionStream(format));
113
+ // @ts-ignore Bun supports "brotli" as CompressionFormat but DOM lib does not
114
+ const compressionStream = new CompressionStream(format);
115
+ const stream = new Blob([body]).stream().pipeThrough(compressionStream);
117
116
 
118
117
  const headers = new Headers(response.headers);
119
118
  headers.set("Content-Encoding", encoding);
120
119
  headers.append("Vary", "Accept-Encoding");
121
120
  headers.delete("Content-Length");
122
121
 
123
- // @ts-ignore ReadableStream type mismatch between stream/web and some bun-types versions
124
122
  return new Response(stream, {
125
123
  status: response.status,
126
124
  headers,
@@ -129,15 +127,15 @@ export async function compressResponse(
129
127
 
130
128
  // Content-Length is present and above threshold — stream-compress
131
129
  const format: Bun.CompressionFormat = encoding === "br" ? "brotli" : "gzip";
132
- // @ts-ignore CompressionStream types from stream/web vs node:stream/web are incompatible with some bun-types versions
133
- const stream = response.body.pipeThrough(new CompressionStream(format));
130
+ // @ts-ignore Bun supports "brotli" as CompressionFormat but DOM lib does not
131
+ const compressionStream = new CompressionStream(format);
132
+ const stream = response.body.pipeThrough(compressionStream);
134
133
 
135
134
  const headers = new Headers(response.headers);
136
135
  headers.set("Content-Encoding", encoding);
137
136
  headers.append("Vary", "Accept-Encoding");
138
137
  headers.delete("Content-Length");
139
138
 
140
- // @ts-ignore ReadableStream type mismatch between stream/web and some bun-types versions
141
139
  return new Response(stream, {
142
140
  status: response.status,
143
141
  headers,