This commit is contained in:
Marko Vejnovic
2025-10-23 19:32:17 -07:00
parent f78ca88ab0
commit f084598c09
2 changed files with 9 additions and 3 deletions

View File

@@ -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 = {} },

View File

@@ -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.
//