From f084598c09af33f8d0ae69a87ec0e1d82aefd0a2 Mon Sep 17 00:00:00 2001 From: Marko Vejnovic Date: Thu, 23 Oct 2025 19:32:17 -0700 Subject: [PATCH] random --- src/install/dependency.zig | 8 +++++++- src/install/hosted_git_info.zig | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/install/dependency.zig b/src/install/dependency.zig index 8bb4cc7e15..1288e7221b 100644 --- a/src/install/dependency.zig +++ b/src/install/dependency.zig @@ -279,7 +279,13 @@ pub fn withoutBuildTag(version: string) string { if (strings.indexOfChar(version, '+')) |plus| return version[0..plus] else return version; } -pub const Version = struct { +pub const ModernVersion = union(enum) { + _npa: npm_package_arg.NpaSpec, +}; + +pub const Version = ModernVersion; + +pub const LegacyVersion = struct { tag: Tag = .uninitialized, literal: String = .{}, value: Value = .{ .uninitialized = {} }, diff --git a/src/install/hosted_git_info.zig b/src/install/hosted_git_info.zig index 0d54aa3ae9..9298704e85 100644 --- a/src/install/hosted_git_info.zig +++ b/src/install/hosted_git_info.zig @@ -285,7 +285,7 @@ pub const HostedGitInfo = struct { var git_url_mut = git_url; defer if (git_url.ptr != git_url_mut.ptr) allocator.free(git_url_mut); - if (isGithubShorthand(git_url)) { + if (isGitHubShorthand(git_url)) { // In this case we have to prefix the url with `github:`. // // NOTE(markovejnovic): I don't exactly understand why this is treated specially. @@ -529,7 +529,7 @@ pub const WellDefinedProtocol = enum { /// Test whether the given node-package-arg string is a GitHub shorthand. /// /// This mirrors the implementation of hosted-git-info, though it is significantly faster. -pub fn isGithubShorthand(npa_str: []const u8) bool { +pub fn isGitHubShorthand(npa_str: []const u8) bool { // The implementation in hosted-git-info is a multi-pass algorithm. We've opted to implement a // single-pass algorithm for better performance. //