File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- var parse = require ( 'esprima-fb ' ) . parse ;
1+ var parse = require ( 'acorn ' ) . parse ;
22
33module . exports = function ( src ) {
44 // If src is a Buffer, esprima will just stringify it, so we beat them to
@@ -9,7 +9,10 @@ module.exports = function (src) {
99 src = String ( src ) ;
1010 }
1111
12- var ast = parse ( src , { range : true } ) ;
12+ var ast = parse ( src , {
13+ range : true ,
14+ ecmaVersion : 6
15+ } ) ;
1316
1417 ast . body = ast . body . filter ( function ( node ) {
1518 return node . type !== 'EmptyStatement' ;
@@ -45,17 +48,12 @@ module.exports = function (src) {
4548 var body = file . value . elements [ 0 ] . body . body ;
4649 var start , end ;
4750 if ( body . length === 0 ) {
48- if ( body . range ) {
49- start = body . range [ 0 ] ;
50- end = body . range [ 1 ] ;
51- } else {
52- start = 0 ;
53- end = 0 ;
54- }
51+ start = body . start || 0 ;
52+ end = body . end || 0 ;
5553 }
5654 else {
57- start = body [ 0 ] . range [ 0 ] ;
58- end = body [ body . length - 1 ] . range [ 1 ] ;
55+ start = body [ 0 ] . start ;
56+ end = body [ body . length - 1 ] . end ;
5957 }
6058
6159 var depProps = file . value . elements [ 1 ] . properties ;
Original file line number Diff line number Diff line change 77 "browser-unpack" : " bin/cmd.js"
88 },
99 "dependencies" : {
10- "acorn" : " ^1.0.3 " ,
10+ "acorn" : " ^2. 1.0" ,
1111 "concat-stream" : " ~1.2.1" ,
12- "esprima-fb" : " 3001.1.0-dev-harmony-fb" ,
1312 "minimist" : " 0.0.5"
1413 },
1514 "devDependencies" : {
3231 " unpack"
3332 ],
3433 "author" : {
35- "name" : " James Halliday" ,
3634 "email" : " mail@substack.net" ,
35+ "name" : " James Halliday" ,
3736 "url" : " http://substack.net"
3837 },
3938 "license" : " MIT"
You can’t perform that action at this time.
0 commit comments