/** * Names a file declares and does not export, answered rather than refused. * * Every export list stops at what a file hands out, and a file keeps most of * what it declares to itself: the helper a function calls, the constant beside * it. A caller who typed such a name exactly is not wrong about the name, and * `git grep` would find it at once. The source index harvested every top-level * declaration of every file it parsed, and every function a function's body * declares, so the declaration is read from there, * with who can reach it, as the reader of its language recorded: an ES * module's own name, and a Swift or Kotlin `private` one, is its file's alone, * a Rust item that is not `pub` is its module's and the modules inside it, and * a Python module keeps no name from an import that spells it, and a closure is * its holder's alone. A reader that * cannot tell — a script, a `macro_rules!` — records nothing, and the answer * says that. */ import { type DeclaredName } from '@variance-authority/sense'; import type { Said } from './held-sentence.js'; import type { AliasMatch, DeclaredMatch, DeclaredRead, HeldMatch, Matches } from './search-matches.js'; import { type Spelling } from '@variance-authority/mcp/tools'; import type { Help } from '@variance-authority/package/help'; /** How many declarations of one name `symbol` writes out before it counts the rest. */ export declare const DECLARED_CAP = 5; /** What the source index says about declarations, or why it says nothing. */ export type Declarations = { readonly names: readonly DeclaredName[]; readonly unread: readonly string[]; } | { readonly refused: string; }; /** * The declarations `query` names — exactly, or held in the name given * `containing` — in `files` when they are named, read off the source index of * `root`, source first. */ export declare function declarations(root: string | undefined, query: string, options?: { readonly containing?: boolean; readonly files?: Iterable; }): Declarations; /** The declarations of exactly `name`, read once for a generation's answer and the look at it. */ export declare const declarationsNamed: (help: Help, root: string | undefined, name: string) => Declarations; /** * A declaration's signature and documentation, as the index recorded them from * the text its read saw; either is left out when the index kept none. */ export declare function textRows(held: { readonly signature?: string | null; readonly doc?: string | null; }): readonly string[]; /** * Who can reach a name its file declares and does not export, as its reader * recorded: the sentence `symbol` ends a declaration with, and the clause `uses` * ends its line with. */ export declare function reachSentences(held: Pick, spell: Spelling): { readonly block: string; readonly clause: string; }; /** One declaration, as a `search` line writes it. */ export declare function declaredLine(held: DeclaredMatch): string; /** One member or function inside a function, as a `search` line writes it, under what holds it. */ export declare function heldLine(held: HeldMatch): string; /** One import that binds the name, as a `search` line writes it. */ export declare function aliasLine(alias: AliasMatch): string; /** One import, saying the export as `named`, with its own spelling when that differs. */ export declare function importLine(alias: Pick, named: string, local: string): string; /** * The sentence that says some files' declarations were not read, and which, * or nothing when every file's were. Indexing again reads none of them: a file * is declined by its size or its bytes, or its reader did not harvest it. */ export declare function unreadLine(unread: readonly string[]): readonly string[]; /** * The blocks `symbol` answers a name's file-private declarations with — alone * when no file exports it, after the exports when another file does: one per * declaration, source first and nearest a path in `from` first, the first * `limit` of them, a count of the rest, and the files whose * declarations were not read; nothing when the * source index is not at hand, since a name nothing exports is then unknown. */ export declare function declaredBlocks(help: Help, root: string | undefined, name: string, wanted: string | undefined, spell: Spelling, limit: number, from?: readonly string[]): { readonly blocks: readonly string[]; }; /** Whether a function's body declares it, rather than its file's top level. */ export declare const isNested: (one: Pick) => boolean; /** * The file-private declarations of the name, source first, top-level or * inside a function as `isNested` tells; none when the index is not at hand. */ export declare function declaredAt(help: Help, root: string | undefined, name: string, wanted: string | undefined): readonly DeclaredName[]; /** * The declarations whose names hold `query`, as the `search` section lists * them: the first `cap`, source first, in `files` when an area named them; * nothing when no checkout was named or its index could not be read. A name * that is the query as written comes first, the same name in another case * second, every name only holding it after them, and a doc alone saying it last. Members and functions * inside a function are `held`, every one, ordered the same way, and `exact` * counts the ones at its head that are the question. `file` receives each * top-level match's coordinates before the display cap. */ export declare function declaredMatches(root: string | undefined, query: string, files: Iterable | undefined, cap: number, told: (one: DeclaredRead) => DeclaredMatch, file?: (at: string, line?: number) => void): { readonly declared: Matches & { readonly unread: readonly string[]; }; readonly held: readonly HeldMatch[]; readonly exact: number; } | undefined; /** * The imports in `files`, when an area named them, that bind `query` as written * to an export of another name, and a declaration of another name too: a default * import that says its declaration's own name renames nothing. Nothing when the * index does not read. */ export declare function aliasMatches(root: string | undefined, query: string, files: ReadonlySet | undefined): readonly AliasMatch[] | undefined; /** * How exactly a name is the question, as every `search` list ranks it: 0 as * written, 1 the same name in another case, nothing when it only holds it. */ export declare function exactness(written: string, question: string): 0 | 1 | undefined; /** One declaration, as a `search` section holds it. */ export declare const declaredMatch: (one: DeclaredName) => DeclaredRead; /** A declaration a row prints: what `said` makes of the doc the index recorded; nothing when it recorded none. */ export declare function declaredTold(said: Said): (one: DeclaredRead) => DeclaredMatch; //# sourceMappingURL=declared.d.ts.map