refactor: Plugin.requires => Plugin.dependencies

This commit is contained in:
Folke Lemaitre 2022-11-29 14:27:04 +01:00
parent 0f5ceb9012
commit 7328e290ba
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
2 changed files with 5 additions and 5 deletions

View File

@ -61,8 +61,8 @@ function M.load(plugins, reason, opts)
Util.track({ plugin = plugin.name, start = reason.start }) Util.track({ plugin = plugin.name, start = reason.start })
M.packadd(plugin, opts and opts.load_start) M.packadd(plugin, opts and opts.load_start)
if plugin.requires then if plugin.dependencies then
M.load(plugin.requires, {}) M.load(plugin.dependencies, {})
end end
if plugin.config then if plugin.config then

View File

@ -40,10 +40,10 @@ M.dirty = false
---@field dir string ---@field dir string
---@field enabled? boolean|(fun():boolean) ---@field enabled? boolean|(fun():boolean)
---@field opt? boolean ---@field opt? boolean
---@field requires? string[] ---@field dependencies? string[]
---@field _ LazyPluginState ---@field _ LazyPluginState
---@alias LazySpec string|LazyPlugin|LazySpec[]|{requires:LazySpec} ---@alias LazySpec string|LazyPlugin|LazySpec[]|{dependencies:LazySpec}
---@class LazySpecLoader ---@class LazySpecLoader
---@field modname string ---@field modname string
@ -103,7 +103,7 @@ function Spec:normalize(spec, results)
elseif spec.enabled == nil or spec.enabled == true or (type(spec.enabled) == "function" and spec.enabled()) then elseif spec.enabled == nil or spec.enabled == true or (type(spec.enabled) == "function" and spec.enabled()) then
---@cast spec LazyPlugin ---@cast spec LazyPlugin
local plugin = self:add(spec) local plugin = self:add(spec)
plugin.requires = plugin.requires and self:normalize(plugin.requires, {}) or nil plugin.dependencies = plugin.dependencies and self:normalize(plugin.dependencies, {}) or nil
table.insert(results, plugin.name) table.insert(results, plugin.name)
end end
return results return results