sicua
Version:
A tool for analyzing project structure and dependencies
71 lines (70 loc) • 2.42 kB
TypeScript
import ts from "typescript";
import { TranslationAnalysisResult } from "../../types/translation.types";
import { TranslationLibrary } from "./utils/libraryDetector";
/**
* Analyzer for detecting translation issues in a React project
* Supports both next-intl and react-i18next libraries
*/
export declare class TranslationAnalyzer {
private sourceFiles;
private projectPath;
private libraryDetector;
private translationFileFinder;
private translationKeyFinder;
private missingTranslationAnalyzer;
private duplicateTranslationAnalyzer;
private coverageAnalyzer;
/**
* Constructor for the translation analyzer
* @param projectPath Path to the project root
* @param sourceFiles Map of source files to analyze
*/
constructor(projectPath: string, sourceFiles: Map<string, ts.SourceFile>);
/**
* Main analysis method with library detection and routing
* @returns Promise that resolves to analysis results
*/
analyze(): Promise<TranslationAnalysisResult>;
/**
* Analyzes projects using next-intl (original implementation)
* @returns Promise that resolves to analysis results
*/
private analyzeNextIntl;
/**
* Analyzes projects using react-i18next
* @returns Promise that resolves to analysis results
*/
private analyzeReactI18next;
/**
* Generate statistics for next-intl projects (original implementation)
*/
private generateNextIntlStatistics;
/**
* Gets information about the detected translation library
* @returns Library detection result
*/
getLibraryDetectionInfo(): {
library: TranslationLibrary;
confidence: number;
evidence: {
imports: string[];
hooks: string[];
patterns: string[];
};
};
/**
* Forces analysis using a specific library (for testing or edge cases)
* @param library Library to use for analysis
* @returns Promise that resolves to analysis results
*/
analyzeWithLibrary(library: TranslationLibrary): Promise<TranslationAnalysisResult>;
/**
* Gets detailed analysis information based on detected library
* @returns Library-specific analysis information
*/
getDetailedAnalysisInfo(): Promise<{
library: TranslationLibrary;
confidence: number;
librarySpecificInfo?: any;
}>;
}