Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading