local M = { root = nil, sources = {} } local uv = vim.uv or vim.loop -- Neovim inserts its runtimepath searcher ahead of the package.path one, so an -- installed copy of arti-pack resolves before the working tree. Claim the first -- slot for the repository instead. function M.install(root) M.root = root table.insert(package.loaders, 1, function(name) local rel = name:gsub('%.', '/') for _, candidate in ipairs({ root .. '/lua/' .. rel .. '.lua', root .. '/lua/' .. rel .. '/init.lua', root .. '/' .. rel .. '.lua', }) do if uv.fs_stat(candidate) then M.sources[name] = candidate return assert(loadfile(candidate)) end end return nil end) end return M