Skip to content
This repository was archived by the owner on Jun 20, 2020. It is now read-only.

Commit 06e8800

Browse files
committed
Add source map support
Fix #18
1 parent 52ee361 commit 06e8800

File tree

6 files changed

+215
-124
lines changed

6 files changed

+215
-124
lines changed

.eslintrc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
// Possible errors
1010
"no-comma-dangle": 0,
1111
"no-console": 0,
12-
"no-extra-parens": 2,
1312

1413
// Best practices
1514
"block-scoped-var": 2,
15+
"complexity": [2, 10],
1616
"eqeqeq": [2, "smart"],
1717
"no-else-return": 2,
1818
"no-floating-decimal": 2,
19+
"no-redeclare": 0, // TODO remove the disabling once let/const scope is calculated correctly
20+
"no-self-compare": 2,
1921
"wrap-iife": [2, "inside"],
2022

2123
// Variables
2224
"no-use-before-define": 0,
25+
"no-shadow": 0,
2326

2427
// Node.js
2528
"no-mixed-requires": 0,
@@ -33,7 +36,6 @@
3336
"space-after-keywords": 2,
3437
"space-in-brackets": [2, "never"],
3538
"space-infix-ops": 2,
36-
"one-var": 2,
3739
"quotes": [2, "single"],
3840

3941
// Legacy

Gruntfile.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module.exports = function (grunt) {
8181
regexp: {
8282
options: {
8383
add: true,
84-
remove: true,
84+
remove: false,
8585
regexp: /^matchedMod$/,
8686
},
8787
files: {
@@ -99,13 +99,33 @@ module.exports = function (grunt) {
9999
singleQuotes: {
100100
options: {
101101
add: true,
102-
remove: true,
102+
remove: false,
103103
singleQuotes: true,
104104
},
105105
files: {
106106
'test/tmp/not-annotated-singlequotes.js': ['test/fixtures/not-annotated.js'],
107107
},
108108
},
109+
sourceMap: {
110+
options: {
111+
add: true,
112+
remove: false,
113+
sourceMap: true,
114+
},
115+
files: {
116+
'test/tmp/not-annotated-source-map.js': ['test/fixtures/not-annotated.js'],
117+
},
118+
},
119+
sourceMapNotInline: {
120+
options: {
121+
add: true,
122+
remove: false,
123+
sourceMap: 'test/tmp/not-annotated-source-map-external.js.map',
124+
},
125+
files: {
126+
'test/tmp/not-annotated-source-map-external.js': ['test/fixtures/not-annotated.js'],
127+
},
128+
},
109129
ngAnnotateOptions: {
110130
options: {
111131
singleQuotes: true,

README.md

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ Once the plugin has been installed, it may be enabled inside your Gruntfile with
2020
grunt.loadNpmTasks('grunt-ng-annotate');
2121
```
2222

23-
## The "ngAnnotate" task
23+
## Overview
2424

25-
### Overview
26-
In your project's Gruntfile, add a section named `ngAnnotate` to the data object passed into `grunt.initConfig()`.
25+
This project defines the `ngAnnotate` task. In your project's Gruntfile, add a section named `ngAnnotate` to the data object passed into `grunt.initConfig()`.
2726

2827
```js
2928
grunt.initConfig({
@@ -38,19 +37,19 @@ grunt.initConfig({
3837
})
3938
```
4039

41-
### Options
40+
## Options
4241

4342
The `ngAnnotate` task accepts a couple of options:
4443

45-
#### add
44+
### add
4645

4746
Tells if ngAnnotate should add annotations.
4847

4948
Type: `boolean`
5049

5150
Default: `true`
5251

53-
#### remove
52+
### remove
5453

5554
Tells if ngAnnotate should remove annotations.
5655

@@ -61,23 +60,33 @@ Default: `false`
6160
Note that both `add` and `remove` options can be set to true; in such a case `ngAnnotate` first removes
6261
annotations and then re-adds them (it can be used to check if annotations were provided correctly).
6362

64-
#### regexp
63+
### regexp
6564

6665
If provided, only strings matched by the regexp are interpreted as module names. You can provide both a regular expression and a string representing one. See README of ng-annotate for further details: https://npmjs.org/package/ng-annotate
6766

6867
Type: `regexp`
6968

7069
Default: none
7170

72-
#### singleQuotes
71+
### singleQuotes
7372

7473
Switches the quote type for strings in the annotations array to single ones; e.g. `'$scope'` instead of `"$scope"`.
7574

7675
Type: `boolean`
7776

7877
Default: `false`
7978

80-
#### ngAnnotateOptions
79+
### sourceMap
80+
81+
Enables source map generation.
82+
83+
Type: `boolean` or `string`
84+
85+
Default: `false`
86+
87+
If set to a string, the string points to a file where to save the source map. If set to `true`, an inline source map will be used.
88+
89+
### ngAnnotateOptions
8190

8291
If ngAnnotate supports a new option that is not directly supported via this Grunt task yet, you can pass it here. These options gets merged with the above specific to ngAnnotate. Options passed here have lower precedence to the direct ones described above.
8392

@@ -86,7 +95,7 @@ Type: `object`
8695
Default: `{}`
8796

8897

89-
### Usage Examples
98+
## Usage Examples
9099

91100
```js
92101
grunt.initConfig({

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"grunt-mocha-test": "0.12.7",
4444
"jscs-trailing-comma": "0.3.0",
4545
"load-grunt-tasks": "2.0.0",
46+
"lodash": "2.4.1",
4647
"mocha": "2.1.0",
4748
"time-grunt": "1.0.0"
4849
},

0 commit comments

Comments
 (0)