1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use anyhow::Result;
#[derive(Clone, Debug, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct Dependency {
pub name: String,
pub version: Option<String>,
pub version_parse_error: bool,
pub missing_version: bool,
}
#[derive(Clone, Debug, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct DependenciesSpec {
pub path: std::path::PathBuf,
pub registry_host_name: String,
pub dependencies: Vec<Dependency>,
}
#[derive(Debug, Clone, Hash, Eq, PartialEq, serde::Serialize, serde::Deserialize)]
pub struct RemotePackageMetadata {
pub registry_host_name: String,
pub registry_human_url: String,
pub archive_url: String,
}
pub trait Extension: Send + Sync {
fn new() -> Self
where
Self: Sized;
fn from_process(
process_path: &std::path::PathBuf,
extension_config_path: &std::path::PathBuf,
) -> Result<Self>
where
Self: Sized;
fn name(&self) -> String;
fn registries(&self) -> Vec<String>;
fn identify_local_dependencies(
&self,
working_directory: &std::path::PathBuf,
) -> Result<Vec<DependenciesSpec>>;
fn remote_package_metadata(
&self,
package_name: &str,
package_version: &str,
) -> Result<RemotePackageMetadata>;
}