dependency-cruiser 18.0.0 → 18.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configs/plugins/3d-reporter-plugin.mjs +1 -1
- package/configs/plugins/stats-reporter-plugin.mjs +2 -2
- package/package.json +5 -5
- package/src/analyze/add-validations.mjs +1 -1
- package/src/analyze/derive/folders/utl.mjs +2 -2
- package/src/analyze/summarize/index.mjs +121 -4
- package/src/analyze/summarize/summarize-modules.mjs +1 -1
- package/src/cache/cache.mjs +5 -5
- package/src/cache/helpers.mjs +2 -2
- package/src/cli/format-meta-info.mjs +12 -14
- package/src/cli/index.mjs +3 -4
- package/src/cli/init-config/check-and-warn-inconsistencies.mjs +3 -3
- package/src/cli/init-config/environment-helpers.mjs +4 -4
- package/src/cli/init-config/get-user-input.mjs +1 -1
- package/src/cli/init-config/index.mjs +1 -1
- package/src/cli/init-config/normalize-init-options.mjs +3 -3
- package/src/cli/init-config/validators.mjs +1 -1
- package/src/cli/init-config/write-run-scripts-to-manifest.mjs +2 -2
- package/src/cli/listeners/ndjson.mjs +1 -1
- package/src/cli/listeners/performance-log/index.mjs +1 -1
- package/src/cli/normalize-cli-options.mjs +6 -4
- package/src/cli/utl/assert-file-existence.mjs +1 -1
- package/src/config-utl/extract-babel-config.mjs +3 -1
- package/src/config-utl/extract-depcruise-config/index.mjs +1 -1
- package/src/config-utl/extract-depcruise-config/merge-configs.mjs +5 -3
- package/src/config-utl/extract-ts-config.mjs +1 -1
- package/src/config-utl/extract-webpack-resolve-config.mjs +2 -2
- package/src/environment.mjs +17 -0
- package/src/extract/acorn/extract.mjs +1 -1
- package/src/extract/acorn/parse.mjs +2 -2
- package/src/extract/extract-dependencies.mjs +1 -1
- package/src/extract/extract-stats.mjs +1 -1
- package/src/extract/gather-initial-sources.mjs +1 -1
- package/src/extract/helpers.mjs +1 -1
- package/src/extract/index.mjs +1 -1
- package/src/extract/resolve/determine-dependency-types.mjs +3 -2
- package/src/extract/resolve/external-module-helpers.mjs +8 -8
- package/src/extract/resolve/get-manifest.mjs +7 -7
- package/src/extract/resolve/index.mjs +2 -1
- package/src/extract/resolve/merge-manifests.mjs +2 -2
- package/src/extract/resolve/module-classifiers.mjs +1 -1
- package/src/extract/resolve/resolve-amd.mjs +1 -1
- package/src/extract/resolve/resolve-cjs.mjs +2 -2
- package/src/extract/resolve/resolve-helpers.mjs +1 -1
- package/src/extract/resolve/resolve.mjs +2 -2
- package/src/extract/swc/dependency-visitor.mjs +1 -0
- package/src/extract/swc/parse.mjs +2 -2
- package/src/extract/transpile/index.mjs +1 -1
- package/src/extract/transpile/meta.mjs +1 -1
- package/src/extract/transpile/try-import-available.mjs +1 -1
- package/src/extract/transpile/typescript-wrap.mjs +1 -1
- package/src/extract/tsc/extract-typescript-deps.mjs +1 -1
- package/src/extract/tsc/parse.mjs +3 -3
- package/src/graph-utl/add-focus.mjs +1 -1
- package/src/graph-utl/consolidate-to-pattern.mjs +1 -0
- package/src/graph-utl/indexed-module-graph.mjs +6 -6
- package/src/graph-utl/module-graph-with-dependency-set.mjs +1 -1
- package/src/graph-utl/rule-set.mjs +3 -3
- package/src/main/cruise.mjs +1 -1
- package/src/main/helpers.mjs +1 -1
- package/src/main/options/normalize.mjs +2 -2
- package/src/main/report-wrap.mjs +1 -0
- package/src/main/resolve-options/normalize.mjs +2 -2
- package/src/main/rule-set/assert-validity.mjs +1 -1
- package/src/main/rule-set/normalize.mjs +1 -1
- package/src/meta.cjs +1 -1
- package/src/report/anon/anonymize-path-element.mjs +1 -1
- package/src/report/anon/index.mjs +1 -1
- package/src/report/anon/random-string.mjs +1 -1
- package/src/report/azure-devops.mjs +2 -2
- package/src/report/baseline.mjs +1 -1
- package/src/report/d2.mjs +3 -3
- package/src/report/dot/index.mjs +1 -1
- package/src/report/dot/module-utl.mjs +2 -2
- package/src/report/dot/theming.mjs +12 -6
- package/src/report/dot-webpage/svg-in-html-snippets/script.cjs +7 -7
- package/src/report/error-html/error-html-template.mjs +7 -0
- package/src/report/error.mjs +33 -2
- package/src/report/html/index.mjs +2 -2
- package/src/report/index.mjs +1 -0
- package/src/report/markdown.mjs +3 -3
- package/src/report/mermaid.mjs +3 -3
- package/src/report/metrics.mjs +2 -2
- package/src/report/plugins.mjs +2 -1
- package/src/report/teamcity.mjs +2 -2
- package/src/report/utl/dependency-to-incidence-transformer.mjs +1 -1
- package/src/report/utl/index.mjs +1 -1
- package/src/schema/cruise-result.validate.mjs +1 -1
- package/src/utl/array-util.mjs +1 -1
- package/src/utl/find-all-files.mjs +1 -1
- package/src/utl/get-extension.mjs +1 -1
- package/src/utl/path-to-posix.mjs +1 -1
- package/src/utl/regex-util.mjs +4 -2
- package/src/utl/try-import.mjs +1 -1
- package/src/utl/try-require.cjs +3 -3
- package/src/validate/index.mjs +2 -2
- package/types/config-utl/extract-babel-config.d.mts +1 -1
- package/types/config-utl/extract-depcruise-config.d.mts +1 -1
- package/types/config-utl/extract-depcruise-options.d.mts +1 -1
- package/types/config-utl/extract-ts-config.d.mts +1 -1
- package/types/config-utl/extract-webpack-resolve-config.d.mts +1 -1
- package/types/cruise-result.d.mts +27 -0
- package/types/dependency-cruiser.d.mts +5 -26
- package/types/environment.d.mts +29 -0
- package/types/options.d.mts +1 -4
- package/types/plugins/3d-reporter-plugin.d.mts +1 -1
- package/types/plugins/mermaid-reporter-plugin.d.mts +1 -1
- package/types/plugins/stats-reporter-plugin.d.mts +1 -1
- package/types/rule-set.d.mts +2 -5
- package/types/shared-types.d.mts +1 -5
- package/types/strict-rule-set.d.mts +2 -5
|
@@ -45,7 +45,7 @@ function normalizeReporterOptions(pReporterOptions) {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
function normalizeFilterOptions(pOptions, pFilterOptionKeys) {
|
|
48
|
-
|
|
48
|
+
const lReturnValue = { ...pOptions };
|
|
49
49
|
|
|
50
50
|
for (const lFilterOptionKey of pFilterOptionKeys) {
|
|
51
51
|
if (pOptions[lFilterOptionKey]) {
|
|
@@ -74,7 +74,7 @@ function normalizeCollapse(pCollapse) {
|
|
|
74
74
|
|
|
75
75
|
function normalizeFocusDepth(pFormatOptions) {
|
|
76
76
|
/** @type {IFormatOptions}*/
|
|
77
|
-
|
|
77
|
+
const lFormatOptions = structuredClone(pFormatOptions);
|
|
78
78
|
if (Object.hasOwn(lFormatOptions, "focusDepth")) {
|
|
79
79
|
if (lFormatOptions?.focus) {
|
|
80
80
|
lFormatOptions.focus.depth = Number.parseInt(
|
package/src/main/report-wrap.mjs
CHANGED
|
@@ -37,7 +37,7 @@ const DEFAULT_RESOLVE_OPTIONS = {
|
|
|
37
37
|
|
|
38
38
|
function omit(pObject, pProperty) {
|
|
39
39
|
const lObject = structuredClone(pObject);
|
|
40
|
-
|
|
40
|
+
/* oxlint-disable-next-line no-dynamic-delete */
|
|
41
41
|
delete lObject[pProperty];
|
|
42
42
|
return lObject;
|
|
43
43
|
}
|
|
@@ -71,7 +71,7 @@ async function compileResolveOptions(
|
|
|
71
71
|
pTSConfig,
|
|
72
72
|
pResolveOptionsFromDCConfig,
|
|
73
73
|
) {
|
|
74
|
-
|
|
74
|
+
const lResolveOptions = {};
|
|
75
75
|
|
|
76
76
|
// There's a performance impact of ~1 ms per resolve even when there
|
|
77
77
|
// are 0 paths in the tsconfig, so not loading it when not necessary
|
|
@@ -76,7 +76,7 @@ function assertRuleSafety(pRule) {
|
|
|
76
76
|
* Throws an Error in all other cases.
|
|
77
77
|
*
|
|
78
78
|
* @param {IConfiguration} pConfiguration The configuration to validate
|
|
79
|
-
* @
|
|
79
|
+
* @returns {IConfiguration} The configuration as passed
|
|
80
80
|
* @throws {Error} An error with the reason for the error as a message
|
|
81
81
|
*/
|
|
82
82
|
export default function assertRuleSetValid(pConfiguration) {
|
|
@@ -111,7 +111,7 @@ function normalizeRule(pRule) {
|
|
|
111
111
|
* - severity (default 'warn')
|
|
112
112
|
*
|
|
113
113
|
* @param {IFlattenedRuleSet} pRuleSet
|
|
114
|
-
* @
|
|
114
|
+
* @returns {IStrictRuleSet}
|
|
115
115
|
*/
|
|
116
116
|
export default function normalizeRuleSet(pRuleSet) {
|
|
117
117
|
bus.debug("startup: parse rule set: normalize");
|
package/src/meta.cjs
CHANGED
|
@@ -37,7 +37,7 @@ function replaceFromWordList(pPathElement, pWordList, pCached) {
|
|
|
37
37
|
* @param {string[]} pWordList words to pick from
|
|
38
38
|
* @param {RegExp} pWhiteListRE pattern not to anonymize
|
|
39
39
|
* @param {boolean} pCached caches the replaced value, with pPathElement as the key
|
|
40
|
-
* @
|
|
40
|
+
* @returns {string} the path element, anonymized if it isn't whitelisted
|
|
41
41
|
*/
|
|
42
42
|
export function anonymizePathElement(
|
|
43
43
|
pPathElement,
|
|
@@ -179,7 +179,7 @@ function sanitizeWordList(pWordList) {
|
|
|
179
179
|
*/
|
|
180
180
|
export default function reportAnonymous(pResults, pAnonymousReporterOptions) {
|
|
181
181
|
/** @type {{wordlist?: String[]}} */
|
|
182
|
-
|
|
182
|
+
const lAnonymousReporterOptions = pAnonymousReporterOptions || {};
|
|
183
183
|
if (!lAnonymousReporterOptions.wordlist) {
|
|
184
184
|
lAnonymousReporterOptions.wordlist =
|
|
185
185
|
pResults?.summary?.optionsUsed?.reporterOptions?.anon?.wordlist ?? [];
|
|
@@ -51,7 +51,7 @@ function getRandomChar(pChar) {
|
|
|
51
51
|
* pulp2slurp => jgyb3guyow
|
|
52
52
|
*
|
|
53
53
|
* @param {string} pString - any string
|
|
54
|
-
* @
|
|
54
|
+
* @returns {string} - a random string with above specs
|
|
55
55
|
*/
|
|
56
56
|
export default function getRandomString(pString) {
|
|
57
57
|
return Array.from(pString).map(getRandomChar).join("");
|
|
@@ -80,7 +80,7 @@ function formatViolation(pViolation) {
|
|
|
80
80
|
reachability: formatReachabilityViolation,
|
|
81
81
|
instability: formatInstabilityViolation,
|
|
82
82
|
};
|
|
83
|
-
|
|
83
|
+
const lFormattedViolators = _formatViolation(
|
|
84
84
|
pViolation,
|
|
85
85
|
lViolationType2Formatter,
|
|
86
86
|
formatDependencyViolation,
|
|
@@ -133,7 +133,7 @@ function formatIgnoreWarning(pNumberOfIgnored) {
|
|
|
133
133
|
* @returns {string}
|
|
134
134
|
*/
|
|
135
135
|
function formatResultMessage(pSummary) {
|
|
136
|
-
|
|
136
|
+
const lStatSummary = `${pSummary.totalCruised} modules, ${
|
|
137
137
|
pSummary?.totalDependenciesCruised ?? 0
|
|
138
138
|
} dependencies cruised`;
|
|
139
139
|
|
package/src/report/baseline.mjs
CHANGED
|
@@ -7,7 +7,7 @@ const EOL = "\n";
|
|
|
7
7
|
* @param {import('../../types/dependency-cruiser').ICruiseResult} pCruiseResult -
|
|
8
8
|
* the output of a dependency-cruise adhering to dependency-cruiser's
|
|
9
9
|
* cruise result schema
|
|
10
|
-
* @
|
|
10
|
+
* @returns {import('../../types/dependency-cruiser').IReporterOutput} -
|
|
11
11
|
* output: some stats on modules and dependencies in json format
|
|
12
12
|
* exitCode: 0
|
|
13
13
|
*/
|
package/src/report/d2.mjs
CHANGED
|
@@ -32,7 +32,7 @@ function getMaxSeverity(pRules) {
|
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* @param {string} pSource
|
|
35
|
-
* @
|
|
35
|
+
* @returns {string}
|
|
36
36
|
*/
|
|
37
37
|
function getVertexName(pSource) {
|
|
38
38
|
const lFolderName = dirname(pSource)
|
|
@@ -117,7 +117,7 @@ function getDependencyAttributes(pDependency) {
|
|
|
117
117
|
|
|
118
118
|
/**
|
|
119
119
|
* @param {import('../../types/cruise-result').ICruiseResult} pCruiseResult
|
|
120
|
-
* @
|
|
120
|
+
* @returns {string}
|
|
121
121
|
*/
|
|
122
122
|
function renderD2Source(pCruiseResult) {
|
|
123
123
|
const lVertices = pCruiseResult.modules
|
|
@@ -153,7 +153,7 @@ function renderD2Source(pCruiseResult) {
|
|
|
153
153
|
* d2 reporter
|
|
154
154
|
*
|
|
155
155
|
* @param {import('../../types/dependency-cruiser').ICruiseResult} pCruiseResult
|
|
156
|
-
* @
|
|
156
|
+
* @returns {import('../../types/dependency-cruiser').IReporterOutput}
|
|
157
157
|
*/
|
|
158
158
|
export default function d2(pCruiseResult) {
|
|
159
159
|
return {
|
package/src/report/dot/index.mjs
CHANGED
|
@@ -57,8 +57,8 @@ function makeInstabilityString(pModule, pShowMetrics = false) {
|
|
|
57
57
|
export function folderify(pShowMetrics) {
|
|
58
58
|
/** @param {import("../../../types/cruise-result").IModule} pModule*/
|
|
59
59
|
return (pModule) => {
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
const lAdditions = {};
|
|
61
|
+
const lDirectoryName = dirname(pModule.source);
|
|
62
62
|
|
|
63
63
|
if (lDirectoryName !== ".") {
|
|
64
64
|
lAdditions.folder = lDirectoryName;
|
|
@@ -47,12 +47,18 @@ function moduleOrDependencyMatchesCriteria(pSchemeEntry, pModule) {
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
export function getThemeAttributes(pModuleOrDependency, pAttributeCriteria) {
|
|
50
|
-
return (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
return (
|
|
51
|
+
(pAttributeCriteria || [])
|
|
52
|
+
.filter((pSchemeEntry) =>
|
|
53
|
+
moduleOrDependencyMatchesCriteria(pSchemeEntry, pModuleOrDependency),
|
|
54
|
+
)
|
|
55
|
+
.map((pSchemeEntry) => pSchemeEntry.attributes)
|
|
56
|
+
/* oxlint-disable-next-line no-accumulating-spread -
|
|
57
|
+
replacing it with alternatives is going to yield the same O(n^2)
|
|
58
|
+
complexity, just with more lines of code
|
|
59
|
+
*/
|
|
60
|
+
.reduce((pAll, pCurrent) => ({ ...pCurrent, ...pAll }), {})
|
|
61
|
+
);
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
export function normalizeTheme(pTheme) {
|
|
@@ -84,7 +84,7 @@ function Mode() {
|
|
|
84
84
|
*
|
|
85
85
|
* @param {SVGGelement[]} pEdges
|
|
86
86
|
* @param {SVGGElement[]} pNodes
|
|
87
|
-
* @
|
|
87
|
+
* @returns {{get: (pTitleText:string) => SVGGElement[]}}
|
|
88
88
|
*/
|
|
89
89
|
function Title2ElementMap(pEdges, pNodes) {
|
|
90
90
|
/* {{[key: string]: SVGGElement[]}} */
|
|
@@ -93,7 +93,7 @@ function Title2ElementMap(pEdges, pNodes) {
|
|
|
93
93
|
/**
|
|
94
94
|
* @param {NodeListOf<SVGGElement>} pEdges
|
|
95
95
|
* @param {NodeListOf<SVGGElement>} pNodes
|
|
96
|
-
* @
|
|
96
|
+
* @returns {{[key: string]: SVGGElement[]}}
|
|
97
97
|
*/
|
|
98
98
|
function buildMap(pEdges, pNodes) {
|
|
99
99
|
var title2NodeMap = buildTitle2NodeMap(pNodes);
|
|
@@ -102,7 +102,7 @@ function Title2ElementMap(pEdges, pNodes) {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* @param {NodeListOf<SVGGElement>} pNodes
|
|
105
|
-
* @
|
|
105
|
+
* @returns {{[key: string]: SVGGElement}}
|
|
106
106
|
*/
|
|
107
107
|
function buildTitle2NodeMap(pNodes) {
|
|
108
108
|
return nodeListToArray(pNodes).reduce(addNodeToMap, {});
|
|
@@ -136,7 +136,7 @@ function Title2ElementMap(pEdges, pNodes) {
|
|
|
136
136
|
/**
|
|
137
137
|
*
|
|
138
138
|
* @param {string} pString
|
|
139
|
-
* @
|
|
139
|
+
* @returns {{from?: string; to?:string;}}
|
|
140
140
|
*/
|
|
141
141
|
function pryEdgeFromTitle(pString) {
|
|
142
142
|
var nodeNames = pString.split(/\s*->\s*/);
|
|
@@ -149,7 +149,7 @@ function Title2ElementMap(pEdges, pNodes) {
|
|
|
149
149
|
/**
|
|
150
150
|
*
|
|
151
151
|
* @param {string} pTitleText
|
|
152
|
-
* @
|
|
152
|
+
* @returns {SVGGElement[]}
|
|
153
153
|
*/
|
|
154
154
|
function get(pTitleText) {
|
|
155
155
|
return (pTitleText && elementMap[pTitleText]) || [];
|
|
@@ -161,7 +161,7 @@ function Title2ElementMap(pEdges, pNodes) {
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* @param {SVGGElement} pGElement
|
|
164
|
-
* @
|
|
164
|
+
* @returns {string?}
|
|
165
165
|
*/
|
|
166
166
|
function getTitleText(pGElement) {
|
|
167
167
|
/** @type {SVGTitleElement} */
|
|
@@ -177,7 +177,7 @@ function getTitleText(pGElement) {
|
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
179
|
* @param {NodeListOf<Element>} pNodeList
|
|
180
|
-
* @
|
|
180
|
+
* @returns {Element[]}
|
|
181
181
|
*/
|
|
182
182
|
function nodeListToArray(pNodeList) {
|
|
183
183
|
var lReturnValue = [];
|
package/src/report/error.mjs
CHANGED
|
@@ -15,6 +15,13 @@ const SEVERITY2COLOR = new Map([
|
|
|
15
15
|
["ignore", "gray"],
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
|
+
const SEVERITY2ICON = new Map([
|
|
19
|
+
["error", "x"],
|
|
20
|
+
["warn", "‼"],
|
|
21
|
+
["info", "i"],
|
|
22
|
+
["ignore", "-"],
|
|
23
|
+
]);
|
|
24
|
+
|
|
18
25
|
const EXTRA_PATH_INFORMATION_INDENT = 6;
|
|
19
26
|
|
|
20
27
|
function formatMiniDependency(pMiniDependency) {
|
|
@@ -89,7 +96,7 @@ function sumMeta(pMeta) {
|
|
|
89
96
|
}
|
|
90
97
|
|
|
91
98
|
function formatSummary(pSummary) {
|
|
92
|
-
|
|
99
|
+
const lMessage = `${EOL}x ${sumMeta(
|
|
93
100
|
pSummary,
|
|
94
101
|
)} dependency violations (${formatMeta(pSummary)}). ${
|
|
95
102
|
pSummary.totalCruised
|
|
@@ -116,6 +123,29 @@ function formatIgnoreWarning(pNumberOfIgnoredViolations) {
|
|
|
116
123
|
}
|
|
117
124
|
return "";
|
|
118
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* @param {import("../../types/cruise-result.mjs").IEnvironmentIssue} pEnvironmentIssue
|
|
128
|
+
* @returns {string}
|
|
129
|
+
*/
|
|
130
|
+
function formatEnvironmentIssue(pEnvironmentIssue) {
|
|
131
|
+
return styleText(
|
|
132
|
+
SEVERITY2COLOR.get(pEnvironmentIssue.severity),
|
|
133
|
+
`${SEVERITY2ICON.get(pEnvironmentIssue.severity)} ${styleText("bold", pEnvironmentIssue.name)}: ${pEnvironmentIssue.description}`,
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @param {import("../../types/cruise-result.mjs").IEnvironmentIssue[]} pEnvironmentIssues
|
|
139
|
+
* @returns {string}
|
|
140
|
+
*/
|
|
141
|
+
function formatEnvironmentIssues(pEnvironmentIssues) {
|
|
142
|
+
const lEnvironmentIssues = pEnvironmentIssues ?? [];
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
(lEnvironmentIssues.length > 0 ? EOL : "") +
|
|
146
|
+
lEnvironmentIssues.map(formatEnvironmentIssue).join(EOL)
|
|
147
|
+
);
|
|
148
|
+
}
|
|
119
149
|
|
|
120
150
|
function report(pResults, pOptions) {
|
|
121
151
|
const lOptions = {
|
|
@@ -135,7 +165,7 @@ function report(pResults, pOptions) {
|
|
|
135
165
|
pResults.summary.totalDependenciesCruised
|
|
136
166
|
} dependencies cruised)${EOL}${formatIgnoreWarning(
|
|
137
167
|
pResults.summary.ignore,
|
|
138
|
-
)}${EOL}`;
|
|
168
|
+
)}${formatEnvironmentIssues(pResults.summary.environment?.issues)}${EOL}`;
|
|
139
169
|
}
|
|
140
170
|
|
|
141
171
|
return lNonIgnorableViolations
|
|
@@ -147,6 +177,7 @@ function report(pResults, pOptions) {
|
|
|
147
177
|
)
|
|
148
178
|
.concat(formatSummary(pResults.summary))
|
|
149
179
|
.concat(formatIgnoreWarning(pResults.summary.ignore))
|
|
180
|
+
.concat(formatEnvironmentIssues(pResults.summary.environment?.issues))
|
|
150
181
|
.concat(EOL);
|
|
151
182
|
}
|
|
152
183
|
|
|
@@ -17,7 +17,7 @@ function addShowTitle(pDependencyEntry) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function getClasses(pModule, pOtherClasses) {
|
|
20
|
-
|
|
20
|
+
const lClasses = pOtherClasses || [];
|
|
21
21
|
if (pModule.coreModule) {
|
|
22
22
|
lClasses.push("cell-core-module");
|
|
23
23
|
}
|
|
@@ -37,7 +37,7 @@ function constructTableHead(pModules) {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
function constructTableCellTitle(pModule, pIncidence) {
|
|
40
|
-
|
|
40
|
+
const lTitleLines = [];
|
|
41
41
|
if (pIncidence.rule) {
|
|
42
42
|
lTitleLines.push(`${pIncidence.rule}:`);
|
|
43
43
|
}
|
package/src/report/index.mjs
CHANGED
|
@@ -36,6 +36,7 @@ const TYPE2MODULE = new Map([
|
|
|
36
36
|
* and returns an IReporterOutput
|
|
37
37
|
*/
|
|
38
38
|
export async function getReporter(pOutputType) {
|
|
39
|
+
/* oxlint-disable-next-line no-useless-assignment */
|
|
39
40
|
let lReturnValue = {};
|
|
40
41
|
if (pOutputType?.startsWith("plugin:")) {
|
|
41
42
|
lReturnValue = await getExternalPluginReporter(pOutputType);
|
package/src/report/markdown.mjs
CHANGED
|
@@ -49,7 +49,7 @@ function severity2Icon(pSeverity) {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* @param {import("../../types/cruise-result.mjs").ISummary} pSummary
|
|
52
|
-
* @
|
|
52
|
+
* @returns {string}
|
|
53
53
|
*/
|
|
54
54
|
function formatStatsSummary(pSummary) {
|
|
55
55
|
const lSpacerLength = 4;
|
|
@@ -60,7 +60,7 @@ function formatStatsSummary(pSummary) {
|
|
|
60
60
|
/**
|
|
61
61
|
* @param {import("../../types/cruise-result.mjs").ICruiseResult} pCruiseResult
|
|
62
62
|
* @param {Boolean} pIncludeIgnoredInSummary
|
|
63
|
-
* @
|
|
63
|
+
* @returns {string}
|
|
64
64
|
*/
|
|
65
65
|
function formatRulesSummary(pCruiseResult, pIncludeIgnoredInSummary) {
|
|
66
66
|
const lTableHead =
|
|
@@ -87,7 +87,7 @@ function formatRulesSummary(pCruiseResult, pIncludeIgnoredInSummary) {
|
|
|
87
87
|
*
|
|
88
88
|
* @param {import("../../types/cruise-result.mjs").IViolation[]} pViolations
|
|
89
89
|
* @param {object} pOptions
|
|
90
|
-
* @
|
|
90
|
+
* @returns {string}
|
|
91
91
|
*/
|
|
92
92
|
function formatViolations(pViolations, pOptions) {
|
|
93
93
|
const lTableHead = "|violated rule|module|to|\n|:---|:---|:---|\n";
|
package/src/report/mermaid.mjs
CHANGED
|
@@ -63,7 +63,7 @@ function renderSubgraphs(pSource, pOptions, pDepth = 0) {
|
|
|
63
63
|
* @param {Map<string, string>} pNamesHashMap
|
|
64
64
|
*/
|
|
65
65
|
function convertSubgraphSources(pCruiseResult, pNamesHashMap) {
|
|
66
|
-
|
|
66
|
+
const lTree = {};
|
|
67
67
|
|
|
68
68
|
for (const lModule of pCruiseResult.modules) {
|
|
69
69
|
const lPaths = lModule.source.split("/");
|
|
@@ -114,7 +114,7 @@ const hashToReadableNodeName = (pNode) =>
|
|
|
114
114
|
/**
|
|
115
115
|
* @param {import("../../types/cruise-result").IModule[]} pModules
|
|
116
116
|
* @param {Boolean} pMinify
|
|
117
|
-
* @
|
|
117
|
+
* @returns {Map<string, string>}
|
|
118
118
|
*/
|
|
119
119
|
function hashModuleNames(pModules, pMinify) {
|
|
120
120
|
const lBase = 36;
|
|
@@ -173,7 +173,7 @@ ${focusHighlights(pCruiseResult.modules, lNamesHashMap)}`;
|
|
|
173
173
|
*
|
|
174
174
|
* @param {import('../../types/dependency-cruiser').ICruiseResult} pCruiseResult
|
|
175
175
|
* @param {import("../../types/reporter-options").IMermaidReporterOptions} pOptions
|
|
176
|
-
* @
|
|
176
|
+
* @returns {import('../../types/dependency-cruiser').IReporterOutput}
|
|
177
177
|
*/
|
|
178
178
|
export default function mermaid(pCruiseResult, pOptions) {
|
|
179
179
|
return {
|
package/src/report/metrics.mjs
CHANGED
|
@@ -249,7 +249,7 @@ function transformMetricsToTable(
|
|
|
249
249
|
largeIntegerWidth: METRIC_WIDTH + METRIC_WIDTH,
|
|
250
250
|
},
|
|
251
251
|
);
|
|
252
|
-
|
|
252
|
+
const lComponents = lObject.data
|
|
253
253
|
.filter(
|
|
254
254
|
(pComponent) =>
|
|
255
255
|
(!hideModules && pComponent.type === "module") ||
|
|
@@ -268,7 +268,7 @@ function transformMetricsToTable(
|
|
|
268
268
|
*
|
|
269
269
|
* @param {import('../../types/dependency-cruiser.js').ICruiseResult} pCruiseResult -
|
|
270
270
|
* @param {import("../../types/reporter-options.js").IMetricsReporterOptions} pReporterOptions
|
|
271
|
-
* @
|
|
271
|
+
* @returns {import('../../types/dependency-cruiser.js').IReporterOutput} -
|
|
272
272
|
*/
|
|
273
273
|
export default function metrics(pCruiseResult, pReporterOptions) {
|
|
274
274
|
const lReporterOptions = pReporterOptions || {};
|
package/src/report/plugins.mjs
CHANGED
|
@@ -25,12 +25,13 @@ export function isValidPlugin(pPluginFunction) {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
async function getPluginReporter(pOutputType) {
|
|
28
|
+
/* oxlint-disable-next-line no-useless-assignment */
|
|
28
29
|
let lReturnValue = false;
|
|
29
30
|
|
|
30
31
|
try {
|
|
31
32
|
const lModule = await import(pOutputType);
|
|
32
33
|
lReturnValue = lModule.default;
|
|
33
|
-
} catch
|
|
34
|
+
} catch {
|
|
34
35
|
throw new Error(
|
|
35
36
|
`Could not find reporter plugin '${pOutputType}' (or it isn't valid)`,
|
|
36
37
|
);
|
package/src/report/teamcity.mjs
CHANGED
|
@@ -16,7 +16,7 @@ const EOL = "\n";
|
|
|
16
16
|
* Copied from https://github.com/pifantastic/teamcity-service-messages/blob/master/lib/message.js#L72
|
|
17
17
|
*
|
|
18
18
|
* @param {String} pMessageString the string to escape
|
|
19
|
-
* @
|
|
19
|
+
* @returns {String}
|
|
20
20
|
*/
|
|
21
21
|
function escape(pMessageString) {
|
|
22
22
|
if (pMessageString === null) {
|
|
@@ -48,7 +48,7 @@ function escape(pMessageString) {
|
|
|
48
48
|
* but this is what teamcity-service-messages used, so as
|
|
49
49
|
* per the rule of least surprise, this is what we use as well.
|
|
50
50
|
*
|
|
51
|
-
* @
|
|
51
|
+
* @returns {string} 10 random numeric digits
|
|
52
52
|
*/
|
|
53
53
|
function getRandomFlowId() {
|
|
54
54
|
const lFlowIdLength = 10;
|
|
@@ -8,7 +8,7 @@ function compareOnSource(pOne, pTwo) {
|
|
|
8
8
|
|
|
9
9
|
function determineIncidenceType(pFromListEntry) {
|
|
10
10
|
return (pModule) => {
|
|
11
|
-
|
|
11
|
+
const lDependency = pModule.dependencies.find(
|
|
12
12
|
(pDependency) => pDependency.resolved === pFromListEntry.source,
|
|
13
13
|
);
|
|
14
14
|
|
package/src/report/utl/index.mjs
CHANGED
|
@@ -32,7 +32,7 @@ export function formatViolation(
|
|
|
32
32
|
*
|
|
33
33
|
* @param {string} pPrefix - prefix
|
|
34
34
|
* @param {string} pSource - filename
|
|
35
|
-
* @
|
|
35
|
+
* @returns {string} prefix and filename concatenated
|
|
36
36
|
*/
|
|
37
37
|
function smartURIConcat(pPrefix, pSource) {
|
|
38
38
|
if (PROTOCOL_PREFIX_RE.test(pPrefix)) {
|