From 9181599cf65881f6e7a7bcd36013a03f3f936832 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sat, 16 Nov 2024 20:46:05 +0100 Subject: [PATCH 01/12] feat(extract): adds recognition of jsdoc @import type imports --- src/extract/tsc/extract-typescript-deps.mjs | 48 +++++++++++++++- src/schema/baseline-violations.schema.json | 1 + src/schema/baseline-violations.schema.mjs | 2 +- src/schema/configuration.schema.json | 1 + src/schema/configuration.schema.mjs | 2 +- src/schema/cruise-result.schema.json | 1 + src/schema/cruise-result.schema.mjs | 2 +- test/extract/tsc/jsdoc-import-tags.spec.mjs | 62 +++++++++++++++++++++ tools/schema/dependency-type.mjs | 1 + types/shared-types.d.mts | 1 + 10 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 test/extract/tsc/jsdoc-import-tags.spec.mjs diff --git a/src/extract/tsc/extract-typescript-deps.mjs b/src/extract/tsc/extract-typescript-deps.mjs index 640352889..8f020bf44 100644 --- a/src/extract/tsc/extract-typescript-deps.mjs +++ b/src/extract/tsc/extract-typescript-deps.mjs @@ -1,3 +1,4 @@ +/* eslint-disable unicorn/prevent-abbreviations */ /* eslint-disable max-lines */ /* eslint-disable no-inline-comments */ import tryImport from "#utl/try-import.mjs"; @@ -24,7 +25,7 @@ function isTypeOnlyImport(pStatement) { function isTypeOnlyExport(pStatement) { return ( // for some reason the isTypeOnly indicator is on _statement_ level - // and not in exportClause as it is in the importClause ¯\_ (ツ)_/¯. + // and not in exportClause as it is in the importClause ¯\_(ツ)_/¯. // Also in the case of the omission of an alias the exportClause // is not there entirely. So regardless whether there is a // pStatement.exportClause or not, we can directly test for the @@ -252,7 +253,33 @@ function isTypeImport(pASTNode) { "FirstTemplateToken") ); } + +function extractJSDocImportTags(pJSDocTags) { + return pJSDocTags + .filter( + (pTag) => + pTag.tagName.escapedText === "import" && + pTag.moduleSpecifier?.kind && + typescript.SyntaxKind[pTag.moduleSpecifier.kind] === "StringLiteral" && + Boolean(pTag.moduleSpecifier.text), + ) + .map((pTag) => ({ + module: pTag.moduleSpecifier.text, + moduleSystem: "es6", + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc-import"], + })); +} + +function extractJSDocImports(pJSDocNodes) { + return pJSDocNodes + .filter((pJSDocLine) => Boolean(pJSDocLine.tags)) + .flatMap((pJSDocLine) => extractJSDocImportTags(pJSDocLine.tags)); +} + +// eslint-disable-next-line max-lines-per-function function walk(pResult, pExoticRequireStrings) { + // eslint-disable-next-line max-lines-per-function return (pASTNode) => { // require('a-string'), require(`a-template-literal`) if (isRequireCallExpression(pASTNode)) { @@ -298,6 +325,24 @@ function walk(pResult, pExoticRequireStrings) { dependencyTypes: ["type-import"], }); } + + // /** @import thing from './module' */ + // /** @import {thing} from './module' */ + // /** @import * as thing from './module' */ + // devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag + // + // TODO: all the kinds of tags that can have import statements as type declarations + // (e.g. @type, @param, @returns, @typedef, @property, @prop, @arg, ...) + // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html + if (pASTNode.jsDoc) { + const lJSDocImports = extractJSDocImports(pASTNode.jsDoc); + + // pResult = pResult.concat(lJSDocImports) looks like the more obvious + // way to do this, but it re-assigns the pResult parameter + lJSDocImports.forEach((pImport) => { + pResult.push(pImport); + }); + } typescript.forEachChild(pASTNode, walk(pResult, pExoticRequireStrings)); }; } @@ -326,6 +371,7 @@ export default function extractTypeScriptDependencies( pTypeScriptAST, pExoticRequireStrings, ) { + // console.dir(pTypeScriptAST, { depth: 100 }); return Boolean(typescript) ? extractImports(pTypeScriptAST) .concat(extractExports(pTypeScriptAST)) diff --git a/src/schema/baseline-violations.schema.json b/src/schema/baseline-violations.schema.json index 11eaa0300..0213670d3 100644 --- a/src/schema/baseline-violations.schema.json +++ b/src/schema/baseline-violations.schema.json @@ -116,6 +116,7 @@ "export", "import-equals", "import", + "jsdoc-import", "local", "localmodule", "npm-bundled", diff --git a/src/schema/baseline-violations.schema.mjs b/src/schema/baseline-violations.schema.mjs index 6d3123f71..aa34242ec 100644 --- a/src/schema/baseline-violations.schema.mjs +++ b/src/schema/baseline-violations.schema.mjs @@ -1 +1 @@ -/* generated - don't edit */export default{title:"dependency-cruiser baseline ('known errors') format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json",$ref:"#/definitions/ViolationsType",definitions:{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"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},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"}}}},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","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"]}}}; \ No newline at end of file +/* generated - don't edit */export default{title:"dependency-cruiser baseline ('known errors') format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json",$ref:"#/definitions/ViolationsType",definitions:{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"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},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"}}}},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-import","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"]}}}; \ No newline at end of file diff --git a/src/schema/configuration.schema.json b/src/schema/configuration.schema.json index c7c5201a8..fa654e3dd 100644 --- a/src/schema/configuration.schema.json +++ b/src/schema/configuration.schema.json @@ -434,6 +434,7 @@ "export", "import-equals", "import", + "jsdoc-import", "local", "localmodule", "npm-bundled", diff --git a/src/schema/configuration.schema.mjs b/src/schema/configuration.schema.mjs index 153755388..763a99c2f 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"}}},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","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"},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"}}},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-import","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"},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 diff --git a/src/schema/cruise-result.schema.json b/src/schema/cruise-result.schema.json index 7a0d475b0..eeffb5dab 100644 --- a/src/schema/cruise-result.schema.json +++ b/src/schema/cruise-result.schema.json @@ -285,6 +285,7 @@ "export", "import-equals", "import", + "jsdoc-import", "local", "localmodule", "npm-bundled", diff --git a/src/schema/cruise-result.schema.mjs b/src/schema/cruise-result.schema.mjs index f5d63a76c..e2723b005 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","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"}}},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"},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-import","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"}}},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"},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 diff --git a/test/extract/tsc/jsdoc-import-tags.spec.mjs b/test/extract/tsc/jsdoc-import-tags.spec.mjs new file mode 100644 index 000000000..a12f59f35 --- /dev/null +++ b/test/extract/tsc/jsdoc-import-tags.spec.mjs @@ -0,0 +1,62 @@ +import { deepEqual } from "node:assert/strict"; +import extractTypescript from "./extract-typescript.utl.mjs"; + +describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { + it("extracts jsdoc @import ('as' variant)", () => { + deepEqual(extractTypescript("/** @import * as fs from 'node:fs' */"), [ + { + module: "node:fs", + moduleSystem: "es6", + dynamic: false, + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc-import"], + }, + ]); + }); + + it("extracts jsdoc @import ('qualified' variant)", () => { + deepEqual( + extractTypescript("/** @import {thing, thang} from './hello.mjs' */"), + [ + { + module: "./hello.mjs", + moduleSystem: "es6", + dynamic: false, + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc-import"], + }, + ], + ); + }); + + it("extracts jsdoc @import ('default import' variant)", () => { + deepEqual(extractTypescript("/** @import thing from './hello.mjs' */"), [ + { + module: "./hello.mjs", + moduleSystem: "es6", + dynamic: false, + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc-import"], + }, + ]); + }); + + it("does not extract imports where the module name isn't a string (identifier variant) ", () => { + deepEqual( + extractTypescript("/** @import {thing} from anIdentifier */"), + [], + ); + }); + + it("does not extract imports where the module name isn't a string (number variant) ", () => { + deepEqual(extractTypescript("/** @import {thing} from 481 */"), []); + }); + + it("does not extract imports where the module name isn't a string (boolean variant) ", () => { + deepEqual(extractTypescript("/** @import {thing} from true */"), []); + }); + + it("does not extract imports where the module name isn't a string (nothing variant) ", () => { + deepEqual(extractTypescript("/** @import {thing} from */"), []); + }); +}); diff --git a/tools/schema/dependency-type.mjs b/tools/schema/dependency-type.mjs index 23ffcb56b..0d74fb7b5 100644 --- a/tools/schema/dependency-type.mjs +++ b/tools/schema/dependency-type.mjs @@ -20,6 +20,7 @@ export default { "export", "import-equals", "import", + "jsdoc-import", "local", "localmodule", "npm-bundled", diff --git a/types/shared-types.d.mts b/types/shared-types.d.mts index 89809111b..af02b8559 100644 --- a/types/shared-types.d.mts +++ b/types/shared-types.d.mts @@ -52,6 +52,7 @@ export type DependencyType = | "export" | "import-equals" | "import" + | "jsdoc-import" | "local" | "localmodule" | "npm-bundled" From f1ad54ef27c43727af1504cda0c748e169c90472 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 11:32:28 +0100 Subject: [PATCH 02/12] changes dependencyType names for the flavors of jsdoc imports --- src/extract/tsc/extract-typescript-deps.mjs | 4 ++-- src/schema/baseline-violations.schema.json | 4 +++- src/schema/baseline-violations.schema.mjs | 2 +- src/schema/configuration.schema.json | 4 +++- src/schema/configuration.schema.mjs | 2 +- src/schema/cruise-result.schema.json | 4 +++- src/schema/cruise-result.schema.mjs | 2 +- test/extract/tsc/jsdoc-import-tags.spec.mjs | 20 +++++++++++++++++--- tools/schema/dependency-type.mjs | 4 +++- types/shared-types.d.mts | 4 +++- 10 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/extract/tsc/extract-typescript-deps.mjs b/src/extract/tsc/extract-typescript-deps.mjs index 8f020bf44..059aa0edc 100644 --- a/src/extract/tsc/extract-typescript-deps.mjs +++ b/src/extract/tsc/extract-typescript-deps.mjs @@ -267,7 +267,7 @@ function extractJSDocImportTags(pJSDocTags) { module: pTag.moduleSpecifier.text, moduleSystem: "es6", exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc-import"], + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], })); } @@ -329,7 +329,7 @@ function walk(pResult, pExoticRequireStrings) { // /** @import thing from './module' */ // /** @import {thing} from './module' */ // /** @import * as thing from './module' */ - // devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag + // see https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag // // TODO: all the kinds of tags that can have import statements as type declarations // (e.g. @type, @param, @returns, @typedef, @property, @prop, @arg, ...) diff --git a/src/schema/baseline-violations.schema.json b/src/schema/baseline-violations.schema.json index 0213670d3..e0b82614e 100644 --- a/src/schema/baseline-violations.schema.json +++ b/src/schema/baseline-violations.schema.json @@ -116,7 +116,9 @@ "export", "import-equals", "import", - "jsdoc-import", + "jsdoc", + "jsdoc-bracket-import", + "jsdoc-import-tag", "local", "localmodule", "npm-bundled", diff --git a/src/schema/baseline-violations.schema.mjs b/src/schema/baseline-violations.schema.mjs index aa34242ec..53f1066eb 100644 --- a/src/schema/baseline-violations.schema.mjs +++ b/src/schema/baseline-violations.schema.mjs @@ -1 +1 @@ -/* generated - don't edit */export default{title:"dependency-cruiser baseline ('known errors') format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json",$ref:"#/definitions/ViolationsType",definitions:{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"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},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"}}}},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-import","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"]}}}; \ No newline at end of file +/* generated - don't edit */export default{title:"dependency-cruiser baseline ('known errors') format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json",$ref:"#/definitions/ViolationsType",definitions:{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"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},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"}}}},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"]}}}; \ No newline at end of file diff --git a/src/schema/configuration.schema.json b/src/schema/configuration.schema.json index fa654e3dd..07edab31e 100644 --- a/src/schema/configuration.schema.json +++ b/src/schema/configuration.schema.json @@ -434,7 +434,9 @@ "export", "import-equals", "import", - "jsdoc-import", + "jsdoc", + "jsdoc-bracket-import", + "jsdoc-import-tag", "local", "localmodule", "npm-bundled", diff --git a/src/schema/configuration.schema.mjs b/src/schema/configuration.schema.mjs index 763a99c2f..bd9c8fa46 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"}}},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-import","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"},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"}}},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"},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 diff --git a/src/schema/cruise-result.schema.json b/src/schema/cruise-result.schema.json index eeffb5dab..3ce02b2d7 100644 --- a/src/schema/cruise-result.schema.json +++ b/src/schema/cruise-result.schema.json @@ -285,7 +285,9 @@ "export", "import-equals", "import", - "jsdoc-import", + "jsdoc", + "jsdoc-bracket-import", + "jsdoc-import-tag", "local", "localmodule", "npm-bundled", diff --git a/src/schema/cruise-result.schema.mjs b/src/schema/cruise-result.schema.mjs index e2723b005..162b18c30 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-import","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"}}},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"},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"}}},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"},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 diff --git a/test/extract/tsc/jsdoc-import-tags.spec.mjs b/test/extract/tsc/jsdoc-import-tags.spec.mjs index a12f59f35..fa1dae01c 100644 --- a/test/extract/tsc/jsdoc-import-tags.spec.mjs +++ b/test/extract/tsc/jsdoc-import-tags.spec.mjs @@ -9,7 +9,7 @@ describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { moduleSystem: "es6", dynamic: false, exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc-import"], + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], }, ]); }); @@ -23,7 +23,7 @@ describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { moduleSystem: "es6", dynamic: false, exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc-import"], + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], }, ], ); @@ -36,7 +36,7 @@ describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { moduleSystem: "es6", dynamic: false, exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc-import"], + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], }, ]); }); @@ -59,4 +59,18 @@ describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { it("does not extract imports where the module name isn't a string (nothing variant) ", () => { deepEqual(extractTypescript("/** @import {thing} from */"), []); }); + + it("does not extract imports with dynamic looking imports (@import {import('./ting.mjs')})", () => { + deepEqual( + extractTypescript("/** @import {import('./thing.mjs').thing} */"), + [], + ); + }); + + it("does not extract imports with dynamic looking imports (@type {import('./ting.mjs')})", () => { + deepEqual( + extractTypescript("/** @type {import('./thing.mjs').thing} */"), + [], + ); + }); }); diff --git a/tools/schema/dependency-type.mjs b/tools/schema/dependency-type.mjs index 0d74fb7b5..faf2e5737 100644 --- a/tools/schema/dependency-type.mjs +++ b/tools/schema/dependency-type.mjs @@ -20,7 +20,9 @@ export default { "export", "import-equals", "import", - "jsdoc-import", + "jsdoc", + "jsdoc-bracket-import", + "jsdoc-import-tag", "local", "localmodule", "npm-bundled", diff --git a/types/shared-types.d.mts b/types/shared-types.d.mts index af02b8559..b8353a530 100644 --- a/types/shared-types.d.mts +++ b/types/shared-types.d.mts @@ -52,7 +52,9 @@ export type DependencyType = | "export" | "import-equals" | "import" - | "jsdoc-import" + | "jsdoc" + | "jsdoc-bracket-import" + | "jsdoc-import-tag" | "local" | "localmodule" | "npm-bundled" From 7c46e72cf7753d78887b18a2df8838a8b13ed33c Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 11:35:53 +0100 Subject: [PATCH 03/12] documents the above + the detectJSDocImports option from the next commit --- doc/options-reference.md | 28 +++++++++++++++++++++ doc/rules-reference.md | 53 +++++++++++++++++++++------------------- 2 files changed, 56 insertions(+), 25 deletions(-) diff --git a/doc/options-reference.md b/doc/options-reference.md index 89d13f568..13524f4b2 100644 --- a/doc/options-reference.md +++ b/doc/options-reference.md @@ -15,6 +15,7 @@ - [`tsConfig`: use a TypeScript configuration file ('project')](#tsconfig-use-a-typescript-configuration-file-project) - [`babelConfig`: use a babel configuration file](#babelconfig-use-a-babel-configuration-file) - [`webpackConfig`: use (the resolution options of) a webpack configuration](#webpackconfig-use-the-resolution-options-of-a-webpack-configuration) + - [`detectJSDocImports`: detect dependencies in JSDoc comments](#detectjsdocimports-detect-dependencies-in-jsdoc-comments) - [Yarn Plug'n'Play support - `externalModuleResolutionStrategy`](#yarn-plugnplay-support---externalmoduleresolutionstrategy) - [`prefix`: prefix links in reports](#prefix-prefix-links-in-reports) - [`reporterOptions`](#reporteroptions) @@ -784,6 +785,33 @@ you can provide the parameters like so: - :bulb: For more information check out the the [webpack resolve](https://webpack.js.org/configuration/resolve/) documentation. +### `detectJSDocImports`: detect dependencies in JSDoc comments + +> :shell: there is no command line equivalent for this + +If you have dependencies in JSDoc comments that you want to take into account +you can set this option to `true`. This will make dependency-cruiser look at +TypeScript 5.5+ [`@import` tags](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag) +as well as to bracket style imports (e.g. `/** @type {import('./thing').SomeType} */`) +in all JSDoc tags they can occur in (e.g. `@param`, `@returns`, `@type`, `@typedef` etc). + +As currently on the TypeScript compiler (`tsc`) can detect these imports, switching +on this option implies dependency-cruiser will set `options.parser` to `tsc` so +it uses the TypeScript compiler to parse not only TypeScript but also JavaScript. + +```json +"options": { + "detectJSDocImports": true // implies `parser: "tsc"` +} +``` + +#### Usage notes + +- :bulb: Only TypeScript compilers 5.5 and up can detect `@import` tags. +- :bulb: If you want to take imports in JSDoc comments in consideration you + will need the `typescript` compiler in your (dev-)dependencies as it's currently + the only parser that supports these. + ### Yarn Plug'n'Play support - `externalModuleResolutionStrategy` > :shell: there is no command line equivalent for this diff --git a/doc/rules-reference.md b/doc/rules-reference.md index 0f676a5c9..cfeb4775d 100644 --- a/doc/rules-reference.md +++ b/doc/rules-reference.md @@ -984,31 +984,34 @@ the dependency was declared. One or more of these can occur at the same time. E. dependency which resolves to a base url in a tsconfig.json you'll see `import`, `aliased` as well as `aliased-tsconfig` and `aliased-tsconfig-base-url`. -| dependency type | meaning the module was imported ... | example | -| --------------------------- | ---------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- | -| aliased | via an alias of some sort (e.g. tsconfig paths, subpath imports, npm workspace or webpack aliases) | "~/hello.ts" | -| aliased-subpath-import | via a [subpath import](https://nodejs.org/api/packages.html#subpath-imports) | "#thing/hello.mjs" | -| aliased-tsconfig | via a typescript compilerOptions.paths or compilerOptions.baseUrl setting in tsconfig. | "@thing/hello" | -| aliased-tsconfig-base-url | via a typescript [compilerOptions.baseUrl setting in tsconfig](https://www.typescriptlang.org/tsconfig#baseUrl) | "libs/utensils/src/hello.js" | -| aliased-tsconfig-paths | via a typescript [compilerOptions.paths setting in tsconfig](https://www.typescriptlang.org/tsconfig#paths) | "@thing/hello" | -| aliased-webpack | via a [webpack resolve alias](https://webpack.js.org/configuration/resolve/#resolvealias) | "Utilities" | -| aliased-workspace | via a [workspace](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#workspaces) | "local-workspace-package" | -| amd-define | with an AMD `define` wrapper (popularized by requirejs) | `define(["./thing"], function(thing){ /* do stuff */ })` | -| amd-require | with a require statement within an AMD module | `define(function(require, exports, module){ var one = require('./thing')})` | -| amd-exotic-require | with a require statement within an AMD module (but with the first parameter baring an insensible non-standard name) | `define(function(want, exports, module){ var one = want('./thing')})` | -| type-only | as 'type only' - only available for TypeScript sources, only for tsPreCompilationDeps !== false. | `import type { IThing } from "./things"` | -| export | implicitly via a module export | `export { thing } from "./things"` | -| import | with a 'regular' ES import | `import { thing } from "./things` | -| dynamic-import | with a dynamic import statement | `const { thing } = await import("./things")` | -| import-equals | with an 'import equals' statement | `import fs = require("fs")` | -| type-import | as part of a type declaration | `const lAThing: import('./things').IThing = {}` | -| require | with a commonjs 'require' statement | `const memoize = require("lodash/memoize")` | -| exotic-require | with a statement that isn't 'require' see [exoticallyRequired](#exoticallyrequired-exoticrequire-and-exoticrequirenot) | `const { thing } = want("./thing")` | -| triple-slash-directive | with a triple slash directive (oldskool TypeScript) | | -| triple-slash-file-reference | with a triple slash directive, specifically importing another module | `/// ` | -| triple-slash-type-reference | with a triple slash directive, specifically importing types | `/// ` | -| triple-slash-amd-dependency | with a triple slash directive, specifically declaring an AMD dependency | `/// ` | -| pre-compilation-only | but the dependency will disappear at runtime. See [preCompilationOnly](#preCompilationOnly) | `import { thing } from "./things"` // and continue to not use `thing` | +| dependency type | meaning the module was imported ... | example | +| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------- | +| aliased | via an alias of some sort (e.g. tsconfig paths, subpath imports, npm workspace or webpack aliases) | "~/hello.ts" | +| aliased-subpath-import | via a [subpath import](https://nodejs.org/api/packages.html#subpath-imports) | "#thing/hello.mjs" | +| aliased-tsconfig | via a typescript compilerOptions.paths or compilerOptions.baseUrl setting in tsconfig. | "@thing/hello" | +| aliased-tsconfig-base-url | via a typescript [compilerOptions.baseUrl setting in tsconfig](https://www.typescriptlang.org/tsconfig#baseUrl) | "libs/utensils/src/hello.js" | +| aliased-tsconfig-paths | via a typescript [compilerOptions.paths setting in tsconfig](https://www.typescriptlang.org/tsconfig#paths) | "@thing/hello" | +| aliased-webpack | via a [webpack resolve alias](https://webpack.js.org/configuration/resolve/#resolvealias) | "Utilities" | +| aliased-workspace | via a [workspace](https://docs.npmjs.com/cli/v10/configuring-npm/package-json#workspaces) | "local-workspace-package" | +| amd-define | with an AMD `define` wrapper (popularized by requirejs) | `define(["./thing"], function(thing){ /* do stuff */ })` | +| amd-exotic-require | with a require statement within an AMD module (but with the first parameter baring an insensible non-standard name) | `define(function(want, exports, module){ var one = want('./thing')})` | +| amd-require | with a require statement within an AMD module | `define(function(require, exports, module){ var one = require('./thing')})` | +| dynamic-import | with a dynamic import statement | `const { thing } = await import("./things")` | +| exotic-require | with a statement that isn't 'require' see [exoticallyRequired](#exoticallyrequired-exoticrequire-and-exoticrequirenot) | `const { thing } = want("./thing")` | +| export | implicitly via a module export | `export { thing } from "./things"` | +| import | with a 'regular' ES import | `import { thing } from "./things` | +| import-equals | with an 'import equals' statement | `import fs = require("fs")` | +| jsdoc | in jsdoc. See `jsdoc-bracket-import` and `jsdoc-import-tag`. Needs [detectJSDocImports](options-reference.md#detectjsdocimports-detect-dependencies-in-jsdoc-comments) set to `true` | `/** @type {import('./things').thing} */`, `/** @import { thing } from "things" */` | +| jsdoc-bracket-import | in a jsdoc comment with a 'bracket' style import. Always `type-only`, also has the `jsdoc` dependency type. FUTURE FEATURE | `/** @type {import('./things').thing} */` | +| jsdoc-import-tag | in a jsdoc comment with an @import tag. Always `type-only`, also has the `jsdoc` dependency type. | `/** @import { thing } from "things" */` | +| pre-compilation-only | but the dependency will disappear at runtime. See [preCompilationOnly](#preCompilationOnly) | `import { thing } from "./things"` // and continue to not use `thing` | +| require | with a commonjs 'require' statement | `const memoize = require("lodash/memoize")` | +| triple-slash-amd-dependency | with a triple slash directive, specifically declaring an AMD dependency | `/// ` | +| triple-slash-directive | with a triple slash directive (oldskool TypeScript) | | +| triple-slash-file-reference | with a triple slash directive, specifically importing another module | `/// ` | +| triple-slash-type-reference | with a triple slash directive, specifically importing types | `/// ` | +| type-import | as part of a type declaration | `const lAThing: import('./things').IThing = {}` | +| type-only | as 'type only' - only available for TypeScript sources, only for tsPreCompilationDeps !== false. | `import type { IThing } from "./things"` | ### `dynamic` From 5cdb0c8a80a7081735d5d48b79abbe9ab594dfa7 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 13:05:15 +0100 Subject: [PATCH 04/12] adds detectJSDocImports option that auto-enables parser: tsc. Only when true extract code will attempt jsdoc import detection --- .dependency-cruiser.mjs | 1 + src/cache/options-compatible.mjs | 1 + src/cli/init-config/config-template.mjs | 11 +++ src/enrich/summarize/summarize-options.mjs | 2 + src/extract/tsc/extract-typescript-deps.mjs | 36 +++++++-- src/extract/tsc/extract.mjs | 3 +- src/main/options/defaults.mjs | 1 + src/main/options/normalize.mjs | 3 + src/schema/configuration.schema.json | 4 + 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 | 1 + 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 + 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/extract/tsc/extract-typescript.utl.mjs | 8 +- test/extract/tsc/jsdoc-import-tags.spec.mjs | 77 +++++++++++++------ test/main/__fixtures__/jsx-as-object.json | 1 + test/main/__fixtures__/jsx.json | 1 + test/main/__fixtures__/ts-no-precomp-cjs.json | 1 + test/main/__fixtures__/ts-no-precomp-es.json | 1 + test/main/__fixtures__/ts-precomp-cjs.json | 1 + test/main/__fixtures__/ts-precomp-es.json | 1 + test/main/__fixtures__/ts.json | 1 + test/main/__fixtures__/tsx.json | 1 + .../expected-result.json | 1 + .../__mocks__/dynamic-imports/es/output.json | 1 + .../output-pre-compilation-deps.json | 1 + .../dynamic-imports/typescript/output.json | 1 + .../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 | 1 + .../options/normalize.cruise-options.spec.mjs | 3 + tools/schema/options.mjs | 6 ++ types/options.d.mts | 5 ++ 50 files changed, 166 insertions(+), 36 deletions(-) diff --git a/.dependency-cruiser.mjs b/.dependency-cruiser.mjs index 767a4637d..812c05d3d 100644 --- a/.dependency-cruiser.mjs +++ b/.dependency-cruiser.mjs @@ -435,6 +435,7 @@ export default { /* Experimental: the parser to use */ parser: "tsc", // acorn, tsc + // detectJSDocImports: true, // implies parser: "tsc" experimentalStats: true, metrics: true, enhancedResolveOptions: { diff --git a/src/cache/options-compatible.mjs b/src/cache/options-compatible.mjs index 77f4dde46..511e76a71 100644 --- a/src/cache/options-compatible.mjs +++ b/src/cache/options-compatible.mjs @@ -105,6 +105,7 @@ export function optionsAreCompatible(pOldOptions, pNewOptions) { pOldOptions.preserveSymlinks === pNewOptions.preserveSymlinks && pOldOptions.combinedDependencies === pNewOptions.combinedDependencies && pOldOptions.experimentalStats === pNewOptions.experimentalStats && + pOldOptions.detectJSDocImports === pNewOptions.detectJSDocImports && 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 b6b189477..4f8b41d3e 100644 --- a/src/cli/init-config/config-template.mjs +++ b/src/cli/init-config/config-template.mjs @@ -228,6 +228,17 @@ module.exports = { // moduleSystems: ['cjs', 'es6'], + /* + false: don't look at JSDoc imports + true: dependency-cruiser will detect dependencies in JSDoc-style + import statements. Implies "parser": "tsc", so the dependency-cruiser + will use the typescript parser for JavaScript files. + + For this to work the typescript compiler will need to be installed in the + same spot as you're running dependency-cruiser from. + */ + // detectJSDocImports: true, + /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/main/' to open it on your online repo or \`vscode://file/$\{process.cwd()}/\` to open it in visual studio code), diff --git a/src/enrich/summarize/summarize-options.mjs b/src/enrich/summarize/summarize-options.mjs index 2e45f37fe..5e1f61c47 100644 --- a/src/enrich/summarize/summarize-options.mjs +++ b/src/enrich/summarize/summarize-options.mjs @@ -4,6 +4,7 @@ const SHAREABLE_OPTIONS = [ "cache", "collapse", "combinedDependencies", + "detectJSDocImports", "doNotFollow", "enhancedResolveOptions", "exclude", @@ -20,6 +21,7 @@ const SHAREABLE_OPTIONS = [ "moduleSystems", "outputTo", "outputType", + "parser", "prefix", "preserveSymlinks", "reaches", diff --git a/src/extract/tsc/extract-typescript-deps.mjs b/src/extract/tsc/extract-typescript-deps.mjs index 059aa0edc..3146abf4c 100644 --- a/src/extract/tsc/extract-typescript-deps.mjs +++ b/src/extract/tsc/extract-typescript-deps.mjs @@ -277,8 +277,16 @@ function extractJSDocImports(pJSDocNodes) { .flatMap((pJSDocLine) => extractJSDocImportTags(pJSDocLine.tags)); } +/** + * Walks the AST and collects all dependencies + * + * @param {import("typescript").Node} pASTNode - the AST node to start from + * @param {string[]} pExoticRequireStrings - exotic require strings to look for + * @param {boolean} pDetectJSDocImports - whether to detect jsdoc imports + * @returns {(pASTNode: import("typescript").Node) => void} - the walker function + */ // eslint-disable-next-line max-lines-per-function -function walk(pResult, pExoticRequireStrings) { +function walk(pResult, pExoticRequireStrings, pDetectJSDocImports) { // eslint-disable-next-line max-lines-per-function return (pASTNode) => { // require('a-string'), require(`a-template-literal`) @@ -334,7 +342,7 @@ function walk(pResult, pExoticRequireStrings) { // TODO: all the kinds of tags that can have import statements as type declarations // (e.g. @type, @param, @returns, @typedef, @property, @prop, @arg, ...) // https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html - if (pASTNode.jsDoc) { + if (pDetectJSDocImports && Boolean(pASTNode.jsDoc)) { const lJSDocImports = extractJSDocImports(pASTNode.jsDoc); // pResult = pResult.concat(lJSDocImports) looks like the more obvious @@ -343,7 +351,10 @@ function walk(pResult, pExoticRequireStrings) { pResult.push(pImport); }); } - typescript.forEachChild(pASTNode, walk(pResult, pExoticRequireStrings)); + typescript.forEachChild( + pASTNode, + walk(pResult, pExoticRequireStrings, pDetectJSDocImports), + ); }; } @@ -352,12 +363,18 @@ function walk(pResult, pExoticRequireStrings) { * a source file, like commonJS or dynamic imports * * @param {import("typescript").Node} pAST - typescript syntax tree + * @param {string[]} pExoticRequireStrings - exotic require strings to look for + * @param {boolean} pDetectJSDocImports - whether to detect jsdoc imports * @returns {{module: string, moduleSystem: string}[]} - all commonJS dependencies */ -function extractNestedDependencies(pAST, pExoticRequireStrings) { +function extractNestedDependencies( + pAST, + pExoticRequireStrings, + pDetectJSDocImports, +) { let lResult = []; - walk(lResult, pExoticRequireStrings)(pAST); + walk(lResult, pExoticRequireStrings, pDetectJSDocImports)(pAST); return lResult; } @@ -365,11 +382,12 @@ function extractNestedDependencies(pAST, pExoticRequireStrings) { /** * returns all dependencies in the AST * - * @type {(pTypeScriptAST: (import("typescript").Node), pExoticRequireStrings: string[]) => {module: string, moduleSystem: string, dynamic: boolean}[]} + * @type {(pTypeScriptAST: (import("typescript").Node), pExoticRequireStrings: string[], pDetectJSDocImports: boolean) => {module: string, moduleSystem: string, dynamic: boolean}[]} */ export default function extractTypeScriptDependencies( pTypeScriptAST, pExoticRequireStrings, + pDetectJSDocImports, ) { // console.dir(pTypeScriptAST, { depth: 100 }); return Boolean(typescript) @@ -378,7 +396,11 @@ export default function extractTypeScriptDependencies( .concat(extractImportEquals(pTypeScriptAST)) .concat(extractTripleSlashDirectives(pTypeScriptAST)) .concat( - extractNestedDependencies(pTypeScriptAST, pExoticRequireStrings), + extractNestedDependencies( + pTypeScriptAST, + pExoticRequireStrings, + pDetectJSDocImports, + ), ) .map((pModule) => ({ dynamic: false, ...pModule })) : /* c8 ignore next */ []; diff --git a/src/extract/tsc/extract.mjs b/src/extract/tsc/extract.mjs index 00adaec3d..100f6d364 100644 --- a/src/extract/tsc/extract.mjs +++ b/src/extract/tsc/extract.mjs @@ -13,13 +13,14 @@ export function shouldUse({ tsPreCompilationDeps, parser }, pFileName) { } export function extract( - { baseDir, exoticRequireStrings, moduleSystems }, + { baseDir, exoticRequireStrings, moduleSystems, detectJSDocImports }, pFileName, pTranspileOptions, ) { return extractTypeScriptDeps( getASTCached(join(baseDir, pFileName), pTranspileOptions), exoticRequireStrings, + detectJSDocImports, ).filter(({ moduleSystem }) => moduleSystems.includes(moduleSystem)); } diff --git a/src/main/options/defaults.mjs b/src/main/options/defaults.mjs index f1268c2d8..a8db34855 100644 --- a/src/main/options/defaults.mjs +++ b/src/main/options/defaults.mjs @@ -3,6 +3,7 @@ export default { validate: false, maxDepth: 0, moduleSystems: ["es6", "cjs", "tsd", "amd"], + detectJSDocImports: false, tsPreCompilationDeps: false, preserveSymlinks: false, combinedDependencies: false, diff --git a/src/main/options/normalize.mjs b/src/main/options/normalize.mjs index 66b27ff76..9407d0dca 100644 --- a/src/main/options/normalize.mjs +++ b/src/main/options/normalize.mjs @@ -211,6 +211,9 @@ export function normalizeCruiseOptions(pOptions, pFileAndDirectoryArray = []) { if (lReturnValue.cache) { lReturnValue.cache = normalizeCacheOptions(lReturnValue.cache); } + if (lReturnValue.detectJSDocImports) { + lReturnValue.parser = "tsc"; + } return normalizeFocusDepth(lReturnValue); } diff --git a/src/schema/configuration.schema.json b/src/schema/configuration.schema.json index 07edab31e..a8e399d22 100644 --- a/src/schema/configuration.schema.json +++ b/src/schema/configuration.schema.json @@ -538,6 +538,10 @@ "description": "The maximum cruise depth specified. 0 means no maximum specified. While it might look attractive to regulate the size of the output, this is not the best option to do so. Filters (exclude, includeOnly, focus), the dot and archi reporter's collapsePattern and the collapse options offer better, more reliable and more understandable results." }, "moduleSystems": { "$ref": "#/definitions/ModuleSystemsType" }, + "detectJSDocImports": { + "type": "boolean", + "description": "When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies `\"parser\": \"tsc\"`. Defaults to false." + }, "prefix": { "type": "string" }, "preserveSymlinks": { "type": "boolean", diff --git a/src/schema/configuration.schema.mjs b/src/schema/configuration.schema.mjs index bd9c8fa46..6c1948d19 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"}}},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"},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"}}},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 diff --git a/src/schema/cruise-result.schema.json b/src/schema/cruise-result.schema.json index 3ce02b2d7..0476eab22 100644 --- a/src/schema/cruise-result.schema.json +++ b/src/schema/cruise-result.schema.json @@ -970,6 +970,10 @@ "description": "The maximum cruise depth specified. 0 means no maximum specified. While it might look attractive to regulate the size of the output, this is not the best option to do so. Filters (exclude, includeOnly, focus), the dot and archi reporter's collapsePattern and the collapse options offer better, more reliable and more understandable results." }, "moduleSystems": { "$ref": "#/definitions/ModuleSystemsType" }, + "detectJSDocImports": { + "type": "boolean", + "description": "When true, dependency-cruiser will detect dependencies in JSDoc-style import statements. Implies `\"parser\": \"tsc\"`. Defaults to false." + }, "prefix": { "type": "string" }, "preserveSymlinks": { "type": "boolean", diff --git a/src/schema/cruise-result.schema.mjs b/src/schema/cruise-result.schema.mjs index 162b18c30..0ebdf2c52 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"}}},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"},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"}}},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 diff --git a/test/cli/__fixtures__/alternate-basedir/expected.json b/test/cli/__fixtures__/alternate-basedir/expected.json index 34d3f0116..0d5f4e907 100644 --- a/test/cli/__fixtures__/alternate-basedir/expected.json +++ b/test/cli/__fixtures__/alternate-basedir/expected.json @@ -19,6 +19,7 @@ "optionsUsed": { "baseDir": "test/cli/__fixtures__/alternate-basedir", "combinedDependencies": false, + "detectJSDocImports": false, "doNotFollow": { "path": "node_modules" }, diff --git a/test/cli/__fixtures__/babel/babel-es6-result.json b/test/cli/__fixtures__/babel/babel-es6-result.json index b895a0a3d..a27b2c618 100644 --- a/test/cli/__fixtures__/babel/babel-es6-result.json +++ b/test/cli/__fixtures__/babel/babel-es6-result.json @@ -68,6 +68,7 @@ "fileName": "test/cli/__fixtures__/babel/es6/babelrc.valid.json" }, "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/cli/__fixtures__/babel/babel-ts-result.json b/test/cli/__fixtures__/babel/babel-ts-result.json index 26260ba7d..804f2cc2d 100644 --- a/test/cli/__fixtures__/babel/babel-ts-result.json +++ b/test/cli/__fixtures__/babel/babel-ts-result.json @@ -194,6 +194,7 @@ "fileName": "test/cli/__fixtures__/babel/ts/babelrc.json" }, "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/cli/__fixtures__/cjs.dir.filtered.json b/test/cli/__fixtures__/cjs.dir.filtered.json index 6b0a68d4e..531aa5cc0 100644 --- a/test/cli/__fixtures__/cjs.dir.filtered.json +++ b/test/cli/__fixtures__/cjs.dir.filtered.json @@ -360,6 +360,7 @@ "optionsUsed": { "baseDir": ".", "combinedDependencies": false, + "detectJSDocImports": false, "exclude": { "path": "node_modules" }, diff --git a/test/cli/__fixtures__/cjs.dir.json b/test/cli/__fixtures__/cjs.dir.json index e408a3b0f..524bf93db 100644 --- a/test/cli/__fixtures__/cjs.dir.json +++ b/test/cli/__fixtures__/cjs.dir.json @@ -427,6 +427,7 @@ "totalDependenciesCruised": 19, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/cjs.dir.stdout.json b/test/cli/__fixtures__/cjs.dir.stdout.json index 3f700edd8..7422e7054 100644 --- a/test/cli/__fixtures__/cjs.dir.stdout.json +++ b/test/cli/__fixtures__/cjs.dir.stdout.json @@ -381,6 +381,7 @@ "moduleSystems": ["amd", "cjs", "es6"], "outputType": "json", "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules" } diff --git a/test/cli/__fixtures__/cjs.file.json b/test/cli/__fixtures__/cjs.file.json index 1fae98b02..9f03e30dc 100644 --- a/test/cli/__fixtures__/cjs.file.json +++ b/test/cli/__fixtures__/cjs.file.json @@ -311,6 +311,7 @@ "totalDependenciesCruised": 14, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/dynamic-import-nok.json b/test/cli/__fixtures__/dynamic-import-nok.json index 1b70a0fcc..5ed661fa9 100644 --- a/test/cli/__fixtures__/dynamic-import-nok.json +++ b/test/cli/__fixtures__/dynamic-import-nok.json @@ -42,6 +42,7 @@ "totalDependenciesCruised": 1, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/dynamic-import-ok.json b/test/cli/__fixtures__/dynamic-import-ok.json index 4ad37ce28..ade9da404 100644 --- a/test/cli/__fixtures__/dynamic-import-ok.json +++ b/test/cli/__fixtures__/dynamic-import-ok.json @@ -42,6 +42,7 @@ "totalDependenciesCruised": 1, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/empty.json b/test/cli/__fixtures__/empty.json index 9922ef35c..5820709ba 100644 --- a/test/cli/__fixtures__/empty.json +++ b/test/cli/__fixtures__/empty.json @@ -10,6 +10,7 @@ "totalDependenciesCruised": 0, "optionsUsed": { "args": "whatever", + "detectJSDocImports": false, "outputTo": "empty.json", "metrics": false, "moduleSystems": ["amd", "cjs", "es6"], diff --git a/test/cli/__fixtures__/multiple-in-one-go.json b/test/cli/__fixtures__/multiple-in-one-go.json index 1ee8d64cb..350e897e3 100644 --- a/test/cli/__fixtures__/multiple-in-one-go.json +++ b/test/cli/__fixtures__/multiple-in-one-go.json @@ -155,6 +155,7 @@ "totalDependenciesCruised": 5, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/result-has-a-dependency-violation.json b/test/cli/__fixtures__/result-has-a-dependency-violation.json index 501020326..422babff9 100644 --- a/test/cli/__fixtures__/result-has-a-dependency-violation.json +++ b/test/cli/__fixtures__/result-has-a-dependency-violation.json @@ -9263,6 +9263,7 @@ "totalDependenciesCruised": 298, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "doNotFollow": { "path": "node_modules", "dependencyTypes": [ diff --git a/test/cli/__fixtures__/typescript-path-resolution.json b/test/cli/__fixtures__/typescript-path-resolution.json index ae491123a..d1c25780b 100644 --- a/test/cli/__fixtures__/typescript-path-resolution.json +++ b/test/cli/__fixtures__/typescript-path-resolution.json @@ -77,6 +77,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json b/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json index ef6d5142a..839d57fbc 100644 --- a/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json +++ b/test/cli/__fixtures__/webpack-config-alias-cruiser-config.json @@ -70,6 +70,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/webpack-config-alias.json b/test/cli/__fixtures__/webpack-config-alias.json index 382fffbb6..50eb40f50 100644 --- a/test/cli/__fixtures__/webpack-config-alias.json +++ b/test/cli/__fixtures__/webpack-config-alias.json @@ -70,6 +70,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "externalModuleResolutionStrategy": "node_modules", "metrics": false, "moduleSystems": ["es6", "cjs", "tsd", "amd"], diff --git a/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json b/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json index 897263412..433238878 100644 --- a/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json +++ b/test/cli/__fixtures__/workspaces-mono-repo-aliases/expected.json @@ -211,6 +211,7 @@ "baseDir": ".", "cache": false, "combinedDependencies": true, + "detectJSDocImports": false, "doNotFollow": { "path": "node_modules" }, diff --git a/test/cli/__fixtures__/workspaces-mono-repo/expected.json b/test/cli/__fixtures__/workspaces-mono-repo/expected.json index cd85e858b..ebe17d186 100644 --- a/test/cli/__fixtures__/workspaces-mono-repo/expected.json +++ b/test/cli/__fixtures__/workspaces-mono-repo/expected.json @@ -228,6 +228,7 @@ "optionsUsed": { "baseDir": "test/cli/__fixtures__/workspaces-mono-repo", "combinedDependencies": false, + "detectJSDocImports": false, "doNotFollow": { "path": "node_modules" }, diff --git a/test/extract/tsc/extract-typescript.utl.mjs b/test/extract/tsc/extract-typescript.utl.mjs index e91758c36..3f60b2a1c 100644 --- a/test/extract/tsc/extract-typescript.utl.mjs +++ b/test/extract/tsc/extract-typescript.utl.mjs @@ -1,8 +1,14 @@ +/* eslint-disable unicorn/prevent-abbreviations */ import extractTypescriptDependencies from "#extract/tsc/extract-typescript-deps.mjs"; import { getASTFromSource } from "#extract/tsc/parse.mjs"; -export default (pTypesScriptSource, pExoticRequireStrings = []) => +export default ( + pTypesScriptSource, + pExoticRequireStrings = [], + pDetectJSDocImports = false, +) => extractTypescriptDependencies( getASTFromSource({ source: pTypesScriptSource }), pExoticRequireStrings, + pDetectJSDocImports, ); diff --git a/test/extract/tsc/jsdoc-import-tags.spec.mjs b/test/extract/tsc/jsdoc-import-tags.spec.mjs index fa1dae01c..eb159f053 100644 --- a/test/extract/tsc/jsdoc-import-tags.spec.mjs +++ b/test/extract/tsc/jsdoc-import-tags.spec.mjs @@ -3,20 +3,27 @@ import extractTypescript from "./extract-typescript.utl.mjs"; describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { it("extracts jsdoc @import ('as' variant)", () => { - deepEqual(extractTypescript("/** @import * as fs from 'node:fs' */"), [ - { - module: "node:fs", - moduleSystem: "es6", - dynamic: false, - exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], - }, - ]); + deepEqual( + extractTypescript("/** @import * as fs from 'node:fs' */", [], true), + [ + { + module: "node:fs", + moduleSystem: "es6", + dynamic: false, + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], + }, + ], + ); }); it("extracts jsdoc @import ('qualified' variant)", () => { deepEqual( - extractTypescript("/** @import {thing, thang} from './hello.mjs' */"), + extractTypescript( + "/** @import {thing, thang} from './hello.mjs' */", + [], + true, + ), [ { module: "./hello.mjs", @@ -30,46 +37,66 @@ describe("[U] ast-extractors/extract-typescript - jsdoc @imports", () => { }); it("extracts jsdoc @import ('default import' variant)", () => { - deepEqual(extractTypescript("/** @import thing from './hello.mjs' */"), [ - { - module: "./hello.mjs", - moduleSystem: "es6", - dynamic: false, - exoticallyRequired: false, - dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], - }, - ]); + deepEqual( + extractTypescript("/** @import thing from './hello.mjs' */", [], true), + [ + { + module: "./hello.mjs", + moduleSystem: "es6", + dynamic: false, + exoticallyRequired: false, + dependencyTypes: ["type-only", "import", "jsdoc", "jsdoc-import-tag"], + }, + ], + ); + }); + + it("does not extract imports when detectJSDocImports is false", () => { + deepEqual( + extractTypescript("/** @import thing from './hello' */", [], false), + [], + ); }); it("does not extract imports where the module name isn't a string (identifier variant) ", () => { deepEqual( - extractTypescript("/** @import {thing} from anIdentifier */"), + extractTypescript("/** @import {thing} from anIdentifier */", [], true), [], ); }); it("does not extract imports where the module name isn't a string (number variant) ", () => { - deepEqual(extractTypescript("/** @import {thing} from 481 */"), []); + deepEqual( + extractTypescript("/** @import {thing} from 481 */", [], true), + [], + ); }); it("does not extract imports where the module name isn't a string (boolean variant) ", () => { - deepEqual(extractTypescript("/** @import {thing} from true */"), []); + deepEqual( + extractTypescript("/** @import {thing} from true */", [], true), + [], + ); }); it("does not extract imports where the module name isn't a string (nothing variant) ", () => { - deepEqual(extractTypescript("/** @import {thing} from */"), []); + deepEqual(extractTypescript("/** @import {thing} from */", [], true), []); }); it("does not extract imports with dynamic looking imports (@import {import('./ting.mjs')})", () => { deepEqual( - extractTypescript("/** @import {import('./thing.mjs').thing} */"), + extractTypescript( + "/** @import {import('./thing.mjs').thing} */", + [], + true, + ), [], ); }); it("does not extract imports with dynamic looking imports (@type {import('./ting.mjs')})", () => { deepEqual( - extractTypescript("/** @type {import('./thing.mjs').thing} */"), + extractTypescript("/** @type {import('./thing.mjs').thing} */", [], true), [], ); }); diff --git a/test/main/__fixtures__/jsx-as-object.json b/test/main/__fixtures__/jsx-as-object.json index 5de6ac0e9..d79929cef 100644 --- a/test/main/__fixtures__/jsx-as-object.json +++ b/test/main/__fixtures__/jsx-as-object.json @@ -197,6 +197,7 @@ "totalDependenciesCruised": 7, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/jsx.json b/test/main/__fixtures__/jsx.json index 28854d887..2ca41b97e 100644 --- a/test/main/__fixtures__/jsx.json +++ b/test/main/__fixtures__/jsx.json @@ -197,6 +197,7 @@ "totalDependenciesCruised": 7, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/ts-no-precomp-cjs.json b/test/main/__fixtures__/ts-no-precomp-cjs.json index f18e5155a..4b97ba10f 100644 --- a/test/main/__fixtures__/ts-no-precomp-cjs.json +++ b/test/main/__fixtures__/ts-no-precomp-cjs.json @@ -72,6 +72,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/ts-no-precomp-es.json b/test/main/__fixtures__/ts-no-precomp-es.json index 37eab7421..59b9ce95c 100644 --- a/test/main/__fixtures__/ts-no-precomp-es.json +++ b/test/main/__fixtures__/ts-no-precomp-es.json @@ -72,6 +72,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/ts-precomp-cjs.json b/test/main/__fixtures__/ts-precomp-cjs.json index 7137c5621..2ca018e5b 100644 --- a/test/main/__fixtures__/ts-precomp-cjs.json +++ b/test/main/__fixtures__/ts-precomp-cjs.json @@ -88,6 +88,7 @@ "totalDependenciesCruised": 3, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/ts-precomp-es.json b/test/main/__fixtures__/ts-precomp-es.json index ee50ee4c6..63c8dfc3d 100644 --- a/test/main/__fixtures__/ts-precomp-es.json +++ b/test/main/__fixtures__/ts-precomp-es.json @@ -88,6 +88,7 @@ "totalDependenciesCruised": 3, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/ts.json b/test/main/__fixtures__/ts.json index a8ac4bf1b..7aa237718 100644 --- a/test/main/__fixtures__/ts.json +++ b/test/main/__fixtures__/ts.json @@ -147,6 +147,7 @@ "totalDependenciesCruised": 6, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__fixtures__/tsx.json b/test/main/__fixtures__/tsx.json index 7dcf27572..c9f5a0753 100644 --- a/test/main/__fixtures__/tsx.json +++ b/test/main/__fixtures__/tsx.json @@ -67,6 +67,7 @@ "totalDependenciesCruised": 2, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__mocks__/collapse-after-cruise/expected-result.json b/test/main/__mocks__/collapse-after-cruise/expected-result.json index fe04e905f..a453dad3c 100644 --- a/test/main/__mocks__/collapse-after-cruise/expected-result.json +++ b/test/main/__mocks__/collapse-after-cruise/expected-result.json @@ -176,6 +176,7 @@ "optionsUsed": { "collapse": "^test/main/__mocks__/collapse-after-cruise/src/[^/]+", "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__mocks__/dynamic-imports/es/output.json b/test/main/__mocks__/dynamic-imports/es/output.json index af503a117..8097b8911 100644 --- a/test/main/__mocks__/dynamic-imports/es/output.json +++ b/test/main/__mocks__/dynamic-imports/es/output.json @@ -149,6 +149,7 @@ "totalDependenciesCruised": 3, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, 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 9e25a644e..78edf6c13 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 @@ -149,6 +149,7 @@ "totalDependenciesCruised": 3, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__mocks__/dynamic-imports/typescript/output.json b/test/main/__mocks__/dynamic-imports/typescript/output.json index 3956ef392..cab759020 100644 --- a/test/main/__mocks__/dynamic-imports/typescript/output.json +++ b/test/main/__mocks__/dynamic-imports/typescript/output.json @@ -149,6 +149,7 @@ "totalDependenciesCruised": 3, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, 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 1bfd82d66..5626242b7 100644 --- a/test/main/__mocks__/type-only-imports/output-with-rules.json +++ b/test/main/__mocks__/type-only-imports/output-with-rules.json @@ -48,6 +48,7 @@ "totalDependenciesCruised": 1, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__mocks__/type-only-imports/output.json b/test/main/__mocks__/type-only-imports/output.json index b5c95f748..83378689e 100644 --- a/test/main/__mocks__/type-only-imports/output.json +++ b/test/main/__mocks__/type-only-imports/output.json @@ -40,6 +40,7 @@ "totalDependenciesCruised": 1, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, 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 34b713f43..8cd4e5da7 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 @@ -18,6 +18,7 @@ "totalDependenciesCruised": 0, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/__mocks__/type-only-module-references/output.json b/test/main/__mocks__/type-only-module-references/output.json index ef5804691..06597d785 100644 --- a/test/main/__mocks__/type-only-module-references/output.json +++ b/test/main/__mocks__/type-only-module-references/output.json @@ -41,6 +41,7 @@ "totalDependenciesCruised": 1, "optionsUsed": { "combinedDependencies": false, + "detectJSDocImports": false, "exoticRequireStrings": [], "externalModuleResolutionStrategy": "node_modules", "metrics": false, diff --git a/test/main/options/normalize.cruise-options.spec.mjs b/test/main/options/normalize.cruise-options.spec.mjs index 0fb34298a..09de87625 100644 --- a/test/main/options/normalize.cruise-options.spec.mjs +++ b/test/main/options/normalize.cruise-options.spec.mjs @@ -189,6 +189,9 @@ describe("[I] normalize cache options", () => { it("passed no cache - no cache property", () => { ok(!normalizeCruiseOptions({}).hasOwnProperty("cache")); }); + it("sets parser to tsc when detectJSDocImports is set to true", () => { + equal(normalizeCruiseOptions({ detectJSDocImports: true }).parser, "tsc"); + }); }); /* eslint no-magic-numbers: 0*/ diff --git a/tools/schema/options.mjs b/tools/schema/options.mjs index 8cfa9547a..e19ac24e9 100644 --- a/tools/schema/options.mjs +++ b/tools/schema/options.mjs @@ -114,6 +114,12 @@ export default { "options offer better, more reliable and more understandable results.", }, moduleSystems: { $ref: "#/definitions/ModuleSystemsType" }, + detectJSDocImports: { + type: "boolean", + description: + "When true, dependency-cruiser will detect dependencies in JSDoc-style " + + 'import statements. Implies `"parser": "tsc"`. Defaults to false.', + }, prefix: { type: "string", }, diff --git a/types/options.d.mts b/types/options.d.mts index c58e7d090..f3e3c6f1c 100644 --- a/types/options.d.mts +++ b/types/options.d.mts @@ -144,6 +144,11 @@ export interface ICruiseOptions { * defaults to ["es6", "cjs", "amd"] */ moduleSystems?: ModuleSystemType[]; + /** + * When true, dependency-cruiser will detect dependencies in JSDoc-style + * import statements. Implies `"parser": "tsc"`. Defaults to false.' + */ + detectJSDocImports?: boolean; /** * one of "json", "html", "dot", "csv" or "err". When left * out the function will return a javascript object as dependencies From dbcb10431447346cb28d8240a1a9843518d94d00 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 14:43:56 +0100 Subject: [PATCH 05/12] adds some dog food --- src/cache/cache.mjs | 7 +++---- src/cache/content-strategy.mjs | 7 ++----- src/cache/helpers.mjs | 7 +++---- src/cache/metadata-strategy.mjs | 7 ++----- src/cache/options-compatible.mjs | 2 +- 5 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/cache/cache.mjs b/src/cache/cache.mjs index f3d4b094a..ebbceebb8 100644 --- a/src/cache/cache.mjs +++ b/src/cache/cache.mjs @@ -13,10 +13,9 @@ import { scannableExtensions } from "#extract/transpile/meta.mjs"; import { bus } from "#utl/bus.mjs"; /** - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData - * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions - * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult - * @typedef {import("../../types/cache-options.mjs").cacheStrategyType} cacheStrategyType + * @import { IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs"; + * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs"; + * @import { cacheStrategyType } from "../../types/cache-options.mjs"; */ const CACHE_FILE_NAME = "cache.json"; diff --git a/src/cache/content-strategy.mjs b/src/cache/content-strategy.mjs index 5309fdbc0..1c8e6cdd8 100644 --- a/src/cache/content-strategy.mjs +++ b/src/cache/content-strategy.mjs @@ -10,11 +10,8 @@ import { } from "./helpers.mjs"; /** - * @typedef {import("../../types/dependency-cruiser.mjs").IModule} IModule - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData - * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult - * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions + * @import {IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs" + * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs" */ /** diff --git a/src/cache/helpers.mjs b/src/cache/helpers.mjs index 2caf61f50..4467b803f 100644 --- a/src/cache/helpers.mjs +++ b/src/cache/helpers.mjs @@ -6,10 +6,9 @@ import memoize from "memoize"; import { filenameMatchesPattern } from "#graph-utl/match-facade.mjs"; /** - * @typedef {import("../..").IModule} IModule - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange - * @typedef {import("../../types/filter-types.mjs").IExcludeType} IExcludeType - * @typedef {import("../../types/strict-filter-types.mjs").IStrictIncludeOnlyType} IStrictIncludeOnlyType + * @import { IModule, IRevisionChange, } from "../../types/dependency-cruiser.mjs" + * @import { IExcludeType } from "../../types/filter-types.mjs" + * @import { IStrictIncludeOnlyType } from "../../types/strict-filter-types.mjs" */ /** diff --git a/src/cache/metadata-strategy.mjs b/src/cache/metadata-strategy.mjs index 519521711..f29a900ec 100644 --- a/src/cache/metadata-strategy.mjs +++ b/src/cache/metadata-strategy.mjs @@ -12,11 +12,8 @@ import { import { bus } from "#utl/bus.mjs"; /** - * @typedef {import("../../types/dependency-cruiser.mjs").IModule} IModule - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionChange} IRevisionChange - * @typedef {import("../../types/dependency-cruiser.mjs").IRevisionData} IRevisionData - * @typedef {import("../../types/dependency-cruiser.mjs").ICruiseResult} ICruiseResult - * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions + * @import {IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs" + * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs" */ export default class MetaDataStrategy { diff --git a/src/cache/options-compatible.mjs b/src/cache/options-compatible.mjs index 511e76a71..e7729a340 100644 --- a/src/cache/options-compatible.mjs +++ b/src/cache/options-compatible.mjs @@ -2,7 +2,7 @@ import { isDeepStrictEqual } from "node:util"; /** - * @typedef {import("../../types/strict-options.mjs").IStrictCruiseOptions} IStrictCruiseOptions + * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs" */ /* From 7bfaa21d1e777e55dea05ba3a5ed7746a27b4a36 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 16:18:58 +0100 Subject: [PATCH 06/12] adds e2e test --- .../dependency-cruiser-config.mjs | 6 ++ .../jsdoc-import-tags/expected.json | 67 +++++++++++++++++++ .../jsdoc-import-tags/src/index.mjs | 8 +++ .../jsdoc-import-tags/src/types.d.mts | 1 + test/cli/index.spec.mjs | 34 +++++++--- 5 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 test/cli/__fixtures__/jsdoc-import-tags/dependency-cruiser-config.mjs create mode 100644 test/cli/__fixtures__/jsdoc-import-tags/expected.json create mode 100644 test/cli/__fixtures__/jsdoc-import-tags/src/index.mjs create mode 100644 test/cli/__fixtures__/jsdoc-import-tags/src/types.d.mts diff --git a/test/cli/__fixtures__/jsdoc-import-tags/dependency-cruiser-config.mjs b/test/cli/__fixtures__/jsdoc-import-tags/dependency-cruiser-config.mjs new file mode 100644 index 000000000..37c8e40db --- /dev/null +++ b/test/cli/__fixtures__/jsdoc-import-tags/dependency-cruiser-config.mjs @@ -0,0 +1,6 @@ +/** @type {import('../../../../types/dependency-cruiser.d.mts').IConfiguration} */ +export default { + options: { + detectJSDocImports: true, + }, +}; diff --git a/test/cli/__fixtures__/jsdoc-import-tags/expected.json b/test/cli/__fixtures__/jsdoc-import-tags/expected.json new file mode 100644 index 000000000..df6ea6f07 --- /dev/null +++ b/test/cli/__fixtures__/jsdoc-import-tags/expected.json @@ -0,0 +1,67 @@ +{ + "modules": [ + { + "source": "src/index.mjs", + "dependencies": [ + { + "dynamic": false, + "module": "./types.mjs", + "moduleSystem": "es6", + "exoticallyRequired": false, + "dependencyTypes": [ + "local", + "type-only", + "import", + "jsdoc", + "jsdoc-import-tag" + ], + "resolved": "src/types.d.mts", + "coreModule": false, + "followable": true, + "couldNotResolve": false, + "matchesDoNotFollow": false, + "circular": false, + "valid": true + } + ], + "dependents": [], + "orphan": false, + "valid": true + }, + { + "source": "src/types.d.mts", + "dependencies": [], + "dependents": ["src/index.mjs"], + "orphan": false, + "valid": true + } + ], + "summary": { + "violations": [], + "error": 0, + "warn": 0, + "info": 0, + "ignore": 0, + "totalCruised": 2, + "totalDependenciesCruised": 1, + "optionsUsed": { + "baseDir": "", + "combinedDependencies": false, + "detectJSDocImports": true, + "exoticRequireStrings": [], + "externalModuleResolutionStrategy": "node_modules", + "metrics": false, + "moduleSystems": ["es6", "cjs", "tsd", "amd"], + "outputTo": "../../__output__/jsdoc-import-tags.json", + "outputType": "json", + "parser": "tsc", + "preserveSymlinks": false, + "rulesFile": "dependency-cruiser-config.mjs", + "tsPreCompilationDeps": false, + "args": "src/index.mjs" + }, + "ruleSetUsed": { + "forbidden": [] + } + } +} diff --git a/test/cli/__fixtures__/jsdoc-import-tags/src/index.mjs b/test/cli/__fixtures__/jsdoc-import-tags/src/index.mjs new file mode 100644 index 000000000..209dfd12a --- /dev/null +++ b/test/cli/__fixtures__/jsdoc-import-tags/src/index.mjs @@ -0,0 +1,8 @@ +/** @import { LeesPlankjeType} from "./types.mjs" */ + +/** + * @param { LeesPlankjeType } pLeesPlankje + */ +export function leesPlankje(pLeesPlankje) { + return pLeesPlankje; +} diff --git a/test/cli/__fixtures__/jsdoc-import-tags/src/types.d.mts b/test/cli/__fixtures__/jsdoc-import-tags/src/types.d.mts new file mode 100644 index 000000000..b0a09a529 --- /dev/null +++ b/test/cli/__fixtures__/jsdoc-import-tags/src/types.d.mts @@ -0,0 +1 @@ +export type LeesPlankjeType = "aap" | "noot" | "mies" | "wim" | "zus" | "jet"; diff --git a/test/cli/index.spec.mjs b/test/cli/index.spec.mjs index 431c5ca65..4fd980974 100644 --- a/test/cli/index.spec.mjs +++ b/test/cli/index.spec.mjs @@ -159,18 +159,19 @@ function resetOutputDirectory() { } }); - deleteDammit(path.join(OUT_DIR, "multiple-in-one-go.json")); - deleteDammit(path.join(OUT_DIR, "transgression-count.json")); - deleteDammit(path.join(OUT_DIR, "webpack-config-alias.json")); - deleteDammit(path.join(OUT_DIR, "webpack-config-alias-cruiser-config.json")); - deleteDammit(path.join(OUT_DIR, "dynamic-import-ok.json")); - deleteDammit(path.join(OUT_DIR, "dynamic-import-nok.json")); - deleteDammit(path.join(OUT_DIR, "typescript-path-resolution.json")); deleteDammit(path.join(OUT_DIR, "babel-es6-result.json")); deleteDammit(path.join(OUT_DIR, "babel-ts-result.json")); - deleteDammit(path.join(OUT_DIR, "known-errors-not-known.txt")); + deleteDammit(path.join(OUT_DIR, "dynamic-import-nok.json")); + deleteDammit(path.join(OUT_DIR, "dynamic-import-ok.json")); + deleteDammit(path.join(OUT_DIR, "jsdoc-import-tags.json")); deleteDammit(path.join(OUT_DIR, "known-errors-known.txt")); + deleteDammit(path.join(OUT_DIR, "known-errors-not-known.txt")); + deleteDammit(path.join(OUT_DIR, "multiple-in-one-go.json")); deleteDammit(path.join(OUT_DIR, "this-thing-likely-wont-exist.txt")); + deleteDammit(path.join(OUT_DIR, "transgression-count.json")); + deleteDammit(path.join(OUT_DIR, "typescript-path-resolution.json")); + deleteDammit(path.join(OUT_DIR, "webpack-config-alias-cruiser-config.json")); + deleteDammit(path.join(OUT_DIR, "webpack-config-alias.json")); deleteDammit(path.join(OUT_DIR, "workspaces-mono-repo-aliases.json")); } @@ -347,7 +348,7 @@ describe("[E] cli/index", () => { match( lFeedback, - /no dependency violations found \(102 modules, 57 dependencies cruised\)/, + /no dependency violations found \([0-9]{3} modules, [0-9]{2} dependencies cruised\)/, ); equal(lExitCode, 0); }); @@ -481,6 +482,21 @@ describe("[E] cli/index", () => { assertJSONFileEqual(lOutputTo, "expected.json"); }); + it("dependency-cruise jsDoc ", async () => { + const lOutputFileName = "jsdoc-import-tags.json"; + const lOutputTo = path.join("../../__output__", lOutputFileName); + process.chdir("./test/cli/__fixtures__/jsdoc-import-tags"); + + const lExitCode = await cli(["src/index.mjs"], { + config: "dependency-cruiser-config.mjs", + outputType: "json", + outputTo: lOutputTo, + }); + + equal(lExitCode, 0); + assertJSONFileEqual(lOutputTo, "expected.json"); + }); + it("dependency-cruise with a babelConfig will use that (es6 edition)", async () => { const lOutputFileName = "babel-es6-result.json"; const lOutputTo = path.join(OUT_DIR, lOutputFileName); From 2593f1f39261026a1978f6b87f677d79e409b3c5 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 18:18:59 +0100 Subject: [PATCH 07/12] disables yarn berry integration test - it runs ok locally but is being an *ss on the ci --- .github/workflows/ci.yml | 70 +++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1fbb994b..de1e17f65 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ env: CI: true # the LANG (used by the Intl API, which we use for some of the number # formatting) is set in the run scripts. This works everywhere, except on - # windows. So, especially for windows ... + # windows. So, especinodeally for windows ... LANG: en_US.UTF-8 # Same for NODE_OPTIONS, just for windows: NODE_OPTIONS: --no-warnings @@ -113,36 +113,38 @@ jobs: - run: npm run depcruise - run: npx mocha --invert --fgrep "#do-not-run-on-windows" - check-berry-integration: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/cache@v4 - with: - path: | - .yarn - .yarnrc.yml - .pnp.js - yarn.lock - key: ${{env.NODE_LATEST}}@${{env.PLATFORM}}-build-${{hashFiles('package.json')}} - restore-keys: | - ${{env.NODE_LATEST}}@${{env.PLATFORM}}-build- - - uses: actions/setup-node@v4 - with: - node-version: ${{env.NODE_LATEST}} - - name: install & build - run: | - rm -f .npmrc - yarn set version berry - YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn - - name: forbidden dependency check - run: | - yarn --version - yarn depcruise - # testing doesn't work as the tests are esm and berry, with pnp enabled, - # doesn't support esm yet. - # - name: test coverage - # run: | - # node --version - # yarn --version - # yarn test:cover + # for #reasons the run step takes forever to complete on the ci - while + # running fine locally. Something to figure out another time. + # check-berry-integration: + # runs-on: ubuntu-latest + # steps: + # - uses: actions/checkout@v4 + # - uses: actions/cache@v4 + # with: + # path: | + # .yarn + # .yarnrc.yml + # .pnp.js + # yarn.lock + # key: ${{env.NODE_LATEST}}@${{env.PLATFORM}}-build-${{hashFiles('package.json')}} + # restore-keys: | + # ${{env.NODE_LATEST}}@${{env.PLATFORM}}-build- + # - uses: actions/setup-node@v4 + # with: + # node-version: ${{env.NODE_LATEST}} + # - name: install & build + # run: | + # rm -f .npmrc + # yarn set version berry + # YARN_ENABLE_IMMUTABLE_INSTALLS=false yarn + # - name: forbidden dependency check + # run: | + # yarn --version + # yarn depcruise + # # testing doesn't work as the tests are esm and berry, with pnp enabled, + # # doesn't support esm yet. + # # - name: test coverage + # # run: | + # # node --version + # # yarn --version + # # yarn test:cover From 1dad2c8cc16406be2adea770fdd0c7ea6a1b3971 Mon Sep 17 00:00:00 2001 From: Sander Verweij Date: Sun, 17 Nov 2024 18:26:05 +0100 Subject: [PATCH 08/12] roll back typo in a comment --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de1e17f65..2746ef575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,7 +13,7 @@ env: CI: true # the LANG (used by the Intl API, which we use for some of the number # formatting) is set in the run scripts. This works everywhere, except on - # windows. So, especinodeally for windows ... + # windows. So, especially for windows ... LANG: en_US.UTF-8 # Same for NODE_OPTIONS, just for windows: NODE_OPTIONS: --no-warnings From 7378c57cbebce6d430949191772a352db37b5357 Mon Sep 17 00:00:00 2001 From: Sander Verweij Date: Sun, 17 Nov 2024 18:27:50 +0100 Subject: [PATCH 09/12] updates documentation sample to be in (more readable) javascript --- doc/options-reference.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/options-reference.md b/doc/options-reference.md index 13524f4b2..070af2327 100644 --- a/doc/options-reference.md +++ b/doc/options-reference.md @@ -799,11 +799,10 @@ As currently on the TypeScript compiler (`tsc`) can detect these imports, switch on this option implies dependency-cruiser will set `options.parser` to `tsc` so it uses the TypeScript compiler to parse not only TypeScript but also JavaScript. -```json -"options": { - "detectJSDocImports": true // implies `parser: "tsc"` +```javascript +options: { + detectJSDocImports: true // implies `parser: "tsc"` } -``` #### Usage notes From 5d1606efaca7bb46f0e0b097a73a0759da7ae2d4 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 18:30:54 +0100 Subject: [PATCH 10/12] adds three backticks the GH UI didn't want to take --- doc/options-reference.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/options-reference.md b/doc/options-reference.md index 070af2327..3d3406510 100644 --- a/doc/options-reference.md +++ b/doc/options-reference.md @@ -803,6 +803,7 @@ it uses the TypeScript compiler to parse not only TypeScript but also JavaScript options: { detectJSDocImports: true // implies `parser: "tsc"` } +``` #### Usage notes From b787f94c73ede6b9e6cb37f91d66871b1ca591f2 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 19:14:08 +0100 Subject: [PATCH 11/12] more dog food --- .dependency-cruiser.mjs | 4 +-- src/cache/content-strategy.mjs | 7 ++-- src/cache/find-content-changes.mjs | 16 ++++++--- src/cache/helpers.mjs | 9 ++--- src/cache/metadata-strategy.mjs | 7 ++-- src/cli/init-config/build-config.mjs | 22 ++++++++----- src/cli/init-config/index.mjs | 16 +++++---- .../init-config/normalize-init-options.mjs | 16 +++++---- src/config-utl/extract-depcruise-options.mjs | 12 ++++--- src/config-utl/extract-known-violations.mjs | 4 +-- src/extract/extract-dependencies.mjs | 23 ++++++++----- src/extract/extract-stats.mjs | 13 +++++--- src/extract/gather-initial-sources.mjs | 12 ++++--- src/extract/index.mjs | 13 +++++--- .../resolve/determine-dependency-types.mjs | 33 +++++++++++-------- src/extract/resolve/index.mjs | 16 ++++++--- src/extract/resolve/module-classifiers.mjs | 9 +++-- src/extract/swc/parse.mjs | 12 ++++--- src/extract/tsc/extract-typescript-deps.mjs | 22 ++++++++----- .../consolidate-module-dependencies.mjs | 12 ++++--- src/graph-utl/filter-bank.mjs | 11 +++++-- src/graph-utl/indexed-module-graph.mjs | 12 +++---- src/graph-utl/rule-set.mjs | 14 +++++--- src/main/options/assert-validity.mjs | 8 +++-- src/main/options/normalize.mjs | 33 +++++++++++-------- src/main/report-wrap.mjs | 19 +++++++---- src/main/resolve-options/normalize.mjs | 13 +++++--- src/main/rule-set/assert-validity.mjs | 7 ++-- src/main/rule-set/normalize.mjs | 26 ++++++++++----- src/validate/index.mjs | 8 +++-- src/validate/match-dependency-rule.mjs | 12 ++++--- src/validate/match-module-rule-helpers.mjs | 24 +++++++++----- src/validate/match-module-rule.mjs | 13 +++++--- 33 files changed, 303 insertions(+), 175 deletions(-) diff --git a/.dependency-cruiser.mjs b/.dependency-cruiser.mjs index 812c05d3d..4c2b2345a 100644 --- a/.dependency-cruiser.mjs +++ b/.dependency-cruiser.mjs @@ -434,8 +434,8 @@ export default { // }, /* Experimental: the parser to use */ - parser: "tsc", // acorn, tsc - // detectJSDocImports: true, // implies parser: "tsc" + // parser: "tsc", // acorn, tsc + detectJSDocImports: true, // implies parser: "tsc" experimentalStats: true, metrics: true, enhancedResolveOptions: { diff --git a/src/cache/content-strategy.mjs b/src/cache/content-strategy.mjs index 1c8e6cdd8..a3f40c80e 100644 --- a/src/cache/content-strategy.mjs +++ b/src/cache/content-strategy.mjs @@ -10,8 +10,9 @@ import { } from "./helpers.mjs"; /** - * @import {IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs" + * @import { IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs" * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs" + * @import { changeType, getSHA } from "watskeburt" */ /** @@ -53,10 +54,10 @@ export default class ContentStrategy { * @param {IStrictCruiseOptions} pCruiseOptions * @param {Object} pOptions * @param {Set} pOptions.extensions - * @param {Set=} pOptions.interestingChangeTypes? + * @param {Set=} pOptions.interestingChangeTypes? * @param {string=} pOptions.baseDir * @param {typeof findContentChanges=} pOptions.diffListFn - * @param {typeof import('watskeburt').getSHA=} pOptions.checksumFn + * @param {typeof getSHA=} pOptions.checksumFn * @returns {IRevisionData} */ getRevisionData(pDirectory, pCachedCruiseResult, pCruiseOptions, pOptions) { diff --git a/src/cache/find-content-changes.mjs b/src/cache/find-content-changes.mjs index 116e6d6c3..b3a3c87f6 100644 --- a/src/cache/find-content-changes.mjs +++ b/src/cache/find-content-changes.mjs @@ -11,10 +11,16 @@ import { import { bus } from "#utl/bus.mjs"; import findAllFiles from "#utl/find-all-files.mjs"; +/** + * @import { IModule, IRevisionChange } from "../../types/dependency-cruiser.mjs" + * @import { ICruiseResult } from "../../types/cruise-result.mjs" + * @import { IStrictExcludeType, IStrictIncludeOnlyType } from "../../types/strict-filter-types.mjs" + */ + /** * @param {Set} pFileSet * @param {typeof getFileHashSync} pFileHashFunction - * @returns {(pModule:import("../..").IModule) => import('../..').IRevisionChange} + * @returns {(pModule:IModule) => IRevisionChange} */ function diffCachedModuleAgainstFileSet( pFileSet, @@ -63,13 +69,13 @@ function diffCachedModuleAgainstFileSet( - there is a cache, but it doesn't contain checksums => same as before, except all files will be marked as 'modified' * @param {string} pDirectory - * @param {import("../..").ICruiseResult} pCachedCruiseResult + * @param {ICruiseResult} pCachedCruiseResult * @param {Object} pOptions * @param {Set} pOptions.extensions * @param {string} pOptions.baseDir - * @param {import("../../types/strict-filter-types.mjs").IStrictExcludeType} pOptions.exclude - * @param {import("../../types/strict-filter-types.mjs").IStrictIncludeOnlyType=} pOptions.includeOnly - * @returns {import("../..").IRevisionChange[]} + * @param {IStrictExcludeType} pOptions.exclude + * @param {IStrictIncludeOnlyType=} pOptions.includeOnly + * @returns {IRevisionChange[]} */ export default function findContentChanges( pDirectory, diff --git a/src/cache/helpers.mjs b/src/cache/helpers.mjs index 4467b803f..1d23ba30b 100644 --- a/src/cache/helpers.mjs +++ b/src/cache/helpers.mjs @@ -9,6 +9,7 @@ import { filenameMatchesPattern } from "#graph-utl/match-facade.mjs"; * @import { IModule, IRevisionChange, } from "../../types/dependency-cruiser.mjs" * @import { IExcludeType } from "../../types/filter-types.mjs" * @import { IStrictIncludeOnlyType } from "../../types/strict-filter-types.mjs" + * @import { changeType, IChange } from "watskeburt" */ /** @@ -34,7 +35,7 @@ function _getFileHashSync(pFileName) { export const getFileHashSync = memoize(_getFileHashSync); /** - * @param {import("watskeburt").IChange} pChange + * @param {IChange} pChange * @return {IRevisionChange} */ export function addCheckSumToChangeSync(pChange) { @@ -79,7 +80,7 @@ export function hasInterestingExtension(pExtensions) { /** * @param {Set} pExtensions - * @returns {(pChange: import("watskeburt").IChange) => boolean} + * @returns {(pChange: IChange) => boolean} */ export function changeHasInterestingExtension(pExtensions) { return (pChange) => { @@ -105,8 +106,8 @@ const DEFAULT_INTERESTING_CHANGE_TYPES = new Set([ ]); /** - * @param {Set=} pInterestingChangeTypes - * @returns {(pChange: import("watskeburt").IChange) => boolean} + * @param {Set=} pInterestingChangeTypes + * @returns {(pChange: IChange) => boolean} */ export function isInterestingChangeType(pInterestingChangeTypes) { return (pChange) => diff --git a/src/cache/metadata-strategy.mjs b/src/cache/metadata-strategy.mjs index f29a900ec..f16f6c03a 100644 --- a/src/cache/metadata-strategy.mjs +++ b/src/cache/metadata-strategy.mjs @@ -14,15 +14,16 @@ import { bus } from "#utl/bus.mjs"; /** * @import {IModule, IRevisionChange, IRevisionData, ICruiseResult } from "../../types/dependency-cruiser.mjs" * @import { IStrictCruiseOptions } from "../../types/strict-options.mjs" + * @import { changeType, IChange } from "watskeburt" */ export default class MetaDataStrategy { /** * @param {string} _pDirectory - * @param {import("../../types/cruise-result.mjs").ICruiseResult} _pCachedCruiseResult + * @param {ICruiseResult} _pCachedCruiseResult * @param {Object} pOptions * @param {Set} pOptions.extensions - * @param {Set=} pOptions.interestingChangeTypes + * @param {Set=} pOptions.interestingChangeTypes * @param {typeof getSHA=} pOptions.shaRetrievalFn * @param {typeof list=} pOptions.diffListFn * @param {typeof addCheckSumToChangeSync=} pOptions.checksumFn @@ -44,7 +45,7 @@ export default class MetaDataStrategy { bus.debug("cache: - getting sha"); const lSHA = await lOptions.shaRetrievalFn(); bus.debug("cache: - getting diff"); - const lDiff = /** @type {import("watskeburt").IChange[]} */ ( + const lDiff = /** @type {IChange[]} */ ( await lOptions.diffListFn({ oldRevision: lSHA }) ); const lChanges = lDiff diff --git a/src/cli/init-config/build-config.mjs b/src/cli/init-config/build-config.mjs index f83287346..88628bce8 100644 --- a/src/cli/init-config/build-config.mjs +++ b/src/cli/init-config/build-config.mjs @@ -2,6 +2,10 @@ import { folderNameArrayToRE } from "./utl.mjs"; import configTemplate from "./config-template.mjs"; +/** + * @import { IInitConfig } from "./types.js"; + */ + /** * @param {string} pString * @returns {string} @@ -22,7 +26,7 @@ function extensionsToString(pExtensions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildNotToTestRule(pInitOptions) { @@ -49,7 +53,7 @@ function buildNotToTestRule(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildTsPreCompilationDepsAttribute(pInitOptions) { @@ -59,7 +63,7 @@ function buildTsPreCompilationDepsAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildCombinedDependenciesAttribute(pInitOptions) { @@ -69,7 +73,7 @@ function buildCombinedDependenciesAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildTsOrJsConfigAttribute(pInitOptions) { @@ -89,7 +93,7 @@ function buildTsOrJsConfigAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildWebpackConfigAttribute(pInitOptions) { @@ -107,7 +111,7 @@ function buildWebpackConfigAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildBabelConfigAttribute(pInitOptions) { @@ -121,7 +125,7 @@ function buildBabelConfigAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildExtensionsAttribute(pInitOptions) { @@ -131,7 +135,7 @@ function buildExtensionsAttribute(pInitOptions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string} */ function buildMainFieldsAttribute(pInitOptions) { @@ -149,7 +153,7 @@ function buildMainFieldsAttribute(pInitOptions) { * Creates a .dependency-cruiser config with a set of basic validations * to the current directory. * - * @param {import("./types.js").IInitConfig} pInitOptions ('Normalized') options that influence the shape of + * @param {IInitConfig} pInitOptions ('Normalized') options that influence the shape of * the configuration * @returns {string} the configuration as a string */ diff --git a/src/cli/init-config/index.mjs b/src/cli/init-config/index.mjs index 3a25d543a..559cede75 100644 --- a/src/cli/init-config/index.mjs +++ b/src/cli/init-config/index.mjs @@ -20,17 +20,21 @@ import { } from "./environment-helpers.mjs"; import { writeRunScriptsToManifest } from "./write-run-scripts-to-manifest.mjs"; +/** + * @import { IInitConfig, IPartialInitConfig, OneShotConfigIDType } from "./types.js"; + */ + const PACKAGE_MANIFEST = `./${_PACKAGE_MANIFEST}`; /** * Create a initialization configuration based on guessed defaults * (e.g. a tsconfig exists => use it and assume typescript is used) * - * @param {import("./types").OneShotConfigIDType} pOneShotConfigId - * @return {import("./types").IPartialInitConfig} an initialization configuration + * @param {OneShotConfigIDType} pOneShotConfigId + * @return {IPartialInitConfig} an initialization configuration */ function getOneShotConfig(pOneShotConfigId) { - /** @type {import("./types").IPartialInitConfig} */ + /** @type {IPartialInitConfig} */ const lBaseConfig = { isMonoRepo: isLikelyMonoRepo(), isTypeModule: isTypeModule(), @@ -46,7 +50,7 @@ function getOneShotConfig(pOneShotConfigId) { babelConfig: getBabelConfigCandidates().shift(), specifyResolutionExtensions: true, }; - /** @type {Map} */ + /** @type {Map} */ const lOneShotConfigs = new Map([ ["yes", lBaseConfig], [ @@ -63,7 +67,7 @@ function getOneShotConfig(pOneShotConfigId) { /** * - * @param {import("./types").IInitConfig} pNormalizedInitConfig + * @param {IInitConfig} pNormalizedInitConfig */ function manifestIsUpdatable(pNormalizedInitConfig) { return ( @@ -73,7 +77,7 @@ function manifestIsUpdatable(pNormalizedInitConfig) { } /** - * @param {boolean|import("./types").OneShotConfigIDType} pInit + * @param {boolean|OneShotConfigIDType} pInit * @param {string=} pConfigFileName * @param {{stdout: NodeJS.WritableStream, stderr: NodeJS.WritableStream}=} pStreams */ diff --git a/src/cli/init-config/normalize-init-options.mjs b/src/cli/init-config/normalize-init-options.mjs index adc99f30b..25a6a98f5 100644 --- a/src/cli/init-config/normalize-init-options.mjs +++ b/src/cli/init-config/normalize-init-options.mjs @@ -8,7 +8,11 @@ import findExtensions from "./find-extensions.mjs"; import meta from "#meta.cjs"; /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @import { IInitConfig, IPartialInitConfig } from "./types.js"; + */ + +/** + * @param {IInitConfig} pInitOptions * @param {string[]} pExtensions * @returns {boolean} */ @@ -25,7 +29,7 @@ function usesTypeScript(pInitOptions, pExtensions) { } /** - * @param {import("./types.js").IInitConfig} pInitOptions + * @param {IInitConfig} pInitOptions * @returns {string[]} */ function getExtensions(pInitOptions) { @@ -38,8 +42,8 @@ function getExtensions(pInitOptions) { } /** - * @param {import("./types.js").IPartialInitConfig} pInitOptions - * @return {import("./types.js").IPartialInitConfig} + * @param {IPartialInitConfig} pInitOptions + * @return {IPartialInitConfig} */ function populate(pInitOptions) { const lReturnValue = { @@ -66,8 +70,8 @@ function populate(pInitOptions) { /** * - * @param {import("./types.js").IPartialInitConfig} pInitOptions - * @return {import("./types.js").IInitConfig} + * @param {IPartialInitConfig} pInitOptions + * @return {IInitConfig} */ export default function normalizeInitOptions(pInitOptions) { let lReturnValue = populate(pInitOptions); diff --git a/src/config-utl/extract-depcruise-options.mjs b/src/config-utl/extract-depcruise-options.mjs index f764a08c1..6db09ed0c 100644 --- a/src/config-utl/extract-depcruise-options.mjs +++ b/src/config-utl/extract-depcruise-options.mjs @@ -1,9 +1,13 @@ import extractDepcruiseConfig from "./extract-depcruise-config/index.mjs"; /** - * - * @param {import('../../../types/configuration.mjs').IConfiguration}} pConfiguration - * @returns {import('../../../types/configuration.mjs').ICruiseOptions} + * @import { IConfiguration } from "../../types/configuration.mjs"; + * @import { ICruiseOptions } from "../../types/options.mjs"; + */ + +/** + * @param {IConfiguration} pConfiguration + * @returns {ICruiseOptions} */ function configuration2options(pConfiguration) { /* c8 ignore next 1 */ @@ -20,7 +24,7 @@ function configuration2options(pConfiguration) { /** * * @param {string} pConfigFileName - * @returns {Promise} + * @returns {Promise} */ export default async function extractDepcruiseOptions(pConfigFileName) { const lReturnValue = await extractDepcruiseConfig(pConfigFileName); diff --git a/src/config-utl/extract-known-violations.mjs b/src/config-utl/extract-known-violations.mjs index 01d40402c..f008b1b12 100644 --- a/src/config-utl/extract-known-violations.mjs +++ b/src/config-utl/extract-known-violations.mjs @@ -3,8 +3,8 @@ import json5 from "json5"; import makeAbsolute from "./make-absolute.mjs"; /** - * @typedef {import("../../types/violations.d.mjs").IViolation} IViolation - * @typedef {import("../../types/shared-types.d.mts").DependencyType} DependencyType + * @import { IViolation } from "../../types/violations.mjs" + * @import { DependencyType } from "../../types/shared-types.mjs" * * @typedef {IViolation & {cycle: Array<{name: string, dependencyTypes: Array}>} | {cycle: Array}} IMaybeOldFormatViolation */ diff --git a/src/extract/extract-dependencies.mjs b/src/extract/extract-dependencies.mjs index 3fda90f8b..f2b872846 100644 --- a/src/extract/extract-dependencies.mjs +++ b/src/extract/extract-dependencies.mjs @@ -15,6 +15,11 @@ import { } from "./helpers.mjs"; import { uniqBy, intersects } from "#utl/array-util.mjs"; +/** + * @import { IDependency } from "../../types/cruise-result.mjs"; + * @import { IResolveOptions, IStrictCruiseOptions, ITranspileOptions } from "../../types/dependency-cruiser.mjs"; + */ + function extractWithTsc(pCruiseOptions, pFileName, pTranspileOptions) { let lDependencies = tscExtract(pCruiseOptions, pFileName, pTranspileOptions); @@ -30,7 +35,7 @@ function extractWithTsc(pCruiseOptions, pFileName, pTranspileOptions) { /** * @param {IStrictCruiseOptions} pCruiseOptions * @param {string} pFileName - * @returns {(IStrictCruiseOptions, string, any) => import("../../types/cruise-result.mjs").IDependency[]} + * @returns {(IStrictCruiseOptions, string, any) => IDependency[]} */ function determineExtractionFunction(pCruiseOptions, pFileName) { let lExtractionFunction = acornExtract; @@ -45,13 +50,13 @@ function determineExtractionFunction(pCruiseOptions, pFileName) { } /** - * @param {import('../../types/dependency-cruiser.js').IStrictCruiseOptions} pCruiseOptions + * @param {IStrictCruiseOptions} pCruiseOptions * @param {string} pFileName * @param {any} pTranspileOptions - * @returns {import('../../types/cruise-result.mjs').IDependency[]} + * @returns {IDependency[]} */ function extractDependencies(pCruiseOptions, pFileName, pTranspileOptions) { - /** @type import('../../types/cruise-result.mjs').IDependency[] */ + /** @type IDependency[] */ let lDependencies = []; if (!pCruiseOptions.extraExtensionsToScan.includes(extname(pFileName))) { @@ -114,7 +119,7 @@ function matchesPattern(pFullPathToFile, pPattern) { /** * - * @param {import("../../types/dependency-cruiser.js").IDependency} pDependency + * @param {IDependency} pDependency * @returns {string} */ function getDependencyUniqueKey({ module, moduleSystem, dependencyTypes }) { @@ -143,12 +148,12 @@ function compareDeps(pLeft, pRight) { * * * @param {string} pFileName path to the file - * @param {import("../../types/dependency-cruiser.js").IStrictCruiseOptions} pCruiseOptions cruise options - * @param {import("../../types/dependency-cruiser.js").IResolveOptions} pResolveOptions webpack 'enhanced-resolve' options - * @param {import("../../types/dependency-cruiser.js").ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options + * @param {IStrictCruiseOptions} pCruiseOptions cruise options + * @param {IResolveOptions} pResolveOptions webpack 'enhanced-resolve' options + * @param {ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options * ('flattened' so there's no need for file access on any * 'extends' option in there) - * @return {import("../../types/dependency-cruiser.js").IDependency[]} an array of dependency objects (see above) + * @return {IDependency[]} an array of dependency objects (see above) */ export default function getDependencies( pFileName, diff --git a/src/extract/extract-stats.mjs b/src/extract/extract-stats.mjs index 2f4afdf0e..4ab5cf411 100644 --- a/src/extract/extract-stats.mjs +++ b/src/extract/extract-stats.mjs @@ -4,10 +4,15 @@ import { } from "./tsc/extract.mjs"; import { getStats as acornStats } from "./acorn/extract.mjs"; +/** + * @import { IStrictCruiseOptions, ITranspileOptions } from "../../types/dependency-cruiser.mjs"; + * @import { IDependency } from "../../types/cruise-result.mjs"; + */ + /** * @param {IStrictCruiseOptions} pCruiseOptions * @param {string} pFileName - * @returns {(IStrictCruiseOptions, string, any) => import("../../types/cruise-result.mjs").IDependency[]} + * @returns {(IStrictCruiseOptions, string, any) => IDependency[]} */ function determineExtractionFunction(pCruiseOptions, pFileName) { let lExtractionFunction = acornStats; @@ -23,11 +28,11 @@ function determineExtractionFunction(pCruiseOptions, pFileName) { * Returns some stats for the module in pFileName * * @param {string} pFileName path to the file - * @param {import("../../types/dependency-cruiser.js").IStrictCruiseOptions} pCruiseOptions cruise options - * @param {import("../../types/dependency-cruiser.js").ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options + * @param {IStrictCruiseOptions} pCruiseOptions cruise options + * @param {ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options * ('flattened' so there's no need for file access on any * 'extends' option in there) - * @return {import("../../types/dependency-cruiser.js").IDependency[]} an array of dependency objects (see above) + * @return {IDependency[]} an array of dependency objects (see above) */ export default function extractStats( pFileName, diff --git a/src/extract/gather-initial-sources.mjs b/src/extract/gather-initial-sources.mjs index 5a522a9dd..dd582b043 100644 --- a/src/extract/gather-initial-sources.mjs +++ b/src/extract/gather-initial-sources.mjs @@ -8,8 +8,11 @@ import getExtension from "#utl/get-extension.mjs"; import pathToPosix from "#utl/path-to-posix.mjs"; /** - * - * @param {import('../../types/options.mjs').IStrictCruiseOptions} pOptions + * @import {IStrictCruiseOptions} from "../../types/options.mjs"; + */ + +/** + * @param {IStrictCruiseOptions} pOptions * @returns {string[]} */ function getScannableExtensions(pOptions) { @@ -37,9 +40,8 @@ function shouldNotBeExcluded(pFullPathToFile, pOptions) { } /** - * * @param {string} pDirectoryName - * @param {import('../../types/options.mjs').IStrictCruiseOptions} pOptions options that + * @param {IStrictCruiseOptions} pOptions options that * @returns {string[]} */ function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) { @@ -90,7 +92,7 @@ function expandGlob(pBaseDirectory, pScannedGlob) { * * @param {string[]} pFileDirectoryAndGlobArray globs and/ or paths to files or * directories to be gathered - * @param {import('../../types/dependency-cruiser.js').IStrictCruiseOptions} pOptions options that + * @param {IStrictCruiseOptions} pOptions options that * influence what needs to be gathered/ scanned * notably useful attributes: * - exclude - regexp of what to exclude diff --git a/src/extract/index.mjs b/src/extract/index.mjs index 3b8fb470f..5d4d8ae45 100644 --- a/src/extract/index.mjs +++ b/src/extract/index.mjs @@ -4,6 +4,11 @@ import gatherInitialSources from "./gather-initial-sources.mjs"; import clearCaches from "./clear-caches.mjs"; import { bus } from "#utl/bus.mjs"; +/** + * @import {IStrictCruiseOptions} from "../../types/options.mjs"; + * @import { IModule, IResolveOptions, ITranspileOptions } from "../../types/dependency-cruiser.mjs"; + */ + /* eslint max-params:0 , max-lines-per-function:0*/ function extractRecursive( pFileName, @@ -142,10 +147,10 @@ function filterExcludedDynamicDependencies(pModule, pExclude) { * returns an array of all the modules it finds that way. * * @param {string[]} pFileDirectoryArray - * @param {import("../../types/dependency-cruiser.js").IStrictCruiseOptions} pCruiseOptions - * @param {import("../../types/dependency-cruiser.js").IResolveOptions} pResolveOptions - * @param {import("../../types/dependency-cruiser.js").ITranspileOptions} pTranspileOptions - * @returns {Partial} + * @param {IStrictCruiseOptions} pCruiseOptions + * @param {IResolveOptions} pResolveOptions + * @param {ITranspileOptions} pTranspileOptions + * @returns {Partial} */ export default function extract( pFileDirectoryArray, diff --git a/src/extract/resolve/determine-dependency-types.mjs b/src/extract/resolve/determine-dependency-types.mjs index 9c2625df1..1056d8525 100644 --- a/src/extract/resolve/determine-dependency-types.mjs +++ b/src/extract/resolve/determine-dependency-types.mjs @@ -9,6 +9,13 @@ import { getPackageRoot, } from "./external-module-helpers.mjs"; +/** + * @import { DependencyType } from "../../../types/shared-types.mjs" + * @import { IResolveOptions, ITranspileOptions } from "../../../types/dependency-cruiser.mjs" + * @import { IDependency } from "../../../types/cruise-result.mjs" + * @import { IResolveOptions } from "../../../types/resolve-options.mjs" + */ + function dependencyKeyHasModuleName( pPackageDependencies, pModuleName, @@ -49,7 +56,7 @@ function determineManifestDependencyTypes( pPackageDependencies, pResolverModulePaths, ) { - /** @type {import("../../../types/shared-types.js").DependencyType[]} */ + /** @type {DependencyType[]} */ let lReturnValue = ["npm-unknown"]; if (Boolean(pPackageDependencies)) { @@ -98,8 +105,8 @@ function dependencyIsBundled(pModule, pPackageDeps) { * @param {string} pModuleName * @param {string} pPackageDeps * @param {string} pFileDirectory - * @param {import("../../../types/dependency-cruiser.js").IResolveOptions} pResolveOptions - * @returns {import("../../../types/shared-types.js").DependencyType[]} + * @param {IResolveOptions} pResolveOptions + * @returns {DependencyType[]} */ function determineNodeModuleDependencyTypes( pModuleName, @@ -107,7 +114,7 @@ function determineNodeModuleDependencyTypes( pFileDirectory, pResolveOptions, ) { - /** @type {import("../../../types/shared-types.js").DependencyType[]} */ + /** @type { DependencyType[] } */ let lReturnValue = determineManifestDependencyTypes( getPackageRoot(pModuleName), pPackageDeps, @@ -127,13 +134,13 @@ function determineNodeModuleDependencyTypes( /** * - * @param {import("../../../types/cruise-result.mjs").IDependency} pDependency + * @param {IDependency} pDependency * @param {string} pModuleName * @param {any} pPackageDeps * @param {string} pFileDirectory - * @param {import("../../../types/dependency-cruiser.js").IResolveOptions} pResolveOptions + * @param {IResolveOptions} pResolveOptions * @param {string} pBaseDirectory - * @returns {import("../../../types/shared-types.js").DependencyType[]} + * @returns {DependencyType[]} */ function determineExternalModuleDependencyTypes( pDependency, @@ -143,7 +150,7 @@ function determineExternalModuleDependencyTypes( pResolveOptions, pBaseDirectory, ) { - /** @type {import("../../../types/shared-types.js").DependencyType[]} */ + /** @type { DependencyType[] } */ let lReturnValue = []; if ( @@ -164,15 +171,15 @@ function determineExternalModuleDependencyTypes( /* eslint max-params:0, complexity:0 */ /** * - * @param {import("../../../types/cruise-result.mjs").IDependency} pDependency the dependency object with all information found hitherto + * @param {IDependency} pDependency the dependency object with all information found hitherto * @param {string} pModuleName the module name as found in the source * @param {any} pManifest a package.json, in object format * @param {string} pFileDirectory the directory relative to which to resolve (only used for npm deps here) - * @param {import("../../../types/resolve-options.mjs").IResolveOptions} pResolveOptions an enhanced resolve 'resolve' key + * @param {IResolveOptions} pResolveOptions an enhanced resolve 'resolve' key * @param {string} pBaseDirectory the base directory dependency cruise is run on - * @param {import("../../../types/dependency-cruiser.mjs").ITranspileOptions} pTranspileOptions + * @param {ITranspileOptions} pTranspileOptions * - * @return {import("../../../types/shared-types.js").DependencyType[]} an array of dependency types for the dependency + * @return { DependencyType[] }an array of dependency types for the dependency */ // eslint-disable-next-line max-lines-per-function export default function determineDependencyTypes( @@ -184,7 +191,7 @@ export default function determineDependencyTypes( pBaseDirectory, pTranspileOptions, ) { - /** @type {import("../../../types/shared-types.js").DependencyType[]}*/ + /** @type {DependencyType[]}*/ let lReturnValue = []; const lResolveOptions = pResolveOptions || {}; diff --git a/src/extract/resolve/index.mjs b/src/extract/resolve/index.mjs index 6e0e83901..9ef69a46b 100644 --- a/src/extract/resolve/index.mjs +++ b/src/extract/resolve/index.mjs @@ -8,12 +8,18 @@ import determineDependencyTypes from "./determine-dependency-types.mjs"; import { getManifest } from "./get-manifest.mjs"; import pathToPosix from "#utl/path-to-posix.mjs"; +/** + * @import { IModule, IResolveOptions } from "../../../types/dependency-cruiser.mjs"; + * @import { IResolveOptions } from "../../../types/resolve-options.mjs"; + * @import { IDependency } from "../../../types/cruise-result.mjs"; + */ + /** * - * @param {import("../../../types/dependency-cruiser.js").IModule} pModule + * @param {IModule} pModule * @param {string} pBaseDirectory * @param {string} pFileDirectory - * @param {import("../../../types/dependency-cruiser.js").IResolveOptions} pResolveOptions + * @param {IResolveOptions} pResolveOptions * @returns {any} */ function resolveModule( @@ -154,14 +160,14 @@ function resolveWithRetry( /** * resolves the module name of the pDependency to a file on disk. * - * @param {Partial } pDependency + * @param {Partial } pDependency * @param {string} pBaseDirectory the directory to consider as base (or 'root') * for resolved files. * @param {string} pFileDirectory the directory of the file the dependency was * detected in - * @param {import("../../../types/resolve-options.mjs").IResolveOptions} pResolveOptions + * @param {IResolveOptions} pResolveOptions * @param {any} pTranspileOptions - * @return {Partial } + * @return {Partial } * * */ diff --git a/src/extract/resolve/module-classifiers.mjs b/src/extract/resolve/module-classifiers.mjs index ee600b788..9270e6259 100644 --- a/src/extract/resolve/module-classifiers.mjs +++ b/src/extract/resolve/module-classifiers.mjs @@ -4,6 +4,11 @@ import { join as posix_join } from "node:path/posix"; import picomatch from "picomatch"; import getExtension from "#utl/get-extension.mjs"; +/** + * @import { IResolveOptions } from "../../../types/resolve-options.mjs" + * @import { ITranspileOptions } from "../../../types/dependency-cruiser.mjs" + */ + let gFollowableExtensionsCache = new Set(); let gFollowableExtensionsCacheInitialized = false; @@ -278,9 +283,9 @@ function matchesTSConfigBaseURL( /** * @param {string} pModuleName * @param {string} pResolvedModuleName - * @param {import("../../../types/resolve-options.mjs").IResolveOptions} pResolveOptions + * @param {importIResolveOptions} pResolveOptions * @param {any} pManifest - * @param {import("../../../types/dependency-cruiser.mjs").ITranspileOptions} pTranspileOptions + * @param {ITranspileOptions} pTranspileOptions * @returns {string[]} */ // eslint-disable-next-line max-params, complexity diff --git a/src/extract/swc/parse.mjs b/src/extract/swc/parse.mjs index 1d85c023b..ce9f3b6a0 100644 --- a/src/extract/swc/parse.mjs +++ b/src/extract/swc/parse.mjs @@ -2,10 +2,14 @@ import memoize, { memoizeClear } from "memoize"; import tryImport from "#utl/try-import.mjs"; import meta from "#meta.cjs"; -/** @type {import('@swc/core')} */ +/** + * @import swcCore, { ParseOptions, ModuleItem } from "@swc/core"; + */ + +/** @type {swcCore} */ const swc = await tryImport("@swc/core", meta.supportedTranspilers.swc); -/** @type {import('@swc/core').ParseOptions} */ +/** @type {ParseOptions} */ const SWC_PARSE_OPTIONS = { dynamicImport: true, // typescript is a superset of ecmascript, so we use typescript always @@ -22,7 +26,7 @@ export function getASTFromSource(pSource) { } function getAST(pFileName) { - /** @type {import('@swc/core')} swc */ + /** @type {swcCore swc} */ return swc.parseFileSync(pFileName, SWC_PARSE_OPTIONS); } @@ -32,7 +36,7 @@ function getAST(pFileName) { * return the result from a cache * * @param {string} pFileName - the name of the file to compile - * @return {import('@swc/core').ModuleItem[]} - an (swc) AST + * @return {ModuleItem[]} - an (swc) AST */ export const getASTCached = memoize(getAST); diff --git a/src/extract/tsc/extract-typescript-deps.mjs b/src/extract/tsc/extract-typescript-deps.mjs index 3146abf4c..a1154a5d3 100644 --- a/src/extract/tsc/extract-typescript-deps.mjs +++ b/src/extract/tsc/extract-typescript-deps.mjs @@ -4,7 +4,11 @@ import tryImport from "#utl/try-import.mjs"; import meta from "#meta.cjs"; -/** @type {import("typescript")} */ +/** + * @import typescript, {Node} from "typescript" + */ + +/** @type {typescript} */ const typescript = await tryImport( "typescript", meta.supportedTranspilers.typescript, @@ -47,7 +51,7 @@ function isTypeOnlyExport(pStatement) { /** * Get all import statements from the top level AST node * - * @param {import("typescript").Node} pAST - the (top-level in this case) AST node + * @param {Node} pAST - the (top-level in this case) AST node * @returns {{module: string; moduleSystem: string; exoticallyRequired: boolean; dependencyTypes?: string[];}[]} - * all import statements in the (top level) AST node */ @@ -71,7 +75,7 @@ function extractImports(pAST) { /** * Get all export statements from the top level AST node * - * @param {import("typescript").Node} pAST - the (top-level in this case) AST node + * @param {Node} pAST - the (top-level in this case) AST node * @returns {{module: string; moduleSystem: string; exoticallyRequired: boolean; dependencyTypes?: string[];}[]} - * all export statements in the (top level) AST node */ @@ -99,7 +103,7 @@ function extractExports(pAST) { * Ignores import equals of variables (e.g. import protocol = ts.server.protocol * which happens in typescript/lib/protocol.d.ts) * - * @param {import("typescript").Node} pAST - the (top-level in this case) AST node + * @param {Node} pAST - the (top-level in this case) AST node * @returns {{module: string, moduleSystem: string;exoticallyRequired: boolean;}[]} - all import equals statements in the * (top level) AST node */ @@ -124,7 +128,7 @@ function extractImportEquals(pAST) { * might be wise to distinguish the three types of /// directive that * can come out of this as the resolution algorithm might differ * - * @param {import("typescript").Node} pAST - typescript syntax tree + * @param {Node} pAST - typescript syntax tree * @returns {{module: string, moduleSystem: string}[]} - 'tripple slash' dependencies */ function extractTripleSlashDirectives(pAST) { @@ -280,10 +284,10 @@ function extractJSDocImports(pJSDocNodes) { /** * Walks the AST and collects all dependencies * - * @param {import("typescript").Node} pASTNode - the AST node to start from + * @param {Node} pASTNode - the AST node to start from * @param {string[]} pExoticRequireStrings - exotic require strings to look for * @param {boolean} pDetectJSDocImports - whether to detect jsdoc imports - * @returns {(pASTNode: import("typescript").Node) => void} - the walker function + * @returns {(pASTNode: Node) => void} - the walker function */ // eslint-disable-next-line max-lines-per-function function walk(pResult, pExoticRequireStrings, pDetectJSDocImports) { @@ -362,7 +366,7 @@ function walk(pResult, pExoticRequireStrings, pDetectJSDocImports) { * returns an array of dependencies that come potentially nested within * a source file, like commonJS or dynamic imports * - * @param {import("typescript").Node} pAST - typescript syntax tree + * @param {Node} pAST - typescript syntax tree * @param {string[]} pExoticRequireStrings - exotic require strings to look for * @param {boolean} pDetectJSDocImports - whether to detect jsdoc imports * @returns {{module: string, moduleSystem: string}[]} - all commonJS dependencies @@ -382,7 +386,7 @@ function extractNestedDependencies( /** * returns all dependencies in the AST * - * @type {(pTypeScriptAST: (import("typescript").Node), pExoticRequireStrings: string[], pDetectJSDocImports: boolean) => {module: string, moduleSystem: string, dynamic: boolean}[]} + * @type {(pTypeScriptAST: (Node), pExoticRequireStrings: string[], pDetectJSDocImports: boolean) => {module: string, moduleSystem: string, dynamic: boolean}[]} */ export default function extractTypeScriptDependencies( pTypeScriptAST, diff --git a/src/graph-utl/consolidate-module-dependencies.mjs b/src/graph-utl/consolidate-module-dependencies.mjs index aecc98c6c..cb3c67790 100644 --- a/src/graph-utl/consolidate-module-dependencies.mjs +++ b/src/graph-utl/consolidate-module-dependencies.mjs @@ -1,6 +1,10 @@ import { compareRules } from "./compare.mjs"; import { uniq } from "#utl/array-util.mjs"; +/** + * @import { IDependency, IModule } from "../../types/cruise-result.mjs"; + */ + function mergeDependency(pLeftDependency, pRightDependency) { return { ...pLeftDependency, @@ -30,8 +34,8 @@ function mergeDependencies(pResolvedName, pDependencies) { } /** - * @param {import('../../types/dependency-cruiser.mjs').IDependency[]} pDependencies - * @returns {import('../../types/dependency-cruiser.mjs').IDependency[]} + * @param {IDependency[]} pDependencies + * @returns {IDependency[]} */ function consolidateDependencies(pDependencies) { let lDependencies = structuredClone(pDependencies); @@ -51,8 +55,8 @@ function consolidateDependencies(pDependencies) { } /** - * @param {import('../../types/dependency-cruiser.mjs').IModule} pModule - * @returns {import('../../types/dependency-cruiser.mjs').IModule} + * @param {IModule} pModule + * @returns {IModule} */ export default function consolidateModuleDependencies(pModule) { return { diff --git a/src/graph-utl/filter-bank.mjs b/src/graph-utl/filter-bank.mjs index 1420aaedb..f34851493 100644 --- a/src/graph-utl/filter-bank.mjs +++ b/src/graph-utl/filter-bank.mjs @@ -5,6 +5,11 @@ import { dependencyMatchesFilter, } from "./match-facade.mjs"; +/** + * @import { IModule } from "../../types/cruise-result.mjs"; + * @import { IStrictReachesType } from "../../types/strict-filter-types.mjs"; + */ + function includeOnly(pModules, pIncludeFilter) { return pIncludeFilter.path ? pModules @@ -33,9 +38,9 @@ function exclude(pModules, pExcludeFilter) { } /** * - * @param {import("../../types/cruise-result.mjs").IModule[]} pModules - * @param {import("../../types/strict-filter-types.js").IStrictReachesType} pReachesFilter - * @returns {import("../../types/cruise-result.mjs").IModule[]} + * @param {IModule[]} pModules + * @param {IStrictReachesType} pReachesFilter + * @returns {IModule[]} */ function filterReaches(pModules, pReachesFilter) { const lModuleNamesToReach = pModules diff --git a/src/graph-utl/indexed-module-graph.mjs b/src/graph-utl/indexed-module-graph.mjs index ae7bcb2c6..4e1a982d9 100644 --- a/src/graph-utl/indexed-module-graph.mjs +++ b/src/graph-utl/indexed-module-graph.mjs @@ -1,14 +1,10 @@ // @ts-check /* eslint-disable security/detect-object-injection */ /** - * @typedef {import("../../types/cruise-result.d.mts").IFolderDependency} IFolderDependency - * @typedef {import("../../types/cruise-result.d.mts").IDependency} IDependency - * @typedef {import("../../types/cruise-result.d.mts").IFolder} IFolder - * @typedef {import("../../types/cruise-result.d.mts").IModule} IModule - * @typedef {import("../../types/shared-types.d.mts").DependencyType} DependencyType - * @typedef {import("../../types/shared-types.d.mjs").IMiniDependency} IMiniDependency - * - * @typedef {(IDependency|IFolderDependency) & {name:string; dependencyTypes?: DependencyType[]}} IEdge + * @import { IFolderDependency, IDependency, IFolder, IModule } from "../../types/cruise-result.mjs" + * @import { DependencyType, IMiniDependency } from "../../types/shared-types.mjs" + +* @typedef {(IDependency|IFolderDependency) & {name:string; dependencyTypes?: DependencyType[]}} IEdge * @typedef {IModule|IFolder} IModuleOrFolder * @typedef {IModuleOrFolder & {dependencies: IEdge[]}} IVertex */ diff --git a/src/graph-utl/rule-set.mjs b/src/graph-utl/rule-set.mjs index ad05406ae..8366798cd 100644 --- a/src/graph-utl/rule-set.mjs +++ b/src/graph-utl/rule-set.mjs @@ -1,3 +1,7 @@ +/** + * @import {IFlattenedRuleSet, IForbiddenRuleType} from '../../types/rule-set.mjs'; + */ + /** * Finds the first rule in the rule set that has name pName, * and undefined if no such rule exists/ the rule is an 'allowed' @@ -5,9 +9,9 @@ * * (this thing probably belongs in a model-like folder and not in utl) * - * @param {import("../../types/dependency-cruiser").IFlattenedRuleSet} pRuleSet - The rule set to search in + * @param {IFlattenedRuleSet} pRuleSet - The rule set to search in * @param {string} pName - The rule name to look for - * @return {import("../../types/rule-set").IForbiddenRuleType|undefined} - a rule (or 'undefined' if nothing found) + * @return {IForbiddenRuleType|undefined} - a rule (or 'undefined' if nothing found) */ export function findRuleByName(pRuleSet, pName) { const lNamedRules = (pRuleSet?.forbidden ?? []).concat( @@ -29,7 +33,7 @@ function ruleHasALicenseLikeAttribute(pRule) { * * Returns false in all other cases * - * @param {import('../../types/dependency-cruiser').IFlattenedRuleSet} pRuleSet + * @param {IFlattenedRuleSet} pRuleSet * @return {boolean} */ export function ruleSetHasLicenseRule(pRuleSet) { @@ -38,9 +42,9 @@ export function ruleSetHasLicenseRule(pRuleSet) { (pRuleSet?.allowed ?? []).some(ruleHasALicenseLikeAttribute) ); } + /** - * - * @param {import('../../types/dependency-cruiser').IFlattenedRuleSet} pRuleSet + * @param {IFlattenedRuleSet} pRuleSet * @return {boolean} */ export function ruleSetHasDeprecationRule(pRuleSet) { diff --git a/src/main/options/assert-validity.mjs b/src/main/options/assert-validity.mjs index 5aa713d37..2c0d9e9d1 100644 --- a/src/main/options/assert-validity.mjs +++ b/src/main/options/assert-validity.mjs @@ -2,6 +2,10 @@ import safeRegex from "safe-regex"; import { getAvailableReporters } from "#report/index.mjs"; +/** + * @import { ICruiseOptions, IFormatOptions } from "../../../types/options.mjs"; + */ + const MODULE_SYSTEM_LIST_RE = /^(?:(?:cjs|amd|es6|tsd)(?:,|$)){1,4}/gi; const VALID_DEPTH_RE = /^\d{1,2}$/g; @@ -96,7 +100,7 @@ function assertPathsSafety(pFilterOption) { /** * @param {any} pOptions * @throws {Error} - * @returns {import("../../../types/dependency-cruiser.js").ICruiseOptions} + * @returns {ICruiseOptions} */ export function assertCruiseOptionsValid(pOptions) { let lReturnValue = {}; @@ -132,7 +136,7 @@ export function assertCruiseOptionsValid(pOptions) { /** * - * @param {import("../../../types/dependency-cruiser.js").IFormatOptions} pFormatOptions + * @param {IFormatOptions} pFormatOptions * @throws {Error} */ export function assertFormatOptionsValid(pFormatOptions) { diff --git a/src/main/options/normalize.mjs b/src/main/options/normalize.mjs index 9407d0dca..f34122118 100644 --- a/src/main/options/normalize.mjs +++ b/src/main/options/normalize.mjs @@ -3,6 +3,14 @@ import { normalizeREProperties } from "../helpers.mjs"; import defaults from "./defaults.mjs"; import { uniq } from "#utl/array-util.mjs"; +/** + * @import { ICruiseResult } from "../../../types/cruise-result.mjs"; + * @import { ICruiseOptions, IFormatOptions } from "../../../types/options.mjs"; + * @import { IStrictCruiseOptions, IStrictFormatOptions } from "../../../types/strict-options.mjs"; + * @import { IForbiddenRuleType, IFlattenedRuleSet } from "../../../types/rule-set.mjs"; + * @import { ICacheOptions } from "../../../types/cache-options.mjs"; + */ + const DEFAULT_CACHE_FOLDER = "node_modules/.cache/dependency-cruiser"; const DEFAULT_CACHE_STRATEGY = "metadata"; @@ -65,7 +73,7 @@ function normalizeCollapse(pCollapse) { } function normalizeFocusDepth(pFormatOptions) { - /** @type {import("../../../types/dependency-cruiser.js").IFormatOptions}*/ + /** @type {IFormatOptions}*/ let lFormatOptions = structuredClone(pFormatOptions); if (Object.hasOwn(lFormatOptions, "focusDepth")) { if (lFormatOptions?.focus) { @@ -81,7 +89,7 @@ function normalizeFocusDepth(pFormatOptions) { /** * - * @param {import("../../../types/dependency-cruiser.js").IForbiddenRuleType} pRule + * @param {IForbiddenRuleType} pRule * @returns {boolean} */ function hasMetricsRule(pRule) { @@ -96,7 +104,7 @@ function hasMetricsRule(pRule) { /** * - * @param {import("../../../types/dependency-cruiser.js").IFlattenedRuleSet} pRuleSet + * @param {IFlattenedRuleSet} pRuleSet * @returns {boolean} */ function ruleSetHasMetricsRule(pRuleSet) { @@ -109,7 +117,7 @@ function ruleSetHasMetricsRule(pRuleSet) { /** * - * @param {import('../../../types/dependency-cruiser.js').ICruiseOptions} pOptions + * @param {ICruiseOptions} pOptions * @returns Boolean */ function reporterShowsMetrics(pOptions) { @@ -122,7 +130,7 @@ function reporterShowsMetrics(pOptions) { /** * Determines whether (instability) metrics should be calculated * - * @param {import('../../../types/dependency-cruiser.js').ICruiseOptions} pOptions + * @param {ICruiseOptions} pOptions * @returns Boolean */ function shouldCalculateMetrics(pOptions) { @@ -135,8 +143,8 @@ function shouldCalculateMetrics(pOptions) { } /** - * @param {string|boolean|Partial} pCacheOptions - * @returns {import("../../../types/cache-options.js").ICacheOptions} + * @param {string|boolean|Partial} pCacheOptions + * @returns {ICacheOptions} */ function normalizeCacheOptions(pCacheOptions) { let lNormalizedCacheOptions = pCacheOptions; @@ -163,12 +171,12 @@ function normalizeCacheOptions(pCacheOptions) { /** * - * @param {import('../../../types/options.mjs').ICruiseOptions} pOptions + * @param {ICruiseOptions} pOptions * @param {string[]} pFileAndDirectoryArray - * @returns {import('../../../types/strict-options.js').IStrictCruiseOptions} + * @returns {IStrictCruiseOptions} */ export function normalizeCruiseOptions(pOptions, pFileAndDirectoryArray = []) { - /** @type {import('../../../types/strict-options.js').IStrictCruiseOptions} */ + /** @type {IStrictCruiseOptions} */ let lReturnValue = { baseDir: process.cwd(), ...defaults, @@ -219,9 +227,8 @@ export function normalizeCruiseOptions(pOptions, pFileAndDirectoryArray = []) { } /** - * - * @param {import("../../../types/dependency-cruiser.js").IFormatOptions} pFormatOptions - * @returns {import("../../../types/strict-options.js").IStrictFormatOptions} + * @param {IFormatOptions} pFormatOptions + * @returns {IStrictFormatOptions} */ export function normalizeFormatOptions(pFormatOptions) { let lFormatOptions = structuredClone(pFormatOptions); diff --git a/src/main/report-wrap.mjs b/src/main/report-wrap.mjs index 334a97455..664805bef 100644 --- a/src/main/report-wrap.mjs +++ b/src/main/report-wrap.mjs @@ -6,10 +6,15 @@ import { compareModules } from "#graph-utl/compare.mjs"; import stripSelfTransitions from "#graph-utl/strip-self-transitions.mjs"; /** - * - * @param {import('../../types/dependency-cruiser.js').ICruiseResult} pResult - * @param {import('../../types/dependency-cruiser.js').IFormatOptions} pFormatOptions - * @returns {import('../../types/dependency-cruiser.js').ICruiseResult} + * @import { ICruiseResult } from "../../types/cruise-result.mjs"; + * @import { IFormatOptions } from "../../types/options.mjs"; + * @import { IReporterOutput } from "../../types/dependency-cruiser.mjs"; + */ + +/** + * @param {ICruiseResult} pResult + * @param {IFormatOptions} pFormatOptions + * @returns {ICruiseResult} */ function reSummarizeResults(pResult, pFormatOptions) { let lModules = applyFilters(pResult.modules, pFormatOptions); @@ -44,9 +49,9 @@ function getReporterSection(pOutputType) { /** * - * @param {import("../..).ICruiseResult} pResult result of a previous run of dependency-cruiser - * @param {import("../../types/dependency-cruiser.js").IFormatOptions} pFormatOptions - * @returns {import("../../types/dependency-cruiser.js").IReporterOutput} + * @param {ICruiseResult} pResult result of a previous run of dependency-cruiser + * @param {IFormatOptions} pFormatOptions + * @returns {IReporterOutput} */ export default async function reportWrap(pResult, pFormatOptions) { const lReportFunction = await getReporter(pFormatOptions.outputType); diff --git a/src/main/resolve-options/normalize.mjs b/src/main/resolve-options/normalize.mjs index 7b5e43d8b..99347eef0 100644 --- a/src/main/resolve-options/normalize.mjs +++ b/src/main/resolve-options/normalize.mjs @@ -6,8 +6,13 @@ import { ruleSetHasLicenseRule, } from "#graph-utl/rule-set.mjs"; +/** + * @import { IResolveOptions } from "../../../types/resolve-options.mjs"; + * @import { ICruiseOptions } from "../../../types/options.mjs"; + */ + const DEFAULT_CACHE_DURATION = 4000; -/** @type {Partial} */ +/** @type {Partial} */ const DEFAULT_RESOLVE_OPTIONS = { symlinks: true, // if a webpack config overrides extensions, there's probably @@ -41,7 +46,7 @@ function omit(pObject, pProperty) { /** * * @param {Number} pCacheDuration - * @returns {Partial} + * @returns {Partial} */ function getNonOverridableResolveOptions(pCacheDuration) { return { @@ -129,8 +134,8 @@ async function compileResolveOptions( } /** - * @param {import("../../../types/dependency-cruiser").IResolveOptions} pResolveOptions - * @param {import("../../../types/dependency-cruiser").ICruiseOptions} pOptions + * @param {IResolveOptions} pResolveOptions + * @param {ICruiseOptions} pOptions * @param {import("typescript").ParsedTsconfig} pTSConfig * @returns */ diff --git a/src/main/rule-set/assert-validity.mjs b/src/main/rule-set/assert-validity.mjs index af17da0e2..3140370b2 100644 --- a/src/main/rule-set/assert-validity.mjs +++ b/src/main/rule-set/assert-validity.mjs @@ -4,6 +4,9 @@ import { assertCruiseOptionsValid } from "../options/assert-validity.mjs"; import { normalizeToREAsString } from "../helpers.mjs"; import configurationSchema from "#configuration-schema"; import { has, get } from "#utl/object-util.mjs"; +/** + * @import { IConfiguration } from "../../../types/configuration.mjs"; + */ const ajv = new Ajv(); // the default for this is 25 - as noted in the safe-regex source code already, @@ -84,8 +87,8 @@ function assertRuleSafety(pRule) { * - the rule set adheres to the [config json schema](../../schema/configuration.schema.json) * - any regular expression in the rule set is 'safe' (~= won't be too slow) * - * @param {import("../../../types/configuration.js").IConfiguration} pConfiguration The configuration to validate - * @return {import("../../../types/configuration.js").IConfiguration} The configuration as passed + * @param {IConfiguration} pConfiguration The configuration to validate + * @return {IConfiguration} The configuration as passed * @throws {Error} An error with the reason for the error as * a message */ diff --git a/src/main/rule-set/normalize.mjs b/src/main/rule-set/normalize.mjs index dec1831d6..ced729f6e 100644 --- a/src/main/rule-set/normalize.mjs +++ b/src/main/rule-set/normalize.mjs @@ -1,5 +1,15 @@ import { normalizeREProperties, normalizeToREAsString } from "../helpers.mjs"; +/** + * @import { RuleScopeType } from "../../../types/shared-types.mjs"; + * @import { MiniDependencyRestrictionType } from "../../../types/restrictions.mjs"; + * @import { IStrictMiniDependencyRestriction } from "../../../types/strict-restrictions.mjs"; + * @import { IAnyRuleType } from "../../../types/rule-set.mjs"; + * @import { IStrictAnyRuleType } from "../../../types/strict-rule-set.mjs"; + * @import { IFlattenedRuleSet } from "../../../types/rule-set.mjs"; + * @import { IStrictRuleSet } from "../../../types/strict-rule-set.mjs"; + */ + const VALID_SEVERITIES = /^(?:error|warn|info|ignore)$/; const DEFAULT_SEVERITY = "warn"; const DEFAULT_RULE = "unnamed"; @@ -20,16 +30,16 @@ function normalizeName(pRuleName) { } /** - * @param {import("../../../types/shared-types.mjs").RuleScopeType} pScope? - * @returns {import("../../../types/shared-types.mjs").RuleScopeType} + * @param {RuleScopeType} pScope? + * @returns {RuleScopeType} */ function normalizeScope(pScope) { return pScope ? pScope : DEFAULT_SCOPE; } /** - * @param {import("../../../types/restrictions.mjs").MiniDependencyRestrictionType} pVia - * @returns {import("../../../types/strict-restrictions.mjs").IStrictMiniDependencyRestriction} + * @param {MiniDependencyRestrictionType} pVia + * @returns {IStrictMiniDependencyRestriction} */ function normalizeVia(pVia) { let lReturnValue = {}; @@ -77,8 +87,8 @@ function normalizeVias(pRuleTo) { } /** - * @param {import("../../../types/rule-set.mjs").IAnyRuleType} pRule - * @returns {import("../../../types/strict-rule-set.mjs").IStrictAnyRuleType} + * @param {IAnyRuleType} pRule + * @returns {IStrictAnyRuleType} */ function normalizeRule(pRule) { const lRuleTo = normalizeVias(pRule.to); @@ -99,8 +109,8 @@ function normalizeRule(pRule) { * - rule name (default 'unnamed') * - severity (default 'warn') * - * @param {import("../../../types/dependency-cruiser.js").IFlattenedRuleSet} pRuleSet - * @return {import("../../../types/strict-rule-set.js").IStrictRuleSet} + * @param {IFlattenedRuleSet} pRuleSet + * @return {IStrictRuleSet} */ export default function normalizeRuleSet(pRuleSet) { const lRuleSet = structuredClone(pRuleSet); diff --git a/src/validate/index.mjs b/src/validate/index.mjs index 4d8da544c..d3530a19a 100644 --- a/src/validate/index.mjs +++ b/src/validate/index.mjs @@ -3,6 +3,10 @@ import matchDependencyRule from "./match-dependency-rule.mjs"; import violatesRequiredRule from "./violates-required-rule.mjs"; import matchFolderRule from "./match-folder-dependency-rule.mjs"; +/** + * @import { IValidationResult } from "./index.d.ts"; + */ + function compareSeverity(pFirst, pSecond) { const lSeverity2Int = { error: 1, @@ -67,10 +71,10 @@ function validateAgainstRequiredRules(pRuleSet, pModule, pMatchModule) { * @param {*} pFrom * @param {*} pTo * @param {*} pMatchModule - * @returns {import("./index.js").IValidationResult} + * @returns {IValidationResult} */ function validateAgainstRules(pRuleSet, pFrom, pTo, pMatchModule) { - /** @type {import("./index.js").IValidationResult} */ + /** @type {IValidationResult} */ let lReturnValue = { valid: true }; const lFoundRuleViolations = validateAgainstAllowedRules( diff --git a/src/validate/match-dependency-rule.mjs b/src/validate/match-dependency-rule.mjs index 25a3d71fe..2ddc86627 100644 --- a/src/validate/match-dependency-rule.mjs +++ b/src/validate/match-dependency-rule.mjs @@ -18,9 +18,13 @@ import { import { extractGroups } from "#utl/regex-util.mjs"; /** - * - * @param {import("../../types/dependency-cruiser.mjs").IModule} pFrom - * @param {import("../../types/dependency-cruiser.mjs").IDependency} pTo + * @import { IDependency, IModule } from "../../types/cruise-result.mjs"; + * @import { IAnyRuleType } from "../../types/rule-set.mjs"; + */ + +/** + * @param {IModule} pFrom + * @param {IDependency} pTo * @returns {(pRule) => boolean} */ function match(pFrom, pTo) { @@ -57,7 +61,7 @@ function match(pFrom, pTo) { } /** - * @param {import("../../types/rule-set.d.mts").IAnyRuleType} pRule + * @param {IAnyRuleType} pRule * @returns boolean */ const isInteresting = (pRule) => diff --git a/src/validate/match-module-rule-helpers.mjs b/src/validate/match-module-rule-helpers.mjs index 9590695db..017e38289 100644 --- a/src/validate/match-module-rule-helpers.mjs +++ b/src/validate/match-module-rule-helpers.mjs @@ -7,12 +7,18 @@ import { matchesModulePathNot, } from "./matchers.mjs"; import { extractGroups } from "#utl/regex-util.mjs"; + +/** + * @import { IModule } from "../../types/cruise-result.mjs"; + * @import { IAnyRuleType } from "../../types/rule-set.mjs"; + */ + /** * Returns true if pRule is an orphan rule and pModule is an orphan. * Returns false in all other cases * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule - * @param {import("../../types/cruise-result.mjs").IModule} pModule + * @param {IAnyRuleType} pRule + * @param {IModule} pModule * @returns {boolean} */ export function matchesOrphanRule(pRule, pModule) { @@ -30,8 +36,8 @@ export function matchesOrphanRule(pRule, pModule) { * criteria. * Returns false in all other cases * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule - * @param {import("../../types/cruise-result.mjs").IModule} pModule + * @param {IAnyRuleType} pRule + * @param {IModule} pModule * @returns {boolean} */ export function matchesReachableRule(pRule, pModule) { @@ -63,8 +69,8 @@ export function matchesReachableRule(pRule, pModule) { * criteria. * Returns false in all other cases * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule - * @param {import("../../types/cruise-result.mjs").IModule} pModule + * @param {IAnyRuleType} pRule + * @param {IModule} pModule * @returns {boolean} */ export function matchesReachesRule(pRule, pModule) { @@ -85,7 +91,7 @@ export function matchesReachesRule(pRule, pModule) { } /** * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule + * @param {IAnyRuleType} pRule * @param {string[]} pDependents * @returns {boolean} */ @@ -105,8 +111,8 @@ function dependentsCountsMatch(pRule, pDependents) { /** * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule - * @param {import("../../types/cruise-result.mjs").IModule} pModule + * @param {IAnyRuleType} pRule + * @param {IModule} pModule * @returns {boolean} */ // eslint-disable-next-line complexity diff --git a/src/validate/match-module-rule.mjs b/src/validate/match-module-rule.mjs index cba9fd608..08d34d708 100644 --- a/src/validate/match-module-rule.mjs +++ b/src/validate/match-module-rule.mjs @@ -7,9 +7,13 @@ import { } from "./match-module-rule-helpers.mjs"; /** - * - * @param {import("../../types/cruise-result.mjs").IModule} pModule - * @returns {(pRule:import("../../types/rule-set.mjs").IAnyRuleType) => boolean} + * @import { IModule } from "../../types/cruise-result.mjs"; + * @import { IAnyRuleType } from "../../types/rule-set.mjs"; + */ + +/** + * @param {IModule} pModule + * @returns {(pRule:IAnyRuleType) => boolean} */ function match(pModule) { return (pRule) => @@ -20,8 +24,7 @@ function match(pModule) { } /** - * - * @param {import("../../types/rule-set.mjs").IAnyRuleType} pRule + * @param {IAnyRuleType} pRule * @returns boolean */ const isInteresting = (pRule) => From 2daf3d3bd68b198d1028eb45686247cc6b776891 Mon Sep 17 00:00:00 2001 From: sverweij Date: Sun, 17 Nov 2024 20:22:03 +0100 Subject: [PATCH 12/12] doc: documents bracket style imports as a future feature --- doc/options-reference.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/options-reference.md b/doc/options-reference.md index 3d3406510..5cb4a2864 100644 --- a/doc/options-reference.md +++ b/doc/options-reference.md @@ -791,8 +791,9 @@ you can provide the parameters like so: If you have dependencies in JSDoc comments that you want to take into account you can set this option to `true`. This will make dependency-cruiser look at -TypeScript 5.5+ [`@import` tags](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag) -as well as to bracket style imports (e.g. `/** @type {import('./thing').SomeType} */`) +TypeScript 5.5+ [`@import` tags](https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#the-jsdoc-import-tag). + +In the near future it will also look to bracket style imports (e.g. `/** @type {import('./thing').SomeType} */`) in all JSDoc tags they can occur in (e.g. `@param`, `@returns`, `@type`, `@typedef` etc). As currently on the TypeScript compiler (`tsc`) can detect these imports, switching @@ -801,7 +802,7 @@ it uses the TypeScript compiler to parse not only TypeScript but also JavaScript ```javascript options: { - detectJSDocImports: true // implies `parser: "tsc"` + detectJSDocImports: true; // implies `parser: "tsc"` } ```