refactor(launcher): memoize markdown.lua in manifest_loader ensure_deps
Matches the existing frontmatter.lua memoization pattern. Avoids re-dofile'ing markdown.lua per successful load_for call (matters once L.9 rolls out manifest.launcher.md to every module and the init-time call count goes from 1 to N).
This commit is contained in:
@@ -1,11 +1,14 @@
|
|||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
local fm
|
local fm, md
|
||||||
|
|
||||||
local function ensure_deps()
|
local function ensure_deps()
|
||||||
if not fm then
|
if not fm then
|
||||||
fm = dofile(engine.module.dir_of("lib-management.launcher") .. "/frontmatter.lua")
|
fm = dofile(engine.module.dir_of("lib-management.launcher") .. "/frontmatter.lua")
|
||||||
end
|
end
|
||||||
|
if not md then
|
||||||
|
md = dofile(engine.module.dir_of("lib-management.launcher") .. "/markdown.lua")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Returns:
|
-- Returns:
|
||||||
@@ -23,7 +26,6 @@ function M.load_for(module_id)
|
|||||||
if not meta then
|
if not meta then
|
||||||
return { _missing = false, _err = perr }, {}
|
return { _missing = false, _err = perr }, {}
|
||||||
end
|
end
|
||||||
local md = dofile(engine.module.dir_of("lib-management.launcher") .. "/markdown.lua")
|
|
||||||
local blocks = md.parse(body)
|
local blocks = md.parse(body)
|
||||||
return meta, blocks
|
return meta, blocks
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user