Skip to content

Commit 0b8b0bf

Browse files
author
Andrew Schmadel
committed
prepare for release
1 parent 4817b11 commit 0b8b0bf

File tree

4 files changed

+1191
-1759
lines changed

4 files changed

+1191
-1759
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# babel-plugin-angularjs-annotate changelog
22

3+
## v0.7.0 2017-01-09
4+
* New Feature: Support for ES6 Object Method shorthand (#16)
5+
36
## v0.6.0 2016-10-14
47
* 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.
58

README.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This plugin currently supports matching and transforming all of the patterns cur
1414

1515
Use like any other [Babel plugin](https://babeljs.io/docs/plugins/).
1616

17-
Most users will want to run
17+
Most users will want to run
1818

1919
```sh
2020
$ npm install babel-plugin-angularjs-annotate --save-dev
@@ -46,7 +46,7 @@ To pass this option to the plugin, [add it to your Babel configuration](https://
4646

4747
## Usage
4848

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.
5050

5151
[Try it out in your browser](http://schmod.github.io/babel-plugin-angularjs-annotate/).
5252

@@ -56,7 +56,7 @@ This plugin can annotate some ES6 classes and arrow functions that are not suppo
5656

5757
#### Implicit arrow function annotation
5858

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.
6060

6161
**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.
6262

@@ -136,6 +136,25 @@ class svc {
136136
}
137137
```
138138

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+
139158
#### Exports
140159

141160
Exported functions and classes may be annotated. Exported functions must have names:
@@ -147,15 +166,15 @@ export default function svc(dep1){}
147166

148167
## Notes & Philosophy
149168

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
151170
functionality for Angular 1.x developers who are already using Babel and/or writing code in ES6.
152171

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
154173
achieve feature parity, or provide identical output to ng-annotate. Notably, Babel does not preserve formatting
155174
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.
156175

157176
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
159178
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!)
160179

161180
### To run tests:

0 commit comments

Comments
 (0)