0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

fix: settings requiring service to be set when settings domains or remotePatterns (#8266)

This commit is contained in:
Erika 2023-08-29 17:54:24 +02:00 committed by GitHub
parent a78175c1b8
commit 8450379db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 11 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix `image.service` requiring to be set manually when `image.domains` or `image.remotePatterns` was assigned a value

View file

@ -29,6 +29,9 @@ const ASTRO_CONFIG_DEFAULTS = {
split: false,
excludeMiddleware: false,
},
image: {
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
},
compressHTML: true,
server: {
host: false,
@ -180,14 +183,18 @@ export const AstroConfigSchema = z.object({
.default(ASTRO_CONFIG_DEFAULTS.redirects),
image: z
.object({
service: z.object({
entrypoint: z.union([
z.literal('astro/assets/services/sharp'),
z.literal('astro/assets/services/squoosh'),
z.string(),
]),
config: z.record(z.any()).default({}),
}),
service: z
.object({
entrypoint: z
.union([
z.literal('astro/assets/services/sharp'),
z.literal('astro/assets/services/squoosh'),
z.string(),
])
.default(ASTRO_CONFIG_DEFAULTS.image.service.entrypoint),
config: z.record(z.any()).default({}),
})
.default(ASTRO_CONFIG_DEFAULTS.image.service),
domains: z.array(z.string()).default([]),
remotePatterns: z
.array(
@ -213,9 +220,7 @@ export const AstroConfigSchema = z.object({
)
.default([]),
})
.default({
service: { entrypoint: 'astro/assets/services/sharp', config: {} },
}),
.default(ASTRO_CONFIG_DEFAULTS.image),
markdown: z
.object({
drafts: z.boolean().default(false),