Home / Type/ LoaderContext Type — astro Architecture

LoaderContext Type — astro Architecture

Architecture documentation for the LoaderContext type/interface in types.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  3306cd60_e902_9313_91fc_2fbd5805e639["LoaderContext"]
  a146b99b_6ede_06f0_3c83_b19531b5f76a["types.ts"]
  3306cd60_e902_9313_91fc_2fbd5805e639 -->|defined in| a146b99b_6ede_06f0_3c83_b19531b5f76a
  style 3306cd60_e902_9313_91fc_2fbd5805e639 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/astro/src/content/loaders/types.ts lines 29–55

export interface LoaderContext {
	/** The unique name of the collection */
	collection: string;
	/** A database to store the actual data */
	store: DataStore;
	/**  A simple KV store, designed for things like sync tokens */
	meta: MetaStore;
	logger: AstroIntegrationLogger;
	/** Astro config, with user config and merged defaults */
	config: AstroConfig;
	/** Validates and parses the data according to the collection schema */
	parseData<TData extends Record<string, unknown>>(props: ParseDataOptions<TData>): Promise<TData>;

	/** Renders markdown content to HTML and metadata */
	renderMarkdown(content: string, options?: RenderMarkdownOptions): Promise<RenderedContent>;

	/** Generates a non-cryptographic content digest. This can be used to check if the data has changed */
	generateDigest(data: Record<string, unknown> | string): string;

	/** When running in dev, this is a filesystem watcher that can be used to trigger updates */
	watcher?: FSWatcher;

	/** If the loader has been triggered by an integration, this may optionally contain extra data set by that integration */
	refreshContextData?: Record<string, unknown>;
	/** @internal */
	entryTypes: Map<string, ContentEntryType>;
}

Frequently Asked Questions

What is the LoaderContext type?
LoaderContext is a type/interface in the astro codebase, defined in packages/astro/src/content/loaders/types.ts.
Where is LoaderContext defined?
LoaderContext is defined in packages/astro/src/content/loaders/types.ts at line 29.

Analyze Your Own Codebase

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

Try Supermodel Free