[Pkg-javascript-commits] [node-browser-unpack] 30/40: upgrade acorn

Bastien Roucariès rouca at moszumanska.debian.org
Thu Nov 9 12:27:25 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-browser-unpack.

commit 8a7051e3452a0960a2d4f7a12b7c7a46d3c7be5e
Author: James Halliday <mail at substack.net>
Date:   Sun Jul 19 01:53:28 2015 -0700

    upgrade acorn
---
 index.js     | 20 +++++++++-----------
 package.json |  5 ++---
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/index.js b/index.js
index fd5ee69..2c5b006 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,4 @@
-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;
diff --git a/package.json b/package.json
index 82b59e2..0d8078c 100644
--- a/package.json
+++ b/package.json
@@ -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 at substack.net",
+    "name": "James Halliday",
     "url": "http://substack.net"
   },
   "license": "MIT"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-browser-unpack.git



More information about the Pkg-javascript-commits mailing list