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:
parent
1fd84b6bbc
commit
c6622adaeb
3 changed files with 16 additions and 2 deletions
5
.changeset/fair-rats-fail.md
Normal file
5
.changeset/fair-rats-fail.md
Normal 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.
|
3
packages/astro/config.d.ts
vendored
3
packages/astro/config.d.ts
vendored
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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'>,
|
||||
|
|
Loading…
Reference in a new issue