Socket
Socket
Sign inDemoInstall

@tkskto/vue-component-analyzer

Package Overview
Dependencies
161
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.1 to 0.1.2

dist/FileCounter.js

40

dist/client.js
/*!
@tkskto/vue-component-analyzer v0.1.1
@tkskto/vue-component-analyzer v0.1.2
https://github.com/tkskto/

@@ -104,2 +104,3 @@ Released under the MIT License.

entries: [],
count: {},
};

@@ -120,7 +121,4 @@ }

class Seed {
constructor(file, level, index) {
this.level = level;
this.index = index;
constructor(file, level, index, count) {
this._children = [];
this._duplicate = false;
this._name = file.name;

@@ -130,2 +128,3 @@ this._props = file.props;

this._index = index;
this._count = count;
}

@@ -148,3 +147,2 @@ renderChildren() {

let seedClassName = '';
let fileClassName = '';
if (this._children.length > 0) {

@@ -156,10 +154,21 @@ childHTML = this.renderChildren();

}
if (this._duplicate) {
fileClassName = ' -duplicate';
}
return `<div class="seed${seedClassName}">
<span class="file"><span class="filename${fileClassName}">${contents}</span></span>
<span class="file">
<span class="filename">
<span class="file__text">${contents}</span>
${this.getCountText()}
</span>
</span>
${childHTML}
</div>`;
}
getCountText() {
if (this._count === 0) {
return '';
}
else if (this._count === 1) {
return '<span class="file__count">1 time referenced.</span>';
}
return `<span class="file__count">${this._count} times referenced.</span>`;
}
get children() {

@@ -171,8 +180,2 @@ return this._children;

}
get duplicate() {
return this._duplicate;
}
set duplicate(value) {
this._duplicate = value;
}
}

@@ -190,3 +193,3 @@

if (data) {
const root = new Seed(entry, 0, 0);
const root = new Seed(entry, 0, 0, 0);
this._tree.push(this.generateSeed(entry, root, 0));

@@ -204,5 +207,6 @@ }

const childSeeds = [];
const { count } = this._model.data;
for (let i = 0, len = children.length; i < len; i++) {
const child = children[i];
const childSeed = new Seed(child, level + 1, i);
const childSeed = new Seed(child, level + 1, i, count[child.name]);
childSeeds.push(childSeed);

@@ -209,0 +213,0 @@ this.generateSeed(child, childSeed, level + 1);

@@ -6,3 +6,3 @@ /**

/*!
@tkskto/vue-component-analyzer v0.1.1
@tkskto/vue-component-analyzer v0.1.2
https://github.com/tkskto/

@@ -59,2 +59,3 @@ Released under the MIT License.

entries: entriesData,
count: utils_1.counter.count,
};

@@ -61,0 +62,0 @@ if (argv.format === FORMAT.BOTH) {

/*!
@tkskto/vue-component-analyzer v0.1.1
@tkskto/vue-component-analyzer v0.1.2
https://github.com/tkskto/
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });

@@ -7,0 +9,0 @@ exports.startServer = void 0;

/*!
@tkskto/vue-component-analyzer v0.1.1
@tkskto/vue-component-analyzer v0.1.2
https://github.com/tkskto/
Released under the MIT License.
*/
'use strict';
Object.defineProperty(exports, "__esModule", { value: true });
exports.getImportDeclarationTree = exports.resolveFile = exports.getPropsDeclaration = exports.getImportDeclaration = void 0;
exports.getImportDeclarationTree = exports.resolveFile = exports.getPropsDeclaration = exports.getImportDeclaration = exports.counter = void 0;
const vue_eslint_parser_1 = require("vue-eslint-parser");

@@ -12,2 +14,4 @@ const fs_1 = require("fs");

const cwd = process.cwd();
const FileCounter = require('./FileCounter');
exports.counter = new FileCounter();
exports.getImportDeclaration = (nodeArr) => {

@@ -72,5 +76,6 @@ return nodeArr.filter((node) => node.type === 'ImportDeclaration');

const filename = path_1.resolve(cwd, fileName);
const shortFilename = filename.replace(cwd, '');
const children = [];
const result = {
name: filename.replace(cwd, ''),
name: shortFilename,
props: '',

@@ -80,2 +85,3 @@ children,

console.log(`read ${filename}.`);
exports.counter.add(shortFilename);
if (path_1.extname(filename) !== '.vue') {

@@ -82,0 +88,0 @@ return result;

{
"name": "@tkskto/vue-component-analyzer",
"version": "0.1.1",
"version": "0.1.2",
"description": "Analyze dependency tree for Vue.js SFC (Single File Component)",

@@ -17,4 +17,6 @@ "main": "dist/index.js",

"cover:report": "nyc report --reporter=html",
"test": "nyc npm run test:base -- --timeout 60000",
"test:base": "mocha --reporter dot"
"test": "npm run test:base -- --timeout 60000",
"test:base": "ts-mocha ./test/specs/*.ts",
"test:base:update": "ts-mocha ./test/specs/*.ts --update",
"tmp": "node dist/index.js --dir test/fixture/declarationTest/importOne.vue -p 8888"
},

@@ -53,3 +55,3 @@ "keywords": [

"opener": "1.5.2",
"vue-eslint-parser": "7.1.0",
"vue-eslint-parser": "7.1.1",
"ws": "7.3.1"

@@ -64,6 +66,8 @@ },

"@types/express": "4.17.8",
"@types/mocha": "8.0.3",
"@types/node": "14.11.8",
"@types/opener": "1.4.0",
"@types/ws": "7.2.7",
"@typescript-eslint/eslint-plugin": "4.4.0",
"@typescript-eslint/parser": "4.4.0",
"@typescript-eslint/eslint-plugin": "4.4.1",
"@typescript-eslint/parser": "4.4.1",
"eslint": "7.11.0",

@@ -74,4 +78,5 @@ "husky": "4.3.0",

"nyc": "15.1.0",
"rollup": "2.29.0",
"rollup": "2.30.0",
"rollup-plugin-license": "2.2.0",
"ts-mocha": "7.0.0",
"typescript": "4.0.3"

@@ -78,0 +83,0 @@ },

@@ -7,3 +7,3 @@ # vue-component-analyzer

![](https://github.com/tkskto/vue-component-analyzer/blob/images/images/screenshot2.png?raw=true)
![](https://github.com/tkskto/vue-component-analyzer/blob/images/images/screenshot3.png?raw=true)

@@ -10,0 +10,0 @@ ## installation and usage

@@ -9,3 +9,4 @@ declare namespace vueComponentAnalyzer {

interface AnalyzeReport {
entries: FileReport[]
entries: FileReport[],
count: {[key: string]: number}
}

@@ -12,0 +13,0 @@ }

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc