dependency-cruiser 10.3.0 → 10.3.1-beta-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "10.3.0",
3
+ "version": "10.3.1-beta-1",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -19,6 +19,25 @@ function softenModuleViolation(
19
19
  };
20
20
  }
21
21
 
22
+ function knownErrorMatchesViolation(pKnownError, pViolationKey) {
23
+ if (pKnownError.rule.name === pViolationKey.rule.name) {
24
+ if (pViolationKey.cycle && pKnownError.cycle) {
25
+ return (
26
+ pKnownError.cycle.length === pViolationKey.cycle.length &&
27
+ pKnownError.cycle.every((pModule) =>
28
+ pViolationKey.cycle.includes(pModule)
29
+ )
30
+ );
31
+ } else {
32
+ return (
33
+ pKnownError.from === pViolationKey.from &&
34
+ pKnownError.to === pViolationKey.to
35
+ );
36
+ }
37
+ }
38
+ return false;
39
+ }
40
+
22
41
  function softenDependencyViolation(
23
42
  pViolationKey,
24
43
  pKnownDependencyViolations,
@@ -26,11 +45,8 @@ function softenDependencyViolation(
26
45
  ) {
27
46
  return {
28
47
  ...pViolationKey.rule,
29
- severity: pKnownDependencyViolations.some(
30
- (pKnownError) =>
31
- pKnownError.from === pViolationKey.from &&
32
- pKnownError.to === pViolationKey.to &&
33
- pKnownError.rule.name === pViolationKey.rule.name
48
+ severity: pKnownDependencyViolations.some((pKnownError) =>
49
+ knownErrorMatchesViolation(pKnownError, pViolationKey)
34
50
  )
35
51
  ? pSoftenedSeverity
36
52
  : pViolationKey.rule.severity,
@@ -48,7 +64,12 @@ function softenDependencyViolations(
48
64
  ...pDependency,
49
65
  rules: pDependency.rules.map((pRule) =>
50
66
  softenDependencyViolation(
51
- { rule: pRule, from: pModuleSource, to: pDependency.resolved },
67
+ {
68
+ rule: pRule,
69
+ from: pModuleSource,
70
+ to: pDependency.resolved,
71
+ cycle: pDependency.cycle,
72
+ },
52
73
  pKnownDependencyViolations,
53
74
  pSoftenedSeverity
54
75
  )
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "10.3.0",
4
+ version: "10.3.1-beta-1",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },