Skip to content
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

feat: split class conversion to enable other Babel plugin conversion #100

Merged
merged 1 commit into from
May 30, 2023

Conversation

petermuessig
Copy link
Member

@petermuessig petermuessig commented May 29, 2023

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

It makes #23 and #25 working but to completely fix it, the lifecycle/architecture of the plugin needs to completely adopted as mentioned by @Elberet in his issues. But with the changes of this PR it at least can work with class decorators and the transpiling of the getters and setters.

@petermuessig petermuessig requested a review from akudev May 29, 2023 11:25
@petermuessig petermuessig force-pushed the feat/ConvertOnExit branch 2 times, most recently from 6dc111c to 5a46b58 Compare May 29, 2023 12:09
Base automatically changed from fix/TSParamProps to main May 30, 2023 08:42
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
@petermuessig petermuessig changed the title feat: convert classes to UI5 in exit phase to allow additional plugins feat: split class conversion to enable other Babel plugin conversion May 30, 2023
@petermuessig petermuessig merged commit 4ba096b into main May 30, 2023
@petermuessig petermuessig deleted the feat/ConvertOnExit branch May 30, 2023 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Property getters and setters Support for UI5-converted classes with class decorators
2 participants