dependency-cruiser 18.1.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 +3 -3
- package/src/analyze/add-validations.mjs +1 -1
- package/src/analyze/derive/folders/utl.mjs +2 -2
- package/src/analyze/summarize/summarize-modules.mjs +1 -1
- package/src/cache/cache.mjs +4 -4
- package/src/cache/helpers.mjs +2 -2
- package/src/cli/format-meta-info.mjs +3 -3
- package/src/cli/index.mjs +2 -2
- 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/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/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.mjs +1 -1
- 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/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 +3 -1
- 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/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
|
@@ -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
|
@@ -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)) {
|
package/src/utl/array-util.mjs
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @param {string[]} pLeftArray an array of strings
|
|
6
6
|
* @param {string[]} pRightArray another array of strings
|
|
7
|
-
* @
|
|
7
|
+
* @returns {boolean} true if there's at least one element in pLeftArray also in pRightArray
|
|
8
8
|
*/
|
|
9
9
|
export function intersects(pLeftArray, pRightArray) {
|
|
10
10
|
if (pLeftArray.length === 0 || pRightArray.length === 0) {
|
|
@@ -13,7 +13,7 @@ const EXTENSION_RE = /(?<extension>(?:(?:\.d\.(?:[cm])?ts)|\.coffee\.md)$)/;
|
|
|
13
13
|
* .ts, .cts and .mts
|
|
14
14
|
*
|
|
15
15
|
* @param {string} pFileName path to the file to be parsed
|
|
16
|
-
* @
|
|
16
|
+
* @returns {string} extension
|
|
17
17
|
*/
|
|
18
18
|
export default function getExtension(pFileName) {
|
|
19
19
|
const lMatchResult = EXTENSION_RE.exec(pFileName);
|
|
@@ -17,7 +17,7 @@ import path from "node:path";
|
|
|
17
17
|
* @param {string} pFilePath the path to transform
|
|
18
18
|
* @param {path} pPathModule? optional - the path module/ object to use (for testing
|
|
19
19
|
* this module on posix platforms only; defaults to require('path'))
|
|
20
|
-
* @
|
|
20
|
+
* @returns {string} the transformed path
|
|
21
21
|
*/
|
|
22
22
|
export default function pathToPosix(pFilePath, pPathModule = path) {
|
|
23
23
|
const lPathModule = pPathModule || path;
|
package/src/utl/regex-util.mjs
CHANGED
|
@@ -41,7 +41,9 @@ export function extractGroups(pFromRestriction, pActualPath) {
|
|
|
41
41
|
// except before it enters here it has already been 'normalized' to a string
|
|
42
42
|
// so it can be safely passed to match. The right solution here (TODO)
|
|
43
43
|
// is to create a separate type for NormalizedFromRestriction
|
|
44
|
-
|
|
44
|
+
const lMatchResult = getCachedRegExp(pFromRestriction.path).exec(
|
|
45
|
+
pActualPath,
|
|
46
|
+
);
|
|
45
47
|
|
|
46
48
|
if (lMatchResult && lMatchResult.length > 1) {
|
|
47
49
|
lReturnValue = lMatchResult.filter(
|
package/src/utl/try-import.mjs
CHANGED
package/src/utl/try-require.cjs
CHANGED
|
@@ -6,7 +6,7 @@ const extractRootModuleName = require("./extract-root-module-name.cjs");
|
|
|
6
6
|
/**
|
|
7
7
|
* @throws {Error}
|
|
8
8
|
* @param pModuleName the name of the module to get the version for
|
|
9
|
-
* @
|
|
9
|
+
* @returns the version of the module identified by pModuleName
|
|
10
10
|
*/
|
|
11
11
|
function getVersion(pModuleName) {
|
|
12
12
|
// @ts-expect-error TS2345 extractRootModuleName can return either a string or
|
|
@@ -26,7 +26,7 @@ function getVersion(pModuleName) {
|
|
|
26
26
|
*
|
|
27
27
|
* @param {string} pModuleName the name of the module to resolve
|
|
28
28
|
* @param {string} [pSemanticVersion] (optional) a semantic version (range)
|
|
29
|
-
* @
|
|
29
|
+
* @returns {NodeModule | false }the (resolved) module identified by pModuleName or false
|
|
30
30
|
*/
|
|
31
31
|
function tryRequire(pModuleName, pSemanticVersion) {
|
|
32
32
|
try {
|
|
@@ -43,7 +43,7 @@ function tryRequire(pModuleName, pSemanticVersion) {
|
|
|
43
43
|
}
|
|
44
44
|
// eslint-disable-next-line import/no-dynamic-require, n/global-require, security/detect-non-literal-require
|
|
45
45
|
return require(pModuleName);
|
|
46
|
-
} catch
|
|
46
|
+
} catch {
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/validate/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function compareSeverity(pFirst, pSecond) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
function validateAgainstAllowedRules(pRuleSet, pMatchModule, pFrom, pTo) {
|
|
21
|
-
|
|
21
|
+
const lFoundRuleViolations = [];
|
|
22
22
|
|
|
23
23
|
if (pRuleSet.allowed) {
|
|
24
24
|
const lInterestingAllowedRules = pRuleSet.allowed.filter(
|
|
@@ -75,7 +75,7 @@ function validateAgainstRequiredRules(pRuleSet, pModule, pMatchModule) {
|
|
|
75
75
|
*/
|
|
76
76
|
function validateAgainstRules(pRuleSet, pFrom, pTo, pMatchModule) {
|
|
77
77
|
/** @type {IValidationResult} */
|
|
78
|
-
|
|
78
|
+
const lReturnValue = { valid: true };
|
|
79
79
|
|
|
80
80
|
const lFoundRuleViolations = validateAgainstAllowedRules(
|
|
81
81
|
pRuleSet,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Silently fails if a supported @babel/core version can't be found
|
|
6
6
|
*
|
|
7
7
|
* @param pBabelConfigFileName
|
|
8
|
-
* @
|
|
8
|
+
* @returns babel config as an object
|
|
9
9
|
* @throws when the babel config has an unknown extension OR
|
|
10
10
|
* when the babel config is invalid OR
|
|
11
11
|
* when dependency-cruiser can't yet process it
|
|
@@ -17,7 +17,7 @@ import type { IConfiguration } from "../configuration.mjs";
|
|
|
17
17
|
* @param pConfigFileName
|
|
18
18
|
* @param pAlreadyVisited
|
|
19
19
|
* @param pBaseDirectory
|
|
20
|
-
* @
|
|
20
|
+
* @returns dependency-cruiser configuration
|
|
21
21
|
* @throws when the config is not valid (/ does not exist/ isn't readable)
|
|
22
22
|
*/
|
|
23
23
|
export default function extractDepcruiseConfig(
|
|
@@ -10,7 +10,7 @@ import type { ICruiseOptions } from "../options.mjs";
|
|
|
10
10
|
* ```
|
|
11
11
|
*
|
|
12
12
|
* @param pConfigFileName
|
|
13
|
-
* @
|
|
13
|
+
* @returns dependency-cruiser options
|
|
14
14
|
* @throws when the config is not valid (/ does not exist/ isn't readable)
|
|
15
15
|
*/
|
|
16
16
|
export default function extractDepcruiseOptions(
|
|
@@ -7,7 +7,7 @@ import type { ParsedCommandLine } from "typescript";
|
|
|
7
7
|
* Silently fails if a supported version of the typescript compiler isn't available
|
|
8
8
|
*
|
|
9
9
|
* @param pTSConfigFileName
|
|
10
|
-
* @
|
|
10
|
+
* @returns tsconfig as an object
|
|
11
11
|
* @throws {Error} when the tsconfig is invalid/ has errors
|
|
12
12
|
* @throws {TypeError} when the tsconfig is unreadable
|
|
13
13
|
*/
|
|
@@ -8,7 +8,7 @@ import type { ResolveOptions } from "enhanced-resolve";
|
|
|
8
8
|
* @param pWebpackConfigFilename
|
|
9
9
|
* @param pEnvironment
|
|
10
10
|
* @param pArguments
|
|
11
|
-
* @
|
|
11
|
+
* @returns webpack resolve config as an object
|
|
12
12
|
* @throws when the webpack config isn't usable (e.g. because it
|
|
13
13
|
* doesn't exist, or because it's invalid)
|
|
14
14
|
*/
|
|
@@ -5,7 +5,7 @@ declare module "3d-reporter-plugin" {
|
|
|
5
5
|
* Sample plugin: 3d representation
|
|
6
6
|
*
|
|
7
7
|
* @param {ICruiseResult} pCruiseResult - the output of a dependency-cruise adhering to dependency-cruiser's cruise result schema
|
|
8
|
-
* @
|
|
8
|
+
* @returns {IReporterOutput} - output: a string, exitCode: 0
|
|
9
9
|
*/
|
|
10
10
|
export default function ThreeDReporterPlugin(
|
|
11
11
|
pCruiseResult: ICruiseResult,
|
|
@@ -6,7 +6,7 @@ declare module "mermaid-reporter-plugin" {
|
|
|
6
6
|
*
|
|
7
7
|
* @deprecated use the mermaid reporter baked into the dependency-cruiser itself (--output-type mermaid)
|
|
8
8
|
* @param {ICruiseResult} pCruiseResult - the output of a dependency-cruise adhering to dependency-cruiser's cruise result schema
|
|
9
|
-
* @
|
|
9
|
+
* @returns {IReporterOutput} - output: the module graph in mermaid format, exitCode: 0
|
|
10
10
|
*/
|
|
11
11
|
export default function statsReporterPlugin(
|
|
12
12
|
pCruiseResult: ICruiseResult,
|
|
@@ -5,7 +5,7 @@ declare module "stats-reporter-plugin" {
|
|
|
5
5
|
* Sample plugin: stats in json format
|
|
6
6
|
*
|
|
7
7
|
* @param {ICruiseResult} pCruiseResult - the output of a dependency-cruise adhering to dependency-cruiser's cruise result schema
|
|
8
|
-
* @
|
|
8
|
+
* @returns {IReporterOutput} - output: output: some stats on modules and dependencies in json format, exitCode: 0
|
|
9
9
|
*/
|
|
10
10
|
export default function statsReporterPlugin(
|
|
11
11
|
pCruiseResult: ICruiseResult,
|