Home / File/ index.ts — astro Source File

index.ts — astro Source File

Architecture documentation for index.ts, a typescript file in the astro codebase. 9 imports, 0 dependents.

File typescript CoreAstro CoreMiddleware 9 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  79573a16_7c46_af8f_5c1d_ea09d9ca9085["index.ts"]
  f0cbc7bb_03ef_2f8c_ec25_361aa00a83d4["./generate-sitemap.js"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> f0cbc7bb_03ef_2f8c_ec25_361aa00a83d4
  d5a12e0e_02f4_40c2_0804_1cbb696a519d["./validate-options.js"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> d5a12e0e_02f4_40c2_0804_1cbb696a519d
  2092713d_04f1_047a_5a27_c1ffde0d3652["./write-sitemap.js"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> 2092713d_04f1_047a_5a27_c1ffde0d3652
  1b66c913_7d50_8404_c094_72060e3e2622["./write-sitemap-chunk.js"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> 1b66c913_7d50_8404_c094_72060e3e2622
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  f16d8c76_2866_6150_bd14_0347b59abfe9["astro"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> f16d8c76_2866_6150_bd14_0347b59abfe9
  4b2a278b_7519_80c4_73d6_387d11edd840["sitemap"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> 4b2a278b_7519_80c4_73d6_387d11edd840
  f8c9251e_f535_6281_2118_9e79a4155212["v4"]
  79573a16_7c46_af8f_5c1d_ea09d9ca9085 --> f8c9251e_f535_6281_2118_9e79a4155212
  style 79573a16_7c46_af8f_5c1d_ea09d9ca9085 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import path from 'node:path';
import { fileURLToPath } from 'node:url';
import type { AstroConfig, AstroIntegration, IntegrationResolvedRoute } from 'astro';
import type { EnumChangefreq, LinkItem as LinkItemBase, SitemapItemLoose } from 'sitemap';
import { ZodError } from 'zod/v4';

import { generateSitemap } from './generate-sitemap.js';
import { validateOptions } from './validate-options.js';
import { writeSitemap } from './write-sitemap.js';
import { writeSitemapChunk } from './write-sitemap-chunk.js';

export { EnumChangefreq as ChangeFreqEnum } from 'sitemap';

export type ChangeFreq = `${EnumChangefreq}`;
export type SitemapItem = Pick<
	SitemapItemLoose,
	'url' | 'lastmod' | 'changefreq' | 'priority' | 'links'
>;
export type LinkItem = LinkItemBase;

export type SitemapOptions =
	| {
			filenameBase?: string;
			filter?(page: string): boolean;
			customSitemaps?: string[];
			customPages?: string[];

			i18n?: {
				defaultLocale: string;
				locales: Record<string, string>;
			};
			// number of entries per sitemap file
			entryLimit?: number;
			// sitemap specific
			changefreq?: ChangeFreq;
			lastmod?: Date;
			priority?: number;

			// called for each sitemap item just before to save them on disk, sync or async
			serialize?(item: SitemapItem): SitemapItem | Promise<SitemapItem | undefined> | undefined;

			xslURL?: string;
			chunks?: Record<
				string,
				(item: SitemapItem) => SitemapItem | Promise<SitemapItem | undefined> | undefined
			>;
			// namespace configuration
			namespaces?: {
				news?: boolean;
				xhtml?: boolean;
				image?: boolean;
				video?: boolean;
			};
	  }
	| undefined;

function formatConfigErrorMessage(err: ZodError) {
	const errorList = err.issues.map((issue) => ` ${issue.path.join('.')}  ${issue.message + '.'}`);
	return errorList.join('\n');
}
// ... (217 more lines)

Domain

Subdomains

Dependencies

  • ./generate-sitemap.js
  • ./validate-options.js
  • ./write-sitemap-chunk.js
  • ./write-sitemap.js
  • astro
  • node:path
  • node:url
  • sitemap
  • v4

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in index.ts?
index.ts defines 4 function(s): createPlugin, formatConfigErrorMessage, isStatusCodePage, item.
What does index.ts depend on?
index.ts imports 9 module(s): ./generate-sitemap.js, ./validate-options.js, ./write-sitemap-chunk.js, ./write-sitemap.js, astro, node:path, node:url, sitemap, and 1 more.
Where is index.ts in the architecture?
index.ts is located at packages/integrations/sitemap/src/index.ts (domain: CoreAstro, subdomain: CoreMiddleware, 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