perf(plugin): minor optim to resolve imports a bit faster

This commit is contained in:
Folke Lemaitre 2024-07-01 07:07:49 +02:00
parent 1fad61712b
commit a9d7ade203
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 13 additions and 8 deletions

View file

@ -150,8 +150,11 @@ function Spec:import(spec)
local modspecs = {}
if type(import) == "string" then
Util.lsmod(import, function(modname)
Util.lsmod(import, function(modname, modpath)
modspecs[#modspecs + 1] = modname
package.preload[modname] = function()
return loadfile(modpath)()
end
end)
table.sort(modspecs)
else