dependency-cruiser 18.2.0 → 18.3.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/README.md +6 -6
- package/bin/depcruise-baseline.mjs +12 -5
- package/bin/{dependency-cruise.mjs → dependency-cruiser.mjs} +24 -14
- package/package.json +7 -7
- package/src/analyze/analyze-modules.mjs +5 -1
- package/src/analyze/index.mjs +1 -1
- package/src/analyze/soften-known-violations.mjs +4 -2
- package/src/analyze/summarize/summarize-options.mjs +2 -0
- package/src/cache/options-compatible.mjs +1 -0
- package/src/cli/index.mjs +11 -3
- package/src/cli/init-config/config-template.mjs +1 -1
- package/src/cli/init-config/write-run-scripts-to-manifest.mjs +7 -7
- package/src/cli/normalize-cli-options.mjs +63 -2
- package/src/extract/helpers.mjs +1 -0
- package/src/extract/swc/dependency-visitor.mjs +13 -2
- package/src/extract/swc/parse.mjs +14 -4
- package/src/extract/transpile/try-import-available.mjs +1 -1
- package/src/graph-utl/compare.mjs +113 -14
- package/src/main/options/normalize.mjs +9 -3
- package/src/main/report-wrap.mjs +4 -2
- package/src/meta.cjs +1 -1
- package/src/report/baseline.mjs +52 -10
- package/src/report/dot-webpage/dot-module.mjs +1 -1
- package/src/report/index.mjs +1 -0
- package/src/schema/configuration.validate.mjs +1 -1
- package/src/schema/cruise-result.validate.mjs +1 -1
- package/src/utl/try-import.mjs +1 -1
- package/types/dependency-cruiser.d.mts +6 -0
- package/types/options.d.mts +17 -1
- package/types/restrictions.d.mts +2 -2
- package/types/shared-types.d.mts +16 -13
package/src/utl/try-import.mjs
CHANGED
|
@@ -14,7 +14,7 @@ function getVersion(pModuleName) {
|
|
|
14
14
|
// The 'proper' way to do this would be with a dynamic import with an
|
|
15
15
|
// import assertion. Because it's 'experimental' since node 16 and prints
|
|
16
16
|
// an ugly warning on stderr since node 19 we'll be using the require
|
|
17
|
-
// hack below
|
|
17
|
+
// hack below instead. Code would otherwise have been:
|
|
18
18
|
//
|
|
19
19
|
// const lManifest = await import(
|
|
20
20
|
// // @ts-expect-error TS2345 extractRootModuleName can return either a string or
|
|
@@ -26,6 +26,12 @@ export interface IReporterOutput {
|
|
|
26
26
|
* a string.
|
|
27
27
|
*/
|
|
28
28
|
output: ICruiseResult | string;
|
|
29
|
+
/**
|
|
30
|
+
* Textual meta information to show in a side-channel (like stderr). E.g.
|
|
31
|
+
* the baseline reporter returns the numerical diffs between the current
|
|
32
|
+
* and the new baseline.
|
|
33
|
+
*/
|
|
34
|
+
meta?: string;
|
|
29
35
|
/**
|
|
30
36
|
* The exit code - reporters can return a non-zero value when they find
|
|
31
37
|
* errors here. api consumers (like a cli) can use this to return a
|
package/types/options.d.mts
CHANGED
|
@@ -16,6 +16,7 @@ export type ExternalModuleResolutionStrategyType = "node_modules" | "yarn-pnp";
|
|
|
16
16
|
export type ProgressType =
|
|
17
17
|
"cli-feedback" | "performance-log" | "ndjson" | "none";
|
|
18
18
|
export type ParserType = "acorn" | "tsc" | "swc";
|
|
19
|
+
export type BaselineModeType = "full" | "shrink-only";
|
|
19
20
|
|
|
20
21
|
export interface ITsConfig {
|
|
21
22
|
fileName?: string;
|
|
@@ -109,6 +110,11 @@ export interface ICruiseOptions {
|
|
|
109
110
|
* as 'highlighted' in its output
|
|
110
111
|
*/
|
|
111
112
|
highlight?: string | string[] | IHighlightType;
|
|
113
|
+
/*
|
|
114
|
+
* whether or not to ignore known violations (whether passed in a separate
|
|
115
|
+
* file or directly in knownViolations)
|
|
116
|
+
*/
|
|
117
|
+
ignoreKnown?: boolean;
|
|
112
118
|
/*
|
|
113
119
|
* baseline of known validations. Typically you'd specify these in a file called
|
|
114
120
|
* .dependency-cruiser-known-violations.json (which you'd generate with the --outputType
|
|
@@ -234,7 +240,7 @@ export interface ICruiseOptions {
|
|
|
234
240
|
*
|
|
235
241
|
* Hasn't had any effect on dependency-cruiser's behaviour since a few major
|
|
236
242
|
* versions ago. If there's a need to manipulate this use the `skipAnalysisNotInRules`
|
|
237
|
-
* option
|
|
243
|
+
* option instead.
|
|
238
244
|
*
|
|
239
245
|
* Previously documented behavior:
|
|
240
246
|
* > When true includes denormalized dependents in the cruise-result, even
|
|
@@ -424,6 +430,16 @@ export interface ICruiseOptions {
|
|
|
424
430
|
* When caching is switched on the default cache folder is 'node_modules/.cache/dependency-cruiser/'
|
|
425
431
|
*/
|
|
426
432
|
cache?: boolean | string | Partial<ICacheOptions>;
|
|
433
|
+
|
|
434
|
+
baseline?: {
|
|
435
|
+
/**
|
|
436
|
+
* How to update the baseline;
|
|
437
|
+
* 'full' - replaces all violations with the current set (the default behaviour)
|
|
438
|
+
* 'shrink-only' - keeps existing violations, removes fixed violations, but
|
|
439
|
+
* does not add new ones.
|
|
440
|
+
*/
|
|
441
|
+
mode?: BaselineModeType;
|
|
442
|
+
};
|
|
427
443
|
}
|
|
428
444
|
|
|
429
445
|
export interface IFormatOptions {
|
package/types/restrictions.d.mts
CHANGED
|
@@ -84,13 +84,13 @@ export interface IToRestriction extends IBaseRestrictionType {
|
|
|
84
84
|
* _only_ modules that don't satisfy this regular expression. E.g. to disallow all cycles,
|
|
85
85
|
* except when they go through one specific module. Typically to temporarily
|
|
86
86
|
* allow some cycles until they're removed.
|
|
87
|
-
* @deprecated use viaOnly.pathNot
|
|
87
|
+
* @deprecated use viaOnly.pathNot instead
|
|
88
88
|
*/
|
|
89
89
|
viaNot?: string | string[];
|
|
90
90
|
/**
|
|
91
91
|
* "For circular dependencies - whether or not to match cycles that include
|
|
92
92
|
* _some_ modules that don't satisfy this regular expression.
|
|
93
|
-
* @deprecated use via.pathNot
|
|
93
|
+
* @deprecated use via.pathNot instead
|
|
94
94
|
*/
|
|
95
95
|
viaSomeNot?: string | string[];
|
|
96
96
|
/**
|
package/types/shared-types.d.mts
CHANGED
|
@@ -3,26 +3,29 @@ export type ModuleSystemType = "cjs" | "amd" | "es6" | "tsd";
|
|
|
3
3
|
|
|
4
4
|
// cruise options, dependency-cruiser
|
|
5
5
|
export type OutputType =
|
|
6
|
-
| "
|
|
7
|
-
| "html"
|
|
8
|
-
| "dot"
|
|
9
|
-
| "cdot"
|
|
6
|
+
| "anon"
|
|
10
7
|
| "archi"
|
|
8
|
+
| "azure-devops"
|
|
9
|
+
| "baseline"
|
|
10
|
+
| "cdot"
|
|
11
|
+
| "csv"
|
|
12
|
+
| "d2"
|
|
11
13
|
| "ddot"
|
|
14
|
+
| "dot-webpage"
|
|
15
|
+
| "dot"
|
|
16
|
+
| "err-html"
|
|
17
|
+
| "err-long"
|
|
18
|
+
| "err"
|
|
12
19
|
| "fdot"
|
|
13
20
|
| "flat"
|
|
14
|
-
| "
|
|
15
|
-
| "
|
|
16
|
-
| "err-long"
|
|
17
|
-
| "err-html"
|
|
18
|
-
| "teamcity"
|
|
19
|
-
| "anon"
|
|
20
|
-
| "text"
|
|
21
|
-
| "metrics"
|
|
21
|
+
| "html"
|
|
22
|
+
| "json"
|
|
22
23
|
| "markdown"
|
|
23
24
|
| "mermaid"
|
|
24
|
-
| "
|
|
25
|
+
| "metrics"
|
|
25
26
|
| "null"
|
|
27
|
+
| "teamcity"
|
|
28
|
+
| "text"
|
|
26
29
|
// for plugins: string. TODO: research whether it's possible to
|
|
27
30
|
// tie this down to the `^plugin:[^:]+-reporter-plugin.[cm]?js$` regex
|
|
28
31
|
| (string & {}); // autocompletion hack
|