mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-21 20:11:06 +00:00
perf(extras): never load nested extras
This commit is contained in:
parent
76cb567e5c
commit
8764dfbc8f
1 changed files with 26 additions and 1 deletions
|
|
@ -111,15 +111,40 @@ function M.fix_imports()
|
|||
)
|
||||
spec.import = rename
|
||||
end
|
||||
local dep = M.deprecated_extras[spec and spec.import]
|
||||
local dep = M.deprecated_extras[spec.import]
|
||||
if dep then
|
||||
dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning."
|
||||
LazyVim.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 })
|
||||
return false
|
||||
end
|
||||
|
||||
local modname = spec.import
|
||||
if type(modname) == "string" and vim.startswith(modname, "lazyvim.plugins.extras.") then
|
||||
M.single_import(spec)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
---@param spec LazySpecImport
|
||||
function M.single_import(spec)
|
||||
local modname = spec.import
|
||||
if type(modname) ~= "string" then
|
||||
return
|
||||
end
|
||||
spec.name = modname
|
||||
spec.import = function()
|
||||
package.loaded[modname] = nil
|
||||
local ok, mod, foo = pcall(require, modname) ---@type boolean, table?, unknown
|
||||
if ok and type(mod) == "table" then
|
||||
if foo then
|
||||
return nil, "Spec module returned more than one value. Expected a single value."
|
||||
end
|
||||
return mod
|
||||
end
|
||||
return nil, mod
|
||||
end
|
||||
end
|
||||
|
||||
function M.fix_renames()
|
||||
---@param plugin LazyPluginSpec
|
||||
Meta.add = LazyVim.inject.args(Meta.add, function(self, plugin)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue