Skip to content

Commit

Permalink
fix: settings requiring service to be set when settings domains or re…
Browse files Browse the repository at this point in the history
…motePatterns (#8266)
  • Loading branch information
Princesseuh authored Aug 29, 2023
1 parent a78175c commit 8450379
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-impalas-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Fix `image.service` requiring to be set manually when `image.domains` or `image.remotePatterns` was assigned a value
27 changes: 16 additions & 11 deletions packages/astro/src/core/config/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand All @@ -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),
Expand Down

0 comments on commit 8450379

Please sign in to comment.