- Compress responses: page scripts and styles once (brotli or gzip, in memory) and cached immutable; pages and API JSON gzipped as they stream - Service worker serves content-named assets cache-first - Load the models modal's data when it opens (cached in localStorage) instead of shipping the model catalog in every conversation page - Lazy-load the Tiptap composer and memoize thread messages - Import lucide icons directly; twui 0.1.4 drops by-name icons from Button - bun run start builds the pages minified before serving Co-Authored-By: Claude Opus 5.5 <[email protected]>
24 lines
1.4 KiB
TypeScript
24 lines
1.4 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import isCompressibleType from "./is-compressible-type";
|
|
|
|
describe("isCompressibleType", () => {
|
|
test("takes text, scripts, JSON and SVG", () => {
|
|
expect(isCompressibleType({ content_type: "text/html; charset=utf-8" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "text/javascript;charset=utf-8" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "text/css" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "application/json" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "application/javascript" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "application/manifest+json" })).toBe(true);
|
|
expect(isCompressibleType({ content_type: "image/svg+xml" })).toBe(true);
|
|
});
|
|
|
|
test("leaves media, binaries and streams", () => {
|
|
expect(isCompressibleType({ content_type: "text/event-stream" })).toBe(false);
|
|
expect(isCompressibleType({ content_type: "audio/mpeg" })).toBe(false);
|
|
expect(isCompressibleType({ content_type: "image/png" })).toBe(false);
|
|
expect(isCompressibleType({ content_type: "application/octet-stream" })).toBe(false);
|
|
expect(isCompressibleType({ content_type: "font/woff2" })).toBe(false);
|
|
expect(isCompressibleType({ content_type: null })).toBe(false);
|
|
});
|
|
});
|