mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-01-09 17:29: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).
|
||||
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Change dependency types for removed peer dependencies by @daimond113
|
||||
|
||||
### Changed
|
||||
- Switch from `log` to `tracing` for logging by @daimond113
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@ pub struct DependencyGraphNode {
|
|||
pub dependencies: BTreeMap<PackageNames, (VersionId, String)>,
|
||||
/// The resolved (transformed, for example Peer -> Standard) type of the dependency
|
||||
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
|
||||
pub pkg_ref: PackageRefs,
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ impl Project {
|
|||
let depth = path.len() - 1;
|
||||
|
||||
tracing::debug!(
|
||||
"{}resolving {specifier} from {}",
|
||||
"{}resolving {specifier} ({ty:?}) from {}",
|
||||
"\t".repeat(depth),
|
||||
path.join(">")
|
||||
);
|
||||
|
@ -304,12 +304,14 @@ impl Project {
|
|||
);
|
||||
}
|
||||
|
||||
if already_resolved.resolved_ty == DependencyType::Peer
|
||||
&& resolved_ty == DependencyType::Standard
|
||||
{
|
||||
if already_resolved.resolved_ty == DependencyType::Peer {
|
||||
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 {
|
||||
already_resolved.direct = Some((alias.clone(), specifier.clone(), ty));
|
||||
}
|
||||
|
@ -326,6 +328,11 @@ impl Project {
|
|||
pkg_ref: pkg_ref.clone(),
|
||||
dependencies: Default::default(),
|
||||
resolved_ty,
|
||||
is_peer: if depth == 0 {
|
||||
false
|
||||
} else {
|
||||
ty == DependencyType::Peer
|
||||
},
|
||||
};
|
||||
insert_node(
|
||||
&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 {
|
||||
if node.is_peer && node.direct.is_none() {
|
||||
node.resolved_ty = DependencyType::Peer;
|
||||
}
|
||||
|
||||
if node.resolved_ty == DependencyType::Peer {
|
||||
tracing::warn!("peer dependency {name}@{version_id} was not resolved");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue