UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

37 lines (36 loc) 1.81 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getTranslationSourceFiles = getTranslationSourceFiles; exports.scanSourceFilesForTranslations = scanSourceFilesForTranslations; /** * Extracts relevant files for translation analysis from the unified scan result * @param scanResult The unified scan result from directoryScanner * @returns Map of file paths to TypeScript SourceFile objects that are relevant for translation analysis */ function getTranslationSourceFiles(scanResult) { const translationSourceFiles = new Map(); // Iterate through all scanned files and filter those relevant for translation analysis for (const [filePath, sourceFile] of scanResult.sourceFiles.entries()) { const metadata = scanResult.fileMetadata.get(filePath); // Filter files that use translation functions if (metadata?.hasTranslations) { translationSourceFiles.set(filePath, sourceFile); } } return translationSourceFiles; } /** * Legacy method that performs a full scan for backward compatibility * @param projectPath The root project path * @returns Map of file paths to TypeScript SourceFile objects * @deprecated Use getTranslationSourceFiles with the unified scanner instead */ async function scanSourceFilesForTranslations(projectPath) { console.warn("Warning: scanSourceFilesForTranslations is deprecated. " + "Use getTranslationSourceFiles with the unified scanner for better performance."); // This is kept for backward compatibility, but we should phase it out // Implementation remains the same as the original // This would be the original implementation, but we're not reproducing it here // as it's deprecated and should be replaced by the new approach return new Map(); }