Skip to content

Commit 13cc3d3

Browse files
committed
allow shebang, fixes #13
1 parent a0aa102 commit 13cc3d3

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
var aparse = require('acorn').parse;
2-
function parse (src) { return aparse(src, { ecmaVersion: 6 }) }
2+
function parse (src) {
3+
return aparse(src, {
4+
ecmaVersion: 6,
5+
allowHashBang: true
6+
});
7+
}
38

49
module.exports = function (src, file) {
510
if (typeof src !== 'string') src = String(src);

test/shebang.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var test = require('tap').test;
2+
3+
var fs = require('fs');
4+
var check = require('../');
5+
6+
var file = __dirname + '/sources/shebang.js';
7+
var src = fs.readFileSync(file);
8+
9+
test('shebang', function (t) {
10+
var err = check(src, file);
11+
t.notOk(err);
12+
t.end();
13+
});

test/sources/shebang.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
console.log('foo');

0 commit comments

Comments
 (0)