/** * On-demand README retrieval for the detail panel. * * READMEs are not published into the catalog. At roughly 8 KB apiece, 1984 of * them would add ~16 MB to a document the browser parses every time the * marketplace opens — and the text would be as stale as the last crawl. They * are fetched per entry instead, straight from the repository's default * branch. * * The target URL is always derived from `owner/repo` as it appears in the * host's own catalog. Nothing about the request comes from the browser except * an entry id, so this route cannot be pointed at an arbitrary host. */ /** What a lookup produced. */ export interface ReadmeResult { readonly markdown: string; readonly sourceUrl?: string; readonly message?: string; } /** * Whether `owner/repo` is shaped the way GitHub spells it. * * The value comes from the host's own catalog rather than the browser, but it * is interpolated into a URL, so it is checked anyway: a catalog is a file on * disk, and a file on disk can be edited. * @param repo - the `owner/repo` string. * @returns true when safe to interpolate. */ export declare function isSafeRepo(repo: string): boolean; /** Fetches and caches repository READMEs. */ export declare class ReadmeStore { private readonly warn; private readonly cache; constructor(warn: (line: string) => void); /** * Get a repository's README, from cache when it is fresh. * @param repo - `owner/repo` as spelled by GitHub. * @returns the Markdown, or a message explaining why there is none. */ get(repo: string): Promise; /** * Try each candidate filename until one returns content. * * `HEAD` resolves to whatever the default branch is, so neither the branch * name nor a redirect needs to be discovered first. * @param repo - `owner/repo`. * @returns the first README found, or undefined. */ private fetchFirst; /** * Store a README, evicting the oldest entry when full. * @param repo - the cache key. * @param row - the fetched content. */ private remember; }