import * as ts from 'typescript'; export interface AstChange { start: number; end: number; replacement: string; } export declare function applyChanges(content: string, changes: AstChange[]): string; /** * Removes named imports from a module matching `fromModulePattern`. * If the import statement becomes empty, removes the entire statement. * Returns the changes and the list of names that were actually removed. */ export declare function buildRemoveNamedImportsChanges(sourceFile: ts.SourceFile, names: string[], fromModulePattern: string): { changes: AstChange[]; removedNames: string[]; }; /** * Inserts `import { name } from 'fromModule';` on its own line after the last existing import * statement, preserving the file's line ending and without introducing a blank line. * If no imports exist, prepends to the file. */ export declare function insertImportStatement(content: string, name: string, fromModule: string): string; /** * True when `symbolName` is already imported from `fromModule` (exact module specifier). */ export declare function isSymbolImportedFrom(content: string, symbolName: string, fromModule: string): boolean; /** * Adds `symbolName` to the existing import statement for `fromModule`, or creates the statement. * No-op when the symbol is already imported from that module. */ export declare function ensureNamedImport(content: string, symbolName: string, fromModule: string): string; /** * Bare identifier names listed in a decorator metadata array (`imports`, `exports`, `declarations`). * Call expressions such as `RouterModule.forRoot(...)` or `PermissionsModule.forChild(...)` are * reduced to their leftmost identifier (`RouterModule`, `PermissionsModule`). */ export declare function getMetadataArrayNames(sourceFile: ts.SourceFile, metadata: ts.ObjectLiteralExpression, propName: string): string[]; /** String literal value of a decorator metadata property (e.g. `templateUrl`). */ export declare function getMetadataStringProperty(sourceFile: ts.SourceFile, metadata: ts.ObjectLiteralExpression, propName: string): string | undefined; /** `true`/`false` value of a decorator metadata property (e.g. `standalone`). */ export declare function getMetadataBooleanProperty(sourceFile: ts.SourceFile, metadata: ts.ObjectLiteralExpression, propName: string): boolean | undefined; /** `true` when the metadata object declares `propName` at all, regardless of its value. */ export declare function hasMetadataProperty(sourceFile: ts.SourceFile, metadata: ts.ObjectLiteralExpression, propName: string): boolean; /** * Standalone components/directives/pipes can only appear in an @NgModule's `exports` if they * are also present in that module's `imports` (the Angular compiler rejects export-only entries, * unlike classic NgModules which can be re-exported without being imported). This backfills * `imports` whenever `symbolName` ends up in `exports` without it. */ export declare function ensureExportedSymbolIsImported(content: string, symbolName: string): string; export declare const ngModule: { replaceInImports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[]; replaceInExports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[]; addToImports(sourceFile: ts.SourceFile, add: string, className?: string): AstChange[]; find(sourceFile: ts.SourceFile): { classDeclaration: ts.ClassDeclaration; metadata: ts.ObjectLiteralExpression; }[]; }; export declare const ngComponent: { replaceInImports(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[]; addToImports(sourceFile: ts.SourceFile, add: string, className?: string): AstChange[]; find(sourceFile: ts.SourceFile): { classDeclaration: ts.ClassDeclaration; metadata: ts.ObjectLiteralExpression; }[]; }; /** * Replaces bare identifiers inside ANY array literal in the file (NgModule imports/exports, * standalone Component imports, TestBed.configureTestingModule imports/declarations, etc.) * with a single replacement identifier. Deduplicates if the replacement is already present. */ export declare function replaceIdentifierInArrayLiterals(sourceFile: ts.SourceFile, remove: string[], add: string): AstChange[]; /** * Removes a property assignment from an object literal, handling comma cleanup. * - Non-last property: removes from property start to next property start (trailing comma). * - Last property: removes from previous property end to this property end (leading comma). * - Only property: removes the property content, leaving empty braces. */ export declare function buildRemoveObjectPropertyChange(sourceFile: ts.SourceFile, obj: ts.ObjectLiteralExpression, prop: ts.PropertyAssignment): AstChange[];