Skip to content

Commit

Permalink
Merge pull request #26 from thekip/master
Browse files Browse the repository at this point in the history
Fix sourcemaps errors and update test
  • Loading branch information
Andrey authored Sep 16, 2016
2 parents 57f2ad6 + 1f3bdcd commit a3ee26d
Show file tree
Hide file tree
Showing 27 changed files with 497 additions and 73 deletions.
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js

node_js:
- "0.12"
- "5"

script:
- npm test
Expand Down
11 changes: 0 additions & 11 deletions acceptance-test.sh

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ angular.module('test', [])
.controller('someCtrl', someCtrl);

function toAnnotate($scope) {
'ngInject';
'ngInject';
console.log('hi'); // should be function body, otherwise babel remove directive prologue
}

class someCtrl {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions cases/babel/reference/sourcemap-checkpoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = [
{
original: { source: 'webpack:///file-to-annotate.js', line: 33, column: 2 },
generated: { line: 84, column: 3},
},
{
original: { source: 'webpack:///file-to-annotate.js', line: 41, column: 0 },
generated: { line: 95, column: 0 },
},
];
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Note: this example babel and equires babel-loader
// npm install babel babel-loader

var path = require('path');

module.exports = {
context: __dirname,
entry: './file-to-annotate',
context: __dirname,
entry: './file-to-annotate.js',
output: {
path: __dirname + '/dist',
filename: 'build.js'
Expand All @@ -15,8 +12,11 @@ module.exports = {
},
module: {
loaders: [
{test: /\.js$/, loaders: ['loader', 'babel']},
{
test: /\.js$/,
loaders: ['loader', 'babel?presets[]=es2015'],
},
]
},
devtool: 'source-map'
devtool: 'source-map'
}
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions cases/simple/reference/sourcemap-checkpoints.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = [
{
original: { source: 'webpack:///file-to-annotate.js', line: 24, column: 5 },
generated: { line: 71, column: 3},
},
{
original: { source: 'webpack:///file-to-annotate.js', line: 11, column: 5 },
generated: { line: 58, column: 3 },
},
];
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ module.exports = {
loaders: [
{test: /\.js$/, loaders: ['loader']},
]
}
},
devtool: 'source-map'
}
43 changes: 43 additions & 0 deletions cases/typescript/file-to-annotate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use strict';

declare const angular: any;

import babelTestMsg from './to-import';
console.log(babelTestMsg);

angular.module('test', [])
.controller('testCtrl', function($scope) {

})
.factory('testFactory', function($cacheFactory) {
return {};
})
.service('testNotAnnotated', function() {
return {};
})
.directive('testDirective', function ($timeout) {
return {
restrict: 'E',
controller: function($scope) {

}
};
})
.controller('someCtrl', someCtrl);

function toAnnotate($scope) {
'ngInject';
console.log('hi'); // should be function body, otherwise babel remove directive prologue
}

class someCtrl {
constructor($scope) {
this.doSomething();
}

doSomething() {

}
}

console.log('after annotated function');
95 changes: 95 additions & 0 deletions cases/typescript/reference/build.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a3ee26d

Please sign in to comment.