Skip to content

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

Merged
nicolo-ribaudo merged 3 commits intobabel:masterfrom
nicolo-ribaudo:decorators-class-features
Dec 9, 2018
Merged

Move decorators transform to @babel/helper-create-class-features-plugin#9059
nicolo-ribaudo merged 3 commits intobabel:masterfrom
nicolo-ribaudo:decorators-class-features

Conversation

@nicolo-ribaudo
Copy link
Copy Markdown
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
@babel-bot
Copy link
Copy Markdown
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 decorators-class-features branch from 28e07a2 to 4936b53 Compare November 22, 2018 13:56
@nicolo-ribaudo nicolo-ribaudo force-pushed the decorators-class-features branch from 4936b53 to 77e56ac Compare November 30, 2018 00:11
@nicolo-ribaudo nicolo-ribaudo force-pushed the decorators-class-features branch from 77e56ac to 886e061 Compare December 7, 2018 10:29
@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
Copy Markdown
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
Copy Markdown
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
@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

None yet

Development

Successfully merging this pull request may close these issues.

Unnecessary variable injected by class-properties plugin

3 participants