diff --git a/index.js b/index.js index ed8acae..0bdee87 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,10 @@ var aparse = require('acorn').parse; -function parse (src) { return aparse(src, { ecmaVersion: 6 }) } +function parse (src) { + return aparse(src, { + ecmaVersion: 6, + allowHashBang: true + }); +} module.exports = function (src, file) { if (typeof src !== 'string') src = String(src); diff --git a/test/shebang.js b/test/shebang.js new file mode 100644 index 0000000..47c5653 --- /dev/null +++ b/test/shebang.js @@ -0,0 +1,13 @@ +var test = require('tap').test; + +var fs = require('fs'); +var check = require('../'); + +var file = __dirname + '/sources/shebang.js'; +var src = fs.readFileSync(file); + +test('shebang', function (t) { + var err = check(src, file); + t.notOk(err); + t.end(); +}); diff --git a/test/sources/shebang.js b/test/sources/shebang.js new file mode 100644 index 0000000..4e7a0dc --- /dev/null +++ b/test/sources/shebang.js @@ -0,0 +1,2 @@ +#!/usr/bin/env node +console.log('foo');