dependency-cruiser 10.8.0-beta-3 → 10.8.0

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.8.0-beta-3",
3
+ "version": "10.8.0",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -131,13 +131,13 @@
131
131
  "version": "npm-run-all build depcruise:graph:doc scm:stage"
132
132
  },
133
133
  "dependencies": {
134
- "acorn": "8.5.0",
134
+ "acorn": "8.6.0",
135
135
  "acorn-jsx": "5.3.2",
136
136
  "acorn-jsx-walk": "2.0.0",
137
137
  "acorn-loose": "8.2.1",
138
138
  "acorn-walk": "8.2.0",
139
- "ajv": "8.6.3",
140
- "chalk": "4.1.2",
139
+ "ajv": "8.8.2",
140
+ "chalk": "^4.1.2",
141
141
  "commander": "8.3.0",
142
142
  "enhanced-resolve": "5.8.3",
143
143
  "figures": "^3.2.0",
@@ -152,17 +152,17 @@
152
152
  "semver": "^7.3.5",
153
153
  "semver-try-require": "^5.0.1",
154
154
  "teamcity-service-messages": "0.1.11",
155
- "tsconfig-paths-webpack-plugin": "3.5.1",
155
+ "tsconfig-paths-webpack-plugin": "3.5.2",
156
156
  "wrap-ansi": "^7.0.0"
157
157
  },
158
158
  "devDependencies": {
159
- "@babel/core": "7.15.8",
160
- "@babel/plugin-transform-modules-commonjs": "7.15.4",
161
- "@babel/preset-typescript": "7.15.0",
162
- "@swc/core": "1.2.105",
163
- "@typescript-eslint/eslint-plugin": "5.2.0",
164
- "@typescript-eslint/parser": "5.2.0",
165
- "@vue/compiler-sfc": "3.2.20",
159
+ "@babel/core": "7.16.0",
160
+ "@babel/plugin-transform-modules-commonjs": "7.16.0",
161
+ "@babel/preset-typescript": "7.16.0",
162
+ "@swc/core": "1.2.113",
163
+ "@typescript-eslint/eslint-plugin": "5.4.0",
164
+ "@typescript-eslint/parser": "5.4.0",
165
+ "@vue/compiler-sfc": "3.2.23",
166
166
  "c8": "7.10.0",
167
167
  "chai": "4.3.4",
168
168
  "chai-json-schema": "1.5.1",
@@ -171,23 +171,23 @@
171
171
  "eslint-config-moving-meadow": "2.0.9",
172
172
  "eslint-config-prettier": "8.3.0",
173
173
  "eslint-plugin-budapestian": "3.0.1",
174
- "eslint-plugin-import": "2.25.2",
174
+ "eslint-plugin-import": "2.25.3",
175
175
  "eslint-plugin-mocha": "9.0.0",
176
176
  "eslint-plugin-node": "11.1.0",
177
177
  "eslint-plugin-security": "1.4.0",
178
- "eslint-plugin-unicorn": "37.0.1",
178
+ "eslint-plugin-unicorn": "39.0.0",
179
179
  "husky": "^4.3.8",
180
180
  "intercept-stdout": "0.1.2",
181
- "lint-staged": "11.2.6",
181
+ "lint-staged": "12.1.2",
182
182
  "mocha": "9.1.3",
183
183
  "normalize-newline": "^3.0.0",
184
184
  "npm-run-all": "4.1.5",
185
- "prettier": "2.4.1",
185
+ "prettier": "2.5.0",
186
186
  "proxyquire": "2.1.3",
187
187
  "shx": "0.3.3",
188
- "svelte": "3.44.0",
188
+ "svelte": "3.44.2",
189
189
  "symlink-dir": "5.0.1",
190
- "typescript": "4.4.4",
190
+ "typescript": "4.5.2",
191
191
  "upem": "^7.0.0",
192
192
  "vue-template-compiler": "2.6.14",
193
193
  "yarn": "1.22.17"
@@ -199,6 +199,11 @@
199
199
  "policy": "wanted",
200
200
  "because": "some eslint plugins (eslint-plugin-budapestian) are not compatible with eslint 8 yet "
201
201
  },
