dependency-cruiser 10.3.0-beta-7 → 10.3.1-beta-2

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-beta-7",
3
+ "version": "10.3.1-beta-2",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -131,21 +131,21 @@
131
131
  "version": "npm-run-all build depcruise:graph:doc scm:stage"
132
132
  },
133
133
  "dependencies": {
134
- "acorn": "8.4.1",
134
+ "acorn": "8.5.0",
135
135
  "acorn-jsx": "5.3.2",
136
136
  "acorn-jsx-walk": "2.0.0",
137
- "acorn-loose": "8.1.0",
138
- "acorn-walk": "8.1.1",
139
- "ajv": "8.6.2",
137
+ "acorn-loose": "8.2.1",
138
+ "acorn-walk": "8.2.0",
139
+ "ajv": "8.6.3",
140
140
  "chalk": "4.1.2",
141
- "commander": "8.1.0",
141
+ "commander": "8.2.0",
142
142
  "enhanced-resolve": "5.8.2",
143
143
  "figures": "^3.2.0",
144
144
  "get-stream": "^6.0.1",
145
145
  "glob": "7.1.7",
146
146
  "handlebars": "4.7.7",
147
147
  "indent-string": "^4.0.0",
148
- "inquirer": "8.1.2",
148
+ "inquirer": "8.1.5",
149
149
  "json5": "2.2.0",
150
150
  "lodash": "4.17.21",
151
151
  "safe-regex": "2.1.1",
@@ -156,13 +156,13 @@
156
156
  "wrap-ansi": "^7.0.0"
157
157
  },
158
158
  "devDependencies": {
159
- "@babel/core": "7.15.0",
160
- "@babel/plugin-transform-modules-commonjs": "7.15.0",
159
+ "@babel/core": "7.15.5",
160
+ "@babel/plugin-transform-modules-commonjs": "7.15.4",
161
161
  "@babel/preset-typescript": "7.15.0",
162
- "@swc/core": "1.2.83",
163
- "@typescript-eslint/eslint-plugin": "4.29.3",
164
- "@typescript-eslint/parser": "4.29.3",
165
- "c8": "7.8.0",
162
+ "@swc/core": "1.2.88",
163
+ "@typescript-eslint/eslint-plugin": "4.31.1",
164
+ "@typescript-eslint/parser": "4.31.1",
165
+ "c8": "7.9.0",
166
166
  "chai": "4.3.4",
167
167
  "chai-json-schema": "1.5.1",
168
168
  "coffeescript": "2.5.1",
@@ -174,18 +174,18 @@
174
174
  "eslint-plugin-mocha": "9.0.0",
175
175
  "eslint-plugin-node": "11.1.0",
176
176
  "eslint-plugin-security": "1.4.0",
177
- "eslint-plugin-unicorn": "35.0.0",
177
+ "eslint-plugin-unicorn": "36.0.0",
178
178
  "husky": "^4.3.8",
179
179
  "intercept-stdout": "0.1.2",
180
180
  "lint-staged": "11.1.2",
181
181
  "mocha": "9.1.1",
182
182
  "normalize-newline": "4.1.0",
183
183
  "npm-run-all": "4.1.5",
184
- "prettier": "2.3.2",
184
+ "prettier": "2.4.1",
185
185
  "shx": "0.3.3",
186
- "svelte": "3.42.4",
186
+ "svelte": "3.42.6",
187
187
  "symlink-dir": "5.0.1",
188
- "typescript": "4.4.2",
188
+ "typescript": "4.4.3",
189
189
  "upem": "^7.0.0",
190
190
  "vue-template-compiler": "2.6.14",
191
191
  "yarn": "1.22.11"
@@ -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
  )
@@ -1,16 +1,18 @@
1
- const _difference = require("lodash/difference");
2
1
  const _uniqWith = require("lodash/uniqWith");
3
2
 
4
3
  function violationIsEqual(pLeftViolation, pRightViolation) {
4
+ let lReturnValue = false;
5
5
  if (
6
6
  pLeftViolation.rule.name === pRightViolation.rule.name &&
7
7
  pLeftViolation.cycle
8
8
  ) {
9
- return (
10
- _difference(pLeftViolation.cycle, pRightViolation.cycle).length === 0
11
- );
9
+ lReturnValue =
10
+ pLeftViolation.cycle.length === pRightViolation.cycle.length &&
11
+ pLeftViolation.cycle.every((pModuleName) =>
12
+ pRightViolation.cycle.includes(pModuleName)
13
+ );
12
14
  }
13
- return false;
15
+ return lReturnValue;
14
16
  }
15
17
 
16
18
  module.exports = function deDuplicateViolations(pViolations) {
@@ -23,6 +23,7 @@ function extractMetaData(pViolations) {
23
23
  error: 0,
24
24
  warn: 0,
25
25
  info: 0,
26
+ ignore: 0,
26
27
  }
27
28
  );
28
29
  }
@@ -113,5 +113,6 @@ module.exports = function gatherInitialSources(
113
113
  } else {
114
114
  return pAll.concat(pathToPosix(pFileOrDirectory));
115
115
  }
116
- }, []);
116
+ }, [])
117
+ .sort();
117
118
  };
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-beta-7",
4
+ version: "10.3.1-beta-2",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },
@@ -172,6 +172,7 @@ module.exports = {
172
172
  error: { type: "number" },
173
173
  warn: { type: "number" },
174
174
  info: { type: "number" },
175
+ ignore: { type: "number" },
175
176
  totalCruised: { type: "number" },
176
177
  totalDependenciesCruised: { type: "number" },
177
178
  ruleSetUsed: { $ref: "#/definitions/RuleSetType" },
@@ -271,6 +271,10 @@ export interface ISummary {
271
271
  * the number of errors in the dependencies
272
272
  */
273
273
  error: number;
274
+ /**
275
+ * the number of ignored notices in the dependencies
276
+ */
277
+ ignore: number;
274
278
  /**
275
279
  * the number of informational level notices in the dependencies
276
280
  */