From 439120c9023b8eefd7bc9d723fbdd6dd90c9ae04 Mon Sep 17 00:00:00 2001 From: Gustavo Coelho Date: Tue, 10 Jul 2018 13:43:55 -0300 Subject: [PATCH 1/2] Vue support Signed-off-by: Gustavo Coelho --- lib/inspector.js | 5 +++++ package.json | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/inspector.js b/lib/inspector.js index a257dcc..5e80e30 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -6,6 +6,8 @@ var Match = require('./match'); var NodeUtils = require('./nodeUtils'); var crypto = require('crypto'); var stable = require('stable'); +var path = require('path'); +var vueParser = require('vue-parser'); class Inspector extends EventEmitter { /** @@ -54,6 +56,9 @@ class Inspector extends EventEmitter { // File contents are split to allow for specific line extraction this._filePaths.forEach((filePath) => { var src = fs.readFileSync(filePath, {encoding: 'utf8'}); + if(path.extname(filePath) === '.vue'){ + src = vueParser.parse(filePath, 'script') + } this._fileContents[filePath] = src.split('\n'); try { var syntaxTree = parse(src, filePath); diff --git a/package.json b/package.json index 319b456..0b833f3 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ }, "dependencies": { "babylon": "6.16.1", + "vue-parser": "1.1.6", "chalk": "^2.1.0", "commander": "^2.11.0", "filepaths": "0.3.0", From 53c7fa5454a3e7f811be41a63d34e55b38fd4cb2 Mon Sep 17 00:00:00 2001 From: Gustavo Coelho Date: Tue, 17 Jul 2018 19:21:35 -0300 Subject: [PATCH 2/2] Vue files Signed-off-by: Gustavo Coelho --- bin/jsinspect | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/jsinspect b/bin/jsinspect index dc15bef..33b3cac 100755 --- a/bin/jsinspect +++ b/bin/jsinspect @@ -73,7 +73,7 @@ if (program.ignore) { ignorePatterns.push(program.ignore); } -var extensions = ['.js', '.jsx']; +var extensions = ['.js', '.jsx', '.vue']; try { paths = filepaths.getSync(suppliedPaths, { ext: extensions,