UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

73 lines (72 loc) 2.23 kB
import { ComponentRelation } from "../types"; export interface ComponentLookupMaps { byId: Map<string, ComponentRelation>; byName: Map<string, ComponentRelation[]>; byPath: Map<string, ComponentRelation>; byDirectory: Map<string, ComponentRelation[]>; byNormalizedImport: Map<string, ComponentRelation[]>; } /** * High-performance lookup service for component relations * Pre-builds hash maps for O(1) component lookups instead of O(n) array searches */ export declare class ComponentLookupService { private readonly lookupMaps; constructor(components: ComponentRelation[]); /** * Find component by unique ID - O(1) */ getComponentById(id: string): ComponentRelation | undefined; /** * Find components by name - O(1) */ getComponentsByName(name: string): ComponentRelation[]; /** * Find component by full path - O(1) */ getComponentByPath(fullPath: string): ComponentRelation | undefined; /** * Find components in directory - O(1) */ getComponentsByDirectory(directory: string): ComponentRelation[]; /** * Find components by normalized import path - O(1) */ getComponentsByNormalizedImport(normalizedImport: string): ComponentRelation[]; /** * Get all component IDs - O(1) */ getAllComponentIds(): string[]; /** * Get all components - O(1) */ getAllComponents(): ComponentRelation[]; /** * Check if component exists by ID - O(1) */ hasComponentById(id: string): boolean; /** * Check if component exists by name - O(1) */ hasComponentByName(name: string): boolean; /** * Get component count - O(1) */ getComponentCount(): number; /** * Find target component IDs for an import path */ resolveImportToComponentIds(importPath: string): string[]; /** * Build all lookup maps during initialization - O(n) operation done once */ private buildLookupMaps; /** * Generate all possible normalized import patterns for a component */ private generateNormalizedImportPatterns; /** * Normalize import path for consistent lookups */ private normalizeImportPath; }