UNPKG

@notjustcoders/ioc-arise

Version:

Arise type-safe IoC containers from your code. Zero overhead, zero coupling.

51 lines 2.01 kB
import { ClassInfo, FactoryInfo, ValueInfo } from '../types'; import { IoCError } from '../errors/IoCError'; export declare class ModuleResolver { private moduleConfig; private sourceDirectory; constructor(moduleConfig: Record<string, string[]>, sourceDirectory: string); /** * Determines which module a file belongs to based on its path * @param filePath - Absolute path to the file * @returns Module name or null if no match found */ getModuleForFile(filePath: string): string | null; /** * Groups classes by their assigned modules * @param classes - Array of ClassInfo objects * @returns Map of module names to their classes */ groupClassesByModule(classes: ClassInfo[]): Map<string, ClassInfo[]>; /** * Groups factory functions by their assigned modules * @param factories - Array of FactoryInfo objects * @returns Map of module names to their factories */ groupFactoriesByModule(factories: FactoryInfo[]): Map<string, FactoryInfo[]>; /** * Groups values by their assigned modules * @param values - Array of ValueInfo objects * @returns Map of module names to their values */ groupValuesByModule(values: ValueInfo[]): Map<string, ValueInfo[]>; /** * Checks if a file path matches a given pattern * @param filePath - Normalized relative file path * @param pattern - Pattern to match against * @returns True if the pattern matches */ private matchesPattern; /** * Converts absolute path to relative path from source directory * @param filePath - Absolute file path * @returns Normalized relative path */ private normalizeFilePath; /** * Validates module configuration * @param moduleConfig - Module configuration to validate * @returns Array of validation errors */ static validateModuleConfig(moduleConfig: Record<string, string[]>): IoCError[]; } //# sourceMappingURL=moduleResolver.d.ts.map