dependency-cruiser 11.2.1 → 11.4.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016-2021 Sander Verweij
3
+ Copyright (c) 2016-2022 Sander Verweij
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "11.2.1",
3
+ "version": "11.4.0",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -91,12 +91,12 @@
91
91
  "depcruise:report": "node ./bin/dependency-cruise.js src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.json --output-to dependency-violations.html",
92
92
  "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",
93
93
  "depcruise:focus": "node ./bin/dependency-cruise.js src bin test configs types --progress --config --output-type text --focus",
94
- "lint": "npm-run-all --parallel --aggregate-output lint:eslint lint:prettier:check lint:types",
94
+ "lint": "npm-run-all --parallel --aggregate-output lint:eslint lint:prettier lint:types",
95
95
  "lint:eslint": "eslint bin/dependency-cruise.js src test configs tools/**/*.mjs --cache --cache-location .cache/eslint/",
96
96
  "lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location .cache/eslint/",
97
- "lint:fix": "npm-run-all lint:eslint:fix lint:prettier lint:types:fix",
98
- "lint:prettier": "prettier --loglevel warn --write src/**/*.js configs/**/*.js tools/**/*.mjs bin/* types/*.d.ts test/**/*.spec.{cjs,js} test/**/*.{spec,utl}.mjs",
99
- "lint:prettier:check": "prettier --loglevel warn --check src/**/*.js configs/**/*.js tools/**/*.mjs bin/* types/*.d.ts test/**/*.spec.{cjs,js} test/**/*.{spec,utl}.mjs",
97
+ "lint:fix": "npm-run-all lint:eslint:fix lint:prettier:fix lint:types:fix",
98
+ "lint:prettier": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
99
+ "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\"",
100
100
  "lint:types": "npm-run-all lint:types:tsc lint:types:lint",
101
101
  "lint:types:tsc": "tsc --noEmit --strict --types --noUnusedLocals --noUnusedParameters types/dependency-cruiser.d.ts",
102
102
  "lint:types:lint": "eslint --no-ignore --config types/.eslintrc.json types/*.d.ts",
@@ -113,8 +113,11 @@
113
113
  "scm:push:gitlab-mirror:tags": "git push --tags gitlab-mirror",
114
114
  "scm:stage": "git add .",
115
115
  "test": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\"",
116
+ "test:i": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\" -g \"^\\[[I]\\]\"",
117
+ "test:u": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\" --grep \"^\\[[U]\\]\"",
118
+ "test:e": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\" --grep \"^\\[[E]\\]\"",
116
119
  "test:cover": "c8 --check-coverage --statements 99.9 --branches 99.7 --functions 100 --lines 99.9 --exclude \"{bin,configs,doc,docs,coverage,test,tools,webpack.conf.js,tmp*,src/**/*.template.js,src/cli/tools/svg-in-html-snippets/script.snippet.js,src/cli/init-config/get-user-input.js,src/cli/listeners/*/index.js}\" --reporter text-summary --reporter html --reporter json-summary npm test",
117
- "test:glob": "set -f && test \"`bin/dependency-cruise.js test/extract/fixtures/gather-globbing/packages/**/src/**/*.js | grep \"no dependency violations found\"`\" = \"✔ no dependency violations found (6 modules, 0 dependencies cruised)\"",
120
+ "test:glob": "set -f && test \"`bin/dependency-cruise.js test/extract/__mocks__/gather-globbing/packages/**/src/**/*.js | grep \"no dependency violations found\"`\" = \"✔ no dependency violations found (6 modules, 0 dependencies cruised)\"",
118
121
  "test:yarn-pnp": "npm-run-all test:yarn-pnp:cleanup test:yarn-pnp:pack test:yarn-pnp:copy test:yarn-pnp:install test:yarn-pnp:version test:yarn-pnp:run test:yarn-pnp:test test:yarn-pnp:cleanup",
119
122
  "test:yarn-pnp:pack": "npm pack",
120
123
  "test:yarn-pnp:copy": "shx cp -r test/integration/yarn-pnp.template test/integration/yarn-pnp.testing-ground",
@@ -132,15 +135,15 @@
132
135
  "version": "npm-run-all build depcruise:graph:doc scm:stage"
133
136
  },
