mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
random
This commit is contained in:
@@ -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 = {} },
|
||||
|
||||
@@ -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.
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user