sicua
Version:
A tool for analyzing project structure and dependencies
58 lines (57 loc) • 1.4 kB
TypeScript
/**
* Types for component deduplication and similarity analysis
*/
import { PropSignature, JSXStructure } from "./component.types";
export interface ComponentDeduplicationData {
components: {
name: string;
path: string;
content: string;
componentId?: string;
}[];
commonalities: {
props: PropSimilarity[];
structure: JSXSimilarity;
};
differences: {
props: PropDifference[];
structure: JSXDifference[];
};
}
export interface PropSimilarity {
name: string;
type: string;
isRequired: boolean;
defaultValue?: string;
usedInComponents: string[];
}
export interface PropDifference {
componentName: string;
uniqueProps: {
name: string;
type: string;
isRequired: boolean;
defaultValue?: string;
}[];
}
export interface JSXSimilarity {
sharedRootElement: string;
sharedStructure: string[];
sharedClassNames: string[];
}
export interface JSXDifference {
componentName: string;
uniqueElements: {
element: string;
location: string;
props?: Record<string, string>;
}[];
}
export interface ComponentSimilarity {
groupId: string;
components: string[];
commonProps: PropSignature[];
commonJSXStructure: JSXStructure[];
similarityScore: number;
deduplicationData: ComponentDeduplicationData;
}