diff options
| author | William Boman <william@redwill.se> | 2025-05-06 02:57:26 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2025-05-06 02:57:26 +0200 |
| commit | f74983e782b7394f5737df99f8823e196a23291d (patch) | |
| tree | 15ee15a22ad4e8dff13c050a361c99f08d831212 /lua/mason-registry/sources/github.lua | |
| parent | refactor(registry): change lua registries to not instantiate Package themselves (diff) | |
| download | mason-f74983e782b7394f5737df99f8823e196a23291d.tar mason-f74983e782b7394f5737df99f8823e196a23291d.tar.gz mason-f74983e782b7394f5737df99f8823e196a23291d.tar.bz2 mason-f74983e782b7394f5737df99f8823e196a23291d.tar.lz mason-f74983e782b7394f5737df99f8823e196a23291d.tar.xz mason-f74983e782b7394f5737df99f8823e196a23291d.tar.zst mason-f74983e782b7394f5737df99f8823e196a23291d.zip | |
feat: associate package instances with registry source and record it in receipt
Diffstat (limited to 'lua/mason-registry/sources/github.lua')
| -rw-r--r-- | lua/mason-registry/sources/github.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lua/mason-registry/sources/github.lua b/lua/mason-registry/sources/github.lua index ceb503dc..5cc69023 100644 --- a/lua/mason-registry/sources/github.lua +++ b/lua/mason-registry/sources/github.lua @@ -61,7 +61,7 @@ function GitHubRegistrySource:reload() if not self:is_installed() then return end - self.buffer = _.compose(_.index_by(_.prop "name"), _.map(util.hydrate_package(self.buffer or {})))( + self.buffer = _.compose(_.index_by(_.prop "name"), _.map(util.hydrate_package(self, self.buffer or {})))( self:get_all_package_specs() ) return self.buffer @@ -160,6 +160,17 @@ function GitHubRegistrySource:get_display_name() end end +function GitHubRegistrySource:serialize() + local info = self:get_info() + return { + proto = "github", + namespace = self.spec.namespace, + name = self.spec.name, + version = info.version, + checksums = info.checksums, + } +end + function GitHubRegistrySource:__tostring() if self.spec.version then return ("GitHubRegistrySource(repo=%s, version=%s)"):format(self.repo, self.spec.version) |
