diff --git a/Makefile b/Makefile index cdabba429..54242fc0e 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ NODE=node RM=rm -f GENERATED_SOURCES=src/cli/init-config/config.js.template.js \ src/report/dot/dot.template.js \ - src/report/error-html/error-html.template.js \ src/schema/baseline-violations.schema.mjs \ src/schema/configuration.schema.mjs \ src/schema/cruise-result.schema.mjs \ diff --git a/src/report/error-html/error-html-template.mjs b/src/report/error-html/error-html-template.mjs new file mode 100644 index 000000000..a94ee0bc9 --- /dev/null +++ b/src/report/error-html/error-html-template.mjs @@ -0,0 +1,212 @@ +export default ` + + + dependency-cruiser - results + + + + + + + + +

Forbidden dependency check - results

+ +

Summary

+

+

+ {{totalCruised}} modules +
+
+ {{totalDependenciesCruised}} dependencies +
+
+ {{error}} errors +
+
+ {{warn}} warnings +
+
+ {{info}} informational +
+
+ {{ignore}} ignored +
+   +

+ {{violatedRulesTable}} +
+ + {{violationsList}} + + +`; diff --git a/src/report/error-html/error-html.template.hbs b/src/report/error-html/error-html.template.hbs deleted file mode 100644 index 860f90beb..000000000 --- a/src/report/error-html/error-html.template.hbs +++ /dev/null @@ -1,295 +0,0 @@ - - - - - dependency-cruiser - results - - - - - - - - -

Forbidden dependency check - results

- -

Summary

-

-

