Commit 8a7051e3 authored by James Halliday's avatar James Halliday

upgrade acorn

parent 948b11eb
var parse = require('esprima-fb').parse;
var parse = require('acorn').parse;
module.exports = function (src) {
// If src is a Buffer, esprima will just stringify it, so we beat them to
......@@ -9,7 +9,10 @@ module.exports = function (src) {
src = String(src);
}
var ast = parse(src, { range: true });
var ast = parse(src, {
range: true,
ecmaVersion: 6
});
ast.body = ast.body.filter(function(node) {
return node.type !== 'EmptyStatement';
......@@ -45,17 +48,12 @@ module.exports = function (src) {
var body = file.value.elements[0].body.body;
var start, end;
if (body.length === 0) {
if (body.range) {
start = body.range[0];
end = body.range[1];
} else {
start = 0;
end = 0;
}
start = body.start || 0;
end = body.end || 0;
}
else {
start = body[0].range[0];
end = body[body.length-1].range[1];
start = body[0].start;
end = body[body.length-1].end;
}
var depProps = file.value.elements[1].properties;
......
......@@ -7,9 +7,8 @@
"browser-unpack": "bin/cmd.js"
},
"dependencies": {
"acorn": "^1.0.3",
"acorn": "^2.1.0",
"concat-stream": "~1.2.1",
"esprima-fb": "3001.1.0-dev-harmony-fb",
"minimist": "0.0.5"
},
"devDependencies": {
......@@ -32,8 +31,8 @@
"unpack"
],
"author": {
"name": "James Halliday",
"email": "mail@substack.net",
"name": "James Halliday",
"url": "http://substack.net"
},
"license": "MIT"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment