diff options
author | 2023-08-01 22:14:57 +0200 | |
---|---|---|
committer | 2023-08-08 11:02:51 +0100 | |
commit | c0de7a7b0f042cd49cbea4f4ac1b2ab6f9fef644 (patch) | |
tree | 6292e6f61494f26f94f616ced858681ea192ef42 | |
parent | f01eb585e7c972d940761309b1595f682b6922d2 (diff) | |
download | astro-c0de7a7b0f042cd49cbea4f4ac1b2ab6f9fef644.tar.gz astro-c0de7a7b0f042cd49cbea4f4ac1b2ab6f9fef644.tar.zst astro-c0de7a7b0f042cd49cbea4f4ac1b2ab6f9fef644.zip |
feat: make Sharp the default image service (#7908)
* feat: make Sharp the default image service
* chore: lockfile
Diffstat (limited to '')
-rw-r--r-- | .changeset/four-houses-compete.md | 18 | ||||
-rw-r--r-- | packages/astro/package.json | 10 | ||||
-rw-r--r-- | packages/astro/src/@types/astro.ts | 4 | ||||
-rw-r--r-- | packages/astro/src/core/config/schema.ts | 2 |
4 files changed, 22 insertions, 12 deletions
diff --git a/.changeset/four-houses-compete.md b/.changeset/four-houses-compete.md new file mode 100644 index 000000000..641bb1035 --- /dev/null +++ b/.changeset/four-houses-compete.md @@ -0,0 +1,18 @@ +--- +'astro': major +--- + +Sharp is now the default image service used for `astro:assets`. If you would prefer to still use Squoosh, you can update your config with the following: + +```ts +import { defineConfig, squooshImageService } from "astro/config"; + +// https://astro.build/config +export default defineConfig({ + image: { + service: squooshImageService(), + } +}) +``` + +However, not only do we recommend using Sharp as it is faster and more reliable, it is also highly likely that the Squoosh service will be removed in a future release. diff --git a/packages/astro/package.json b/packages/astro/package.json index a3a1d68c7..32e016073 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -153,6 +153,7 @@ "mime": "^3.0.0", "network-information-types": "^0.1.1", "ora": "^6.3.1", + "sharp": "^0.32.1", "p-limit": "^4.0.0", "path-to-regexp": "^6.2.1", "preferred-pm": "^3.0.3", @@ -209,19 +210,10 @@ "remark-code-titles": "^0.1.2", "rollup": "^3.25.1", "sass": "^1.63.4", - "sharp": "^0.32.1", "srcset-parse": "^1.1.0", "undici": "^5.22.1", "unified": "^10.1.2" }, - "peerDependencies": { - "sharp": ">=0.31.0" - }, - "peerDependenciesMeta": { - "sharp": { - "optional": true - } - }, "engines": { "node": ">=18.14.1", "npm": ">=6.14.0" diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 1e5863d12..4c51a7eaf 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -20,9 +20,9 @@ import type { AstroConfigSchema } from '../core/config'; import type { AstroTimer } from '../core/config/timer'; import type { AstroCookies } from '../core/cookies'; import type { LogOptions, LoggerLevel } from '../core/logger/core'; +import { AstroIntegrationLogger } from '../core/logger/core'; import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server'; import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js'; -import { AstroIntegrationLogger } from '../core/logger/core'; export type { MarkdownHeading, MarkdownMetadata, @@ -987,7 +987,7 @@ export interface AstroUserConfig { * @docs * @name image.service (Experimental) * @type {{entrypoint: 'astro/assets/services/sharp' | 'astro/assets/services/squoosh' | string, config: Record<string, any>}} - * @default `{entrypoint: 'astro/assets/services/squoosh', config?: {}}` + * @default `{entrypoint: 'astro/assets/services/sharp', config?: {}}` * @version 2.1.0 * @description * Set which image service is used for Astro’s experimental assets support. diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index c40953187..64cb4d16a 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -191,7 +191,7 @@ export const AstroConfigSchema = z.object({ }), }) .default({ - service: { entrypoint: 'astro/assets/services/squoosh', config: {} }, + service: { entrypoint: 'astro/assets/services/sharp', config: {} }, }), markdown: z .object({ |