Skip to content

Commit a3ee26d

Browse files
author
Andrey
authored
Merge pull request #26 from thekip/master
Fix sourcemaps errors and update test
2 parents 57f2ad6 + 1f3bdcd commit a3ee26d

27 files changed

+497
-73
lines changed

.editorconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text eol=lf

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
language: node_js
22

33
node_js:
4-
- "0.12"
4+
- "5"
55

66
script:
77
- npm test

acceptance-test.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

examples/babel/file-to-annotate.js renamed to cases/babel/file-to-annotate.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ angular.module('test', [])
2424
.controller('someCtrl', someCtrl);
2525

2626
function toAnnotate($scope) {
27-
'ngInject';
27+
'ngInject';
28+
console.log('hi'); // should be function body, otherwise babel remove directive prologue
2829
}
2930

3031
class someCtrl {

examples/babel/annotated-reference.js renamed to cases/babel/reference/build.js

Lines changed: 12 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = [
2+
{
3+
original: { source: 'webpack:///file-to-annotate.js', line: 33, column: 2 },
4+
generated: { line: 84, column: 3},
5+
},
6+
{
7+
original: { source: 'webpack:///file-to-annotate.js', line: 41, column: 0 },
8+
generated: { line: 95, column: 0 },
9+
},
10+
];
File renamed without changes.
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
// Note: this example babel and equires babel-loader
2-
// npm install babel babel-loader
3-
41
var path = require('path');
52

63
module.exports = {
7-
context: __dirname,
8-
entry: './file-to-annotate',
4+
context: __dirname,
5+
entry: './file-to-annotate.js',
96
output: {
107
path: __dirname + '/dist',
118
filename: 'build.js'
@@ -15,8 +12,11 @@ module.exports = {
1512
},
1613
module: {
1714
loaders: [
18-
{test: /\.js$/, loaders: ['loader', 'babel']},
15+
{
16+
test: /\.js$/,
17+
loaders: ['loader', 'babel?presets[]=es2015'],
18+
},
1919
]
2020
},
21-
devtool: 'source-map'
21+
devtool: 'source-map'
2222
}

examples/simple/annotated-reference.js renamed to cases/simple/reference/build.js

Lines changed: 17 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = [
2+
{
3+
original: { source: 'webpack:///file-to-annotate.js', line: 24, column: 5 },
4+
generated: { line: 71, column: 3},
5+
},
6+
{
7+
original: { source: 'webpack:///file-to-annotate.js', line: 11, column: 5 },
8+
generated: { line: 58, column: 3 },
9+
},
10+
];

examples/simple/webpack.config.js renamed to cases/simple/webpack.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ module.exports = {
1414
loaders: [
1515
{test: /\.js$/, loaders: ['loader']},
1616
]
17-
}
17+
},
18+
devtool: 'source-map'
1819
}

cases/typescript/file-to-annotate.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
3+
declare const angular: any;
4+
5+
import babelTestMsg from './to-import';
6+
console.log(babelTestMsg);
7+
8+
angular.module('test', [])
9+
.controller('testCtrl', function($scope) {
10+
11+
})
12+
.factory('testFactory', function($cacheFactory) {
13+
return {};
14+
})
15+
.service('testNotAnnotated', function() {
16+
return {};
17+
})
18+
.directive('testDirective', function ($timeout) {
19+
return {
20+
restrict: 'E',
21+
controller: function($scope) {
22+
23+
}
24+
};
25+
})
26+
.controller('someCtrl', someCtrl);
27+
28+
function toAnnotate($scope) {
29+
'ngInject';
30+
console.log('hi'); // should be function body, otherwise babel remove directive prologue
31+
}
32+
33+
class someCtrl {
34+
constructor($scope) {
35+
this.doSomething();
36+
}
37+
38+
doSomething() {
39+
40+
}
41+
}
42+
43+
console.log('after annotated function');

cases/typescript/reference/build.js

Lines changed: 95 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)