From a00d3a087cce423c98ffddb11f19d3154ab69bac Mon Sep 17 00:00:00 2001 From: Sander Verweij Date: Tue, 7 Jan 2025 01:56:53 +0100 Subject: [PATCH] feat: adds skipAnalysisNotInRules option (#979) ## Description - adds a `skipAnalysisNotInRules` option that, when switched to `true` skips all analyses not necessary for checking the current rule set. - Defaults the option to `false` for backwards compatibility of both cli and api. - Add this option with the value `true` to the --init template that scaffolds initial .dependency-cruiser.js configurations - Takes the new option into account in the cache-dirty check - Adds a paragraph in the options reference TODO: - [x] implement for cycle analysis - [x] implement for dependents analysis - [x] implement for orphan check For the _focus_, _metrics_ and _reachables_ analyses this was already in place by default ## Motivation and Context Addresses #978 ## How Has This Been Tested? - [x] green ci - [x] additional and updated automated non-regression tests ## Types of changes - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] Documentation only change - [ ] Refactor (non-breaking change which fixes an issue without changing functionality) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) --- .dependency-cruiser.mjs | 1 + doc/options-reference.md | 31 ++++- src/cache/options-compatible.mjs | 1 + src/cli/init-config/config-template.mjs | 10 ++ src/enrich/derive/circular.mjs | 47 +++++-- src/enrich/derive/dependents/index.mjs | 43 +++++- .../derive/folders/aggregate-to-folders.mjs | 10 +- src/enrich/derive/folders/index.mjs | 10 +- src/enrich/derive/orphan/index.mjs | 36 ++++- src/enrich/derive/reachable.mjs | 18 +-- src/enrich/enrich-modules.mjs | 15 ++- src/enrich/summarize/summarize-options.mjs | 1 + src/main/options/defaults.mjs | 1 + src/schema/configuration.schema.json | 7 +- src/schema/configuration.schema.mjs | 2 +- src/schema/cruise-result.schema.json | 4 +- src/schema/cruise-result.schema.mjs | 2 +- .../alternate-basedir/expected.json | 1 + .../__fixtures__/babel/babel-es6-result.json | 1 + .../__fixtures__/babel/babel-ts-result.json | 1 + test/cli/__fixtures__/cjs.dir.filtered.json | 1 + test/cli/__fixtures__/cjs.dir.json | 1 + test/cli/__fixtures__/cjs.dir.stdout.json | 3 +- test/cli/__fixtures__/cjs.file.json | 1 + test/cli/__fixtures__/dynamic-import-nok.json | 1 + test/cli/__fixtures__/dynamic-import-ok.json | 1 + test/cli/__fixtures__/empty.json | 1 + .../jsdoc-import-tags/expected.json | 1 + test/cli/__fixtures__/multiple-in-one-go.json | 1 + .../result-has-a-dependency-violation.json | 1 + .../typescript-path-resolution.json | 1 + .../webpack-config-alias-cruiser-config.json | 1 + .../__fixtures__/webpack-config-alias.json | 1 + .../expected.json | 1 + .../workspaces-mono-repo/expected.json | 1 + test/enrich/derive/circular.spec.mjs | 127 ++++++++++++++++++ .../derive/dependents/get-dependents.spec.mjs | 2 +- test/enrich/derive/dependents/index.spec.mjs | 108 +++++++++++++++ test/enrich/derive/orphan/index.spec.mjs | 75 ++++++++++- .../cruise-reporterless/metrics.json | 1 - test/main/__fixtures__/jsx-as-object.json | 15 ++- test/main/__fixtures__/jsx.json | 15 ++- test/main/__fixtures__/ts-no-precomp-cjs.json | 12 +- test/main/__fixtures__/ts-no-precomp-es.json | 12 +- test/main/__fixtures__/ts-precomp-cjs.json | 11 +- test/main/__fixtures__/ts-precomp-es.json | 11 +- test/main/__fixtures__/ts.json | 13 +- test/main/__fixtures__/tsx.json | 5 +- .../expected-result.json | 1 + .../__mocks__/dynamic-imports/es/output.json | 27 ++-- .../output-pre-compilation-deps.json | 27 ++-- .../dynamic-imports/typescript/output.json | 27 ++-- .../type-only-imports/output-with-rules.json | 1 + .../__mocks__/type-only-imports/output.json | 1 + .../output-no-ts.json | 1 + .../type-only-module-references/output.json | 5 +- test/main/main.cruise-reporterless.spec.mjs | 2 +- tools/schema/options-used.mjs | 3 + tools/schema/options.mjs | 16 +++ types/options.d.mts | 32 ++++- 60 files changed, 639 insertions(+), 170 deletions(-) create mode 100644 test/enrich/derive/circular.spec.mjs create mode 100644 test/enrich/derive/dependents/index.spec.mjs diff --git a/.dependency-cruiser.mjs b/.dependency-cruiser.mjs index 9244b7d34..6d6fcc7a0 100644 --- a/.dependency-cruiser.mjs +++ b/.dependency-cruiser.mjs @@ -437,6 +437,7 @@ export default { // parser: "tsc", // acorn, tsc detectJSDocImports: true, // implies parser: "tsc" experimentalStats: true, + skipAnalysisNotInRules: true, metrics: true, enhancedResolveOptions: { exportsFields: ["exports"], diff --git a/doc/options-reference.md b/doc/options-reference.md index b61582771..31b008585 100644 --- a/doc/options-reference.md +++ b/doc/options-reference.md @@ -36,6 +36,7 @@ - [enhancedResolveOptions](#enhancedresolveoptions) - [forceDeriveDependents](#forcederivedependents) - [experimentalStats](#experimentalstats) + - [skipAnalysisNotInRules](#skipanalysisnotinrules) - [parser](#parser) - [cache](#cache) - [progress](#progress) @@ -1668,9 +1669,17 @@ The cacheDuration used here overrides any that might be set in webpack configs. ### `forceDeriveDependents` -Dependency-cruiser will automatically determine whether it needs to derive dependents. -However, if you want to force them to be derived, you can switch this variable -to `true`. +> [!WARNING] +> Deprecated. This optiton hasnt had any effect on dependency-cruiser's behaviour +> since a few major versions. I there's a need to maniuplate whether or not +> dependendents get derived independent of any rule (/ metric/ report) needing +> them use the [`skipAnalysisNotInRules`](#skipanalysisnotinrules) option as +> documented below. +> +> #### Previously documented behaviour +>> Dependency-cruiser will automatically determine whether it needs to derive dependents. +>> However, if you want to force them to be derived, you can switch this variable +>> to `true`. ### `experimentalStats` @@ -1679,6 +1688,22 @@ in the result for each module. This feature is not yet used by any of the reporters dependency-cruiser ships with. The feature is also _experimental_ which means it might disappear or change in the future. +### `skipAnalysisNotInRules` + +When this flag is set to `true`, dependency-cruiser will skip all analysis that +don't serve a rule. E.g. if there's no 'circular' rule in the rule set it won't +analyse cycles. This flag affects cycle, dependents and orphan analysis. If you +have a rule set that doesn't use one of these features, switching it to true +will make cruises faster. + +Dependency-cruiser skips other analyses (reachable, folder, metrics, focus) +automatically when they're not needed, without the need to set this flag. + +Defaults to `false` for backwards compatibility. However, we recommend to switch +this option to `true`, unless you have a specific use case (i.e. use the json +output for further analysis, using the API). + + ### `parser` With this _EXPERIMENTAL_ feature you can specify which parser you want to use diff --git a/src/cache/options-compatible.mjs b/src/cache/options-compatible.mjs index e7729a340..4a72310ba 100644 --- a/src/cache/options-compatible.mjs +++ b/src/cache/options-compatible.mjs @@ -106,6 +106,7 @@ export function optionsAreCompatible(pOldOptions, pNewOptions) { pOldOptions.combinedDependencies === pNewOptions.combinedDependencies && pOldOptions.experimentalStats === pNewOptions.experimentalStats && pOldOptions.detectJSDocImports === pNewOptions.detectJSDocImports && + pOldOptions.skipAnalysisNotInRules === pNewOptions.skipAnalysisNotInRules && metricsIsCompatible(pOldOptions.metrics, pNewOptions.metrics) && // includeOnly suffers from a backwards compatibility disease includeOnlyIsCompatible(pOldOptions.includeOnly, pNewOptions.includeOnly) && diff --git a/src/cli/init-config/config-template.mjs b/src/cli/init-config/config-template.mjs index befe155e9..67ede9dd6 100644 --- a/src/cli/init-config/config-template.mjs +++ b/src/cli/init-config/config-template.mjs @@ -334,6 +334,16 @@ module.exports = { */ // aliasFields: ["browser"], }, + + /* + skipAnalysisNotInRules will make dependency-cruiser execute + analysis strictly necessary for checking the rule set only. + + See https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#skipanalysisnotinrules + for details + */ + skipAnalysisNotInRules: true, + reporterOptions: { dot: { /* pattern of modules that can be consolidated in the detailed diff --git a/src/enrich/derive/circular.mjs b/src/enrich/derive/circular.mjs index 0e444c4d9..f2e59d4b2 100644 --- a/src/enrich/derive/circular.mjs +++ b/src/enrich/derive/circular.mjs @@ -1,5 +1,25 @@ /* eslint-disable security/detect-object-injection */ +/** @import { IFlattenedRuleSet } from "../../../types/rule-set.mjs" */ + +function isCycleRule(pRule) { + return ( + /* c8 ignore start */ + Object.hasOwn(pRule?.to ?? {}, "circular") + /* c8 ignore stop */ + ); +} +/** + * @param {IFlattenedRuleSet} pRuleSet + * @returns {boolean} + */ +export function hasCycleRule(pRuleSet) { + return ( + (pRuleSet?.forbidden ?? []).some(isCycleRule) || + (pRuleSet?.allowed ?? []).some(isCycleRule) + ); +} + function addCircularityCheckToDependency( pIndexedGraph, pFrom, @@ -31,17 +51,26 @@ function addCircularityCheckToDependency( export default function detectAndAddCycles( pNodes, pIndexedNodes, - { pSourceAttribute, pDependencyName }, + { pSourceAttribute, pDependencyName, pSkipAnalysisNotInRules, pRuleSet }, ) { + if (!pSkipAnalysisNotInRules || hasCycleRule(pRuleSet)) { + return pNodes.map((pModule) => ({ + ...pModule, + dependencies: pModule.dependencies.map((pToDep) => + addCircularityCheckToDependency( + pIndexedNodes, + pModule[pSourceAttribute], + pToDep, + pDependencyName, + ), + ), + })); + } return pNodes.map((pModule) => ({ ...pModule, - dependencies: pModule.dependencies.map((pToDep) => - addCircularityCheckToDependency( - pIndexedNodes, - pModule[pSourceAttribute], - pToDep, - pDependencyName, - ), - ), + dependencies: pModule.dependencies.map((pToDep) => ({ + ...pToDep, + circular: false, + })), })); } diff --git a/src/enrich/derive/dependents/index.mjs b/src/enrich/derive/dependents/index.mjs index 2677cf09b..6ba12cea5 100644 --- a/src/enrich/derive/dependents/index.mjs +++ b/src/enrich/derive/dependents/index.mjs @@ -1,8 +1,41 @@ import getDependents from "./get-dependents.mjs"; -export default function addDependents(pModules) { - return pModules.map((pModule) => ({ - ...pModule, - dependents: getDependents(pModule, pModules), - })); +/** @import { IFlattenedRuleSet } from "../../../../types/rule-set.mjs" */ + +function isDependentsRule(pRule) { + // used in folder rules and when moreUnstable is in the 'to' => governed by + // the 'metrics' flag in options, sot not going to repeat that here + + // dependents are used in the orphans analsys. hHwever, there is a fall back + // where it does its own analysis, so not going to repeat that check here. + return ( + /* c8 ignore start */ + Object.hasOwn(pRule?.module ?? {}, "numberOfDependentsLessThan") || + Object.hasOwn(pRule?.module ?? {}, "numberOfDependentsMoreThan") + /* c8 ignore stop */ + ); +} + +/** + * @param {IFlattenedRuleSet} pRuleSet + * @returns {boolean} + */ +export function hasDependentsRule(pRuleSet) { + return ( + (pRuleSet?.forbidden ?? []).some(isDependentsRule) || + (pRuleSet?.allowed ?? []).some(isDependentsRule) + ); +} + +export default function addDependents( + pModules, + { skipAnalysisNotInRules, metrics, ruleSet }, +) { + if (!skipAnalysisNotInRules || metrics || hasDependentsRule(ruleSet)) { + return pModules.map((pModule) => ({ + ...pModule, + dependents: getDependents(pModule, pModules), + })); + } + return pModules; } diff --git a/src/enrich/derive/folders/aggregate-to-folders.mjs b/src/enrich/derive/folders/aggregate-to-folders.mjs index fc526ba13..9bf2ed3e9 100644 --- a/src/enrich/derive/folders/aggregate-to-folders.mjs +++ b/src/enrich/derive/folders/aggregate-to-folders.mjs @@ -134,7 +134,13 @@ function getSinks(pFolders) { return lReturnValue; } -export default function aggregateToFolders(pModules) { +/** + * + * @param {import("../../../../types/cruise-result.d.mts").IModule} pModules + * @param {import("../../../../types/cruise-result.d.mts").IOptions} pOptions + * @returns + */ +export default function aggregateToFolders(pModules, pOptions = {}) { let lFolders = object2Array( pModules.filter(metricsAreCalculable).reduce(aggregateToFolder, {}), ) @@ -145,5 +151,7 @@ export default function aggregateToFolders(pModules) { return detectCycles(lFolders, new IndexedModuleGraph(lFolders, "name"), { pSourceAttribute: "name", pDependencyName: "name", + pSkipAnalysisNotInRules: pOptions.skipAnalysisNotInRules, + pRuleSet: pOptions.ruleSet, }); } diff --git a/src/enrich/derive/folders/index.mjs b/src/enrich/derive/folders/index.mjs index b8c307db7..da97099e9 100644 --- a/src/enrich/derive/folders/index.mjs +++ b/src/enrich/derive/folders/index.mjs @@ -2,8 +2,8 @@ import aggregateToFolders from "./aggregate-to-folders.mjs"; import { validateFolder } from "#validate/index.mjs"; /** - * @param {import("../../../../types/dependency-cruiser.js").IFolder} pFolder - * @param {import('../../../../types/dependency-cruiser.js').IOptions} pOptions + * @param {import("../../../../types/dependency-cruiser.mjs").IFolder} pFolder + * @param {import('../../../../types/dependency-cruiser.mjs').IOptions} pOptions * @returns */ function validateFolderDependency(pFolder, pOptions) { @@ -25,15 +25,15 @@ function addFolderDependencyViolations(pOptions) { /** * - * @param {import('../../../../types/dependency-cruiser.js').IModule[]} pModules - * @param {import('../../../../types/dependency-cruiser.js').IOptions} pOptions + * @param {import('../../../../types/dependency-cruiser.mjs').IModule[]} pModules + * @param {import('../../../../types/dependency-cruiser.mjs').IOptions} pOptions * @returns {any} */ export default function deriveFolderMetrics(pModules, pOptions) { let lReturnValue = {}; if (pOptions.metrics) { lReturnValue = { - folders: aggregateToFolders(pModules).map( + folders: aggregateToFolders(pModules, pOptions).map( addFolderDependencyViolations(pOptions), ), }; diff --git a/src/enrich/derive/orphan/index.mjs b/src/enrich/derive/orphan/index.mjs index 08f4d251f..c1095f606 100644 --- a/src/enrich/derive/orphan/index.mjs +++ b/src/enrich/derive/orphan/index.mjs @@ -1,8 +1,34 @@ import isOrphan from "./is-orphan.mjs"; -export default function deriveOrphans(pModules) { - return pModules.map((pModule) => ({ - ...pModule, - orphan: isOrphan(pModule, pModules), - })); +/** @import { IFlattenedRuleSet } from "../../../../types/rule-set.mjs" */ + +function isOrphanRule(pRule) { + return ( + /* c8 ignore start */ + Object.hasOwn(pRule?.from ?? {}, "orphan") + /* c8 ignore stop */ + ); +} +/** + * @param {IFlattenedRuleSet} pRuleSet + * @returns {boolean} + */ +export function hasOrphanRule(pRuleSet) { + return ( + (pRuleSet?.forbidden ?? []).some(isOrphanRule) || + (pRuleSet?.allowed ?? []).some(isOrphanRule) + ); +} + +export default function deriveOrphans( + pModules, + { skipAnalysisNotInRules, ruleSet }, +) { + if (!skipAnalysisNotInRules || hasOrphanRule(ruleSet)) { + return pModules.map((pModule) => ({ + ...pModule, + orphan: isOrphan(pModule, pModules), + })); + } + return pModules; } diff --git a/src/enrich/derive/reachable.mjs b/src/enrich/derive/reachable.mjs index 95b8d9118..a384cdcb0 100644 --- a/src/enrich/derive/reachable.mjs +++ b/src/enrich/derive/reachable.mjs @@ -6,19 +6,15 @@ import { import IndexedModuleGraph from "#graph-utl/indexed-module-graph.mjs"; import { extractGroups } from "#utl/regex-util.mjs"; +function isReachableRule(pRule) { + return Object.hasOwn(pRule?.to ?? {}, "reachable"); +} + function getReachableRules(pRuleSet) { return (pRuleSet?.forbidden ?? []) - .filter((pRule) => Object.hasOwn(pRule?.to ?? {}, "reachable")) - .concat( - (pRuleSet?.allowed ?? []).filter((pRule) => - Object.hasOwn(pRule?.to ?? {}, "reachable"), - ), - ) - .concat( - (pRuleSet?.required ?? []).filter((pRule) => - Object.hasOwn(pRule?.to ?? {}, "reachable"), - ), - ); + .filter(isReachableRule) + .concat((pRuleSet?.allowed ?? []).filter(isReachableRule)) + .concat((pRuleSet?.required ?? []).filter(isReachableRule)); } function isModuleInRuleFrom(pRule) { diff --git a/src/enrich/enrich-modules.mjs b/src/enrich/enrich-modules.mjs index 2af17a794..730fc61c1 100644 --- a/src/enrich/enrich-modules.mjs +++ b/src/enrich/enrich-modules.mjs @@ -9,22 +9,31 @@ import IndexedModuleGraph from "#graph-utl/indexed-module-graph.mjs"; import addFocus from "#graph-utl/add-focus.mjs"; import { bus } from "#utl/bus.mjs"; +/** @import { IModule, IOptions } from "../../types/dependency-cruiser.mjs" */ + +/** + * @param {IModule[]} pModules + * @param {IOptions} pOptions + * @returns {IModule[]} + */ export default function enrichModules(pModules, pOptions) { bus.info("analyzing: cycles"); const lIndexedModules = new IndexedModuleGraph(pModules); let lModules = deriveCycles(pModules, lIndexedModules, { pSourceAttribute: "source", pDependencyName: "resolved", + pSkipAnalysisNotInRules: pOptions.skipAnalysisNotInRules, + pRuleSet: pOptions.ruleSet, }); bus.info("analyzing: dependents"); - lModules = addDependents(lModules); + lModules = addDependents(lModules, pOptions); bus.info("analyzing: orphans"); - lModules = deriveOrphans(lModules); + lModules = deriveOrphans(lModules, pOptions); bus.info("analyzing: reachables"); lModules = deriveReachable(lModules, pOptions.ruleSet); bus.info("analyzing: module metrics"); lModules = deriveModuleMetrics(lModules, pOptions); - bus.info("analyzing: add focus (if any)"); + bus.info("analyzing: focus"); lModules = addFocus(lModules, pOptions.focus); // when validate === false we might want to skip the addValidations. diff --git a/src/enrich/summarize/summarize-options.mjs b/src/enrich/summarize/summarize-options.mjs index 5e1f61c47..3e3a7fd51 100644 --- a/src/enrich/summarize/summarize-options.mjs +++ b/src/enrich/summarize/summarize-options.mjs @@ -27,6 +27,7 @@ const SHAREABLE_OPTIONS = [ "reaches", "reporterOptions", "rulesFile", + "skipAnalysisNotInRules", "tsConfig", "tsPreCompilationDeps", "webpackConfig", diff --git a/src/main/options/defaults.mjs b/src/main/options/defaults.mjs index a8db34855..dd6dfc71d 100644 --- a/src/main/options/defaults.mjs +++ b/src/main/options/defaults.mjs @@ -4,6 +4,7 @@ export default { maxDepth: 0, moduleSystems: ["es6", "cjs", "tsd", "amd"], detectJSDocImports: false, + skipAnalysisNotInRules: false, tsPreCompilationDeps: false, preserveSymlinks: false, combinedDependencies: false, diff --git a/src/schema/configuration.schema.json b/src/schema/configuration.schema.json index 39d4b92cc..cab4ed2d6 100644 --- a/src/schema/configuration.schema.json +++ b/src/schema/configuration.schema.json @@ -602,7 +602,8 @@ }, "forceDeriveDependents": { "type": "boolean", - "description": "When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false." + "deprecated": true, + "description": "Hasn't had any effect on dependency-cruiser's behaviour since a few major versions ago. If there's a need to manipulate this use the `skipAnalysisNotInRules` option in stead.Previously documented behaviour: When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false." }, "webpackConfig": { "type": "object", @@ -718,6 +719,10 @@ "type": "boolean", "description": "When this flag is set to true, dependency-cruiser will calculate some stats for each module. Has some performance impact. EXPERIMENTAL Will be renamed when the 'experimental' state is lifted. Defaults to false." }, + "skipAnalysisNotInRules": { + "type": "boolean", + "description": "When this flag is set to true, dependency-cruiser will skip all analysis that don't serve a rule. E.g. if there's no 'circular' rule in the rule set it won't analyse cycles. This flag affects cycle, dependents and orphan analysis. If you have a rule set that doesn't use one of these features, switching it to true will make cruises faster. Defaults to false for backwards compatibility. For most uses of dependency-cruiser we recommend to switch this option to true, though." + }, "baseDir": { "type": "string", "description": "The directory dependency-cruiser should run its cruise from. Defaults to the current working directory." diff --git a/src/schema/configuration.schema.mjs b/src/schema/configuration.schema.mjs index c75100254..06a8f738c 100644 --- a/src/schema/configuration.schema.mjs +++ b/src/schema/configuration.schema.mjs @@ -1 +1 @@ -/* generated - don't edit */export default{title:"dependency-cruiser configuration",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/configuration.schema.json",type:"object",additionalProperties:false,properties:{$schema:{type:"string"},forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}},options:{$ref:"#/definitions/OptionsType"},extends:{$ref:"#/definitions/ExtendsType"}},definitions:{RuleSetType:{type:"object",additionalProperties:false,properties:{forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}}}},AllowedRuleType:{oneOf:[{$ref:"#/definitions/RegularAllowedRuleType"},{$ref:"#/definitions/ReachabilityAllowedRuleType"}]},RegularAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},ReachabilityAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},ForbiddenRuleType:{oneOf:[{$ref:"#/definitions/RegularForbiddenRuleType"},{$ref:"#/definitions/ReachabilityForbiddenRuleType"},{$ref:"#/definitions/DependentsForbiddenRuleType"}]},RegularForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},DependentsForbiddenRuleType:{type:"object",required:["module","from"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/DependentsModuleRestrictionType"},from:{$ref:"#/definitions/DependentsFromRestrictionType"}}},ReachabilityForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},RequiredRuleType:{type:"object",required:["module","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/RequiredModuleRestrictionType"},to:{$ref:"#/definitions/RequiredToRestrictionType"}}},MiniDependencyRestrictionType:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}}]},FromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},orphan:{type:"boolean"}}},ReachabilityFromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ToRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},couldNotResolve:{type:"boolean"},circular:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{$ref:"#/definitions/REAsStringsType"},exoticRequireNot:{$ref:"#/definitions/REAsStringsType"},preCompilationOnly:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},moreThanOneDependencyType:{type:"boolean"},license:{$ref:"#/definitions/REAsStringsType"},licenseNot:{$ref:"#/definitions/REAsStringsType"},via:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaOnly:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},viaSomeNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},moreUnstable:{type:"boolean"}}},DependentsModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},numberOfDependentsLessThan:{type:"integer",minimum:0,maximum:100},numberOfDependentsMoreThan:{type:"integer",minimum:0,maximum:100}}},DependentsFromRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ReachabilityToRestrictionType:{required:["reachable"],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},RequiredModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},RequiredToRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},DependencyTypeType:{type:"string",enum:["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","jsdoc","jsdoc-bracket-import","jsdoc-import-tag","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]},REAsStringsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},OptionsType:{type:"object",additionalProperties:false,properties:{doNotFollow:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundDoNotFollowType"}]},exclude:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundExcludeType"}]},includeOnly:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundIncludeOnlyType"}]},focus:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundFocusType"}]},reaches:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundReachesType"}]},affected:{oneOf:[{type:"string"},{type:"boolean"}]},highlight:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundHighlightType"}]},knownViolations:{$ref:"#/definitions/ViolationsType"},collapse:{oneOf:[{type:"string"},{type:"integer",minimum:1,maximum:9}]},maxDepth:{type:"integer",minimum:0,maximum:99},moduleSystems:{$ref:"#/definitions/ModuleSystemsType"},detectJSDocImports:{type:"boolean"},prefix:{type:"string"},preserveSymlinks:{type:"boolean"},combinedDependencies:{type:"boolean"},tsConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},tsPreCompilationDeps:{oneOf:[{type:"boolean"},{type:"string",enum:["specify"]}]},extraExtensionsToScan:{type:"array",items:{type:"string"}},externalModuleResolutionStrategy:{type:"string",enum:["node_modules","yarn-pnp"]},builtInModules:{type:"object",additionalProperties:false,properties:{override:{type:"array",items:{type:"string"}},add:{type:"array",items:{type:"string"}}}},forceDeriveDependents:{type:"boolean"},webpackConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"},env:{oneOf:[{type:"object"},{type:"string"}]},arguments:{type:"object"}}},enhancedResolveOptions:{type:"object",additionalProperties:false,properties:{exportsFields:{type:"array",items:{type:"string"}},conditionNames:{type:"array",items:{type:"string"}},extensions:{type:"array",items:{type:"string"}},mainFields:{type:"array",items:{type:"string"}},mainFiles:{type:"array"},aliasFields:{type:"array",items:{type:"string"}},cachedInputFileSystem:{type:"object",additionalProperties:false,properties:{cacheDuration:{type:"integer",minimum:0,maximum:1800000}}}}},babelConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},parser:{type:"string",enum:["acorn","tsc","swc"]},exoticRequireStrings:{type:"array",items:{type:"string"}},reporterOptions:{$ref:"#/definitions/ReporterOptionsType"},progress:{type:"object",additionalProperties:false,properties:{type:{type:"string",enum:["cli-feedback","performance-log","ndjson","none"]},maximumLevel:{type:"number",enum:[-1,40,50,60,70,80,99]}}},metrics:{type:"boolean"},experimentalStats:{type:"boolean"},baseDir:{type:"string"},cache:{oneOf:[{type:"boolean"},{deprecated:true,type:"string"},{$ref:"#/definitions/CacheOptionsType"}]}}},ModuleSystemType:{type:"string",enum:["cjs","es6","amd","tsd"]},ModuleSystemsType:{type:"array",items:{$ref:"#/definitions/ModuleSystemType"}},CompoundExcludeType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dynamic:{type:"boolean"}}},CompoundDoNotFollowType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CompoundIncludeOnlyType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundFocusType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},depth:{type:"number",minimum:1,maximum:4}}},CompoundReachesType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundHighlightType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},ReporterOptionsType:{type:"object",additionalProperties:false,properties:{anon:{$ref:"#/definitions/AnonReporterOptionsType"},archi:{$ref:"#/definitions/DotReporterOptionsType"},dot:{$ref:"#/definitions/DotReporterOptionsType"},ddot:{$ref:"#/definitions/DotReporterOptionsType"},flat:{$ref:"#/definitions/DotReporterOptionsType"},markdown:{$ref:"#/definitions/MarkdownReporterOptionsType"},metrics:{$ref:"#/definitions/MetricsReporterOptionsType"},mermaid:{$ref:"#/definitions/MermaidReporterOptionsType"},text:{$ref:"#/definitions/TextReporterOptionsType"}}},AnonReporterOptionsType:{type:"object",additionalProperties:false,properties:{wordlist:{type:"array",items:{type:"string"}}}},MetricsReporterOptionsType:{type:"object",additionalProperties:false,properties:{orderBy:{type:"string",enum:["instability","moduleCount","afferentCouplings","efferentCouplings","name","size","topLevelStatementCount"]},hideModules:{type:"boolean"},hideFolders:{type:"boolean"}}},MarkdownReporterOptionsType:{type:"object",additionalProperties:false,properties:{showTitle:{type:"boolean"},title:{type:"string"},showSummary:{type:"boolean"},showSummaryHeader:{type:"boolean"},summaryHeader:{type:"string"},showStatsSummary:{type:"boolean"},showRulesSummary:{type:"boolean"},includeIgnoredInSummary:{type:"boolean"},showDetails:{type:"boolean"},includeIgnoredInDetails:{type:"boolean"},showDetailsHeader:{type:"boolean"},detailsHeader:{type:"string"},collapseDetails:{type:"boolean"},collapsedMessage:{type:"string"},noViolationsMessage:{type:"string"},showFooter:{type:"boolean"}}},MermaidReporterOptionsType:{type:"object",additionalProperties:false,properties:{minify:{type:"boolean"}}},TextReporterOptionsType:{type:"object",additionalProperties:false,properties:{highlightFocused:{type:"boolean"}}},DotReporterOptionsType:{type:"object",additionalProperties:false,properties:{collapsePattern:{$ref:"#/definitions/REAsStringsType"},filters:{$ref:"#/definitions/ReporterFiltersType"},showMetrics:{type:"boolean"},theme:{$ref:"#/definitions/DotThemeType"}}},DotThemeType:{type:"object",additionalProperties:false,properties:{replace:{type:"boolean"},graph:{type:"object"},node:{type:"object"},edge:{type:"object"},modules:{$ref:"#/definitions/DotThemeArrayType"},dependencies:{$ref:"#/definitions/DotThemeArrayType"}}},DotThemeArrayType:{type:"array",items:{$ref:"#/definitions/DotThemeEntryType"}},DotThemeEntryType:{type:"object",additionalProperties:false,properties:{criteria:{type:"object"},attributes:{type:"object"}}},ReporterFiltersType:{type:"object",additionalProperties:false,properties:{exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{$ref:"#/definitions/CompoundIncludeOnlyType"},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"}}},ViolationsType:{type:"array",items:{$ref:"#/definitions/ViolationType"}},ViolationType:{type:"object",required:["from","to","rule"],additionalProperties:false,properties:{from:{type:"string"},to:{type:"string"},type:{$ref:"#/definitions/ViolationTypeType"},rule:{$ref:"#/definitions/RuleSummaryType"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},metrics:{type:"object",required:["from","to"],additionalProperties:false,properties:{from:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}},to:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}}}},comment:{type:"string"}}},RuleSummaryType:{type:"object",required:["name","severity"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"}}},ViolationTypeType:{type:"string",enum:["dependency","module","reachability","cycle","instability","folder"]},MiniDependency:{type:"object",required:["name","dependencyTypes"],additionalProperties:false,properties:{name:{type:"string"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CacheOptionsType:{type:"object",additionalProperties:false,properties:{folder:{type:"string"},strategy:{$ref:"#/definitions/CacheStrategyType"},compress:{type:"boolean",default:false}}},CacheStrategyType:{type:"string",enum:["metadata","content"]},ExtendsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}}; \ No newline at end of file +/* generated - don't edit */export default{title:"dependency-cruiser configuration",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/configuration.schema.json",type:"object",additionalProperties:false,properties:{$schema:{type:"string"},forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}},options:{$ref:"#/definitions/OptionsType"},extends:{$ref:"#/definitions/ExtendsType"}},definitions:{RuleSetType:{type:"object",additionalProperties:false,properties:{forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}}}},AllowedRuleType:{oneOf:[{$ref:"#/definitions/RegularAllowedRuleType"},{$ref:"#/definitions/ReachabilityAllowedRuleType"}]},RegularAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},ReachabilityAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},ForbiddenRuleType:{oneOf:[{$ref:"#/definitions/RegularForbiddenRuleType"},{$ref:"#/definitions/ReachabilityForbiddenRuleType"},{$ref:"#/definitions/DependentsForbiddenRuleType"}]},RegularForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},DependentsForbiddenRuleType:{type:"object",required:["module","from"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/DependentsModuleRestrictionType"},from:{$ref:"#/definitions/DependentsFromRestrictionType"}}},ReachabilityForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},RequiredRuleType:{type:"object",required:["module","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/RequiredModuleRestrictionType"},to:{$ref:"#/definitions/RequiredToRestrictionType"}}},MiniDependencyRestrictionType:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}}]},FromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},orphan:{type:"boolean"}}},ReachabilityFromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ToRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},couldNotResolve:{type:"boolean"},circular:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{$ref:"#/definitions/REAsStringsType"},exoticRequireNot:{$ref:"#/definitions/REAsStringsType"},preCompilationOnly:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},moreThanOneDependencyType:{type:"boolean"},license:{$ref:"#/definitions/REAsStringsType"},licenseNot:{$ref:"#/definitions/REAsStringsType"},via:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaOnly:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},viaSomeNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},moreUnstable:{type:"boolean"}}},DependentsModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},numberOfDependentsLessThan:{type:"integer",minimum:0,maximum:100},numberOfDependentsMoreThan:{type:"integer",minimum:0,maximum:100}}},DependentsFromRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ReachabilityToRestrictionType:{required:["reachable"],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},RequiredModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},RequiredToRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},DependencyTypeType:{type:"string",enum:["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","jsdoc","jsdoc-bracket-import","jsdoc-import-tag","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]},REAsStringsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},OptionsType:{type:"object",additionalProperties:false,properties:{doNotFollow:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundDoNotFollowType"}]},exclude:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundExcludeType"}]},includeOnly:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundIncludeOnlyType"}]},focus:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundFocusType"}]},reaches:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundReachesType"}]},affected:{oneOf:[{type:"string"},{type:"boolean"}]},highlight:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundHighlightType"}]},knownViolations:{$ref:"#/definitions/ViolationsType"},collapse:{oneOf:[{type:"string"},{type:"integer",minimum:1,maximum:9}]},maxDepth:{type:"integer",minimum:0,maximum:99},moduleSystems:{$ref:"#/definitions/ModuleSystemsType"},detectJSDocImports:{type:"boolean"},prefix:{type:"string"},preserveSymlinks:{type:"boolean"},combinedDependencies:{type:"boolean"},tsConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},tsPreCompilationDeps:{oneOf:[{type:"boolean"},{type:"string",enum:["specify"]}]},extraExtensionsToScan:{type:"array",items:{type:"string"}},externalModuleResolutionStrategy:{type:"string",enum:["node_modules","yarn-pnp"]},builtInModules:{type:"object",additionalProperties:false,properties:{override:{type:"array",items:{type:"string"}},add:{type:"array",items:{type:"string"}}}},forceDeriveDependents:{type:"boolean",deprecated:true},webpackConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"},env:{oneOf:[{type:"object"},{type:"string"}]},arguments:{type:"object"}}},enhancedResolveOptions:{type:"object",additionalProperties:false,properties:{exportsFields:{type:"array",items:{type:"string"}},conditionNames:{type:"array",items:{type:"string"}},extensions:{type:"array",items:{type:"string"}},mainFields:{type:"array",items:{type:"string"}},mainFiles:{type:"array"},aliasFields:{type:"array",items:{type:"string"}},cachedInputFileSystem:{type:"object",additionalProperties:false,properties:{cacheDuration:{type:"integer",minimum:0,maximum:1800000}}}}},babelConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},parser:{type:"string",enum:["acorn","tsc","swc"]},exoticRequireStrings:{type:"array",items:{type:"string"}},reporterOptions:{$ref:"#/definitions/ReporterOptionsType"},progress:{type:"object",additionalProperties:false,properties:{type:{type:"string",enum:["cli-feedback","performance-log","ndjson","none"]},maximumLevel:{type:"number",enum:[-1,40,50,60,70,80,99]}}},metrics:{type:"boolean"},experimentalStats:{type:"boolean"},skipAnalysisNotInRules:{type:"boolean"},baseDir:{type:"string"},cache:{oneOf:[{type:"boolean"},{deprecated:true,type:"string"},{$ref:"#/definitions/CacheOptionsType"}]}}},ModuleSystemType:{type:"string",enum:["cjs","es6","amd","tsd"]},ModuleSystemsType:{type:"array",items:{$ref:"#/definitions/ModuleSystemType"}},CompoundExcludeType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dynamic:{type:"boolean"}}},CompoundDoNotFollowType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CompoundIncludeOnlyType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundFocusType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},depth:{type:"number",minimum:1,maximum:4}}},CompoundReachesType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundHighlightType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},ReporterOptionsType:{type:"object",additionalProperties:false,properties:{anon:{$ref:"#/definitions/AnonReporterOptionsType"},archi:{$ref:"#/definitions/DotReporterOptionsType"},dot:{$ref:"#/definitions/DotReporterOptionsType"},ddot:{$ref:"#/definitions/DotReporterOptionsType"},flat:{$ref:"#/definitions/DotReporterOptionsType"},markdown:{$ref:"#/definitions/MarkdownReporterOptionsType"},metrics:{$ref:"#/definitions/MetricsReporterOptionsType"},mermaid:{$ref:"#/definitions/MermaidReporterOptionsType"},text:{$ref:"#/definitions/TextReporterOptionsType"}}},AnonReporterOptionsType:{type:"object",additionalProperties:false,properties:{wordlist:{type:"array",items:{type:"string"}}}},MetricsReporterOptionsType:{type:"object",additionalProperties:false,properties:{orderBy:{type:"string",enum:["instability","moduleCount","afferentCouplings","efferentCouplings","name","size","topLevelStatementCount"]},hideModules:{type:"boolean"},hideFolders:{type:"boolean"}}},MarkdownReporterOptionsType:{type:"object",additionalProperties:false,properties:{showTitle:{type:"boolean"},title:{type:"string"},showSummary:{type:"boolean"},showSummaryHeader:{type:"boolean"},summaryHeader:{type:"string"},showStatsSummary:{type:"boolean"},showRulesSummary:{type:"boolean"},includeIgnoredInSummary:{type:"boolean"},showDetails:{type:"boolean"},includeIgnoredInDetails:{type:"boolean"},showDetailsHeader:{type:"boolean"},detailsHeader:{type:"string"},collapseDetails:{type:"boolean"},collapsedMessage:{type:"string"},noViolationsMessage:{type:"string"},showFooter:{type:"boolean"}}},MermaidReporterOptionsType:{type:"object",additionalProperties:false,properties:{minify:{type:"boolean"}}},TextReporterOptionsType:{type:"object",additionalProperties:false,properties:{highlightFocused:{type:"boolean"}}},DotReporterOptionsType:{type:"object",additionalProperties:false,properties:{collapsePattern:{$ref:"#/definitions/REAsStringsType"},filters:{$ref:"#/definitions/ReporterFiltersType"},showMetrics:{type:"boolean"},theme:{$ref:"#/definitions/DotThemeType"}}},DotThemeType:{type:"object",additionalProperties:false,properties:{replace:{type:"boolean"},graph:{type:"object"},node:{type:"object"},edge:{type:"object"},modules:{$ref:"#/definitions/DotThemeArrayType"},dependencies:{$ref:"#/definitions/DotThemeArrayType"}}},DotThemeArrayType:{type:"array",items:{$ref:"#/definitions/DotThemeEntryType"}},DotThemeEntryType:{type:"object",additionalProperties:false,properties:{criteria:{type:"object"},attributes:{type:"object"}}},ReporterFiltersType:{type:"object",additionalProperties:false,properties:{exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{$ref:"#/definitions/CompoundIncludeOnlyType"},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"}}},ViolationsType:{type:"array",items:{$ref:"#/definitions/ViolationType"}},ViolationType:{type:"object",required:["from","to","rule"],additionalProperties:false,properties:{from:{type:"string"},to:{type:"string"},type:{$ref:"#/definitions/ViolationTypeType"},rule:{$ref:"#/definitions/RuleSummaryType"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},metrics:{type:"object",required:["from","to"],additionalProperties:false,properties:{from:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}},to:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}}}},comment:{type:"string"}}},RuleSummaryType:{type:"object",required:["name","severity"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"}}},ViolationTypeType:{type:"string",enum:["dependency","module","reachability","cycle","instability","folder"]},MiniDependency:{type:"object",required:["name","dependencyTypes"],additionalProperties:false,properties:{name:{type:"string"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CacheOptionsType:{type:"object",additionalProperties:false,properties:{folder:{type:"string"},strategy:{$ref:"#/definitions/CacheStrategyType"},compress:{type:"boolean",default:false}}},CacheStrategyType:{type:"string",enum:["metadata","content"]},ExtendsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]}}}; \ No newline at end of file diff --git a/src/schema/cruise-result.schema.json b/src/schema/cruise-result.schema.json index 0cc27c1e5..50039e3d1 100644 --- a/src/schema/cruise-result.schema.json +++ b/src/schema/cruise-result.schema.json @@ -1034,7 +1034,8 @@ }, "forceDeriveDependents": { "type": "boolean", - "description": "When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false." + "deprecated": true, + "description": "Hasn't had any effect on dependency-cruiser's behaviour since a few major versions ago. If there's a need to manipulate this use the `skipAnalysisNotInRules` option in stead.Previously documented behaviour: When true includes de-normalized dependents in the cruise-result, even though there's no rule in the rule set that requires them. Defaults to false." }, "webpackConfig": { "type": "object", @@ -1147,6 +1148,7 @@ "description": "When this flag is set to true, dependency-cruiser will calculate (stability) metrics for all modules and folders. Defaults to false." }, "experimentalStats": { "type": "boolean" }, + "skipAnalysisNotInRules": { "type": "boolean" }, "baseDir": { "type": "string", "description": "The directory dependency-cruiser should run its cruise from. Defaults to the current working directory." diff --git a/src/schema/cruise-result.schema.mjs b/src/schema/cruise-result.schema.mjs index 32b907101..68309e3a5 100644 --- a/src/schema/cruise-result.schema.mjs +++ b/src/schema/cruise-result.schema.mjs @@ -1 +1 @@ -/* generated - don't edit */export default{title:"dependency-cruiser output format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/cruise-result.schema.json",type:"object",required:["summary","modules"],additionalProperties:false,properties:{modules:{$ref:"#/definitions/ModulesType"},folders:{$ref:"#/definitions/FoldersType"},summary:{$ref:"#/definitions/SummaryType"},revisionData:{$ref:"#/definitions/RevisionDataType"}},definitions:{ModulesType:{type:"array",items:{$ref:"#/definitions/ModuleType"}},ModuleType:{type:"object",required:["source","dependencies","valid"],additionalProperties:false,properties:{source:{type:"string"},valid:{type:"boolean"},dependencies:{$ref:"#/definitions/DependenciesType"},dependents:{type:"array",items:{type:"string"}},followable:{type:"boolean"},matchesDoNotFollow:{type:"boolean"},matchesFocus:{type:"boolean"},matchesReaches:{type:"boolean"},matchesHighlight:{type:"boolean"},coreModule:{type:"boolean"},couldNotResolve:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},license:{type:"string"},orphan:{type:"boolean"},reachable:{type:"array",items:{$ref:"#/definitions/ReachableType"}},reaches:{type:"array",items:{$ref:"#/definitions/ReachesType"}},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}},consolidated:{type:"boolean"},instability:{type:"number"},experimentalStats:{$ref:"#/definitions/ExperimentalStatsType"},checksum:{type:"string"}}},ReachableType:{type:"object",required:["value","asDefinedInRule","matchedFrom"],additionalProperties:false,properties:{value:{type:"boolean"},asDefinedInRule:{type:"string"},matchedFrom:{type:"string"}}},ReachesType:{type:"object",required:["modules","asDefinedInRule"],additionalProperties:false,properties:{modules:{type:"array",items:{type:"object",required:["source","via"],additionalProperties:false,properties:{source:{type:"string"},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}}}}},asDefinedInRule:{type:"string"}}},DependenciesType:{type:"array",items:{$ref:"#/definitions/DependencyType"}},DependencyType:{type:"object",required:["circular","coreModule","couldNotResolve","dependencyTypes","exoticallyRequired","dynamic","followable","module","moduleSystem","resolved","valid"],additionalProperties:false,properties:{module:{type:"string"},protocol:{type:"string",enum:["data:","file:","node:"]},mimeType:{type:"string"},resolved:{type:"string"},coreModule:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},license:{type:"string"},followable:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{type:"string"},matchesDoNotFollow:{type:"boolean"},couldNotResolve:{type:"boolean"},preCompilationOnly:{type:"boolean"},typeOnly:{type:"boolean"},circular:{type:"boolean"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},moduleSystem:{$ref:"#/definitions/ModuleSystemType"},valid:{type:"boolean"},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}},instability:{type:"number"}}},DependencyTypeType:{type:"string",enum:["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","jsdoc","jsdoc-bracket-import","jsdoc-import-tag","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]},ModuleSystemType:{type:"string",enum:["cjs","es6","amd","tsd"]},RuleSummaryType:{type:"object",required:["name","severity"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},MiniDependency:{type:"object",required:["name","dependencyTypes"],additionalProperties:false,properties:{name:{type:"string"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},ExperimentalStatsType:{type:"object",required:["size","topLevelStatementCount"],additionalProperties:false,properties:{topLevelStatementCount:{type:"number"},size:{type:"number"}}},FoldersType:{type:"array",items:{$ref:"#/definitions/FolderType"}},FolderType:{type:"object",required:["name","moduleCount"],additionalProperties:false,properties:{name:{type:"string"},dependents:{type:"array",items:{type:"object",required:["name"],additionalProperties:false,properties:{name:{type:"string"}}}},dependencies:{type:"array",items:{type:"object",required:["name","valid","circular"],additionalProperties:false,properties:{name:{type:"string"},instability:{type:"number"},valid:{type:"boolean"},circular:{type:"boolean"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}}}}},moduleCount:{type:"number"},afferentCouplings:{type:"number"},efferentCouplings:{type:"number"},instability:{type:"number"},experimentalStats:{$ref:"#/definitions/ExperimentalStatsType"}}},SummaryType:{type:"object",required:["violations","error","warn","info","totalCruised","optionsUsed"],additionalProperties:false,properties:{violations:{$ref:"#/definitions/ViolationsType"},error:{type:"number"},warn:{type:"number"},info:{type:"number"},ignore:{type:"number"},totalCruised:{type:"number"},totalDependenciesCruised:{type:"number"},ruleSetUsed:{$ref:"#/definitions/RuleSetType"},optionsUsed:{$ref:"#/definitions/OptionsUsedType"}}},ViolationsType:{type:"array",items:{$ref:"#/definitions/ViolationType"}},ViolationType:{type:"object",required:["from","to","rule"],additionalProperties:false,properties:{from:{type:"string"},to:{type:"string"},type:{$ref:"#/definitions/ViolationTypeType"},rule:{$ref:"#/definitions/RuleSummaryType"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},metrics:{type:"object",required:["from","to"],additionalProperties:false,properties:{from:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}},to:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}}}},comment:{type:"string"}}},ViolationTypeType:{type:"string",enum:["dependency","module","reachability","cycle","instability","folder"]},RuleSetType:{type:"object",additionalProperties:false,properties:{forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}}}},AllowedRuleType:{oneOf:[{$ref:"#/definitions/RegularAllowedRuleType"},{$ref:"#/definitions/ReachabilityAllowedRuleType"}]},RegularAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},ReachabilityAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},ForbiddenRuleType:{oneOf:[{$ref:"#/definitions/RegularForbiddenRuleType"},{$ref:"#/definitions/ReachabilityForbiddenRuleType"},{$ref:"#/definitions/DependentsForbiddenRuleType"}]},RegularForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},DependentsForbiddenRuleType:{type:"object",required:["module","from"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/DependentsModuleRestrictionType"},from:{$ref:"#/definitions/DependentsFromRestrictionType"}}},ReachabilityForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},RequiredRuleType:{type:"object",required:["module","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/RequiredModuleRestrictionType"},to:{$ref:"#/definitions/RequiredToRestrictionType"}}},MiniDependencyRestrictionType:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}}]},FromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},orphan:{type:"boolean"}}},ReachabilityFromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ToRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},couldNotResolve:{type:"boolean"},circular:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{$ref:"#/definitions/REAsStringsType"},exoticRequireNot:{$ref:"#/definitions/REAsStringsType"},preCompilationOnly:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},moreThanOneDependencyType:{type:"boolean"},license:{$ref:"#/definitions/REAsStringsType"},licenseNot:{$ref:"#/definitions/REAsStringsType"},via:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaOnly:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},viaSomeNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},moreUnstable:{type:"boolean"}}},DependentsModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},numberOfDependentsLessThan:{type:"integer",minimum:0,maximum:100},numberOfDependentsMoreThan:{type:"integer",minimum:0,maximum:100}}},DependentsFromRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ReachabilityToRestrictionType:{required:["reachable"],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},RequiredModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},RequiredToRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},REAsStringsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},OptionsUsedType:{type:"object",additionalProperties:false,properties:{doNotFollow:{$ref:"#/definitions/CompoundDoNotFollowType"},exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundIncludeOnlyType"}]},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"},affected:{oneOf:[{type:"string"},{type:"boolean"}]},highlight:{$ref:"#/definitions/CompoundHighlightType"},knownViolations:{$ref:"#/definitions/ViolationsType"},collapse:{type:"string"},maxDepth:{type:"integer",minimum:0,maximum:99},moduleSystems:{$ref:"#/definitions/ModuleSystemsType"},detectJSDocImports:{type:"boolean"},prefix:{type:"string"},preserveSymlinks:{type:"boolean"},combinedDependencies:{type:"boolean"},tsConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},tsPreCompilationDeps:{oneOf:[{type:"boolean"},{type:"string",enum:["specify"]}]},extraExtensionsToScan:{type:"array",items:{type:"string"}},externalModuleResolutionStrategy:{type:"string",enum:["node_modules","yarn-pnp"]},builtInModules:{type:"object",additionalProperties:false,properties:{override:{type:"array",items:{type:"string"}},add:{type:"array",items:{type:"string"}}}},forceDeriveDependents:{type:"boolean"},webpackConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"},env:{oneOf:[{type:"object"},{type:"string"}]},arguments:{type:"object"}}},enhancedResolveOptions:{type:"object",additionalProperties:false,properties:{exportsFields:{type:"array",items:{type:"string"}},conditionNames:{type:"array",items:{type:"string"}},extensions:{type:"array",items:{type:"string"}},mainFields:{type:"array",items:{type:"string"}},mainFiles:{type:"array"},aliasFields:{type:"array",items:{type:"string"}},cachedInputFileSystem:{type:"object",additionalProperties:false,properties:{cacheDuration:{type:"integer",minimum:0,maximum:1800000}}}}},babelConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},parser:{type:"string",enum:["acorn","tsc","swc"]},exoticRequireStrings:{type:"array",items:{type:"string"}},reporterOptions:{$ref:"#/definitions/ReporterOptionsType"},progress:{type:"object",additionalProperties:false,properties:{type:{type:"string",enum:["cli-feedback","performance-log","ndjson","none"]},maximumLevel:{type:"number",enum:[-1,40,50,60,70,80,99]}}},metrics:{type:"boolean"},experimentalStats:{type:"boolean"},baseDir:{type:"string"},cache:{oneOf:[{type:"boolean",enum:[false]},{$ref:"#/definitions/CacheOptionsType"}]},args:{type:"string"},rulesFile:{type:"string"},outputTo:{type:"string"},outputType:{$ref:"#/definitions/OutputType"}}},ModuleSystemsType:{type:"array",items:{$ref:"#/definitions/ModuleSystemType"}},OutputType:{oneOf:[{type:"string",enum:["json","html","dot","ddot","cdot","archi","fdot","flat","csv","err","err-long","err-html","teamcity","anon","text","metrics","markdown","mermaid","d2","null"]},{type:"string",pattern:"^plugin:[^:]+$"}]},CompoundExcludeType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dynamic:{type:"boolean"}}},CompoundDoNotFollowType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CompoundIncludeOnlyType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundFocusType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},depth:{type:"number",minimum:1,maximum:4}}},CompoundReachesType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundHighlightType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},ReporterOptionsType:{type:"object",additionalProperties:false,properties:{anon:{$ref:"#/definitions/AnonReporterOptionsType"},archi:{$ref:"#/definitions/DotReporterOptionsType"},dot:{$ref:"#/definitions/DotReporterOptionsType"},ddot:{$ref:"#/definitions/DotReporterOptionsType"},flat:{$ref:"#/definitions/DotReporterOptionsType"},markdown:{$ref:"#/definitions/MarkdownReporterOptionsType"},metrics:{$ref:"#/definitions/MetricsReporterOptionsType"},mermaid:{$ref:"#/definitions/MermaidReporterOptionsType"},text:{$ref:"#/definitions/TextReporterOptionsType"}}},AnonReporterOptionsType:{type:"object",additionalProperties:false,properties:{wordlist:{type:"array",items:{type:"string"}}}},MetricsReporterOptionsType:{type:"object",additionalProperties:false,properties:{orderBy:{type:"string",enum:["instability","moduleCount","afferentCouplings","efferentCouplings","name","size","topLevelStatementCount"]},hideModules:{type:"boolean"},hideFolders:{type:"boolean"}}},MarkdownReporterOptionsType:{type:"object",additionalProperties:false,properties:{showTitle:{type:"boolean"},title:{type:"string"},showSummary:{type:"boolean"},showSummaryHeader:{type:"boolean"},summaryHeader:{type:"string"},showStatsSummary:{type:"boolean"},showRulesSummary:{type:"boolean"},includeIgnoredInSummary:{type:"boolean"},showDetails:{type:"boolean"},includeIgnoredInDetails:{type:"boolean"},showDetailsHeader:{type:"boolean"},detailsHeader:{type:"string"},collapseDetails:{type:"boolean"},collapsedMessage:{type:"string"},noViolationsMessage:{type:"string"},showFooter:{type:"boolean"}}},MermaidReporterOptionsType:{type:"object",additionalProperties:false,properties:{minify:{type:"boolean"}}},TextReporterOptionsType:{type:"object",additionalProperties:false,properties:{highlightFocused:{type:"boolean"}}},DotReporterOptionsType:{type:"object",additionalProperties:false,properties:{collapsePattern:{$ref:"#/definitions/REAsStringsType"},filters:{$ref:"#/definitions/ReporterFiltersType"},showMetrics:{type:"boolean"},theme:{$ref:"#/definitions/DotThemeType"}}},DotThemeType:{type:"object",additionalProperties:false,properties:{replace:{type:"boolean"},graph:{type:"object"},node:{type:"object"},edge:{type:"object"},modules:{$ref:"#/definitions/DotThemeArrayType"},dependencies:{$ref:"#/definitions/DotThemeArrayType"}}},DotThemeArrayType:{type:"array",items:{$ref:"#/definitions/DotThemeEntryType"}},DotThemeEntryType:{type:"object",additionalProperties:false,properties:{criteria:{type:"object"},attributes:{type:"object"}}},ReporterFiltersType:{type:"object",additionalProperties:false,properties:{exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{$ref:"#/definitions/CompoundIncludeOnlyType"},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"}}},CacheOptionsType:{type:"object",additionalProperties:false,properties:{folder:{type:"string"},strategy:{$ref:"#/definitions/CacheStrategyType"},compress:{type:"boolean",default:false}}},CacheStrategyType:{type:"string",enum:["metadata","content"]},RevisionDataType:{type:"object",required:["SHA1","changes"],properties:{cacheFormatVersion:{type:"number"},SHA1:{type:"string"},changes:{type:"array",items:{type:"object",required:["name","type"],properties:{name:{type:"string"},type:{type:"string",enum:["added","copied","deleted","modified","renamed","type changed","unmerged","pairing broken","unknown","unmodified","untracked","ignored"]},oldName:{type:"string"},checksum:{type:"string"},args:{type:"array",items:{type:"string"}},rulesFile:{type:"string"}}}}}}}}; \ No newline at end of file +/* generated - don't edit */export default{title:"dependency-cruiser output format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/cruise-result.schema.json",type:"object",required:["summary","modules"],additionalProperties:false,properties:{modules:{$ref:"#/definitions/ModulesType"},folders:{$ref:"#/definitions/FoldersType"},summary:{$ref:"#/definitions/SummaryType"},revisionData:{$ref:"#/definitions/RevisionDataType"}},definitions:{ModulesType:{type:"array",items:{$ref:"#/definitions/ModuleType"}},ModuleType:{type:"object",required:["source","dependencies","valid"],additionalProperties:false,properties:{source:{type:"string"},valid:{type:"boolean"},dependencies:{$ref:"#/definitions/DependenciesType"},dependents:{type:"array",items:{type:"string"}},followable:{type:"boolean"},matchesDoNotFollow:{type:"boolean"},matchesFocus:{type:"boolean"},matchesReaches:{type:"boolean"},matchesHighlight:{type:"boolean"},coreModule:{type:"boolean"},couldNotResolve:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},license:{type:"string"},orphan:{type:"boolean"},reachable:{type:"array",items:{$ref:"#/definitions/ReachableType"}},reaches:{type:"array",items:{$ref:"#/definitions/ReachesType"}},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}},consolidated:{type:"boolean"},instability:{type:"number"},experimentalStats:{$ref:"#/definitions/ExperimentalStatsType"},checksum:{type:"string"}}},ReachableType:{type:"object",required:["value","asDefinedInRule","matchedFrom"],additionalProperties:false,properties:{value:{type:"boolean"},asDefinedInRule:{type:"string"},matchedFrom:{type:"string"}}},ReachesType:{type:"object",required:["modules","asDefinedInRule"],additionalProperties:false,properties:{modules:{type:"array",items:{type:"object",required:["source","via"],additionalProperties:false,properties:{source:{type:"string"},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}}}}},asDefinedInRule:{type:"string"}}},DependenciesType:{type:"array",items:{$ref:"#/definitions/DependencyType"}},DependencyType:{type:"object",required:["circular","coreModule","couldNotResolve","dependencyTypes","exoticallyRequired","dynamic","followable","module","moduleSystem","resolved","valid"],additionalProperties:false,properties:{module:{type:"string"},protocol:{type:"string",enum:["data:","file:","node:"]},mimeType:{type:"string"},resolved:{type:"string"},coreModule:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},license:{type:"string"},followable:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{type:"string"},matchesDoNotFollow:{type:"boolean"},couldNotResolve:{type:"boolean"},preCompilationOnly:{type:"boolean"},typeOnly:{type:"boolean"},circular:{type:"boolean"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},moduleSystem:{$ref:"#/definitions/ModuleSystemType"},valid:{type:"boolean"},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}},instability:{type:"number"}}},DependencyTypeType:{type:"string",enum:["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","jsdoc","jsdoc-bracket-import","jsdoc-import-tag","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]},ModuleSystemType:{type:"string",enum:["cjs","es6","amd","tsd"]},RuleSummaryType:{type:"object",required:["name","severity"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},MiniDependency:{type:"object",required:["name","dependencyTypes"],additionalProperties:false,properties:{name:{type:"string"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},ExperimentalStatsType:{type:"object",required:["size","topLevelStatementCount"],additionalProperties:false,properties:{topLevelStatementCount:{type:"number"},size:{type:"number"}}},FoldersType:{type:"array",items:{$ref:"#/definitions/FolderType"}},FolderType:{type:"object",required:["name","moduleCount"],additionalProperties:false,properties:{name:{type:"string"},dependents:{type:"array",items:{type:"object",required:["name"],additionalProperties:false,properties:{name:{type:"string"}}}},dependencies:{type:"array",items:{type:"object",required:["name","valid","circular"],additionalProperties:false,properties:{name:{type:"string"},instability:{type:"number"},valid:{type:"boolean"},circular:{type:"boolean"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},rules:{type:"array",items:{$ref:"#/definitions/RuleSummaryType"}}}}},moduleCount:{type:"number"},afferentCouplings:{type:"number"},efferentCouplings:{type:"number"},instability:{type:"number"},experimentalStats:{$ref:"#/definitions/ExperimentalStatsType"}}},SummaryType:{type:"object",required:["violations","error","warn","info","totalCruised","optionsUsed"],additionalProperties:false,properties:{violations:{$ref:"#/definitions/ViolationsType"},error:{type:"number"},warn:{type:"number"},info:{type:"number"},ignore:{type:"number"},totalCruised:{type:"number"},totalDependenciesCruised:{type:"number"},ruleSetUsed:{$ref:"#/definitions/RuleSetType"},optionsUsed:{$ref:"#/definitions/OptionsUsedType"}}},ViolationsType:{type:"array",items:{$ref:"#/definitions/ViolationType"}},ViolationType:{type:"object",required:["from","to","rule"],additionalProperties:false,properties:{from:{type:"string"},to:{type:"string"},type:{$ref:"#/definitions/ViolationTypeType"},rule:{$ref:"#/definitions/RuleSummaryType"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},metrics:{type:"object",required:["from","to"],additionalProperties:false,properties:{from:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}},to:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}}}},comment:{type:"string"}}},ViolationTypeType:{type:"string",enum:["dependency","module","reachability","cycle","instability","folder"]},RuleSetType:{type:"object",additionalProperties:false,properties:{forbidden:{type:"array",items:{$ref:"#/definitions/ForbiddenRuleType"}},allowed:{type:"array",items:{$ref:"#/definitions/AllowedRuleType"}},allowedSeverity:{$ref:"#/definitions/SeverityType"},required:{type:"array",items:{$ref:"#/definitions/RequiredRuleType"}}}},AllowedRuleType:{oneOf:[{$ref:"#/definitions/RegularAllowedRuleType"},{$ref:"#/definitions/ReachabilityAllowedRuleType"}]},RegularAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},ReachabilityAllowedRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{comment:{type:"string"},scope:{type:"string",enum:["module","folder"]},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},ForbiddenRuleType:{oneOf:[{$ref:"#/definitions/RegularForbiddenRuleType"},{$ref:"#/definitions/ReachabilityForbiddenRuleType"},{$ref:"#/definitions/DependentsForbiddenRuleType"}]},RegularForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/FromRestrictionType"},to:{$ref:"#/definitions/ToRestrictionType"}}},DependentsForbiddenRuleType:{type:"object",required:["module","from"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/DependentsModuleRestrictionType"},from:{$ref:"#/definitions/DependentsFromRestrictionType"}}},ReachabilityForbiddenRuleType:{type:"object",required:["from","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},from:{$ref:"#/definitions/ReachabilityFromRestrictionType"},to:{$ref:"#/definitions/ReachabilityToRestrictionType"}}},RequiredRuleType:{type:"object",required:["module","to"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"},scope:{type:"string",enum:["module","folder"]},comment:{type:"string"},module:{$ref:"#/definitions/RequiredModuleRestrictionType"},to:{$ref:"#/definitions/RequiredToRestrictionType"}}},MiniDependencyRestrictionType:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}}]},FromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},orphan:{type:"boolean"}}},ReachabilityFromRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ToRestrictionType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},couldNotResolve:{type:"boolean"},circular:{type:"boolean"},dynamic:{type:"boolean"},exoticallyRequired:{type:"boolean"},exoticRequire:{$ref:"#/definitions/REAsStringsType"},exoticRequireNot:{$ref:"#/definitions/REAsStringsType"},preCompilationOnly:{type:"boolean"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},dependencyTypesNot:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}},moreThanOneDependencyType:{type:"boolean"},license:{$ref:"#/definitions/REAsStringsType"},licenseNot:{$ref:"#/definitions/REAsStringsType"},via:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaOnly:{$ref:"#/definitions/MiniDependencyRestrictionType"},viaNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},viaSomeNot:{deprecated:true,$ref:"#/definitions/REAsStringsType"},moreUnstable:{type:"boolean"}}},DependentsModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},numberOfDependentsLessThan:{type:"integer",minimum:0,maximum:100},numberOfDependentsMoreThan:{type:"integer",minimum:0,maximum:100}}},DependentsFromRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},ReachabilityToRestrictionType:{required:["reachable"],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},RequiredModuleRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},pathNot:{$ref:"#/definitions/REAsStringsType"}}},RequiredToRestrictionType:{required:[],type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},reachable:{type:"boolean"}}},REAsStringsType:{oneOf:[{type:"string"},{type:"array",items:{type:"string"}}]},OptionsUsedType:{type:"object",additionalProperties:false,properties:{doNotFollow:{$ref:"#/definitions/CompoundDoNotFollowType"},exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{oneOf:[{$ref:"#/definitions/REAsStringsType"},{$ref:"#/definitions/CompoundIncludeOnlyType"}]},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"},affected:{oneOf:[{type:"string"},{type:"boolean"}]},highlight:{$ref:"#/definitions/CompoundHighlightType"},knownViolations:{$ref:"#/definitions/ViolationsType"},collapse:{type:"string"},maxDepth:{type:"integer",minimum:0,maximum:99},moduleSystems:{$ref:"#/definitions/ModuleSystemsType"},detectJSDocImports:{type:"boolean"},prefix:{type:"string"},preserveSymlinks:{type:"boolean"},combinedDependencies:{type:"boolean"},tsConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},tsPreCompilationDeps:{oneOf:[{type:"boolean"},{type:"string",enum:["specify"]}]},extraExtensionsToScan:{type:"array",items:{type:"string"}},externalModuleResolutionStrategy:{type:"string",enum:["node_modules","yarn-pnp"]},builtInModules:{type:"object",additionalProperties:false,properties:{override:{type:"array",items:{type:"string"}},add:{type:"array",items:{type:"string"}}}},forceDeriveDependents:{type:"boolean",deprecated:true},webpackConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"},env:{oneOf:[{type:"object"},{type:"string"}]},arguments:{type:"object"}}},enhancedResolveOptions:{type:"object",additionalProperties:false,properties:{exportsFields:{type:"array",items:{type:"string"}},conditionNames:{type:"array",items:{type:"string"}},extensions:{type:"array",items:{type:"string"}},mainFields:{type:"array",items:{type:"string"}},mainFiles:{type:"array"},aliasFields:{type:"array",items:{type:"string"}},cachedInputFileSystem:{type:"object",additionalProperties:false,properties:{cacheDuration:{type:"integer",minimum:0,maximum:1800000}}}}},babelConfig:{type:"object",additionalProperties:false,properties:{fileName:{type:"string"}}},parser:{type:"string",enum:["acorn","tsc","swc"]},exoticRequireStrings:{type:"array",items:{type:"string"}},reporterOptions:{$ref:"#/definitions/ReporterOptionsType"},progress:{type:"object",additionalProperties:false,properties:{type:{type:"string",enum:["cli-feedback","performance-log","ndjson","none"]},maximumLevel:{type:"number",enum:[-1,40,50,60,70,80,99]}}},metrics:{type:"boolean"},experimentalStats:{type:"boolean"},skipAnalysisNotInRules:{type:"boolean"},baseDir:{type:"string"},cache:{oneOf:[{type:"boolean",enum:[false]},{$ref:"#/definitions/CacheOptionsType"}]},args:{type:"string"},rulesFile:{type:"string"},outputTo:{type:"string"},outputType:{$ref:"#/definitions/OutputType"}}},ModuleSystemsType:{type:"array",items:{$ref:"#/definitions/ModuleSystemType"}},OutputType:{oneOf:[{type:"string",enum:["json","html","dot","ddot","cdot","archi","fdot","flat","csv","err","err-long","err-html","teamcity","anon","text","metrics","markdown","mermaid","d2","null"]},{type:"string",pattern:"^plugin:[^:]+$"}]},CompoundExcludeType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dynamic:{type:"boolean"}}},CompoundDoNotFollowType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},CompoundIncludeOnlyType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundFocusType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"},depth:{type:"number",minimum:1,maximum:4}}},CompoundReachesType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},CompoundHighlightType:{type:"object",additionalProperties:false,properties:{path:{$ref:"#/definitions/REAsStringsType"}}},ReporterOptionsType:{type:"object",additionalProperties:false,properties:{anon:{$ref:"#/definitions/AnonReporterOptionsType"},archi:{$ref:"#/definitions/DotReporterOptionsType"},dot:{$ref:"#/definitions/DotReporterOptionsType"},ddot:{$ref:"#/definitions/DotReporterOptionsType"},flat:{$ref:"#/definitions/DotReporterOptionsType"},markdown:{$ref:"#/definitions/MarkdownReporterOptionsType"},metrics:{$ref:"#/definitions/MetricsReporterOptionsType"},mermaid:{$ref:"#/definitions/MermaidReporterOptionsType"},text:{$ref:"#/definitions/TextReporterOptionsType"}}},AnonReporterOptionsType:{type:"object",additionalProperties:false,properties:{wordlist:{type:"array",items:{type:"string"}}}},MetricsReporterOptionsType:{type:"object",additionalProperties:false,properties:{orderBy:{type:"string",enum:["instability","moduleCount","afferentCouplings","efferentCouplings","name","size","topLevelStatementCount"]},hideModules:{type:"boolean"},hideFolders:{type:"boolean"}}},MarkdownReporterOptionsType:{type:"object",additionalProperties:false,properties:{showTitle:{type:"boolean"},title:{type:"string"},showSummary:{type:"boolean"},showSummaryHeader:{type:"boolean"},summaryHeader:{type:"string"},showStatsSummary:{type:"boolean"},showRulesSummary:{type:"boolean"},includeIgnoredInSummary:{type:"boolean"},showDetails:{type:"boolean"},includeIgnoredInDetails:{type:"boolean"},showDetailsHeader:{type:"boolean"},detailsHeader:{type:"string"},collapseDetails:{type:"boolean"},collapsedMessage:{type:"string"},noViolationsMessage:{type:"string"},showFooter:{type:"boolean"}}},MermaidReporterOptionsType:{type:"object",additionalProperties:false,properties:{minify:{type:"boolean"}}},TextReporterOptionsType:{type:"object",additionalProperties:false,properties:{highlightFocused:{type:"boolean"}}},DotReporterOptionsType:{type:"object",additionalProperties:false,properties:{collapsePattern:{$ref:"#/definitions/REAsStringsType"},filters:{$ref:"#/definitions/ReporterFiltersType"},showMetrics:{type:"boolean"},theme:{$ref:"#/definitions/DotThemeType"}}},DotThemeType:{type:"object",additionalProperties:false,properties:{replace:{type:"boolean"},graph:{type:"object"},node:{type:"object"},edge:{type:"object"},modules:{$ref:"#/definitions/DotThemeArrayType"},dependencies:{$ref:"#/definitions/DotThemeArrayType"}}},DotThemeArrayType:{type:"array",items:{$ref:"#/definitions/DotThemeEntryType"}},DotThemeEntryType:{type:"object",additionalProperties:false,properties:{criteria:{type:"object"},attributes:{type:"object"}}},ReporterFiltersType:{type:"object",additionalProperties:false,properties:{exclude:{$ref:"#/definitions/CompoundExcludeType"},includeOnly:{$ref:"#/definitions/CompoundIncludeOnlyType"},focus:{$ref:"#/definitions/CompoundFocusType"},reaches:{$ref:"#/definitions/CompoundReachesType"}}},CacheOptionsType:{type:"object",additionalProperties:false,properties:{folder:{type:"string"},strategy:{$ref:"#/definitions/CacheStrategyType"},compress:{type:"boolean",default:false}}},CacheStrategyType:{type:"string",enum:["metadata","content"]},RevisionDataType:{type:"object",required:["SHA1","changes"],properties:{cacheFormatVersion:{type:"number"},SHA1:{type:"string"},changes:{type:"array",items:{type:"object",required:["name","type"],properties:{name:{type:"string"},type:{type:"string",enum:["added","copied","deleted","modified","renamed","type changed","unmerged","pairing broken","unknown","unmodified","untracked","ignored"]},oldName:{type:"string"},checksum:{type:"string"},args:{type:"array",items:{type:"string"}},rulesFile:{type:"string"}}}}}}}}; \ No newline at end of file diff --git a/test/cli/__fixtures__/alternate-basedir/expected.json b/test/cli/__fixtures__/alternate-basedir/expected.json index 0d5f4e907..0570a0eff 100644 --- a/test/cli/__fixtures__/alternate-basedir/expected.json +++ b/test/cli/__fixtures__/alternate-basedir/expected.json @@ -30,6 +30,7 @@ "outputTo": "test/cli/__output__/alternate-basedir.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "src" }, diff --git a/test/cli/__fixtures__/babel/babel-es6-result.json b/test/cli/__fixtures__/babel/babel-es6-result.json index a27b2c618..813457556 100644 --- a/test/cli/__fixtures__/babel/babel-es6-result.json +++ b/test/cli/__fixtures__/babel/babel-es6-result.json @@ -76,6 +76,7 @@ "outputTo": "test/cli/__output__/babel-es6-result.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "webpackConfig": { "fileName": "test/cli/__fixtures__/babel/es6/webpack-cache-bust.config.js" diff --git a/test/cli/__fixtures__/babel/babel-ts-result.json b/test/cli/__fixtures__/babel/babel-ts-result.json index 804f2cc2d..0ff9becec 100644 --- a/test/cli/__fixtures__/babel/babel-ts-result.json +++ b/test/cli/__fixtures__/babel/babel-ts-result.json @@ -202,6 +202,7 @@ "outputTo": "test/cli/__output__/babel-ts-result.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "webpackConfig": { "fileName": "test/cli/__fixtures__/babel/ts/webpack-cache-bust.config.js" diff --git a/test/cli/__fixtures__/cjs.dir.filtered.json b/test/cli/__fixtures__/cjs.dir.filtered.json index 531aa5cc0..d5e091009 100644 --- a/test/cli/__fixtures__/cjs.dir.filtered.json +++ b/test/cli/__fixtures__/cjs.dir.filtered.json @@ -371,6 +371,7 @@ "outputTo": "test/cli/__output__/cjs.dir.filtered.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/cli/__fixtures__/cjs" } diff --git a/test/cli/__fixtures__/cjs.dir.json b/test/cli/__fixtures__/cjs.dir.json index 524bf93db..47c593c12 100644 --- a/test/cli/__fixtures__/cjs.dir.json +++ b/test/cli/__fixtures__/cjs.dir.json @@ -434,6 +434,7 @@ "outputTo": "test/cli/__output__/cjs.dir.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "exoticRequireStrings": [], "args": "test/cli/__fixtures__/cjs" diff --git a/test/cli/__fixtures__/cjs.dir.stdout.json b/test/cli/__fixtures__/cjs.dir.stdout.json index 7422e7054..486777a2d 100644 --- a/test/cli/__fixtures__/cjs.dir.stdout.json +++ b/test/cli/__fixtures__/cjs.dir.stdout.json @@ -383,7 +383,8 @@ "combinedDependencies": false, "detectJSDocImports": false, "exoticRequireStrings": [], - "externalModuleResolutionStrategy": "node_modules" + "externalModuleResolutionStrategy": "node_modules", + "skipAnalysisNotInRules": false } } } diff --git a/test/cli/__fixtures__/cjs.file.json b/test/cli/__fixtures__/cjs.file.json index 9f03e30dc..0a3a6fdd3 100644 --- a/test/cli/__fixtures__/cjs.file.json +++ b/test/cli/__fixtures__/cjs.file.json @@ -318,6 +318,7 @@ "outputTo": "test/cli/__output__/cjs.file.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "exoticRequireStrings": [], "args": "test/cli/__fixtures__/cjs/root_one.js" diff --git a/test/cli/__fixtures__/dynamic-import-nok.json b/test/cli/__fixtures__/dynamic-import-nok.json index 5ed661fa9..f1bc1ce7a 100644 --- a/test/cli/__fixtures__/dynamic-import-nok.json +++ b/test/cli/__fixtures__/dynamic-import-nok.json @@ -49,6 +49,7 @@ "outputTo": "test/cli/__output__/dynamic-import-nok.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsConfig": { "fileName": "test/cli/__fixtures__/typescriptconfig/cli-dynamic-imports/tsconfig.error_on_compile_dynamic_imports.json" }, diff --git a/test/cli/__fixtures__/dynamic-import-ok.json b/test/cli/__fixtures__/dynamic-import-ok.json index ade9da404..2e7b50e68 100644 --- a/test/cli/__fixtures__/dynamic-import-ok.json +++ b/test/cli/__fixtures__/dynamic-import-ok.json @@ -49,6 +49,7 @@ "outputTo": "test/cli/__output__/dynamic-import-ok.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsConfig": { "fileName": "test/cli/__fixtures__/typescriptconfig/cli-dynamic-imports/tsconfig.compile_dynamic_imports.json" }, diff --git a/test/cli/__fixtures__/empty.json b/test/cli/__fixtures__/empty.json index 5820709ba..6218f2acb 100644 --- a/test/cli/__fixtures__/empty.json +++ b/test/cli/__fixtures__/empty.json @@ -18,6 +18,7 @@ "tsPreCompilationDeps": false, "combinedDependencies": false, "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "externalModuleResolutionStrategy": "node_modules" } } diff --git a/test/cli/__fixtures__/jsdoc-import-tags/expected.json b/test/cli/__fixtures__/jsdoc-import-tags/expected.json index df6ea6f07..3a56248c5 100644 --- a/test/cli/__fixtures__/jsdoc-import-tags/expected.json +++ b/test/cli/__fixtures__/jsdoc-import-tags/expected.json @@ -56,6 +56,7 @@ "outputType": "json", "parser": "tsc", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "rulesFile": "dependency-cruiser-config.mjs", "tsPreCompilationDeps": false, "args": "src/index.mjs" diff --git a/test/cli/__fixtures__/multiple-in-one-go.json b/test/cli/__fixtures__/multiple-in-one-go.json index 350e897e3..efc7287ff 100644 --- a/test/cli/__fixtures__/multiple-in-one-go.json +++ b/test/cli/__fixtures__/multiple-in-one-go.json @@ -162,6 +162,7 @@ "outputTo": "test/cli/__output__/multiple-in-one-go.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "exoticRequireStrings": [], "args": "test/cli/__fixtures__/cjs/sub test/cli/__fixtures__/duplicate-subs/sub/more-in-sub.js test/cli/__fixtures__/unresolvable-in-sub" diff --git a/test/cli/__fixtures__/result-has-a-dependency-violation.json b/test/cli/__fixtures__/result-has-a-dependency-violation.json index 422babff9..a8e56889a 100644 --- a/test/cli/__fixtures__/result-has-a-dependency-violation.json +++ b/test/cli/__fixtures__/result-has-a-dependency-violation.json @@ -9287,6 +9287,7 @@ "prefix": "https://github.com/sverweij/dependency-cruiser/blob/develop/", "preserveSymlinks": false, "rulesFile": ".dependency-cruiser.json", + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": true, "exoticRequireStrings": ["tryRequire", "requireJSON"], "reporterOptions": { diff --git a/test/cli/__fixtures__/typescript-path-resolution.json b/test/cli/__fixtures__/typescript-path-resolution.json index d1c25780b..2d60e1c87 100644 --- a/test/cli/__fixtures__/typescript-path-resolution.json +++ b/test/cli/__fixtures__/typescript-path-resolution.json @@ -84,6 +84,7 @@ "outputTo": "test/cli/__output__/typescript-path-resolution.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "tsConfig": { "fileName": "test/cli/__fixtures__/typescriptconfig/cli-config-with-path/tsconfig.json" diff --git a/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json b/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json index 839d57fbc..cfac42253 100644 --- a/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json +++ b/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json @@ -78,6 +78,7 @@ "outputType": "json", "preserveSymlinks": false, "rulesFile": "test/cli/__fixtures__/webpackconfig/aliassy/dependency-cruiser-json-with-webpack-config.json", + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "webpackConfig": { "fileName": "test/cli/__fixtures__/webpackconfig/aliassy/webpack.regularexport.config.js" diff --git a/test/cli/__fixtures__/webpack-config-alias.json b/test/cli/__fixtures__/webpack-config-alias.json index 50eb40f50..afbbb589b 100644 --- a/test/cli/__fixtures__/webpack-config-alias.json +++ b/test/cli/__fixtures__/webpack-config-alias.json @@ -77,6 +77,7 @@ "outputTo": "test/cli/__output__/webpack-config-alias.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "webpackConfig": { "fileName": "test/cli/__fixtures__/webpackconfig/aliassy/webpack.regularexport.config.js" diff --git a/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json b/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json index 433238878..a14db3cc0 100644 --- a/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json +++ b/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json @@ -223,6 +223,7 @@ "outputType": "json", "preserveSymlinks": false, "rulesFile": ".dependency-cruiser.js", + "skipAnalysisNotInRules": false, "tsConfig": { "fileName": "tsconfig.json" }, diff --git a/test/cli/__fixtures__/workspaces-mono-repo/expected.json b/test/cli/__fixtures__/workspaces-mono-repo/expected.json index ebe17d186..f02685b52 100644 --- a/test/cli/__fixtures__/workspaces-mono-repo/expected.json +++ b/test/cli/__fixtures__/workspaces-mono-repo/expected.json @@ -239,6 +239,7 @@ "outputTo": "test/cli/__output__/workspaces-mono-repo.json", "outputType": "json", "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "apps" }, diff --git a/test/enrich/derive/circular.spec.mjs b/test/enrich/derive/circular.spec.mjs new file mode 100644 index 000000000..a8ec87341 --- /dev/null +++ b/test/enrich/derive/circular.spec.mjs @@ -0,0 +1,127 @@ +import assert from "node:assert/strict"; +import detectAndAddCycles, { hasCycleRule } from "#enrich/derive/circular.mjs"; +import IndexedModuleGraph from "#graph-utl/indexed-module-graph.mjs"; + +describe("[U] enrich/circular - hasCycleRule", () => { + it("returns false for empty lRuleSet", () => { + assert.equal(hasCycleRule({}), false); + }); + + it("returns true when forbidden rules contain circular", () => { + const lRuleSet = { + forbidden: [{ from: {}, to: { circular: true } }], + }; + assert.equal(hasCycleRule(lRuleSet), true); + }); + + it("returns true when allowed rule contain circular", () => { + const lRuleSet = { + allowed: [{ from: {}, to: { circular: true } }], + }; + assert.equal(hasCycleRule(lRuleSet), true); + }); +}); + +describe("[U] enrich/circular - detectAndAddCycles", () => { + it("adds circular: false when no cycles", () => { + const lNodes = [ + { + source: "x", + dependencies: [{ resolved: "y" }], + }, + { + source: "y", + dependencies: [], + }, + ]; + const lMockIndexedNodes = new IndexedModuleGraph(lNodes); + + const lResult = detectAndAddCycles(lNodes, lMockIndexedNodes, { + pSourceAttribute: "source", + pDependencyName: "resolved", + pSkipAnalysisNotInRules: false, + }); + + assert.deepEqual(lResult[0].dependencies[0].circular, false); + }); + + it("detects and adds cycles", () => { + const lNodes = [ + { + source: "a", + dependencies: [{ resolved: "b" }], + }, + { + source: "b", + dependencies: [{ resolved: "a" }], + }, + ]; + const lMockIndexedNodes = new IndexedModuleGraph(lNodes); + + const lResult = detectAndAddCycles(lNodes, lMockIndexedNodes, { + pSourceAttribute: "source", + pDependencyName: "resolved", + pSkipAnalysisNotInRules: false, + }); + + assert.equal(lResult[0].dependencies[0].circular, true); + assert.deepEqual(lResult[0].dependencies[0].cycle, [ + { name: "b", dependencyTypes: [] }, + { name: "a", dependencyTypes: [] }, + ]); + }); + + it("skips analysis when pSkipAnalysisNotInRules=true and no cycle rules", () => { + const lNodes = [ + { + source: "a", + dependencies: [{ resolved: "b" }], + }, + { + source: "b", + dependencies: [{ resolved: "a" }], + }, + ]; + const lMockIndexedNodes = new IndexedModuleGraph(lNodes); + + const lResult = detectAndAddCycles(lNodes, lMockIndexedNodes, { + pSourceAttribute: "source", + pDependencyName: "resolved", + pSkipAnalysisNotInRules: true, + pRuleSet: {}, + }); + + assert.equal(lResult[0].dependencies[0].circular, false); + // eslint-disable-next-line no-undefined + assert.equal(lResult[0].dependencies[0].cycle, undefined); + }); + + it("performs analysis when pSkipAnalysisNotInRules=true but cycle rules exist", () => { + const lNodes = [ + { + source: "a", + dependencies: [{ resolved: "b" }], + }, + { + source: "b", + dependencies: [{ resolved: "a" }], + }, + ]; + const lIndexedNodes = new IndexedModuleGraph(lNodes); + + const lResult = detectAndAddCycles(lNodes, lIndexedNodes, { + pSourceAttribute: "source", + pDependencyName: "resolved", + pSkipAnalysisNotInRules: true, + pRuleSet: { + forbidden: [{ from: {}, to: { circular: true } }], + }, + }); + + assert.equal(lResult[0].dependencies[0].circular, true); + assert.deepEqual(lResult[0].dependencies[0].cycle, [ + { name: "b", dependencyTypes: [] }, + { name: "a", dependencyTypes: [] }, + ]); + }); +}); diff --git a/test/enrich/derive/dependents/get-dependents.spec.mjs b/test/enrich/derive/dependents/get-dependents.spec.mjs index 7f0398070..2a93c32aa 100644 --- a/test/enrich/derive/dependents/get-dependents.spec.mjs +++ b/test/enrich/derive/dependents/get-dependents.spec.mjs @@ -2,7 +2,7 @@ import { deepEqual } from "node:assert/strict"; import getDependents from "#enrich/derive/dependents/get-dependents.mjs"; -describe("[U] enrich/derive/dependents/get-dependents", () => { +describe("[U] enrich/derive/dependents - get-dependents", () => { it("empty module without a source name & no modules yield no modules", () => { deepEqual(getDependents({}, []), []); }); diff --git a/test/enrich/derive/dependents/index.spec.mjs b/test/enrich/derive/dependents/index.spec.mjs new file mode 100644 index 000000000..6de6750e2 --- /dev/null +++ b/test/enrich/derive/dependents/index.spec.mjs @@ -0,0 +1,108 @@ +import { deepEqual, equal } from "node:assert/strict"; +import addDependents, { + hasDependentsRule, +} from "#enrich/derive/dependents/index.mjs"; + +describe("[U] enrich/derive/dependents - has-dependents-rule", () => { + it("returns false on an empty rule set", () => { + equal(hasDependentsRule({}), false); + }); + + it("returns false on a rule set without rules that need dependents analysed", () => { + equal(hasDependentsRule({ forbidden: [{ from: {}, to: {} }] }), false); + }); + + it("returns true on a rule set without rules that need dependents analysed (less, forbidden)", () => { + equal( + hasDependentsRule({ + forbidden: [{ module: { numberOfDependentsLessThan: 3 }, from: {} }], + }), + true, + ); + }); + + it("returns true on a rule set without rules that need dependents analysed (more, forbidden)", () => { + equal( + hasDependentsRule({ + forbidden: [{ module: { numberOfDependentsLessThan: 3 }, from: {} }], + }), + true, + ); + }); + + it("returns true on a rule set without rules that need dependents analysed (less, allowed)", () => { + equal( + hasDependentsRule({ + allowed: [{ module: { numberOfDependentsLessThan: 3 }, from: {} }], + }), + true, + ); + }); + + it("returns true on a rule set without rules that need dependents analysed (more, allowed)", () => { + equal( + hasDependentsRule({ + allowed: [{ module: { numberOfDependentsMoreThan: 3 }, from: {} }], + }), + true, + ); + }); +}); + +describe("[U] enrich/derive/dependents - addDependents", () => { + const lModules = [ + { source: "a", dependencies: [{ resolved: "b" }, { resolved: "c" }] }, + { source: "b", dependencies: [{ resolved: "c" }] }, + { source: "c", dependencies: [] }, + ]; + const lModulesWithDependents = [ + { + source: "a", + dependencies: [{ resolved: "b" }, { resolved: "c" }], + dependents: [], + }, + { source: "b", dependencies: [{ resolved: "c" }], dependents: ["a"] }, + { source: "c", dependencies: [], dependents: ["a", "b"] }, + ]; + const lRuleSetWithDependents = { + forbidden: [{ module: { numberOfDependentsLessThan: 3 }, from: {} }], + }; + + it("returns the input when skipAnalysisNotInRules=true, there's no metrics and the rule set is not provided", () => { + deepEqual( + addDependents(lModules, { skipAnalysisNotInRules: true }), + lModules, + ); + }); + + it("returns the input when skipAnalysisNotInRules=true, there's no metrics and the rule set is empty", () => { + deepEqual( + addDependents(lModules, { skipAnalysisNotInRules: true, ruleSet: {} }), + lModules, + ); + }); + + it("returns the input enriched with dependents when skipAnalysisNotInRules=true, there's no metrics and the rule set needs dependents", () => { + deepEqual( + addDependents(lModules, { + skipAnalysisNotInRules: true, + ruleSet: lRuleSetWithDependents, + }), + lModulesWithDependents, + ); + }); + + it("returns the input enriched with dependents when skipAnalysisNotInRules=true and metrics need to be calculated", () => { + deepEqual( + addDependents(lModules, { skipAnalysisNotInRules: true, metrics: true }), + lModulesWithDependents, + ); + }); + + it("returns the input enriched with dependents with skipAnalysisNotInRules=false", () => { + deepEqual( + addDependents(lModules, { skipAnalysisNotInRules: false }), + lModulesWithDependents, + ); + }); +}); diff --git a/test/enrich/derive/orphan/index.spec.mjs b/test/enrich/derive/orphan/index.spec.mjs index 0b261f28c..266612ab8 100644 --- a/test/enrich/derive/orphan/index.spec.mjs +++ b/test/enrich/derive/orphan/index.spec.mjs @@ -1,19 +1,67 @@ -import { deepEqual } from "node:assert/strict"; +import { deepEqual, equal } from "node:assert/strict"; import ONE_MODULE_FIXTURE from "./__mocks__/one-module.mjs"; import ONE_MODULE_AFTER_PROCESSING from "./__mocks__/one-module.afterprocessing.mjs"; import TWO_MODULES_FIXTURE from "./__mocks__/two-module.mjs"; import TWO_MODULES_AFTER_PROCESSING from "./__mocks__/two-module.afterprocessing.mjs"; -import orphan from "#enrich/derive/orphan/index.mjs"; +import deriveOrphans, { hasOrphanRule } from "#enrich/derive/orphan/index.mjs"; + +const RULE_SET_WITH_ORPHAN_RULE = { + forbidden: [ + { + from: { + orphan: true, + }, + to: {}, + }, + ], +}; + +const RULE_SET_WITH_ALLOWED_ORPHAN_RULE = { + allowed: [ + { + from: { orphan: false }, + to: {}, + }, + ], +}; + +describe("[U] enrich/derive/orphan/index - hasOrphanRule", () => { + it("returns false on an empty rule set", () => { + equal(hasOrphanRule([]), false); + }); + + it("returns false on a rule set with an orhpan rule (forbidden)", () => { + equal(hasOrphanRule(RULE_SET_WITH_ORPHAN_RULE), true); + }); + + it("returns false on a rule set with an orhpan rule (alllowed)", () => { + equal(hasOrphanRule(RULE_SET_WITH_ALLOWED_ORPHAN_RULE), true); + }); +}); describe("[U] enrich/derive/orphan/index - orphan detection", () => { it('attaches the "orphan" boolean to orphan modules by default', () => { - deepEqual(orphan(ONE_MODULE_FIXTURE, {}), ONE_MODULE_AFTER_PROCESSING); + deepEqual( + deriveOrphans(ONE_MODULE_FIXTURE, {}), + ONE_MODULE_AFTER_PROCESSING, + ); + }); + + it('attaches the "orphan" boolean to orphan modules if the ruleset requires an orphan check, and skipAnalysisNotInRules is absent', () => { + deepEqual( + deriveOrphans(ONE_MODULE_FIXTURE, { + validate: true, + ruleSet: RULE_SET_WITH_ORPHAN_RULE, + }), + ONE_MODULE_AFTER_PROCESSING, + ); }); - it('attaches the "orphan" boolean to orphan modules if the ruleset requires an orphan check', () => { + it('attaches the "orphan" boolean to orphan modules if the ruleset requires an orphan check, and skipAnalysisNotInRules is true', () => { deepEqual( - orphan(ONE_MODULE_FIXTURE, { + deriveOrphans(ONE_MODULE_FIXTURE, { + skipAnalysisNotInRules: true, validate: true, ruleSet: { forbidden: [ @@ -30,7 +78,20 @@ describe("[U] enrich/derive/orphan/index - orphan detection", () => { ); }); - it('does attachs the "orphan" boolean to non-orphan modules with the value "false"', () => { - deepEqual(orphan(TWO_MODULES_FIXTURE), TWO_MODULES_AFTER_PROCESSING); + it('does attach the "orphan" boolean to non-orphan modules with the value "false"', () => { + deepEqual( + deriveOrphans(TWO_MODULES_FIXTURE, {}), + TWO_MODULES_AFTER_PROCESSING, + ); + }); + + it("does not attach any orphan attribute when the rule set doesn't have an orphan rule and skipAnalysisNotInRules=true", () => { + deepEqual( + deriveOrphans(ONE_MODULE_FIXTURE, { + skipAnalysisNotInRules: true, + ruleSet: {}, + }), + ONE_MODULE_FIXTURE, + ); }); }); diff --git a/test/main/__fixtures__/cruise-reporterless/metrics.json b/test/main/__fixtures__/cruise-reporterless/metrics.json index 019cd1d01..5afdc045d 100644 --- a/test/main/__fixtures__/cruise-reporterless/metrics.json +++ b/test/main/__fixtures__/cruise-reporterless/metrics.json @@ -4,7 +4,6 @@ "input": { "fileName": "test/main/__mocks__/cruise-reporterless/metrics/root.js", "options": { - "forceDeriveDependents": false, "metrics": true } }, diff --git a/test/main/__fixtures__/jsx-as-object.json b/test/main/__fixtures__/jsx-as-object.json index d79929cef..1edce394d 100644 --- a/test/main/__fixtures__/jsx-as-object.json +++ b/test/main/__fixtures__/jsx-as-object.json @@ -8,11 +8,11 @@ "moduleSystem": "cjs", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/jsx/jsx.jsx", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -30,11 +30,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "components/pay-method-choice", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -44,11 +44,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "components/product-detail", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -58,11 +58,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "products", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -72,11 +72,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "react", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -86,11 +86,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "tracking", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -100,11 +100,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "utils", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -203,6 +203,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/main/__mocks__/jsx" }, diff --git a/test/main/__fixtures__/jsx.json b/test/main/__fixtures__/jsx.json index 2ca41b97e..78cc4fb89 100644 --- a/test/main/__fixtures__/jsx.json +++ b/test/main/__fixtures__/jsx.json @@ -8,11 +8,11 @@ "moduleSystem": "cjs", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/jsx/jsx.jsx", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -30,11 +30,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "components/pay-method-choice", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -44,11 +44,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "components/product-detail", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -58,11 +58,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "products", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -72,11 +72,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "react", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -86,11 +86,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "tracking", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -100,11 +100,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "utils", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -203,6 +203,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/main/__mocks__/jsx" } diff --git a/test/main/__fixtures__/ts-no-precomp-cjs.json b/test/main/__fixtures__/ts-no-precomp-cjs.json index 4b97ba10f..7c1b029af 100644 --- a/test/main/__fixtures__/ts-no-precomp-cjs.json +++ b/test/main/__fixtures__/ts-no-precomp-cjs.json @@ -33,11 +33,11 @@ "moduleSystem": "cjs", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/ts-precompilation-deps-off-cjs/also-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -47,11 +47,11 @@ "moduleSystem": "cjs", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/ts-precompilation-deps-off-cjs/definitely-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -78,12 +78,10 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, - "tsConfig": { - "fileName": "test/main/__mocks__/tsconfig.targetcjs.json" - }, + "skipAnalysisNotInRules": false, + "tsConfig": { "fileName": "test/main/__mocks__/tsconfig.targetcjs.json" }, "tsPreCompilationDeps": false, - "args": "test/main/__mocks__/ts-precompilation-deps-off-cjs", - "baseDir": "" + "args": "test/main/__mocks__/ts-precompilation-deps-off-cjs" } } } diff --git a/test/main/__fixtures__/ts-no-precomp-es.json b/test/main/__fixtures__/ts-no-precomp-es.json index 59b9ce95c..a06d7bca0 100644 --- a/test/main/__fixtures__/ts-no-precomp-es.json +++ b/test/main/__fixtures__/ts-no-precomp-es.json @@ -33,11 +33,11 @@ "moduleSystem": "cjs", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/ts-precompilation-deps-off-es/also-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -47,11 +47,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts-precompilation-deps-off-es/definitely-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -78,12 +78,10 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, - "tsConfig": { - "fileName": "test/main/__mocks__/tsconfig.targetes.json" - }, + "skipAnalysisNotInRules": false, + "tsConfig": { "fileName": "test/main/__mocks__/tsconfig.targetes.json" }, "tsPreCompilationDeps": false, - "args": "test/main/__mocks__/ts-precompilation-deps-off-es", - "baseDir": "" + "args": "test/main/__mocks__/ts-precompilation-deps-off-es" } } } diff --git a/test/main/__fixtures__/ts-precomp-cjs.json b/test/main/__fixtures__/ts-precomp-cjs.json index 2ca018e5b..5e37aa66d 100644 --- a/test/main/__fixtures__/ts-precomp-cjs.json +++ b/test/main/__fixtures__/ts-precomp-cjs.json @@ -35,11 +35,11 @@ "module": "./also-used", "moduleSystem": "cjs", "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-cjs/also-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -49,11 +49,11 @@ "module": "./definitely-used", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-cjs/definitely-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -63,11 +63,11 @@ "module": "./imported-from-index-but-not-used", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-cjs/imported-from-index-but-not-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -94,9 +94,8 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, - "tsConfig": { - "fileName": "test/main/__mocks__/tsconfig.targetcjs.json" - }, + "skipAnalysisNotInRules": false, + "tsConfig": { "fileName": "test/main/__mocks__/tsconfig.targetcjs.json" }, "tsPreCompilationDeps": true, "args": "test/main/__mocks__/ts-precompilation-deps-on-cjs" } diff --git a/test/main/__fixtures__/ts-precomp-es.json b/test/main/__fixtures__/ts-precomp-es.json index 63c8dfc3d..142d2ad07 100644 --- a/test/main/__fixtures__/ts-precomp-es.json +++ b/test/main/__fixtures__/ts-precomp-es.json @@ -35,11 +35,11 @@ "module": "./also-used", "moduleSystem": "cjs", "exoticallyRequired": false, + "dependencyTypes": ["local", "require"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-es/also-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "require"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -49,11 +49,11 @@ "module": "./definitely-used", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-es/definitely-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -63,11 +63,11 @@ "module": "./imported-from-index-but-not-used", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts-precompilation-deps-on-es/imported-from-index-but-not-used.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -94,9 +94,8 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, - "tsConfig": { - "fileName": "test/main/__mocks__/tsconfig.targetes.json" - }, + "skipAnalysisNotInRules": false, + "tsConfig": { "fileName": "test/main/__mocks__/tsconfig.targetes.json" }, "tsPreCompilationDeps": true, "args": "test/main/__mocks__/ts-precompilation-deps-on-es" } diff --git a/test/main/__fixtures__/ts.json b/test/main/__fixtures__/ts.json index 7aa237718..0adee2b06 100644 --- a/test/main/__fixtures__/ts.json +++ b/test/main/__fixtures__/ts.json @@ -8,11 +8,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts/javascriptThing.js", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -22,11 +22,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts/sub/index.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -36,11 +36,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts/sub/kaching.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -50,11 +50,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "export"], "resolved": "test/main/__mocks__/ts/sub/willBeReExported.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "export"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -64,11 +64,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["core", "import"], "resolved": "path", "coreModule": true, "followable": false, "couldNotResolve": false, - "dependencyTypes": ["core", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -105,11 +105,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/ts/sub/willBeReExported.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -153,6 +153,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/main/__mocks__/ts" } diff --git a/test/main/__fixtures__/tsx.json b/test/main/__fixtures__/tsx.json index c9f5a0753..a06c3baf3 100644 --- a/test/main/__fixtures__/tsx.json +++ b/test/main/__fixtures__/tsx.json @@ -8,11 +8,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "test/main/__mocks__/tsx/sub/render.tsx", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -30,11 +30,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["unknown"], "resolved": "react-dom", "coreModule": false, "followable": false, "couldNotResolve": true, - "dependencyTypes": ["unknown"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -73,6 +73,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/main/__mocks__/tsx" } diff --git a/test/main/__mocks__/collapse-after-cruise/expected-result.json b/test/main/__mocks__/collapse-after-cruise/expected-result.json index a453dad3c..02f203f51 100644 --- a/test/main/__mocks__/collapse-after-cruise/expected-result.json +++ b/test/main/__mocks__/collapse-after-cruise/expected-result.json @@ -182,6 +182,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "test/main/__mocks__/collapse-after-cruise" }, diff --git a/test/main/__mocks__/dynamic-imports/es/output.json b/test/main/__mocks__/dynamic-imports/es/output.json index 8097b8911..bf94fe476 100644 --- a/test/main/__mocks__/dynamic-imports/es/output.json +++ b/test/main/__mocks__/dynamic-imports/es/output.json @@ -8,18 +8,15 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/index.js", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ - { - "name": "src/index.js", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.js", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.js", "dependencyTypes": ["local", "import"] @@ -45,11 +42,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/dynamic-to-circular.js", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -61,10 +58,7 @@ "name": "src/circular.js", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.js", - "dependencyTypes": ["local", "import"] - } + { "name": "src/index.js", "dependencyTypes": ["local", "import"] } ], "valid": false, "rules": [{ "severity": "info", "name": "no-circular" }] @@ -82,11 +76,11 @@ "moduleSystem": "es6", "dynamic": true, "exoticallyRequired": false, + "dependencyTypes": ["local", "dynamic-import"], "resolved": "src/circular.js", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "dynamic-import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -94,10 +88,7 @@ "name": "src/circular.js", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.js", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.js", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.js", "dependencyTypes": ["local", "import"] @@ -126,10 +117,7 @@ "to": "src/index.js", "rule": { "severity": "info", "name": "no-circular" }, "cycle": [ - { - "name": "src/index.js", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.js", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.js", "dependencyTypes": ["local", "import"] @@ -155,6 +143,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "src", "baseDir": "test/main/__mocks__/dynamic-imports/es" diff --git a/test/main/__mocks__/dynamic-imports/typescript/output-pre-compilation-deps.json b/test/main/__mocks__/dynamic-imports/typescript/output-pre-compilation-deps.json index 78edf6c13..cf66dd772 100644 --- a/test/main/__mocks__/dynamic-imports/typescript/output-pre-compilation-deps.json +++ b/test/main/__mocks__/dynamic-imports/typescript/output-pre-compilation-deps.json @@ -8,18 +8,15 @@ "module": "./index", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/index.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -45,11 +42,11 @@ "module": "./dynamic-to-circular", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/dynamic-to-circular.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -61,10 +58,7 @@ "name": "src/circular.ts", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - } + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] } ], "valid": false, "rules": [{ "severity": "info", "name": "no-circular" }] @@ -82,11 +76,11 @@ "module": "./circular", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["local", "dynamic-import"], "resolved": "src/circular.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "dynamic-import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -94,10 +88,7 @@ "name": "src/circular.ts", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -126,10 +117,7 @@ "to": "src/index.ts", "rule": { "severity": "info", "name": "no-circular" }, "cycle": [ - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -155,6 +143,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": true, "args": "src", "baseDir": "test/main/__mocks__/dynamic-imports/typescript" diff --git a/test/main/__mocks__/dynamic-imports/typescript/output.json b/test/main/__mocks__/dynamic-imports/typescript/output.json index cab759020..637156c31 100644 --- a/test/main/__mocks__/dynamic-imports/typescript/output.json +++ b/test/main/__mocks__/dynamic-imports/typescript/output.json @@ -8,18 +8,15 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/index.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -45,11 +42,11 @@ "moduleSystem": "es6", "dynamic": false, "exoticallyRequired": false, + "dependencyTypes": ["local", "import"], "resolved": "src/dynamic-to-circular.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -61,10 +58,7 @@ "name": "src/circular.ts", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - } + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] } ], "valid": false, "rules": [{ "severity": "info", "name": "no-circular" }] @@ -82,11 +76,11 @@ "moduleSystem": "es6", "dynamic": true, "exoticallyRequired": false, + "dependencyTypes": ["local", "dynamic-import"], "resolved": "src/circular.ts", "coreModule": false, "followable": true, "couldNotResolve": false, - "dependencyTypes": ["local", "dynamic-import"], "matchesDoNotFollow": false, "circular": true, "cycle": [ @@ -94,10 +88,7 @@ "name": "src/circular.ts", "dependencyTypes": ["local", "dynamic-import"] }, - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -126,10 +117,7 @@ "to": "src/index.ts", "rule": { "severity": "info", "name": "no-circular" }, "cycle": [ - { - "name": "src/index.ts", - "dependencyTypes": ["local", "import"] - }, + { "name": "src/index.ts", "dependencyTypes": ["local", "import"] }, { "name": "src/dynamic-to-circular.ts", "dependencyTypes": ["local", "import"] @@ -155,6 +143,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "src", "baseDir": "test/main/__mocks__/dynamic-imports/typescript" diff --git a/test/main/__mocks__/type-only-imports/output-with-rules.json b/test/main/__mocks__/type-only-imports/output-with-rules.json index 5626242b7..6f0ac79c0 100644 --- a/test/main/__mocks__/type-only-imports/output-with-rules.json +++ b/test/main/__mocks__/type-only-imports/output-with-rules.json @@ -54,6 +54,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": true, "args": "src", "baseDir": "test/main/__mocks__/type-only-imports" diff --git a/test/main/__mocks__/type-only-imports/output.json b/test/main/__mocks__/type-only-imports/output.json index 83378689e..781e2b94d 100644 --- a/test/main/__mocks__/type-only-imports/output.json +++ b/test/main/__mocks__/type-only-imports/output.json @@ -46,6 +46,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": true, "args": "src", "baseDir": "test/main/__mocks__/type-only-imports" diff --git a/test/main/__mocks__/type-only-module-references/output-no-ts.json b/test/main/__mocks__/type-only-module-references/output-no-ts.json index 8cd4e5da7..204256f6f 100644 --- a/test/main/__mocks__/type-only-module-references/output-no-ts.json +++ b/test/main/__mocks__/type-only-module-references/output-no-ts.json @@ -24,6 +24,7 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": false, "args": "src", "baseDir": "test/main/__mocks__/type-only-module-references" diff --git a/test/main/__mocks__/type-only-module-references/output.json b/test/main/__mocks__/type-only-module-references/output.json index 06597d785..64a22ad40 100644 --- a/test/main/__mocks__/type-only-module-references/output.json +++ b/test/main/__mocks__/type-only-module-references/output.json @@ -8,12 +8,12 @@ "module": "graphql/tsutils/Maybe", "moduleSystem": "es6", "exoticallyRequired": false, + "dependencyTypes": ["npm-no-pkg", "import"], "resolved": "node_modules/@types/graphql/tsutils/Maybe.d.ts", "coreModule": false, "followable": true, "couldNotResolve": false, "license": "MIT", - "dependencyTypes": ["npm-no-pkg", "import"], "matchesDoNotFollow": false, "circular": false, "valid": true @@ -47,9 +47,10 @@ "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], "preserveSymlinks": false, + "skipAnalysisNotInRules": false, "tsPreCompilationDeps": true, "args": "src", "baseDir": "test/main/__mocks__/type-only-module-references" } } -} +} \ No newline at end of file diff --git a/test/main/main.cruise-reporterless.spec.mjs b/test/main/main.cruise-reporterless.spec.mjs index fbfd93756..2538c83a4 100644 --- a/test/main/main.cruise-reporterless.spec.mjs +++ b/test/main/main.cruise-reporterless.spec.mjs @@ -37,7 +37,7 @@ function runFixture(pFixture) { it(pFixture.title, async () => { let lResult = await cruise( [pFixture.input.fileName], - { forceDeriveDependents: true, ...pFixture.input.options }, + pFixture.input.options, { bustTheCache: true, resolveLicenses: true, diff --git a/tools/schema/options-used.mjs b/tools/schema/options-used.mjs index 32f5b0693..869b92090 100644 --- a/tools/schema/options-used.mjs +++ b/tools/schema/options-used.mjs @@ -64,6 +64,9 @@ export default { experimentalStats: { type: "boolean", }, + skipAnalysisNotInRules: { + type: "boolean", + }, // for backwards compatibility reasons can be either a string, false // or an object in the input, but for internal processing and output // always put as an object diff --git a/tools/schema/options.mjs b/tools/schema/options.mjs index e19ac24e9..a0e54142a 100644 --- a/tools/schema/options.mjs +++ b/tools/schema/options.mjs @@ -219,7 +219,12 @@ export default { }, forceDeriveDependents: { type: "boolean", + deprecated: true, description: + "Hasn't had any effect on dependency-cruiser's behaviour since a few major " + + "versions ago. If there's a need to manipulate this use the `skipAnalysisNotInRules` " + + "option in stead." + + "Previously documented behaviour: " + "When true includes de-normalized dependents in the cruise-result, even " + "though there's no rule in the rule set that requires them. Defaults to false.", }, @@ -434,6 +439,17 @@ export default { "Will be renamed when the 'experimental' state is lifted. " + "Defaults to false.", }, + skipAnalysisNotInRules: { + type: "boolean", + description: + "When this flag is set to true, dependency-cruiser will skip all analysis " + + "that don't serve a rule. E.g. if there's no 'circular' rule in the rule set " + + "it won't analyse cycles. This flag affects cycle, dependents and orphan " + + "analysis. If you have a rule set that doesn't use one of these " + + "features, switching it to true will make cruises faster. " + + "Defaults to false for backwards compatibility. For most uses of dependency-cruiser " + + "we recommend to switch this option to true, though.", + }, baseDir: { type: "string", description: diff --git a/types/options.d.mts b/types/options.d.mts index f3e3c6f1c..2c2313927 100644 --- a/types/options.d.mts +++ b/types/options.d.mts @@ -227,8 +227,15 @@ export interface ICruiseOptions { add: string[]; }; /** - * When true includes denormalized dependents in the cruise-result, even - * though there's no rule in the rule set that requires them. Defaults to false. + * @deprecated + * + * Hasn't had any effect on dependency-cruiser's behaviour since a few major + * versions ago. If there's a need to manipulate this use the `skipAnalysisNotInRules` + * option in stead. + * + * Previously documented behavior: + * > When true includes denormalized dependents in the cruise-result, even + * > though there's no rule in the rule set that requires them. Defaults to false. */ forceDeriveDependents?: boolean; /** @@ -383,13 +390,26 @@ export interface ICruiseOptions { metrics?: boolean; /** - * When this flag is set to true, dependency-cruiser will calculate some " + - * stats for each module. Has some performance impact. EXPERIMENTAL " + - * Will be renamed when the 'experimental' state is lifted." + - * Defaults to false.",* + * When this flag is set to true, dependency-cruiser will calculate some + * stats for each module. Has some performance impact. EXPERIMENTAL + * Will be renamed when the 'experimental' state is lifted. + * + * Defaults to false. */ experimentalStats?: boolean; + /** + * When this flag is set to true, dependency-cruiser will skip all analysis + * that don't serve a rule. E.g. if there's no 'circular' rule in the rule set + * it won't analyse cycles. This flag affects cycle, dependents, orphan, and + * reachability analysis. If you have a rule set that doesn't use one of these + * features, switching it to true will make cruises faster. + * + * Defaults to false for backwards compatibility - for most uses of + * dependency-cruiser we recommend to switch this option to true, though. + */ + skipAnalysisNotInRules?: boolean; + /** * - false: don't use caching. * - true or empty object: use caching with the default settings