fix: resolve Sharp 0.35.1 and BullMQ type incompatibilities after dep bumps

Sharp 0.35.1 moved FormatEnum to a namespace export and removed "avif"
from FormatEnum (now a separate literal in toFormat). BullMQ 5.78.1
bundles ioredis 5.10.1 while we have 5.11.1, causing structural type
mismatch. Also fixes new Biome 1.9 lint rules.
This commit is contained in:
SnapOtter
2026-06-15 15:20:16 +08:00
parent 9a61cb6af1
commit b76dc68682
18 changed files with 62 additions and 50 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ export function registerCompose(app: FastifyInstance) {
input: processedOverlay,
top: settings.y,
left: settings.x,
blend: settings.blendMode as import("sharp").Blend,
blend: settings.blendMode as sharp.Blend,
},
])
.toBuffer();
+1 -3
View File
@@ -120,9 +120,7 @@ export function registerConvert(app: FastifyInstance) {
}
const inputExt = extname(filename).toLowerCase().replace(".", "");
const sharpOpts: import("sharp").SharpOptions = isSvgBuffer(inputBuffer)
? { density: 300 }
: {};
const sharpOpts: sharp.SharpOptions = isSvgBuffer(inputBuffer) ? { density: 300 } : {};
// Preserve animation frames when both input and output are animatable formats
if (ANIMATABLE_FORMATS.has(inputExt) && ANIMATABLE_FORMATS.has(settings.format)) {
sharpOpts.animated = true;
+4 -2
View File
@@ -24,14 +24,16 @@ const settingsSchema = z.object({
quality: z.number().min(1).max(100).default(90),
});
type SharpFormat = keyof sharp.FormatEnum | "avif";
function resolveOutputFormat(
outputFormat: string,
originalExt: string,
): { sharpFormat: keyof sharp.FormatEnum | null; ext: string } {
): { sharpFormat: SharpFormat | null; ext: string } {
if (outputFormat === "original") {
return { sharpFormat: null, ext: originalExt };
}
const map: Record<string, { sharpFormat: keyof sharp.FormatEnum; ext: string }> = {
const map: Record<string, { sharpFormat: SharpFormat; ext: string }> = {
png: { sharpFormat: "png", ext: ".png" },
jpg: { sharpFormat: "jpeg", ext: ".jpg" },
webp: { sharpFormat: "webp", ext: ".webp" },
+1 -1
View File
@@ -209,7 +209,7 @@ export function registerStripMetadata(app: FastifyInstance) {
case "webp":
result.webp({ quality: 85 });
break;
case "avif":
case "heif":
result.avif({ quality: 50 });
break;
case "tiff":