202
+ {
203
+ "package": "chalk",
204
+ "policy": "wanted",
205
+ "because": "version 5 only exports ejs - and we use cjs and don't transpile"
206
+ },
202
207
  {
203
208
  "package": "figures",
204
209
  "policy": "wanted",
@@ -1,14 +1,26 @@
1
- const _memoize = require("lodash/memoize");
1
+ let gIndexedGraph = null;
2
2
 
3
- function bareFindModuleByName(pGraph, pSource) {
4
- return pGraph.find((pNode) => pNode.source === pSource);
3
+ /**
4
+ * Returns the module with attribute pSource, when it exists in the pModuleGraph.
5
+ * Returns undefined when it doesn't.
6
+ *
7
+ * This function uses an indexed cache for efficiency reasons. If you need to
8
+ * call this function consecutively for different module graphs, you can clear
9
+ * this cache with the clearCache function from this module.
10
+ *
11
+ * @param {import('../../../types/cruise-result').IModule[]} pModuleGraph
12
+ * @param {string} pSource
13
+ * @returns {import('../../../types/cruise-result').IModule | undefined}
14
+ */
15
+ function findModuleByName(pModuleGraph, pSource) {
16
+ if (!gIndexedGraph) {
17
+ gIndexedGraph = new Map(
18
+ pModuleGraph.map((pModule) => [pModule.source, pModule])
19
+ );
20
+ }
21
+ return gIndexedGraph.get(pSource);
5
22
  }
6
23
 
7
- const findModuleByName = _memoize(
8
- bareFindModuleByName,
9
- (_pGraph, pSource) => pSource
10
- );
11
-
12
24
  function isDependent(pResolvedName) {
13
25
  return (pModule) =>
14
26
  pModule.dependencies.some(
@@ -17,7 +29,11 @@ function isDependent(pResolvedName) {
17
29
  }
18
30
 
19
31
  function clearCache() {
20
- findModuleByName.cache.clear();
32
+ gIndexedGraph = null;
21
33
  }
22
34
 
23
- module.exports = { findModuleByName, clearCache, isDependent };
35
+ module.exports = {
36
+ findModuleByName,
37
+ clearCache,
38
+ isDependent,
39
+ };
@@ -78,7 +78,8 @@ function softenKnownViolation(pModule, pKnownViolations, pSoftenedSeverity) {
78
78
  pRule,
79
79
  pModule.source,
80
80
  pKnownViolations.filter(
81
- (pKnownError) => pKnownError.from === pKnownError.to
81
+ (pKnownError) =>
82
+ pKnownError.from === pKnownError.to && !pKnownError.cycle
82
83
  ),
83
84
  pSoftenedSeverity
84
85
  )
@@ -93,7 +94,8 @@ function softenKnownViolation(pModule, pKnownViolations, pSoftenedSeverity) {
93
94
  pDependency,
94
95
  pModule.source,
95
96
  pKnownViolations.filter(
96
- (pKnownError) => pKnownError.from !== pKnownError.to
97
+ (pKnownError) =>
98
+ pKnownError.from !== pKnownError.to || pKnownError.cycle
97
99
  ),
98
100
  pSoftenedSeverity
99
101
  )
@@ -119,7 +119,13 @@ if (VisitorModule) {
119
119
  // also include the same method, but with the correct spelling.
120
120
  visitExportAllDeclration(pNode) {
121
121
  this.pushImportExportSource(pNode);
122
- return super.visitExportAllDeclration(pNode);
122
+ /* c8 ignore start */
123
+ if (super.visitExportAllDeclration) {
124
+ return super.visitExportAllDeclration(pNode);
125
+ } else {
126
+ /* c8 ignore stop */
127
+ return super.visitExportAllDeclaration(pNode);
128
+ }
123
129
  }
124
130
 
125
131
  /* c8 ignore start */
@@ -131,7 +137,13 @@ if (VisitorModule) {
131
137
  // same spelling error as the above - same solution
132
138
  visitExportNamedDeclration(pNode) {
133
139
  this.pushImportExportSource(pNode);
134
- return super.visitExportNamedDeclration(pNode);
140
+ /* c8 ignore start */
141
+ if (super.visitExportNamedDeclration) {
142
+ return super.visitExportNamedDeclration(pNode);
143
+ } else {
144
+ /* c8 ignore stop */
145
+ return super.visitExportNamedDeclaration(pNode);
146
+ }
135
147
  }
136
148
  /* c8 ignore start */
137
149
  visitExportNamedDeclaration(pNode) {
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "10.8.0-beta-3",
4
+ version: "10.8.0",
5
5
  engines: {
6
6
  node: "^12.20||^14||>=16",
7
7
  },