Home / File/ definitions.ts — astro Source File

definitions.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 3 imports 11 functions

Entity Profile

Dependency Diagram

graph LR
  acedbcbd_1f43_e7eb_ce1b_cea2d1105273["definitions.ts"]
  2f3de45d_9993_acba_acd0_40014d5fbc2e["./core/optimize-fallbacks.js"]
  acedbcbd_1f43_e7eb_ce1b_cea2d1105273 --> 2f3de45d_9993_acba_acd0_40014d5fbc2e
  ea387312_d0a2_bb52_dafc_3872f7307f95["../../src/assets/fonts/types.js"]
  acedbcbd_1f43_e7eb_ce1b_cea2d1105273 --> ea387312_d0a2_bb52_dafc_3872f7307f95
  07866fa4_1b50_10c2_1b6b_5b1f385406b5["unifont"]
  acedbcbd_1f43_e7eb_ce1b_cea2d1105273 --> 07866fa4_1b50_10c2_1b6b_5b1f385406b5
  style acedbcbd_1f43_e7eb_ce1b_cea2d1105273 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type * as unifont from 'unifont';
import type { CollectedFontForMetrics } from './core/optimize-fallbacks.js';
import type {
	CssProperties,
	FontFaceMetrics,
	FontFileData,
	FontProvider,
	FontType,
	GenericFallbackName,
	ResolveFontOptions,
	Style,
} from './types.js';

export interface Hasher {
	hashString: (input: string) => string;
	hashObject: (input: Record<string, any>) => string;
}

export interface UrlResolver {
	resolve: (id: string) => string;
	readonly cspResources: Array<string>;
}

export interface FontFileContentResolver {
	resolve: (url: string) => string;
}

export interface CssRenderer {
	generateFontFace: (family: string, properties: CssProperties) => string;
	generateCssVariable: (key: string, values: Array<string>) => string;
}

export interface FontMetricsResolver {
	getMetrics: (name: string, font: CollectedFontForMetrics) => Promise<FontFaceMetrics>;
	generateFontFace: (input: {
		metrics: FontFaceMetrics;
		fallbackMetrics: FontFaceMetrics;
		name: string;
		font: string;
		properties: CssProperties;
	}) => string;
}

export interface SystemFallbacksProvider {
	getLocalFonts: (fallback: GenericFallbackName) => Array<string> | null;
	getMetricsForLocalFont: (family: string) => FontFaceMetrics;
}

export interface FontFetcher {
	fetch: (input: FontFileData) => Promise<Buffer>;
}

export interface FontTypeExtractor {
	extract: (url: string) => FontType;
}

export interface FontFileReader {
	extract: (input: { family: string; url: string }) => {
		weight: string;
		style: Style;
	};
}

export interface FontFileIdGenerator {
	generate: (input: {
		originalUrl: string;
		type: FontType;
		cssVariable: string;
		font: unifont.FontFaceData;
	}) => string;
}

export interface StringMatcher {
	getClosestMatch: (target: string, candidates: Array<string>) => string;
}

export interface Storage {
	getItem: (key: string) => Promise<any | null>;
	getItemRaw: (key: string) => Promise<Buffer | null>;
	setItem: (key: string, value: any) => Promise<void>;
	setItemRaw: (key: string, value: any) => Promise<void>;
}

export interface FontResolver {
	resolveFont: (
		options: ResolveFontOptions<Record<string, any>> & { provider: FontProvider },
	) => Promise<Array<unifont.FontFaceData>>;
	listFonts: (options: { provider: FontProvider }) => Promise<string[] | undefined>;
}

Domain

Subdomains

Dependencies

  • ../../src/assets/fonts/types.js
  • ./core/optimize-fallbacks.js
  • unifont

Frequently Asked Questions

What does definitions.ts do?
definitions.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in definitions.ts?
definitions.ts defines 11 function(s): FontFaceMetrics, FontType, fallback, family, id, input, key, name, options, target, and 1 more.
What does definitions.ts depend on?
definitions.ts imports 3 module(s): ../../src/assets/fonts/types.js, ./core/optimize-fallbacks.js, unifont.
Where is definitions.ts in the architecture?
definitions.ts is located at packages/astro/src/assets/fonts/definitions.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets/fonts).

Analyze Your Own Codebase

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

Try Supermodel Free