Optimise AST parsing
Closed this issue · 0 comments
davestewart commented
Background
When testing NCA on Pinia ORM's docs, setup fails when attempting to process an element's props.
Not only that, but parsing the entire document hits transformed code blocks, which contain a LOT of child elements!
So it looks like the strategy to visit all nodes needs more work 😬
Proposal
When visiting nodes we need to know:
- should its children be processed?
- should its attributes be processed?
- could this element have an asset link?
Regardless of whether we continue with the "process all tags" approach, to optimise we'll need to know which HTML tags could be optimised against unnecessary traversal, for example, code
and pre
.
Likely known HTML tags should be added to a list and this should be checked against.
Notes
The alternative to processing all elements would be to go back to only processing configured known and custom elements.