Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dependency-cruiser

Package Overview
Dependencies
Maintainers
1
Versions
536
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dependency-cruiser - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

4

package.json
{
"name": "dependency-cruiser",
"version": "1.2.2",
"version": "1.2.3",
"description": "Visualize and validate javascript dependencies. With your rules. ES6, CommonJS, AMD",

@@ -37,3 +37,3 @@ "bin": {

"js-makedepend": "1.0.6",
"mocha": "3.1.2",
"mocha": "3.2.0",
"npm-check-updates": "2.8.6",

@@ -40,0 +40,0 @@ "nsp": "2.6.2"

@@ -81,3 +81,3 @@ # Dependency cruiser ![Dependency cruiser](https://raw.githubusercontent.com/sverweij/dependency-cruiser/master/doc/assets/ZKH-Dependency-recolored-160.png)

See the _dependency-cruise_ target in the [Makefile](https://github.com/sverweij/dependency-cruiser/blob/master/Makefile) for a real world
See the _dependency-cruise_ target in the [Makefile](https://github.com/sverweij/dependency-cruiser/blob/master/Makefile#L78) for a real world
example.

@@ -84,0 +84,0 @@

@@ -14,6 +14,15 @@ "use strict";

if (lDep) {
return lDep.valid ? "true" : "violation";
return lDep.valid
? {
incidence: "true"
}
: {
incidence: lDep.rule.level,
rule: lDep.rule.name
};
}
return "false";
return {
incidence: "false"
};
};

@@ -27,6 +36,8 @@ }

incidences: pDependencyList.map(pDependencyListEntry => {
return {
incidence: determineIncidenceType(pDependencyListEntry)(pDependency),
to: pDependencyListEntry.source
};
return Object.assign(
{
to: pDependencyListEntry.source
},
determineIncidenceType(pDependencyListEntry)(pDependency)
);
})

@@ -33,0 +44,0 @@ };

@@ -22,6 +22,6 @@ var Handlebars = require("handlebars/runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};

return "subgraph \"cluster_"
+ ((stack1 = ((helper = (helper = helpers.aggregateDir || (depth0 != null ? depth0.aggregateDir : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"aggregateDir","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ ((stack1 = ((helper = (helper = helpers.aggregateSnippet || (depth0 != null ? depth0.aggregateSnippet : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"aggregateSnippet","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" {label=\""
+ ((stack1 = ((helper = (helper = helpers.dir || (depth0 != null ? depth0.dir : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"dir","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" style=\"rounded\" ";
+ ((stack1 = ((helper = (helper = helpers.snippet || (depth0 != null ? depth0.snippet : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"snippet","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" fontname=\"Helvetica-bold\" style=\"rounded,bold\" ";
},"5":function(container,depth0,helpers,partials,data) {

@@ -56,3 +56,7 @@ return " }";

},"14":function(container,depth0,helpers,partials,data) {
return "[color=\"red\" penwidth=2.0]";
var helper;
return "[color=\""
+ container.escapeExpression(((helper = (helper = helpers.color || (depth0 != null ? depth0.color : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"color","hash":{},"data":data}) : helper)))
+ "\" penwidth=2.0]";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {

@@ -59,0 +63,0 @@ var stack1, alias1=depth0 != null ? depth0 : {};

@@ -8,2 +8,9 @@ "use strict";

const LEVEL2COLOR = {
error : "orange",
warning : "orange",
information : "blue"
};
const DEFAULT_VIOLATION_COLOR = "red";
function compareOnSource(pOne, pTwo) {

@@ -13,8 +20,10 @@ return pOne.source > pTwo.source ? 1 : -1;

let toFullPath = (pAll, pCurrent) => `${pAll}${path.sep}${pCurrent}`;
function toFullPath (pAll, pCurrent) {
return `${pAll}${path.sep}${pCurrent}`;
}
function agg (pFolder, i, ary){
function aggregate (pPathSnippet, pCounter, pPathArray){
return {
dir: pFolder,
aggregateDir: `${ary.slice(0, i).reduce(toFullPath, '')}${path.sep}${pFolder}`
snippet: pPathSnippet,
aggregateSnippet: `${pPathArray.slice(0, pCounter).reduce(toFullPath, '')}${path.sep}${pPathSnippet}`
};

@@ -29,3 +38,3 @@ }

lAdditions.folder = lDirName;
lAdditions.path = lDirName.split(path.sep).map(agg);
lAdditions.path = lDirName.split(path.sep).map(aggregate);
}

@@ -39,8 +48,29 @@

);
}
function determineColor(pDependency) {
let lColorAddition = {};
if (pDependency.hasOwnProperty("valid") && !pDependency.valid) {
lColorAddition.color = LEVEL2COLOR[pDependency.rule.level] || DEFAULT_VIOLATION_COLOR;
}
return Object.assign(
pDependency,
lColorAddition
);
}
function colorize(pDependencyItem){
return Object.assign(
pDependencyItem,
{
dependencies: pDependencyItem.dependencies.map(determineColor)
}
);
}
function render(pInput) {
return Handlebars.templates['dot.template.hbs']({
"things" : pInput.sort(compareOnSource).map(folderify)
"things" : pInput.sort(compareOnSource).map(folderify).map(colorize)
});

@@ -47,0 +77,0 @@ }

@@ -27,13 +27,19 @@ var Handlebars = require("handlebars/runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};

},"5":function(container,depth0,helpers,partials,data,blockParams,depths) {
var helper, alias1=container.escapeExpression;
var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=container.escapeExpression;
return "title=\""
+ alias1(container.lambda((depths[1] != null ? depths[1].source : depths[1]), depth0))
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.rule : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ alias2(container.lambda((depths[1] != null ? depths[1].source : depths[1]), depth0))
+ " ->\n"
+ alias1(((helper = (helper = helpers.to || (depth0 != null ? depth0.to : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"to","hash":{},"data":data}) : helper)))
+ alias2(((helper = (helper = helpers.to || (depth0 != null ? depth0.to : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"to","hash":{},"data":data}) : helper)))
+ "\"";
},"6":function(container,depth0,helpers,partials,data) {
var helper;
return container.escapeExpression(((helper = (helper = helpers.rule || (depth0 != null ? depth0.rule : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"rule","hash":{},"data":data}) : helper)))
+ ":\n";
},"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1, alias1=depth0 != null ? depth0 : {};
return "<style media=\"screen\">\n html {\n font-family: sans-serif;\n font-size: 10pt;\n }\n table, td.controls {\n transition-duration: 0.4s;\n }\n table, th, td{\n border: solid black 1px;\n border-collapse: collapse;\n font-size: inherit;\n }\n th{\n text-align:start;\n vertical-align: bottom;\n max-width: 1em;\n max-height: 30em;\n height: 20em;\n font-weight: normal;\n white-space: nowrap;\n overflow: hidden;\n }\n th div {\n transform: rotateZ(-90deg);\n transform-origin: 0.5em;\n text-align: start;\n height: 1em;\n width: 30em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n td {\n text-align: center;\n font-style: italic;\n }\n td.first-cell {\n text-align: left;\n font-style: normal;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n td.top-left {\n border-top: solid 1px transparent;\n border-left: solid 1px transparent;\n }\n td.top-right {\n border-top: solid 1px transparent;\n border-right: solid 1px transparent;\n }\n td.bottom-left {\n border-bottom: solid 1px transparent;\n border-left: solid 1px transparent;\n }\n td.bottom-right {\n border-bottom: solid 1px transparent;\n border-right: solid 1px transparent;\n }\n tbody tr:hover {\n background-color: lightgrey;\n }\n #table-rotated:target {\n transform: rotateZ(45deg);\n transform-origin: bottom left;\n }\n #table-rotated:target #unrotate {\n opacity: 1;\n }\n #table-rotated:target #rotate {\n opacity: 0;\n }\n #unrotate {\n opacity: 0;\n }\n #rotate {\n opacity: 1;\n }\n .controls {\n opacity: 0.2;\n vertical-align: bottom;\n padding: 0.5em;\n }\n .controls:hover {\n opacity: 1;\n }\n .controls a {\n font-style: normal;\n text-decoration: none;\n background-color: #eee;\n padding: 0.2em 0.5em 0.2em 0.5em;\n }\n .cell-true {\n background-color: black;\n opacity: 0.5;\n }\n .cell-false {\n background-color: white;\n opacity: 0.5;\n }\n .cell-violation {\n background-color: red;\n opacity: 0.5;\n }\n</style>\n<table id=\"table-rotated\">\n <thead>\n <tr>\n <td class=\"controls top-left\">\n <a id=\"rotate\" href=\"#table-rotated\">rotate</a>\n <a id=\"unrotate\" href=\"#\">rotate back</a>\n </td>\n "
return "<style media=\"screen\">\n html {\n font-family: sans-serif;\n font-size: 10pt;\n }\n table, td.controls {\n transition-duration: 0.4s;\n }\n table, th, td{\n border: solid black 1px;\n border-collapse: collapse;\n font-size: inherit;\n }\n th{\n text-align:start;\n vertical-align: bottom;\n max-width: 1em;\n max-height: 30em;\n height: 20em;\n font-weight: normal;\n white-space: nowrap;\n overflow: hidden;\n }\n th div {\n transform: rotateZ(-90deg);\n transform-origin: 0.5em;\n text-align: start;\n height: 1em;\n width: 30em;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n td {\n text-align: center;\n font-style: italic;\n }\n td.first-cell {\n text-align: left;\n font-style: normal;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n td.top-left {\n border-top: solid 1px transparent;\n border-left: solid 1px transparent;\n }\n td.top-right {\n border-top: solid 1px transparent;\n border-right: solid 1px transparent;\n }\n td.bottom-left {\n border-bottom: solid 1px transparent;\n border-left: solid 1px transparent;\n }\n td.bottom-right {\n border-bottom: solid 1px transparent;\n border-right: solid 1px transparent;\n }\n tbody tr:hover {\n background-color: lightgrey;\n }\n #table-rotated:target {\n transform: rotateZ(45deg);\n transform-origin: bottom left;\n }\n #table-rotated:target #unrotate {\n opacity: 1;\n }\n #table-rotated:target #rotate {\n opacity: 0;\n }\n #unrotate {\n opacity: 0;\n }\n #rotate {\n opacity: 1;\n }\n .controls {\n opacity: 0.2;\n vertical-align: bottom;\n padding: 0.5em;\n }\n .controls:hover {\n opacity: 1;\n }\n .controls a {\n font-style: normal;\n text-decoration: none;\n background-color: #eee;\n padding: 0.2em 0.5em 0.2em 0.5em;\n }\n .cell-true {\n background-color: black;\n opacity: 0.5;\n }\n .cell-false {\n background-color: white;\n opacity: 0.5;\n }\n .cell-error {\n background-color: red;\n opacity: 0.5;\n }\n .cell-warning {\n background-color: orange;\n opacity: 0.5;\n }\n .cell-information {\n background-color: blue;\n opacity: 0.5;\n }\n</style>\n<table id=\"table-rotated\">\n <thead>\n <tr>\n <td class=\"controls top-left\">\n <a id=\"rotate\" href=\"#table-rotated\">rotate</a>\n <a id=\"unrotate\" href=\"#\">rotate back</a>\n </td>\n "
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.things : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")

@@ -40,0 +46,0 @@ + "\n <td class=\"top-right\"></td>\n </tr>\n </thead>\n <tbody>\n"

@@ -12,7 +12,8 @@ "use strict";

incidences: pDependencyEntry.incidences.map(pIncidence => {
return {
incidence: pIncidence.incidence,
to: pIncidence.to,
hasRelation: pIncidence.incidence !== "false"
};
return Object.assign(
pIncidence,
{
hasRelation: pIncidence.incidence !== "false"
}
);
})

@@ -19,0 +20,0 @@ };

@@ -18,5 +18,5 @@ "use strict";

subgraph "cluster_/node_modules" {label="node_modules" style="rounded" subgraph "cluster_/node_modules/somemodule" {label="somemodule" style="rounded" subgraph "cluster_/node_modules/somemodule/node_modules" {label="node_modules" style="rounded" subgraph "cluster_/node_modules/somemodule/node_modules/someothermodule" {label="someothermodule" style="rounded" "node_modules/somemodule/node_modules/someothermodule/main.js" [label="main.js"] } } } }
subgraph "cluster_/node_modules" {label="node_modules" style="rounded" subgraph "cluster_/node_modules/somemodule" {label="somemodule" style="rounded" subgraph "cluster_/node_modules/somemodule/src" {label="src" style="rounded" "node_modules/somemodule/src/moar-javascript.js" [label="moar-javascript.js"] } } }
subgraph "cluster_/node_modules" {label="node_modules" style="rounded" subgraph "cluster_/node_modules/somemodule" {label="somemodule" style="rounded" subgraph "cluster_/node_modules/somemodule/src" {label="src" style="rounded" "node_modules/somemodule/src/somemodule.js" [label="somemodule.js"] } } }
subgraph "cluster_/node_modules" {label="node_modules" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule" {label="somemodule" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule/node_modules" {label="node_modules" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule/node_modules/someothermodule" {label="someothermodule" fontname="Helvetica-bold" style="rounded,bold" "node_modules/somemodule/node_modules/someothermodule/main.js" [label="main.js"] } } } }
subgraph "cluster_/node_modules" {label="node_modules" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule" {label="somemodule" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule/src" {label="src" fontname="Helvetica-bold" style="rounded,bold" "node_modules/somemodule/src/moar-javascript.js" [label="moar-javascript.js"] } } }
subgraph "cluster_/node_modules" {label="node_modules" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule" {label="somemodule" fontname="Helvetica-bold" style="rounded,bold" subgraph "cluster_/node_modules/somemodule/src" {label="src" fontname="Helvetica-bold" style="rounded,bold" "node_modules/somemodule/src/somemodule.js" [label="somemodule.js"] } } }
"one_only_one.js"

@@ -27,25 +27,25 @@ "one_only_two.js"

"shared.js"
subgraph "cluster_/sub" {label="sub" style="rounded" "sub/depindir.js" [label="depindir.js"] }
subgraph "cluster_/sub" {label="sub" style="rounded" "sub/dir.js" [label="dir.js"] }
subgraph "cluster_/sub" {label="sub" fontname="Helvetica-bold" style="rounded,bold" "sub/depindir.js" [label="depindir.js"] }
subgraph "cluster_/sub" {label="sub" fontname="Helvetica-bold" style="rounded,bold" "sub/dir.js" [label="dir.js"] }
"two_only_one.js"
"node_modules/somemodule/src/somemodule.js" -> "node_modules/somemodule/src/moar-javascript.js" [color="red" penwidth=2.0]
"node_modules/somemodule/src/somemodule.js" -> "node_modules/somemodule/node_modules/someothermodule/main.js" [color="red" penwidth=2.0]
"one_only_one.js" -> "path" [color="red" penwidth=2.0]
"one_only_two.js" -> "path" [color="red" penwidth=2.0]
"root_one.js" -> "one_only_one.js" [color="red" penwidth=2.0]
"root_one.js" -> "one_only_two.js" [color="red" penwidth=2.0]
"root_one.js" -> "shared.js" [color="red" penwidth=2.0]
"root_one.js" -> "sub/dir.js" [color="red" penwidth=2.0]
"root_one.js" -> "fs" [color="red" penwidth=2.0]
"root_one.js" -> "node_modules/somemodule/src/somemodule.js" [color="red" penwidth=2.0]
"root_two.js" -> "shared.js" [color="red" penwidth=2.0]
"root_two.js" -> "somedata.json" [color="red" penwidth=2.0]
"root_two.js" -> "two_only_one.js" [color="red" penwidth=2.0]
"root_two.js" -> "http" [color="red" penwidth=2.0]
"shared.js" -> "path" [color="red" penwidth=2.0]
"sub/depindir.js" -> "path" [color="red" penwidth=2.0]
"sub/dir.js" -> "sub/depindir.js" [color="red" penwidth=2.0]
"sub/dir.js" -> "path" [color="red" penwidth=2.0]
"two_only_one.js" -> "sub/dir.js" [color="red" penwidth=2.0]
"node_modules/somemodule/src/somemodule.js" -> "node_modules/somemodule/src/moar-javascript.js" [color="orange" penwidth=2.0]
"node_modules/somemodule/src/somemodule.js" -> "node_modules/somemodule/node_modules/someothermodule/main.js" [color="orange" penwidth=2.0]
"one_only_one.js" -> "path" [color="orange" penwidth=2.0]
"one_only_two.js" -> "path" [color="orange" penwidth=2.0]
"root_one.js" -> "one_only_one.js" [color="orange" penwidth=2.0]
"root_one.js" -> "one_only_two.js" [color="orange" penwidth=2.0]
"root_one.js" -> "shared.js" [color="orange" penwidth=2.0]
"root_one.js" -> "sub/dir.js" [color="orange" penwidth=2.0]
"root_one.js" -> "fs" [color="orange" penwidth=2.0]
"root_one.js" -> "node_modules/somemodule/src/somemodule.js" [color="orange" penwidth=2.0]
"root_two.js" -> "shared.js" [color="orange" penwidth=2.0]
"root_two.js" -> "somedata.json" [color="orange" penwidth=2.0]
"root_two.js" -> "two_only_one.js" [color="orange" penwidth=2.0]
"root_two.js" -> "http" [color="orange" penwidth=2.0]
"shared.js" -> "path" [color="orange" penwidth=2.0]
"sub/depindir.js" -> "path" [color="orange" penwidth=2.0]
"sub/dir.js" -> "sub/depindir.js" [color="orange" penwidth=2.0]
"sub/dir.js" -> "path" [color="orange" penwidth=2.0]
"two_only_one.js" -> "sub/dir.js" [color="orange" penwidth=2.0]
}

@@ -52,0 +52,0 @@ `;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc