Use `swc_ecma_compat_es2017::async_to_generator` for conditional async transformations

Hey team, I've been working on a plugin that takes
async
functions and transforms them to generators for usage with mobx flows. I've gotten reasonably far but came across: https://docs.rs/swc_ecma_compat_es2017/latest/src/swc_ecma_compat_es2017/async_to_generator.rs.html#39-46

This transformation is exactly what i've been aiming for and would make for a far more robust solution, as what i've written so far handles the conditional cases as I expect.

The issue i'm running into is that I'd like to instantiate the AsyncToGenerator visitor to visit_children_with it when the conditions are met to perform this transformation, but async_to_generator returns Pass which does not satisfy VisitMut

Would it be reasonable to export a function that does work this way from swc_ecma_compat_es2017? Or am I down the wrong path here?
Source of the Rust file src/async_to_generator.rs.
Was this page helpful?