mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-04-19 21:06:46 +00:00
fix(pkg): correctly pre-load package specs and remove them when needed during resolve
This commit is contained in:
parent
d7bc9ce11a
commit
93552cd18e
6 changed files with 87 additions and 38 deletions
|
@ -29,24 +29,27 @@ function M.get(plugin)
|
|||
end
|
||||
|
||||
---@type RockSpec?
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
local rockspec = {}
|
||||
local ret, err = loadfile(rockspec_file, "t", rockspec)
|
||||
if not ret then
|
||||
local load, err = loadfile(rockspec_file, "t", rockspec)
|
||||
if not load then
|
||||
error(err)
|
||||
end
|
||||
ret()
|
||||
return rockspec
|
||||
and rockspec.package
|
||||
load()
|
||||
|
||||
---@param dep string
|
||||
local rocks = vim.tbl_filter(function(dep)
|
||||
local name = dep:gsub("%s.*", "")
|
||||
return not vim.tbl_contains(M.skip, name)
|
||||
end, rockspec and rockspec.dependencies or {})
|
||||
|
||||
return #rocks > 0
|
||||
and {
|
||||
source = "rockspec",
|
||||
file = rockspec_file,
|
||||
spec = {
|
||||
dir = plugin.dir,
|
||||
url = plugin.url,
|
||||
rocks = vim.tbl_filter(function(dep)
|
||||
local name = dep:gsub("%s.*", "")
|
||||
return not vim.tbl_contains(M.skip, name)
|
||||
end, rockspec.dependencies),
|
||||
plugin.name,
|
||||
rocks = rocks,
|
||||
},
|
||||
}
|
||||
or nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue