You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGES.md
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
# babel-plugin-angularjs-annotate changelog
2
2
3
+
## v0.7.0 2017-01-09
4
+
* New Feature: Support for ES6 Object Method shorthand (#16)
5
+
3
6
## v0.6.0 2016-10-14
4
7
* New Feature: print a warning if we ask to re-annotate an DI injection array if the new parameters do not match, and throw an exception if the number of parameters is wrong.
@@ -46,7 +46,7 @@ To pass this option to the plugin, [add it to your Babel configuration](https://
46
46
47
47
## Usage
48
48
49
-
See [ng-annotate](https://github.com/olov/ng-annotate)'s documentation and the [test sources](tests/) for details about the patterns that can be automatically detected by ng-annotate and this plugin, as well as information about how to explicitly mark functions and classes for annotation.
49
+
See [ng-annotate](https://github.com/olov/ng-annotate)'s documentation and the [test sources](tests/) for details about the patterns that can be automatically detected by ng-annotate and this plugin, as well as information about how to explicitly mark functions and classes for annotation.
50
50
51
51
[Try it out in your browser](http://schmod.github.io/babel-plugin-angularjs-annotate/).
52
52
@@ -56,7 +56,7 @@ This plugin can annotate some ES6 classes and arrow functions that are not suppo
56
56
57
57
#### Implicit arrow function annotation
58
58
59
-
Arrow functions may be annotated anywhere that a "regular" function expression may be used.
59
+
Arrow functions may be annotated anywhere that a "regular" function expression may be used.
60
60
61
61
**NOTE:** There are places where you _shouldn't_ use arrow functions in an Angular application. Inside of an arrow function, the value of `this` is inherited from the lexical scope enclosing the function. For this reason, arrow functions should not be used to declare Angular services or providers.
62
62
@@ -136,6 +136,25 @@ class svc {
136
136
}
137
137
```
138
138
139
+
140
+
#### Object Method Shorthand
141
+
142
+
Object methods can be written with the new [shorthand](http://exploringjs.com/es6/ch_oop-besides-classes.html#object-literal-method-definitions) syntax:
143
+
144
+
```js
145
+
let foo = {
146
+
bar($http){
147
+
'ngInject';
148
+
}
149
+
};
150
+
```
151
+
152
+
```js
153
+
$stateProvider.state('myState', {
154
+
controller($scope) {}
155
+
});
156
+
```
157
+
139
158
#### Exports
140
159
141
160
Exported functions and classes may be annotated. Exported functions must have names:
@@ -147,15 +166,15 @@ export default function svc(dep1){}
147
166
148
167
## Notes & Philosophy
149
168
150
-
This project/experiment does _not_ seek to replace ng-annotate. However, it does seek to provide similar
169
+
This project/experiment does _not_ seek to replace ng-annotate. However, it does seek to provide similar
151
170
functionality for Angular 1.x developers who are already using Babel and/or writing code in ES6.
152
171
153
-
Because of some of the limitations presented by Babel's transformation process, this project does not aim to
172
+
Because of some of the limitations presented by Babel's transformation process, this project does not aim to
154
173
achieve feature parity, or provide identical output to ng-annotate. Notably, Babel does not preserve formatting
155
174
and indentations like ng-annotate does, and this project does not seek to replicate the features of ng-annotate that remove or transform existing annotations.
156
175
157
176
Initially, I had hoped to make very few modifications to the upstream sources, in the hopes of eventually
158
-
merging babel support directly into ng-annotate. Unfortunately, Babylon appears to have diverged too
177
+
merging babel support directly into ng-annotate. Unfortunately, Babylon appears to have diverged too
159
178
far from Acorn to make that goal realistic. (I would love to be wrong here, and would welcome contributions that close the gap between the two projects!)
0 commit comments