Skip to content
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

Move decorators transform to @babel/helper-create-class-features-plugin #9059

Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented Nov 21, 2018

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

This PR moves the modern decorator transformer (I don't think that I will move the legacy transformer) to @babel/plugin-class-features. I didn't add support for decorators on private elements yet, but it will come after this PR.

Al the functions inside packages/babel-plugin-class-features/src/decorators.js have been copy-pasted from packages/babel-plugin-proposal-decorators/src/transform.js, except for:

  • hasDecorators and hasOwnDecorators, which are new;
  • extractElementDescriptor (formerly getSingleElementDefinition): I changed the order of the parameters and added a path.remove() call which previously was in another place;
  • buildDecoratedClass (formerly transformClass), which has been largely modified;
  • The insertInitializeInstanceElements, bareSupersVisitor, getConstructorPath and getElementsDefinitions functions has been removed sicne they are no more needed.

This PR didn't change any test (as expected), except for two unused variables which have been removed (EDIT: It looks like I fixed #6916)

@nicolo-ribaudo nicolo-ribaudo added PR: Internal 🏠 A type of pull request used for our changelog categories Spec: Decorators labels Nov 21, 2018
@nicolo-ribaudo nicolo-ribaudo added this to In progress in Class features Nov 21, 2018
@babel-bot
Copy link
Collaborator

babel-bot commented Nov 21, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/9493/

@nicolo-ribaudo nicolo-ribaudo changed the title Move decorators transform to @babel/plugin-class-features Move decorators transform to @babel/helper-create-class-features-plugin Dec 7, 2018
Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@nicolo-ribaudo
Copy link
Member Author

I'm merging this since it is mainly moving code around; I will open a follow up PR to implement private & decorators soon.

@nicolo-ribaudo nicolo-ribaudo merged commit d1d3c82 into babel:master Dec 9, 2018
Class features automation moved this from In progress to Done Dec 9, 2018
@nicolo-ribaudo nicolo-ribaudo deleted the decorators-class-features branch December 9, 2018 11:30
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 4, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Oct 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Internal 🏠 A type of pull request used for our changelog categories Spec: Decorators
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Unnecessary variable injected by class-properties plugin
3 participants