Home / File/ types.ts — astro Source File

types.ts — astro Source File

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

File typescript CoreAstro RenderingEngine 6 imports 6 functions

Entity Profile

Dependency Diagram

graph LR
  0414cf8f_0404_f03b_316f_0d732aa66968["types.ts"]
  f9135b22_844a_994a_36b6_f2bdc2b16857["../../src/assets/fonts/config.js"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> f9135b22_844a_994a_36b6_f2bdc2b16857
  a2fc192c_cdf9_df62_81bf_9c18a80b317e["./fonts/constants.js"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> a2fc192c_cdf9_df62_81bf_9c18a80b317e
  2f3de45d_9993_acba_acd0_40014d5fbc2e["./core/optimize-fallbacks.js"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> 2f3de45d_9993_acba_acd0_40014d5fbc2e
  ef055097_16b3_7136_fbaf_9392f06fd4dc["unpack"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> ef055097_16b3_7136_fbaf_9392f06fd4dc
  07866fa4_1b50_10c2_1b6b_5b1f385406b5["unifont"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> 07866fa4_1b50_10c2_1b6b_5b1f385406b5
  f8c9251e_f535_6281_2118_9e79a4155212["v4"]
  0414cf8f_0404_f03b_316f_0d732aa66968 --> f8c9251e_f535_6281_2118_9e79a4155212
  style 0414cf8f_0404_f03b_316f_0d732aa66968 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import type { Font } from '@capsizecss/unpack';
import type * as unifont from 'unifont';
import type * as z from 'zod/v4';
import type { DisplaySchema, StyleSchema, WeightSchema } from './config.js';
import type { FONT_TYPES, GENERIC_FALLBACK_NAMES } from './constants.js';
import type { CollectedFontForMetrics } from './core/optimize-fallbacks.js';

export type Weight = z.infer<typeof WeightSchema>;
type Display = z.infer<typeof DisplaySchema>;

export interface FontProviderInitContext {
	/**
	 * Useful for caching.
	 */
	storage: {
		getItem: {
			<T = unknown>(key: string): Promise<T | null>;
			<T = unknown>(key: string, init: () => Awaitable<T>): Promise<T>;
		};
		setItem: (key: string, value: unknown) => Awaitable<void>;
	};
	/**
	 * The project root, useful for resolving local files paths.
	 */
	root: URL;
}

type Awaitable<T> = T | Promise<T>;

export interface FontProvider<
	TFamilyOptions extends Record<string, any> | undefined | never = never,
> {
	/**
	 * A unique name for the provider, used in logs and for identification.
	 */
	name: string;
	/**
	 * A serializable object, used for identification.
	 */
	config?: Record<string, any> | undefined;
	/**
	 * Optional callback, used to perform any initialization logic.
	 */
	init?: ((context: FontProviderInitContext) => Awaitable<void>) | undefined;
	/**
	 * Used to retrieve and return font face data based on the given options.
	 */
	resolveFont: (options: ResolveFontOptions<TFamilyOptions>) => Awaitable<
		| {
				fonts: Array<unifont.FontFaceData>;
		  }
		| undefined
	>;
	/**
	 * Optional callback, used to return the list of available font names.
	 */
	listFonts?: (() => Awaitable<Array<string> | undefined>) | undefined;
}

export interface FamilyProperties {
// ... (230 more lines)

Domain

Subdomains

Dependencies

  • ../../src/assets/fonts/config.js
  • ./core/optimize-fallbacks.js
  • ./fonts/constants.js
  • unifont
  • unpack
  • v4

Frequently Asked Questions

What does types.ts do?
types.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 types.ts?
types.ts defines 6 function(s): Awaitable, context, input, key, options, params.
What does types.ts depend on?
types.ts imports 6 module(s): ../../src/assets/fonts/config.js, ./core/optimize-fallbacks.js, ./fonts/constants.js, unifont, unpack, v4.
Where is types.ts in the architecture?
types.ts is located at packages/astro/src/assets/fonts/types.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