Home / File/ local.ts — astro Source File

local.ts — astro Source File

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

Entity Profile

Dependency Diagram

graph LR
  58255ece_c750_2cc1_8857_7a8e6a866fc7["local.ts"]
  e92fda44_4a5d_b83b_1a45_958cdae6c91b["./definitions.js"]
  58255ece_c750_2cc1_8857_7a8e6a866fc7 --> e92fda44_4a5d_b83b_1a45_958cdae6c91b
  ea387312_d0a2_bb52_dafc_3872f7307f95["../../src/assets/fonts/types.js"]
  58255ece_c750_2cc1_8857_7a8e6a866fc7 --> ea387312_d0a2_bb52_dafc_3872f7307f95
  3955a637_4c78_0528_fe7c_92190a232cb0["node:module"]
  58255ece_c750_2cc1_8857_7a8e6a866fc7 --> 3955a637_4c78_0528_fe7c_92190a232cb0
  d9a92db9_c95e_9165_13ac_24b3d859d946["node:url"]
  58255ece_c750_2cc1_8857_7a8e6a866fc7 --> d9a92db9_c95e_9165_13ac_24b3d859d946
  07866fa4_1b50_10c2_1b6b_5b1f385406b5["unifont"]
  58255ece_c750_2cc1_8857_7a8e6a866fc7 --> 07866fa4_1b50_10c2_1b6b_5b1f385406b5
  style 58255ece_c750_2cc1_8857_7a8e6a866fc7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { createRequire } from 'node:module';
import { fileURLToPath, pathToFileURL } from 'node:url';
import type * as unifont from 'unifont';
import type { FontFileReader } from '../definitions.js';
import type {
	FamilyProperties,
	FontProvider,
	FontProviderInitContext,
	ResolveFontOptions,
	Style,
	Weight,
} from '../types.js';

interface NormalizedSource {
	url: string;
	tech: string | undefined;
}

type RawSource =
	| string
	| URL
	| {
			url: string | URL;
			tech?: string | undefined;
	  };

interface Variant extends FamilyProperties {
	/**
	 * Font [sources](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src). It can be a path relative to the root, a package import or a URL. URLs are particularly useful if you inject local fonts through an integration.
	 *
	 * We recommend not putting your font files in [the `public/` directory](/en/reference/configuration-reference/#publicdir). Since Astro will copy these files into that folder at build time, this will result in duplicated files
	 * in your build output. Instead, store them somewhere else in your project, such as in `src/`.
	 *
	 * You can also specify a [tech](https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#tech) by providing objects:
	 *
	 * ```js
	 * src: [{ url:"./src/assets/fonts/MyFont.woff2", tech: "color-COLRv1" }]
	 * ```
	 */
	src: [RawSource, ...Array<RawSource>];
	/**
	 * A [font weight](https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight). If the associated font is a [variable font](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_fonts/Variable_fonts_guide), you can specify a range of weights:
	 *
	 * ```js
	 * weight: "100 900"
	 * ```
	 *
	 * When the value is not set, by default Astro will try to infer the value based on the first source.
	 */
	weight?: Weight | undefined;
	/**
	 * A [font style](https://developer.mozilla.org/en-US/docs/Web/CSS/font-style).
	 *
	 * When the value is not set, by default Astro will try to infer the value based on the first source.
	 */
	style?: Style | undefined;
}

export interface LocalFamilyOptions {
	/**
// ... (88 more lines)

Domain

Subdomains

Dependencies

  • ../../src/assets/fonts/types.js
  • ./definitions.js
  • node:module
  • node:url
  • unifont

Frequently Asked Questions

What does local.ts do?
local.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What does local.ts depend on?
local.ts imports 5 module(s): ../../src/assets/fonts/types.js, ./definitions.js, node:module, node:url, unifont.
Where is local.ts in the architecture?
local.ts is located at packages/astro/src/assets/fonts/providers/local.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/assets/fonts/providers).

Analyze Your Own Codebase

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

Try Supermodel Free