/** * The migration off the import spellings a permanent namespace replaced. * * D52 rule 116 / D50 rule 90 retired `import {stringify} from "velar/json"` in * favour of `Json.stringify`, and `import {range} from "velar/collections"` in * favour of the Core prelude name. What is left is one report per specifier and * the rewrite that carries the whole module across in a single pass — a subject * of its own, about a module's import list rather than about any type, so under * D115 §三 it is its own module rather than another hundred lines of * `analyzer.ts`. */ import { type Program } from "../ast.ts"; import { type Diagnostic } from "../diagnostic.ts"; import { type Span } from "../source.ts"; /** * D114 AS-I2: the exports a standard module retired into a name that needs no * import, with that name. * * `velar/task` published `TaskTimeoutError` while `Promise.timeout` rejected * with a bare `Error`, so one concept — "the budget ran out" — had two * identities and one of them was not discriminable at all. Charter §11 allows * an error exactly one classification, so the two became `TimeoutError`, a Core * built-in that every module can name without importing anything. The old * spelling is answered here, with the rewrite that carries a module across in * one pass. * * The retired name stays in the module's published interface as a tombstone. * Nothing throws it and no annotation can reach it, and keeping it is what lets * this migration be the *only* report an author sees: dropping the export * outright would add the project driver's "has no export named" beside it, and * that sentence carries no rewrite. */ export declare const RETIRED_MODULE_EXPORTS: ReadonlyMap>; /** The name one retired module export retired into, or null when the export stands. */ export declare function retiredModuleExport(source: string, name: string): string | null; /** What this migration asks of the analyzer that hosts it, and nothing more. */ export interface PermanentNamespaceImportHost { readonly diagnostics: Diagnostic[]; renderNamedImport(source: string, specifiers: readonly { readonly imported: string; readonly local: string; }[]): string; } export declare class PermanentNamespaceImports { private readonly host; constructor(host: PermanentNamespaceImportHost); /** D52 rule 116: reads of a name imported from a module that has a permanent namespace. */ readonly reads: { readonly local: string; readonly source: string; readonly imported: string; readonly span: Span; }[]; /** The import each such local came from, keyed by the local name. */ readonly origins: Map; /** * D114 0.28.0 D-I1: the import specifiers this migration's report already * answers for, by span. `declareBinding` leaves the reserved-Core-binding * sentence unsaid at those, exactly as `refusedTypeNames` does for a type * name a nearer roster already refused — one spelling, one report. They are * kept by span rather than by name because only *this* import of the name is * answered for; a local of the same name elsewhere is still refused. */ readonly refusedSpecifiers: Set; register(program: Program): void; /** * D52 rule 116 / D50 rule 90: a permanent namespace needs no import, so the * import spelling retires. The rewrite is the import's own inverse — take the * specifier out, put the prefix on every read it left behind — and it is * carried whole so the author never sees a half-migrated module. */ report(program: Program): void; /** * D50 rule 97.3: a retirement that leaves one surviving spelling did not * happen. `export {stringify} from "velar/json"` is an import spelling with * an export in front of it — the barrel republishes the retired bare name * and every downstream `import {stringify} from "./barrel.vel"` is clean * forever after. No mechanical fix: which reads in which other modules * wanted the name is not a rewrite this module can make. */ reportReExports(program: Program): void; /** The text every read of one retired import spelling becomes. */ private replacementFor; /** The one sentence a retired import spelling earns, whichever roster retired it. */ private retirementMessage; } //# sourceMappingURL=retired-imports.d.ts.map