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.0.6 to 1.1.0

test/report.dotReporter.spec.js

2

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

@@ -5,0 +5,0 @@ "bin": {

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

## Excluding modules from being cruised: --exclude
If you don't want to see certain modules in your report (or not have them
validated), you can exclude them by passing a regular expression to the
`--exclude` (short: `-x`) option. E.g. to exclude `node_modules` from being
scanned:
```sh
dependency-cruise -x "node_modules" -T html -f deps-without-node_modules.html src
```
Beacuse it's regular expressions, you can do more interesting stuff here as well. To exclude
all modules with a file path starting with coverage, test or node_modules, you could do this:
```sh
dependency-cruise -x "^(coverage|test|node_modules)" -T html -f deps-without-stuffs.html src
```
## Validation

@@ -81,0 +100,0 @@ Validates against a list of rules in a rules file. This defaults to a file

var Handlebars = require("handlebars/runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['dot.template.hbs'] = template({"1":function(container,depth0,helpers,partials,data) {
var stack1;
return " "
+ ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.folder : depth0),{"name":"if","hash":{},"fn":container.program(2, data, 0),"inverse":container.program(4, data, 0),"data":data})) != null ? stack1 : "");
},"2":function(container,depth0,helpers,partials,data) {
var stack1, helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function";
return "subgraph \"cluster_"
+ ((stack1 = ((helper = (helper = helpers.folder || (depth0 != null ? depth0.folder : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"folder","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" {label=\""
+ ((stack1 = ((helper = (helper = helpers.folder || (depth0 != null ? depth0.folder : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"folder","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" style=\"rounded,filled\" fillcolor=\"#f5f5f5\" \""
+ ((stack1 = ((helper = (helper = helpers.source || (depth0 != null ? depth0.source : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"source","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\" [label=\""
+ ((stack1 = ((helper = (helper = helpers.label || (depth0 != null ? depth0.label : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"label","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\"]}\n";
},"4":function(container,depth0,helpers,partials,data) {
var stack1, helper;
return " \""
return "\""
+ ((stack1 = ((helper = (helper = helpers.source || (depth0 != null ? depth0.source : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"source","hash":{},"data":data}) : helper))) != null ? stack1 : "")
+ "\"\n";
},"3":function(container,depth0,helpers,partials,data,blockParams,depths) {
},"6":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1;
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.dependencies : depth0),{"name":"each","hash":{},"fn":container.program(4, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"4":function(container,depth0,helpers,partials,data,blockParams,depths) {
return ((stack1 = helpers.each.call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.dependencies : depth0),{"name":"each","hash":{},"fn":container.program(7, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"7":function(container,depth0,helpers,partials,data,blockParams,depths) {
var stack1, helper, alias1=depth0 != null ? depth0 : {};

@@ -20,7 +37,11 @@

+ "\" "
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.valid : depth0),{"name":"if","hash":{},"fn":container.program(5, data, 0, blockParams, depths),"inverse":container.program(7, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
+ ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.valid : depth0),{"name":"if","hash":{},"fn":container.program(8, data, 0, blockParams, depths),"inverse":container.program(11, data, 0, blockParams, depths),"data":data})) != null ? stack1 : "")
+ "\n";
},"5":function(container,depth0,helpers,partials,data) {
return "";
},"7":function(container,depth0,helpers,partials,data) {
},"8":function(container,depth0,helpers,partials,data) {
var stack1;
return ((stack1 = helpers["if"].call(depth0 != null ? depth0 : {},(depth0 != null ? depth0.coreModule : depth0),{"name":"if","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "");
},"9":function(container,depth0,helpers,partials,data) {
return "[color=\"grey\"]";
},"11":function(container,depth0,helpers,partials,data) {
return "[color=\"red\" penwidth=2.0]";

@@ -30,6 +51,7 @@ },"compiler":[7,">= 4.0.0"],"main":function(container,depth0,helpers,partials,data,blockParams,depths) {

return "digraph \"dependency-cruiser output\"{\n ordering=out\n rankdir=LR\n splines=true\n overlap=false\n nodesep=0.16\n node [shape=box style=\"rounded, filled\" fillcolor=\"#ffffcc\" height=0.2 fontname=Helvetica fontsize=9]\n edge [color=black arrowhead=normal fontname=\"Helvetica\" fontsize=\"9\"]\n\n"
return "digraph \"dependency-cruiser output\"{\n ordering=out\n rankdir=LR\n splines=true\n overlap=false\n nodesep=0.16\n fontname=\"Helvetica\"\n fontsize=\"9\"\n compound=true\n node [shape=box style=\"rounded, filled\" fillcolor=\"#ffffcc\" height=0.2 fontname=Helvetica fontsize=9]\n edge [color=black arrowhead=normal fontname=\"Helvetica\" fontsize=\"9\"]\n\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 : "")
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.things : depth0),{"name":"each","hash":{},"fn":container.program(3, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "\n"
+ ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.things : depth0),{"name":"each","hash":{},"fn":container.program(6, data, 0, blockParams, depths),"inverse":container.noop,"data":data})) != null ? stack1 : "")
+ "}\n";
},"useData":true,"useDepths":true});
"use strict";
const path = require('path');
const Handlebars = require("handlebars/dist/cjs/handlebars.runtime");

@@ -16,6 +17,25 @@

function folderify(pDependencyItem) {
let lAdditions = {};
let lDirName = path.dirname(pDependencyItem.source);
if (lDirName !== ".") {
lAdditions.folder = lDirName;
}
lAdditions.label = path.basename(pDependencyItem.source);
return Object.assign(
pDependencyItem,
lAdditions
);
}
function render(pInput) {
return Handlebars.templates['dot.template.hbs']({"things" : pInput.sort(compareOnSource)});
return Handlebars.templates['dot.template.hbs']({
"things" : pInput.sort(compareOnSource).map(folderify)
});
}
exports.render = render;
[
{
"source": "test/fixtures/cjs/node_modules/somemodule/node_modules/someothermodule/main.js",
"source": "node_modules/somemodule/node_modules/someothermodule/main.js",
"dependencies": []
},
{
"source": "test/fixtures/cjs/node_modules/somemodule/src/moar-javascript.js",
"source": "node_modules/somemodule/src/moar-javascript.js",
"dependencies": []
},
{
"source": "test/fixtures/cjs/node_modules/somemodule/src/somemodule.js",
"source": "node_modules/somemodule/src/somemodule.js",
"dependencies": [
{
"module": "./moar-javascript",
"resolved": "test/fixtures/cjs/node_modules/somemodule/src/moar-javascript.js",
"resolved": "node_modules/somemodule/src/moar-javascript.js",
"moduleSystem": "cjs",

@@ -23,3 +23,3 @@ "coreModule": false,

"module": "someothermodule",
"resolved": "test/fixtures/cjs/node_modules/somemodule/node_modules/someothermodule/main.js",
"resolved": "node_modules/somemodule/node_modules/someothermodule/main.js",
"moduleSystem": "cjs",

@@ -33,3 +33,3 @@ "coreModule": false,

{
"source": "test/fixtures/cjs/one_only_one.js",
"source": "one_only_one.js",
"dependencies": [

@@ -47,3 +47,3 @@ {

{
"source": "test/fixtures/cjs/one_only_two.js",
"source": "one_only_two.js",
"dependencies": [

@@ -61,7 +61,7 @@ {

{
"source": "test/fixtures/cjs/root_one.js",
"source": "root_one.js",
"dependencies": [
{
"module": "./one_only_one",
"resolved": "test/fixtures/cjs/one_only_one.js",
"resolved": "one_only_one.js",
"moduleSystem": "cjs",

@@ -74,3 +74,3 @@ "coreModule": false,

"module": "./one_only_two",
"resolved": "test/fixtures/cjs/one_only_two.js",
"resolved": "one_only_two.js",
"moduleSystem": "cjs",

@@ -83,3 +83,3 @@ "coreModule": false,

"module": "./shared",
"resolved": "test/fixtures/cjs/shared.js",
"resolved": "shared.js",
"moduleSystem": "cjs",

@@ -92,3 +92,3 @@ "coreModule": false,

"module": "./sub/dir",
"resolved": "test/fixtures/cjs/sub/dir.js",
"resolved": "sub/dir.js",
"moduleSystem": "cjs",

@@ -109,3 +109,3 @@ "coreModule": false,

"module": "somemodule",
"resolved": "test/fixtures/cjs/node_modules/somemodule/src/somemodule.js",
"resolved": "node_modules/somemodule/src/somemodule.js",
"moduleSystem": "cjs",

@@ -119,3 +119,3 @@ "coreModule": false,

{
"source": "test/fixtures/cjs/shared.js",
"source": "shared.js",
"dependencies": [

@@ -133,7 +133,7 @@ {

{
"source": "test/fixtures/cjs/sub/dir.js",
"source": "sub/dir.js",
"dependencies": [
{
"module": "./depindir",
"resolved": "test/fixtures/cjs/sub/depindir.js",
"resolved": "sub/depindir.js",
"moduleSystem": "cjs",

@@ -155,3 +155,3 @@ "coreModule": false,

{
"source": "test/fixtures/cjs/sub/depindir.js",
"source": "sub/depindir.js",
"dependencies": [

@@ -169,7 +169,7 @@ {

{
"source": "test/fixtures/cjs/root_two.js",
"source": "root_two.js",
"dependencies": [
{
"module": "./shared",
"resolved": "test/fixtures/cjs/shared.js",
"resolved": "shared.js",
"moduleSystem": "cjs",

@@ -182,3 +182,3 @@ "coreModule": false,

"module": "./somedata.json",
"resolved": "test/fixtures/cjs/somedata.json",
"resolved": "somedata.json",
"moduleSystem": "cjs",

@@ -191,3 +191,3 @@ "coreModule": false,

"module": "./two_only_one",
"resolved": "test/fixtures/cjs/two_only_one.js",
"resolved": "two_only_one.js",
"moduleSystem": "cjs",

@@ -209,7 +209,7 @@ "coreModule": false,

{
"source": "test/fixtures/cjs/two_only_one.js",
"source": "two_only_one.js",
"dependencies": [
{
"module": "./sub/dir",
"resolved": "test/fixtures/cjs/sub/dir.js",
"resolved": "sub/dir.js",
"moduleSystem": "cjs",

@@ -216,0 +216,0 @@ "coreModule": false,

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