dependency-cruiser 11.7.1 → 11.9.0-beta-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,6 +46,10 @@ try {
46
46
  "regex to collapse to a pattern E.g. ^packages/[^/]+/ would collapse to " +
47
47
  "modules/ folders directly under your packages folder. "
48
48
  )
49
+ .option(
50
+ "-P, --prefix <prefix>",
51
+ "prefix to use for links in the dot and err-html reporters"
52
+ )
49
53
  .option(
50
54
  "-e, --exit-code",
51
55
  "exit with a non-zero exit code when the input json contains error level " +
@@ -53,7 +53,7 @@ try {
53
53
  )
54
54
  .option(
55
55
  "--ts-config [file]",
56
- "use a typescript configuration (e.g. tsconfig.json)"
56
+ "use a TypeScript configuration (e.g. tsconfig.json) or it's JavaScript counterpart (e.g. jsconfig.json)"
57
57
  )
58
58
  .option(
59
59
  "--webpack-config [file]",
@@ -0,0 +1,111 @@
1
+ const ACORN_DUMMY_VALUE = "✖";
2
+
3
+ /* eslint-disable security/detect-object-injection */
4
+ const mermaidNode = (pNode, pText) => {
5
+ const lNode = pNode
6
+ .replace(ACORN_DUMMY_VALUE, "__unknown__")
7
+ .replace(/^\.$|^\.\//g, "__currentPath__")
8
+ .replace(/^\.{2}$|^\.{2}\//g, "__prevPath__")
9
+ .replace(/[[\]/.@]/g, "_");
10
+ const lText = pText ? `["${pText}"]` : "";
11
+ return `${lNode}${lText}`;
12
+ };
13
+
14
+ const mermaidEdge = (pFrom, pTo) => {
15
+ const lFromNode = mermaidNode(pFrom.node);
16
+ const lToNode = mermaidNode(pTo.node);
17
+ return `${lFromNode} --> ${lToNode}`;
18
+ };
19
+
20
+ const mermaidEdges = (pEdges) => {
21
+ return pEdges.map((pEdge) => mermaidEdge(pEdge.from, pEdge.to)).join("\n");
22
+ };
23
+
24
+ const convertedEdgeSources = (pCruiseResult) => {
25
+ return pCruiseResult.modules.flatMap((pModule) => {
26
+ const lFrom = {
27
+ node: pModule.source,
28
+ text: pModule.source.split("/").slice(-1)[0],
29
+ };
30
+
31
+ return pModule.dependencies.map((pDep) => {
32
+ return {
33
+ from: lFrom,
34
+ to: {
35
+ node: pDep.resolved,
36
+ text: pDep.resolved.split("/").slice(-1)[0],
37
+ },
38
+ };
39
+ });
40
+ });
41
+ };
42
+
43
+ const indent = (pDepth = 0) => {
44
+ return " ".repeat(pDepth);
45
+ };
46
+
47
+ const mermaidSubgraph = (pNode, pText, pChildren, pDepth) => {
48
+ return `${indent(pDepth)}subgraph ${mermaidNode(pNode, pText)}
49
+ ${pChildren}
50
+ ${indent(pDepth)}end`;
51
+ };
52
+
53
+ const mermaidSubgraphs = (pSource, pDepth = 0) => {
54
+ return Object.keys(pSource)
55
+ .map((pName) => {
56
+ const source = pSource[pName];
57
+ const children = mermaidSubgraphs(source.children, pDepth + 1);
58
+ if (children === "")
59
+ return `${indent(pDepth)}${mermaidNode(source.node, source.text)}`;
60
+
61
+ return mermaidSubgraph(source.node, source.text, children, pDepth);
62
+ })
63
+ .join("\n");
64
+ };
65
+
66
+ const convertedSubgraphSources = (pCruiseResult) => {
67
+ let lTree = {};
68
+
69
+ pCruiseResult.modules.forEach((pModule) => {
70
+ const paths = pModule.source.split("/");
71
+
72
+ paths.reduce((pChildren, pCurrentPath, pIndex) => {
73
+ if (!pChildren[pCurrentPath]) {
74
+ pChildren[pCurrentPath] = {
75
+ node: paths.slice(0, pIndex + 1).join("/"),
76
+ text: pCurrentPath,
77
+ children: {},
78
+ };
79
+ }
80
+ return pChildren[pCurrentPath].children;
81
+ }, lTree);
82
+ });
83
+
84
+ return lTree;
85
+ };
86
+
87
+ const renderMermaidThing = (pCruiseResult) => {
88
+ const subgraphs = convertedSubgraphSources(pCruiseResult);
89
+ const edges = convertedEdgeSources(pCruiseResult);
90
+
91
+ return `flowchart LR
92
+
93
+ ${mermaidSubgraphs(subgraphs)}
94
+ ${mermaidEdges(edges)}
95
+ `;
96
+ };
97
+
98
+ /**
99
+ * mermaid reporter plugin
100
+ *
101
+ * @param {import('../../types/dependency-cruiser').ICruiseResult} pCruiseResult -
102
+ * the output of a dependency-cruise adhering to dependency-cruiser's
103
+ * cruise result schema
104
+ * @return {import('../../types/dependency-cruiser').IReporterOutput} -
105
+ * output: a string
106
+ * exitCode: 0
107
+ */
108
+ module.exports = (pCruiseResult) => ({
109
+ output: renderMermaidThing(pCruiseResult),
110
+ exitCode: 0,
111
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "11.7.1",
3
+ "version": "11.9.0-beta-2",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -51,7 +51,8 @@
51
51
  "./config-utl/extract-ts-config": "./src/config-utl/extract-ts-config.js",
52
52
  "./config-utl/extract-webpack-resolve-config": "./src/config-utl/extract-webpack-resolve-config.js",
53
53
  "./sample-reporter-plugin": "./configs/plugins/stats-reporter-plugin.js",
54
- "./sample-3d-reporter-plugin": "./configs/plugins/3d-reporter-plugin.js"
54
+ "./sample-3d-reporter-plugin": "./configs/plugins/3d-reporter-plugin.js",
55
+ "./mermaid-reporter-plugin": "./configs/plugins/mermaid-reporter-plugin.js"
55
56
  },
56
57
  "types": "types/dependency-cruiser.d.ts",
57
58
  "files": [
@@ -142,7 +143,7 @@
142
143
  "acorn-walk": "8.2.0",
143
144
  "ajv": "8.11.0",
144
145
  "chalk": "^4.1.2",
145
- "commander": "9.2.0",
146
+ "commander": "9.3.0",
146
147
  "enhanced-resolve": "5.9.3",
147
148
  "figures": "^3.2.0",
148
149
  "get-stream": "^6.0.1",
@@ -160,20 +161,20 @@
160
161
  "wrap-ansi": "^7.0.0"
161
162
  },
162
163
  "devDependencies": {
163
- "@babel/core": "7.17.10",
164
- "@babel/plugin-transform-modules-commonjs": "7.17.9",
165
- "@babel/preset-typescript": "7.16.7",
166
- "@swc/core": "1.2.183",
164
+ "@babel/core": "7.18.2",
165
+ "@babel/plugin-transform-modules-commonjs": "7.18.2",
166
+ "@babel/preset-typescript": "7.17.12",
167
+ "@swc/core": "1.2.194",
167
168
  "@types/lodash": "4.14.182",
168
- "@types/node": "17.0.33",
169
- "@typescript-eslint/eslint-plugin": "5.23.0",
170
- "@typescript-eslint/parser": "5.23.0",
171
- "@vue/compiler-sfc": "3.2.33",
172
- "c8": "7.11.2",
169
+ "@types/node": "17.0.36",
170
+ "@typescript-eslint/eslint-plugin": "5.26.0",
171
+ "@typescript-eslint/parser": "5.26.0",
172
+ "@vue/compiler-sfc": "3.2.36",
173
+ "c8": "7.11.3",
173
174
  "chai": "4.3.6",
174
175
  "chai-json-schema": "1.5.1",
175
176
  "coffeescript": "2.7.0",
176
- "eslint": "^8.15.0",
177
+ "eslint": "^8.16.0",
177
178
  "eslint-config-moving-meadow": "3.0.0",
178
179
  "eslint-config-prettier": "8.5.0",
179
180
  "eslint-plugin-budapestian": "3.0.2",
@@ -193,7 +194,7 @@
193
194
  "shx": "0.3.4",
194
195
  "svelte": "3.48.0",
195
196
  "symlink-dir": "5.0.1",
196
- "typescript": "4.6.4",
197
+ "typescript": "4.7.2",
197
198
  "upem": "^7.0.0",
198
199
  "vue-template-compiler": "2.6.14",
199
200
  "yarn": "1.22.18"
package/src/cli/format.js CHANGED
@@ -12,6 +12,7 @@ const KNOWN_FMT_OPTIONS = [
12
12
  "includeOnly",
13
13
  "outputTo",
14
14
  "outputType",
15
+ "prefix",
15
16
  "version",
16
17
  ];
17
18
 
@@ -1 +1 @@
1
- var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,o,t,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dotfiles (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likeley this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true,\n // as it's pretty common to have a type import be a type only import \n // _and_ (e.g.) a devDependency - don't consider type-only dependency\n // types for this rule\n dependencyTypesNot: [\"type-only\"]\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:18},end:{line:166,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:169,column:15},end:{line:169,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,o,t,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,o,t,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,o,t,s){return" combinedDependencies: true,\n"},13:function(e,n,o,t,s){return" // combinedDependencies: false,\n"},15:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:320,column:17},end:{line:320,column:29}}}):o)+"'\n },\n"},17:function(e,n,o,t,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},19:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:340,column:17},end:{line:340,column:34}}}):o)+"',\n // env: {},\n // args: {},\n },\n"},21:function(e,n,o,t,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n"},23:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:360,column:17},end:{line:360,column:32}}}):o)+"'\n },\n"},25:function(e,n,o,t,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},compiler:[8,">= 4.3.0"],main:function(e,n,o,t,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),d=null!=(d=c(o,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?d:r,u={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=c(o,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,u))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(d=null!=(d=c(o,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?d:r)==a?d.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):d)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"depdency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules',\n dependencyTypes: [\n 'npm',\n 'npm-dev',\n 'npm-optional',\n 'npm-peer',\n 'npm-bundled',\n 'npm-no-pkg'\n ]\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:288,column:4},end:{line:292,column:11}}}))?h:"")+' \n /* list of extensions (typically non-parseable) to scan. Empty by default. */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(o,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:301,column:4},end:{line:305,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:318,column:4},end:{line:326,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `args` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(19,s,0),inverse:e.program(21,s,0),data:s,loc:{start:{line:338,column:4},end:{line:350,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(23,s,0),inverse:e.program(25,s,0),data:s,loc:{start:{line:358,column:4},end:{line:366,column:11}}}))?h:"")+'\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you\'ve\n redeclared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don\'t have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as \'exports\' fields in package.json. Use\n [\'exports\'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: ["exports"],\n /* List of conditions to check for in the exports field. e.g. use [\'imports\']\n if you\'re only interested in exposed es6 modules, [\'require\'] for commonjs,\n or all conditions at once `([\'import\', \'require\', \'node\', \'default\']`)\n if anything goes for you. Only works when the \'exportsFields\' array is\n non-empty.\n\n If you have a \'conditionNames\' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: ["import", "require", "node", "default"]\n },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // }\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n }\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(d=null!=(d=c(o,"version")||(null!=n?c(n,"version"):n))?d:r)==a?d.call(i,{name:"version",hash:{},data:s,loc:{start:{line:477,column:33},end:{line:477,column:44}}}):d)+" on "+l(typeof(d=null!=(d=c(o,"date")||(null!=n?c(n,"date"):n))?d:r)==a?d.call(i,{name:"date",hash:{},data:s,loc:{start:{line:477,column:48},end:{line:477,column:56}}}):d)+"\n"},useData:!0});
1
+ var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,o,t,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dotfiles (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likeley this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true,\n // as it's pretty common to have a type import be a type only import \n // _and_ (e.g.) a devDependency - don't consider type-only dependency\n // types for this rule\n dependencyTypesNot: [\"type-only\"]\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:18},end:{line:166,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:169,column:15},end:{line:169,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,o,t,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,o,t,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,o,t,s){return" combinedDependencies: true,\n"},13:function(e,n,o,t,s){return" // combinedDependencies: false,\n"},15:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:312,column:17},end:{line:312,column:29}}}):o)+"'\n },\n"},17:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return null!=(o=i(o,"if").call(null!=n?n:e.nullContext||{},null!=n?i(n,"useJsConfig"):n,{name:"if",hash:{},fn:e.program(18,s,0),inverse:e.program(20,s,0),data:s,loc:{start:{line:315,column:6},end:{line:323,column:13}}}))?o:""},18:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"jsConfig")||(null!=n?i(n,"jsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"jsConfig",hash:{},data:s,loc:{start:{line:317,column:17},end:{line:317,column:29}}}):o)+"'\n },\n"},20:function(e,n,o,t,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},22:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:338,column:17},end:{line:338,column:34}}}):o)+"',\n // env: {},\n // args: {},\n },\n"},24:function(e,n,o,t,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n"},26:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:358,column:17},end:{line:358,column:32}}}):o)+"'\n },\n"},28:function(e,n,o,t,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},compiler:[8,">= 4.3.0"],main:function(e,n,o,t,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),d=null!=(d=c(o,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?d:r,u={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=c(o,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,u))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(d=null!=(d=c(o,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?d:r)==a?d.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):d)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"depdency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules'\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:280,column:4},end:{line:284,column:11}}}))?h:"")+' \n /* list of extensions (typically non-parseable) to scan. Empty by default. */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(o,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:293,column:4},end:{line:297,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:310,column:4},end:{line:324,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `args` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(22,s,0),inverse:e.program(24,s,0),data:s,loc:{start:{line:336,column:4},end:{line:348,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(26,s,0),inverse:e.program(28,s,0),data:s,loc:{start:{line:356,column:4},end:{line:364,column:11}}}))?h:"")+'\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you\'ve\n redeclared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don\'t have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as \'exports\' fields in package.json. Use\n [\'exports\'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: ["exports"],\n /* List of conditions to check for in the exports field. e.g. use [\'imports\']\n if you\'re only interested in exposed es6 modules, [\'require\'] for commonjs,\n or all conditions at once `([\'import\', \'require\', \'node\', \'default\']`)\n if anything goes for you. Only works when the \'exportsFields\' array is\n non-empty.\n\n If you have a \'conditionNames\' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: ["import", "require", "node", "default"]\n },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // }\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n }\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(d=null!=(d=c(o,"version")||(null!=n?c(n,"version"):n))?d:r)==a?d.call(i,{name:"version",hash:{},data:s,loc:{start:{line:475,column:33},end:{line:475,column:44}}}):d)+" on "+l(typeof(d=null!=(d=c(o,"date")||(null!=n?c(n,"date"):n))?d:r)==a?d.call(i,{name:"date",hash:{},data:s,loc:{start:{line:475,column:48},end:{line:475,column:56}}}):d)+"\n"},useData:!0});
@@ -7,7 +7,8 @@ const { DEFAULT_CONFIG_FILE_NAME } = require("../defaults");
7
7
  const LIKELY_SOURCE_FOLDERS = ["src", "lib", "app", "bin", "sources"];
8
8
  const LIKELY_TEST_FOLDERS = ["test", "spec", "tests", "specs", "bdd"];
9
9
  const LIKELY_PACKAGES_FOLDERS = ["packages"];
10
- const TSCONFIG_CANDIDATE_PATTERN = /.*[tj]sconfig.*\.json$/gi;
10
+ const TSCONFIG_CANDIDATE_PATTERN = /.*tsconfig.*\.json$/gi;
11
+ const JSCONFIG_CANDIDATE_PATTERN = /.*jsconfig.*\.json$/gi;
11
12
  const WEBPACK_CANDIDATE_PATTERN = /.*webpack.*\.c?js(on)?$/gi;
12
13
  const BABEL_CONFIG_CANDIDATE_PATTERN = /^\.babelrc$|.*babel.*\.json/gi;
13
14
 
@@ -119,6 +120,10 @@ const getTSConfigCandidates = (pFolderName = process.cwd()) =>
119
120
  getMatchingFileNames(TSCONFIG_CANDIDATE_PATTERN, pFolderName);
120
121
  const hasTSConfigCandidates = (pFolderName = process.cwd()) =>
121
122
  getTSConfigCandidates(pFolderName).length > 0;
123
+ const getJSConfigCandidates = (pFolderName = process.cwd()) =>
124
+ getMatchingFileNames(JSCONFIG_CANDIDATE_PATTERN, pFolderName);
125
+ const hasJSConfigCandidates = (pFolderName = process.cwd()) =>
126
+ getJSConfigCandidates(pFolderName).length > 0;
122
127
 
123
128
  const getWebpackConfigCandidates = () =>
124
129
  getMatchingFileNames(WEBPACK_CANDIDATE_PATTERN);
@@ -149,6 +154,8 @@ module.exports = {
149
154
  hasWebpackConfigCandidates,
150
155
  getTSConfigCandidates,
151
156
  hasTSConfigCandidates,
157
+ getJSConfigCandidates,
158
+ hasJSConfigCandidates,
152
159
  getSourceFolderCandidates,
153
160
  getTestFolderCandidates,
154
161
  getMonoRepoPackagesCandidates,
@@ -4,6 +4,8 @@ const {
4
4
  getTestFolderCandidates,
5
5
  hasBabelConfigCandidates,
6
6
  getBabelConfigCandidates,
7
+ hasJSConfigCandidates,
8
+ getJSConfigCandidates,
7
9
  hasTSConfigCandidates,
8
10
  getTSConfigCandidates,
9
11
  hasWebpackConfigCandidates,
@@ -67,6 +69,20 @@ const INQUIRER_QUESTIONS = [
67
69
  validate: validateLocation,
68
70
  when: (pAnswers) => pAnswers.hasTestsOutsideSource && !pAnswers.isMonoRepo,
69
71
  },
72
+ {
73
+ name: "useJsConfig",
74
+ type: "confirm",
75
+ message: "Looks like you're using a 'jsconfig.json'. Use that?",
76
+ default: true,
77
+ when: () => hasJSConfigCandidates() && !hasTSConfigCandidates(),
78
+ },
79
+ {
80
+ name: "jsConfig",
81
+ type: "list",
82
+ message: "Full path to your 'jsconfig.json':",
83
+ choices: getJSConfigCandidates(),
84
+ when: (pAnswers) => pAnswers.useJsConfig,
85
+ },
70
86
  {
71
87
  name: "useTsConfig",
72
88
  type: "confirm",
@@ -13,6 +13,8 @@ const {
13
13
  hasTSConfigCandidates,
14
14
  getTSConfigCandidates,
15
15
  getDefaultConfigFileName,
16
+ hasJSConfigCandidates,
17
+ getJSConfigCandidates,
16
18
  } = require("./environment-helpers");
17
19
  const {
18
20
  writeRunScriptsToManifest,
@@ -32,6 +34,8 @@ function getOneshotConfig(pOneShotConfigId) {
32
34
  const lBaseConfig = {
33
35
  isMonoRepo: isLikelyMonoRepo(),
34
36
  combinedDependencies: false,
37
+ useJsConfig: hasJSConfigCandidates() && !hasTSConfigCandidates(),
38
+ jsConfig: getJSConfigCandidates().shift(),
35
39
  useTsConfig: hasTSConfigCandidates(),
36
40
  tsConfig: getTSConfigCandidates().shift(),
37
41
  tsPreCompilationDeps: hasTSConfigCandidates(),
@@ -14,7 +14,7 @@ const {
14
14
  * @param {import("../../../types/cruise-result").IModule[]} pModules -
15
15
  * cruised modules that have been enriched with mandatory attributes &
16
16
  * have been validated against rules as passed in the options
17
- * @param {import("../../../types/options").ICruiseOptions} pOptions -
17
+ * @param {import("../../../types/options").IStrictCruiseOptions} pOptions -
18
18
  * @param {string[]} pFileDirectoryArray -
19
19
  * the files/ directories originally passed to be cruised
20
20
  * @param {import("../../../types/dependency-cruiser").IFolder[]} pFolders -
@@ -1,15 +1,16 @@
1
1
  const fs = require("fs");
2
2
  const path = require("path");
3
3
  const glob = require("glob");
4
- const _get = require("lodash/get");
4
+ const get = require("lodash/get");
5
5
  const filenameMatchesPattern =
6
6
  require("../graph-utl/match-facade").filenameMatchesPattern;
7
7
  const pathToPosix = require("./utl/path-to-posix");
8
8
  const transpileMeta = require("./transpile/meta");
9
+ const getExtension = require("./utl/get-extension");
9
10
 
10
11
  /**
11
12
  *
12
- * @param {import('../../types/options').ICruiseOptions} pOptions
13
+ * @param {import('../../types/options').IStrictCruiseOptions} pOptions
13
14
  * @returns {string[]}
14
15
  */
15
16
  function getScannableExtensions(pOptions) {
@@ -18,18 +19,22 @@ function getScannableExtensions(pOptions) {
18
19
  );
19
20
  }
20
21
 
22
+ function fileIsScannable(pOptions, pPathToFile) {
23
+ return getScannableExtensions(pOptions).includes(getExtension(pPathToFile));
24
+ }
25
+
21
26
  function shouldBeIncluded(pFullPathToFile, pOptions) {
22
27
  return (
23
- !_get(pOptions, "includeOnly.path") ||
28
+ !get(pOptions, "includeOnly.path") ||
24
29
  filenameMatchesPattern(pFullPathToFile, pOptions.includeOnly.path)
25
30
  );
26
31
  }
27
32
 
28
33
  function shouldNotBeExcluded(pFullPathToFile, pOptions) {
29
34
  return (
30
- (!_get(pOptions, "exclude.path") ||
35
+ (!get(pOptions, "exclude.path") ||
31
36
  !filenameMatchesPattern(pFullPathToFile, pOptions.exclude.path)) &&
32
- (!_get(pOptions, "doNotFollow.path") ||
37
+ (!get(pOptions, "doNotFollow.path") ||
33
38
  !filenameMatchesPattern(pFullPathToFile, pOptions.doNotFollow.path))
34
39
  );
35
40
  }
@@ -37,7 +42,7 @@ function shouldNotBeExcluded(pFullPathToFile, pOptions) {
37
42
  /**
38
43
  *
39
44
  * @param {string} pDirectoryName
40
- * @param {import('../../types/options').ICruiseOptions} pOptions options that
45
+ * @param {import('../../types/options').IStrictCruiseOptions} pOptions options that
41
46
  * @returns {string[]}
42
47
  */
43
48
  function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) {
@@ -59,11 +64,7 @@ function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) {
59
64
  gatherScannableFilesFromDirectory(pFullPathToFile, pOptions)
60
65
  );
61
66
  }
62
- if (
63
- getScannableExtensions(pOptions).some((pExtension) =>
64
- pFullPathToFile.endsWith(pExtension)
65
- )
66
- ) {
67
+ if (fileIsScannable(pOptions, pFullPathToFile)) {
67
68
  return pSum.concat(pFullPathToFile);
68
69
  }
69
70
  return pSum;
@@ -84,7 +85,7 @@ function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) {
84
85
  *
85
86
  * @param {string[]} pFileAndDirectoryArray globs and/ or paths to files or
86
87
  * directories to be gathered
87
- * @param {import('../../types/dependency-cruiser').ICruiseOptions} pOptions options that
88
+ * @param {import('../../types/dependency-cruiser').IStrictCruiseOptions} pOptions options that
88
89
  * influence what needs to be gathered/ scanned
89
90
  * notably useful attributes:
90
91
  * - exclude - regexp of what to exclude
@@ -108,7 +108,7 @@ function extractWithTsc(
108
108
 
109
109
  /**
110
110
  *
111
- * @param {import('../../types/dependency-cruiser').ICruiseOptions} pCruiseOptions
111
+ * @param {import('../../types/dependency-cruiser').IStrictCruiseOptions} pCruiseOptions
112
112
  * @param {string} pFileName
113
113
  * @param {any} pTranspileOptions
114
114
  * @returns {import('../../types/cruise-result').IDependency[]}
@@ -208,7 +208,7 @@ function compareDeps(pLeft, pRight) {
208
208
  *
209
209
  *
210
210
  * @param {string} pFileName path to the file
211
- * @param {import("../../types/dependency-cruiser").ICruiseOptions} pCruiseOptions cruise options
211
+ * @param {import("../../types/dependency-cruiser").IStrictCruiseOptions} pCruiseOptions cruise options
212
212
  * @param {import("../../types/dependency-cruiser").IResolveOptions} pResolveOptions webpack 'enhanced-resolve' options
213
213
  * @param {import("../../types/dependency-cruiser").ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options
214
214
  * ('flattened' so there's no need for file access on any
@@ -141,7 +141,7 @@ function filterExcludedDynamicDependencies(pModule, pExclude) {
141
141
  * returns an array of all the modules it finds that way.
142
142
  *
143
143
  * @param {string[]} pFileDirectoryArray
144
- * @param {import("../../types/dependency-cruiser").ICruiseOptions} pCruiseOptions
144
+ * @param {import("../../types/dependency-cruiser").IStrictCruiseOptions} pCruiseOptions
145
145
  * @param {import("../../types/dependency-cruiser").IResolveOptions} pResolveOptions
146
146
  * @param {import("../../types/dependency-cruiser").ITranspileOptions} pTranspileOptions
147
147
  * @returns {Partial<import("../../types/dependency-cruiser").IModule[]>}
package/src/main/index.js CHANGED
@@ -51,6 +51,7 @@ function futureCruise(
51
51
  pTranspileOptions
52
52
  ) {
53
53
  bus.emit("progress", "parsing options", c(1));
54
+ /** @type {import("../../types/strict-options").IStrictCruiseOptions} */
54
55
  let lCruiseOptions = normalizeCruiseOptions(
55
56
  validateCruiseOptions(pCruiseOptions)
56
57
  );
@@ -1,4 +1,4 @@
1
- /** @type {import('../../../types/options').ICruiseOptions} */
1
+ /** @type {import('../../../types/strict-options').IStrictCruiseOptions} */
2
2
  module.exports = {
3
3
  validate: false,
4
4
  maxDepth: 0,
@@ -110,11 +110,10 @@ function shouldCalculateMetrics(pOptions) {
110
110
 
111
111
  /**
112
112
  *
113
- * @param {Partial<import('../../../types/options').ICruiseOptions>} pOptions
114
- * @returns {import('../../../types/options').ICruiseOptions}
113
+ * @param {import('../../../types/options').ICruiseOptions} pOptions
114
+ * @returns {import('../../../types/strict-options').IStrictCruiseOptions}
115
115
  */
116
116
  function normalizeCruiseOptions(pOptions) {
117
- /** @type {import('../../../types/options').ICruiseOptions} */
118
117
  let lReturnValue = {
119
118
  baseDir: process.cwd(),
120
119
  ...defaults,
@@ -145,6 +144,9 @@ function normalizeCruiseOptions(pOptions) {
145
144
  );
146
145
  }
147
146
  lReturnValue.metrics = shouldCalculateMetrics(pOptions);
147
+ // if (has(pOptions, "ruleSet")) {
148
+ // lReturnValue.ruleSet = normalizeRuleSet(pOptions.ruleSet);
149
+ // }
148
150
 
149
151
  return lReturnValue;
150
152
  }
@@ -152,7 +154,7 @@ function normalizeCruiseOptions(pOptions) {
152
154
  /**
153
155
  *
154
156
  * @param {import("../../../types/dependency-cruiser").IFormatOptions} pFormatOptions
155
- * @returns {import("../../../types/dependency-cruiser").IFormatOptions}
157
+ * @returns {import("../../../types/strict-options").IStrictFormatOptions}
156
158
  */
157
159
  function normalizeFormatOptions(pFormatOptions) {
158
160
  const lFormatOptions = clone(pFormatOptions);