Closed millermedeiros closed 9 years ago
see #216
I guess we don't need to deprecate it, just change the documentation and explain the problem.. let people know that it is mainly if you want to loop over the whole tree and that [transform|token|node]
plugin methods are only for editing the tokens and adding/removing WhiteSpace
/Indent
/LineBreak
tokens and should not be used to change the AST structure otherwise it will release ZALGO.
the current implementation is naive, if you modify the AST by adding/removing new nodes or reordering the nodes you might get the wrong output since
rocambole.moonwalk
won't have the correctnode.level
reference.I think it's a better idea to introduce the concept of
pipe
and/or ask plugin authors to usestringBefore
andstringAfter
instead.transformBefore
andtransformAfter
was a premature optimization that went wrong.