jayphelps / core-decorators

Library of stage-0 JavaScript decorators (aka ES2016/ES7 decorators but not accurate) inspired by languages that come with built-ins like @​override, @​deprecate, @​autobind, @​mixin and more. Popular with React/Angular, but is framework agnostic.
MIT License
4.51k stars 262 forks source link

Upgrade to latest, stage 2 spec #84

Open jayphelps opened 8 years ago

jayphelps commented 8 years ago

Latest spec was just approved to stage 2: http://tc39.github.io/proposal-decorators/

Babel may or may not start supporting this spec. It's a non-trivial change and compared to most specs to date, fairly complicated, so I wouldn't be surprised if they continue to be too scared of churn to implement it. https://phabricator.babeljs.io/T2645

That said, I think I'll start trying to implement this anyway mostly so I can see if I can support both the old and new specs in the same library. I'm skeptical that I can.

jkrems commented 8 years ago

If you're just looking to play around / test out how it might work against the stage-2 spec, I did an initial implementation of a transform for babel 6 here: https://github.com/jkrems/babel-plugin-transform-decorators-stage-2-initial

(Note: class decorators are only partially implemented but method decorators should work mostly according to spec.)

jayphelps commented 8 years ago

@jkrems that's sweet! I will indeed take a look. Thanks for letting me know.

kevinSuttle commented 8 years ago

@jayphelps Seems they moved back to GitHub: https://github.com/babel/babel/issues/2645

peey commented 7 years ago

@jayphelps Babel has begun work on upgrading to stage 2 spec. We may not support the older spec in next major release. Would you like to join the discussion on Babel's slack? I've sent you an invite. (To anyone else who wants to join, you can get a slack invite from here and the discussion channel is #proposal-decorators)

As a decorators library author it'd be useful to get your thoughts on migration from stage 0 spec to stage 2 spec.

jayphelps commented 7 years ago

@peey thanks! Sorry I forgot to comment here, but I did visit the channel and do still plan to update core-decorators to be stage-2 compliant when a compiler (babel or TS) supports it 👍