diff --git a/.changeset/dirty-scissors-fail.md b/.changeset/dirty-scissors-fail.md new file mode 100644 index 000000000000..0ec7f4cdec91 --- /dev/null +++ b/.changeset/dirty-scissors-fail.md @@ -0,0 +1,5 @@ +--- +'@astrojs/image': minor +--- + +added a warning if the image was GIF diff --git a/packages/integrations/image/src/vendor/squoosh/impl.ts b/packages/integrations/image/src/vendor/squoosh/impl.ts index fa50c0fd96d3..3d01141d3e76 100644 --- a/packages/integrations/image/src/vendor/squoosh/impl.ts +++ b/packages/integrations/image/src/vendor/squoosh/impl.ts @@ -31,6 +31,10 @@ export async function decodeBuffer( const firstChunkString = Array.from(firstChunk) .map((v) => String.fromCodePoint(v)) .join('') + // TODO (future PR): support more formats + if (firstChunkString.includes('GIF')) { + throw Error(`GIF images are not supported, please install the @astrojs/image/sharp plugin`) + } const key = Object.entries(supportedFormats).find(([, { detectors }]) => detectors.some((detector) => detector.exec(firstChunkString)) )?.[0] as EncoderKey | undefined