data-store.ts — astro Source File
Architecture documentation for data-store.ts, a typescript file in the astro codebase. 2 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR dabf6768_9542_21ce_e4c4_299b1540a491["data-store.ts"] 82f345a2_2234_43f1_c3c4_eea191acdca8["markdown-remark"] dabf6768_9542_21ce_e4c4_299b1540a491 --> 82f345a2_2234_43f1_c3c4_eea191acdca8 ca52ff61_c81f_c2ca_81b6_5a678b65fd31["devalue"] dabf6768_9542_21ce_e4c4_299b1540a491 --> ca52ff61_c81f_c2ca_81b6_5a678b65fd31 style dabf6768_9542_21ce_e4c4_299b1540a491 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { MarkdownHeading } from '@astrojs/markdown-remark';
import * as devalue from 'devalue';
export interface RenderedContent {
/** Rendered HTML string. If present then `render(entry)` will return a component that renders this HTML. */
html: string;
metadata?: {
/** Any images that are present in this entry. Relative to the {@link DataEntry} filePath. */
imagePaths?: Array<string>;
/** Any headings that are present in this file. */
headings?: MarkdownHeading[];
/** Raw frontmatter, parsed parsed from the file. This may include data from remark plugins. */
frontmatter?: Record<string, any>;
/** Any other metadata that is present in this file. */
[key: string]: unknown;
};
}
export interface DataEntry<TData extends Record<string, unknown> = Record<string, unknown>> {
/** The ID of the entry. Unique per collection. */
id: string;
/** The parsed entry data */
data: TData;
/** The file path of the content, if applicable. Relative to the site root. */
filePath?: string;
/** The raw body of the content, if applicable. */
body?: string;
/** An optional content digest, to check if the content has changed. */
digest?: number | string;
/** The rendered content of the entry, if applicable. */
rendered?: RenderedContent;
/**
* If an entry is a deferred, its rendering phase is delegated to a virtual module during the runtime phase when calling `renderEntry`.
*/
deferredRender?: boolean;
assetImports?: Array<string>;
}
/**
* A read-only data store for content collections. This is used to retrieve data from the content layer at runtime.
* To add or modify data, use {@link MutableDataStore} instead.
*/
export class ImmutableDataStore {
protected _collections = new Map<string, Map<string, any>>();
constructor() {
this._collections = new Map();
}
get<T = DataEntry>(collectionName: string, key: string): T | undefined {
return this._collections.get(collectionName)?.get(String(key));
}
entries<T = DataEntry>(collectionName: string): Array<[id: string, T]> {
const collection = this._collections.get(collectionName) ?? new Map();
return [...collection.entries()];
}
values<T = DataEntry>(collectionName: string): Array<T> {
// ... (67 more lines)
Domain
Subdomains
Functions
Classes
Types
Dependencies
- devalue
- markdown-remark
Source
Frequently Asked Questions
What does data-store.ts do?
data-store.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 data-store.ts?
data-store.ts defines 1 function(s): dataStoreSingleton.
What does data-store.ts depend on?
data-store.ts imports 2 module(s): devalue, markdown-remark.
Where is data-store.ts in the architecture?
data-store.ts is located at packages/astro/src/content/data-store.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