dependency-cruiser
Advanced tools
Comparing version 1.9.2 to 1.9.3
{ | ||
"name": "dependency-cruiser", | ||
"version": "1.9.2", | ||
"version": "1.9.3", | ||
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.", | ||
@@ -40,3 +40,3 @@ "bin": { | ||
"istanbul": "0.4.5", | ||
"js-makedepend": "2.0.0", | ||
"js-makedepend": "2.0.1", | ||
"mocha": "3.2.0", | ||
@@ -55,6 +55,6 @@ "npm-check-updates": "2.8.8", | ||
"dependencies": { | ||
"acorn": "4.0.3", | ||
"acorn": "4.0.4", | ||
"ajv": "4.10.0", | ||
"chalk": "1.1.3", | ||
"coffee-script": "1.12.1", | ||
"coffee-script": "1.12.2", | ||
"commander": "2.9.0", | ||
@@ -61,0 +61,0 @@ "figures": "2.0.0", |
"use strict"; | ||
const _ = require('lodash'); | ||
const _ = require('lodash'); | ||
const extract = require('./extract'); | ||
const gather = require('./gatherInitialSources'); | ||
const extract = require('./extract'); | ||
const gather = require('./gatherInitialSources'); | ||
const summarize = require('./summarize'); | ||
@@ -82,44 +83,2 @@ function extractRecursive (pFileName, pOptions, pVisited) { | ||
function cutNonTransgressions(pSourceEntry) { | ||
return { | ||
source: pSourceEntry.source, | ||
dependencies: pSourceEntry.dependencies.filter(pDep => pDep.valid === false) | ||
}; | ||
} | ||
function addSource(pSource) { | ||
return pDependency => Object.assign( | ||
{ | ||
from: pSource, | ||
to: pDependency.resolved, | ||
rule: pDependency.rule | ||
} | ||
); | ||
} | ||
function extractMetaData(pViolations) { | ||
return pViolations.reduce( | ||
(pAll, pThis) => { | ||
pAll[pThis.rule.severity] += 1; | ||
return pAll; | ||
} | ||
, { | ||
error : 0, | ||
warn : 0, | ||
info : 0 | ||
} | ||
); | ||
} | ||
function extractViolations(pInput){ | ||
return pInput | ||
.map(cutNonTransgressions) | ||
.filter(pDep => pDep.dependencies.length > 0) | ||
.sort((pOne, pTwo) => pOne.source > pTwo.source ? 1 : -1) | ||
.reduce( | ||
(pAll, pThis) => pAll.concat(pThis.dependencies.map(addSource(pThis.source))), | ||
[] | ||
); | ||
} | ||
function makeOptionsPresentable(pOptions) { | ||
@@ -150,3 +109,3 @@ const SHARABLE_OPTIONS = [ | ||
module.exports = (pFileDirArray, pOptions, pCallback) => { | ||
let lCallback = pCallback ? pCallback : (pInput => pInput); | ||
const lCallback = pCallback ? pCallback : (pInput => pInput); | ||
@@ -157,3 +116,2 @@ const lDependencies = _( | ||
.value(); | ||
const lViolations = extractViolations(lDependencies); | ||
@@ -165,7 +123,4 @@ return lCallback( | ||
Object.assign( | ||
summarize(lDependencies), | ||
{ | ||
violations : lViolations | ||
}, | ||
extractMetaData(lViolations), | ||
{ | ||
optionsUsed: makeOptionsPresentable(pOptions) | ||
@@ -172,0 +127,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
431260
55
1868
+ Addedacorn@4.0.4(transitive)
+ Addedcoffee-script@1.12.2(transitive)
- Removedacorn@4.0.3(transitive)
- Removedcoffee-script@1.12.1(transitive)
Updatedacorn@4.0.4
Updatedcoffee-script@1.12.2