mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-01-10 01:39:10 +00:00
fix: change dependency types for removed peers
Some checks are pending
Test & Lint / lint (push) Waiting to run
Some checks are pending
Test & Lint / lint (push) Waiting to run
This commit is contained in:
parent
78976834b2
commit
60fb68fcf3
3 changed files with 22 additions and 5 deletions
|
@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
### Fixed
|
||||||
|
- Change dependency types for removed peer dependencies by @daimond113
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Switch from `log` to `tracing` for logging by @daimond113
|
- Switch from `log` to `tracing` for logging by @daimond113
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ pub struct DependencyGraphNode {
|
||||||
pub dependencies: BTreeMap<PackageNames, (VersionId, String)>,
|
pub dependencies: BTreeMap<PackageNames, (VersionId, String)>,
|
||||||
/// The resolved (transformed, for example Peer -> Standard) type of the dependency
|
/// The resolved (transformed, for example Peer -> Standard) type of the dependency
|
||||||
pub resolved_ty: DependencyType,
|
pub resolved_ty: DependencyType,
|
||||||
|
/// Whether the resolved type should be Peer if this isn't depended on
|
||||||
|
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
|
||||||
|
pub is_peer: bool,
|
||||||
/// The package reference
|
/// The package reference
|
||||||
pub pkg_ref: PackageRefs,
|
pub pkg_ref: PackageRefs,
|
||||||
}
|
}
|
||||||
|
|
|
@ -179,7 +179,7 @@ impl Project {
|
||||||
let depth = path.len() - 1;
|
let depth = path.len() - 1;
|
||||||
|
|
||||||
tracing::debug!(
|
tracing::debug!(
|
||||||
"{}resolving {specifier} from {}",
|
"{}resolving {specifier} ({ty:?}) from {}",
|
||||||
"\t".repeat(depth),
|
"\t".repeat(depth),
|
||||||
path.join(">")
|
path.join(">")
|
||||||
);
|
);
|
||||||
|
@ -304,12 +304,14 @@ impl Project {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if already_resolved.resolved_ty == DependencyType::Peer
|
if already_resolved.resolved_ty == DependencyType::Peer {
|
||||||
&& resolved_ty == DependencyType::Standard
|
|
||||||
{
|
|
||||||
already_resolved.resolved_ty = resolved_ty;
|
already_resolved.resolved_ty = resolved_ty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ty == DependencyType::Peer && depth == 0 {
|
||||||
|
already_resolved.is_peer = true;
|
||||||
|
}
|
||||||
|
|
||||||
if already_resolved.direct.is_none() && depth == 0 {
|
if already_resolved.direct.is_none() && depth == 0 {
|
||||||
already_resolved.direct = Some((alias.clone(), specifier.clone(), ty));
|
already_resolved.direct = Some((alias.clone(), specifier.clone(), ty));
|
||||||
}
|
}
|
||||||
|
@ -326,6 +328,11 @@ impl Project {
|
||||||
pkg_ref: pkg_ref.clone(),
|
pkg_ref: pkg_ref.clone(),
|
||||||
dependencies: Default::default(),
|
dependencies: Default::default(),
|
||||||
resolved_ty,
|
resolved_ty,
|
||||||
|
is_peer: if depth == 0 {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
ty == DependencyType::Peer
|
||||||
|
},
|
||||||
};
|
};
|
||||||
insert_node(
|
insert_node(
|
||||||
&mut graph,
|
&mut graph,
|
||||||
|
@ -388,8 +395,12 @@ impl Project {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (name, versions) in &graph {
|
for (name, versions) in &mut graph {
|
||||||
for (version_id, node) in versions {
|
for (version_id, node) in versions {
|
||||||
|
if node.is_peer && node.direct.is_none() {
|
||||||
|
node.resolved_ty = DependencyType::Peer;
|
||||||
|
}
|
||||||
|
|
||||||
if node.resolved_ty == DependencyType::Peer {
|
if node.resolved_ty == DependencyType::Peer {
|
||||||
tracing::warn!("peer dependency {name}@{version_id} was not resolved");
|
tracing::warn!("peer dependency {name}@{version_id} was not resolved");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue