/** * Core data types for React State Map */ export interface StateNode { id: string; type: 'useState' | 'useReducer' | 'useContext' | 'zustand' | 'redux' | 'customHook' | 'props'; name: string; filePath: string; line: number; column: number; initialValue?: string; storeName?: string; hookName?: string; } export interface ContextInfo { contextId: string; contextName: string; providerValue?: string; } export interface ComponentNode { id: string; name: string; filePath: string; line: number; column: number; stateUsed: StateNode[]; stateProvided: StateNode[]; contextProviders: ContextInfo[]; contextConsumers: string[]; props: PropDefinition[]; isExported: boolean; } export interface PropDefinition { name: string; type?: string; isUsed: boolean; passedTo: string[]; } export interface StateFlowEdge { id: string; from: string; to: string; stateId: string; mechanism: 'props' | 'context' | 'hook'; propName?: string; hops: number; } export interface ContextBoundary { contextId: string; contextName: string; providerComponent: string; providerFile: string; providerLine: number; childComponents: string[]; } export interface PropDrillingPath { stateId: string; stateName: string; origin: string; path: string[]; hops: number; propNames: string[]; } export interface StateFlowGraph { components: Map; stateNodes: Map; edges: StateFlowEdge[]; contextBoundaries: ContextBoundary[]; propDrillingPaths: PropDrillingPath[]; componentMetrics: ComponentPropMetrics[]; bundles: PropBundle[]; contextLeaks: ContextLeak[]; propChains: PropChain[]; } export interface SerializedStateFlowGraph { components: Record; stateNodes: Record; edges: StateFlowEdge[]; contextBoundaries: ContextBoundary[]; propDrillingPaths: PropDrillingPath[]; componentMetrics: ComponentPropMetrics[]; bundles: PropBundle[]; contextLeaks: ContextLeak[]; propChains: PropChain[]; } export interface ParseOptions { entryPoint?: string; rootDir: string; include?: string[]; exclude?: string[]; drillingThreshold?: number; } export interface ParseResult { graph: StateFlowGraph; errors: ParseError[]; warnings: ParseWarning[]; } export interface ParseError { filePath: string; line?: number; column?: number; message: string; } export interface ParseWarning { filePath: string; line?: number; column?: number; message: string; code: string; } export interface PropUsage { propName: string; usedInRender: boolean; passedToChild: boolean; usedInCallback: boolean; usedInEffect: boolean; usedInLogic: boolean; transformed: boolean; } export type ComponentRole = 'consumer' | 'passthrough' | 'transformer' | 'mixed'; export interface ComponentPropMetrics { componentId: string; componentName: string; filePath: string; totalPropsReceived: number; propsConsumed: number; propsPassed: number; propsTransformed: number; propsIgnored: number; passthroughRatio: number; consumptionRatio: number; role: ComponentRole; propUsages: PropUsage[]; } export interface PropBundle { id: string; propName: string; sourceComponentId: string; sourceComponentName: string; estimatedSize: number; properties: string[]; passedThrough: string[]; isObjectLiteral: boolean; filePath: string; line: number; } export interface BundleFlow { bundleId: string; fromComponentId: string; toComponentId: string; propName: string; consumedProperties: string[]; forwardedProperties: string[]; } export type BundleSeverity = 'low' | 'medium' | 'high'; export interface BundleWarning { bundle: PropBundle; severity: BundleSeverity; passedThroughCount: number; utilizationRatio: number; recommendation: string; } export type ContextLeakSeverity = 'low' | 'medium' | 'high'; export interface ContextLeak { id: string; contextName: string; leakingComponentId: string; leakingComponentName: string; extractedValues: string[]; passedTo: Array<{ componentId: string; componentName: string; propNames: string[]; }>; severity: ContextLeakSeverity; potentialFix: string; filePath: string; line: number; } export interface EnhancedContextUsage { contextName: string; variableName: string; destructuredFields: string[]; usedInJsx: boolean; passedAsProps: string[]; line: number; } export type RenameType = 'destructure' | 'alias' | 'accessor' | 'assignment' | 'spread'; export interface PropRename { fromName: string; toName: string; componentId: string; componentName: string; renameType: RenameType; line: number; filePath: string; } export interface PropChain { id: string; originalStateId?: string; originalName: string; renames: PropRename[]; finalName: string; depth: number; } export interface ScopeEntry { type: 'propAlias' | 'destructure' | 'contextValue' | 'computed'; originalName: string; sourceProp?: string; line: number; } //# sourceMappingURL=types.d.ts.map