0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-06 22:10:10 -05:00

Deprecate the Squoosh image service (#11780)

This commit is contained in:
Erika 2024-08-20 14:28:52 +02:00 committed by GitHub
parent 1fd84b6bbc
commit c6622adaeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Deprecates the Squoosh image service, to be removed in Astro 5.0. We recommend migrating to the default Sharp service.

View file

@ -26,6 +26,9 @@ export function getViteConfig(
export function sharpImageService(config?: SharpImageServiceConfig): ImageServiceConfig;
/**
* @deprecated The Squoosh image service is deprecated and will be removed in Astro 5.x.
* We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained.
*
* Return the configuration needed to use the Squoosh-based image service
* See: https://docs.astro.build/en/guides/images/#configure-squoosh
*/

View file

@ -1,5 +1,4 @@
// TODO: Investigate removing this service once sharp lands WASM support, as libsquoosh is deprecated
import { yellow } from 'kleur/colors';
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
import { imageMetadata } from '../utils/metadata.js';
import {
@ -11,6 +10,13 @@ import {
import { processBuffer } from './vendor/squoosh/image-pool.js';
import type { Operation } from './vendor/squoosh/image.js';
// eslint-disable-next-line no-console
console.warn(
yellow(
'The Squoosh image service is deprecated and will be removed in Astro 5.x. We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained.',
),
);
const baseQuality = { low: 25, mid: 50, high: 80, max: 100 };
const qualityTable: Record<
Exclude<ImageOutputFormat, 'png' | 'svg'>,