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 fm
|
||||
local fm, md
|
||||
|
||||
local function ensure_deps()
|
||||
if not fm then
|
||||
fm = dofile(engine.module.dir_of("lib-management.launcher") .. "/frontmatter.lua")
|
||||
end
|
||||
if not md then
|
||||
md = dofile(engine.module.dir_of("lib-management.launcher") .. "/markdown.lua")
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns:
|
||||
@@ -23,7 +26,6 @@ function M.load_for(module_id)
|
||||
if not meta then
|
||||
return { _missing = false, _err = perr }, {}
|
||||
end
|
||||
local md = dofile(engine.module.dir_of("lib-management.launcher") .. "/markdown.lua")
|
||||
local blocks = md.parse(body)
|
||||
return meta, blocks
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user