- {{summary.totalCruised}} modules -
-
- {{summary.totalDependenciesCruised}} dependencies -
-
- {{summary.error}} errors -
-
- {{summary.warn}} warnings -
-
- {{summary.info}} informational -
- {{#if summary.ignore}} -
- {{summary.ignore}} ignored -
- {{/if}} -   -

- - - - - - - - - {{#if summary.ignore}}{{/if}} - - - {{#summary.agggregateViolations}} - - - - - - {{#if ../summary.ignore}}{{/if}} - - - {{/summary.agggregateViolations}} - - - - -
severityruleviolationsignoredexplanation
{{#if unviolated}}{{else}}{{/if}}{{severity}}{{name}} - {{count}}{{ignoredCount}}{{comment}}
- - -
-
- - {{#if summary.violations}} - -

All violations

- - - - - - - - - - - {{#summary.violations}} - - - - - - - - {{/summary.violations}} - {{#if summary.ignore}} - - - - {{/if}} - -
severityrulefromto
{{rule.severity}}{{rule.name}}{{from}}{{{fromExtras}}}{{{to}}}
- - -
-
- {{else}} -

No violations found

-

Get gummy bears to celebrate.

- {{/if}} - - - - \ No newline at end of file diff --git a/src/report/error-html/error-html.template.js b/src/report/error-html/error-html.template.js deleted file mode 100644 index ff8063593..000000000 --- a/src/report/error-html/error-html.template.js +++ /dev/null @@ -1 +0,0 @@ -var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["error-html.template.hbs"]=template({1:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'
\n '+n.escapeExpression(n.lambda(null!=(n=null!=l?a(l,"summary"):l)?a(n,"ignore"):n,l))+" ignored\n
\n"},3:function(n,l,e,o,t){return"ignored"},5:function(n,l,e,o,t,a,r){var i,s,u=null!=l?l:n.nullContext||{},d=n.hooks.helperMissing,c="function",p=n.escapeExpression,h=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return" \n "+(null!=(i=h(e,"if").call(u,null!=l?h(l,"unviolated"):l,{name:"if",hash:{},fn:n.program(8,t,0,a,r),inverse:n.program(10,t,0,a,r),data:t,loc:{start:{line:219,column:20},end:{line:220,column:66}}}))?i:"")+"\n "+p(typeof(s=null!=(s=h(e,"severity")||(null!=l?h(l,"severity"):l))?s:d)==c?s.call(u,{name:"severity",hash:{},data:t,loc:{start:{line:221,column:82},end:{line:221,column:94}}}):s)+'\n '+p(typeof(s=null!=(s=h(e,"name")||(null!=l?h(l,"name"):l))?s:d)==c?s.call(u,{name:"name",hash:{},data:t,loc:{start:{line:222,column:107},end:{line:222,column:115}}}):s)+"\n \n "+p(typeof(s=null!=(s=h(e,"count")||(null!=l?h(l,"count"):l))?s:d)==c?s.call(u,{name:"count",hash:{},data:t,loc:{start:{line:224,column:28},end:{line:224,column:37}}}):s)+"\n "+(null!=(i=h(e,"if").call(u,null!=(i=null!=r[1]?h(r[1],"summary"):r[1])?h(i,"ignore"):i,{name:"if",hash:{},fn:n.program(16,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:225,column:16},end:{line:225,column:90}}}))?i:"")+"\n "+p(typeof(s=null!=(s=h(e,"comment")||(null!=l?h(l,"comment"):l))?s:d)==c?s.call(u,{name:"comment",hash:{},data:t,loc:{start:{line:226,column:20},end:{line:226,column:31}}}):s)+"\n \n"},6:function(n,l,e,o,t){return'class="unviolated" '},8:function(n,l,e,o,t){return''},10:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'✗'},12:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(e=null!=(e=a(e,"ok")||(null!=l?a(l,"ok"):l))?e:n.hooks.helperMissing)?e.call(null!=l?l:n.nullContext||{},{name:"ok",hash:{},data:t,loc:{start:{line:221,column:45},end:{line:221,column:51}}}):e)+'"'},14:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'"'+n.escapeExpression("function"==typeof(e=null!=(e=a(e,"severity")||(null!=l?a(l,"severity"):l))?e:n.hooks.helperMissing)?e.call(null!=l?l:n.nullContext||{},{name:"severity",hash:{},data:t,loc:{start:{line:221,column:61},end:{line:221,column:73}}}):e)+'"'},16:function(n,l,e,o,t){var a=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return""+n.escapeExpression("function"==typeof(e=null!=(e=a(e,"ignoredCount")||(null!=l?a(l,"ignoredCount"):l))?e:n.hooks.helperMissing)?e.call(null!=l?l:n.nullContext||{},{name:"ignoredCount",hash:{},data:t,loc:{start:{line:225,column:53},end:{line:225,column:69}}}):e)+""},18:function(n,l,e,o,t){return'"6"'},20:function(n,l,e,o,t){return'"5"'},22:function(n,l,e,o,t,a,r){var i,s=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' \n

All violations

\n \n \n \n \n \n \n \n \n \n \n'+(null!=(i=n.hooks.blockHelperMissing.call(l,n.lambda(null!=(i=null!=l?s(l,"summary"):l)?s(i,"violations"):i,l),{name:"summary.violations",hash:{},fn:n.program(23,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:260,column:12},end:{line:269,column:35}}}))?i:"")+(null!=(i=s(e,"if").call(null!=l?l:n.nullContext||{},null!=(i=null!=l?s(l,"summary"):l)?s(i,"ignore"):i,{name:"if",hash:{},fn:n.program(25,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:270,column:12},end:{line:281,column:19}}}))?i:"")+" \n
severityrulefromto
\n
\n"},23:function(n,l,e,o,t,a,r){var i,s=n.lambda,u=n.escapeExpression,d=null!=l?l:n.nullContext||{},c=n.hooks.helperMissing,p="function",n=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return' \n '+u(s(null!=(i=null!=l?n(l,"rule"):l)?n(i,"severity"):i,l))+'\n '+u(s(null!=(i=null!=l?n(l,"rule"):l)?n(i,"name"):i,l))+'\n '+u(typeof(s=null!=(s=n(e,"from")||(null!=l?n(l,"from"):l))?s:c)==p?s.call(d,{name:"from",hash:{},data:t,loc:{start:{line:265,column:72},end:{line:265,column:80}}}):s)+""+(null!=(i=typeof(s=null!=(s=n(e,"fromExtras")||(null!=l?n(l,"fromExtras"):l))?s:c)==p?s.call(d,{name:"fromExtras",hash:{},data:t,loc:{start:{line:265,column:84},end:{line:265,column:100}}}):s)?i:"")+"\n "+(null!=(i=typeof(s=null!=(s=n(e,"to")||(null!=l?n(l,"to"):l))?s:c)==p?s.call(d,{name:"to",hash:{},data:t,loc:{start:{line:266,column:20},end:{line:266,column:28}}}):s)?i:"")+"\n\n \n"},25:function(n,l,e,o,t){return' \n \n
\n ↓ also show ignored violations\n
\n
\n ↑ hide ignored violations\n
\n \n \n'},27:function(n,l,e,o,t){return'

No violations found

\n

Get gummy bears to celebrate.

\n'},compiler:[8,">= 4.3.0"],main:function(n,l,e,o,t,a,r){var i,s=n.lambda,u=n.escapeExpression,d=null!=l?l:n.nullContext||{},c=n.lookupProperty||function(n,l){if(Object.prototype.hasOwnProperty.call(n,l))return n[l]};return'\n\n\n\n dependency-cruiser - results\n \n \n\n \n \n\n\n\n

Forbidden dependency check - results

\n \n

Summary

\n

\n

\n '+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalCruised"):i,l))+' modules\n
\n
\n '+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"totalDependenciesCruised"):i,l))+' dependencies\n
\n
\n '+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"error"):i,l))+' errors\n
\n
\n '+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"warn"):i,l))+' warnings\n
\n
\n '+u(s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"info"):i,l))+" informational\n
\n"+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(1,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:199,column:8},end:{line:203,column:15}}}))?i:"")+"  \n

\n \n \n \n \n \n \n \n \n "+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"ignore"):i,{name:"if",hash:{},fn:n.program(3,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:214,column:20},end:{line:214,column:65}}}))?i:"")+"\n \n \n"+(null!=(i=n.hooks.blockHelperMissing.call(l,s(null!=(i=null!=l?c(l,"summary"):l)?c(i,"agggregateViolations"):i,l),{name:"summary.agggregateViolations",hash:{},fn:n.program(5,t,0,a,r),inverse:n.noop,data:t,loc:{start:{line:217,column:12},end:{line:228,column:45}}}))?i:"")+" \n \n \n \n
severityruleviolationsexplanation
\n \n \n
\n
\n\n'+(null!=(i=c(e,"if").call(d,null!=(i=null!=l?c(l,"summary"):l)?c(i,"violations"):i,{name:"if",hash:{},fn:n.program(22,t,0,a,r),inverse:n.program(27,t,0,a,r),data:t,loc:{start:{line:243,column:4},end:{line:288,column:11}}}))?i:"")+' \n\n\n"},useData:!0,useDepths:!0}); \ No newline at end of file diff --git a/src/report/error-html/index.mjs b/src/report/error-html/index.mjs index a22bb5470..40841bcec 100644 --- a/src/report/error-html/index.mjs +++ b/src/report/error-html/index.mjs @@ -1,25 +1,165 @@ -import Handlebars from "handlebars/runtime.js"; -import { formatSummaryForReport, aggregateViolations } from "./utl.mjs"; +import meta from "../../meta.js"; +import { + determineFromExtras, + aggregateViolations, + determineTo, +} from "./utl.mjs"; +import template from "./error-html-template.mjs"; -await import("./error-html.template.js"); +function getViolatedRuleRowClass(pViolatedRule) { + return pViolatedRule.unviolated ? ' class="unviolated"' : ""; +} -function massageSummaryIntoSomethingUsable(pResults) { - const lSummary = formatSummaryForReport(pResults.summary); - return { - summary: { - ...lSummary, - agggregateViolations: aggregateViolations( - lSummary.violations, - lSummary.ruleSetUsed - ), - }, +function getViolatedRuleOkNokCell(pViolatedRule) { + if (pViolatedRule.unviolated) { + return ''; + } + return ``; +} + +function buildViolatedRuleRow(pViolatedRule) { + return ` + ${getViolatedRuleOkNokCell(pViolatedRule)} + ${pViolatedRule.severity} + + ${pViolatedRule.name} + + ${pViolatedRule.count} + ${pViolatedRule.ignoredCount ?? 0} + ${pViolatedRule.comment} + `; +} + +/** + * @param {import('../../../types/cruise-result.js')} pResults + * @returns {string} + */ +function constructViolatedRulesTable(pResults) { + return ` + + + + + + + + + + + + ${aggregateViolations( + pResults.summary.violations, + pResults.summary.ruleSetUsed, + ) + .map(buildViolatedRuleRow) + .join("\n")} + + + + +
severityruleviolationsignoredexplanation
+ + +
`; +} + +function getViolationRowClass(pViolation) { + return pViolation.ignored ? ' class="ignored"' : ""; +} + +/** + * @param {import('../../../types/cruise-result.js').IViolation} pViolation + * @returns {string} + */ +function constructViolationRow(pPrefix) { + return (pViolation) => { + return ` + ${pViolation.rule.severity} + + ${pViolation.rule.name} + + ${ + pViolation.from + }${determineFromExtras(pViolation)} + ${determineTo(pViolation)} + `; }; } +/** + * @param {import('../../../types/cruise-result.js').ICruiseResult} pResults + * @returns {string} + */ +function constructViolationsList(pResults) { + if (pResults.summary.violations.length > 0) { + return ` +

All violations

+ + + + + + + + + + + ${pResults.summary.violations + .map(constructViolationRow(pResults.summary.optionsUsed.prefix ?? "")) + .join("\n")} + ${ + pResults.summary.ignore > 0 + ? ` + + ` + : "" + } + +
severityrulefromto
+ + +
+
`; + } + return `

No violations found

+

Get gummy bears to celebrate.

`; +} + +/** + * @param {import('../../../types/cruise-result.js')} pResults + * @returns {string} + */ function report(pResults) { - return Handlebars.templates["error-html.template.hbs"]( - massageSummaryIntoSomethingUsable(pResults) - ); + return template + .replace("{{totalCruised}}", pResults.summary.totalCruised) + .replace( + "{{totalDependenciesCruised}}", + pResults.summary.totalDependenciesCruised, + ) + .replace("{{error}}", pResults.summary.error) + .replace("{{warn}}", pResults.summary.warn) + .replace("{{info}}", pResults.summary.info) + .replace("{{ignore}}", pResults.summary.ignore ?? 0) + .replace("{{violatedRulesTable}}", constructViolatedRulesTable(pResults)) + .replace("{{violationsList}}", constructViolationsList(pResults)) + .replace("{{depcruiseVersion}}", `dependency-cruiser@${meta.version}`) + .replace("{{runDate}}", new Date().toISOString()); } /** diff --git a/src/report/error-html/utl.mjs b/src/report/error-html/utl.mjs index fa84fd025..8a00b13e9 100644 --- a/src/report/error-html/utl.mjs +++ b/src/report/error-html/utl.mjs @@ -47,11 +47,11 @@ function formatModuleTo() { function formatInstabilityTo(pViolation) { return `${pViolation.to} (I: ${formatPercentage( - pViolation.metrics.to.instability + pViolation.metrics.to.instability, )})`; } -function determineTo(pViolation) { +export function determineTo(pViolation) { const lViolationType2Formatter = { dependency: formatDependencyTo, module: formatModuleTo, @@ -62,17 +62,17 @@ function determineTo(pViolation) { return formatViolation( pViolation, lViolationType2Formatter, - formatDependencyTo + formatDependencyTo, ); } function formatInstabilityFromExtras(pViolation) { return ` (I: ${formatPercentage( - pViolation.metrics.from.instability + pViolation.metrics.from.instability, )})`; } -function determineFromExtras(pViolation) { +export function determineFromExtras(pViolation) { const lViolationType2Formatter = { instability: formatInstabilityFromExtras, }; @@ -132,7 +132,7 @@ export function aggregateViolations(pViolations, pRuleSetUsed) { (pFirst, pSecond) => Math.sign(pSecond.count - pFirst.count) || Math.sign(pSecond.ignoredCount - pFirst.ignoredCount) || - pFirst.name.localeCompare(pSecond.name) + pFirst.name.localeCompare(pSecond.name), ); } diff --git a/test/report/error-html/__mocks__/orphans-cycles-metrics.mjs b/test/report/error-html/__mocks__/orphans-cycles-metrics.mjs new file mode 100644 index 000000000..f33d25e1e --- /dev/null +++ b/test/report/error-html/__mocks__/orphans-cycles-metrics.mjs @@ -0,0 +1,2160 @@ +export default { + modules: [ + { + source: "src/extract/ast-extractors/estree-helpers.js", + dependencies: [], + dependents: [ + "src/extract/ast-extractors/extract-amd-deps.js", + "src/extract/ast-extractors/extract-cjs-deps.js", + "src/extract/ast-extractors/extract-es6-deps.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/ast-extractors/extract-amd-deps.js", + dependencies: [ + { + dynamic: false, + module: "./estree-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/estree-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./extract-cjs-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-cjs-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + ], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.6666666666666666, + valid: true, + }, + { + source: "src/extract/ast-extractors/extract-cjs-deps.js", + dependencies: [ + { + dynamic: false, + module: "./estree-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/estree-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/ast-extractors/extract-amd-deps.js", + "src/extract/get-dependencies.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.3333333333333333, + valid: true, + }, + { + source: "src/extract/ast-extractors/extract-es6-deps.js", + dependencies: [ + { + dynamic: false, + module: "./estree-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/estree-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/ast-extractors/extract-swc-deps.js", + dependencies: [ + { + dynamic: false, + module: "./swc-dependency-visitor", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/swc-dependency-visitor.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/ast-extractors/swc-dependency-visitor.js", + dependencies: [], + dependents: ["src/extract/ast-extractors/extract-swc-deps.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/ast-extractors/extract-typescript-deps.js", + dependencies: [], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/clear-caches.js", + dependencies: [ + { + dynamic: false, + module: "./parse/to-javascript-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-javascript-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./parse/to-swc-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-swc-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./parse/to-typescript-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-typescript-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./resolve/external-module-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/external-module-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + { + dynamic: false, + module: "./resolve/get-manifest", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/get-manifest/index.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "./resolve/resolve", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + { + dynamic: false, + module: "./resolve/resolve-amd", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve-amd.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + ], + dependents: ["src/extract/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.875, + valid: true, + }, + { + source: "src/extract/parse/to-javascript-ast.js", + dependencies: [ + { + dynamic: false, + module: "../transpile", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/index.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "../utl/get-extension", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/get-extension.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/get-dependencies.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/transpile/index.js", + dependencies: [ + { + dynamic: false, + module: "./meta", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/meta.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.8, + valid: false, + rules: [ + { + severity: "info", + name: "SDP", + }, + ], + }, + ], + dependents: [ + "src/extract/parse/to-javascript-ast.js", + "src/extract/parse/to-typescript-ast.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.3333333333333333, + valid: true, + }, + { + source: "src/extract/transpile/meta.js", + dependencies: [ + { + dynamic: false, + module: "../parse/to-swc-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-swc-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./babel-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/babel-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./coffeescript-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/coffeescript-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./javascript-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/javascript-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./livescript-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/livescript-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./svelte-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/svelte-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./typescript-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/typescript-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./vue-template-wrap", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/vue-template-wrap.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/transpile/index.js", + "src/extract/gather-initial-sources.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.8, + valid: true, + }, + { + source: "src/extract/parse/to-swc-ast.js", + dependencies: [], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/transpile/meta.js", + "src/extract/get-dependencies.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/babel-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/coffeescript-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/javascript-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/livescript-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/svelte-wrap.js", + dependencies: [ + { + dynamic: false, + module: "./svelte-preprocess", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/svelte-preprocess.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/transpile/svelte-preprocess.js", + dependencies: [], + dependents: ["src/extract/transpile/svelte-wrap.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/typescript-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/transpile/vue-template-wrap.js", + dependencies: [], + dependents: ["src/extract/transpile/meta.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/utl/get-extension.js", + dependencies: [], + dependents: [ + "src/extract/parse/to-javascript-ast.js", + "src/extract/parse/to-typescript-ast.js", + "src/extract/resolve/module-classifiers.js", + "src/extract/gather-initial-sources.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/parse/to-typescript-ast.js", + dependencies: [ + { + dynamic: false, + module: "../transpile", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/index.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "../utl/get-extension", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/get-extension.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/get-dependencies.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/resolve/external-module-helpers.js", + dependencies: [ + { + dynamic: false, + module: "./module-classifiers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/module-classifiers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.16666666666666666, + valid: true, + }, + { + dynamic: false, + module: "./resolve", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/resolve/determine-dependency-types.js", + "src/extract/resolve/resolve-helpers.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.4, + valid: true, + }, + { + source: "src/extract/resolve/module-classifiers.js", + dependencies: [ + { + dynamic: false, + module: "../utl/get-extension", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/get-extension.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/resolve/external-module-helpers.js", + "src/extract/resolve/index.js", + "src/extract/resolve/determine-dependency-types.js", + "src/extract/resolve/resolve-cjs.js", + "src/extract/resolve/resolve-helpers.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.16666666666666666, + valid: true, + }, + { + source: "src/extract/resolve/resolve.js", + dependencies: [ + { + dynamic: false, + module: "../utl/path-to-posix", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/path-to-posix.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "../utl/strip-query-parameters", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/strip-query-parameters.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/resolve/external-module-helpers.js", + "src/extract/resolve/resolve-cjs.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.4, + valid: true, + }, + { + source: "src/extract/utl/path-to-posix.js", + dependencies: [], + dependents: [ + "src/extract/resolve/resolve.js", + "src/extract/resolve/resolve-amd.js", + "src/extract/gather-initial-sources.js", + "src/extract/resolve/index.js", + "src/extract/resolve/resolve-cjs.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/utl/strip-query-parameters.js", + dependencies: [], + dependents: ["src/extract/resolve/resolve.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/resolve/get-manifest/index.js", + dependencies: [ + { + dynamic: false, + module: "./merge-manifests", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/get-manifest/merge-manifests.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/resolve/index.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.3333333333333333, + valid: true, + }, + { + source: "src/extract/resolve/get-manifest/merge-manifests.js", + dependencies: [], + dependents: ["src/extract/resolve/get-manifest/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/resolve/resolve-amd.js", + dependencies: [ + { + dynamic: false, + module: "../utl/path-to-posix", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/path-to-posix.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: [ + "src/extract/clear-caches.js", + "src/extract/resolve/index.js", + ], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.3333333333333333, + valid: true, + }, + { + source: "src/extract/gather-initial-sources.js", + dependencies: [ + { + dynamic: false, + module: "./transpile/meta", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/transpile/meta.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.8, + valid: false, + rules: [ + { + severity: "info", + name: "SDP", + }, + ], + }, + { + dynamic: false, + module: "./utl/get-extension", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/get-extension.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./utl/path-to-posix", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/path-to-posix.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.75, + valid: true, + }, + { + source: "src/extract/get-dependencies.js", + dependencies: [ + { + dynamic: false, + module: "./ast-extractors/extract-amd-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-amd-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.6666666666666666, + valid: true, + }, + { + dynamic: false, + module: "./ast-extractors/extract-cjs-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-cjs-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "./ast-extractors/extract-es6-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-es6-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./ast-extractors/extract-swc-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-swc-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./ast-extractors/extract-typescript-deps", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/ast-extractors/extract-typescript-deps.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./parse/to-javascript-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-javascript-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./parse/to-swc-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-swc-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./parse/to-typescript-ast", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/parse/to-typescript-ast.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./resolve", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/index.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.875, + valid: true, + }, + { + dynamic: false, + module: "./utl/detect-pre-compilation-ness", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/detect-pre-compilation-ness.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.5, + valid: true, + }, + { + dynamic: false, + module: "./utl/extract-module-attributes", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/extract-module-attributes.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.9166666666666666, + valid: true, + }, + { + source: "src/extract/resolve/index.js", + dependencies: [ + { + dynamic: false, + module: "../utl/path-to-posix", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/path-to-posix.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./determine-dependency-types", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/determine-dependency-types.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.6666666666666666, + valid: true, + }, + { + dynamic: false, + module: "./get-manifest", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/get-manifest/index.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "./module-classifiers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/module-classifiers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.16666666666666666, + valid: true, + }, + { + dynamic: false, + module: "./resolve-amd", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve-amd.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.3333333333333333, + valid: true, + }, + { + dynamic: false, + module: "./resolve-cjs", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve-cjs.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.75, + valid: true, + }, + { + dynamic: false, + module: "./resolve-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.6666666666666666, + valid: true, + }, + ], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.875, + valid: true, + }, + { + source: "src/extract/resolve/determine-dependency-types.js", + dependencies: [ + { + dynamic: false, + module: "./external-module-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/external-module-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + { + dynamic: false, + module: "./module-classifiers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/module-classifiers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.16666666666666666, + valid: true, + }, + ], + dependents: ["src/extract/resolve/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.6666666666666666, + valid: true, + }, + { + source: "src/extract/resolve/resolve-cjs.js", + dependencies: [ + { + dynamic: false, + module: "../utl/path-to-posix", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/path-to-posix.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + { + dynamic: false, + module: "./module-classifiers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/module-classifiers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.16666666666666666, + valid: true, + }, + { + dynamic: false, + module: "./resolve", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/resolve.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + ], + dependents: ["src/extract/resolve/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.75, + valid: true, + }, + { + source: "src/extract/resolve/resolve-helpers.js", + dependencies: [ + { + dynamic: false, + module: "./external-module-helpers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/external-module-helpers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.4, + valid: true, + }, + { + dynamic: false, + module: "./module-classifiers", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/resolve/module-classifiers.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.16666666666666666, + valid: true, + }, + ], + dependents: ["src/extract/resolve/index.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.6666666666666666, + valid: true, + }, + { + source: "src/extract/utl/detect-pre-compilation-ness.js", + dependencies: [ + { + dynamic: false, + module: "./compare", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/utl/compare.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0, + valid: true, + }, + ], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0.5, + valid: true, + }, + { + source: "src/extract/utl/compare.js", + dependencies: [], + dependents: ["src/extract/utl/detect-pre-compilation-ness.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/utl/extract-module-attributes.js", + dependencies: [], + dependents: ["src/extract/get-dependencies.js"], + orphan: false, + reachable: [ + { + value: true, + asDefinedInRule: "not-reachable-from-folder-index", + matchedFrom: "src/extract/index.js", + }, + ], + instability: 0, + valid: true, + }, + { + source: "src/extract/index.js", + dependencies: [ + { + dynamic: false, + module: "./clear-caches", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/clear-caches.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.875, + valid: true, + }, + { + dynamic: false, + module: "./gather-initial-sources", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/gather-initial-sources.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.75, + valid: true, + }, + { + dynamic: false, + module: "./get-dependencies", + moduleSystem: "cjs", + exoticallyRequired: false, + resolved: "src/extract/get-dependencies.js", + coreModule: false, + followable: true, + couldNotResolve: false, + dependencyTypes: ["local"], + matchesDoNotFollow: false, + circular: false, + instability: 0.9166666666666666, + valid: true, + }, + ], + dependents: [], + orphan: false, + instability: 1, + valid: true, + }, + { + source: "src/extract/transpile/meta.d.ts", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: true, + }, + { + source: "src/schema/baseline-violations.schema.js", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: false, + rules: [ + { + severity: "error", + name: "no-orphans", + }, + ], + }, + { + source: "src/schema/baseline-violations.schema.json", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: true, + }, + { + source: "src/schema/configuration.schema.js", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: false, + rules: [ + { + severity: "error", + name: "no-orphans", + }, + ], + }, + { + source: "src/schema/configuration.schema.json", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: true, + }, + { + source: "src/schema/cruise-result.schema.js", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: false, + rules: [ + { + severity: "error", + name: "no-orphans", + }, + ], + }, + { + source: "src/schema/cruise-result.schema.json", + dependencies: [], + dependents: [], + orphan: true, + instability: 0, + valid: true, + }, + ], + folders: [ + { + name: "src", + dependencies: [], + dependents: [], + moduleCount: 47, + afferentCouplings: 0, + efferentCouplings: 0, + instability: 0, + }, + { + name: "src/extract", + dependencies: [], + dependents: [], + moduleCount: 41, + afferentCouplings: 0, + efferentCouplings: 0, + instability: 0, + }, + { + name: "src/extract/ast-extractors", + dependencies: [], + dependents: [ + { + name: "src/extract", + }, + ], + moduleCount: 7, + afferentCouplings: 5, + efferentCouplings: 0, + instability: 0, + }, + { + name: "src/extract/parse", + dependencies: [ + { + name: "src/extract/transpile", + instability: 0.25, + circular: true, + cycle: ["src/extract/transpile", "src/extract/parse"], + valid: false, + rules: [ + { + severity: "warn", + name: "no-folder-cycles", + }, + ], + }, + { + name: "src/extract/utl", + instability: 0, + circular: false, + valid: true, + }, + ], + dependents: [ + { + name: "src/extract", + }, + { + name: "src/extract/transpile", + }, + ], + moduleCount: 3, + afferentCouplings: 7, + efferentCouplings: 4, + instability: 0.36363636363636365, + }, + { + name: "src/extract/transpile", + dependencies: [ + { + name: "src/extract/parse", + instability: 0.36363636363636365, + circular: true, + cycle: ["src/extract/parse", "src/extract/transpile"], + valid: false, + rules: [ + { + severity: "warn", + name: "no-folder-cycles", + }, + { + severity: "info", + name: "folder-SDP", + }, + ], + }, + ], + dependents: [ + { + name: "src/extract/parse", + }, + { + name: "src/extract", + }, + ], + moduleCount: 11, + afferentCouplings: 3, + efferentCouplings: 1, + instability: 0.25, + }, + { + name: "src/extract/utl", + dependencies: [], + dependents: [ + { + name: "src/extract/parse", + }, + { + name: "src/extract/resolve", + }, + { + name: "src/extract", + }, + ], + moduleCount: 6, + afferentCouplings: 12, + efferentCouplings: 0, + instability: 0, + }, + { + name: "src/extract/resolve", + dependencies: [ + { + name: "src/extract/utl", + instability: 0, + circular: false, + valid: true, + }, + ], + dependents: [ + { + name: "src/extract", + }, + ], + moduleCount: 10, + afferentCouplings: 5, + efferentCouplings: 6, + instability: 0.5454545454545454, + }, + { + name: "src/extract/resolve/get-manifest", + dependencies: [], + dependents: [ + { + name: "src/extract", + }, + { + name: "src/extract/resolve", + }, + ], + moduleCount: 2, + afferentCouplings: 2, + efferentCouplings: 0, + instability: 0, + }, + { + name: "src/schema", + dependencies: [], + dependents: [], + moduleCount: 6, + afferentCouplings: 0, + efferentCouplings: 0, + instability: 0, + }, + ], + summary: { + violations: [ + { + type: "module", + from: "src/schema/baseline-violations.schema.js", + to: "src/schema/baseline-violations.schema.js", + rule: { + severity: "error", + name: "no-orphans", + }, + }, + { + type: "module", + from: "src/schema/configuration.schema.js", + to: "src/schema/configuration.schema.js", + rule: { + severity: "error", + name: "no-orphans", + }, + }, + { + type: "module", + from: "src/schema/cruise-result.schema.js", + to: "src/schema/cruise-result.schema.js", + rule: { + severity: "error", + name: "no-orphans", + }, + }, + { + type: "cycle", + from: "src/extract/parse", + to: "src/extract/transpile", + rule: { + severity: "warn", + name: "no-folder-cycles", + }, + cycle: ["src/extract/transpile", "src/extract/parse"], + }, + { + type: "cycle", + from: "src/extract/transpile", + to: "src/extract/parse", + rule: { + severity: "warn", + name: "no-folder-cycles", + }, + cycle: ["src/extract/parse", "src/extract/transpile"], + }, + { + type: "instability", + from: "src/extract/transpile", + to: "src/extract/parse", + rule: { + severity: "info", + name: "folder-SDP", + }, + metrics: { + from: { + instability: 0.25, + }, + to: { + instability: 0.36363636363636365, + }, + }, + }, + { + type: "instability", + from: "src/extract/gather-initial-sources.js", + to: "src/extract/transpile/meta.js", + rule: { + severity: "info", + name: "SDP", + }, + metrics: { + from: { + instability: 0.75, + }, + to: { + instability: 0.8, + }, + }, + }, + { + type: "instability", + from: "src/extract/transpile/index.js", + to: "src/extract/transpile/meta.js", + rule: { + severity: "info", + name: "SDP", + }, + metrics: { + from: { + instability: 0.3333333333333333, + }, + to: { + instability: 0.8, + }, + }, + }, + ], + error: 3, + warn: 2, + info: 3, + ignore: 0, + totalCruised: 47, + totalDependenciesCruised: 65, + optionsUsed: { + combinedDependencies: false, + doNotFollow: { + path: "node_modules", + dependencyTypes: [ + "npm", + "npm-dev", + "npm-optional", + "npm-peer", + "npm-bundled", + "npm-no-pkg", + ], + }, + exclude: { + path: "mocks|fixtures|test/integration|src/cli/tools/svg-in-html-snippets/script.snippet.js", + }, + externalModuleResolutionStrategy: "node_modules", + includeOnly: "^src/(schema|extract)", + knownViolations: [ + { + type: "module", + from: "test/extract/ast-extractors/typescript2.8-union-types-ast.json", + to: "test/extract/ast-extractors/typescript2.8-union-types-ast.json", + rule: { + severity: "error", + name: "no-orphans", + }, + }, + { + type: "module", + from: "src/schema/baseline-violations.schema.js", + to: "src/schema/baseline-violations.schema.js", + rule: { + severity: "error", + name: "not-unreachable-from-cli", + }, + }, + { + type: "module", + from: "src/cli/format.js", + to: "src/cli/format.js", + rule: { + severity: "info", + name: "not-reachable-from-folder-index", + }, + }, + { + type: "module", + from: "src/cli/tools/wrap-stream-in-html.js", + to: "src/cli/tools/wrap-stream-in-html.js", + rule: { + severity: "info", + name: "not-reachable-from-folder-index", + }, + }, + { + type: "module", + from: "src/cli/validate-node-environment.js", + to: "src/cli/validate-node-environment.js", + rule: { + severity: "info", + name: "not-reachable-from-folder-index", + }, + }, + { + type: "module", + from: "src/utl/array-util.js", + to: "src/utl/array-util.js", + rule: { + severity: "info", + name: "utl-module-not-shared-enough", + }, + }, + { + type: "module", + from: "src/utl/wrap-and-indent.js", + to: "src/utl/wrap-and-indent.js", + rule: { + severity: "info", + name: "utl-module-not-shared-enough", + }, + }, + ], + moduleSystems: ["cjs", "es6"], + outputTo: "tmp-report.json", + outputType: "json", + prefix: "https://github.com/sverweij/dependency-cruiser/blob/develop/", + preserveSymlinks: false, + rulesFile: "configs/.dependency-cruiser-show-metrics-config.json", + tsPreCompilationDeps: true, + exoticRequireStrings: ["tryRequire", "requireJSON"], + enhancedResolveOptions: { + exportsFields: ["exports"], + conditionNames: ["require"], + extensions: [".js", ".d.ts"], + }, + args: "src bin test configs types tools", + }, + ruleSetUsed: { + forbidden: [ + { + name: "folder-SDP", + scope: "folder", + severity: "info", + comment: + "This folder dependency violates the 'stable dependencies' principle as it depends on a folder that is likely to be more prone to changes.", + from: {}, + to: { + moreUnstable: true, + }, + }, + { + name: "SDP", + severity: "info", + comment: + "This dependency violates the 'stable dependencies' principle; it depends on a module that is likely to be more prone to changes than it is itself. Consider refactoring. ", + from: { + pathNot: "^test/", + }, + to: { + moreUnstable: true, + }, + scope: "module", + }, + { + name: "no-folder-cycles", + scope: "folder", + severity: "warn", + comment: + "This folder is part of a circular relationship. You might want to refactor that a bit.", + from: {}, + to: { + circular: true, + }, + }, + { + name: "no-orphans", + comment: + "This is an orphan module - it's likely not used (anymore?). Either use it or remove it. If it's logical this module is an orphan (i.e. it's a config file), add an exception for it in your dependency-cruiser configuration. By default this rule does not scrutinize dotfiles (e.g. .eslintrc.js), TypeScript declaration files (.d.ts), tsconfig.json and some of the babel and webpack configs.", + severity: "error", + from: { + orphan: true, + pathNot: + "(^|/)\\.[^/]+\\.(js|cjs|mjs|ts|json)$|\\.d\\.ts$|(^|/)tsconfig\\.json$|(^|/)(babel|webpack)\\.config\\.(js|cjs|mjs|ts|json)$|-reporter-plugin\\.js$|\\.schema\\.json$", + }, + to: {}, + scope: "module", + }, + ], + }, + }, +}; diff --git a/test/report/error-html/error-html.spec.mjs b/test/report/error-html/error-html.spec.mjs index a685c3434..ee8f8a1c8 100644 --- a/test/report/error-html/error-html.spec.mjs +++ b/test/report/error-html/error-html.spec.mjs @@ -3,6 +3,7 @@ import errorHTML from "../../../src/report/error-html/index.mjs"; import everythingFineResult from "./__mocks__/everything-fine.mjs"; import validationMoreThanOnce from "./__mocks__/violation-more-than-once.mjs"; import validationMoreThanOnceWithAnIgnore from "./__mocks__/violation-more-than-once-with-an-ignore.mjs"; +import orphansCyclesMetrics from "./__mocks__/orphans-cycles-metrics.mjs"; describe("[I] report/error-html", () => { const lOkeliDokelyKey = "gummy bears"; @@ -57,4 +58,27 @@ describe("[I] report/error-html", () => { ); strictEqual(lResult.exitCode, 0); }); + + it("report nicely on orphans, cycles and metric rules", () => { + const lResult = errorHTML(orphansCyclesMetrics); + + doesNotMatch(lResult.output, new RegExp(lOkeliDokelyKey)); + doesNotMatch(lResult.output, new RegExp(lOkeliDokelyHeader)); + + // empty 'to' column for module only rules + match( + lResult.output, + />src\/schema\/baseline-violations\.schema\.js<\/a><\/td>[^<]*<\/td>/, + ); + // cycles as cycles in the 'to' column: + match( + lResult.output, + /src\/extract\/transpile →src\/extract\/parse/, + ); + // metrics violations with the 'instability' for the involved modules in: + match( + lResult.output, + /src\/extract\/transpile\/index\.js<\/a> \(I: 33%\)<\/span><\/td>[^<]*src\/extract\/transpile\/meta.js \(I: 80%\)<\/span>/, + ); + }); });