Home / File/ check.ts — astro Source File

check.ts — astro Source File

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

File typescript CoreAstro CoreMiddleware 14 imports 1 classes

Entity Profile

Dependency Diagram

graph LR
  cc9095c8_1b43_06ff_72e4_ee83e980957f["check.ts"]
  38342bd4_11df_7a37_2e70_333185fe2db2["../../core/index.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 38342bd4_11df_7a37_2e70_333185fe2db2
  22ba4b0b_4bbc_2d12_698a_6fa06c26f2f4["./core/svelte.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 22ba4b0b_4bbc_2d12_698a_6fa06c26f2f4
  65f2080d_0c1a_6e67_4a38_2f8aa458fd74["./core/vue.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 65f2080d_0c1a_6e67_4a38_2f8aa458fd74
  94d3f901_415d_ea74_abf3_1cb83a4afb5b["./plugins/astro.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 94d3f901_415d_ea74_abf3_1cb83a4afb5b
  3cc02992_202a_e698_7c76_4d5f1911d414["./plugins/typescript/index.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 3cc02992_202a_e698_7c76_4d5f1911d414
  fcea7c61_8834_bcc8_0062_ff8308eb913e["./utils.js"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> fcea7c61_8834_bcc8_0062_ff8308eb913e
  e16a223b_37f3_6b25_1ee1_2b7bcb9d9415["node:fs"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> e16a223b_37f3_6b25_1ee1_2b7bcb9d9415
  b326953c_dc9d_ec9e_dc34_4beead549f6e["node:os"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> b326953c_dc9d_ec9e_dc34_4beead549f6e
  c52a5f83_66e3_37d7_9ebb_767f7129bc62["node:path"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> c52a5f83_66e3_37d7_9ebb_767f7129bc62
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> d9a92db9_c95e_9165_13ac_24b3d859d946
  33a89a42_e257_7d7c_5ccb_1a8818d772c1["kit"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 33a89a42_e257_7d7c_5ccb_1a8818d772c1
  6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56["language-server"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> 6857b6b2_4d48_bfb0_0a0e_8e2e52fabb56
  e64464d4_88a4_c7e2_f90f_758b06231bbe["tinyglobby"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> e64464d4_88a4_c7e2_f90f_758b06231bbe
  abeb339e_cdba_0d7f_6b7f_3696c1eb86f9["vscode-uri"]
  cc9095c8_1b43_06ff_72e4_ee83e980957f --> abeb339e_cdba_0d7f_6b7f_3696c1eb86f9
  style cc9095c8_1b43_06ff_72e4_ee83e980957f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { existsSync } from 'node:fs';
import { homedir } from 'node:os';
import { resolve } from 'node:path';
import { pathToFileURL } from 'node:url';
import * as kit from '@volar/kit';
import { Diagnostic, DiagnosticSeverity } from '@volar/language-server';
import { globSync } from 'tinyglobby';
import { URI } from 'vscode-uri';
import { addAstroTypes, getAstroLanguagePlugin } from './core/index.js';
import { getSvelteLanguagePlugin } from './core/svelte.js';
import { getVueLanguagePlugin } from './core/vue.js';
import { create as createAstroService } from './plugins/astro.js';
import { create as createTypeScriptServices } from './plugins/typescript/index.js';
import { getAstroInstall } from './utils.js';

// Export those for downstream consumers
export { Diagnostic, DiagnosticSeverity };

export interface CheckResult {
	status: 'completed' | 'cancelled' | undefined;
	fileChecked: number;
	errors: number;
	warnings: number;
	hints: number;
	fileResult: {
		errors: kit.Diagnostic[];
		fileUrl: URL;
		fileContent: string;
		text: string;
	}[];
}

export class AstroCheck {
	private ts!: typeof import('typescript');
	public linter!: ReturnType<(typeof kit)['createTypeScriptChecker']>;

	constructor(
		private readonly workspacePath: string,
		private readonly typescriptPath: string | undefined,
		private readonly tsconfigPath: string | undefined,
	) {
		this.initialize();
	}

	/**
	 * Lint a list of files or the entire project and optionally log the errors found
	 * @param fileNames List of files to lint, if undefined, all files included in the project will be linted
	 * @param logErrors Whether to log errors by itself. This is disabled by default.
	 * @return {CheckResult} The result of the lint, including a list of errors, the file's content and its file path.
	 */
	public async lint({
		fileNames = undefined,
		cancel = () => false,
		logErrors = undefined,
	}: {
		fileNames?: string[] | undefined;
		cancel?: () => boolean;
		logErrors?:
			| {
					level: 'error' | 'warning' | 'hint';
// ... (150 more lines)

Domain

Subdomains

Classes

Types

Dependencies

  • ../../core/index.js
  • ./core/svelte.js
  • ./core/vue.js
  • ./plugins/astro.js
  • ./plugins/typescript/index.js
  • ./utils.js
  • kit
  • language-server
  • node:fs
  • node:os
  • node:path
  • node:url
  • tinyglobby
  • vscode-uri

Frequently Asked Questions

What does check.ts do?
check.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What does check.ts depend on?
check.ts imports 14 module(s): ../../core/index.js, ./core/svelte.js, ./core/vue.js, ./plugins/astro.js, ./plugins/typescript/index.js, ./utils.js, kit, language-server, and 6 more.
Where is check.ts in the architecture?
check.ts is located at packages/language-tools/language-server/src/check.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/language-tools/language-server/src).

Analyze Your Own Codebase

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

Try Supermodel Free