diff --git a/.changeset/fair-rats-fail.md b/.changeset/fair-rats-fail.md new file mode 100644 index 000000000000..b93bc8a2b5aa --- /dev/null +++ b/.changeset/fair-rats-fail.md @@ -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. diff --git a/packages/astro/config.d.ts b/packages/astro/config.d.ts index 9f4c6bfd112d..68743b35d37a 100644 --- a/packages/astro/config.d.ts +++ b/packages/astro/config.d.ts @@ -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 */ diff --git a/packages/astro/src/assets/services/squoosh.ts b/packages/astro/src/assets/services/squoosh.ts index 6eb78db4b2ee..b98f831d27a9 100644 --- a/packages/astro/src/assets/services/squoosh.ts +++ b/packages/astro/src/assets/services/squoosh.ts @@ -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,