/** * Which declaration an export is, and the name it is keyed by. * * A declaration is the file that declares it and the name that file exports * it under. `export default greet` beside `export { greet }` is one * declaration, `greet`, and `default` is a slot every module has, not a name: * it keys a declaration only when nothing names it. A named default, * `export default function Badge`, is keyed by the name it binds; an anonymous * one by the local name of the import nearest its file, else by the nearest * export that passes it on under a name. * * The package stage carries what each export binds in its own file, so a key * is computed from that file's rows; only an anonymous default and an export that passes * another file's declaration on read the source index, once each per `Help`. */ import type { Help, Named } from '@variance-authority/package/help'; import { type ExportedDeclaration } from '@variance-authority/sense'; /** The name a default export is published under, which names nothing. */ export declare const SLOT = "default"; /** Whether `spelling`, a name something is exported or imported under, says `name`: the slot says no name, not even its own. */ export declare const says: (spelling: string, name: string) => boolean; /** One declaration: where it is declared, the name it is keyed by, and every name its file exports it under, in code units. */ export interface Key { readonly at: string; readonly named: string; readonly spellings: readonly string[]; } /** * The declaration `held` exports. One its own file binds is keyed there; one * that passes another file's on is the declaring file's export of the same * binding, under `held`'s name alone. Without a source index such an export * is keyed where it is written. */ export declare function keyOf(help: Help, root: string | undefined, held: Pick): Key; /** The key of `origin`, a declaration the source index walked to: its declaring file's export of the same binding. */ export declare function originKey(help: Help, root: string | undefined, origin: ExportedDeclaration): Key; /** * Whether `held` answers to `name`: it is exported under it, or the binding * its own file exports is keyed by it or exported under it too, or, for an * anonymous default, an import of it binds `name`. An export that * passes another file's declaration on answers only to its own name, and the * slot to defaults nothing names; asked by the slot, every default reads its * key. */ export declare function answers(help: Help, root: string | undefined, held: Pick, name: string): boolean; /** * Every export that answers to `name`, in the order the export list holds * them. An export answers by its own name, by a name its file exports the * same binding under, by the name its file binds a default nothing else names * as, or, for an anonymous default, by a local name an import gives it: so the * rows that can answer are the ones written under the name, the other rows of * their files, the rows bound as the name, and the rows of the files an import * of `default` bound to the name reaches. Asked by the slot, the defaults and * the rows bound as it. */ export declare function answering(help: Help, root: string | undefined, name: string): readonly Named[]; /** * The declaration `held` binds: its file's own, or the one it passes on * through every file that passes it on. None when the walk ends short of a * declaration, when no checkout is named, and when the index is not published * or does not read, which the imports of the same answer already say. */ export declare function boundOf(root: string | undefined, held: Pick): ExportedDeclaration | undefined; /** The declaration `held` passes on from another file, as the source index walks to it; none when its own file declares it or the index does not read. */ export declare function originOf(help: Help, root: string | undefined, held: Pick): ExportedDeclaration | undefined; //# sourceMappingURL=declaration-key.d.ts.map