dependency-cruiser 12.5.0-beta-4 → 12.5.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.
@@ -102,9 +102,14 @@ try {
102
102
  "prefix to use for links in the dot and err-html reporters"
103
103
  )
104
104
  .option(
105
- "-C, --cache [cache-location]",
105
+ "-C, --cache [cache-directory]",
106
106
  "(experimental) use a cache to speed up execution. " +
107
- "Location defaults to node_modules/.cache/dependency-cruiser"
107
+ "The directory defaults to node_modules/.cache/dependency-cruiser"
108
+ )
109
+ .option(
110
+ "--cache-strategy <strategy>",
111
+ "(experimental) strategy to use for detecting changed files in the cache. " +
112
+ "Possible values: metadata (= use git, the default), content"
108
113
  )
109
114
  .option("--preserve-symlinks", `leave symlinks unchanged (off by default)`)
110
115
  .option("-v, --validate [file]", `alias for --config`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "12.5.0-beta-4",
3
+ "version": "12.5.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",
@@ -149,7 +149,7 @@
149
149
  "acorn-walk": "8.2.0",
150
150
  "ajv": "8.12.0",
151
151
  "chalk": "^4.1.2",
152
- "commander": "9.5.0",
152
+ "commander": "10.0.0",
153
153
  "enhanced-resolve": "5.12.0",
154
154
  "figures": "^3.2.0",
155
155
  "get-stream": "^6.0.1",
@@ -175,26 +175,26 @@
175
175
  "@babel/core": "7.20.12",
176
176
  "@babel/plugin-transform-modules-commonjs": "7.20.11",
177
177
  "@babel/preset-typescript": "7.18.6",
178
- "@swc/core": "1.3.25",
178
+ "@swc/core": "1.3.26",
179
179
  "@types/lodash": "4.14.191",
180
180
  "@types/node": "18.11.18",
181
181
  "@types/prompts": "2.4.2",
182
- "@typescript-eslint/eslint-plugin": "5.48.0",
183
- "@typescript-eslint/parser": "5.48.0",
182
+ "@typescript-eslint/eslint-plugin": "5.48.1",
183
+ "@typescript-eslint/parser": "5.48.1",
184
184
  "@vue/compiler-sfc": "3.2.45",
185
185
  "c8": "7.12.0",
186
186
  "chai": "4.3.7",
187
187
  "chai-json-schema": "1.5.1",
188
188
  "coffeescript": "2.7.0",
189
- "eslint": "8.31.0",
189
+ "eslint": "8.32.0",
190
190
  "eslint-config-moving-meadow": "4.0.2",
191
191
  "eslint-config-prettier": "8.6.0",
192
192
  "eslint-plugin-budapestian": "5.0.1",
193
193
  "eslint-plugin-eslint-comments": "3.2.0",
194
- "eslint-plugin-import": "2.26.0",
194
+ "eslint-plugin-import": "2.27.4",
195
195
  "eslint-plugin-mocha": "10.1.0",
196
196
  "eslint-plugin-node": "11.1.0",
197
- "eslint-plugin-security": "1.5.0",
197
+ "eslint-plugin-security": "1.6.0",
198
198
  "eslint-plugin-unicorn": "^45.0.0",
199
199
  "husky": "8.0.3",
200
200
  "intercept-stdout": "0.1.2",
@@ -202,10 +202,10 @@
202
202
  "mocha": "10.2.0",
203
203
  "normalize-newline": "^3.0.0",
204
204
  "npm-run-all": "4.1.5",
205
- "prettier": "2.8.2",
205
+ "prettier": "2.8.3",
206
206
  "proxyquire": "2.1.3",
207
207
  "shx": "0.3.4",
208
- "svelte": "3.55.0",
208
+ "svelte": "3.55.1",
209
209
  "symlink-dir": "5.1.0",
210
210
  "typescript": "4.9.4",
211
211
  "upem": "7.3.1",
package/src/cache/utl.js CHANGED
@@ -111,7 +111,10 @@ function moduleIsInterestingForDiff(pModule) {
111
111
  !pModule.consolidated &&
112
112
  !pModule.coreModule &&
113
113
  !pModule.couldNotResolve &&
114
- !pModule.matchesDoNotFollow
114
+ !pModule.matchesDoNotFollow &&
115
+ // as followable is optional, !exists when the module _is_ followable
116
+ // explicit comparison with false
117
+ pModule.followable !== false
115
118
  );
116
119
  }
117
120
 
@@ -8,14 +8,7 @@ const loadConfig = require("../config-utl/extract-depcruise-config");
8
8
  const defaults = require("./defaults");
9
9
 
10
10
  function getOptionValue(pDefault) {
11
- return (pValue) => {
12
- let lReturnValue = pDefault;
13
-
14
- if (typeof pValue === "string") {
15
- lReturnValue = pValue;
16
- }
17
- return lReturnValue;
18
- };
11
+ return (pValue) => (typeof pValue === "string" ? pValue : pDefault);
19
12
  }
20
13
 
