aboutsummaryrefslogtreecommitdiff
path: root/src/install/resolvers/folder_resolver.zig
diff options
context:
space:
mode:
authorGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-01-13 16:04:06 -0800
committerGravatar Dylan Conway <dylan.conway567@gmail.com> 2023-01-13 16:04:06 -0800
commit9c2a7c6b823162714a303df9407c86951975d144 (patch)
tree5a5fed7c796f90e181ad47c4407a9c4cbf0724d6 /src/install/resolvers/folder_resolver.zig
parent766f8ceebc76dd749ba5c104f802c7ebda289db9 (diff)
downloadbun-dylan/github-dependencies.tar.gz
bun-dylan/github-dependencies.tar.zst
bun-dylan/github-dependencies.zip
git cache folder resolverdylan/github-dependencies
Diffstat (limited to 'src/install/resolvers/folder_resolver.zig')
-rw-r--r--src/install/resolvers/folder_resolver.zig30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/install/resolvers/folder_resolver.zig b/src/install/resolvers/folder_resolver.zig
index b9e222f22..cf7b6eb05 100644
--- a/src/install/resolvers/folder_resolver.zig
+++ b/src/install/resolvers/folder_resolver.zig
@@ -71,6 +71,22 @@ pub const FolderResolution = union(Tag) {
pub fn count(_: @This(), comptime Builder: type, _: Builder, _: JSAst.Expr) void {}
};
+ pub const GitCacheFolderResolver = struct {
+ repository: Repository,
+ version_tag: Dependency.Version.Tag,
+
+ pub fn resolve(this: @This(), comptime Builder: type, _: Builder, _: JSAst.Expr) !Resolution {
+ return Resolution{
+ .tag = if (this.version_tag == .git) Resolution.Tag.git else Resolution.Tag.github,
+ .value = .{
+ .git = this.repository,
+ },
+ };
+ }
+
+ pub fn count(_: @This(), comptime Builder: type, _: Builder, _: JSAst.Expr) void {}
+ };
+
pub fn normalizePackageJSONPath(global_or_relative: GlobalOrRelative, joined: *[bun.MAX_PATH_BYTES]u8, non_normalized_path: string) [2]string {
var abs: string = "";
var rel: string = "";
@@ -257,8 +273,11 @@ pub const FolderResolution = union(Tag) {
json_bytes,
version,
Features.git,
- Resolver,
- Resolver{ .folder_path = rel },
+ GitCacheFolderResolver,
+ GitCacheFolderResolver{
+ .repository = if (version.tag == .git) version.value.git else version.value.github,
+ .version_tag = version.tag,
+ },
),
} catch |err| {
if (err == error.FileNotFound) {
@@ -323,8 +342,11 @@ pub const FolderResolution = union(Tag) {
abs,
version,
Features.git,
- Resolver,
- Resolver{ .folder_path = rel },
+ GitCacheFolderResolver,
+ GitCacheFolderResolver{
+ .repository = if (version.tag == .git) version.value.git else version.value.github,
+ .version_tag = version.tag,
+ },
),
} catch |err| {
if (err == error.FileNotFound) {