babel-plugin-angularjs-annotate
babel-plugin-angularjs-annotate copied to clipboard
remove/reuse existing $inject expressions
The following test-case from the original ng-annotate does not yet pass with the Babel plugin:
Ctrl1.$inject = ["serviceName"];
// @ngInject
// already has .$inject array (before function definition)
function Ctrl1(a) {
}
// @ngInject
// already has .$inject array (after function definition)
function Ctrl2(a) {
}
Ctrl2.$inject = ["serviceName"];
function outer() {
MyCtrl["$inject"] = ["asdf"];
return {
controller: MyCtrl,
};
// @ngInject
function MyCtrl(a) {
}
}
We need to detect existing $inject statements, and remove and/or correct them. (If there's a conflict, we should probably also print a warning)