Skip to content

Commit

Permalink
Replace buntis with typescript-estree
Browse files Browse the repository at this point in the history
The buntis git repo has been deleted by upstream, so we shouldn't rely
on it.
  • Loading branch information
vbraun committed Jul 6, 2021
1 parent 6e3c24b commit 5b5343b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
"author": "Polyconseil",
"license": "MIT",
"devDependencies": {
"@types/jest": "^26.0.14",
"@types/jest": "^26.0.14"
"codecov": "^3.8.0",
"eslint": "^7.10.0",
"jest": "^26.5.2"
"jest": "^26.5.2",
"typescript": "^4.2.0"
},
"engines": {
"node": ">=8"
Expand All @@ -36,7 +37,7 @@
"acorn": "^7.4.0",
"acorn-stage3": "^4.0.0",
"acorn-walk": "^8.0.0",
"buntis": "0.2.1",
"@typescript-eslint/typescript-estree": "^4.0.0",
"cheerio": "^1.0.0-rc.3",
"estree-walker": "^2.0.1",
"flow-remove-types": "^2.135.0",
Expand Down
7 changes: 4 additions & 3 deletions src/typescript-extract.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {walk} = require('estree-walker');
const {parseTSScript} = require('buntis');
const {parse} = require('@typescript-eslint/typescript-estree');
const extractUtils = require('./extract-utils.js');

const {DEFAULT_VUE_GETTEXT_FUNCTIONS} = require('./constants.js');
Expand Down Expand Up @@ -41,8 +41,9 @@ function getTranslationObject(node, gettextFunctionName, filename) {
}

function getGettextEntriesFromTypeScript(script, filename) {
let translationEntries = [];
walk(parseTSScript(script, {loc: true, next: true}), {
const translationEntries = [];
const ast = parse(script, { loc: true, range: true });
walk(ast, {
enter: function(node) {
if (node.type && node.type === 'CallExpression' && node.callee) {
if (DEFAULT_VUE_GETTEXT_FUNCTIONS_KEYS.includes(node.callee.name)) {
Expand Down

0 comments on commit 5b5343b

Please sign in to comment.