Comparing version 3.0.0-rc.3 to 3.0.0-rc.4
{ | ||
"name": "bunshine", | ||
"version": "3.0.0-rc.3", | ||
"version": "3.0.0-rc.4", | ||
"module": "server/server.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -5,10 +5,11 @@ # Bunshine | ||
<img alt="Bunshine Logo" src="https://github.com/kensnyder/bunshine/raw/main/assets/bunshine-logo.png?v=3.0.0-rc.3" width="200" height="187" /> | ||
<img alt="Bunshine Logo" src="https://github.com/kensnyder/bunshine/raw/main/assets/bunshine-logo.png?v=3.0.0-rc.4" width="200" height="187" /> | ||
[](https://npmjs.com/package/bunshine) | ||
[](https://github.com/search?q=repo:kensnyder/bunshine++language:TypeScript&type=code) | ||
 | ||
[](https://www.npmjs.com/package/bunshine?activeTab=dependencies) | ||
 | ||
[](https://opensource.org/licenses/ISC) | ||
[](https://npmjs.com/package/bunshine) | ||
[](https://github.com/search?q=repo:kensnyder/bunshine++language:TypeScript&type=code) | ||
 | ||
[](https://www.npmjs.com/package/bunshine?activeTab=dependencies) | ||
 | ||
[](https://deepscan.io/dashboard#view=project&tid=24409&pid=27605&bid=884000) | ||
[](https://opensource.org/licenses/ISC) | ||
@@ -1028,3 +1029,3 @@ ## Installation | ||
<img alt="devLogger" src="https://github.com/kensnyder/bunshine/raw/main/assets/devLogger-screenshot.png?v=3.0.0-rc.3" width="524" height="78" /> | ||
<img alt="devLogger" src="https://github.com/kensnyder/bunshine/raw/main/assets/devLogger-screenshot.png?v=3.0.0-rc.4" width="524" height="78" /> | ||
@@ -1045,5 +1046,5 @@ `prodLogger` outputs logs in JSON with the following shape: | ||
"runtime": "Bun v1.1.33", | ||
"poweredBy": "Bunshine v3.0.0-rc.3", | ||
"poweredBy": "Bunshine v3.0.0-rc.4", | ||
"machine": "server1", | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0-rc.3.0 Safari/537.36", | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0-rc.4.0 Safari/537.36", | ||
"pid": 123 | ||
@@ -1065,5 +1066,5 @@ } | ||
"runtime": "Bun v1.1.3", | ||
"poweredBy": "Bunshine v3.0.0-rc.3", | ||
"poweredBy": "Bunshine v3.0.0-rc.4", | ||
"machine": "server1", | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0-rc.3.0 Safari/537.36", | ||
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0-rc.4.0 Safari/537.36", | ||
"pid": 123, | ||
@@ -1325,3 +1326,3 @@ "took": 5 | ||
middleware. Deflate provides no advantage, and Brotli provides 2-8% additional | ||
size savings at the cost of 7-10x as much CPU time as gzip. Brotli takes on | ||
size savings at the cost of 100x as much CPU time as gzip. Brotli takes on | ||
the order of 100ms to compress 100kb of html, compared to sub-milliseconds | ||
@@ -1334,5 +1335,7 @@ for gzip. | ||
- `response-reencoding.ts` - Both the etags middleware and compression | ||
middleware convert the response body to an ArrayBuffer, process it, then create a new Response object. The decode/reencode process takes only 10s of microseconds. | ||
- `TextEncoder-reuse.ts` - The Context object's response factories (c.json(), | ||
c.html(), etc.) reuse a single `TextEncoder` object. That gains about 18% | ||
middleware convert the response body to an `ArrayBuffer`, process it, then | ||
create a new `Response` object. The decode/reencode process takes only 10s of | ||
microseconds. | ||
- `TextEncoder-reuse.ts` - The Context object's response factories (`c.json()`, | ||
`c.html()`, etc.) reuse a single `TextEncoder` object. That gains about 18% | ||
which turns out to be only on the order of 10s of nanoseconds. | ||
@@ -1368,3 +1371,4 @@ - `timer-resolution.ts` - `performance.now()` is faster than `Date.now()` even | ||
- ✅ Context | ||
- ✅ examples/server.ts | ||
- ✅ examples/kitchen-sink.ts | ||
- 🔲 more examples | ||
- ✅ middleware > compression | ||
@@ -1389,3 +1393,2 @@ - ✅ middleware > cors | ||
- 🔲 support and document flags to bin/serve.ts with commander | ||
- 🔲 more files in examples folder | ||
- 🔲 example of mini app that uses bin/serve.ts (maybe our own docs?) | ||
@@ -1392,0 +1395,0 @@ - 🔲 GitHub Actions to run tests and coverage |
@@ -26,3 +26,3 @@ import { TypedArray } from 'type-fest'; | ||
resp.headers.set('Etag', etag); | ||
if (ifNoneMatch && ifNoneMatch === etag) { | ||
if (ifNoneMatch && _includesEtag(ifNoneMatch, etag)) { | ||
return new Response('', { | ||
@@ -42,2 +42,7 @@ headers: resp.headers, | ||
function _includesEtag(ifNoneMatch: string, etag: string) { | ||
const matches = ifNoneMatch.split(',').map(s => s.trim()); | ||
return matches.includes(etag); | ||
} | ||
export async function defaultEtagsCalculator(_: Context, resp: Response) { | ||
@@ -44,0 +49,0 @@ const buffer = await resp.arrayBuffer(); |
136996
2277
1393