-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support for UI5-converted classes with class decorators #23
Comments
@Elberet I know this is old, but are you using |
Well, sometime during the past half year, I've migrated away from this plugin towards a custom set of Babel plugins... but form what I can recall: Yes, And, since That also allowed me to do a few other things right in my build pipeline, such as allowing |
Thanks for the insights @Elberet! Do you have any available examples of your final build pipeline? I'm currently looking into alternatives to work with TS + UI5. |
I wrote the thing on company time, so I'll have to check if I can put it under some OS license and put it on GitHub, but the chances of that happening are unfortunately slim to none. 😞 If you would like to follow in my footsteps, I can give some pointers tho, but it pretty much boils down to: be frugal, let other plugins do as much as possible, and keep in mind that you can always use |
Hello, I see the issue is still open and I need decorators to achieve some special logic with a JSONModel. I observe that my decorators are not being converted to JavaScript. Since I am not familiar with babel, I searched and found that I needed to add It is supposed to work ? |
No, As mentioned above, by the time |
To ensure that other plugins can be used upfront the conversion of the ES6 imports and classes to UI5 AMD-like syntax and Object.extend, the plugin now runs in the exit phase of the visitor. This allows other plugins, e.g. decorators to run before and convert the code accordingly. This plugin only sanitizes the decorators to remove the plugin proprietary ones to avoid conflicts with other plugins. Fixes #23
To ensure that other plugins can be used upfront the conversion of the ES6 imports and classes to UI5 AMD-like syntax and Object.extend, the plugin now runs in the exit phase of the visitor. This allows other plugins, e.g. decorators to run before and convert the code accordingly. This plugin only sanitizes the decorators to remove the plugin proprietary ones to avoid conflicts with other plugins. Fixes #23 fix: update plugin dependencies
To ensure that other plugins can be used upfront the conversion of the ES6 imports and classes to UI5 AMD-like syntax and Object.extend, the plugin now runs in the exit phase of the visitor. This allows other plugins, e.g. decorators to run before and convert the code accordingly. This plugin only sanitizes the decorators to remove the plugin proprietary ones to avoid conflicts with other plugins. The plugin is now also not dependent on the plugin order anymore and using the preset-env ensures a proper transpilation of code to a specific target browser set. Added tests to ensure that a proper decorator handling works when using the plugin-proposal-decorators or that e.g the conversion of getters/setters takes place when using the babel plugin named plugin-transform-property-mutators as this is not part of the preset-env by default. Updated all dependencies of the project with this change. Fixes #23 Fixes #25
To ensure that other plugins can be used upfront the conversion of the ES6 imports and classes to UI5 AMD-like syntax and Object.extend, the plugin now runs in the exit phase of the visitor. This allows other plugins, e.g. decorators to run before and convert the code accordingly. This plugin only sanitizes the decorators to remove the plugin proprietary ones to avoid conflicts with other plugins. Added tests to ensure that a proper decorator handling works when using the plugin-proposal-decorators or that e.g the conversion of getters/setters takes place when using the babel plugin named plugin-transform-property-mutators as this is not part of the preset-env by default. Updated all dependencies of the project with this change. Fixes #23 Fixes #25
…100) To ensure that other plugins can be used upfront the conversion of the ES6 imports and classes to UI5 AMD-like syntax and Object.extend, the plugin now runs in the exit phase of the visitor. This allows other plugins, e.g. decorators to run before and convert the code accordingly. This plugin only sanitizes the decorators to remove the plugin proprietary ones to avoid conflicts with other plugins. Added tests to ensure that a proper decorator handling works when using the plugin-proposal-decorators or that e.g the conversion of getters/setters takes place when using the babel plugin named plugin-transform-property-mutators as this is not part of the preset-env by default. Updated all dependencies of the project with this change. Fixes #23 Fixes #25
I'm working on a concise, easily readable API for class mixins, such as this:
mixin
is a simple wrapper that returns a decorator function; the decorator function should eventually be called by Babel's decorators API and receives a descriptor which it uses to register a finisher. The finisher function then gets called with the class' constructor function as its argument and... well, this part is still very much WIP. 😊Unfortunately,
babel-plugin-transform-classes-ui5
doesn't support the very first step: while it respects the@namespace
decorator and triggers UI5-transformation for the class, the@mixin
decorators are ignored and Babel's decorators API is not invoked.Any chance to get this working?
FWIW, Babel desugars a decorated class into something like this:
The first commented-out section is basically the usual class constructor factory, with the big difference being that method and property definitions are moved into the second commented-out section, each wrapped into a descriptor object so that the decorators API can process them further.
This indicates to me that if support for method/property decorators is omitted until some future version, supporting just class decorators should™ be fairly straight forward - just pull in Babel's decorators machinery and feed it the constructor function returned by UI5's
extend
...The text was updated successfully, but these errors were encountered: