-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: convert classes to UI5 in exit phase to allow additional plugins
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
- Loading branch information
1 parent
c88dac0
commit 5a46b58
Showing
17 changed files
with
15,042 additions
and
8,361 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Controller from "sap/ui/core/mvc/Controller"; | ||
import { mixin } from "../lib/decorators"; | ||
import RoutingSupport from "../lib/RoutingSupport"; | ||
|
||
@mixin(RoutingSupport) | ||
export default class AppController extends Controller { | ||
/* ... */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Controller from "sap/ui/core/mvc/Controller"; | ||
import { mixin } from "../lib/decorators"; | ||
import RoutingSupport from "../lib/RoutingSupport"; | ||
|
||
@namespace("example.controller") | ||
@mixin(RoutingSupport) | ||
export default class AppController extends Controller { | ||
/* ... */ | ||
} |
Empty file.
Empty file.
16 changes: 16 additions & 0 deletions
16
packages/plugin/__test__/fixtures/preset-env/preset-env-property-mutators.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// This conversion will be run with preset env set to ie >= 11. | ||
// In general, we want to ensure that the class transform does not get applied before out own. | ||
|
||
import SAPClass from "sap/class"; | ||
|
||
/** | ||
* @name my.MyClass | ||
*/ | ||
export default class MyClass extends SAPClass { | ||
get thing() { | ||
return this._thing; | ||
} | ||
set thing(value) { | ||
this._thing = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.