dependency-cruiser 13.0.0-beta-7 → 13.0.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.
Files changed (34) hide show
  1. package/README.md +5 -5
  2. package/bin/dependency-cruise.mjs +1 -1
  3. package/package.json +22 -20
  4. package/src/cache/cache.mjs +3 -2
  5. package/src/cache/content-strategy.mjs +27 -21
  6. package/src/cache/find-content-changes.mjs +4 -2
  7. package/src/cache/helpers.mjs +13 -7
  8. package/src/cache/metadata-strategy.mjs +14 -11
  9. package/src/cache/options-compatible.mjs +1 -0
  10. package/src/cli/init-config/config.js.template.js +1 -1
  11. package/src/cli/init-config/environment-helpers.mjs +0 -1
  12. package/src/cli/init-config/write-run-scripts-to-manifest.mjs +0 -1
  13. package/src/cli/listeners/performance-log/format-helpers.mjs +48 -22
  14. package/src/cli/listeners/performance-log/handlers.mjs +2 -0
  15. package/src/config-utl/extract-ts-config.mjs +1 -1
  16. package/src/enrich/derive/metrics/get-module-metrics.mjs +0 -1
  17. package/src/enrich/summarize/summarize-options.mjs +1 -1
  18. package/src/extract/parse/to-javascript-ast.mjs +0 -1
  19. package/src/extract/parse/to-swc-ast.mjs +0 -1
  20. package/src/extract/parse/to-typescript-ast.mjs +0 -1
  21. package/src/extract/resolve/external-module-helpers.mjs +0 -1
  22. package/src/extract/resolve/module-classifiers.mjs +0 -1
  23. package/src/extract/transpile/index.mjs +0 -1
  24. package/src/extract/transpile/meta.mjs +0 -1
  25. package/src/meta.js +1 -1
  26. package/src/report/error-html/utl.mjs +0 -1
  27. package/src/report/null.mjs +1 -1
  28. package/src/report/plugins.mjs +0 -1
  29. package/src/utl/bus.mjs +0 -1
  30. package/types/cruise-result.d.ts +5 -46
  31. package/types/dependency-cruiser.d.ts +1 -1
  32. package/types/extract-ts-config.d.ts +5 -0
  33. package/types/options.d.ts +72 -1
  34. package/types/reporter-options.d.ts +1 -1
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
- # Dependency cruiser ![Dependency cruiser](https://raw.githubusercontent.com/sverweij/dependency-cruiser/master/doc/assets/ZKH-Dependency-recolored-160.png)
1
+ # Dependency cruiser ![Dependency cruiser](https://raw.githubusercontent.com/sverweij/dependency-cruiser/main/doc/assets/ZKH-Dependency-recolored-160.png)
2
2
 
3
3
  _Validate and visualise dependencies. With your rules._ JavaScript. TypeScript. CoffeeScript. ES6, CommonJS, AMD.
4
4
 
5
5
  ## What's this do?
6
6
 
