/** * Dependency Service * * Analyzes plugin dependencies, builds dependency graphs, and detects missing/circular dependencies. * * @since v1.20.0 */ import type { PluginSourceType, ScannedPlugin } from '../types/index.js'; /** * Represents a node in the dependency graph */ export interface DependencyNode { /** Plugin name (lowercase for matching) */ name: string; /** Display name (original case) */ displayName: string; /** Installed version if present */ version?: string; /** Hard dependencies (plugin won't load without these) */ dependencies: string[]; /** Soft dependencies (optional, loads first if present) */ softDependencies: string[]; /** Plugins that should load after this one */ loadBefore: string[]; /** Whether the plugin is installed on the server */ installed: boolean; /** Source type if known */ source?: PluginSourceType; } /** * Dependency graph structure */ export interface DependencyGraph { /** All nodes in the graph */ nodes: Map; /** Edges: plugin name -> list of dependency names */ edges: Map; } /** * Information about a missing dependency */ export interface MissingDependency { /** Dependency name (lowercase) */ name: string; /** Display name (original case) */ displayName: string; /** Plugins that require this dependency */ requiredBy: string[]; /** Whether it's available in the registry */ inRegistry: boolean; /** Whether it's a soft dependency (optional) */ isSoft: boolean; } /** * Dependency analysis result */ export interface DependencyAnalysis { /** The dependency graph */ graph: DependencyGraph; /** Missing hard dependencies */ missingRequired: MissingDependency[]; /** Missing soft dependencies */ missingSoft: MissingDependency[]; /** Circular dependency chains detected */ circularChains: string[][]; /** Recommended load order (topological sort) */ loadOrder: string[]; } /** * Build a dependency graph from scanned plugins */ export declare function buildDependencyGraph(plugins: ScannedPlugin[]): DependencyGraph; /** * Find all missing dependencies in a graph */ export declare function findMissingDependencies(graph: DependencyGraph, registryLookup?: (name: string) => boolean): { missingRequired: MissingDependency[]; missingSoft: MissingDependency[]; }; /** * Detect circular dependencies in the graph using DFS */ export declare function findCircularDependencies(graph: DependencyGraph): string[][]; /** * Get topological sort of plugins (correct load order) * Returns plugins in order they should be loaded (dependencies first) */ export declare function getLoadOrder(graph: DependencyGraph): string[]; /** * Get all dependencies for a plugin (recursive, including transitive) */ export declare function getAllDependencies(graph: DependencyGraph, pluginName: string, includesSoft?: boolean): string[]; /** * Perform full dependency analysis on a set of scanned plugins */ export declare function analyzeDependencies(plugins: ScannedPlugin[], registryLookup?: (name: string) => boolean): DependencyAnalysis; /** * Get dependency summary for display */ export declare function getDependencySummary(analysis: DependencyAnalysis): { totalPlugins: number; missingRequiredCount: number; missingSoftCount: number; circularCount: number; hasIssues: boolean; }; /** * Format a dependency tree for a single plugin */ export declare function formatDependencyTree(graph: DependencyGraph, pluginName: string, maxDepth?: number): string[]; //# sourceMappingURL=dependency-service.d.ts.map