134
137
  "dependencies": {
135
- "acorn": "8.6.0",
138
+ "acorn": "8.7.0",
136
139
  "acorn-jsx": "5.3.2",
137
140
  "acorn-jsx-walk": "2.0.0",
138
- "acorn-loose": "8.2.1",
141
+ "acorn-loose": "8.3.0",
139
142
  "acorn-walk": "8.2.0",
140
- "ajv": "8.8.2",
143
+ "ajv": "8.10.0",
141
144
  "chalk": "^4.1.2",
142
- "commander": "8.3.0",
143
- "enhanced-resolve": "5.8.3",
145
+ "commander": "9.0.0",
146
+ "enhanced-resolve": "5.9.2",
144
147
  "figures": "^3.2.0",
145
148
  "get-stream": "^6.0.1",
146
149
  "glob": "7.2.0",
@@ -157,53 +160,63 @@
157
160
  "wrap-ansi": "^7.0.0"
158
161
  },
159
162
  "devDependencies": {
160
- "@babel/core": "7.16.5",
161
- "@babel/plugin-transform-modules-commonjs": "7.16.5",
162
- "@babel/preset-typescript": "7.16.5",
163
- "@swc/core": "1.2.123",
164
- "@typescript-eslint/eslint-plugin": "5.8.0",
165
- "@typescript-eslint/parser": "5.8.0",
166
- "@vue/compiler-sfc": "3.2.26",
167
- "c8": "7.10.0",
168
- "chai": "4.3.4",
163
+ "@babel/core": "7.17.5",
164
+ "@babel/plugin-transform-modules-commonjs": "7.16.8",
165
+ "@babel/preset-typescript": "7.16.7",
166
+ "@swc/core": "1.2.150",
167
+ "@typescript-eslint/eslint-plugin": "5.13.0",
168
+ "@typescript-eslint/parser": "5.13.0",
169
+ "@vue/compiler-sfc": "3.2.31",
170
+ "c8": "7.11.0",
171
+ "chai": "4.3.6",
169
172
  "chai-json-schema": "1.5.1",
170
173
  "coffeescript": "2.6.1",
171
174
  "eslint": "^7.32.0",
172
175
  "eslint-config-moving-meadow": "2.0.9",
173
- "eslint-config-prettier": "8.3.0",
176
+ "eslint-config-prettier": "8.5.0",
174
177
  "eslint-plugin-budapestian": "3.0.1",
175
- "eslint-plugin-import": "2.25.3",
178
+ "eslint-plugin-import": "2.25.4",
176
179
  "eslint-plugin-mocha": "^9.0.0",
177
180
  "eslint-plugin-node": "11.1.0",
178
181
  "eslint-plugin-security": "1.4.0",
179
- "eslint-plugin-unicorn": "39.0.0",
182
+ "eslint-plugin-unicorn": "^40.1.0",
180
183
  "husky": "^4.3.8",
181
184
  "intercept-stdout": "0.1.2",
182
- "lint-staged": "12.1.4",
183
- "mocha": "9.1.3",
185
+ "lint-staged": "12.3.4",
186
+ "mocha": "9.2.1",
184
187
  "normalize-newline": "^3.0.0",
185
188
  "npm-run-all": "4.1.5",
186
189
  "prettier": "2.5.1",
187
190
  "proxyquire": "2.1.3",
188
- "shx": "0.3.3",
189
- "svelte": "3.44.3",
191
+ "shx": "0.3.4",
192
+ "svelte": "3.46.4",
190
193
  "symlink-dir": "5.0.1",
191
- "typescript": "4.5.4",
194
+ "typescript": "4.6.2",
192
195
  "upem": "^7.0.0",
193
196
  "vue-template-compiler": "2.6.14",
194
197
  "yarn": "1.22.17"
195
198
  },
