-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve interoperability with other plugins #18
Conversation
Hello and thank you for your contribution. Sorry, I have no time to maintain my github repos, but I have an offer for you. Waiting for your answer. |
Hello @vslinko. Took some time to think about this. I'm okay with handling the merge and the publish myself (would also need to be added as a collaborator on npmjs.com), and will follow through with the teething problems of v2, but I don't wish to completely take over the maintainership of this package. |
Ok. I'll give you permissions. |
This has been sitting on my todo list for a while now, and I keep putting it off because it may or may not break somebody's build, and I may or may not have to sink a few evenings into fixing it. So I've decided to leave this PR hanging for now, until people actually start asking for it to get merged. Note to future self (or whoever): test with Next.js's test suite before merging, since they appear to be the largest non-end-user consumer of this plugin. |
@vslinko @jeremejevs I'm the lead maintainer of Next.js and got a few reports of this specific issue. I'd be happy to release this new version for you both if you add me as a maintainer. |
@timneutkens You have been invited. Thank you for your eagerness to help. |
Awesome, thanks @vslinko, I'm going to release this as a patch 👍 Since all tests pass |
@vslinko for some reason I see https://www.npmjs.com/package/babel-plugin-react-require listed under my packages, but the package itself doesn't seem to be aware than I'm one of the people that has access, disallowing me to publish. |
@timneutkens I don't know what else I can do. npmjs.com says that you have an access to write. Could you write to npmjs.com support? |
Thanks for the reply, prompted me to retry, you did nothing wrong, npm just takes a little longer than I expected to give access rights. I just published:
|
Prompted by airbnb/babel-plugin-inline-react-svg#31.
This should handle all possible scenarios now, except for the edge case outlined in
Program.exit
and for plugins which usepath.node.body.unshift
instead ofpath.unshiftContainer
. The difference is thatunshiftContainer
queues the added node for processing by other plugins, as described here, while when something is added viapath.node.body
mutation, other plugins will never learn about it, if they don't re-traverse the whole file again.path.scope.hasBinding
doesn't cut it, unfortunately, since Babel doesn't keep it up-to-date during traversal, apparently for performance reasons. A bit more info in this PR: babel/babel#6879There may be side-effects from the addition of a potentially duplicate import, but none come to my mind at the moment. Maybe this should be a new major version, as to alert people about potential breakage.