mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
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:
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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" },
|
||||
|
||||
@@ -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":
|
||||
|
||||
Reference in New Issue
Block a user