- 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]>
21 lines
1.1 KiB
TypeScript
21 lines
1.1 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import isHashedAssetPath from "./is-hashed-asset-path";
|
|
|
|
describe("isHashedAssetPath", () => {
|
|
test("matches content-named page scripts and styles", () => {
|
|
expect(isHashedAssetPath({ pathname: "/.bunext/public/pages/chunk-AEHOZS24.js" })).toBe(true);
|
|
expect(isHashedAssetPath({ pathname: "/.bunext/public/pages/auth/login/S2GYKY3T.js" })).toBe(true);
|
|
expect(isHashedAssetPath({ pathname: "/.bunext/public/pages/auth/login/X4TQCLSA.css" })).toBe(true);
|
|
expect(
|
|
isHashedAssetPath({ pathname: "/.bunext/public/pages/admin/bots/%5Bbot_id%5D/VXCMP4GM.js" }),
|
|
).toBe(true);
|
|
});
|
|
|
|
test("leaves fixed names and everything else", () => {
|
|
expect(isHashedAssetPath({ pathname: "/.bunext/public/vendor/react.js" })).toBe(false);
|
|
expect(isHashedAssetPath({ pathname: "/.bunext/public/pages/index.js" })).toBe(false);
|
|
expect(isHashedAssetPath({ pathname: "/admin/bots" })).toBe(false);
|
|
expect(isHashedAssetPath({ pathname: "/public/AEHOZS24.js" })).toBe(false);
|
|
});
|
|
});
|