Home / File/ config.ts — astro Source File

config.ts — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  be7d1eab_916b_90f9_3072_d169ed547abf["config.ts"]
  ef8a1e3f_e350_75a6_b92d_62a8566d8db9["../core/errors/index.js"]
  be7d1eab_916b_90f9_3072_d169ed547abf --> ef8a1e3f_e350_75a6_b92d_62a8566d8db9
  eb7ca709_080c_a438_b9d7_f1238835779d["../content/consts.js"]
  be7d1eab_916b_90f9_3072_d169ed547abf --> eb7ca709_080c_a438_b9d7_f1238835779d
  a7935420_ff38_d53d_2988_e0293e03591e["./loaders/types.js"]
  be7d1eab_916b_90f9_3072_d169ed547abf --> a7935420_ff38_d53d_2988_e0293e03591e
  a2586aae_ce09_613d_4444_659268b61a89["core"]
  be7d1eab_916b_90f9_3072_d169ed547abf --> a2586aae_ce09_613d_4444_659268b61a89
  f8c9251e_f535_6281_2118_9e79a4155212["v4"]
  be7d1eab_916b_90f9_3072_d169ed547abf --> f8c9251e_f535_6281_2118_9e79a4155212
  style be7d1eab_916b_90f9_3072_d169ed547abf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type * as zCore from 'zod/v4/core';
import type * as z from 'zod/v4';
import { AstroError, AstroErrorData, AstroUserError } from '../core/errors/index.js';
import { CONTENT_LAYER_TYPE, LIVE_CONTENT_TYPE } from './consts.js';
import type { LiveLoader, Loader } from './loaders/types.js';

function getImporterFilename() {
	// Find the first line in the stack trace that doesn't include 'defineCollection' or 'getImporterFilename'
	const stackLine = new Error().stack
		?.split('\n')
		.find(
			(line) =>
				!line.includes('defineCollection') &&
				!line.includes('defineLiveCollection') &&
				!line.includes('getImporterFilename') &&
				!line.startsWith('Error'),
		);
	if (!stackLine) {
		return undefined;
	}
	// Extract the relative path from the stack line
	const match = /\/((?:src|chunks)\/.*?):\d+:\d+/.exec(stackLine);

	return match?.[1] ?? undefined;
}

// This needs to be in sync with ImageMetadata
type ImageFunction = () => z.ZodObject<{
	src: zCore.$ZodString;
	width: zCore.$ZodNumber;
	height: zCore.$ZodNumber;
	format: zCore.$ZodUnion<
		[
			zCore.$ZodLiteral<'png'>,
			zCore.$ZodLiteral<'jpg'>,
			zCore.$ZodLiteral<'jpeg'>,
			zCore.$ZodLiteral<'tiff'>,
			zCore.$ZodLiteral<'webp'>,
			zCore.$ZodLiteral<'gif'>,
			zCore.$ZodLiteral<'svg'>,
			zCore.$ZodLiteral<'avif'>,
		]
	>;
}>;

export interface DataEntry {
	id: string;
	data: Record<string, unknown>;
	filePath?: string;
	body?: string;
}

export interface DataStore {
	get: (key: string) => DataEntry;
	entries: () => Array<[id: string, DataEntry]>;
	set: (key: string, data: Record<string, unknown>, body?: string, filePath?: string) => void;
	values: () => Array<DataEntry>;
	keys: () => Array<string>;
	delete: (key: string) => void;
	clear: () => void;
// ... (152 more lines)

Subdomains

Dependencies

  • ../content/consts.js
  • ../core/errors/index.js
  • ./loaders/types.js
  • core
  • v4

Frequently Asked Questions

What does config.ts do?
config.ts is a source file in the astro codebase, written in typescript. It belongs to the ContentCollections domain, DataLoaders subdomain.
What functions are defined in config.ts?
config.ts defines 9 function(s): Array, DataEntry, S, defineCollection, defineLiveCollection, getImporterFilename, id, key, z.
What does config.ts depend on?
config.ts imports 5 module(s): ../content/consts.js, ../core/errors/index.js, ./loaders/types.js, core, v4.
Where is config.ts in the architecture?
config.ts is located at packages/astro/src/content/config.ts (domain: ContentCollections, subdomain: DataLoaders, directory: packages/astro/src/content).

Analyze Your Own Codebase

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

Try Supermodel Free