196
199
  "upem": {
197
200
  "policies": [
201
+ {
202
+ "package": "chalk",
203
+ "policy": "wanted",
204
+ "because": "version 5 only exports ejs - and we use cjs and don't transpile"
205
+ },
198
206
  {
199
207
  "package": "eslint",
200
208
  "policy": "wanted",
201
209
  "because": "some eslint plugins (eslint-plugin-budapestian) are not compatible with eslint 8 yet "
202
210
  },
203
211
  {
204
- "package": "chalk",
212
+ "package": "eslint-plugin-mocha",
205
213
  "policy": "wanted",
206
- "because": "version 5 only exports ejs - and we use cjs and don't transpile"
214
+ "because": "version 10 dropped support for node 12, which we still do support"
215
+ },
216
+ {
217
+ "package": "eslint-plugin-unicorn",
218
+ "policy": "wanted",
219
+ "because": "^41 peer requires eslint 8 which we can't have yet (see above)"
207
220
  },
208
221
  {
209
222
  "package": "figures",
@@ -221,9 +234,9 @@
221
234
  "because": "version 5 only exports ejs - and we use cjs and don't transpile"
222
235
  },
223
236
  {
224
- "package": "eslint-plugin-mocha",
225
- "policy": "wanted",
226
- "because": "version 10 dropped support for node 12, which we still do support"
237
+ "package": "lint-staged",
238
+ "policy": "pin",
239
+ "because": "12.3.5 fails with SyntaxError: Unexpected token o in JSON at position 1"
227
240
  },
228
241
  {
229
242
  "package": "normalize-newline",
@@ -247,10 +260,11 @@
247
260
  "src/**/*.template.js",
248
261
  "src/cli/tools/svg-in-html-snippets/script.snippet.js",
249
262
  "test/integration/**",
250
- "test/*/fixtures/**",
251
- "test/*/*/fixtures/**",
252
- "test/*/mocks/**",
253
- "test/*/*/mocks/**",
263
+ "test/*/__fixtures__/**",
264
+ "test/*/*/__fixtures__/**",
265
+ "test/*/*/*/__fixtures__/**",
266
+ "test/*/__mocks__/**",
267
+ "test/*/*/__mocks__/**",
254
268
  "types/**"
255
269
  ],
256
270
  "engines": {
@@ -283,13 +297,13 @@
283
297
  "eslint --fix",
284
298
  "prettier --write"
285
299
  ],
286
- "test/**/*.{utl,spec}.{mjs,js}": [
300
+ "test/**/*.{utl,spec}.{mjs,cjs}": [
287
301
  "eslint --fix",
288
302
  "prettier --write"
289
303
  ],
290
- "*.d.ts": [
304
+ "types/**/*.d.ts": [
291
305
  "eslint --config types/.eslintrc.json --fix",
292
- "prettier --write --ignore-path .prettierignore"
306
+ "prettier --write"
293
307
  ]
294
308
  }
295
309
  }
@@ -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=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]};return" 'extends': '"+l(typeof(e=null!=(e=c(o,"preset")||(null!=n?c(n,"preset"):n))?e:r)==a?e.call(i,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):e)+"',\n /*\n the '"+l(typeof(e=null!=(e=c(o,"preset")||(null!=n?c(n,"preset"):n))?e:r)==a?e.call(i,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):e)+"' 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 '^(assert)$',\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 }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5: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]};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: '"+l(typeof(e=null!=(e=c(o,"testLocationRE")||(null!=n?c(n,"testLocationRE"):n))?e:r)==a?e.call(i,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:163,column:18},end:{line:163,column:36}}}):e)+"'\n },\n to: {\n path: '"+l(typeof(e=null!=(e=c(o,"testLocationRE")||(null!=n?c(n,"testLocationRE"):n))?e:r)==a?e.call(i,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:15},end:{line:166,column:33}}}):e)+"'\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(i=null!=(i=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:317,column:17},end:{line:317,column:29}}}):i)+"'\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(i=null!=(i=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:337,column:17},end:{line:337,column:34}}}):i)+"',\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(i=null!=(i=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:357,column:17},end:{line:357,column:32}}}):i)+"'\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:153,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:154,column:4},end:{line:169,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=!c(o,"hasTestsOutsideSource")?e.hooks.blockHelperMissing.call(n,h,u):h)&&(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:192,column:15},end:{line:192,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\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:285,column:4},end:{line:289,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:298,column:4},end:{line:302,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:315,column:4},end:{line:323,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:335,column:4},end:{line:347,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:355,column:4},end:{line:363,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:474,column:33},end:{line:474,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:474,column:48},end:{line:474,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=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]};return" 'extends': '"+l(typeof(e=null!=(e=c(o,"preset")||(null!=n?c(n,"preset"):n))?e:r)==a?e.call(i,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):e)+"',\n /*\n the '"+l(typeof(e=null!=(e=c(o,"preset")||(null!=n?c(n,"preset"):n))?e:r)==a?e.call(i,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):e)+"' 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 }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5: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]};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: '"+l(typeof(e=null!=(e=c(o,"testLocationRE")||(null!=n?c(n,"testLocationRE"):n))?e:r)==a?e.call(i,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:162,column:18},end:{line:162,column:36}}}):e)+"'\n },\n to: {\n path: '"+l(typeof(e=null!=(e=c(o,"testLocationRE")||(null!=n?c(n,"testLocationRE"):n))?e:r)==a?e.call(i,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:165,column:15},end:{line:165,column:33}}}):e)+"'\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(i=null!=(i=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:316,column:17},end:{line:316,column:29}}}):i)+"'\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(i=null!=(i=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:336,column:17},end:{line:336,column:34}}}):i)+"',\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(i=null!=(i=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?i:e.hooks.helperMissing)?i.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:356,column:17},end:{line:356,column:32}}}):i)+"'\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:152,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:153,column:4},end:{line:168,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=!c(o,"hasTestsOutsideSource")?e.hooks.blockHelperMissing.call(n,h,u):h)&&(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:191,column:15},end:{line:191,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:284,column:4},end:{line:288,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:297,column:4},end:{line:301,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:314,column:4},end:{line:322,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:334,column:4},end:{line:346,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:354,column:4},end:{line:362,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:473,column:33},end:{line:473,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:473,column:48},end:{line:473,column:56}}}):d)+"\n"},useData:!0});
@@ -84,8 +84,8 @@ function findFolderByName(pAllFolders, pName) {
84
84
  return pAllFolders.find((pFolder) => pFolder.name === pName);
85
85
  }
86
86
 
87
- function denormalizeInstability(pAllFolders) {
88
- return (pFolder) => ({
87
+ function denormalizeInstability(pFolder, _, pAllFolders) {
88
+ return {
89
89
  ...pFolder,
90
90
  dependencies: pFolder.dependencies.map((pDependency) => {
91
91
  const lFolder = findFolderByName(pAllFolders, pDependency.name) || {};
@@ -94,7 +94,7 @@ function denormalizeInstability(pAllFolders) {
94
94
  instability: lFolder.instability >= 0 ? lFolder.instability : 0,
95
95
  };
96
96
  }),
97
- });
97
+ };
98
98
  }
99
99
 
100
100
  module.exports = function aggregateToFolders(pModules) {
@@ -102,5 +102,5 @@ module.exports = function aggregateToFolders(pModules) {
102
102
  pModules.filter(metricsAreCalculable).reduce(aggregateToFolder, {})
103
103
  ).map(calculateFolderMetrics);
104
104
 
105
- return lFolders.map(denormalizeInstability(lFolders));
105
+ return lFolders.map(denormalizeInstability);
106
106
  };
@@ -1,9 +1,46 @@
1
+ const validate = require("../../../validate");
1
2
  const aggregateToFolders = require("./aggregate-to-folders");
2
3
 
4
+ /**
5
+ *
6
+ * @param {*} pFolder
7
+ * @param {import('../../../../types/dependency-cruiser').IOptions} pOptions
8
+ * @returns
9
+ */
10
+ function validateFolderDependency(pFolder, pOptions) {
11
+ return (pDependency) => {
12
+ return {
13
+ ...pDependency,
14
+ ...validate.folder(pOptions.ruleSet || {}, pFolder, pDependency),
15
+ };
16
+ };
17
+ }
18
+
19
+ function addFolderDependencyViolations(pOptions) {
20
+ return (pFolder) => {
21
+ return {
22
+ ...pFolder,
23
+ dependencies: pFolder.dependencies.map(
24
+ validateFolderDependency(pFolder, pOptions)
25
+ ),
26
+ };
27
+ };
28
+ }
29
+
30
+ /**
31
+ *
32
+ * @param {import('../../../../types/dependency-cruiser').IModule[]} pModules
33
+ * @param {import('../../../../types/dependency-cruiser').IOptions} pOptions
34
+ * @returns {any}
35
+ */
3
36
  module.exports = function deriveFolderMetrics(pModules, pOptions) {
4
37
  let lReturnValue = {};
5
38
  if (pOptions.metrics) {
6
- lReturnValue = { folders: aggregateToFolders(pModules) };
39
+ lReturnValue = {
40
+ folders: aggregateToFolders(pModules).map(
41
+ addFolderDependencyViolations(pOptions)
42
+ ),
43
+ };
7
44
  }
8
45
  return lReturnValue;
9
46
  };
