frontmatterHolders.ts — astro Source File
Architecture documentation for frontmatterHolders.ts, a typescript file in the astro codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR f60cb650_8357_a1b3_0ec1_4fa2349de8ca["frontmatterHolders.ts"] 72d62155_7ca7_47f8_5bc1_b16efdc23a61["yaml2ts"] f60cb650_8357_a1b3_0ec1_4fa2349de8ca --> 72d62155_7ca7_47f8_5bc1_b16efdc23a61 040ca79b_dadf_4383_efd2_c0b13744e9f1["language-core"] f60cb650_8357_a1b3_0ec1_4fa2349de8ca --> 040ca79b_dadf_4383_efd2_c0b13744e9f1 41525615_7e06_b0e8_f601_674c57b118ee["typescript"] f60cb650_8357_a1b3_0ec1_4fa2349de8ca --> 41525615_7e06_b0e8_f601_674c57b118ee abeb339e_cdba_0d7f_6b7f_3696c1eb86f9["vscode-uri"] f60cb650_8357_a1b3_0ec1_4fa2349de8ca --> abeb339e_cdba_0d7f_6b7f_3696c1eb86f9 style f60cb650_8357_a1b3_0ec1_4fa2349de8ca fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import { VIRTUAL_CODE_ID, yaml2ts } from '@astrojs/yaml2ts';
import {
type CodeMapping,
forEachEmbeddedCode,
type LanguagePlugin,
type VirtualCode,
} from '@volar/language-core';
import type ts from 'typescript';
import type { URI } from 'vscode-uri';
export const SUPPORTED_FRONTMATTER_EXTENSIONS = { md: 'markdown', mdx: 'mdx', mdoc: 'markdoc' };
export const SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS = Object.keys(SUPPORTED_FRONTMATTER_EXTENSIONS);
const SUPPORTED_FRONTMATTER_EXTENSIONS_VALUES = Object.values(SUPPORTED_FRONTMATTER_EXTENSIONS);
export const frontmatterRE = /^---(.*?)^---/ms;
export type CollectionConfig = {
reload: (folders: { uri: string }[]) => void;
configs: {
folder: URI;
config: CollectionConfigInstance;
}[];
};
export type CollectionConfigInstance = {
collections: {
hasSchema: boolean;
name: string;
}[];
entries: Record<string, string>;
};
function getCollectionName(collectionConfig: CollectionConfig, fileURI: string) {
for (const collection of collectionConfig.configs) {
if (collection.config.entries[fileURI]) {
return collection.config.entries[fileURI];
}
}
}
export function getFrontmatterLanguagePlugin(
collectionConfig: CollectionConfig,
): LanguagePlugin<URI, FrontmatterHolder> {
return {
getLanguageId(scriptId) {
const fileType = SUPPORTED_FRONTMATTER_EXTENSIONS_KEYS.find((ext) =>
scriptId.path.endsWith(`.${ext}`),
);
if (fileType) {
return SUPPORTED_FRONTMATTER_EXTENSIONS[
fileType as keyof typeof SUPPORTED_FRONTMATTER_EXTENSIONS
];
}
},
createVirtualCode(scriptId, languageId, snapshot) {
if (SUPPORTED_FRONTMATTER_EXTENSIONS_VALUES.includes(languageId)) {
return new FrontmatterHolder(
scriptId.fsPath.replace(/\\/g, '/'),
languageId,
// ... (107 more lines)
Domain
Subdomains
Classes
Dependencies
- language-core
- typescript
- vscode-uri
- yaml2ts
Source
Frequently Asked Questions
What does frontmatterHolders.ts do?
frontmatterHolders.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 frontmatterHolders.ts?
frontmatterHolders.ts defines 3 function(s): folders, getCollectionName, getFrontmatterLanguagePlugin.
What does frontmatterHolders.ts depend on?
frontmatterHolders.ts imports 4 module(s): language-core, typescript, vscode-uri, yaml2ts.
Where is frontmatterHolders.ts in the architecture?
frontmatterHolders.ts is located at packages/language-tools/language-server/src/core/frontmatterHolders.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/language-tools/language-server/src/core).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free