Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions lib/jsxgettext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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();

Expand All @@ -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
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down