New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-luna

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-luna - npm Package Compare versions

Comparing version

to
1.0.5

dist/static/css/app.245fe7c440f3ef1183938a683460cd45.css

1

index.js

@@ -9,2 +9,3 @@ #!/usr/bin/env node

const _envPath = __dirname
//全局变量缓存数据

@@ -11,0 +12,0 @@ let result = {}

@@ -83,11 +83,11 @@ /**

function _recurseItem(item) {
function _recurseItem(item, tree) {
if(!item.children) { return item }
else {
for(let i = 0; i < item.children.length; i++) {
formateTree.forEach(j => {
tree.forEach(j => {
if(j.name === item.children[i].name) {
item.children[i] = j
}
_recurseItem(item.children[i])
_recurseItem(item.children[i], tree)
})

@@ -100,3 +100,3 @@ }

formateTree.forEach(i => {
this.all.push(_recurseItem(i))
this.all.push(_recurseItem(i, formateTree))
})

@@ -122,6 +122,63 @@

/**
* @method _getParent 查找目标组件被引用关系
* @param {Object} 单个树对象
* @param {String} 要查找的目标元素
* @param {Array} 缓存结果数组即该目标元素的所有父节点
*/
function _getParent(item, target, arr) {
if(item.children) {
for(let i = 0; i<item.children.length; i++) {
if(item.children[i].name === target) {
arr.indexOf(item.name) === -1 ? arr.push(item.name) : arr;
}
if(item.children[i].children) _getParent(item.children[i], target, arr)
}
}
}
/**
* @description 获取所有元素的被引用父节点
* @method _getAllParent
* @param {Array} 所有树集合组成的数组
* @return {Array} 返回以结果数组
*/
function _getAllParent(arr) {
let allReverse = {};
for(let i =0; i<arr.length; i++) {
allReverse[arr[i].name] = []
for(let j =0; j<arr.length; j++) {
if(i !== j) {
_getParent(arr[j], arr[i].name, allReverse[arr[i].name])
}
}
}
return allReverse
}
/**
* @description 转化成name-children的形式,便于复用_recurseItem函数
*/
let parentNodeList = _getAllParent(this.all)
let reverseTreeAll = []
for(let i in parentNodeList) {
if(parentNodeList[i].length) {
reverseTreeAll.push({name: i, children: []})
for(let j = 0; j<parentNodeList[i].length; j++) {
reverseTreeAll[reverseTreeAll.length-1].children.push({name: parentNodeList[i][j]})
}
} else reverseTreeAll.push({name: i})
}
let reverseTree = [];
reverseTreeAll.forEach(i => {
reverseTree.push(_recurseItem(i, reverseTreeAll))
})
return {
all: this.all,
pages: this.pages,
components: this.components
components: this.components,
reverseTree: reverseTree
}

@@ -128,0 +185,0 @@ }

2

package.json
{
"name": "vue-luna",
"version": "1.0.4",
"version": "1.0.5",
"description": "基于Echarts的Vue组件依赖关系分析工具",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -41,2 +41,2 @@ # vue-luna

* 扩展核心功能,支持不加文件名分析
* 支持动态查找某个组件的被引用关系
* 支持动态查找某个组件的被引用关系 (已完成)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet