speedskater / babel-plugin-rewire

A babel plugin adding the ability to rewire module dependencies. This enables to mock modules for testing purposes.
843 stars 90 forks source link

Compatibility fixes for Babel 7 #211

Closed NilSet closed 5 years ago

NilSet commented 6 years ago

Fixed an issue where modules were interpreted as commonjs even when es6 Removed direct imports of babel-types and babel-template

Fixes #209 maybe

NilSet commented 6 years ago

@speedskater I just noticed the version-1.1.0 branch. Should I have based this off of that branch?

damassi commented 6 years ago

Can confirm this PR works in our new Babel 7 codebase

speedskater commented 6 years ago

@NilSet, @ilias-t, @damassi thank you all for your work on this pull request. I am currently not in the office but I will review it tomorrow in the evening. Regarding the branch, i think the current branch would indeed be version-1.1.0 branch. Neverthless I will try to merge the version 1.1.0 branch into master and than using this PR an if possible some other open PRs to create a 1.2.0 branch and based on this a 1.2.0-RC1.

Regarding the var/const/let issues I would propose to remain with the vars until we reach babel 7 support, and to tackle this in a separate branch/PR.

Is this procedure okay for you?

damassi commented 6 years ago

That would be fantastic, thanks @speedskater 👍

NilSet commented 6 years ago

I have a rebase onto 1.1.0 mostly done. I may switch to a less hacky solution for the template placeholder thing.

NilSet commented 6 years ago

I'll keep this pointed at master, but compare the branch with version-1.1.0 to see only my changes

speedskater commented 6 years ago

@NilSet thanks again for you PR. I have merged it into the 1.2.0 branch and puglished 1.2.0-rc.1 and on npm as a prerelease. Could you all please test this release in your code bases. If I won't get any negativ feedback till next monday I will convert it to the final 1.2.0 and will then merge it onto master. @damassi could you please test it in your babel 7 codebase ?

speedskater commented 6 years ago

@NilSet I also added you as a contributor to the README. I hope this is okay with you?

NilSet commented 6 years ago

1.2.0-rc.1 seems to be working great!

NilSet commented 6 years ago

@speedskater How has the feedback been? Do we look ok to merge version-1.2.0 into master and release it as latest?

augbog commented 6 years ago

Also curious about the progress of this? Would love to see this merged :)

villesau commented 6 years ago

Would love to see this merged!

adamnoakes commented 5 years ago

I've tried 1.2.0-rc.1 with the 7.0.0 babel release and am having an issue

export { _get__2 as __get__, _get__2 as __GetDependency__, _set__2 as __Rewire__, _set__2 as __set__, _reset__2 as __ResetDependency__, _RewireAPI__2 as __RewireAPI__ };
^^^^^^

SyntaxError: Unexpected token export

Has anyone else tried with 7.0.0?

miguel-orange commented 5 years ago

@adamnoakes - I've tested with babel 7, seems to be working.

ilias-t commented 5 years ago

Commit history doesn't look clean, @NilSet are you pointing to the correct branch or maybe to rebase again?

adamnoakes commented 5 years ago

@miguel-orange i done some more investigation and it works ok for me when i use babel cli but when using babel register i get the issues, not sure if it's an issue with this, babel register or my setup. Are you using babel-register?

When i remove this plugin, everything compiles fine using babel-register.

kibertoad commented 5 years ago

@speedskater Does this still need anything to be done before it can be merged to master?

damassi commented 5 years ago

@speedskater has unfortunately gone missing :( That said, the rc candidate release works great.

speedskater commented 5 years ago

@kibertoad @damassi sorry for beeing not available for the project over the last month and neglecting the project. Unfortunately, I am currently changing jobs and finishing my PhD thesis at the same time. Therefore it won't get better soon. I hope I will be able to contribute some improvement in the future, but it will take some time. In the meantime I will add a former coworker of mine as a contributer to the project, so he will be able to provide bugfixes.