UNPKG

structure-validation

Version:

A Node.js CLI tool for validating codebase folder and file structure using a clean declarative configuration. Part of the guardz ecosystem for comprehensive TypeScript development.

112 lines 3.26 kB
/** * Represents a file that has been moved */ export interface MovedFile { oldPath: string; newPath: string; oldRelativePath: string; newRelativePath: string; } /** * Represents an import statement that needs to be updated */ export interface ImportUpdate { filePath: string; importPath: string; newImportPath: string; line: number; column: number; } /** * Application service for updating import statements when files are moved */ export declare class ImportUpdateService { private project; private basePath; constructor(basePath?: string); /** * Update all import statements after files have been moved */ updateImportsAfterMove(movedFiles: MovedFile[]): Promise<{ updated: string[]; errors: string[]; summary: string; }>; /** * Add all TypeScript/JavaScript files to the project */ private addSourceFiles; /** * Find all TypeScript/JavaScript files in the project */ private findSourceFiles; /** * Update imports in a specific file */ private updateImportsInFile; /** * Find if an import path corresponds to a moved file */ private findMovedFileForImport; /** * Check if two paths match (handling different separators and normalization) */ private pathsMatch; /** * Calculate the new import path after a file has been moved */ private calculateNewImportPath; /** * Generate a summary of the import update operation */ private generateSummary; /** * Get statistics about the import update operation */ getStats(): { totalFiles: number; totalImports: number; }; /** * Update imports after files have been renamed * @param renamedFiles Array of renamed file information * @returns Promise<{ updated: string[]; errors: string[]; summary: string }> */ updateImportsAfterRename(renamedFiles: MovedFile[]): Promise<{ updated: string[]; errors: string[]; summary: string; }>; /** * Remove imports for deleted files * @param deletedFiles Array of deleted file paths * @returns Promise<{ updated: string[]; errors: string[]; summary: string }> */ removeImportsForDeletedFiles(deletedFiles: string[]): Promise<{ updated: string[]; errors: string[]; summary: string; }>; /** * Remove imports for deleted files in a specific file * @param sourceFile The source file to check * @param deletedFiles Array of deleted file paths * @returns Promise<string[]> Array of removed import descriptions */ private removeImportsInFile; /** * Validate import paths and suggest fixes * @returns Promise<{ invalid: string[]; suggestions: string[] }> */ validateImportPaths(): Promise<{ invalid: string[]; suggestions: string[]; }>; /** * Find a similar file when the original import path is invalid * @param invalidPath The invalid import path * @returns Promise<string | null> The path to a similar file, or null if not found */ private findSimilarFile; } //# sourceMappingURL=ImportUpdateService.d.ts.map