dependency-cruiser 17.3.10 → 17.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/analyze/summarize/summarize-modules.mjs +2 -0
- package/src/cli/init-config/build-config.mjs +1 -1
- package/src/cli/init-config/check-and-warn-inconsistencies.mjs +111 -0
- package/src/cli/init-config/get-user-input.mjs +1 -1
- package/src/cli/init-config/index.mjs +6 -1
- package/src/cli/init-config/normalize-init-options.mjs +1 -1
- package/src/cli/init-config/types.d.mts +114 -0
- package/src/cli/init-config/write-run-scripts-to-manifest.mjs +1 -1
- package/src/extract/transpile/meta.mjs +32 -10
- package/src/meta.cjs +1 -1
- package/src/report/error-html/error-html-template.mjs +25 -0
- package/src/report/error-html/index.mjs +23 -10
- package/src/report/error-html/utl.mjs +9 -8
- package/src/report/error.mjs +20 -9
- package/src/report/markdown.mjs +8 -5
- package/src/report/utl/index.mjs +60 -0
- package/src/schema/configuration.validate.mjs +1 -1
- package/src/schema/cruise-result.validate.mjs +1 -1
- package/src/utl/try-import.mjs +0 -1
- package/types/reporter-options.d.mts +47 -2
- package/types/violations.d.mts +14 -2
package/src/utl/try-import.mjs
CHANGED
|
@@ -45,7 +45,6 @@ function getVersion(pModuleName) {
|
|
|
45
45
|
* @param {string} [pSemanticVersion] - An semantic version to check against.
|
|
46
46
|
* @returns {Promise<NodeModule | false>} - The imported module or false if the import fails or the version does not satisfy the provided semantic version.
|
|
47
47
|
*/
|
|
48
|
-
|
|
49
48
|
export default async function tryImport(pModuleName, pSemanticVersion) {
|
|
50
49
|
try {
|
|
51
50
|
if (pSemanticVersion) {
|
|
@@ -22,6 +22,18 @@ export interface IReporterOptions {
|
|
|
22
22
|
* Options to tweak the output of the ddot reporter
|
|
23
23
|
*/
|
|
24
24
|
ddot?: IDotReporterOptions;
|
|
25
|
+
/**
|
|
26
|
+
* Options to tweak the output of the err reporter
|
|
27
|
+
*/
|
|
28
|
+
err?: IErrorReporterOptions;
|
|
29
|
+
/**
|
|
30
|
+
* Options to tweak the output of the err-html reporter
|
|
31
|
+
*/
|
|
32
|
+
"err-html"?: IErrorReporterOptions;
|
|
33
|
+
/**
|
|
34
|
+
* Options to tweak the output of the err-long reporter
|
|
35
|
+
*/
|
|
36
|
+
"err-long"?: IErrorReporterOptions;
|
|
25
37
|
/**
|
|
26
38
|
* Options to tweak the output of the flat /fdot reporter
|
|
27
39
|
*/
|
|
@@ -57,7 +69,7 @@ export interface IAnonReporterOptions {
|
|
|
57
69
|
* List of words to use to replace path elements of file names in the output
|
|
58
70
|
* with so the output isn't directly traceable to its intended purpose.
|
|
59
71
|
* When the list is exhausted, the anon reporter will use random strings
|
|
60
|
-
* patterned after the original file name
|
|
72
|
+
* patterned after the original file name instead. The list is empty
|
|
61
73
|
* by default.
|
|
62
74
|
*
|
|
63
75
|
* Read more in https://github.com/sverweij/dependency-cruiser/blob/main/doc/cli.md#anon---obfuscated-json",
|
|
@@ -126,6 +138,24 @@ export interface IDotThemeEntry {
|
|
|
126
138
|
attributes: any;
|
|
127
139
|
}
|
|
128
140
|
|
|
141
|
+
export interface IErrorReporterOptions {
|
|
142
|
+
/**
|
|
143
|
+
* For external modules (typically those in node_modules), show the
|
|
144
|
+
* unresolved module name instead of the resolved one in the error
|
|
145
|
+
* overview.
|
|
146
|
+
* E.g. 'snodash' instead of 'node_modules/snodash/dist/esm/bundle.mjs'.
|
|
147
|
+
* Defaults to false.
|
|
148
|
+
*/
|
|
149
|
+
showExternalModulesUnresolved?: boolean;
|
|
150
|
+
/**
|
|
151
|
+
* For aliased modules (either subpath imports in package.json or via legacy
|
|
152
|
+
* tsconfig/ jsconfig/ webpack/ babel constructs) show the unresolved module name instead of the
|
|
153
|
+
* resolved one in the error overview.
|
|
154
|
+
* E.g. '#utils' instead of 'libs/shared/utils/lib/src/main.cjs'
|
|
155
|
+
* Defaults to false.
|
|
156
|
+
*/
|
|
157
|
+
showAliasedModulesUnresolved?: boolean;
|
|
158
|
+
}
|
|
129
159
|
export interface IMetricsReporterOptions {
|
|
130
160
|
hideModules?: boolean;
|
|
131
161
|
hideFolders?: boolean;
|
|
@@ -185,11 +215,26 @@ export interface IMarkdownReporterOptions {
|
|
|
185
215
|
* The text to show as a header on top of the detailed list of violations. E.g. '### All violations'
|
|
186
216
|
* When left out shows a default value.
|
|
187
217
|
*/
|
|
188
|
-
detailsHeader?:
|
|
218
|
+
detailsHeader?: string;
|
|
189
219
|
/**
|
|
190
220
|
* Whether or not to collapse the list of violations in a <details> block. Defaults to true.
|
|
191
221
|
*/
|
|
192
222
|
collapseDetails?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* For external modules (typically those in node_modules) show the unresolved module name instead
|
|
225
|
+
* of the resolved one in the error overview.
|
|
226
|
+
* E.g 'snodash' instead of 'node_modules/snodash/dist/esm/bundle.mjs'.
|
|
227
|
+
* Defaults to false.
|
|
228
|
+
*/
|
|
229
|
+
showExternalModulesUnresolved?: boolean;
|
|
230
|
+
/**
|
|
231
|
+
* For aliased modules (either subpath imports in package.json or via legacy
|
|
232
|
+
* tsconfig/ jsconfig/ webpack/ babel constructs) show the unresolved module name instead of the
|
|
233
|
+
* resolved one in the error overview.
|
|
234
|
+
* 'E.g. '#utils' instead of 'libs/shared/utils/lib/src/main.cjs'
|
|
235
|
+
* Defaults to false.
|
|
236
|
+
*/
|
|
237
|
+
showAliasedModulesUnresolved?: boolean;
|
|
193
238
|
/**
|
|
194
239
|
* The text to in the <summary> section of the <details> block. E.g. 'click to see all violations'
|
|
195
240
|
* When left out shows a default value.
|
package/types/violations.d.mts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { IRuleSummary } from "./rule-summary.mjs";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
DependencyType,
|
|
4
|
+
IMiniDependency,
|
|
5
|
+
ViolationType,
|
|
6
|
+
} from "./shared-types.mjs";
|
|
3
7
|
|
|
4
8
|
export interface IMetricsSummary {
|
|
5
9
|
from: {
|
|
@@ -24,9 +28,17 @@ export interface IViolation {
|
|
|
24
28
|
*/
|
|
25
29
|
from: string;
|
|
26
30
|
/**
|
|
27
|
-
* The to part of the dependency this violation is about
|
|
31
|
+
* The (resolved) to part of the dependency this violation is about
|
|
28
32
|
*/
|
|
29
33
|
to: string;
|
|
34
|
+
/**
|
|
35
|
+
* The (unresolved) to part of the dependency this violation is about
|
|
36
|
+
*/
|
|
37
|
+
unresolvedTo?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The dependencyTypes that define the relation between the to and the from
|
|
40
|
+
*/
|
|
41
|
+
dependencyTypes?: DependencyType[];
|
|
30
42
|
/**
|
|
31
43
|
* The circular path if the violation is about circularity
|
|
32
44
|
*/
|