From a067fbd4bd4c73588f908843b5a1f74707a43a87 Mon Sep 17 00:00:00 2001
From: daimond113 <72147841+daimond113@users.noreply.github.com>
Date: Fri, 22 Nov 2024 15:52:54 +0100
Subject: [PATCH] fix: correctly resolve peer dependencies
---
CHANGELOG.md | 4 ++++
src/cli/commands/install.rs | 4 ++--
src/cli/commands/outdated.rs | 2 +-
src/cli/commands/publish.rs | 2 +-
src/cli/mod.rs | 4 ++--
src/download.rs | 2 +-
src/linking/mod.rs | 2 +-
src/lockfile.rs | 8 ++++----
src/resolver.rs | 23 +++++++++++++----------
9 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7dfe0a..699d394 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
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
+- Fix peer dependencies being resolved incorrectly by @daimond113
+
## [0.5.0-rc.11] - 2024-11-20
### Fixed
- Add back mistakenly removed updates check caching by @daimond113
diff --git a/src/cli/commands/install.rs b/src/cli/commands/install.rs
index 4dc7b22..3a6df0f 100644
--- a/src/cli/commands/install.rs
+++ b/src/cli/commands/install.rs
@@ -231,7 +231,7 @@ impl InstallCommand {
(
n,
v.into_iter()
- .filter(|(_, n)| n.node.ty != DependencyType::Dev)
+ .filter(|(_, n)| n.node.resolved_ty != DependencyType::Dev)
.collect(),
)
})
@@ -268,7 +268,7 @@ impl InstallCommand {
.flat_map(|versions| versions.values())
.filter(|node| node.target.bin_path().is_some())
.filter_map(|node| node.node.direct.as_ref())
- .map(|(alias, _)| alias)
+ .map(|(alias, _, _)| alias)
.filter(|alias| {
if *alias == env!("CARGO_BIN_NAME") {
log::warn!(
diff --git a/src/cli/commands/outdated.rs b/src/cli/commands/outdated.rs
index 8ca531a..828493b 100644
--- a/src/cli/commands/outdated.rs
+++ b/src/cli/commands/outdated.rs
@@ -60,7 +60,7 @@ impl OutdatedCommand {
.map(|(current_version_id, node)| {
let project = project.clone();
async move {
- let Some((alias, mut specifier)) = node.node.direct else {
+ let Some((alias, mut specifier, _)) = node.node.direct else {
return Ok::<(), anyhow::Error>(());
};
diff --git a/src/cli/commands/publish.rs b/src/cli/commands/publish.rs
index 4ae26a5..57872c8 100644
--- a/src/cli/commands/publish.rs
+++ b/src/cli/commands/publish.rs
@@ -81,7 +81,7 @@ impl PublishCommand {
.filter_map(|(_, node)| node.node.direct.as_ref().map(|_| node))
.any(|node| {
node.target.build_files().is_none()
- && !matches!(node.node.ty, DependencyType::Dev)
+ && !matches!(node.node.resolved_ty, DependencyType::Dev)
})
{
anyhow::bail!("roblox packages may not depend on non-roblox packages");
diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index 5c68e5e..fc2bdba 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -79,7 +79,7 @@ pub async fn up_to_date_lockfile(project: &Project) -> anyhow::Result