|
1 | | -import type { OutgoingHttpHeaders } from 'node:http'; |
2 | 1 | import type { |
3 | 2 | RehypePlugin as _RehypePlugin, |
4 | 3 | RemarkPlugin as _RemarkPlugin, |
5 | 4 | RemarkRehype as _RemarkRehype, |
6 | | - ShikiConfig, |
7 | 5 | Smartypants as _Smartypants, |
| 6 | + ShikiConfig, |
8 | 7 | } from '@astrojs/markdown-remark'; |
9 | 8 | import { markdownConfigDefaults, syntaxHighlightDefaults } from '@astrojs/markdown-remark'; |
| 9 | +import type { OutgoingHttpHeaders } from 'node:http'; |
10 | 10 | import { type BuiltinTheme, bundledThemes } from 'shiki'; |
11 | 11 | import * as z from 'zod/v4'; |
12 | 12 | import { FontFamilySchema } from '../../../assets/fonts/config.js'; |
| 13 | +import { SvgOptimizerSchema } from '../../../assets/svg/config.js'; |
13 | 14 | import { EnvSchema } from '../../../env/schema.js'; |
14 | 15 | import type { AstroUserConfig, ViteUserConfig } from '../../../types/public/config.js'; |
15 | | -import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from '../../csp/config.js'; |
16 | 16 | import { CacheSchema, RouteRulesSchema } from '../../cache/config.js'; |
| 17 | +import { allowedDirectivesSchema, cspAlgorithmSchema, cspHashSchema } from '../../csp/config.js'; |
17 | 18 | import { SessionSchema } from '../../session/config.js'; |
18 | | -import { SvgOptimizerSchema } from '../../../assets/svg/config.js'; |
19 | 19 |
|
20 | 20 | // The below types are required boilerplate to work around a Zod issue since v3.21.2. Since that version, |
21 | 21 | // Zod's compiled TypeScript would "simplify" certain values to their base representation, causing references |
@@ -193,15 +193,16 @@ export const AstroConfigSchema = z.object({ |
193 | 193 | .union([z.literal('where'), z.literal('class'), z.literal('attribute')]) |
194 | 194 | .optional() |
195 | 195 | .default('attribute'), |
196 | | - adapter: z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) }).optional(), |
197 | | - integrations: z.preprocess( |
198 | | - // preprocess |
199 | | - (val) => (Array.isArray(val) ? val.flat(Number.POSITIVE_INFINITY).filter(Boolean) : val), |
200 | | - // validate |
201 | | - z |
202 | | - .array(z.object({ name: z.string(), hooks: z.object({}).passthrough().default({}) })) |
203 | | - .default(ASTRO_CONFIG_DEFAULTS.integrations), |
204 | | - ), |
| 196 | + adapter: z.object({ name: z.string(), hooks: z.object({}).loose().default({}) }).optional(), |
| 197 | + integrations: z |
| 198 | + .preprocess( |
| 199 | + // preprocess |
| 200 | + (val) => (Array.isArray(val) ? val.flat(Number.POSITIVE_INFINITY).filter(Boolean) : val), |
| 201 | + // validate |
| 202 | + z.array(z.object({ name: z.string(), hooks: z.object({}).loose().default({}) })), |
| 203 | + ) |
| 204 | + .optional() |
| 205 | + .default(ASTRO_CONFIG_DEFAULTS.integrations), |
205 | 206 | build: z |
206 | 207 | .object({ |
207 | 208 | format: z |
|
0 commit comments