diff --git a/lib/jsxgettext.js b/lib/jsxgettext.js index 7eef48e..faed7fe 100644 --- a/lib/jsxgettext.js +++ b/lib/jsxgettext.js @@ -7,8 +7,9 @@ var fs = require('fs'); var path = require('path'); -var parser = require('acorn-jsx'); -var walk = require('acorn/dist/walk'); +var acorn = require('acorn'); +var jsx = require('acorn-jsx'); +var walk = require('acorn-walk'); var gettextParser = require('gettext-parser'); var regExpEscape = require('escape-string-regexp'); @@ -170,9 +171,8 @@ function parse(sources, options) { var source = sources[filename].replace(/^#.*/, ''); // strip leading hash-bang var astComments = []; var parserOptions = Object.assign({}, { - ecmaVersion: 8, + ecmaVersion: 10, sourceType: 'module', - plugins: { jsx: { allowNamespaces: false } }, onComment: function (block, text, start, end, line/*, column*/) { text = text.match(commentRegex) && text.replace(/^\//, '').trim(); @@ -186,6 +186,7 @@ function parse(sources, options) { }, locations: true }, options.parserOptions && JSON.parse(options.parserOptions)); + var parser = acorn.Parser.extend(jsx({ allowNamespaces: false })); var ast = parser.parse(source, parserOptions); // finds comments that end on the previous line diff --git a/package.json b/package.json index 2d6a16b..cddb074 100644 --- a/package.json +++ b/package.json @@ -47,17 +47,18 @@ "node": ">= 4.0.0" }, "dependencies": { - "acorn": "^5.1.2", - "acorn-jsx": "^4.0.1", - "commander": "^2.11.0", - "escape-string-regexp": "^1.0.5", - "gettext-parser": "^1.3.0", + "acorn": "^6.1.1", + "acorn-jsx": "^5.0.1", + "acorn-walk": "^6.1.1", + "commander": "^2.20.0", + "escape-string-regexp": "^2.0.0", + "gettext-parser": "^4.0.0", "jade": "^1.11.0" }, "devDependencies": { - "jshint": "2.9.5", + "jshint": "2.10.2", "test": "0.6.0", - "i18n-abide": "0.0.25" + "i18n-abide": "0.0.26" }, "scripts": { "test": "node ./node_modules/jshint/bin/jshint . && node test"