Skip to content

Commit

Permalink
feat: remove the squoosh image service (#11770)
Browse files Browse the repository at this point in the history
* feat: remove the squoosh image service

* fix: build

* chore: changeset
  • Loading branch information
Princesseuh authored Aug 20, 2024
1 parent 787fed8 commit cfa6a47
Show file tree
Hide file tree
Showing 60 changed files with 30 additions and 12,922 deletions.
22 changes: 22 additions & 0 deletions .changeset/spotty-garlics-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
'@astrojs/vercel': major
'@astrojs/node': major
'astro': major
---

Removed support for the Squoosh image service. As the underlying library `libsquoosh` is no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.

Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.

```diff
- import { squooshImageService } from "astro/config";
import { defineConfig } from "astro/config";

export default defineConfig({
- image: {
- service: squooshImageService()
- }
});
```

If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: https://github.com/Princesseuh/astro-image-service-squoosh
9 changes: 0 additions & 9 deletions packages/astro/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@ 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
*/
export function squooshImageService(): ImageServiceConfig;

/**
* Return the configuration needed to use the passthrough image service. This image services does not perform
* any image transformations, and is mainly useful when your platform does not support other image services, or you are
Expand Down
7 changes: 0 additions & 7 deletions packages/astro/config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ export function sharpImageService(config = {}) {
};
}

export function squooshImageService() {
return {
entrypoint: 'astro/assets/services/squoosh',
config: {},
};
}

export function passthroughImageService() {
return {
entrypoint: 'astro/assets/services/noop',
Expand Down
1 change: 0 additions & 1 deletion packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"./assets/utils/inferRemoteSize.js": "./dist/assets/utils/remoteProbe.js",
"./assets/endpoint/*": "./dist/assets/endpoint/*.js",
"./assets/services/sharp": "./dist/assets/services/sharp.js",
"./assets/services/squoosh": "./dist/assets/services/squoosh.js",
"./assets/services/noop": "./dist/assets/services/noop.js",
"./loaders": "./dist/content/loaders/index.js",
"./content/runtime": "./dist/content/runtime.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/assets/services/noop.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type LocalImageService, baseService } from './service.js';

// Empty service used for platforms that neither support Squoosh or Sharp.
// Empty service used for platforms that don't support Sharp / users who don't want transformations.
const noopService: LocalImageService = {
...baseService,
propertiesToHash: ['src'],
Expand Down
119 changes: 0 additions & 119 deletions packages/astro/src/assets/services/squoosh.ts

This file was deleted.

202 changes: 0 additions & 202 deletions packages/astro/src/assets/services/vendor/squoosh/LICENSE

This file was deleted.

Loading

0 comments on commit cfa6a47

Please sign in to comment.