aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/install/install.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/install/install.zig b/src/install/install.zig
index 86e0ca532..3ce46b3ce 100644
--- a/src/install/install.zig
+++ b/src/install/install.zig
@@ -1375,7 +1375,7 @@ pub const PackageManager = struct {
resolve_tasks: TaskChannel,
timestamp_for_manifest_cache_control: u32 = 0,
extracted_count: u32 = 0,
- alias_map: std.ArrayHashMapUnmanaged(PackageID, String, ArrayIdentityContext, false) = .{},
+ alias_map: std.ArrayHashMapUnmanaged(PackageID, string, ArrayIdentityContext, false) = .{},
default_features: Features = Features{},
summary: Lockfile.Package.Diff.Summary = Lockfile.Package.Diff.Summary{},
env: *DotEnv.Loader,
@@ -2069,7 +2069,11 @@ pub const PackageManager = struct {
Features.npm,
));
- try this.alias_map.put(this.allocator, package.meta.id, alias);
+ const buf = this.lockfile.buffers.string_bytes.items;
+ if (!alias.eql(name, buf, buf)) {
+ const alias_str = try this.allocator.dupe(u8, alias.slice(buf));
+ try this.alias_map.put(this.allocator, package.meta.id, alias_str);
+ }
if (!behavior.isEnabled(if (this.isRootDependency(dependency_id))
this.options.local_package_features
@@ -5530,7 +5534,7 @@ pub const PackageManager = struct {
resolution: Resolution,
) void {
const buf = this.lockfile.buffers.string_bytes.items;
- const alias = if (this.manager.alias_map.get(package_id)) |str| str.slice(buf) else name;
+ const alias = this.manager.alias_map.get(package_id) orelse name;
std.mem.copy(u8, &this.destination_dir_subpath_buf, alias);
this.destination_dir_subpath_buf[alias.len] = 0;
var destination_dir_subpath: [:0]u8 = this.destination_dir_subpath_buf[0..alias.len :0];