-
Notifications
You must be signed in to change notification settings - Fork 18
✨ Support Babel 8 #71
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import { metadataVisitor } from './metadata/metadataVisitor'; | |
|
|
||
| export default declare( | ||
| (api: any): PluginObj => { | ||
| api.assertVersion(7); | ||
| api.assertVersion("^7.0.0 || ^8.0.0-0"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual change that makes the plugin work in Babel 8. No changes needed, other than not asserting that we are not using it :) |
||
|
|
||
| return { | ||
| visitor: { | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,52 +1,42 @@ | ||
| var _dec, _dec2, _dec3, _class, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _dec17, _dec18, _class2, _class3, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _dec25, _dec26, _class4, _class5; | ||
|
|
||
| function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; } | ||
|
|
||
| var _dec, _dec2, _dec3, _class, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec0, _dec1, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _dec16, _class2, _class3, _dec17, _dec18, _dec19, _dec20, _dec21, _dec22, _dec23, _dec24, _class4, _class5; | ||
| function _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; } | ||
| class Injected {} | ||
|
|
||
| let MyClass = (_dec = function (target, key) { | ||
| return inject()(target, undefined, 0); | ||
| }, _dec2 = Reflect.metadata("design:type", Function), _dec3 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected]), _dec(_class = _dec2(_class = _dec3(_class = class MyClass { | ||
| constructor(parameter) {} | ||
|
|
||
| }) || _class) || _class) || _class); | ||
| let MyOtherClass = (_dec4 = function (target, key) { | ||
| return inject()(target, undefined, 0); | ||
| }, _dec5 = function (target, key) { | ||
| return inject('KIND')(target, undefined, 1); | ||
| }, _dec6 = Reflect.metadata("design:type", Function), _dec7 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Injected === "undefined" ? Object : Injected]), _dec8 = function (target, key) { | ||
| return demo()(target, key, 0); | ||
| }, _dec9 = Reflect.metadata("design:type", Function), _dec10 = Reflect.metadata("design:paramtypes", [String, void 0]), _dec11 = decorate('named'), _dec12 = function (target, key) { | ||
| }, _dec9 = Reflect.metadata("design:type", Function), _dec0 = Reflect.metadata("design:paramtypes", [String, void 0]), _dec1 = decorate('named'), _dec10 = function (target, key) { | ||
| return inject()(target, key, 0); | ||
| }, _dec13 = function (target, key) { | ||
| }, _dec11 = function (target, key) { | ||
| return arg()(target, key, 1); | ||
| }, _dec14 = Reflect.metadata("design:type", Function), _dec15 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Schema === "undefined" ? Object : Schema]), _dec16 = function (target, key) { | ||
| }, _dec12 = Reflect.metadata("design:type", Function), _dec13 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Schema === "undefined" ? Object : Schema]), _dec14 = function (target, key) { | ||
| return argObjectSpread()(target, key, 0); | ||
| }, _dec17 = Reflect.metadata("design:type", Function), _dec18 = Reflect.metadata("design:paramtypes", [typeof SchemaObjectSpread === "undefined" ? Object : SchemaObjectSpread]), _dec4(_class2 = _dec5(_class2 = _dec6(_class2 = _dec7(_class2 = (_class3 = class MyOtherClass { | ||
| }, _dec15 = Reflect.metadata("design:type", Function), _dec16 = Reflect.metadata("design:paramtypes", [typeof SchemaObjectSpread === "undefined" ? Object : SchemaObjectSpread]), _dec4(_class2 = _dec5(_class2 = _dec6(_class2 = _dec7(_class2 = (_class3 = class MyOtherClass { | ||
| constructor(parameter, otherParam) { | ||
| this.parameter = parameter; | ||
| } | ||
|
|
||
| methodUndecorated(param, otherParam) {} | ||
|
|
||
| method(param, schema) {} | ||
|
|
||
| methodWithObjectSpread({ | ||
| name | ||
| }) {} | ||
|
|
||
| }, (_applyDecoratedDescriptor(_class3.prototype, "methodUndecorated", [_dec8, _dec9, _dec10], Object.getOwnPropertyDescriptor(_class3.prototype, "methodUndecorated"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "method", [_dec11, _dec12, _dec13, _dec14, _dec15], Object.getOwnPropertyDescriptor(_class3.prototype, "method"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "methodWithObjectSpread", [_dec16, _dec17, _dec18], Object.getOwnPropertyDescriptor(_class3.prototype, "methodWithObjectSpread"), _class3.prototype)), _class3)) || _class2) || _class2) || _class2) || _class2); | ||
| let DecoratedClass = (_dec19 = function (target, key) { | ||
| }, _applyDecoratedDescriptor(_class3.prototype, "methodUndecorated", [_dec8, _dec9, _dec0], Object.getOwnPropertyDescriptor(_class3.prototype, "methodUndecorated"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "method", [_dec1, _dec10, _dec11, _dec12, _dec13], Object.getOwnPropertyDescriptor(_class3.prototype, "method"), _class3.prototype), _applyDecoratedDescriptor(_class3.prototype, "methodWithObjectSpread", [_dec14, _dec15, _dec16], Object.getOwnPropertyDescriptor(_class3.prototype, "methodWithObjectSpread"), _class3.prototype), _class3)) || _class2) || _class2) || _class2) || _class2); | ||
| let DecoratedClass = (_dec17 = function (target, key) { | ||
| return inject()(target, undefined, 0); | ||
| }, _dec20 = function (target, key) { | ||
| }, _dec18 = function (target, key) { | ||
| return inject()(target, undefined, 1); | ||
| }, _dec21 = Reflect.metadata("design:type", Function), _dec22 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Injected === "undefined" ? Object : Injected]), _dec23 = decorate('example'), _dec24 = function (target, key) { | ||
| }, _dec19 = Reflect.metadata("design:type", Function), _dec20 = Reflect.metadata("design:paramtypes", [typeof Injected === "undefined" ? Object : Injected, typeof Injected === "undefined" ? Object : Injected]), _dec21 = decorate('example'), _dec22 = function (target, key) { | ||
| return inject()(target, key, 0); | ||
| }, _dec25 = Reflect.metadata("design:type", Function), _dec26 = Reflect.metadata("design:paramtypes", [String]), Decorate(_class4 = _dec19(_class4 = _dec20(_class4 = _dec21(_class4 = _dec22(_class4 = (_class5 = class DecoratedClass { | ||
| }, _dec23 = Reflect.metadata("design:type", Function), _dec24 = Reflect.metadata("design:paramtypes", [String]), Decorate(_class4 = _dec17(_class4 = _dec18(_class4 = _dec19(_class4 = _dec20(_class4 = (_class5 = class DecoratedClass { | ||
| constructor(module, otherModule) { | ||
| this.module = module; | ||
| } | ||
|
|
||
| method(param) {} | ||
|
|
||
| }, (_applyDecoratedDescriptor(_class5.prototype, "method", [_dec23, _dec24, _dec25, _dec26], Object.getOwnPropertyDescriptor(_class5.prototype, "method"), _class5.prototype)), _class5)) || _class4) || _class4) || _class4) || _class4) || _class4); | ||
| }, _applyDecoratedDescriptor(_class5.prototype, "method", [_dec21, _dec22, _dec23, _dec24], Object.getOwnPropertyDescriptor(_class5.prototype, "method"), _class5.prototype), _class5)) || _class4) || _class4) || _class4) || _class4) || _class4); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| import { Service } from './service'; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This variable was unused in the test, both in types and values, and Babel 7 and 8 have different behavior (Babel 7 removes it, Babel 8 keeps it). Given that it's not relevant for the test, I deleted it from the input just to avoid having two different outputs. |
||
| import { Decorate } from './Decorate'; | ||
|
|
||
| const sym = Symbol(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v2 doesn't work anymore, I'm getting error 400 🤷