What's the problem?
For example, if my mdast/hdast plugin will generate esm export: export const toc = [...] based on the heading it visited. When a document has no heading, it will never be triggered, thus no export generated. Under this case, there's no simple way to "run exactly once", or "run at least once".
Previously, it's done by directly injecting it after visit, but Satteri plugins don't have this concept.
What's the proposed solution?
Support a root visitor, it will run exactly once for every document, even if empty.
Participation
What's the problem?
For example, if my mdast/hdast plugin will generate esm export:
export const toc = [...]based on the heading it visited. When a document has no heading, it will never be triggered, thus no export generated. Under this case, there's no simple way to "run exactly once", or "run at least once".Previously, it's done by directly injecting it after visit, but Satteri plugins don't have this concept.
What's the proposed solution?
Support a root visitor, it will run exactly once for every document, even if empty.
Participation