plugin-dependency-resolver

Solid

Generate plugin dependency resolution logic with topological sorting.

AI & Automation 814 stars 53 forks Updated today MIT

Install

View on GitHub

Quality Score: 93/100

Stars 20%
97
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
57
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Plugin Dependency Resolver Generate plugin dependency resolution logic. ## Generated Patterns ```typescript interface PluginNode { name: string; dependencies: string[]; } export function resolveDependencies(plugins: PluginNode[]): string[] { const graph = new Map<string, string[]>(); const inDegree = new Map<string, number>(); for (const plugin of plugins) { graph.set(plugin.name, plugin.dependencies); inDegree.set(plugin.name, 0); } for (const [, deps] of graph) { for (const dep of deps) { inDegree.set(dep, (inDegree.get(dep) || 0) + 1); } } const queue = [...inDegree.entries()].filter(([, d]) => d === 0).map(([n]) => n); const result: string[] = []; while (queue.length > 0) { const node = queue.shift()!; result.push(node); for (const dep of graph.get(node) || []) { inDegree.set(dep, inDegree.get(dep)! - 1); if (inDegree.get(dep) === 0) queue.push(dep); } } if (result.length !== plugins.length) { throw new Error('Circular dependency detected'); } return result.reverse(); } ``` ## Target Processes - plugin-architecture-implementation

Details

Author
a5c-ai
Repository
a5c-ai/babysitter
Created
4 months ago
Last Updated
today
Language
JavaScript
License
MIT

Related Skills