diff options
author | 2022-07-27 21:15:57 -0700 | |
---|---|---|
committer | 2022-07-27 21:15:57 -0700 | |
commit | bebce1ec63e8b08b01cbee1579a0f0b796908196 (patch) | |
tree | 6484edebc8a2b8a162d3d9bca61d1ca115d428b5 | |
parent | eea925e7e0f3904f9fae6f7e12ffb5aa87d022ae (diff) | |
download | bun-bebce1ec63e8b08b01cbee1579a0f0b796908196.tar.gz bun-bebce1ec63e8b08b01cbee1579a0f0b796908196.tar.zst bun-bebce1ec63e8b08b01cbee1579a0f0b796908196.zip |
[bun install] Fix missing lockfile data for tarballs
-rw-r--r-- | src/install/dependency.zig | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/install/dependency.zig b/src/install/dependency.zig index 2f813b3cc..f83366073 100644 --- a/src/install/dependency.zig +++ b/src/install/dependency.zig @@ -539,21 +539,21 @@ pub fn parseWithTag( }; }, .tarball => { - if (strings.indexOf(dependency, "://")) |protocol| { - if (strings.eqlComptime(dependency[0..protocol], "file")) { - return Version{ - .tag = .tarball, - .value = .{ .tarball = URI{ .local = sliced.sub(dependency[7..]).value() } }, - }; - } else if (strings.eqlComptime(dependency[0..protocol], "http") or strings.eqlComptime(dependency[0..protocol], "https")) { - return Version{ - .tag = .tarball, - .value = .{ .tarball = URI{ .remote = sliced.sub(dependency).value() } }, - }; - } else { - if (log_) |log| log.addErrorFmt(null, logger.Loc.Empty, allocator, "invalid dependency \"{s}\"", .{dependency}) catch unreachable; - return null; - } + if (strings.hasPrefixComptime(dependency, "https://") or strings.hasPrefixComptime(dependency, "http://")) { + return Version{ + .tag = .tarball, + .literal = sliced.value(), + .value = .{ .tarball = URI{ .remote = sliced.sub(dependency).value() } }, + }; + } else if (strings.hasPrefixComptime(dependency, "file://")) { + return Version{ + .tag = .tarball, + .literal = sliced.value(), + .value = .{ .tarball = URI{ .local = sliced.sub(dependency[7..]).value() } }, + }; + } else if (strings.contains(dependency, "://")) { + if (log_) |log| log.addErrorFmt(null, logger.Loc.Empty, allocator, "invalid or unsupported dependency \"{s}\"", .{dependency}) catch unreachable; + return null; } return Version{ @@ -567,7 +567,7 @@ pub fn parseWithTag( }; }, .folder => { - if (strings.indexOf(dependency, ":")) |protocol| { + if (strings.indexOfChar(dependency, ':')) |protocol| { if (strings.eqlComptime(dependency[0..protocol], "file")) { if (dependency.len <= protocol) { if (log_) |log| log.addErrorFmt(null, logger.Loc.Empty, allocator, "\"file\" dependency missing a path", .{}) catch unreachable; |