Skip to content

Commit

Permalink
Merge pull request #18 from twada/fix-17-missing-sourcemap-original-c…
Browse files Browse the repository at this point in the history
…olumns

Fix Invalid mapping error when using babelify
  • Loading branch information
twada committed May 12, 2016
2 parents 43d5a65 + f5cb609 commit 2fa0757
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@
],
"dependencies": {
"convert-source-map": "^1.1.3",
"offset-sourcemap-lines": "^0.1.0",
"offset-sourcemap-lines": "^0.1.1",
"oss-license-name-to-url": "^1.2.1",
"through2": "^2.0.0",
"type-name": "^2.0.0"
},
"devDependencies": {
"babel-plugin-transform-es2015-classes": "^6.8.0",
"babelify": "^7.3.0",
"browserify": "^13.0.0",
"event-stream": "^3.3.1",
"intelli-espower-loader": "^1.0.0",
Expand Down
8 changes: 8 additions & 0 deletions test/test-babel-class/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class Entry {
constructor(name) {
this.name = name;
}
toString() {
return this.name;
}
}
6 changes: 6 additions & 0 deletions test/test-babel-class/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "test-babel-class",
"description": "",
"version": "0.1.0",
"license": "MIT"
}
30 changes: 30 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,3 +380,33 @@ describe('multiple common licenses', function () {
});
});
});


describe('repro case for #17 : sourcemap generated by babel class', function () {
var expectedModules = [
'test-babel-class'
];
describe('sourcemap should be generated', function () {
var header;
before(function (done) {
var save = saveFirstChunk();
var entryPath = path.normalize(path.join(__dirname, 'test-babel-class', 'index.js'));
var b = browserify(entryPath, { debug: true });
b.transform('babelify', {
plugins: ['transform-es2015-classes']
});
b.plugin(licensify);
b.bundle().pipe(save).pipe(es.wait(function(err, data) {
assert(!err);
header = save.firstChunk;
done();
}));
});
expectedModules.forEach(function (moduleName) {
var re = new RegExp(' \* ' + moduleName + '\:$', 'gm');
it('ensure header includes [' + moduleName + ']', function () {
assert(re.test(header));
});
});
});
});

0 comments on commit 2fa0757

Please sign in to comment.