woodpile: SWC AST visitor in Javascript #7721
kwonoj
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
Just to be clear, this is nothing related to writing-plugin-in-javascript. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi there, I'm a bit confused as why you're recommending What is the status of |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
https://www.npmjs.com/package/woodpile
Woodpile is a utility library to traverse SWC ASTs in Javascript. It is a thin interop layer to the SWC's rust implementation of its visitor macro, attempt to provide consistent, synchronized mechanism to traverse ASTs in Javascript as well. This package could be useful to duck typing, prototyping SWC plugin in Javascript as its interface aims to provide similar experience as SWC's visitor macro.
For those reason, this package aims correctness over performance. There are inevitable costs to exchange data between Javascript to Rust, and vice versa. If you want to achieve peak performace, you should use SWC's visitor macro directly.
This is a userland alternative to handwritten JS visitor in @swc/core for the easier ast traversing.
Usage
visit
is a main interface to traverse AST.Currently,
visit
accepts an object withvisit
property have corresponding callbacks to traverse.Beta Was this translation helpful? Give feedback.
All reactions