Raxol.Terminal.Plugin.DependencyResolver (Raxol v2.0.1)

View Source

Handles plugin dependency resolution for the terminal emulator. This module extracts the plugin dependency resolution logic from the main emulator.

Summary

Functions

Calculates the in-degree for each node in the dependency graph.

Extracts dependencies from a list of plugins.

Resolves plugin dependencies and returns the load order.

Performs topological sorting on plugin dependencies.

Helper function for topological sorting using Kahn's algorithm.

Functions

calculate_in_degree(dependencies, nodes)

@spec calculate_in_degree(map(), [String.t()]) :: map()

Calculates the in-degree for each node in the dependency graph.

extract_plugin_dependencies(plugins)

@spec extract_plugin_dependencies([map()]) :: map()

Extracts dependencies from a list of plugins.

resolve_plugin_dependencies(plugin_manager)

@spec resolve_plugin_dependencies(map()) :: [String.t()]

Resolves plugin dependencies and returns the load order.

topological_sort(dependencies)

@spec topological_sort(map()) :: {:ok, [String.t()]} | {:error, atom()}

Performs topological sorting on plugin dependencies.

topological_sort_helper(dependencies, in_degree, list, result)

@spec topological_sort_helper(map(), map(), [String.t()], [String.t()]) :: [
  String.t()
]

Helper function for topological sorting using Kahn's algorithm.