/** * Network discovery of a Google-Fonts family's variants. Wraps the neutral * fetch/parse/ladder with the font-domain error mapping: a transport-level * `FETCH_FAILED` becomes `FONT_FAILED` with the right `reason` so callers can * tell "this font doesn't exist" (`not-found`) from "network is down" * (`fetch-failed`/`timeout`). Concurrent requests for the same family dedupe; * a `not-found` result is negatively cached (deterministic), a transient * failure is not (so a later attempt can succeed). */ import { type ByteCache } from './fetch.js'; import { type GoogleFontFaces } from './google-fonts.js'; export interface DiscoverOptions { /** Request an exact numeric face, with the family stylesheet as fallback. */ variant?: { weight: number; italic: boolean; }; /** * Shape the SHARED per-family load (byte cache, retry count/pacing). The * load is created once per family, by whichever caller gets there first — * later concurrent callers await the same load with their own signal/timeout. */ cache?: ByteCache; retries?: number; baseDelayMs?: number; /** * Abort THIS caller's wait. The shared load keeps running for other * callers (and to settle the cache) — an aborted caller must never poison * the family for everyone else. */ signal?: AbortSignal; /** * Bound THIS caller's total wait in ms (rejects with `FONT_FAILED/timeout`). * The shared load itself uses the default per-attempt network timeout. */ timeout?: number; } /** * Resolve a family's Google-Fonts variants, deduped and cached. Throws a * `FONT_FAILED` on failure; a `not-found` is remembered so we don't re-hit * Google for a family we already know it lacks, while transient failures are * dropped so a later call retries from scratch. */ export declare function fetchGoogleFontFaces(family: string, opts?: DiscoverOptions): Promise; /** Test/reset hook — clears the in-process faces cache. */ export declare function _clearFacesCache(): void;