Fix the mechanical style rules. [skip build]

This commit is contained in:
2026-11-01 09:01:32 +11:00
parent 831ce01150
commit 9591d8d01b
42 changed files with 762 additions and 756 deletions
+28 -28
View File
@@ -268,6 +268,34 @@ export function needsPngForMetadata(metadata: ImageMetadata): boolean {
return Boolean(metadata.banner || metadata.avatarBorderColor || metadata.gradient);
}
/**
* Build a Blob from Uint8Array without relying on BufferSource/BlobPart quirks
* across TS DOM lib / Electron versions (avoids SharedArrayBuffer typing issues).
*/
export function uint8ArrayToBlob(data: Uint8Array, type: string): Blob {
const copy = new ArrayBuffer(data.byteLength);
new Uint8Array(copy).set(data);
return new Blob([copy], { type });
}
/**
* Get the MIME type for an image format
*/
export function getMimeType(format: ImageFormat): string {
switch (format) {
case 'png':
return 'image/png';
case 'webp':
return 'image/webp';
case 'jpeg':
return 'image/jpeg';
case 'gif':
return 'image/gif';
default:
return 'application/octet-stream';
}
}
/**
* Convert image data to PNG via canvas (needed for banner/border/gradient metadata).
*/
@@ -304,16 +332,6 @@ export async function convertImageDataToPng(
}
}
/**
* Build a Blob from Uint8Array without relying on BufferSource/BlobPart quirks
* across TS DOM lib / Electron versions (avoids SharedArrayBuffer typing issues).
*/
export function uint8ArrayToBlob(data: Uint8Array, type: string): Blob {
const copy = new ArrayBuffer(data.byteLength);
new Uint8Array(copy).set(data);
return new Blob([copy], { type });
}
/**
* Embed paarrot metadata (color and/or banner) into image data
* Preserves existing metadata that is not being updated
@@ -376,24 +394,6 @@ export function removeColorFromImage(imageData: ArrayBuffer | Uint8Array): Uint8
}
}
/**
* Get the MIME type for an image format
*/
export function getMimeType(format: ImageFormat): string {
switch (format) {
case 'png':
return 'image/png';
case 'webp':
return 'image/webp';
case 'jpeg':
return 'image/jpeg';
case 'gif':
return 'image/gif';
default:
return 'application/octet-stream';
}
}
/**
* Get the file extension for an image format
*/