sicua
Version:
A tool for analyzing project structure and dependencies
89 lines (88 loc) • 2.52 kB
TypeScript
import ts from "typescript";
/**
* Utility functions for performance-related SEO analysis
*/
export declare class PerformanceUtils {
/**
* Detects dynamic imports in a component
*/
static findDynamicImports(sourceFile: ts.SourceFile): Array<{
importPath: string;
isNextDynamic: boolean;
hasSSR: boolean;
hasLoading: boolean;
}>;
/**
* Helper to find import() calls in expressions
*/
private static findImportInExpression;
/**
* Analyzes static imports that might impact performance
*/
static analyzeStaticImports(sourceFile: ts.SourceFile): Array<{
importPath: string;
isLibrary: boolean;
isLargeLibrary: boolean;
isImageImport: boolean;
importType: "default" | "named" | "namespace" | "side-effect";
}>;
/**
* Detects potential Core Web Vitals issues in JSX
*/
static detectCWVIssues(sourceFile: ts.SourceFile): Array<{
type: "LCP" | "CLS" | "FID" | "INP";
severity: "low" | "medium" | "high";
description: string;
location: string;
element?: string;
}>;
/**
* Analyze a JSX element for potential CWV issues
*/
private static analyzeElementForCWV;
/**
* Determines if an element is likely above the fold
*/
private static isLikelyAboveFold;
/**
* Find the start of the main component in the source file
*/
private static findComponentStart;
/**
* Check if a function returns JSX
*/
private static functionReturnsJSX;
/**
* Check if an expression is JSX
*/
private static isJSXExpression;
/**
* Check if an event handler is complex (potential performance issue)
*/
private static isComplexEventHandler;
/**
* Check if there's a preconnect for Google Fonts
*/
private static hasPreconnectForGoogleFonts;
/**
* Analyze bundle impact of imports
*/
static analyzeBundleImpact(imports: Array<{
importPath: string;
isLibrary: boolean;
isLargeLibrary: boolean;
importType: string;
}>): {
heavyImports: string[];
treeshakingIssues: string[];
bundleScore: number;
};
/**
* Check if component is server or client component
*/
static isServerComponent(sourceFile: ts.SourceFile): {
isServerComponent: boolean;
hasUseClientDirective: boolean;
hasUseServerDirective: boolean;
};
}