Home / File/ validate-options.ts — astro Source File

validate-options.ts — astro Source File

Architecture documentation for validate-options.ts, a typescript file in the astro codebase. 3 imports, 0 dependents.

File typescript CoreAstro RoutingSystem 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  3325e896_efbb_d220_9c03_12ceb805ec1d["validate-options.ts"]
  3adbf330_e1f3_6c24_255f_e8c25442ac9f["./index.js"]
  3325e896_efbb_d220_9c03_12ceb805ec1d --> 3adbf330_e1f3_6c24_255f_e8c25442ac9f
  1aaba5cb_d258_7c13_0570_77fcb0c61a16["./schema.js"]
  3325e896_efbb_d220_9c03_12ceb805ec1d --> 1aaba5cb_d258_7c13_0570_77fcb0c61a16
  f8c9251e_f535_6281_2118_9e79a4155212["v4"]
  3325e896_efbb_d220_9c03_12ceb805ec1d --> f8c9251e_f535_6281_2118_9e79a4155212
  style 3325e896_efbb_d220_9c03_12ceb805ec1d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import * as z from 'zod/v4';
import type { SitemapOptions } from './index.js';
import { SitemapOptionsSchema } from './schema.js';

// @internal
export const validateOptions = (site: string | undefined, opts: SitemapOptions) => {
	const result = SitemapOptionsSchema.parse(opts);

	z.object({
		site: z.string().optional(), // Astro takes care of `site`: how to validate, transform and refine
		canonicalURL: z.string().optional(), // `canonicalURL` is already validated in prev step
	})
		.refine((options) => options.site || options.canonicalURL, {
			message: 'Required `site` astro.config option or `canonicalURL` integration option',
		})
		.parse({
			site,
			canonicalURL: result.canonicalURL,
		});

	return result;
};

Domain

Subdomains

Functions

Dependencies

  • ./index.js
  • ./schema.js
  • v4

Frequently Asked Questions

What does validate-options.ts do?
validate-options.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RoutingSystem subdomain.
What functions are defined in validate-options.ts?
validate-options.ts defines 1 function(s): validateOptions.
What does validate-options.ts depend on?
validate-options.ts imports 3 module(s): ./index.js, ./schema.js, v4.
Where is validate-options.ts in the architecture?
validate-options.ts is located at packages/integrations/sitemap/src/validate-options.ts (domain: CoreAstro, subdomain: RoutingSystem, directory: packages/integrations/sitemap/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free