babel / babylon

PSA: moved into babel/babel as @babel/parser -->

Home Page:https://github.com/babel/babel/tree/master/packages/babel-parser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to create a custom babylon plugin?

janryWang opened this issue · comments

commented

I see the plugins are now coupled in this directory, https://github.com/babel/babylon/tree/master/src/plugins,
I want to create a plugin with a separate repository

commented

Hey @janryWang! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

commented

@hzoo Because i want to develop a private unofficial babylon plugin that is dedicated to helping me parse the code.But I did not find babylon had this ability.

We do not support external plugins in babylon. We already have a lot of work in maintaining all the internal plugins and the project itself and if we would make the current plugin api available to the public we would need to be way more careful when changing things in babylon. Right now most changes would be breaking changes if the plugin API would be public, as we very often need to change stuff around and we would not be able to guarantee a stable API or make every single release a major one.

commented

Thanks @danez , But I still hope that babylon has external scalability. Can you consider supporting this ability in the future?

As suggested in the readme, you can fork Babylon and implement your own plugin (if you need examples, you can check the files in src/plugins).

It is very unlikely that we will ever support a plugin system, since lots of bugfix and new features need the internal methods (that would be exposed to external plugins) to be changed: there would be breaking changes in almost every release. 😅

commented

https://github.com/babel/babylon#faq

We should write a better guide on how to do it but yeah