aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Alex Lam S.L <alexlamsl@gmail.com> 2023-04-30 19:45:08 +0300
committerGravatar GitHub <noreply@github.com> 2023-04-30 09:45:08 -0700
commitdd03a4f95d89a856e2fefa1450a57c082c246f53 (patch)
treead318076b15d0fba66119a50d4b251ab872c6f88 /src
parent4be3548829d6083cfe7c488eb84e310b952b88e1 (diff)
downloadbun-dd03a4f95d89a856e2fefa1450a57c082c246f53.tar.gz
bun-dd03a4f95d89a856e2fefa1450a57c082c246f53.tar.zst
bun-dd03a4f95d89a856e2fefa1450a57c082c246f53.zip
[install] handle repeated install of GitHub dependency correctly (#2780)
fixes #2602
Diffstat (limited to 'src')
-rw-r--r--src/install/install.zig21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/install/install.zig b/src/install/install.zig
index 51cdedea6..4bad3eafa 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -4818,6 +4818,21 @@ pub const PackageManager = struct {
var k: usize = 0;
while (k < new_dependencies.len) : (k += 1) {
if (new_dependencies[k].key) |key| {
+ if (!update.is_aliased and !update.resolved_name.isEmpty() and key.data.e_string.eql(
+ string,
+ update.resolved_name.slice(update.version_buf),
+ )) {
+ // This actually is a duplicate which we did not
+ // pick up before dependency resolution.
+ // For this case, we'll just swap remove it.
+ if (new_dependencies.len > 1) {
+ new_dependencies[k] = new_dependencies[new_dependencies.len - 1];
+ new_dependencies = new_dependencies[0 .. new_dependencies.len - 1];
+ } else {
+ new_dependencies = &[_]G.Property{};
+ }
+ continue;
+ }
if (key.data.e_string.eql(
string,
if (update.is_aliased)
@@ -4826,8 +4841,8 @@ pub const PackageManager = struct {
update.version.literal.slice(update.version_buf),
)) {
if (update.resolved_name.isEmpty()) {
- // This actually is a duplicate
- // like "react" appearing in both "dependencies" and "optionalDependencies"
+ // This actually is a duplicate like "react"
+ // appearing in both "dependencies" and "optionalDependencies".
// For this case, we'll just swap remove it
if (new_dependencies.len > 1) {
new_dependencies[k] = new_dependencies[new_dependencies.len - 1];
@@ -4864,7 +4879,7 @@ pub const PackageManager = struct {
logger.Loc.Empty,
).clone(allocator);
update.e_string = new_dependencies[k].value.?.data.e_string;
- continue :outer;
+ if (update.is_aliased) continue :outer;
}
}
}