@@ -6,6 +6,7 @@ local Util = require("lazy.util")
66local M = {}
77
88M .patterns = { " nvim" , " treesitter" , " tree-sitter" , " cmp" , " neo" }
9+ local manifest_file = " build/manifest.lua"
910
1011function M .fetch (url , file , prefix )
1112 if not vim .uv .fs_stat (file ) then
@@ -19,11 +20,46 @@ function M.fetch(url, file, prefix)
1920 end
2021end
2122
23+ function M .split ()
24+ local lines = vim .fn .readfile (manifest_file )
25+ local id = 0
26+ local files = {} --- @type string[]
27+ while # lines > 0 do
28+ id = id + 1
29+ local part_file = " build/manifest-part-" .. id .. " .lua"
30+ local idx = math.min (# lines , 30000 )
31+ while idx < # lines and not lines [idx ]:match (" ^ },$" ) do
32+ idx = idx + 1
33+ end
34+ local part_lines = vim .list_slice (lines , 1 , idx )
35+ if idx ~= # lines then
36+ part_lines [# part_lines ] = " }}"
37+ end
38+ vim .fn .writefile (part_lines , part_file )
39+ files [# files + 1 ] = part_file
40+ print (" Wrote " .. part_file .. " \n " )
41+
42+ lines = vim .list_slice (lines , idx + 1 )
43+ if # lines == 0 then
44+ break
45+ end
46+ lines [1 ] = " repository = { " .. lines [1 ]
47+ end
48+ return files
49+ end
50+
2251--- @return RockManifest ?
2352function M .fetch_manifest ()
24- local manifest_file = " build/manifest.lua"
2553 M .fetch (" https://luarocks.org/manifest-5.1" , manifest_file )
26- return Rocks .parse (manifest_file )
54+ local ret = { repository = {} }
55+ for _ , file in ipairs (M .split ()) do
56+ local part = Rocks .parse (file )
57+ print (vim .tbl_count (part .repository or {}) .. " rocks in " .. file .. " \n " )
58+ for k , v in pairs (part .repository or {}) do
59+ ret .repository [k ] = v
60+ end
61+ end
62+ return ret
2763end
2864
2965function M .fetch_rockspec (name , version , prefix )
@@ -37,6 +73,7 @@ function M.build()
3773 local manifest = M .fetch_manifest () or {}
3874 --- @type { name : string , version : string , url : string } []
3975 local nvim_rocks = {}
76+ print (vim .tbl_count (manifest .repository or {}) .. " rocks in manifest\n " )
4077 for rock , vv in pairs (manifest .repository or {}) do
4178 local matches = false
4279 for _ , pattern in ipairs (M .patterns ) do
0 commit comments