21
14
  function normalizeConfigFileName(pCliOptions, pConfigWrapperName, pDefault) {
@@ -104,44 +97,84 @@ function validateAndGetKnownViolationsFileName(pKnownViolations) {
104
97
  }
105
98
 
106
99
  function normalizeKnownViolationsOption(pCliOptions) {
107
- if (has(pCliOptions, "ignoreKnown")) {
108
- const lReturnValue = {
109
- knownViolationsFile: validateAndGetKnownViolationsFileName(
110
- pCliOptions.ignoreKnown
111
- ),
112
- };
113
- return lReturnValue;
100
+ if (!has(pCliOptions, "ignoreKnown")) {
101
+ return {};
114
102
  }
115
- return {};
103
+ return {
104
+ knownViolationsFile: validateAndGetKnownViolationsFileName(
105
+ pCliOptions.ignoreKnown
106
+ ),
107
+ };
116
108
  }
117
109
 
118
110
  function normalizeValidationOption(pCliOptions) {
119
- if (has(pCliOptions, "validate")) {
120
- const rulesFile = validateAndNormalizeRulesFileName(pCliOptions.validate);
121
- return {
122
- rulesFile,
123
- ruleSet: loadConfig(
124
- path.isAbsolute(rulesFile) ? rulesFile : `./${rulesFile}`
125
- ),
126
- validate: true,
127
- };
128
- } else {
111
+ if (!has(pCliOptions, "validate")) {
129
112
  return {
130
113
  validate: false,
131
114
  };
132
115
  }
116
+ const rulesFile = validateAndNormalizeRulesFileName(pCliOptions.validate);
117
+ return {
118
+ rulesFile,
119
+ ruleSet: loadConfig(
120
+ path.isAbsolute(rulesFile) ? rulesFile : `./${rulesFile}`
121
+ ),
122
+ validate: true,
123
+ };
133
124
  }
134
125
 
135
126
  function normalizeProgress(pCliOptions) {
136
- let lProgress = null;
127
+ if (!has(pCliOptions, "progress")) {
128
+ return {};
129
+ }
130
+
131
+ let lProgress = pCliOptions.progress;
132
+ if (lProgress === true) {
133
+ lProgress = "cli-feedback";
134
+ }
135
+ return { progress: lProgress };
136
+ }
137
+
138
+ function normalizeCacheStrategy(pCliOptions) {
139
+ if (!has(pCliOptions, "cacheStrategy")) {
140
+ return {};
141
+ }
142
+ const lStrategy =
143
+ pCliOptions.cacheStrategy === "content" ? "content" : "metadata";
137
144
 
138
- if (has(pCliOptions, "progress")) {
139
- lProgress = get(pCliOptions, "progress");
140
- if (lProgress === true) {
141
- lProgress = "cli-feedback";
142
- }
145
+ let lReturnValue = {};
146
+
147
+ if (pCliOptions.cache && typeof pCliOptions.cache === "object") {
148
+ lReturnValue.cache = clone(pCliOptions.cache);
149
+ lReturnValue.cache.strategy = lStrategy;
150
+ } else {
151
+ lReturnValue = {
152
+ cache: {
153
+ strategy: lStrategy,
154
+ },
155
+ };
156
+ }
157
+ return lReturnValue;
158
+ }
159
+
160
+ function normalizeCache(pCliOptions) {
161
+ if (!has(pCliOptions, "cache")) {
162
+ return {};
143
163
  }
144
- return lProgress ? { progress: lProgress } : {};
164
+
165
+ if (pCliOptions.cache === true) {
166
+ return { cache: {} };
167
+ }
168
+
169
+ if (typeof pCliOptions.cache === "string") {
170
+ return {
171
+ cache: {
172
+ folder: pCliOptions.cache,
173
+ },
174
+ };
175
+ }
176
+
177
+ return { cache: false };
145
178
  }
146
179
 
147
180
  /**
@@ -171,6 +204,8 @@ module.exports = function normalizeOptions(pOptionsAsPassedFromCommander) {
171
204
 
172
205
  lOptions = { ...lOptions, ...normalizeValidationOption(lOptions) };
173
206
  lOptions = { ...lOptions, ...normalizeProgress(lOptions) };
207
+ lOptions = { ...lOptions, ...normalizeCache(lOptions) };
208
+ lOptions = { ...lOptions, ...normalizeCacheStrategy(lOptions) };
174
209
  lOptions = { ...lOptions, ...normalizeKnownViolationsOption(lOptions) };
175
210
  lOptions = normalizeConfigFileName(
176
211
  lOptions,
@@ -1,4 +1,5 @@
1
1
  const has = require("lodash/has");
2
+ const merge = require("lodash/merge");
2
3
  const safeRegex = require("safe-regex");
3
4
  const report = require("../../report");
4
5
 
@@ -103,7 +104,7 @@ function validateCruiseOptions(pOptions) {
103
104
  if (has(pOptions, "ruleSet.options")) {
104
105
  lReturnValue = validateCruiseOptions(pOptions.ruleSet.options);
105
106
  }
106
- return { ...lReturnValue, ...pOptions };
107
+ return merge({}, lReturnValue, pOptions);
107
108
  }
108
109
  return lReturnValue;
109
110
  }
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "12.5.0-beta-4",
4
+ version: "12.5.1-beta-1",
5
5
  engines: {
6
6
  node: "^14||^16||>=18",
7
7
  },
package/types/README.md DELETED
@@ -1 +0,0 @@
1
- ![overview](overview.svg)