use std::path::{Path, PathBuf};
use anyhow::Result;
use async_trait::async_trait;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum DependencySourceType {
CratesIo,
Git,
Path,
Unknown(String),
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DiscoveredDependency {
pub name: String,
pub version: String,
pub source_type: DependencySourceType,
pub manifest_path: PathBuf,
pub root_path: PathBuf,
pub package_hash: Option<String>,
pub is_direct: bool,
pub features: Vec<String>,
}
#[async_trait]
pub trait DependencyProvider: Send + Sync {
fn ecosystem(&self) -> &'static str;
async fn discover_dependencies(&self, root: &Path) -> Result<Vec<DiscoveredDependency>>;
fn resolve_source_directory(&self, dep: &DiscoveredDependency) -> Result<PathBuf>;
}