Use _quarto.modules registry instead of redundant module requires in filters#14702
Open
cderv wants to merge 6 commits into
Open
Use _quarto.modules registry instead of redundant module requires in filters#14702cderv wants to merge 6 commits into
cderv wants to merge 6 commits into
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
editor-support crossref runs quarto-init.lua then crossref.lua as two separate pandoc --lua-filter args. quarto-init.lua's Meta handler (read_includes) runs before crossref.lua ever imports import_all.lua, so _quarto.modules was nil at that point. Revert to a local require.
Member
|
This is a really great LLM task! Maybe it's worth taking a longer look at the Lua files and trying to move more of those files out. Although, make sure to remember that these Lua changes are not truly tested in the test suite, and that we should probably do a bit of manual testing with the actual software bundle. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When packaging the Lua filter bundle, Pandoc's Lua interpreter enforces a 200 top-level-local-variable limit (
MAXVARS) across all inlined filter files.mainis already at that ceiling with zero headroom, which surfaced while evaluating room to bump the bundled Pandoc to 3.10.modules/import_all.luaalready centralizes mostmodules/*requires into a single_quarto.modulesregistry table, at no additional local-slot cost no matter how many modules get registered. But ~24 inlined filter files still redundantly re-required the same modules (constants,patterns,lightbox,scope,typst) as fresh top-level locals instead of referencing the existing registry - each costing one slot in the shared budget.This replaces those redundant
local X = require("modules/Y")aliases with direct_quarto.modules.Yaccess at every call site. Pure access-path change to an already-loaded singleton table - no logic or API change.26 alias declarations removed across 24 files. Packaged bundle
main.luatop-level local count drops from ~200 to 173.Verified manually: packaged
quarto checkpasses with no "too many local variables" error, packaged renders of lightbox (HTML) and typst (PDF) fixtures succeed, and smoke-all chunks covering the edited filters (2022, 2023/01) pass locally.Follow up on #14664 where we hit the limit