-
Couldn't load subscription status.
- 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
Conversation
|
|
||
| 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; } | ||
|
|
||
| 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; } |
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.
There are a lot of these variables/whitespace changes. I had to update the Babel 7 version used in the test to a later one so that we get the same result for Babel 7 and 8.
| @@ -1,4 +1,3 @@ | |||
| import { Service } from './service'; | |||
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.
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.
| var _awsSdk = _interopRequireDefault(require("aws-sdk")); | ||
| var _dec, _dec2, _dec3, _dec4, _class; | ||
| function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } | ||
| let SomeService = exports.SomeService = (_dec = Injectable(), _dec2 = function (target, key) { |
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.
I had to copy this __module__ folder into a __module-8__ for Babel 8, because Babel 7 and 8 put the exports.SomeService = in different places.
| 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 comment
The 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 :)
4ee7567 to
0bfe46b
Compare
0bfe46b to
52c122b
Compare
| steps: | ||
| - uses: actions/checkout@v2 | ||
| - uses: actions/setup-node@v2 | ||
| - uses: actions/setup-node@v6 |
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 🤷
|
Thanks @nicolo-ribaudo , lgtm |
We are close to releasing Babel 8 stable, this PR allows this plugin to run with either Babel 7 or Babel 8.
Most of the changes are in tests, to allow testing both versions.