Home / Class/ FsFontFileContentResolver Class — astro Architecture

FsFontFileContentResolver Class — astro Architecture

Architecture documentation for the FsFontFileContentResolver class in fs-font-file-content-resolver.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  ef761255_239d_91c8_3761_4414b91dab35["FsFontFileContentResolver"]
  07700b7b_8319_7286_5f38_52c3c69d06d9["fs-font-file-content-resolver.ts"]
  ef761255_239d_91c8_3761_4414b91dab35 -->|defined in| 07700b7b_8319_7286_5f38_52c3c69d06d9
  9c00eddd_9c20_93b2_c038_c88f8a81dae8["constructor()"]
  ef761255_239d_91c8_3761_4414b91dab35 -->|method| 9c00eddd_9c20_93b2_c038_c88f8a81dae8
  a5018a94_0b25_dd70_82d7_09add5f7fea0["resolve()"]
  ef761255_239d_91c8_3761_4414b91dab35 -->|method| a5018a94_0b25_dd70_82d7_09add5f7fea0

Relationship Graph

Source Code

packages/astro/src/assets/fonts/infra/fs-font-file-content-resolver.ts lines 7–28

export class FsFontFileContentResolver implements FontFileContentResolver {
	#readFileSync: ReadFileSync;

	constructor({ readFileSync }: { readFileSync: ReadFileSync }) {
		this.#readFileSync = readFileSync;
	}

	resolve(url: string): string {
		if (!isAbsolute(url)) {
			// HTTP URLs are enough
			return url;
		}
		try {
			// We use the url and the file content for the id generation because:
			// - The URL is not hashed unlike remote providers
			// - A font file can renamed and swapped so we would incorrectly cache it
			return url + this.#readFileSync(url);
		} catch (cause) {
			throw new AstroError(AstroErrorData.UnknownFilesystemError, { cause });
		}
	}
}

Domain

Frequently Asked Questions

What is the FsFontFileContentResolver class?
FsFontFileContentResolver is a class in the astro codebase, defined in packages/astro/src/assets/fonts/infra/fs-font-file-content-resolver.ts.
Where is FsFontFileContentResolver defined?
FsFontFileContentResolver is defined in packages/astro/src/assets/fonts/infra/fs-font-file-content-resolver.ts at line 7.

Analyze Your Own Codebase

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

Try Supermodel Free