Home / File/ index.ts — astro Source File

index.ts — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  ca1e0273_5b18_284e_2292_2a514a6b83bb["index.ts"]
  f005b2a8_916f_d678_bc89_e6dd00e1b427["./frontmatter.js"]
  ca1e0273_5b18_284e_2292_2a514a6b83bb --> f005b2a8_916f_d678_bc89_e6dd00e1b427
  5615987f_e3e8_1b0a_855e_2589e7b2d1d5["./language.js"]
  ca1e0273_5b18_284e_2292_2a514a6b83bb --> 5615987f_e3e8_1b0a_855e_2589e7b2d1d5
  040ca79b_dadf_4383_efd2_c0b13744e9f1["language-core"]
  ca1e0273_5b18_284e_2292_2a514a6b83bb --> 040ca79b_dadf_4383_efd2_c0b13744e9f1
  9a56281a_a938_13f7_5f90_f34aa72a5593["createLanguageServicePlugin.js"]
  ca1e0273_5b18_284e_2292_2a514a6b83bb --> 9a56281a_a938_13f7_5f90_f34aa72a5593
  style ca1e0273_5b18_284e_2292_2a514a6b83bb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { LanguagePlugin } from '@volar/language-core';
import { createLanguageServicePlugin } from '@volar/typescript/lib/quickstart/createLanguageServicePlugin.js';
import type { CollectionConfig } from './frontmatter.js';
import { getFrontmatterLanguagePlugin } from './frontmatter.js';
import { getLanguagePlugin } from './language.js';

export = createLanguageServicePlugin((ts, info) => {
	let collectionConfig = undefined;

	try {
		const currentDir = info.project.getCurrentDirectory();
		const fileContent = ts.sys.readFile(currentDir + '/.astro/collections/collections.json');
		if (fileContent) {
			collectionConfig = {
				folder: currentDir,
				config: JSON.parse(fileContent) as CollectionConfig['config'],
			};
		}
	} catch (err) {
		// If the file doesn't exist, we don't really care, but if it's something else, we want to know
		if (err && (err as any).code !== 'ENOENT') console.error(err);
	}

	let languagePlugins: LanguagePlugin<string>[] = [getLanguagePlugin()];

	if (collectionConfig) {
		languagePlugins.push(getFrontmatterLanguagePlugin([collectionConfig]));
	}

	return {
		languagePlugins,
	};
});

Domain

Dependencies

  • ./frontmatter.js
  • ./language.js
  • createLanguageServicePlugin.js
  • language-core

Frequently Asked Questions

What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain.
What does index.ts depend on?
index.ts imports 4 module(s): ./frontmatter.js, ./language.js, createLanguageServicePlugin.js, language-core.
Where is index.ts in the architecture?
index.ts is located at packages/language-tools/ts-plugin/src/index.ts (domain: CoreAstro, directory: packages/language-tools/ts-plugin/src).

Analyze Your Own Codebase

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

Try Supermodel Free