import type * as TsMorphTypes from 'ts-morph'; /** Prefix of every comment a v3 codemod leaves for manual work. */ export declare const TODO_MARKER = "TODO(c15t v3):"; /** A replacement of `[start, end)` in a file's full text. */ export interface TextEdit { start: number; end: number; text: string; } /** Result shape every source transform returns to `runTransform`. */ export interface TransformResult { changed: boolean; operations: number; summaries: string[]; } export declare const UNCHANGED: TransformResult; export declare const toTextEdit: (node: TsMorphTypes.Node, text: string) => TextEdit; /** The whitespace that starts the node's line, exactly as written. */ export declare const lineIndent: (node: TsMorphTypes.Node) => string; /** Applies non-overlapping edits from the end of the file backwards. */ export declare const applyEdits: (sourceFile: TsMorphTypes.SourceFile, edits: TextEdit[]) => void; /** * Queues a `TODO(c15t v3)` comment above `node`, or inline before it when * the node shares its line. Returns false when the same comment is already * there, so a second run adds nothing. */ export declare const addTodo: (node: TsMorphTypes.Node, message: string, edits: TextEdit[]) => boolean; /** * The local binding an import specifier creates. `isReference` is true only * for identifiers that resolve to that binding, so a parameter or local * function with the same name is not treated as the import. */ export declare const importedBinding: (namedImport: TsMorphTypes.ImportSpecifier) => { isReference: (node: TsMorphTypes.Node) => boolean; }; /** Identifiers in this file, outside imports, that refer to the import. */ export declare const referencesOf: (namedImport: TsMorphTypes.ImportSpecifier) => TsMorphTypes.Identifier[]; /** The declarations an identifier resolves to in its own file. */ export declare const localDeclarationsOf: (identifier: TsMorphTypes.Identifier) => TsMorphTypes.Node[]; /** The module an import declaration that holds `node` loads. */ export declare const importedModuleOf: (node: TsMorphTypes.Node) => string | undefined; /** * The name a binding has where it comes from, so an alias resolves to what * it stands for: * * - an identifier nothing in the file declares is a global, named by its text; * - `test` in `import { vi as test } from 'vitest'` is `vi`; * - `V.vi` after `import * as V from 'vitest'` is `vi`, as is `V.vi` after * a default import, `import V from 'vitest'`. * * An import counts only from a module `modulesOf` lists for its name. Any * other local binding, such as a parameter that shadows a global, has none. * * @param node - An identifier, or a property access on a namespace or * default import. * @param modulesOf - For each exported name, the modules that export it. * @returns The global or imported name, or `undefined`. */ export declare const sourceNameOf: (node: TsMorphTypes.Node, modulesOf: Readonly>) => string | undefined; /** * Strips `as`, `satisfies`, `` type assertions, non-null `!` and * parentheses around an expression. */ export declare const unwrapExpression: (node: TsMorphTypes.Node) => TsMorphTypes.Node; /** * Whether an identifier names Node's `require`: the global, or a binding * created by `createRequire()` from `node:module`, imported by name or * reached through a namespace or default import. A parameter or local * declaration that shadows `require` does not count. */ export declare const isNodeRequire: (identifier: TsMorphTypes.Identifier) => boolean; /** * An object property's key without quotes. A computed key counts when it is * a string, as in `['tailwindcss']: {}`; any other computed key is * `undefined`. */ export declare const propertyKey: (property: TsMorphTypes.ObjectLiteralElementLike) => string | undefined; /** The first property with this key, ignoring spreads and computed keys. */ export declare const findProperty: (object: TsMorphTypes.ObjectLiteralExpression, key: string) => TsMorphTypes.ObjectLiteralElementLike | undefined; /** The value a property supplies: its initializer, or the shorthand name. */ export declare const propertyValueText: (property: TsMorphTypes.ObjectLiteralElementLike) => string | undefined; /** Writes `key: value`, or the shorthand when they are the same name. */ export declare const propertyText: (key: string, value: string) => string; /** * The range that removes one list element (a property, an import specifier * or a JSX attribute) and its comma. To remove several elements of the same * list, use `elementRemovals`, so two removals never claim the same comma. */ export declare const propertyRemoval: (property: TsMorphTypes.Node) => TextEdit; /** * Ranges that remove `elements` and their commas. Adjacent elements of one * list are removed as a single run: removing `b` and `c` from * `{ a: 1, b: 2, c: 3 }` leaves `{ a: 1 }`. A comment between two elements * ends the run, so it stays. */ export declare const elementRemovals: (elements: Iterable) => TextEdit[]; /** * Makes `names` available from `specifier`, reusing an existing value * import from it, or adding a declaration after the last import. */ export declare const ensureNamedImports: (sourceFile: TsMorphTypes.SourceFile, specifier: string, names: Iterable) => void; /** True when the file has a binding with this name outside the given import. */ export declare const isNameTaken: (sourceFile: TsMorphTypes.SourceFile, name: string) => boolean; /** Where one import or export specifier should go, and how to write it there. */ export interface SpecifierMove { target: string; text: string; } /** * Moves specifiers to declarations for other entries. A declaration whose * every specifier moves is replaced in place; otherwise the moved * specifiers are removed and new declarations follow it. Type-only * declarations stay type-only. */ export declare const moveSpecifiers: (declaration: TsMorphTypes.ImportDeclaration | TsMorphTypes.ExportDeclaration, moves: Map, edits: TextEdit[]) => void; /** The text of a specifier with `name` in place of its imported name. */ export declare const renamedSpecifierText: (specifier: TsMorphTypes.ImportSpecifier | TsMorphTypes.ExportSpecifier, name: string, keepLocalName: boolean) => string; /** * The object literal an expression is written as, following an identifier * or shorthand property to a variable initialized in the same file. */ export declare const objectLiteralFor: (node: TsMorphTypes.Node | undefined) => TsMorphTypes.ObjectLiteralExpression | undefined; /** The node a property's value is written with: its initializer, or the shorthand itself. */ export declare const propertyValueNode: (property: TsMorphTypes.ObjectLiteralElementLike) => TsMorphTypes.Node | undefined;