[Pkg-javascript-commits] [node-astw] 18/30: Switch from esprima to acorn

Bastien Roucariès rouca at moszumanska.debian.org
Tue Sep 26 12:55:05 UTC 2017


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

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

commit 9dd3e83092444d23bee9883852a2c0442639ffd8
Author: Andres Suarez <zertosh at gmail.com>
Date:   Sat Apr 25 15:40:32 2015 -0400

    Switch from esprima to acorn
---
 index.js     | 9 +++++++--
 package.json | 4 ++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/index.js b/index.js
index 6947081..8e34110 100644
--- a/index.js
+++ b/index.js
@@ -1,9 +1,14 @@
-var parse = require('esprima').parse;
+var parse = require('acorn').parse;
 
 module.exports = function (src) {
     var ast = src;
     if (typeof src === 'string') {
-        try { ast = parse(src) }
+        try {
+            ast = parse(src, {
+                ecmaVersion: 6,
+                allowReturnOutsideFunction: true
+            })
+        }
         catch (err) { ast = parse('(' + src + ')') }
     }
     return function (cb) {
diff --git a/package.json b/package.json
index 5a005ee..b2a7649 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
   "description": "walk the ast with references to parent nodes",
   "main": "index.js",
   "dependencies": {
-    "esprima": "^2.1.0"
+    "acorn": "^1.0.3"
   },
   "devDependencies": {
     "tape": "~2.4.1",
@@ -34,7 +34,7 @@
     "ast",
     "walk",
     "source",
-    "esprima"
+    "acorn"
   ],
   "author": {
     "name": "James Halliday",

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



More information about the Pkg-javascript-commits mailing list