image-asset-manager
Version:
A comprehensive image asset management tool for frontend projects
65 lines • 2.03 kB
TypeScript
import { Reference, ImageFile } from "../types";
export interface CodeScanOptions {
extensions: string[];
excludePatterns: string[];
recursive: boolean;
maxDepth: number;
}
export interface CodeScanResult {
references: Reference[];
scannedFiles: string[];
errors: Array<{
file: string;
error: string;
}>;
}
export declare class CodeScanner {
private static readonly SUPPORTED_EXTENSIONS;
private static readonly IMAGE_EXTENSIONS;
private static readonly REFERENCE_PATTERNS;
/**
* Scan a directory for source code files and extract image references
*/
scanDirectory(projectPath: string, options: CodeScanOptions): Promise<CodeScanResult>;
/**
* Recursively scan directories for source code files
*/
private scanDirectoryRecursive;
/**
* Scan a single source code file for image references
*/
scanFile(filePath: string, basePath: string): Promise<Reference[]>;
/**
* Extract image references from file content
*/
private extractReferences;
/**
* Get line number for a given character index in content
*/
private getLineNumber;
/**
* Check if a file is a source code file we should scan
*/
private isSourceCodeFile;
/**
* Check if a path should be excluded from scanning
*/
private shouldExclude;
/**
* Resolve relative image paths to absolute paths within the project
*/
resolveImagePath(referencePath: string, sourceFilePath: string, projectPath: string): string;
/**
* Filter references to only include existing image files
*/
filterValidReferences(references: Reference[], imageFiles: ImageFile[], projectPath: string): Promise<Reference[]>;
/**
* Extract the actual image path from a reference context
*/
private extractImagePathFromReference;
/**
* Get default scan options
*/
static getDefaultOptions(): CodeScanOptions;
}
//# sourceMappingURL=CodeScanner.d.ts.map