mirror of
https://github.com/pesde-pkg/pesde.git
synced 2024-12-12 11:00:36 +00:00
fix(overrides): use project indices in specifier
This commit is contained in:
parent
57e6aedfd1
commit
e0468069f3
1 changed files with 11 additions and 6 deletions
|
@ -18,7 +18,7 @@ use crate::{
|
||||||
index::{Index, IndexFileEntry, IndexPackageError},
|
index::{Index, IndexFileEntry, IndexPackageError},
|
||||||
manifest::{DependencyType, Manifest, OverrideKey, Realm},
|
manifest::{DependencyType, Manifest, OverrideKey, Realm},
|
||||||
package_name::{PackageName, StandardPackageName},
|
package_name::{PackageName, StandardPackageName},
|
||||||
project::{get_index, get_index_by_url, Project, ReadLockfileError},
|
project::{get_index, get_index_by_url, Indices, Project, ReadLockfileError},
|
||||||
DEV_PACKAGES_FOLDER, INDEX_FOLDER, PACKAGES_FOLDER, SERVER_PACKAGES_FOLDER,
|
DEV_PACKAGES_FOLDER, INDEX_FOLDER, PACKAGES_FOLDER, SERVER_PACKAGES_FOLDER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,6 +209,14 @@ pub enum ResolveError {
|
||||||
UrlParse(#[from] url::ParseError),
|
UrlParse(#[from] url::ParseError),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn get_by_maybe_url<'a>(indices: &'a Indices, maybe_url: &'a str) -> &'a dyn Index {
|
||||||
|
if let Ok(url) = maybe_url.parse() {
|
||||||
|
get_index_by_url(indices, &url)
|
||||||
|
} else {
|
||||||
|
get_index(indices, Some(maybe_url))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Manifest {
|
impl Manifest {
|
||||||
fn missing_dependencies(
|
fn missing_dependencies(
|
||||||
&self,
|
&self,
|
||||||
|
@ -372,11 +380,8 @@ impl Manifest {
|
||||||
|
|
||||||
let (pkg_ref, default_realm, dependencies) = match &specifier {
|
let (pkg_ref, default_realm, dependencies) = match &specifier {
|
||||||
DependencySpecifier::Registry(registry_dependency) => {
|
DependencySpecifier::Registry(registry_dependency) => {
|
||||||
let index = if dependant.is_none() {
|
// needed because of overrides, which are expected to use the project's indices rather than URLs
|
||||||
get_index(project.indices(), Some(®istry_dependency.index))
|
let index = get_by_maybe_url(project.indices(), ®istry_dependency.index);
|
||||||
} else {
|
|
||||||
get_index_by_url(project.indices(), ®istry_dependency.index.parse()?)
|
|
||||||
};
|
|
||||||
|
|
||||||
let entry = find_version_from_index(
|
let entry = find_version_from_index(
|
||||||
&mut root,
|
&mut root,
|
||||||
|
|
Loading…
Reference in a new issue