7
- ![Snazzy dot output to whet your appetite](https://raw.githubusercontent.com/sverweij/dependency-cruiser/master/doc/assets/sample-dot-output.png)
7
+ ![Snazzy dot output to whet your appetite](https://raw.githubusercontent.com/sverweij/dependency-cruiser/main/doc/assets/sample-dot-output.png)
8
8
 
9
9
  This runs through the dependencies in any JavaScript, TypeScript, LiveScript or CoffeeScript project and ...
10
10
 
@@ -138,7 +138,7 @@ npx depcruise src
138
138
 
139
139
  This will validate against your rules and shows any violations in an eslint-like format:
140
140
 
141
- ![sample err output](https://raw.githubusercontent.com/sverweij/dependency-cruiser/master/doc/assets/sample-err-output.png)
141
+ ![sample err output](https://raw.githubusercontent.com/sverweij/dependency-cruiser/main/doc/assets/sample-err-output.png)
142
142
 
143
143
  There's more ways to report validations; in a graph (like the one on top of this
144
144
  readme) or in an self-containing `html` file.
@@ -148,7 +148,7 @@ readme) or in an self-containing `html` file.
148
148
  documentation.
149
149
  - dependency-cruiser uses itself to check on itself in its own build process;
150
150
  see the `depcruise` script in the
151
- [package.json](https://github.com/sverweij/dependency-cruiser/blob/master/package.json#L76)
151
+ [package.json](https://github.com/sverweij/dependency-cruiser/blob/main/package.json#L76)
152
152
 
153
153
  ## I want to know more!
154
154
 
@@ -192,7 +192,7 @@ You've come to the right place :-) :
192
192
 
193
193
  ## Build status
194
194
 
195
- [![GitHub Workflow Status](https://github.com/sverweij/dependency-cruiser/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/sverweij/dependency-cruiser/actions/workflows/ci.yml)
195
+ [![GitHub Workflow Status](https://github.com/sverweij/dependency-cruiser/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sverweij/dependency-cruiser/actions/workflows/ci.yml)
196
196
  [![coverage](https://gitlab.com/sverweij/dependency-cruiser/badges/master/coverage.svg)](https://gitlab.com/sverweij/dependency-cruiser/builds)
197
197
  [![Maintainability](https://api.codeclimate.com/v1/badges/93035ef5fba33901d479/maintainability)](https://codeclimate.com/github/sverweij/dependency-cruiser/maintainability)
198
198
  [![Test Coverage](https://api.codeclimate.com/v1/badges/93035ef5fba33901d479/test_coverage)](https://codeclimate.com/github/sverweij/dependency-cruiser/test_coverage)
@@ -162,7 +162,7 @@ try {
162
162
  .addHelpText(
163
163
  "after",
164
164
  `${EOL}Other options:` +
165
- `${EOL} see https://github.com/sverweij/dependency-cruiser/blob/master/doc/cli.md${EOL}`
165
+ `${EOL} see https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md${EOL}`
166
166
  )
167
167
  .version(meta.version)
168
168
  .arguments("[files-or-directories]")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "13.0.0-beta-7",
3
+ "version": "13.0.1",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -46,7 +46,8 @@
46
46
  "main": "src/main/index.mjs",
47
47
  "exports": {
48
48
  ".": {
49
- "import": "./src/main/index.mjs"
49
+ "import": "./src/main/index.mjs",
50
+ "types": "./types/dependency-cruiser.d.ts"
50
51
  },
51
52
  "./config-utl/extract-babel-config": {
52
53
  "import": "./src/config-utl/extract-babel-config.mjs"
@@ -55,7 +56,8 @@
55
56
  "import": "./src/config-utl/extract-depcruise-config/index.mjs"
56
57
  },
57
58
  "./config-utl/extract-ts-config": {
58
- "import": "./src/config-utl/extract-ts-config.mjs"
59
+ "import": "./src/config-utl/extract-ts-config.mjs",
60
+ "types": "./types/extract-ts-config.d.ts"
59
61
  },
60
62
  "./config-utl/extract-webpack-resolve-config": {
61
63
  "import": "./src/config-utl/extract-webpack-resolve-config.mjs"
@@ -96,13 +98,13 @@
96
98
  "depcruise:graph:doc:fmt-types": "cd types && node ../bin/dependency-cruise.mjs . --output-type dot | dot -T svg > overview.svg && cd -",
97
99
  "depcruise:graph:doc:samples": "sh tools/generate-samples.sh",
98
100
  "depcruise:graph:mermaid": "node ./bin/dependency-cruise.mjs bin src --include-only ^src/ --collapse 2 --output-type mermaid",
99
- "depcruise:graph:mermaid:diff": "node ./bin/dependency-cruise.mjs bin src test types tools --config configs/.dependency-cruiser-unlimited.json --output-type mermaid --reaches \"$(watskeburt $SHA)\"",
100
- "depcruise:graph:view": "node ./bin/dependency-cruise.mjs bin src --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-show-metrics-config.mjs --output-type dot --progress cli-feedback --highlight \"$(watskeburt develop)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
101
- "depcruise:graph:view:diff": "node ./bin/dependency-cruise.mjs bin src test --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-unlimited.json --output-type dot --progress cli-feedback --reaches \"$(watskeburt develop)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
101
+ "depcruise:graph:mermaid:diff": "node ./bin/dependency-cruise.mjs bin src test types tools --config configs/.dependency-cruiser-unlimited.mjs --output-type mermaid --reaches \"$(watskeburt $SHA)\"",
102
+ "depcruise:graph:view": "node ./bin/dependency-cruise.mjs bin src --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-show-metrics-config.mjs --output-type dot --progress cli-feedback --highlight \"$(watskeburt main)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
103
+ "depcruise:graph:view:diff": "node ./bin/dependency-cruise.mjs bin src test --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-unlimited.mjs --output-type dot --progress cli-feedback --reaches \"$(watskeburt main)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
102
104
  "depcruise:report": "node ./bin/dependency-cruise.mjs src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.mjs --output-to dependency-violations.html",
103
105
  "depcruise:report:view": "node ./bin/dependency-cruise.mjs src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.mjs --output-to - | browser",
104
106
  "depcruise:focus": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --output-type text --focus",
105
- "depcruise:reaches": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --config configs/.dependency-cruiser-unlimited.json --output-type text --reaches",
107
+ "depcruise:reaches": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --config configs/.dependency-cruiser-unlimited.mjs --output-type text --reaches",
106
108
  "format": "prettier --loglevel warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
107
109
  "format:check": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
108
110
  "lint": "npm-run-all --parallel --aggregate-output lint:eslint format:check lint:types",
@@ -151,10 +153,10 @@
151
153
  "ajv": "8.12.0",
152
154
  "chalk": "5.2.0",
153
155
  "commander": "10.0.1",
154
- "enhanced-resolve": "5.13.0",
156
+ "enhanced-resolve": "5.14.0",
155
157
  "figures": "5.0.0",
156
158
  "get-stream": "^6.0.1",
157
- "glob": "10.2.2",
159
+ "glob": "10.2.4",
158
160
  "handlebars": "4.7.7",
159
161
  "ignore": "5.2.4",
160
162
  "indent-string": "5.0.0",
@@ -165,29 +167,29 @@
165
167
  "prompts": "2.4.2",
166
168
  "rechoir": "^0.8.0",
167
169
  "safe-regex": "2.1.1",
168
- "semver": "^7.5.0",
170
+ "semver": "^7.5.1",
169
171
  "semver-try-require": "6.2.2",
170
172
  "teamcity-service-messages": "0.1.14",
171
173
  "tsconfig-paths-webpack-plugin": "4.0.1",
172
- "watskeburt": "0.11.1",
174
+ "watskeburt": "0.11.2",
173
175
  "wrap-ansi": "8.1.0"
174
176
  },
175
177
  "devDependencies": {
176
- "@babel/core": "7.21.5",
178
+ "@babel/core": "7.21.8",
177
179
  "@babel/plugin-transform-modules-commonjs": "7.21.5",
178
180
  "@babel/preset-typescript": "7.21.5",
179
- "@swc/core": "1.3.55",
181
+ "@swc/core": "1.3.58",
180
182
  "@types/lodash": "4.14.194",
181
- "@types/node": "18.16.3",
183
+ "@types/node": "20.1.6",
182
184
  "@types/prompts": "2.4.4",
183
- "@typescript-eslint/eslint-plugin": "5.59.1",
184
- "@typescript-eslint/parser": "5.59.1",
185
- "@vue/compiler-sfc": "3.2.47",
185
+ "@typescript-eslint/eslint-plugin": "5.59.6",
186
+ "@typescript-eslint/parser": "5.59.6",
187
+ "@vue/compiler-sfc": "3.3.2",
186
188
  "c8": "7.13.0",
187
189
  "chai": "4.3.7",
188
190
  "chai-json-schema": "1.5.1",
189
191
  "coffeescript": "2.7.0",
190
- "eslint": "8.39.0",
192
+ "eslint": "8.40.0",
191
193
  "eslint-config-moving-meadow": "4.0.2",
192
194
  "eslint-config-prettier": "8.8.0",
193
195
  "eslint-plugin-budapestian": "5.0.1",
@@ -196,7 +198,7 @@
196
198
  "eslint-plugin-mocha": "10.1.0",
197
199
  "eslint-plugin-node": "11.1.0",
198
200
  "eslint-plugin-security": "1.7.1",
199
- "eslint-plugin-unicorn": "^46.0.0",
201
+ "eslint-plugin-unicorn": "^47.0.0",
200
202
  "husky": "8.0.3",
201
203
  "intercept-stdout": "0.1.2",
202
204
  "lint-staged": "13.2.2",
@@ -206,7 +208,7 @@
206
208
  "prettier": "2.8.8",
207
209
  "proxyquire": "2.1.3",
208
210
  "shx": "0.3.4",
209
- "svelte": "3.58.0",
211
+ "svelte": "3.59.1",
210
212
  "symlink-dir": "5.1.1",
211
213
  "typescript": "5.0.4",
212
214
  "upem": "7.3.2",
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { readFile, mkdir, writeFile } from "node:fs/promises";
2
3
  import { join } from "node:path";
3
4
  import { scannableExtensions } from "../extract/transpile/meta.mjs";
@@ -24,7 +25,7 @@ export default class Cache {
24
25
  * @param {import("../../types/strict-options.js").IStrictCruiseOptions} pCruiseOptions
25
26
  * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCachedCruiseResult
26
27
  * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pRevisionData
27
- * @returns {boolean}
28
+ * @returns {Promise<boolean>}
28
29
  */
29
30
  async canServeFromCache(pCruiseOptions, pCachedCruiseResult, pRevisionData) {
30
31
  this.revisionData =
@@ -54,7 +55,7 @@ export default class Cache {
54
55
 
55
56
  /**
56
57
  * @param {string} pCacheFolder
57
- * @returns {import("../../types/dependency-cruiser.js").ICruiseResult}
58
+ * @returns {Promise<import("../../types/dependency-cruiser.js").ICruiseResult>}
58
59
  */
59
60
  async read(pCacheFolder) {
60
61
  try {
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-inline-comments */
2
+ // @ts-check
1
3
  import { isDeepStrictEqual } from "node:util";
2
4
  import { join } from "node:path/posix";
3
5
  import findContentChanges from "./find-content-changes.mjs";
@@ -47,9 +49,9 @@ export default class ContentStrategy {
47
49
  * @param {Object} pOptions
48
50
  * @param {Set<string>} pOptions.extensions
49
51
  * @param {Set<import("watskeburt").changeTypeType>} pOptions.interestingChangeTypes
50
- * @param {string} pOptions.baseDir
51
- * @param {(pString:string) => Array<import("watskeburt").IChange>} pOptions.diffListFn
52
- * @param {(import("watskeburt").IChange) => import("../..").IRevisionChange} pOptions.checksumFn
52
+ * @param {string=} pOptions.baseDir
53
+ * @param {typeof findContentChanges=} pOptions.diffListFn
54
+ * @param {typeof import('watskeburt').getSHASync=} pOptions.checksumFn
53
55
  * @returns {import("../../types/dependency-cruiser.js").IRevisionData}
54
56
  */
55
57
  getRevisionData(pDirectory, pCachedCruiseResult, pCruiseOptions, pOptions) {
@@ -60,31 +62,35 @@ export default class ContentStrategy {
60
62
  };
61
63
  return {
62
64
  SHA1: "unknown-in-content-cache-strategy",
63
- changes: lOptions
64
- .diffListFn(pDirectory, pCachedCruiseResult, {
65
- baseDir: lOptions.baseDir,
66
- extensions: lOptions.extensions,
67
- includeOnly: pCruiseOptions.includeOnly,
68
- exclude: pCruiseOptions.exclude,
69
- })
70
- .filter(isInterestingChangeType(lOptions.interestingChangeTypes)),
65
+ changes:
66
+ /** @type {import("../../types/dependency-cruiser.js").IRevisionChange[]} */ (
67
+ lOptions.diffListFn(pDirectory, pCachedCruiseResult, {
68
+ baseDir: lOptions.baseDir,
69
+ extensions: lOptions.extensions,
70
+ includeOnly: pCruiseOptions.includeOnly,
71
+ exclude: pCruiseOptions.exclude,
72
+ })
73
+ ).filter(isInterestingChangeType(lOptions.interestingChangeTypes)),
71
74
  };
72
75
  }
73
76
 
74
77
  /**
75
- * @param {import("../../types/dependency-cruiser.js").IRevisionData} pExistingRevisionData
76
- * @param {import("../../types/dependency-cruiser.js").IRevisionData} pNewRevisionData
78
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pExistingRevisionData
79
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pNewRevisionData
77
80
  * @returns {boolean}
78
81
  */
79
82
  revisionDataEqual(pExistingRevisionData, pNewRevisionData) {
80
- return (
81
- Boolean(pExistingRevisionData) &&
82
- Boolean(pNewRevisionData) &&
83
- // Even though we don't really have a SHA1, it might be the previous version
84
- // of the cache did, e.g. because it was rendered with the metadata cache
85
- // strategy. In that case the SHA1 comparison is a reliable, fast bailout.
86
- pExistingRevisionData.SHA1 === pNewRevisionData.SHA1 &&
87
- isDeepStrictEqual(pExistingRevisionData.changes, pNewRevisionData.changes)
83
+ return Boolean(
84
+ pExistingRevisionData &&
85
+ pNewRevisionData &&
86
+ // Even though we don't really have a SHA1, it might be the previous version
87
+ // of the cache did, e.g. because it was rendered with the metadata cache
88
+ // strategy. In that case the SHA1 comparison is a reliable, fast bailout.
89
+ pExistingRevisionData.SHA1 === pNewRevisionData.SHA1 &&
90
+ isDeepStrictEqual(
91
+ pExistingRevisionData.changes,
92
+ pNewRevisionData.changes
93
+ )
88
94
  );
89
95
  }
90
96
 
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-inline-comments */
2
+ // @ts-check
1
3
  import { join } from "node:path/posix";
2
4
  import { bus } from "../utl/bus.mjs";
3
5
  import findAllFiles from "../utl/find-all-files.mjs";
@@ -65,7 +67,7 @@ function diffCachedModuleAgainstFileSet(
65
67
  * @param {Object} pOptions
66
68
  * @param {Set<string>} pOptions.extensions
67
69
  * @param {string} pOptions.baseDir
68
- * @returns {{source: string; changeType: import("watskeburt").changeTypeType; checksum: string}[]}
70
+ * @returns {import("../..").IRevisionChange[]}
69
71
  */
70
72
  export default function findContentChanges(
71
73
  pDirectory,
@@ -93,7 +95,7 @@ export default function findContentChanges(
93
95
  for (let lFileName of lFileSet) {
94
96
  lDiffNewVsCached.push({
95
97
  name: lFileName,
96
- changeType: "added",
98
+ changeType: /** @type import('watskeburt').changeTypeType */ ("added"),
97
99
  checksum: getFileHashSync(join(pOptions.baseDir, lFileName)),
98
100
  });
99
101
  }
@@ -1,4 +1,4 @@
1
- /* eslint-disable import/exports-last */
1
+ // @ts-check
2
2
  import { createHash } from "node:crypto";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { readFile } from "node:fs/promises";
@@ -15,7 +15,7 @@ function hash(pString) {
15
15
  }
16
16
 
17
17
  /**
18
- * @param {import("fs").PathOrFileDescriptor} pFileName
18
+ * @param {string} pFileName
19
19
  * @returns {Promise<string>}
20
20
  */
21
21
  async function _getFileHash(pFileName) {
@@ -36,7 +36,7 @@ export async function addCheckSumToChange(pChange) {
36
36
  }
37
37
 
38
38
  /**
39
- * @param {import("fs").PathOrFileDescriptor} pFileName
39
+ * @param {string} pFileName
40
40
  * @returns {string}
41
41
  */
42
42
  function _getFileHashSync(pFileName) {
@@ -99,9 +99,15 @@ export function hasInterestingExtension(pExtensions) {
99
99
  * @returns {(pChange: import("watskeburt").IChange) => boolean}
100
100
  */
101
101
  export function changeHasInterestingExtension(pExtensions) {
102
- return (pChange) =>
103
- hasInterestingExtension(pExtensions)(pChange.name) ||
104
- (pChange.oldName && hasInterestingExtension(pExtensions)(pChange.oldName));
102
+ return (pChange) => {
103
+ const lNameHasInterestingExtension = hasInterestingExtension(pExtensions)(
104
+ pChange.name
105
+ );
106
+ const lOldNameHasInterestingExtension = Boolean(
107
+ pChange.oldName && hasInterestingExtension(pExtensions)(pChange.oldName)
108
+ );
109
+ return lNameHasInterestingExtension || lOldNameHasInterestingExtension;
110
+ };
105
111
  }
106
112
 
107
113
  // skipping: "pairing broken", "unmodified", "type changed", "ignored"
@@ -127,7 +133,7 @@ export function isInterestingChangeType(pInterestingChangeTypes) {
127
133
  }
128
134
 
129
135
  /**
130
- * @param {pModule:import("../..").IModule} pModule
136
+ * @param {import("../..").IModule} pModule
131
137
  */
132
138
  export function moduleIsInterestingForDiff(pModule) {
133
139
  return (
@@ -1,3 +1,5 @@
1
+ /* eslint-disable no-inline-comments */
2
+ // @ts-check
1
3
  import { isDeepStrictEqual } from "node:util";
2
4
  import { getSHA, list } from "watskeburt";
3
5
  import { bus } from "../utl/bus.mjs";
@@ -11,20 +13,19 @@ import {
11
13
 
12
14
  export default class MetaDataStrategy {
13
15
  /**
14
- * @param {Set<string>} pExtensions
15
- * @param {Set<import("watskeburt").changeTypeType>} pInterestingChangeTypes
16
- * @param {import("../../types/strict-options.js").IStrictCruiseOptions} pCruiseOptions
16
+ * @param {string} _pDirectory
17
+ * @param {import("../../types/cruise-result.js").ICruiseResult} _pCachedCruiseResult
17
18
  * @param {Object} pOptions
18
19
  * @param {Set<string>} pOptions.extensions
19
20
  * @param {Set<import("watskeburt").changeTypeType>} pOptions.interestingChangeTypes
20
- * @param {() => string} pOptions.shaRetrievalFn
21
- * @param {(pString:string) => Array<import("watskeburt").IChange>} pOptions.diffListFn
22
- * @param {(import("watskeburt").IChange) => import("../..").IRevisionChange} pOptions.checksumFn
23
- * @returns {import("../../types/dependency-cruiser.js").IRevisionData}
21
+ * @param {typeof getSHA=} pOptions.shaRetrievalFn
22
+ * @param {typeof list=} pOptions.diffListFn
23
+ * @param {typeof addCheckSumToChangeSync=} pOptions.checksumFn
24
+ * @returns {Promise<import("../../types/dependency-cruiser.js").IRevisionData>}
24
25
  */
25
26
  async getRevisionData(
26
- pDirectory,
27
- pCachedCruiseResult,
27
+ _pDirectory,
28
+ _pCachedCruiseResult,
28
29
  pCruiseOptions,
29
30
  pOptions
30
31
  ) {
@@ -38,7 +39,9 @@ export default class MetaDataStrategy {
38
39
  bus.debug("cache: - getting sha");
39
40
  const lSHA = await lOptions.shaRetrievalFn();
40
41
  bus.debug("cache: - getting diff");
41
- const lDiff = await lOptions.diffListFn(lSHA);
42
+ const lDiff = /** @type {import("watskeburt").IChange[]} */ (
43
+ await lOptions.diffListFn(lSHA)
44
+ );
42
45
  const lChanges = lDiff
43
46
  .filter(({ name }) => excludeFilter(pCruiseOptions.exclude)(name))
44
47
  .filter(({ name }) =>
@@ -74,7 +77,7 @@ export default class MetaDataStrategy {
74
77
 
75
78
  /**
76
79
  * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCruiseResult
77
- * @param {import("../../types/dependency-cruiser.js").IRevisionData} pRevisionData
80
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pRevisionData
78
81
  * @returns {import("../../types/dependency-cruiser.js").ICruiseResult}
79
82
  */
80
83
  prepareRevisionDataForSaving(pCruiseResult, pRevisionData) {
@@ -1,3 +1,4 @@
1
+ // @ts-check
1
2
  import { isDeepStrictEqual } from "node:util";
2
3
 
3
4
  /*
@@ -1 +1 @@
1
- var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,t,o,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(t,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(t,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,t,o,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likely this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true,\n // as it's pretty common to have a type import be a type only import \n // _and_ (e.g.) a devDependency - don't consider type-only dependency\n // types for this rule\n dependencyTypesNot: [\"type-only\"]\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,t,o,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(t,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:18},end:{line:166,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(t,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:169,column:15},end:{line:169,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,t,o,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,t,o,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,t,o,s){return" combinedDependencies: true,\n"},13:function(e,n,t,o,s){return" // combinedDependencies: false,\n"},15:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:316,column:17},end:{line:316,column:29}}}):t)+"'\n },\n"},17:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return null!=(t=i(t,"if").call(null!=n?n:e.nullContext||{},null!=n?i(n,"useJsConfig"):n,{name:"if",hash:{},fn:e.program(18,s,0),inverse:e.program(20,s,0),data:s,loc:{start:{line:319,column:6},end:{line:327,column:13}}}))?t:""},18:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"jsConfig")||(null!=n?i(n,"jsConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"jsConfig",hash:{},data:s,loc:{start:{line:321,column:17},end:{line:321,column:29}}}):t)+"'\n },\n"},20:function(e,n,t,o,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},22:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:342,column:17},end:{line:342,column:34}}}):t)+"',\n // env: {},\n // arguments: {},\n },\n"},24:function(e,n,t,o,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // arguments: {},\n // },\n"},26:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:362,column:17},end:{line:362,column:32}}}):t)+"'\n },\n"},28:function(e,n,t,o,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},30:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" extensions: "+(null!=(i="function"==typeof(t=null!=(t=i(t,"resolutionExtensionsAsString")||(null!=n?i(n,"resolutionExtensionsAsString"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"resolutionExtensionsAsString",hash:{},data:s,loc:{start:{line:412,column:18},end:{line:412,column:52}}}):t)?i:"")+",\n"},32:function(e,n,t,o,s){return' // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],\n'},34:function(e,n,t,o,s){return' mainFields: ["main", "types"],\n'},36:function(e,n,t,o,s){return' // mainFields: ["main", "types"],\n'},compiler:[8,">= 4.3.0"],main:function(e,n,t,o,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),u=null!=(u=c(t,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?u:r,d={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof u==a?u.call(i,d):u;return null!=(h=c(t,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,d))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(u=null!=(u=c(t,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?u:r)==a?u.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):u)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"dependency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules'\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:280,column:4},end:{line:284,column:11}}}))?h:"")+' \n /* \n list of extensions to scan that aren\'t javascript or compile-to-javascript. \n Empty by default. Only put extensions in here that you want to take into\n account that are _not_ parsable. \n */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(t,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:297,column:4},end:{line:301,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:314,column:4},end:{line:328,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `arguments` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(22,s,0),inverse:e.program(24,s,0),data:s,loc:{start:{line:340,column:4},end:{line:352,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(26,s,0),inverse:e.program(28,s,0),data:s,loc:{start:{line:360,column:4},end:{line:368,column:11}}}))?h:"")+"\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you've\n re-declared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don't have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as 'exports' fields in package.json. Use\n ['exports'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: [\"exports\"],\n /* List of conditions to check for in the exports field. e.g. use ['imports']\n if you're only interested in exposed es6 modules, ['require'] for commonjs,\n or all conditions at once `(['import', 'require', 'node', 'default']`)\n if anything goes for you. Only works when the 'exportsFields' array is\n non-empty.\n\n If you have a 'conditionNames' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: [\"import\", \"require\", \"node\", \"default\"],\n /*\n The extensions, by default are the same as the ones dependency-cruiser\n can access (run `npx depcruise --info` to see which ones that are in\n _your_ environment. If that list is larger than what you need (e.g. \n it contains .js, .jsx, .ts, .tsx, .cts, .mts - but you don't use \n TypeScript you can pass just the extensions you actually use (e.g. \n [\".js\", \".jsx\"]). This can speed up the most expensive step in \n dependency cruising (module resolution) quite a bit.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"specifyResolutionExtensions"):n,{name:"if",hash:{},fn:e.program(30,s,0),inverse:e.program(32,s,0),data:s,loc:{start:{line:411,column:6},end:{line:415,column:13}}}))?h:"")+' /* \n If your TypeScript project makes use of types specified in \'types\'\n fields in package.jsons of external dependencies, specify "types"\n in addition to "main" in here, so enhanced-resolve (the resolver\n dependency-cruiser uses) knows to also look there. You can also do\n this if you\'re not sure, but still use TypeScript. In a future version\n of dependency-cruiser this will likely become the default.\n */\n'+(null!=(h=c(t,"if").call(i,null!=n?c(n,"usesTypeScript"):n,{name:"if",hash:{},fn:e.program(34,s,0),inverse:e.program(36,s,0),data:s,loc:{start:{line:424,column:6},end:{line:428,column:13}}}))?h:"")+' },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/(@[^/]+/[^/]+|[^/]+)\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { matchesFocus: true },\n // attributes: {\n // fillcolor: "lime",\n // penwidth: 2,\n // },\n // },\n // {\n // criteria: { matchesFocus: false },\n // attributes: {\n // fillcolor: "lightgrey",\n // },\n // },\n // {\n // criteria: { matchesReaches: true },\n // attributes: {\n // fillcolor: "lime",\n // penwidth: 2,\n // },\n // },\n // {\n // criteria: { matchesReaches: false },\n // attributes: {\n // fillcolor: "lightgrey",\n // },\n // },\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // },\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/(@[^/]+/[^/]+|[^/]+)\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n },\n "text": {\n "highlightFocused": true\n },\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(u=null!=(u=c(t,"version")||(null!=n?c(n,"version"):n))?u:r)==a?u.call(i,{name:"version",hash:{},data:s,loc:{start:{line:535,column:33},end:{line:535,column:44}}}):u)+" on "+l(typeof(u=null!=(u=c(t,"date")||(null!=n?c(n,"date"):n))?u:r)==a?u.call(i,{name:"date",hash:{},data:s,loc:{start:{line:535,column:48},end:{line:535,column:56}}}):u)+"\n"},useData:!0});
1
+ var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,t,o,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(t,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(t,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,t,o,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dot-files (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likely this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true,\n // as it's pretty common to have a type import be a type only import \n // _and_ (e.g.) a devDependency - don't consider type-only dependency\n // types for this rule\n dependencyTypesNot: [\"type-only\"]\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,t,o,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(t,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:18},end:{line:166,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(t,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:169,column:15},end:{line:169,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,t,o,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,t,o,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,t,o,s){return" combinedDependencies: true,\n"},13:function(e,n,t,o,s){return" // combinedDependencies: false,\n"},15:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:316,column:17},end:{line:316,column:29}}}):t)+"'\n },\n"},17:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return null!=(t=i(t,"if").call(null!=n?n:e.nullContext||{},null!=n?i(n,"useJsConfig"):n,{name:"if",hash:{},fn:e.program(18,s,0),inverse:e.program(20,s,0),data:s,loc:{start:{line:319,column:6},end:{line:327,column:13}}}))?t:""},18:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"jsConfig")||(null!=n?i(n,"jsConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"jsConfig",hash:{},data:s,loc:{start:{line:321,column:17},end:{line:321,column:29}}}):t)+"'\n },\n"},20:function(e,n,t,o,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},22:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:342,column:17},end:{line:342,column:34}}}):t)+"',\n // env: {},\n // arguments: {},\n },\n"},24:function(e,n,t,o,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // arguments: {},\n // },\n"},26:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(t=null!=(t=i(t,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:362,column:17},end:{line:362,column:32}}}):t)+"'\n },\n"},28:function(e,n,t,o,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},30:function(e,n,t,o,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" extensions: "+(null!=(i="function"==typeof(t=null!=(t=i(t,"resolutionExtensionsAsString")||(null!=n?i(n,"resolutionExtensionsAsString"):n))?t:e.hooks.helperMissing)?t.call(null!=n?n:e.nullContext||{},{name:"resolutionExtensionsAsString",hash:{},data:s,loc:{start:{line:412,column:18},end:{line:412,column:52}}}):t)?i:"")+",\n"},32:function(e,n,t,o,s){return' // extensions: [".js", ".jsx", ".ts", ".tsx", ".d.ts"],\n'},34:function(e,n,t,o,s){return' mainFields: ["main", "types"],\n'},36:function(e,n,t,o,s){return' // mainFields: ["main", "types"],\n'},compiler:[8,">= 4.3.0"],main:function(e,n,t,o,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),u=null!=(u=c(t,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?u:r,d={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof u==a?u.call(i,d):u;return null!=(h=c(t,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,d))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(u=null!=(u=c(t,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?u:r)==a?u.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):u)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"dependency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/main/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules'\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:280,column:4},end:{line:284,column:11}}}))?h:"")+' \n /* \n list of extensions to scan that aren\'t javascript or compile-to-javascript. \n Empty by default. Only put extensions in here that you want to take into\n account that are _not_ parsable. \n */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(t,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:297,column:4},end:{line:301,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:314,column:4},end:{line:328,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `arguments` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(22,s,0),inverse:e.program(24,s,0),data:s,loc:{start:{line:340,column:4},end:{line:352,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(26,s,0),inverse:e.program(28,s,0),data:s,loc:{start:{line:360,column:4},end:{line:368,column:11}}}))?h:"")+"\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you've\n re-declared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don't have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as 'exports' fields in package.json. Use\n ['exports'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: [\"exports\"],\n /* List of conditions to check for in the exports field. e.g. use ['imports']\n if you're only interested in exposed es6 modules, ['require'] for commonjs,\n or all conditions at once `(['import', 'require', 'node', 'default']`)\n if anything goes for you. Only works when the 'exportsFields' array is\n non-empty.\n\n If you have a 'conditionNames' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: [\"import\", \"require\", \"node\", \"default\"],\n /*\n The extensions, by default are the same as the ones dependency-cruiser\n can access (run `npx depcruise --info` to see which ones that are in\n _your_ environment. If that list is larger than what you need (e.g. \n it contains .js, .jsx, .ts, .tsx, .cts, .mts - but you don't use \n TypeScript you can pass just the extensions you actually use (e.g. \n [\".js\", \".jsx\"]). This can speed up the most expensive step in \n dependency cruising (module resolution) quite a bit.\n */\n"+(null!=(h=c(t,"if").call(i,null!=n?c(n,"specifyResolutionExtensions"):n,{name:"if",hash:{},fn:e.program(30,s,0),inverse:e.program(32,s,0),data:s,loc:{start:{line:411,column:6},end:{line:415,column:13}}}))?h:"")+' /* \n If your TypeScript project makes use of types specified in \'types\'\n fields in package.jsons of external dependencies, specify "types"\n in addition to "main" in here, so enhanced-resolve (the resolver\n dependency-cruiser uses) knows to also look there. You can also do\n this if you\'re not sure, but still use TypeScript. In a future version\n of dependency-cruiser this will likely become the default.\n */\n'+(null!=(h=c(t,"if").call(i,null!=n?c(n,"usesTypeScript"):n,{name:"if",hash:{},fn:e.program(34,s,0),inverse:e.program(36,s,0),data:s,loc:{start:{line:424,column:6},end:{line:428,column:13}}}))?h:"")+' },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/(@[^/]+/[^/]+|[^/]+)\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { matchesFocus: true },\n // attributes: {\n // fillcolor: "lime",\n // penwidth: 2,\n // },\n // },\n // {\n // criteria: { matchesFocus: false },\n // attributes: {\n // fillcolor: "lightgrey",\n // },\n // },\n // {\n // criteria: { matchesReaches: true },\n // attributes: {\n // fillcolor: "lime",\n // penwidth: 2,\n // },\n // },\n // {\n // criteria: { matchesReaches: false },\n // attributes: {\n // fillcolor: "lightgrey",\n // },\n // },\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // },\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/(@[^/]+/[^/]+|[^/]+)\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n },\n "text": {\n "highlightFocused": true\n },\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(u=null!=(u=c(t,"version")||(null!=n?c(n,"version"):n))?u:r)==a?u.call(i,{name:"version",hash:{},data:s,loc:{start:{line:535,column:33},end:{line:535,column:44}}}):u)+" on "+l(typeof(u=null!=(u=c(t,"date")||(null!=n?c(n,"date"):n))?u:r)==a?u.call(i,{name:"date",hash:{},data:s,loc:{start:{line:535,column:48},end:{line:535,column:56}}}):u)+"\n"},useData:!0});
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  // @ts-check
3
2
  import { readFileSync, readdirSync, accessSync, statSync, R_OK } from "node:fs";
4
3
  import { join } from "node:path";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  /* eslint-disable security/detect-object-injection */
3
2
  import { writeFileSync } from "node:fs";
4
3
  import figures from "figures";
@@ -1,14 +1,17 @@
1
+
1
2
  import chalk from "chalk";
3
+ import { INFO } from "../../../utl/bus.mjs";
2
4
 
3
5
  const MS_PER_SECOND = 1000;
4
6
  const MS_PER_MICRO_SECOND = 0.001;
5
- const MAX_EXPECTED_LENGTH = 13;
7
+ const MAX_EXPECTED_METRIC_LENGTH = 13;
8
+ const MAX_EXPECTED_MESSAGE_LENGTH = 42;
6
9
  const NUMBER_OF_COLUMNS = 8;
7
10
  const K = 1024;
8
11
  /*
9
12
  * using `undefined` as the first parameter to Intl.NumberFormat so
10
13
  * it will fall back to the 'current' locale. Using a non-existent language
11
- * (e.g. `zz`) also works, but `undefined` seems to be the lesser of the two
14
+ * (e.g. `zz`) also works, but `undefined` seems to be the lesser of the two
12
15
  * evil as it is closer to the intent (skip the optional parameter).
13
16
  */
14
17
  // eslint-disable-next-line no-undefined
@@ -28,10 +31,16 @@ const gSizeFormat = new Intl.NumberFormat(LOCALE, {
28
31
  maximumFractionDigits: 0,
29
32
  }).format;
30
33
 
31
- const pad = (pString) => pString.padStart(MAX_EXPECTED_LENGTH).concat(" ");
34
+ const pad = (pString) =>
35
+ pString.padStart(MAX_EXPECTED_METRIC_LENGTH).concat(" ");
32
36
 
33
37
  export function formatDividerLine() {
34
- return `${`${"-".repeat(MAX_EXPECTED_LENGTH)} `.repeat(NUMBER_OF_COLUMNS)}\n`;
38
+ const lNumberColumnDivider = "-".repeat(MAX_EXPECTED_METRIC_LENGTH);
39
+ const lMessageColumnHDivider = "-".repeat(MAX_EXPECTED_MESSAGE_LENGTH);
40
+
41
+ return `${`${lNumberColumnDivider} `.repeat(
42
+ NUMBER_OF_COLUMNS - 1
43
+ )}${lMessageColumnHDivider}\n`;
35
44
  }
36
45
 
37
46
  export function formatHeader() {
@@ -42,24 +51,40 @@ export function formatHeader() {
42
51
  pad("∆ heapTotal") +
43
52
  pad("∆ heapUsed") +
44
53
  pad("∆ external") +
45
- pad("⏱ system") +
46
- pad("⏱ user") +
47
- pad("⏱ real")
54
+ pad("⏱ system") +
55
+ pad("⏱ user") +
56
+ pad("⏱ real")
48
57
  }after step...\n`
49
58
  )
50
59
  .concat(formatDividerLine());
51
60
  }
52
61
 
53
- export function formatTime(pNumber, pConversionMultiplier = MS_PER_SECOND) {
54
- return gTimeFormat(pConversionMultiplier * pNumber)
55
- .padStart(MAX_EXPECTED_LENGTH)
56
- .concat(" ");
62
+ function formatMessage(pMessage, pLevel) {
63
+ return pLevel >= INFO ? chalk.dim(pMessage) : pMessage;
64
+ }
65
+
66
+ export function formatTime(
67
+ pNumber,
68
+ pConversionMultiplier = MS_PER_SECOND,
69
+ pLevel
70
+ ) {
71
+ return formatMessage(
72
+ gTimeFormat(pConversionMultiplier * pNumber)
73
+ .padStart(MAX_EXPECTED_METRIC_LENGTH)
74
+ .concat(" "),
75
+ pLevel
76
+ );
57
77
  }
58
78
 
59
- export function formatMemory(pBytes) {
60
- const lReturnValue = gSizeFormat(pBytes / K).padStart(MAX_EXPECTED_LENGTH);
79
+ export function formatMemory(pBytes, pLevel) {
80
+ const lReturnValue = gSizeFormat(pBytes / K).padStart(
81
+ MAX_EXPECTED_METRIC_LENGTH
82
+ );
61
83
 
62
- return (pBytes < 0 ? chalk.blue(lReturnValue) : lReturnValue).concat(" ");
84
+ return formatMessage(
85
+ (pBytes < 0 ? chalk.blue(lReturnValue) : lReturnValue).concat(" "),
86
+ pLevel
87
+ );
63
88
  }
64
89
 
65
90
  export function formatPerfLine({
@@ -71,15 +96,16 @@ export function formatPerfLine({
71
96
  deltaHeapTotal,
72
97
  deltaExternal,
73
98
  message,
99
+ level,
74
100
  }) {
75
101
  return `${
76
- formatMemory(deltaRss) +
77
- formatMemory(deltaHeapTotal) +
78
- formatMemory(deltaHeapUsed) +
79
- formatMemory(deltaExternal) +
80
- formatTime(elapsedSystem, MS_PER_MICRO_SECOND) +
81
- formatTime(elapsedUser, MS_PER_MICRO_SECOND) +
82
- formatTime(elapsedTime) +
83
- message
102
+ formatMemory(deltaRss, level) +
103
+ formatMemory(deltaHeapTotal, level) +
104
+ formatMemory(deltaHeapUsed, level) +
105
+ formatMemory(deltaExternal, level) +
106
+ formatTime(elapsedSystem, MS_PER_MICRO_SECOND, level) +
107
+ formatTime(elapsedUser, MS_PER_MICRO_SECOND, level) +
108
+ formatTime(elapsedTime, MS_PER_SECOND, level) +
109
+ formatMessage(message, level)
84
110
  }\n`;
85
111
  }
@@ -27,6 +27,7 @@ export function getProgressLine(pMessage, pState, pLevel, pMaxLevel) {
27
27
  deltaHeapTotal: heapTotal - pState.previousHeapTotal,
28
28
  deltaExternal: external - pState.previousExternal,
29
29
  message: pState.previousMessage,
30
+ level: pState.previousLevel,
30
31
  };
31
32
 
32
33
  pState.previousMessage = pMessage;
@@ -37,6 +38,7 @@ export function getProgressLine(pMessage, pState, pLevel, pMaxLevel) {
37
38
  pState.previousHeapTotal = heapTotal;
38
39
  pState.previousHeapUsed = heapUsed;
39
40
  pState.previousExternal = external;
41
+ pState.previousLevel = pLevel;
40
42
 
41
43
  lReturnValue = formatPerfLine(lStats);
42
44
  }
@@ -34,7 +34,7 @@ const FORMAT_DIAGNOSTICS_HOST = {
34
34
  * Silently fails if a supported version of the typescript compiler isn't available
35
35
  *
36
36
  * @param {string} pTSConfigFileName
37
- * @return {any} tsconfig as an object
37
+ * @return {import("typescript").ParsedCommandLine} tsconfig as an object
38
38
  * @throws {Error} when the tsconfig is invalid/ jas errors
39
39
  * @throws {TypeError} when the tsconfig is unreadable
40
40
  */
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import IndexedModuleGraph from "../../../graph-utl/indexed-module-graph.mjs";
3
2
  import { calculateInstability, metricsAreCalculable } from "../module-utl.mjs";
4
3
 
@@ -26,10 +26,10 @@ const SHAREABLE_OPTIONS = [
26
26
  "reaches",
27
27
  "reporterOptions",
28
28
  "rulesFile",
29
+ "tsConfig",
29
30
  "tsPreCompilationDeps",
30
31
  "webpackConfig",
31
32
  // "progress", TODO: could be enabled
32
- // "tsConfig", TODO: should be enabled
33
33
  ];
34
34
 
35
35
  function makeOptionsPresentable(pOptions) {
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import { readFileSync } from "node:fs";
3
2
  import { Parser as acornParser, parse as acornParse } from "acorn";
4
3
  import { parse as acornLooseParse } from "acorn-loose";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import tryImport from "semver-try-require";
3
2
  import memoize from "lodash/memoize.js";
4
3
  import meta from "../../meta.js";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import { readFileSync } from "node:fs";
3
2
  import tryImport from "semver-try-require";
4
3
  import memoize from "lodash/memoize.js";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import { readFileSync } from "node:fs";
3
2
  import { join } from "node:path";
4
3
  import memoize from "lodash/memoize.js";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import { isAbsolute, resolve as path_resolve } from "node:path";
3
2
  import getExtension from "../../utl/get-extension.mjs";
4
3
 
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  /* eslint security/detect-object-injection : 0*/
3
2
  import javaScriptWrap from "./javascript-wrap.mjs";
4
3
  import typeScriptWrap from "./typescript-wrap.mjs";
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  /* eslint security/detect-object-injection : 0*/
3
2
  import meta from "../../meta.js";
4
3
  import tryAvailable from "./try-import-available.mjs";
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "13.0.0-beta-7",
4
+ version: "13.0.1",
5
5
  engines: {
6
6
  node: "^16.14||>=18",
7
7
  },
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import has from "lodash/has.js";
3
2
  import meta from "../../meta.js";
4
3
  import { formatViolation, formatPercentage } from "../utl/index.mjs";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Returns the results of a cruise in JSON
2
+ * Returns the results of a cruise _only_ in an exitCode
3
3
  *
4
4
  * @param {import("../../types/cruise-result").ICruiseResult} pResults
5
5
  * @returns {import("../../types/dependency-cruiser").IReporterOutput}
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import has from "lodash/has.js";
3
2
 
4
3
  export function isValidPlugin(pPluginFunction) {
package/src/utl/bus.mjs CHANGED
@@ -1,4 +1,3 @@
1
- /* eslint-disable import/exports-last */
2
1
  import EventEmitter from "node:events";
3
2
 
4
3
  export const OFF = -1;
@@ -6,7 +6,11 @@ import { IRuleSummary } from "./rule-summary";
6
6
  import { IChange } from "watskeburt";
7
7
 
8
8
  export interface IRevisionChange extends IChange {
9
- checksum: string;
9
+ // optional because
10
+ // - in content strategy 'ignored' and 'deleted' files can't have a checksum
11
+ // - in metadata strategy we don't calculate a checksum because ~we're lazy~
12
+ // it's an unnecessary expense
13
+ checksum?: string;
10
14
  }
11
15
 
12
16
  /**
@@ -15,8 +19,6 @@ export interface IRevisionChange extends IChange {
15
19
  export interface IRevisionData {
16
20
  SHA1: string;
17
21
  changes: IRevisionChange[];
18
- args: string[];
19
- rulesFile: string;
20
22
  }
21
23
 
22
24
  export interface ICruiseResult {
@@ -358,51 +360,8 @@ export interface IOptions extends ICruiseOptions {
358
360
  * The rules file used to validate the dependencies (if any)
359
361
  */
360
362
  rulesFile?: string;
361
- /**
362
- * The TypeScript configuration file used (if any)
363
- */
364
- tsConfig?: ITsConfig;
365
- /**
366
- * The webpack configuration options used for the cruise
367
- */
368
- webpackConfig?: IWebpackConfig;
369
- /**
370
- * The Babel configuration file used (if any)
371
- */
372
- babelConfig?: IBabelConfig;
373
- }
374
-
375
- export interface ITsConfig {
376
- fileName?: string;
377
- }
378
-
379
- export interface IBabelConfig {
380
- fileName?: string;
381
- }
382
-
383
- /**
384
- * The webpack configuration options used for the cruise
385
- */
386
- export interface IWebpackConfig {
387
- /**
388
- * The arguments used
389
- */
390
- arguments?: { [key: string]: any };
391
- /**
392
- * The 'env' parameters passed
393
- */
394
- env?: WebpackEnvType;
395
- /**
396
- * The name of the webpack configuration file used
397
- */
398
- fileName?: string;
399
363
  }
400
364
 
401
- /**
402
- * The 'env' parameters passed
403
- */
404
- export type WebpackEnvType = { [key: string]: any } | string;
405
-
406
365
  export interface IFolderDependency {
407
366
  /**
408
367
  * the (resolved) name of the dependency
@@ -98,7 +98,7 @@ export function cruise(
98
98
  * Given a cruise result, formats it with the given reporter (pOutputType)
99
99
  *
100
100
  * @param pResult A javascript object that contains the result of a cruise. Must adhere
101
- * to the [dependency-cruiser results schema](https://github.com/sverweij/dependency-cruiser/blob/develop/src/schema/cruise-result.json)
101
+ * to the [dependency-cruiser results schema](https://github.com/sverweij/dependency-cruiser/blob/main/src/schema/cruise-result.json)
102
102
  * @param pOutputType Which reporter to use to format the cruise result with
103
103
  */
104
104
  export function format(
@@ -0,0 +1,5 @@
1
+ import { ParsedCommandLine } from "typescript";
2
+
3
+ export default function extractTSConfig(
4
+ pTSConfigFileName: string
5
+ ): ParsedCommandLine;
@@ -19,6 +19,37 @@ export type ProgressType =
19
19
  | "ndjson"
20
20
  | "none";
21
21
 
22
+ export interface ITsConfig {
23
+ fileName?: string;
24
+ }
25
+
26
+ export interface IBabelConfig {
27
+ fileName?: string;
28
+ }
29
+
30
+ /**
31
+ * The 'env' parameters passed to webpack, if any
32
+ */
33
+ export type WebpackEnvType = { [key: string]: any } | string;
34
+
35
+ /**
36
+ * The webpack configuration options used for the cruise
37
+ */
38
+ export interface IWebpackConfig {
39
+ /**
40
+ * The arguments used
41
+ */
42
+ arguments?: { [key: string]: any };
43
+ /**
44
+ * The 'env' parameters passed
45
+ */
46
+ env?: WebpackEnvType;
47
+ /**
48
+ * The name of the webpack configuration file used
49
+ */
50
+ fileName?: string;
51
+ }
52
+
22
53
  export interface ICruiseOptions {
23
54
  /**
24
55
  * if true, will attempt to validate with the rules in ruleSet.
@@ -175,7 +206,7 @@ export interface ICruiseOptions {
175
206
  /*
176
207
  * List of strings you have in use in addition to cjs/ es6 requires
177
208
  * & imports to declare module dependencies. Use this e.g. if you've
178
- * redeclared require (`const want = require`), use a require-wrapper
209
+ * re-declared require (`const want = require`), use a require-wrapper
179
210
  * (like semver-try-require) or use window.require as a hack
180
211
  *
181
212
  * Defaults to `[]`
@@ -186,6 +217,31 @@ export interface ICruiseOptions {
186
217
  */
187
218
  reporterOptions?: IReporterOptions;
188
219
 
220
+ /**
221
+ * TypeScript project file ('tsconfig.json') to use for (1) compilation
222
+ * and (2) resolution (e.g. with the paths property)",
223
+ */
224
+ tsConfig?: ITsConfig;
225
+
226
+ /**
227
+ * Webpack configuration to use to get resolve options from
228
+ */
229
+ webpackConfig?: IWebpackConfig;
230
+
231
+ /**
232
+ * Babel configuration (e.g. '.babelrc.json') to use.
233
+ */
234
+ babelConfig?: IBabelConfig;
235
+
236
+ /**
237
+ * Overrides the parser dependency-cruiser will use - EXPERIMENTAL
238
+ *
239
+ * Note that you'll _very_ likely not need this - dependency-cruiser will
240
+ * typically sort out what the best parser for the job is out of the ones
241
+ * available
242
+ */
243
+ parser?: "acorn" | "tsc" | "swc";
244
+
189
245
  /**
190
246
  * Options used in module resolution that for dependency-cruiser's
191
247
  * use cannot go in a webpack config.
@@ -218,6 +274,18 @@ export interface ICruiseOptions {
218
274
  * tsconfig contains paths/ aliases.
219
275
  */
220
276
  extensions?: string[];
277
+ /**
278
+ * A list of main fields in manifests (package.json s). Typically you'd want
279
+ * to keep leave this this on its default (['main']) , but if you e.g. use
280
+ * external packages that only expose types, and you still want references
281
+ * to these types to be resolved you could expand this to ['main', 'types']
282
+ */
283
+ mainFields?: string[];
284
+ /**
285
+ * A list of files to consider 'main' files, defaults to ['index']. Only set
286
+ * this when you have really special needs that warrant it.
287
+ */
288
+ mainFiles?: string[];
221
289
  /**
222
290
  * Options to pass to the resolver (webpack's 'enhanced resolve') regarding
223
291
  * caching.
@@ -240,6 +308,7 @@ export interface ICruiseOptions {
240
308
  cacheDuration: number;
241
309
  };
242
310
  };
311
+
243
312
  /**
244
313
  * Whether or not to show progress feedback when the command line
245
314
  * app is running.
@@ -259,11 +328,13 @@ export interface ICruiseOptions {
259
328
  */
260
329
  maximumLevel?: -1 | 40 | 50 | 60 | 70 | 80 | 99;
261
330
  };
331
+
262
332
  /**
263
333
  * When this flag is set to true, dependency-cruiser will calculate (stability) metrics
264
334
  * for all modules and folders. Defaults to false.
265
335
  */
266
336
  metrics?: boolean;
337
+
267
338
  /**
268
339
  * - false: don't use caching.
269
340
  * - true or empty object: use caching with the default settings
@@ -60,7 +60,7 @@ export interface IAnonReporterOptions {
60
60
  * patterned after the original file name in stead. The list is empty
61
61
  * by default.
62
62
  *
63
- * Read more in https://github.com/sverweij/dependency-cruiser/blob/develop/doc/cli.md#anon---obfuscated-json",
63
+ * Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json",
64
64
  */
65
65
  wordlist?: string[];
66
66
  }