Home / Function/ constructor() — astro Function Reference

constructor() — astro Function Reference

Architecture documentation for the constructor() function in frontmatter.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  4a7bd5b9_a468_adcb_6659_d09e3dcf1701["constructor()"]
  448e349c_6c7a_24b8_080c_eb7a40d94536["FrontmatterHolder"]
  4a7bd5b9_a468_adcb_6659_d09e3dcf1701 -->|defined in| 448e349c_6c7a_24b8_080c_eb7a40d94536
  style 4a7bd5b9_a468_adcb_6659_d09e3dcf1701 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/language-tools/ts-plugin/src/frontmatter.ts lines 91–126

	constructor(
		public fileName: string,
		public languageId: string,
		public snapshot: ts.IScriptSnapshot,
		public collection: string | undefined,
	) {
		this.mappings = [
			{
				sourceOffsets: [0],
				generatedOffsets: [0],
				lengths: [this.snapshot.getLength()],
				data: {
					verification: true,
					completion: true,
					semantic: true,
					navigation: true,
					structure: true,
					format: true,
				},
			},
		];

		this.embeddedCodes = [];
		this.snapshot = snapshot;

		if (!this.collection) return;

		const frontmatterContent = frontmatterRE.exec(
			this.snapshot.getText(0, this.snapshot.getLength()),
		)?.[0];

		if (!frontmatterContent) return;

		const yaml2tsResult = yaml2ts(frontmatterContent, this.collection);
		this.embeddedCodes.push(yaml2tsResult.virtualCode);
	}

Domain

Subdomains

Frequently Asked Questions

What does constructor() do?
constructor() is a function in the astro codebase, defined in packages/language-tools/ts-plugin/src/frontmatter.ts.
Where is constructor() defined?
constructor() is defined in packages/language-tools/ts-plugin/src/frontmatter.ts at line 91.

Analyze Your Own Codebase

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

Try Supermodel Free