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 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)

@babel-bot

This comment has been minimized.

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 force-pushed the nicolo-ribaudo:decorators-class-features branch from 28e07a2 to 4936b53 Nov 22, 2018
@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo:decorators-class-features branch from 4936b53 to 77e56ac Nov 30, 2018
@nicolo-ribaudo nicolo-ribaudo force-pushed the nicolo-ribaudo:decorators-class-features branch from 77e56ac to 886e061 Dec 7, 2018
@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 left a comment

👍

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member Author

nicolo-ribaudo commented Dec 9, 2018

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
4 checks passed
4 checks passed
babel/repl REPL preview is available
Details
ci/circleci Your tests passed on CircleCI!
Details
codecov/project 80.72% (target 80%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Class features automation moved this from In progress to Done Dec 9, 2018
@nicolo-ribaudo nicolo-ribaudo deleted the nicolo-ribaudo:decorators-class-features branch Dec 9, 2018
@lock lock bot added the outdated 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.
Projects
3 participants
You can’t perform that action at this time.