dependency-cruiser 11.10.0 → 11.12.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.
- package/bin/depcruise-baseline.js +3 -1
- package/bin/depcruise-fmt.js +4 -0
- package/bin/dependency-cruise.js +4 -0
- package/configs/rules/no-duplicate-dependency-types.js +1 -1
- package/package.json +25 -20
- package/src/cli/init-config/config.js.template.js +1 -1
- package/src/cli/normalize-cli-options.js +1 -0
- package/src/enrich/derive/dependents/index.js +6 -0
- package/src/enrich/derive/module-utl.js +1 -0
- package/src/graph-utl/add-focus.js +18 -15
- package/src/graph-utl/filterbank.js +37 -2
- package/src/graph-utl/indexed-module-graph.js +48 -0
- package/src/main/options/normalize.js +7 -2
- package/src/main/options/validate.js +2 -0
- package/src/meta.js +1 -1
- package/src/report/mermaid.js +103 -61
- package/src/report/text.js +63 -10
- package/src/schema/configuration.schema.js +1 -1
- package/src/schema/cruise-result.schema.js +1 -1
- package/types/cruise-result.d.ts +5 -5
- package/types/dependency-cruiser.d.ts +2 -2
- package/types/filter-types.d.ts +9 -0
- package/types/init-config.d.ts +1 -1
- package/types/options.d.ts +14 -5
- package/types/reporter-options.d.ts +23 -0
- package/types/restrictions.d.ts +2 -2
- package/types/strict-options.d.ts +1 -1
|
@@ -19,7 +19,9 @@ try {
|
|
|
19
19
|
|
|
20
20
|
program
|
|
21
21
|
.description(
|
|
22
|
-
"Writes all known violations of rules in a .dependency-cruiser.js to a file.\
|
|
22
|
+
"Writes all known violations of rules in a .dependency-cruiser.js to a file.\n" +
|
|
23
|
+
"Alias for depcruise -c -T baseline -f .dependency-cruiser-known-violations.json [files-or-directories]\n" +
|
|
24
|
+
"Details: https://github.com/sverweij/dependency-cruiser"
|
|
23
25
|
)
|
|
24
26
|
.option("-c, --config [file]", "read rules and options from [file]", true)
|
|
25
27
|
.option(
|
package/bin/depcruise-fmt.js
CHANGED
|
@@ -39,6 +39,10 @@ try {
|
|
|
39
39
|
"-F, --focus <regex>",
|
|
40
40
|
"only include modules matching the regex + their direct neighbours"
|
|
41
41
|
)
|
|
42
|
+
.option(
|
|
43
|
+
"-R, --reaches <regex>",
|
|
44
|
+
"only include modules matching the regex + all modules that can reach it"
|
|
45
|
+
)
|
|
42
46
|
.option("-x, --exclude <regex>", "exclude all modules matching the regex")
|
|
43
47
|
.option(
|
|
44
48
|
"-S, --collapse <regex>",
|
package/bin/dependency-cruise.js
CHANGED
|
@@ -42,6 +42,10 @@ try {
|
|
|
42
42
|
"-F, --focus <regex>",
|
|
43
43
|
"only include modules matching the regex + their direct neighbours"
|
|
44
44
|
)
|
|
45
|
+
.option(
|
|
46
|
+
"-R, --reaches <regex>",
|
|
47
|
+
"only include modules matching the regex + all modules that can reach it"
|
|
48
|
+
)
|
|
45
49
|
.option("-x, --exclude <regex>", "exclude all modules matching the regex")
|
|
46
50
|
.option(
|
|
47
51
|
"-X, --do-not-follow <regex>",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
name: "no-duplicate-dep-types",
|
|
3
3
|
comment:
|
|
4
|
-
"
|
|
4
|
+
"Likely this module depends on an external ('npm') package that occurs more " +
|
|
5
5
|
"than once in your package.json i.e. bot as a devDependencies and in dependencies. " +
|
|
6
6
|
"This will cause maintenance problems later on. If it's intentional, you can " +
|
|
7
7
|
"disable this rule by adding this override as a rule in the 'forbidden' section " +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.12.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",
|
|
@@ -93,8 +93,8 @@
|
|
|
93
93
|
"depcruise:report:view": "node ./bin/dependency-cruise.js src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.json --output-to - | browser",
|
|
94
94
|
"depcruise:focus": "node ./bin/dependency-cruise.js src bin test configs types --progress --config --output-type text --focus",
|
|
95
95
|
"lint": "npm-run-all --parallel --aggregate-output lint:eslint lint:prettier lint:types",
|
|
96
|
-
"lint:eslint": "eslint bin/dependency-cruise.js src test configs tools/**/*.mjs --cache --cache-location
|
|
97
|
-
"lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location
|
|
96
|
+
"lint:eslint": "eslint bin/dependency-cruise.js src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
|
|
97
|
+
"lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
|
|
98
98
|
"lint:fix": "npm-run-all lint:eslint:fix lint:prettier:fix lint:types:fix",
|
|
99
99
|
"lint:prettier": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
|
|
100
100
|
"lint:prettier:fix": "prettier --loglevel warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
|
|
@@ -144,13 +144,13 @@
|
|
|
144
144
|
"ajv": "8.11.0",
|
|
145
145
|
"chalk": "^4.1.2",
|
|
146
146
|
"commander": "9.3.0",
|
|
147
|
-
"enhanced-resolve": "5.
|
|
147
|
+
"enhanced-resolve": "5.10.0",
|
|
148
148
|
"figures": "^3.2.0",
|
|
149
149
|
"get-stream": "^6.0.1",
|
|
150
150
|
"glob": "7.2.0",
|
|
151
151
|
"handlebars": "4.7.7",
|
|
152
152
|
"indent-string": "^4.0.0",
|
|
153
|
-
"inquirer": "8.2.4",
|
|
153
|
+
"inquirer": "^8.2.4",
|
|
154
154
|
"json5": "2.2.1",
|
|
155
155
|
"lodash": "4.17.21",
|
|
156
156
|
"safe-regex": "2.1.1",
|
|
@@ -161,43 +161,43 @@
|
|
|
161
161
|
"wrap-ansi": "^7.0.0"
|
|
162
162
|
},
|
|
163
163
|
"devDependencies": {
|
|
164
|
-
"@babel/core": "7.18.
|
|
165
|
-
"@babel/plugin-transform-modules-commonjs": "7.18.
|
|
166
|
-
"@babel/preset-typescript": "7.
|
|
167
|
-
"@swc/core": "1.2.
|
|
164
|
+
"@babel/core": "7.18.6",
|
|
165
|
+
"@babel/plugin-transform-modules-commonjs": "7.18.6",
|
|
166
|
+
"@babel/preset-typescript": "7.18.6",
|
|
167
|
+
"@swc/core": "1.2.211",
|
|
168
168
|
"@types/lodash": "4.14.182",
|
|
169
|
-
"@types/node": "
|
|
170
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
171
|
-
"@typescript-eslint/parser": "5.
|
|
169
|
+
"@types/node": "18.0.3",
|
|
170
|
+
"@typescript-eslint/eslint-plugin": "5.30.5",
|
|
171
|
+
"@typescript-eslint/parser": "5.30.5",
|
|
172
172
|
"@vue/compiler-sfc": "3.2.37",
|
|
173
173
|
"c8": "7.11.3",
|
|
174
174
|
"chai": "4.3.6",
|
|
175
175
|
"chai-json-schema": "1.5.1",
|
|
176
176
|
"coffeescript": "2.7.0",
|
|
177
|
-
"eslint": "^8.
|
|
177
|
+
"eslint": "^8.19.0",
|
|
178
178
|
"eslint-config-moving-meadow": "3.0.0",
|
|
179
179
|
"eslint-config-prettier": "8.5.0",
|
|
180
|
-
"eslint-plugin-budapestian": "
|
|
180
|
+
"eslint-plugin-budapestian": "4.0.0",
|
|
181
181
|
"eslint-plugin-import": "2.26.0",
|
|
182
182
|
"eslint-plugin-mocha": "^9.0.0",
|
|
183
183
|
"eslint-plugin-node": "11.1.0",
|
|
184
184
|
"eslint-plugin-security": "1.5.0",
|
|
185
|
-
"eslint-plugin-unicorn": "^
|
|
185
|
+
"eslint-plugin-unicorn": "^43.0.1",
|
|
186
186
|
"husky": "^4.3.8",
|
|
187
187
|
"intercept-stdout": "0.1.2",
|
|
188
188
|
"lint-staged": "12.3.4",
|
|
189
189
|
"mocha": "10.0.0",
|
|
190
190
|
"normalize-newline": "^3.0.0",
|
|
191
191
|
"npm-run-all": "4.1.5",
|
|
192
|
-
"prettier": "2.
|
|
192
|
+
"prettier": "2.7.1",
|
|
193
193
|
"proxyquire": "2.1.3",
|
|
194
194
|
"shx": "0.3.4",
|
|
195
|
-
"svelte": "3.
|
|
195
|
+
"svelte": "3.49.0",
|
|
196
196
|
"symlink-dir": "5.0.1",
|
|
197
|
-
"typescript": "4.7.
|
|
197
|
+
"typescript": "4.7.4",
|
|
198
198
|
"upem": "^7.0.0",
|
|
199
|
-
"vue-template-compiler": "2.
|
|
200
|
-
"yarn": "1.22.
|
|
199
|
+
"vue-template-compiler": "2.7.4",
|
|
200
|
+
"yarn": "1.22.19"
|
|
201
201
|
},
|
|
202
202
|
"upem": {
|
|
203
203
|
"policies": [
|
|
@@ -226,6 +226,11 @@
|
|
|
226
226
|
"policy": "wanted",
|
|
227
227
|
"because": "https://github.com/typicode/husky/issues/822"
|
|
228
228
|
},
|
|
229
|
+
{
|
|
230
|
+
"package": "inquirer",
|
|
231
|
+
"policy": "wanted",
|
|
232
|
+
"because": "version 9 only exports ejs - and we use cjs and don't transpile"
|
|
233
|
+
},
|
|
229
234
|
{
|
|
230
235
|
"package": "indent-string",
|
|
231
236
|
"policy": "wanted",
|
|
@@ -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: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});
|
|
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 dot-files (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 \"Likely 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 \"dependency-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 re-declared 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});
|
|
@@ -10,10 +10,16 @@ function hasDependentsRule(pOptions) {
|
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {import("../../../../types/cruise-result").IOptions} pOptions
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
13
18
|
function shouldAddDependents(pOptions) {
|
|
14
19
|
return (
|
|
15
20
|
Boolean(pOptions.forceDeriveDependents) ||
|
|
16
21
|
Boolean(pOptions.metrics) ||
|
|
22
|
+
Boolean(pOptions.reaches) ||
|
|
17
23
|
pOptions.outputType === "metrics" ||
|
|
18
24
|
hasDependentsRule(pOptions)
|
|
19
25
|
);
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const has = require("lodash/has");
|
|
2
|
+
const { moduleMatchesFilter } = require("./match-facade");
|
|
3
3
|
|
|
4
4
|
function getFocusModules(pModules, pFilter) {
|
|
5
5
|
return pModules
|
|
6
|
-
.filter((pModule) =>
|
|
6
|
+
.filter((pModule) => moduleMatchesFilter(pModule, pFilter))
|
|
7
7
|
.map((pModule) => ({ ...pModule, matchesFocus: true }));
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
function getCallingModules(pModules,
|
|
10
|
+
function getCallingModules(pModules, pFocusedModuleNames) {
|
|
11
11
|
return pModules
|
|
12
12
|
.filter(
|
|
13
13
|
(pModule) =>
|
|
14
|
-
!
|
|
14
|
+
!pFocusedModuleNames.has(pModule.source) &&
|
|
15
15
|
pModule.dependencies.some((pDependency) =>
|
|
16
|
-
|
|
16
|
+
pFocusedModuleNames.has(pDependency.resolved)
|
|
17
17
|
)
|
|
18
18
|
)
|
|
19
19
|
.map((pModule) => ({
|
|
20
20
|
...pModule,
|
|
21
21
|
matchesFocus: false,
|
|
22
22
|
dependencies: pModule.dependencies.filter((pDependency) =>
|
|
23
|
-
|
|
23
|
+
pFocusedModuleNames.has(pDependency.resolved)
|
|
24
24
|
),
|
|
25
25
|
}));
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
function getCalledModules(pModules,
|
|
28
|
+
function getCalledModules(pModules, pFocusedModules, pFocusedModuleNames) {
|
|
29
29
|
const lCalledModuleNames = new Set(
|
|
30
|
-
|
|
30
|
+
pFocusedModules.reduce(
|
|
31
31
|
(pAll, pModule) =>
|
|
32
32
|
pAll.concat(pModule.dependencies.map(({ resolved }) => resolved)),
|
|
33
33
|
[]
|
|
@@ -37,19 +37,22 @@ function getCalledModules(pModules, pFilter, pFocusModules) {
|
|
|
37
37
|
return pModules
|
|
38
38
|
.filter(
|
|
39
39
|
(pModule) =>
|
|
40
|
-
!
|
|
40
|
+
!pFocusedModuleNames.has(pModule.source) &&
|
|
41
41
|
lCalledModuleNames.has(pModule.source)
|
|
42
42
|
)
|
|
43
43
|
.map((pModule) => ({ ...pModule, matchesFocus: false, dependencies: [] }));
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
module.exports = function addFocus(pModules, pFilter) {
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
47
|
+
if (has(pFilter, "path")) {
|
|
48
|
+
const lFocusedModules = getFocusModules(pModules, pFilter);
|
|
49
|
+
const lFocusedModuleNames = new Set(
|
|
50
|
+
lFocusedModules.map(({ source }) => source)
|
|
51
|
+
);
|
|
49
52
|
|
|
50
|
-
return
|
|
51
|
-
.concat(getCallingModules(pModules,
|
|
52
|
-
.concat(getCalledModules(pModules,
|
|
53
|
+
return lFocusedModules
|
|
54
|
+
.concat(getCallingModules(pModules, lFocusedModuleNames))
|
|
55
|
+
.concat(getCalledModules(pModules, lFocusedModules, lFocusedModuleNames));
|
|
53
56
|
}
|
|
54
57
|
return pModules;
|
|
55
58
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const clone = require("lodash/clone");
|
|
2
|
-
const
|
|
2
|
+
const addFocus = require("./add-focus");
|
|
3
|
+
const IndexedModuleGraph = require("./indexed-module-graph");
|
|
3
4
|
const matchFacade = require("./match-facade");
|
|
4
5
|
|
|
5
6
|
function includeOnly(pModules, pIncludeFilter) {
|
|
@@ -32,6 +33,37 @@ function exclude(pModules, pExcludeFilter) {
|
|
|
32
33
|
}))
|
|
33
34
|
: pModules;
|
|
34
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param {import("../../types/cruise-result").IModule[]} pModules
|
|
39
|
+
* @param {import("../../types/filter-types").IReachesType} pReachesFilter
|
|
40
|
+
* @returns {import("../../types/cruise-result").IModule[]}
|
|
41
|
+
*/
|
|
42
|
+
function filterReaches(pModules, pReachesFilter) {
|
|
43
|
+
const lModuleNamesToReach = pModules
|
|
44
|
+
.filter((pModule) =>
|
|
45
|
+
matchFacade.moduleMatchesFilter(pModule, pReachesFilter)
|
|
46
|
+
)
|
|
47
|
+
.map(({ source }) => source);
|
|
48
|
+
|
|
49
|
+
/** @type {Array<string>} */
|
|
50
|
+
let lReachingModules = [];
|
|
51
|
+
let lIndexedModules = new IndexedModuleGraph(pModules);
|
|
52
|
+
|
|
53
|
+
for (let lModuleToReach of lModuleNamesToReach) {
|
|
54
|
+
lReachingModules = lReachingModules.concat(
|
|
55
|
+
lIndexedModules.findTransitiveDependents(lModuleToReach)
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return pModules
|
|
59
|
+
.filter(({ source }) => lReachingModules.includes(source))
|
|
60
|
+
.map((pModule) => ({
|
|
61
|
+
...pModule,
|
|
62
|
+
dependencies: pModule.dependencies.filter(({ resolved }) =>
|
|
63
|
+
lReachingModules.includes(resolved)
|
|
64
|
+
),
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
35
67
|
|
|
36
68
|
function applyFilters(pModules, pFilters) {
|
|
37
69
|
if (pFilters) {
|
|
@@ -44,7 +76,10 @@ function applyFilters(pModules, pFilters) {
|
|
|
44
76
|
lReturnValue = includeOnly(lReturnValue, pFilters.includeOnly);
|
|
45
77
|
}
|
|
46
78
|
if (pFilters.focus) {
|
|
47
|
-
lReturnValue =
|
|
79
|
+
lReturnValue = addFocus(lReturnValue, pFilters.focus);
|
|
80
|
+
}
|
|
81
|
+
if (pFilters.reaches) {
|
|
82
|
+
lReturnValue = filterReaches(lReturnValue, pFilters.reaches);
|
|
48
83
|
}
|
|
49
84
|
return lReturnValue;
|
|
50
85
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module.exports = class IndexedModuleGraph {
|
|
2
|
+
init(pModules) {
|
|
3
|
+
this.indexedGraph = new Map(
|
|
4
|
+
pModules.map((pModule) => [pModule.source, pModule])
|
|
5
|
+
);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
constructor(pModules) {
|
|
9
|
+
this.init(pModules);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {string} pName
|
|
15
|
+
* @return {import("../types/cruise-result").IModule}
|
|
16
|
+
*/
|
|
17
|
+
findModuleByName(pName) {
|
|
18
|
+
return this.indexedGraph.get(pName);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param {import("../types/cruise-result").IModule[]} pModules
|
|
24
|
+
* @param {string} pName
|
|
25
|
+
* @param {Set<string>} pVisited
|
|
26
|
+
* @returns {Array<string>}
|
|
27
|
+
*/
|
|
28
|
+
findTransitiveDependents(pName, pVisited = new Set()) {
|
|
29
|
+
/** @type {string[]} */
|
|
30
|
+
let lReturnValue = [];
|
|
31
|
+
const lModule = this.findModuleByName(pName);
|
|
32
|
+
|
|
33
|
+
if (lModule) {
|
|
34
|
+
let lDependents = lModule.dependents || [];
|
|
35
|
+
const lVisited = pVisited.add(pName);
|
|
36
|
+
|
|
37
|
+
if (lDependents.length > 0) {
|
|
38
|
+
lDependents
|
|
39
|
+
.filter((pDependent) => !lVisited.has(pDependent))
|
|
40
|
+
.forEach((pDependent) =>
|
|
41
|
+
this.findTransitiveDependents(pDependent, lVisited)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
lReturnValue = Array.from(lVisited);
|
|
45
|
+
}
|
|
46
|
+
return lReturnValue;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
@@ -146,12 +146,16 @@ function normalizeCruiseOptions(pOptions) {
|
|
|
146
146
|
}
|
|
147
147
|
// TODO: further down the execution path code still relies on .doNotFollow
|
|
148
148
|
// and .exclude existing. We should treat them the same as the
|
|
149
|
-
// other
|
|
149
|
+
// other filters (so either make all exist always or only
|
|
150
150
|
// when they're actually defined)
|
|
151
151
|
lReturnValue.doNotFollow = normalizeFilterOption(lReturnValue.doNotFollow);
|
|
152
152
|
lReturnValue.exclude = normalizeFilterOption(lReturnValue.exclude);
|
|
153
153
|
lReturnValue.extraExtensionsToScan = lReturnValue.extraExtensionsToScan || [];
|
|
154
|
-
lReturnValue = normalizeFilterOptions(lReturnValue, [
|
|
154
|
+
lReturnValue = normalizeFilterOptions(lReturnValue, [
|
|
155
|
+
"focus",
|
|
156
|
+
"includeOnly",
|
|
157
|
+
"reaches",
|
|
158
|
+
]);
|
|
155
159
|
|
|
156
160
|
lReturnValue.exoticRequireStrings = uniq(lReturnValue.exoticRequireStrings);
|
|
157
161
|
if (lReturnValue.reporterOptions) {
|
|
@@ -182,6 +186,7 @@ function normalizeFormatOptions(pFormatOptions) {
|
|
|
182
186
|
"exclude",
|
|
183
187
|
"focus",
|
|
184
188
|
"includeOnly",
|
|
189
|
+
"reaches",
|
|
185
190
|
]);
|
|
186
191
|
}
|
|
187
192
|
|
|
@@ -73,6 +73,7 @@ function validateCruiseOptions(pOptions) {
|
|
|
73
73
|
validatePathsSafety(pOptions.exclude);
|
|
74
74
|
validateRegExpSafety(pOptions.includeOnly);
|
|
75
75
|
validateRegExpSafety(pOptions.focus);
|
|
76
|
+
validateRegExpSafety(pOptions.reaches);
|
|
76
77
|
validateRegExpSafety(pOptions.collapse);
|
|
77
78
|
|
|
78
79
|
// necessary because not in the config schema
|
|
@@ -97,6 +98,7 @@ function validateCruiseOptions(pOptions) {
|
|
|
97
98
|
function validateFormatOptions(pFormatOptions) {
|
|
98
99
|
validatePathsSafety(pFormatOptions.exclude);
|
|
99
100
|
validatePathsSafety(pFormatOptions.focus);
|
|
101
|
+
validatePathsSafety(pFormatOptions.reaches);
|
|
100
102
|
validatePathsSafety(pFormatOptions.includeOnly);
|
|
101
103
|
validateRegExpSafety(pFormatOptions.collapse);
|
|
102
104
|
validateOutputType(pFormatOptions.outputType);
|