summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2024-08-20 14:28:52 +0200
committerGravatar GitHub <noreply@github.com> 2024-08-20 14:28:52 +0200
commitc6622adaeb405e961b12c91f0e5d02c7333d01cf (patch)
tree0e7b72867f995c0d5c8b5419e922f0b18671a0dd
parent1fd84b6bbc42885d0a80ea65a87b4a7946320924 (diff)
downloadastro-c6622adaeb405e961b12c91f0e5d02c7333d01cf.tar.gz
astro-c6622adaeb405e961b12c91f0e5d02c7333d01cf.tar.zst
astro-c6622adaeb405e961b12c91f0e5d02c7333d01cf.zip
Deprecate the Squoosh image service (#11780)
-rw-r--r--.changeset/fair-rats-fail.md5
-rw-r--r--packages/astro/config.d.ts3
-rw-r--r--packages/astro/src/assets/services/squoosh.ts10
3 files changed, 16 insertions, 2 deletions
diff --git a/.changeset/fair-rats-fail.md b/.changeset/fair-rats-fail.md
new file mode 100644
index 000000000..b93bc8a2b
--- /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 9f4c6bfd1..68743b35d 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 6eb78db4b..b98f831d2 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<ImageOutputFormat, 'png' | 'svg'>,