2024-06-26 00:07:26 +08:00
|
|
|
local M = {}
|
|
|
|
|
|
|
|
---@type table<string, string>
|
|
|
|
local mapping = nil
|
|
|
|
|
2024-06-26 02:38:50 +08:00
|
|
|
local function load()
|
|
|
|
if not mapping then
|
|
|
|
mapping = {}
|
|
|
|
---@type {name:string, url:string, version:string}[]
|
|
|
|
local gen = require("lazy.community._generated")
|
|
|
|
for _, rock in ipairs(gen) do
|
|
|
|
mapping[rock.name] = rock.url
|
|
|
|
end
|
2024-06-26 00:07:26 +08:00
|
|
|
end
|
2024-06-26 02:38:50 +08:00
|
|
|
return mapping
|
2024-06-26 00:07:26 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
---@param rock string
|
|
|
|
---@return string?
|
|
|
|
function M.get_url(rock)
|
2024-06-26 02:38:50 +08:00
|
|
|
return load()[rock]
|
2024-06-26 00:07:26 +08:00
|
|
|
end
|
|
|
|
|
2024-06-26 02:53:42 +08:00
|
|
|
function M.get_spec(name)
|
|
|
|
return require("lazy.community.specs")[name]
|
|
|
|
end
|
|
|
|
|
2024-06-26 00:07:26 +08:00
|
|
|
return M
|