@@ -6,11 +6,19 @@ const clearCaches = require("./clear-caches");
6
6
  module.exports = function enrich(pModules, pOptions, pFileAndDirectoryArray) {
7
7
  clearCaches();
8
8
  const lModules = enrichModules(pModules, pOptions);
9
+ const lFolders = aggregateToFolders(lModules, pOptions);
9
10
 
10
11
  clearCaches();
11
- return {
12
+ const lReturnValue = {
12
13
  modules: lModules,
13
- ...aggregateToFolders(lModules, pOptions),
14
- summary: summarize(lModules, pOptions, pFileAndDirectoryArray),
14
+ ...lFolders,
15
+ summary: summarize(
16
+ lModules,
17
+ pOptions,
18
+ pFileAndDirectoryArray,
19
+ lFolders.folders
20
+ ),
15
21
  };
22
+
23
+ return lReturnValue;
16
24
  };
@@ -0,0 +1,31 @@
1
+ function getViolationStats(pViolations) {
2
+ return pViolations.reduce(
3
+ (pAll, pThis) => {
4
+ pAll[pThis.rule.severity] += 1;
5
+ return pAll;
6
+ },
7
+ {
8
+ error: 0,
9
+ warn: 0,
10
+ info: 0,
11
+ ignore: 0,
12
+ }
13
+ );
14
+ }
15
+
16
+ function getModulesCruised(pModules) {
17
+ return pModules.length;
18
+ }
19
+
20
+ function getDependenciesCruised(pModules) {
21
+ return pModules.reduce(
22
+ (pAll, pModule) => pAll + pModule.dependencies.length,
23
+ 0
24
+ );
25
+ }
26
+
27
+ module.exports = {
28
+ getViolationStats,
29
+ getModulesCruised,
30
+ getDependenciesCruised,
31
+ };
@@ -1,6 +1,12 @@
1
1
  const addRuleSetUsed = require("./add-rule-set-used");
2
2
  const summarizeModules = require("./summarize-modules");
3
+ const summarizeFolders = require("./summarize-folders");
3
4
  const summarizeOptions = require("./summarize-options");
5
+ const {
6
+ getViolationStats,
7
+ getModulesCruised,
8
+ getDependenciesCruised,
9
+ } = require("./get-stats");
4
10
 
5
11
  /**
6
12
  *
@@ -8,17 +14,30 @@ const summarizeOptions = require("./summarize-options");
8
14
  * cruised modules that have been enriched with mandatory attributes &
9
15
  * have been validated against rules as passed in the options
10
16
  * @param {import("../../../types/options").ICruiseOptions} pOptions -
11
- *
12
17
  * @param {string[]} pFileDirectoryArray -
13
18
  * the files/ directories originally passed to be cruised
19
+ * @param {import("../../../types/dependency-cruiser").IFolder[]} pFolders -
20
+ * the pModules collapsed to folders, with their own metrics & deps
14
21
  *
15
22
  * @returns {import("../../../types/cruise-result").ISummary} -
16
23
  * a summary of the found modules, dependencies and any violations
17
24
  */
18
- module.exports = function makeSummary(pModules, pOptions, pFileDirectoryArray) {
19
- return Object.assign(
20
- summarizeModules(pModules, pOptions.ruleSet),
21
- summarizeOptions(pFileDirectoryArray, pOptions),
22
- pOptions.ruleSet ? { ruleSetUsed: addRuleSetUsed(pOptions) } : {}
25
+ module.exports = function summarize(
26
+ pModules,
27
+ pOptions,
28
+ pFileDirectoryArray,
29
+ pFolders
30
+ ) {
31
+ const lViolations = summarizeModules(pModules, pOptions.ruleSet).concat(
32
+ summarizeFolders(pFolders || [], pOptions.ruleSet)
23
33
  );
34
+
35
+ return {
36
+ violations: lViolations,
37
+ ...getViolationStats(lViolations),
38
+ totalCruised: getModulesCruised(pModules),
39
+ totalDependenciesCruised: getDependenciesCruised(pModules),
40
+ ...summarizeOptions(pFileDirectoryArray, pOptions),
41
+ ...(pOptions.ruleSet ? { ruleSetUsed: addRuleSetUsed(pOptions) } : {}),
42
+ };
24
43
  };
@@ -0,0 +1,38 @@
1
+ const _has = require("lodash/has");
2
+ const { findRuleByName } = require("../../graph-utl/rule-set");
3
+
4
+ function classifyViolation(pRule, pRuleSet) {
5
+ if (_has(findRuleByName(pRuleSet, pRule.name), "to.moreUnstable")) {
6
+ return "instability";
7
+ }
8
+ return "folder";
9
+ }
10
+
11
+ function getViolations(pFolder, pRuleSet) {
12
+ return pFolder.dependencies
13
+ .filter((pDependency) => !pDependency.valid)
14
+ .flatMap((pDependency) =>
15
+ pDependency.rules.map((pRule) => {
16
+ const lViolationType = classifyViolation(pRule, pRuleSet);
17
+
18
+ return {
19
+ type: lViolationType,
20
+ from: pFolder.name,
21
+ to: pDependency.name,
22
+ rule: pRule,
23
+ ...(lViolationType === "instability"
24
+ ? {
25
+ metrics: {
26
+ from: { instability: pFolder.instability },
27
+ to: { instability: pDependency.instability },
28
+ },
29
+ }
30
+ : {}),
31
+ };
32
+ })
33
+ );
34
+ }
35
+
36
+ module.exports = function summarizeFolders(pFolders, pRuleSet) {
37
+ return pFolders.flatMap((pFolder) => getViolations(pFolder, pRuleSet));
38
+ };
@@ -15,20 +15,6 @@ function cutNonTransgressions(pModule) {
15
15
  };
16
16
  }
17
17
 
18
- function extractMetaData(pViolations) {
19
- return pViolations.reduce(
20
- (pAll, pThis) => {
21
- pAll[pThis.rule.severity] += 1;
22
- return pAll;
23
- },
24
- {
25
- error: 0,
26
- warn: 0,
27
- info: 0,
28
- ignore: 0,
29
- }
30
- );
31
- }
32
18
  function toDependencyViolationSummary(pRule, pModule, pDependency, pRuleSet) {
33
19
  let lReturnValue = {
34
20
  type: "dependency",
@@ -149,22 +135,10 @@ function extractModuleViolations(pModules, pRuleSet) {
149
135
  }
150
136
 
151
137
  module.exports = function summarizeModules(pModules, pRuleSet) {
152
- const lViolations = _uniqWith(
138
+ return _uniqWith(
153
139
  extractDependencyViolations(pModules, pRuleSet)
154
140
  .concat(extractModuleViolations(pModules, pRuleSet))
155
141
  .sort(compare.violations),
156
142
  isSameViolation
157
143
  );
158
-
159
- return {
160
- violations: lViolations,
161
- ...extractMetaData(lViolations),
162
- totalCruised: pModules.length,
163
- totalDependenciesCruised: pModules.reduce(
164
- (pAll, pModule) => pAll + pModule.dependencies.length,
165
- 0
166
- ),
167
- };
168
144
  };
169
-
170
- module.exports.extractModuleViolations = extractModuleViolations;
@@ -29,23 +29,27 @@ const SHAREABLE_OPTIONS = [
29
29
 
30
30
  function makeOptionsPresentable(pOptions) {
31
31
  return SHAREABLE_OPTIONS.filter(
32
- (pOption) => _has(pOptions, pOption) && pOptions[pOption] !== 0
32
+ (pShareableOptionKey) =>
33
+ _has(pOptions, pShareableOptionKey) && pOptions[pShareableOptionKey] !== 0
33
34
  )
34
35
  .filter(
35
- (pOption) =>
36
- pOption !== "doNotFollow" ||
36
+ (pShareableOptionKey) =>
37
+ pShareableOptionKey !== "doNotFollow" ||
37
38
  Object.keys(pOptions.doNotFollow).length > 0
38
39
  )
39
40
  .filter(
40
- (pOption) =>
41
- pOption !== "exclude" || Object.keys(pOptions.exclude).length > 0
41
+ (pShareableOptionKey) =>
42
+ pShareableOptionKey !== "exclude" ||
43
+ Object.keys(pOptions.exclude).length > 0
42
44
  )
43
45
  .filter(
44
- (pOption) =>
45
- pOption !== "knownViolations" || pOptions.knownViolations.length > 0
46
+ (pShareableOptionKey) =>
47
+ pShareableOptionKey !== "knownViolations" ||
48
+ pOptions.knownViolations.length > 0
46
49
  )
47
- .reduce((pAll, pOption) => {
48
- pAll[pOption] = pOptions[pOption];
50
+ .reduce((pAll, pShareableOptionKey) => {
51
+ // console.error(pOption);
52
+ pAll[pShareableOptionKey] = pOptions[pShareableOptionKey];
49
53
  return pAll;
50
54
  }, {});
51
55
  }