Merge branch 'feat/format-support-expansion'

# Conflicts:
#	README.md
#	apps/web/src/components/layout/app-layout.tsx
This commit is contained in:
SnapOtter
2026-05-08 16:21:11 +08:00
145 changed files with 27402 additions and 100 deletions
@@ -10,10 +10,11 @@ const FORMAT_MAP: Record<string, string> = {
heif: "avif",
tiff: "tiff",
gif: "gif",
jxl: "jxl",
};
/** Formats that Sharp cannot encode — fall back to PNG for output. */
const NO_ENCODER = new Set(["svg", "bmp", "raw", "tga", "psd", "exr", "hdr", "ico"]);
const NO_ENCODER = new Set(["svg", "raw", "tga", "psd", "exr", "hdr"]);
function formatOpts(format: string, quality: number): Record<string, unknown> {
const opts: Record<string, unknown> = { quality };
@@ -39,6 +39,8 @@ export async function optimizeForWeb(image: Sharp, options: OptimizeForWebOption
return pipeline.avif({ quality, effort: 4 });
case "png":
return pipeline.png({ compressionLevel: 9, palette: true });
case "jxl":
return pipeline.jxl({ quality, effort: 7 });
default:
throw new Error(`Unsupported format: ${format}`);
}