Home / Function/ initialize() — astro Function Reference

initialize() — astro Function Reference

Architecture documentation for the initialize() function in check.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  eadf2b20_d224_261e_a1fd_53fce5489201["initialize()"]
  97a48377_0e57_a94f_8ce7_cd934868bb42["AstroCheck"]
  eadf2b20_d224_261e_a1fd_53fce5489201 -->|defined in| 97a48377_0e57_a94f_8ce7_cd934868bb42
  b1b7a70f_131e_f0a4_b6f7_7c5e60f6d363["constructor()"]
  b1b7a70f_131e_f0a4_b6f7_7c5e60f6d363 -->|calls| eadf2b20_d224_261e_a1fd_53fce5489201
  055b217e_dcda_35ec_58e0_9733f092ce96["getTsconfig()"]
  eadf2b20_d224_261e_a1fd_53fce5489201 -->|calls| 055b217e_dcda_35ec_58e0_9733f092ce96
  style eadf2b20_d224_261e_a1fd_53fce5489201 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/language-tools/language-server/src/check.ts lines 135–190

	private initialize() {
		this.ts = this.typescriptPath ? require(this.typescriptPath) : require('typescript');
		const tsconfigPath = this.getTsconfig();

		const languagePlugins = [
			getAstroLanguagePlugin(),
			getSvelteLanguagePlugin(),
			getVueLanguagePlugin(),
		];
		const services = [...createTypeScriptServices(this.ts), createAstroService()];

		if (tsconfigPath) {
			const includeProjectReference = false; // #920
			this.linter = kit.createTypeScriptChecker(
				languagePlugins,
				services,
				tsconfigPath,
				includeProjectReference,
				({ project }) => {
					const { languageServiceHost } = project.typescript!;
					const astroInstall = getAstroInstall([this.workspacePath]);

					addAstroTypes(
						typeof astroInstall === 'string' ? undefined : astroInstall,
						this.ts,
						languageServiceHost,
					);
				},
			);
		} else {
			this.linter = kit.createTypeScriptInferredChecker(
				languagePlugins,
				services,
				() => {
					return globSync('**/*.astro', {
						cwd: this.workspacePath,
						ignore: ['node_modules'],
						absolute: true,
						// Required to avoid tinyglobby running eternally
						expandDirectories: false,
					});
				},
				undefined,
				({ project }) => {
					const { languageServiceHost } = project.typescript!;
					const astroInstall = getAstroInstall([this.workspacePath]);

					addAstroTypes(
						typeof astroInstall === 'string' ? undefined : astroInstall,
						this.ts,
						languageServiceHost,
					);
				},
			);
		}
	}

Domain

Subdomains

Called By

Frequently Asked Questions

What does initialize() do?
initialize() is a function in the astro codebase, defined in packages/language-tools/language-server/src/check.ts.
Where is initialize() defined?
initialize() is defined in packages/language-tools/language-server/src/check.ts at line 135.
What does initialize() call?
initialize() calls 1 function(s): getTsconfig.
What calls initialize()?
initialize() is called by 1 function(s): constructor.

Analyze Your Own Codebase

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

Try Supermodel Free