mirror of
https://github.com/withastro/astro.git
synced 2025-04-14 23:51:49 -05:00
[ci] format
This commit is contained in:
parent
ff257df4e1
commit
0edd79fb54
3 changed files with 6 additions and 6 deletions
|
@ -4,4 +4,4 @@ There are 3 zod schemas needed to validate the Astro config properly:
|
|||
|
||||
- `AstroConfigSchema` (base): a schema that matches the `AstroConfig` type
|
||||
- `createRelativeSchema` (relative): a function that uses the base schema, and adds transformations relative to the project root. Transformations occur at runtime, and the paths are resolved against the `cwd` of the CLI.
|
||||
- `AstroConfigRefinedSchema` (refined): a schema that handles extra validations. Due to constraints imposed by the Astro architecture, refinements can't be done on the `AstroConfig` schema because integrations deal with the output of the `AstroConfig` schema. As a result, this schema runs after parsing the user config and after every integration `astro:config:setup` hook (to make sure `updateConfig() has been called with valid config)`.
|
||||
- `AstroConfigRefinedSchema` (refined): a schema that handles extra validations. Due to constraints imposed by the Astro architecture, refinements can't be done on the `AstroConfig` schema because integrations deal with the output of the `AstroConfig` schema. As a result, this schema runs after parsing the user config and after every integration `astro:config:setup` hook (to make sure `updateConfig() has been called with valid config)`.
|
||||
|
|
|
@ -11,7 +11,9 @@ export async function validateConfig(
|
|||
const AstroConfigRelativeSchema = createRelativeSchema(cmd, root);
|
||||
|
||||
// First-Pass Validation
|
||||
return await validateConfigRefined(await AstroConfigRelativeSchema.parseAsync(userConfig, { errorMap }));
|
||||
return await validateConfigRefined(
|
||||
await AstroConfigRelativeSchema.parseAsync(userConfig, { errorMap }),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -19,8 +21,6 @@ export async function validateConfig(
|
|||
* - To validate the user config
|
||||
* - To validate the config after all integrations (that may have updated it)
|
||||
*/
|
||||
export async function validateConfigRefined(
|
||||
updatedConfig: AstroConfig,
|
||||
): Promise<AstroConfig> {
|
||||
export async function validateConfigRefined(updatedConfig: AstroConfig): Promise<AstroConfig> {
|
||||
return await AstroConfigRefinedSchema.parseAsync(updatedConfig, { errorMap });
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import type { SerializedSSRManifest } from '../core/app/types.js';
|
|||
import type { PageBuildData } from '../core/build/types.js';
|
||||
import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.js';
|
||||
import { mergeConfig } from '../core/config/index.js';
|
||||
import { validateConfigRefined } from '../core/config/validate.js';
|
||||
import { validateSetAdapter } from '../core/dev/adapter-validation.js';
|
||||
import type { AstroIntegrationLogger, Logger } from '../core/logger/core.js';
|
||||
import { validateSessionConfig } from '../core/session.js';
|
||||
|
@ -34,7 +35,6 @@ import type {
|
|||
} from '../types/public/integrations.js';
|
||||
import type { RouteData } from '../types/public/internal.js';
|
||||
import { validateSupportedFeatures } from './features-validation.js';
|
||||
import { validateConfigRefined } from '../core/config/validate.js';
|
||||
|
||||
async function withTakingALongTimeMsg<T>({
|
||||
name,
|
||||
|
|
Loading…
Add table
Reference in a new issue