validate.ts — astro Source File
Architecture documentation for validate.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 143fef06_0023_7c05_ceb8_02d41e7430ff["validate.ts"] c32d12e2_d85e_28c0_eea7_9b29629857e0["../types/public/config.js"] 143fef06_0023_7c05_ceb8_02d41e7430ff --> c32d12e2_d85e_28c0_eea7_9b29629857e0 ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"] 143fef06_0023_7c05_ceb8_02d41e7430ff --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9 98277c9f_2ef4_8553_dbba_3908c3aeda5e["../../core/config/schemas/index.js"] 143fef06_0023_7c05_ceb8_02d41e7430ff --> 98277c9f_2ef4_8553_dbba_3908c3aeda5e style 143fef06_0023_7c05_ceb8_02d41e7430ff fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { AstroConfig } from '../../types/public/config.js';
import { errorMap } from '../errors/index.js';
import { AstroConfigRefinedSchema, createRelativeSchema } from './schemas/index.js';
/** Turn raw config values into normalized values */
export async function validateConfig(
userConfig: any,
root: string,
cmd: string,
): Promise<AstroConfig> {
const AstroConfigRelativeSchema = createRelativeSchema(cmd, root);
// First-Pass Validation
return await validateConfigRefined(
await AstroConfigRelativeSchema.parseAsync(userConfig, {
error(issue) {
// If an experimental feature, give a more specific error message.
if (issue.path?.[0] === 'experimental') {
return {
message: `Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/experimental-flags/ for a list of all current experiments.`,
};
}
return errorMap(issue);
},
}),
);
}
/**
* Used twice:
* - 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> {
return await AstroConfigRefinedSchema.parseAsync(updatedConfig, { error: errorMap });
}
Domain
Subdomains
Functions
Dependencies
- ../../core/config/schemas/index.js
- ../core/errors/index.js
- ../types/public/config.js
Source
Frequently Asked Questions
What does validate.ts do?
validate.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in validate.ts?
validate.ts defines 2 function(s): validateConfig, validateConfigRefined.
What does validate.ts depend on?
validate.ts imports 3 module(s): ../../core/config/schemas/index.js, ../core/errors/index.js, ../types/public/config.js.
Where is validate.ts in the architecture?
validate.ts is located at packages/astro/src/core/config/validate.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/config).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free