/** * What `docs_uses` reads for a name: every declaration of it, each another * thing, chosen once by the `file` an asker names, and the sites of each one. * * The Help value holds the imports that cross a package; the rest are read * off the source index, out of the file that declares the name. The index * follows each `export … from` that passes it on, so an import through a * barrel is listed and the barrel is not, and a same-named export of another * file is another declaration, whose sites are read and kept apart. */ import type { Spelling } from '@variance-authority/mcp/tools'; import type { Documented, Entry, Help, Named, Opening, Use } from '@variance-authority/package/help'; import type { DeclaredName } from '@variance-authority/sense'; import { type Members } from './members.js'; import { type IndexedUse } from './unpublished.js'; /** * A site, how it names the module it imports when that is a file path, the * name it takes when that is known, and the lines of its file that use what * its import binds, when the source index read them. */ export type Site = Use & { readonly how?: string; readonly name?: string; readonly lines?: readonly number[]; }; /** * The sites that import a name, and the ones that may read it and are no use * of it: a read off the module's `default`, which holds the name only when the * module is CommonJS, and the module passed on whole, where the reading does * not follow it. Only `certain` is counted as places that import the name. */ export declare function sureness(sites: readonly Site[]): { readonly certain: readonly Site[]; readonly off: readonly Site[]; readonly whole: readonly Site[]; }; type Published = readonly [Documented, Opening, Entry]; /** * One published declaration: the binding a file declares, by its file and its * declared name, and every entry that publishes it. A barrel and a subpath that * pass one declaration on are two doors to one thing; two files that declare * the name are two, and so are two bindings of one file, which an entry doing * `export { greet as salute }` beside the file's own `salute` makes. */ export interface PublishedDeclaration { readonly at: string; readonly line: number; /** The name its file exports it under, which a door may publish under another; its named one when the file exports it as `default` too. */ readonly declared: string; /** Every name its file exports it under, `declared` among them. */ readonly spellings: readonly string[]; /** The entries that publish it, the one the workspace imports it by most first. */ readonly doors: readonly Published[]; } /** * Every published declaration of a name, by the name an entry publishes or the * name the declaring file exports it under, from the package asked for when * one was, the one whose leading door the workspace imports most first. The * package stage carries which declaration each entry reaches, so nothing here * walks the exports again. Equal counts fall to the published name and subpath * by code unit, then to the declaring file, so the order never follows the * order directories were read in. */ export declare function publishedDeclarations(help: Help, root: string | undefined, name: string, wanted: string | undefined): readonly PublishedDeclaration[]; /** * One declaration beside the one answered first: the entries that publish it, * or the exports that reach it when none does, the package it is declared in, * and the sites of it. */ export interface Namesake { /** The declaration the entries publish, when one does. */ readonly declaration: PublishedDeclaration | undefined; readonly exported: readonly Named[]; readonly home: string | undefined; readonly sites: readonly Site[]; readonly inFile: readonly Use[]; } /** * Every file that makes a declaration published, for the look at an answer that * teaches it: each entry opening it, and each barrel passing it on by the walk * {@link sitesOfPublished} makes for that answer. */ export declare function publishingFiles(help: Help, root: string | undefined, published: readonly PublishedDeclaration[]): readonly string[]; /** * The sites of the published declaration of `name` in `at`, the ones `uses` * lists when asked for that name and that file, and why the source index did * not read the imports within its package, when it did not, with the files * that publish it. The row's door, `name` imported from `specifier`, picks the * declaration: two bindings of one file published under one name by two entries * are two rows. */ export declare function publishedSitesOf(help: Help, root: string | undefined, name: string, at: string, specifier: string): { readonly sites: readonly Site[]; readonly publishing: readonly string[]; readonly unread?: string; }; /** The package a file is in, as the place `by` names it; none for a file no manifest holds, which `by` names as empty. */ export declare function packageOf(by: string | undefined): string | undefined; /** * Every site of the name for the declaration asked about, and each other * declaration's apart, and what was read to find them, or the refusal. * `declaration`, one published declaration, answers for that one alone, which * `file` cannot when its file declares two bindings an entry publishes. */ export declare function usesOf(help: Help, input: Readonly>, root: string | undefined, spell: Spelling, declaration?: PublishedDeclaration): { name: string; lead: PublishedDeclaration | undefined; found: readonly Published[]; exported: readonly Named[]; namesakes: readonly Namesake[]; byPath: readonly Site[]; members: Members; kept: readonly DeclaredName[]; keptSites: readonly IndexedUse[]; keptInFile: readonly Use[]; file: string | undefined; files: string[]; home: string | undefined; sites: readonly Site[]; unread: string | undefined; within: IndexedUse[] | undefined; inFile: readonly Use[]; undeclared: readonly string[]; origin: import("@variance-authority/sense").ExportedDeclaration | undefined; originNamed: string | undefined; inside: readonly string[]; }; /** What `docs_uses` read for one question. */ export type Answer = ReturnType; export {}; //# sourceMappingURL=uses-of.d.ts.map