dependency-cruiser
Advanced tools
Comparing version 2.2.1 to 2.2.2
{ | ||
"name": "dependency-cruiser", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.", | ||
@@ -38,3 +38,3 @@ "bin": { | ||
"chai-json-schema": "1.4.0", | ||
"coffee-script": "1.12.5", | ||
"coffee-script": "1.12.6", | ||
"eslint": "3.19.0", | ||
@@ -44,7 +44,7 @@ "eslint-plugin-security": "1.3.0", | ||
"istanbul": "0.4.5", | ||
"js-makedepend": "2.2.2", | ||
"mocha": "3.2.0", | ||
"npm-check-updates": "2.11.0", | ||
"js-makedepend": "2.2.3", | ||
"mocha": "3.4.1", | ||
"npm-check-updates": "2.11.1", | ||
"nsp": "2.6.3", | ||
"typescript": "2.2.2" | ||
"typescript": "2.3.2" | ||
}, | ||
@@ -61,7 +61,7 @@ "repository": { | ||
"acorn": "5.0.3", | ||
"ajv": "5.0.0", | ||
"ajv": "5.1.3", | ||
"chalk": "1.1.3", | ||
"commander": "2.9.0", | ||
"figures": "2.0.0", | ||
"handlebars": "4.0.6", | ||
"handlebars": "4.0.8", | ||
"lodash": "4.17.4", | ||
@@ -68,0 +68,0 @@ "resolve": "1.3.3", |
@@ -20,2 +20,13 @@ "use strict"; | ||
/** | ||
* Creates a .dependency-cruiser config with a set of basic validations | ||
* to the current directory. | ||
* | ||
* @returns {void} Nothing | ||
* @throws {Error} An error object with the root cause of the problem | ||
* as a description: | ||
* - file already exists | ||
* - writing to the file doesn't work | ||
* | ||
*/ | ||
module.exports = () => { | ||
@@ -22,0 +33,0 @@ if (fileExists(DEPENDENCY_CRUISER_CONFIG)) { |
@@ -6,2 +6,3 @@ "use strict"; | ||
const DEFAULT_MODULE_SYSTEMS = ["cjs", "amd", "es6"]; | ||
const DEFAULT_RULES_FILE_NAME = ".dependency-cruiser.json"; | ||
@@ -22,3 +23,3 @@ function normalizeModuleSystems(pSystemList) { | ||
if (typeof pValidate === 'boolean' && pValidate){ | ||
return ".dependency-cruiser.json"; | ||
return DEFAULT_RULES_FILE_NAME; | ||
} else { | ||
@@ -29,2 +30,9 @@ return pValidate; | ||
/** | ||
* returns the pOptions, so that the returned value contains a | ||
* valid value for each possible option | ||
* | ||
* @param {object} pOptions [description] | ||
* @return {object} [description] | ||
*/ | ||
module.exports = (pOptions) => { | ||
@@ -31,0 +39,0 @@ pOptions = _.defaults(pOptions, { |
"use strict"; | ||
const _ = require('lodash'); | ||
const _ = require('lodash'); | ||
const extract = require('./extract'); | ||
const detectCircularity = require('./detectCircularity'); | ||
const gather = require('./gatherInitialSources'); | ||
const summarize = require('./summarize'); | ||
const addValidations = require('./addValidations'); | ||
const extract = require('./extract'); | ||
const dependencyEndsUpAtFrom = require('./dependencyEndsUpAtFrom'); | ||
const gather = require('./gatherInitialSources'); | ||
const summarize = require('./summarize'); | ||
const addValidations = require('./addValidations'); | ||
@@ -121,2 +121,36 @@ function extractRecursive (pFileName, pOptions, pVisited) { | ||
function addCircularityCheckToDependency (pToDep, pGraph, pFrom) { | ||
return Object.assign( | ||
{}, | ||
pToDep, | ||
{ | ||
circular: dependencyEndsUpAtFrom(pGraph, pFrom, pToDep.resolved) | ||
} | ||
); | ||
} | ||
/** | ||
* Runs through all dependencies, for each of them determines | ||
* whether it's (part of a) circular (relationship) and returns the | ||
* dependencies with that added. | ||
* | ||
* @param {Object} pDependencies [description] | ||
* @return {Object} the same dependencies, but for each | ||
* of them added whether or not it is | ||
* part of | ||
*/ | ||
function addCircularityCheckToGraph (pDependencies) { | ||
return pDependencies.map( | ||
pNode => Object.assign( | ||
{}, | ||
pNode, | ||
{ | ||
dependencies: pNode.dependencies.map( | ||
pToDep => addCircularityCheckToDependency(pToDep, pDependencies, pNode.source) | ||
) | ||
} | ||
) | ||
); | ||
} | ||
module.exports = (pFileDirArray, pOptions, pCallback) => { | ||
@@ -131,3 +165,3 @@ const lCallback = pCallback ? pCallback : (pInput => pInput); | ||
if (circularityDetectionNecessary(pOptions)){ | ||
lDependencies = detectCircularity(lDependencies); | ||
lDependencies = addCircularityCheckToGraph(lDependencies); | ||
} | ||
@@ -134,0 +168,0 @@ |
@@ -17,2 +17,4 @@ "use strict"; | ||
* @return {object} The validated & normalized rule set | ||
* @throws {Error} An error with the reason for the error as | ||
* a message | ||
*/ | ||
@@ -19,0 +21,0 @@ module.exports = pRuleSetJSON => |
@@ -47,2 +47,4 @@ "use strict"; | ||
* @return {object} The ruleset as passed | ||
* @throws {Error} An error with the reason for the error as | ||
* a message | ||
*/ | ||
@@ -49,0 +51,0 @@ module.exports = (pRuleSet) => { |
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
11
130401
55
2440
+ Addedajv@5.1.3(transitive)
+ Addedhandlebars@4.0.8(transitive)
- Removedajv@5.0.0(transitive)
- Removedhandlebars@4.0.6(transitive)
Updatedajv@5.1.3
Updatedhandlebars@4.0.8