dependency-cruiser 10.0.2 → 10.0.6
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-fmt.js +3 -3
- package/bin/dependency-cruise.js +3 -3
- package/bin/wrap-stream-in-html.js +1 -5
- package/package.json +32 -55
- package/src/cli/defaults.js +15 -0
- package/src/cli/format.js +0 -1
- package/src/cli/index.js +1 -1
- package/src/cli/init-config/config.js.template.js +1 -106
- package/src/cli/init-config/index.js +3 -2
- package/src/cli/init-config/normalize-init-options.js +2 -2
- package/src/cli/init-config/write-config.js +3 -2
- package/src/cli/init-config/write-run-scripts-to-manifest.js +1 -1
- package/src/cli/normalize-options.js +1 -1
- package/src/cli/tools/wrap-stream-in-html.js +25 -20
- package/src/cli/validate-node-environment.js +3 -3
- package/src/config-utl/extract-babel-config.js +2 -3
- package/src/config-utl/extract-ts-config.js +5 -7
- package/src/enrich/derive/reachable/index.js +2 -8
- package/src/extract/ast-extractors/extract-typescript-deps.js +4 -7
- package/src/extract/ast-extractors/swc-dependency-visitor.js +14 -11
- package/src/extract/parse/to-swc-ast.js +3 -4
- package/src/extract/parse/to-typescript-ast.js +3 -4
- package/src/extract/transpile/babel-wrap.js +2 -2
- package/src/extract/transpile/coffeescript-wrap.js +5 -4
- package/src/extract/transpile/livescript-wrap.js +5 -5
- package/src/extract/transpile/meta.js +1 -1
- package/src/extract/transpile/svelte-wrap.js +3 -1
- package/src/extract/transpile/typescript-wrap.js +3 -4
- package/src/extract/transpile/vue-template-wrap.js +3 -1
- package/src/main/index.js +1 -1
- package/src/main/options/defaults.js +10 -0
- package/src/main/options/normalize.js +1 -1
- package/src/main/rule-set/validate.js +1 -1
- package/src/meta.js +18 -0
- package/src/report/dot/default-theme.js +145 -0
- package/src/report/dot/dot.template.js +1 -199
- package/src/report/dot/theming.js +3 -3
- package/src/report/error-html/error-html.template.js +1 -132
- package/src/report/error-html/utl.js +1 -1
- package/src/report/html/html.template.js +1 -118
- package/src/schema/README.md +2 -2
- package/src/schema/configuration.schema.js +441 -0
- package/src/schema/cruise-result.schema.js +595 -0
- package/src/cli/defaults.json +0 -15
- package/src/main/options/defaults.json +0 -10
- package/src/report/dot/default-theme.json +0 -145
- package/src/schema/configuration.schema.json +0 -697
- package/src/schema/cruise-result.schema.json +0 -988
package/bin/depcruise-fmt.js
CHANGED
|
@@ -14,8 +14,8 @@ try {
|
|
|
14
14
|
// not so nice
|
|
15
15
|
/* eslint-disable node/global-require */
|
|
16
16
|
const program = require("commander");
|
|
17
|
-
const
|
|
18
|
-
const format = require("../src/cli/format");
|
|
17
|
+
const { version } = require("../src/meta.js");
|
|
18
|
+
const format = require("../src/cli/format.js");
|
|
19
19
|
|
|
20
20
|
program
|
|
21
21
|
.description(
|
|
@@ -51,7 +51,7 @@ try {
|
|
|
51
51
|
"exit with a non-zero exit code when the input json contains error level " +
|
|
52
52
|
"dependency violations. Works for err, err-long and teamcity output types"
|
|
53
53
|
)
|
|
54
|
-
.version(
|
|
54
|
+
.version(version)
|
|
55
55
|
.arguments("<dependency-cruiser-json>")
|
|
56
56
|
.parse(process.argv);
|
|
57
57
|
|
package/bin/dependency-cruise.js
CHANGED
|
@@ -9,7 +9,7 @@ try {
|
|
|
9
9
|
// not so nice
|
|
10
10
|
/* eslint-disable node/global-require */
|
|
11
11
|
const program = require("commander");
|
|
12
|
-
const
|
|
12
|
+
const { version } = require("../src/meta.js");
|
|
13
13
|
const cli = require("../src/cli");
|
|
14
14
|
|
|
15
15
|
program
|
|
@@ -88,8 +88,8 @@ try {
|
|
|
88
88
|
"-i, --info",
|
|
89
89
|
"shows what languages and extensions dependency-cruiser supports"
|
|
90
90
|
)
|
|
91
|
-
.version(
|
|
92
|
-
.arguments("
|
|
91
|
+
.version(version)
|
|
92
|
+
.arguments("[files-or-directories]")
|
|
93
93
|
.parse(process.argv);
|
|
94
94
|
|
|
95
95
|
if (Boolean(program.args[0]) || program.opts().info || program.opts().init) {
|
|
@@ -2,8 +2,4 @@
|
|
|
2
2
|
|
|
3
3
|
const wrapStreamInHtml = require("../src/cli/tools/wrap-stream-in-html");
|
|
4
4
|
|
|
5
|
-
wrapStreamInHtml(process.stdin)
|
|
6
|
-
.then((pOutput) => process.stdout.write(pOutput))
|
|
7
|
-
.catch((pError) => {
|
|
8
|
-
process.stderr.write(`${pError}\n`);
|
|
9
|
-
});
|
|
5
|
+
wrapStreamInHtml(process.stdin, process.stdout);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.6",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -57,6 +57,7 @@
|
|
|
57
57
|
"bin",
|
|
58
58
|
"configs/**/*.js",
|
|
59
59
|
"src",
|
|
60
|
+
"!src/**/*.json",
|
|
60
61
|
"!src/**/*.hbs",
|
|
61
62
|
"!src/**/*.md",
|
|
62
63
|
"!**/*.DS_Store",
|
|
@@ -66,7 +67,7 @@
|
|
|
66
67
|
"README.md"
|
|
67
68
|
],
|
|
68
69
|
"scripts": {
|
|
69
|
-
"build": "make
|
|
70
|
+
"build": "make build",
|
|
70
71
|
"build:clean": "make clean",
|
|
71
72
|
"check": "npm-run-all build lint depcruise test:cover",
|
|
72
73
|
"check:full": "npm-run-all check test:glob test:yarn-pnp",
|
|
@@ -89,8 +90,8 @@
|
|
|
89
90
|
"lint:eslint": "eslint bin/dependency-cruise.js src test configs tools/**/*.mjs --cache --cache-location .cache/eslint/",
|
|
90
91
|
"lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location .cache/eslint/",
|
|
91
92
|
"lint:fix": "npm-run-all lint:eslint:fix lint:prettier lint:types:fix",
|
|
92
|
-
"lint:prettier": "prettier --loglevel warn --write src/**/*.
|
|
93
|
-
"lint:prettier:check": "prettier --loglevel warn --check src/**/*.
|
|
93
|
+
"lint:prettier": "prettier --loglevel warn --write src/**/*.js configs/**/*.js tools/**/*.mjs bin/* !**/*.template.js types/*.d.ts test/**/*.spec.{cjs,js} test/**/*.{spec,utl}.mjs",
|
|
94
|
+
"lint:prettier:check": "prettier --loglevel warn --check src/**/*.js configs/**/*.js tools/**/*.mjs bin/* !**/*.template.js types/*.d.ts test/**/*.spec.{cjs,js} test/**/*.{spec,utl}.mjs",
|
|
94
95
|
"lint:types": "npm-run-all lint:types:tsc lint:types:lint",
|
|
95
96
|
"lint:types:tsc": "tsc --noEmit --strict --types --noUnusedLocals --noUnusedParameters types/dependency-cruiser.d.ts",
|
|
96
97
|
"lint:types:lint": "eslint --no-ignore --config types/.eslintrc.json types/*.d.ts",
|
|
@@ -106,8 +107,8 @@
|
|
|
106
107
|
"scm:push:gitlab-mirror:commits": "git push gitlab-mirror",
|
|
107
108
|
"scm:push:gitlab-mirror:tags": "git push --tags gitlab-mirror",
|
|
108
109
|
"scm:stage": "git add .",
|
|
109
|
-
"test": "mocha --timeout 4000 \"test/**/*.spec.js\"",
|
|
110
|
-
"test:cover": "
|
|
110
|
+
"test": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\"",
|
|
111
|
+
"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",
|
|
111
112
|
"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)\"",
|
|
112
113
|
"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",
|
|
113
114
|
"test:yarn-pnp:pack": "npm pack",
|
|
@@ -126,21 +127,21 @@
|
|
|
126
127
|
"version": "npm-run-all build depcruise:graph:doc scm:stage"
|
|
127
128
|
},
|
|
128
129
|
"dependencies": {
|
|
129
|
-
"acorn": "8.4.
|
|
130
|
-
"acorn-jsx": "5.3.
|
|
130
|
+
"acorn": "8.4.1",
|
|
131
|
+
"acorn-jsx": "5.3.2",
|
|
131
132
|
"acorn-jsx-walk": "2.0.0",
|
|
132
133
|
"acorn-loose": "8.1.0",
|
|
133
|
-
"acorn-walk": "8.1.
|
|
134
|
-
"ajv": "8.6.
|
|
134
|
+
"acorn-walk": "8.1.1",
|
|
135
|
+
"ajv": "8.6.2",
|
|
135
136
|
"chalk": "4.1.1",
|
|
136
|
-
"commander": "
|
|
137
|
+
"commander": "8.0.0",
|
|
137
138
|
"enhanced-resolve": "5.8.2",
|
|
138
139
|
"figures": "3.2.0",
|
|
139
140
|
"get-stream": "6.0.1",
|
|
140
141
|
"glob": "7.1.7",
|
|
141
142
|
"handlebars": "4.7.7",
|
|
142
143
|
"indent-string": "4.0.0",
|
|
143
|
-
"inquirer": "8.1.
|
|
144
|
+
"inquirer": "8.1.2",
|
|
144
145
|
"json5": "2.2.0",
|
|
145
146
|
"lodash": "4.17.21",
|
|
146
147
|
"safe-regex": "2.1.1",
|
|
@@ -151,16 +152,17 @@
|
|
|
151
152
|
"wrap-ansi": "7.0.0"
|
|
152
153
|
},
|
|
153
154
|
"devDependencies": {
|
|
154
|
-
"@babel/core": "7.14.
|
|
155
|
+
"@babel/core": "7.14.8",
|
|
155
156
|
"@babel/plugin-transform-modules-commonjs": "7.14.5",
|
|
156
157
|
"@babel/preset-typescript": "7.14.5",
|
|
157
|
-
"@swc/core": "1.2.
|
|
158
|
-
"@typescript-eslint/eslint-plugin": "4.
|
|
159
|
-
"@typescript-eslint/parser": "4.
|
|
158
|
+
"@swc/core": "1.2.66",
|
|
159
|
+
"@typescript-eslint/eslint-plugin": "4.28.4",
|
|
160
|
+
"@typescript-eslint/parser": "4.28.4",
|
|
161
|
+
"c8": "7.7.3",
|
|
160
162
|
"chai": "4.3.4",
|
|
161
163
|
"chai-json-schema": "1.5.1",
|
|
162
164
|
"coffeescript": "2.5.1",
|
|
163
|
-
"eslint": "7.
|
|
165
|
+
"eslint": "7.31.0",
|
|
164
166
|
"eslint-config-moving-meadow": "2.0.9",
|
|
165
167
|
"eslint-config-prettier": "8.3.0",
|
|
166
168
|
"eslint-plugin-budapestian": "2.3.0",
|
|
@@ -168,25 +170,28 @@
|
|
|
168
170
|
"eslint-plugin-mocha": "9.0.0",
|
|
169
171
|
"eslint-plugin-node": "11.1.0",
|
|
170
172
|
"eslint-plugin-security": "1.4.0",
|
|
171
|
-
"eslint-plugin-unicorn": "
|
|
173
|
+
"eslint-plugin-unicorn": "34.0.1",
|
|
172
174
|
"husky": "4.3.0",
|
|
173
175
|
"intercept-stdout": "0.1.2",
|
|
174
|
-
"lint-staged": "11.
|
|
175
|
-
"mocha": "9.0.
|
|
176
|
-
"normalize-newline": "
|
|
176
|
+
"lint-staged": "11.1.1",
|
|
177
|
+
"mocha": "9.0.2",
|
|
178
|
+
"normalize-newline": "4.1.0",
|
|
177
179
|
"npm-run-all": "4.1.5",
|
|
178
|
-
"nyc": "15.1.0",
|
|
179
180
|
"prettier": "2.2.1",
|
|
180
181
|
"shx": "0.3.3",
|
|
181
|
-
"svelte": "3.
|
|
182
|
+
"svelte": "3.40.2",
|
|
182
183
|
"symlink-dir": "5.0.1",
|
|
183
|
-
"typescript": "4.3.
|
|
184
|
+
"typescript": "4.3.5",
|
|
184
185
|
"upem": "6.0.0",
|
|
185
186
|
"vue-template-compiler": "2.6.14",
|
|
186
187
|
"yarn": "1.22.10"
|
|
187
188
|
},
|
|
188
189
|
"upem": {
|
|
189
190
|
"donotup": [
|
|
191
|
+
{
|
|
192
|
+
"package": "figures",
|
|
193
|
+
"because": "version 4 only exports ejs - and we use cjs and don't transpile"
|
|
194
|
+
},
|
|
190
195
|
{
|
|
191
196
|
"package": "husky",
|
|
192
197
|
"because": "https://github.com/typicode/husky/issues/822"
|
|
@@ -195,10 +200,6 @@
|
|
|
195
200
|
"package": "indent-string",
|
|
196
201
|
"because": "version 5 only exports ejs - and we use cjs and don't transpile"
|
|
197
202
|
},
|
|
198
|
-
{
|
|
199
|
-
"package": "normalize-newline",
|
|
200
|
-
"because": "version 4 only exports ejs - and we use cjs and don't transpile"
|
|
201
|
-
},
|
|
202
203
|
{
|
|
203
204
|
"package": "prettier",
|
|
204
205
|
"because": "version 2.3.0 gives different results between local (macOS) and the ci (linux)"
|
|
@@ -209,42 +210,18 @@
|
|
|
209
210
|
}
|
|
210
211
|
]
|
|
211
212
|
},
|
|
212
|
-
"nyc": {
|
|
213
|
-
"statements": 99.85,
|
|
214
|
-
"branches": 99.7,
|
|
215
|
-
"functions": 100,
|
|
216
|
-
"lines": 99.85,
|
|
217
|
-
"exclude": [
|
|
218
|
-
"bin",
|
|
219
|
-
"configs/**/*",
|
|
220
|
-
"test/**/*",
|
|
221
|
-
"src/**/*.template.js",
|
|
222
|
-
"src/cli/tools/svg-in-html-snippets/script.snippet.js",
|
|
223
|
-
"src/cli/init-config/get-user-input.js",
|
|
224
|
-
"src/cli/listeners/*/index.js",
|
|
225
|
-
"coverage/**/*",
|
|
226
|
-
"tmp*",
|
|
227
|
-
"tools/**/*",
|
|
228
|
-
"docs/**/*",
|
|
229
|
-
"doc/**/*",
|
|
230
|
-
"webpack.conf.js"
|
|
231
|
-
],
|
|
232
|
-
"reporter": [
|
|
233
|
-
"text-summary",
|
|
234
|
-
"html",
|
|
235
|
-
"json-summary"
|
|
236
|
-
],
|
|
237
|
-
"all": true
|
|
238
|
-
},
|
|
239
213
|
"eslintIgnore": [
|
|
240
214
|
"node_modules",
|
|
241
215
|
"coverage",
|
|
242
216
|
"tmp",
|
|
217
|
+
"src/**/*.schema.js",
|
|
243
218
|
"src/**/*.template.js",
|
|
244
219
|
"src/cli/tools/svg-in-html-snippets/script.snippet.js",
|
|
245
220
|
"test/integration/**",
|
|
246
221
|
"test/*/fixtures/**",
|
|
247
222
|
"test/*/*/fixtures/**",
|
|
223
|
+
"test/*/mocks/**",
|
|
224
|
+
"test/*/*/mocks/**",
|
|
248
225
|
"types/**"
|
|
249
226
|
],
|
|
250
227
|
"engines": {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
OLD_DEFAULT_RULES_FILE_NAME: ".dependency-cruiser.json",
|
|
3
|
+
RULES_FILE_NAME_SEARCH_ARRAY: [
|
|
4
|
+
".dependency-cruiser.json",
|
|
5
|
+
".dependency-cruiser.js",
|
|
6
|
+
".dependency-cruiser.cjs",
|
|
7
|
+
],
|
|
8
|
+
DEFAULT_CONFIG_FILE_NAME: ".dependency-cruiser.js",
|
|
9
|
+
WEBPACK_CONFIG: "webpack.config.js",
|
|
10
|
+
TYPESCRIPT_CONFIG: "tsconfig.json",
|
|
11
|
+
BABEL_CONFIG: ".babelrc",
|
|
12
|
+
PACKAGE_MANIFEST: "package.json",
|
|
13
|
+
OUTPUT_TYPE: "err",
|
|
14
|
+
OUTPUT_TO: "-",
|
|
15
|
+
};
|
package/src/cli/format.js
CHANGED
package/src/cli/index.js
CHANGED
|
@@ -72,7 +72,7 @@ function setUpListener(pCruiseOptions) {
|
|
|
72
72
|
_get(pCruiseOptions, "ruleSet.options.progress.type")
|
|
73
73
|
);
|
|
74
74
|
const lListenerFunction = _get(lString2Listener, lListenerID);
|
|
75
|
-
/*
|
|
75
|
+
/* c8 ignore next 3 */
|
|
76
76
|
if (Boolean(lListenerFunction)) {
|
|
77
77
|
lListenerFunction(bus);
|
|
78
78
|
}
|
|
@@ -1,106 +1 @@
|
|
|
1
|
-
var Handlebars = require("handlebars/runtime"); var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
|
2
|
-
templates['config.js.template.hbs'] = template({"1":function(container,depth0,helpers,partials,data) {
|
|
3
|
-
var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
4
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
5
|
-
return parent[propertyName];
|
|
6
|
-
}
|
|
7
|
-
return undefined
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
return " 'extends': '"
|
|
11
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"preset") || (depth0 != null ? lookupProperty(depth0,"preset") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"preset","hash":{},"data":data,"loc":{"start":{"line":4,"column":14},"end":{"line":4,"column":24}}}) : helper)))
|
|
12
|
-
+ "',\n /*\n the '"
|
|
13
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"preset") || (depth0 != null ? lookupProperty(depth0,"preset") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"preset","hash":{},"data":data,"loc":{"start":{"line":6,"column":10},"end":{"line":6,"column":20}}}) : helper)))
|
|
14
|
-
+ "' 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";
|
|
15
|
-
},"3":function(container,depth0,helpers,partials,data) {
|
|
16
|
-
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";
|
|
17
|
-
},"5":function(container,depth0,helpers,partials,data) {
|
|
18
|
-
var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
20
|
-
return parent[propertyName];
|
|
21
|
-
}
|
|
22
|
-
return undefined
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
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: '"
|
|
26
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"testLocationRE") || (depth0 != null ? lookupProperty(depth0,"testLocationRE") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"testLocationRE","hash":{},"data":data,"loc":{"start":{"line":163,"column":18},"end":{"line":163,"column":36}}}) : helper)))
|
|
27
|
-
+ "'\n },\n to: {\n path: '"
|
|
28
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"testLocationRE") || (depth0 != null ? lookupProperty(depth0,"testLocationRE") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"testLocationRE","hash":{},"data":data,"loc":{"start":{"line":166,"column":15},"end":{"line":166,"column":33}}}) : helper)))
|
|
29
|
-
+ "'\n }\n },\n";
|
|
30
|
-
},"7":function(container,depth0,helpers,partials,data) {
|
|
31
|
-
return " tsPreCompilationDeps: true,\n";
|
|
32
|
-
},"9":function(container,depth0,helpers,partials,data) {
|
|
33
|
-
return " // tsPreCompilationDeps: false,\n";
|
|
34
|
-
},"11":function(container,depth0,helpers,partials,data) {
|
|
35
|
-
return " combinedDependencies: true,\n";
|
|
36
|
-
},"13":function(container,depth0,helpers,partials,data) {
|
|
37
|
-
return " // combinedDependencies: false,\n";
|
|
38
|
-
},"15":function(container,depth0,helpers,partials,data) {
|
|
39
|
-
var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
40
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
41
|
-
return parent[propertyName];
|
|
42
|
-
}
|
|
43
|
-
return undefined
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
return " tsConfig: {\n fileName: '"
|
|
47
|
-
+ container.escapeExpression(((helper = (helper = lookupProperty(helpers,"tsConfig") || (depth0 != null ? lookupProperty(depth0,"tsConfig") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"tsConfig","hash":{},"data":data,"loc":{"start":{"line":314,"column":17},"end":{"line":314,"column":29}}}) : helper)))
|
|
48
|
-
+ "'\n },\n";
|
|
49
|
-
},"17":function(container,depth0,helpers,partials,data) {
|
|
50
|
-
return " // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n";
|
|
51
|
-
},"19":function(container,depth0,helpers,partials,data) {
|
|
52
|
-
var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
53
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
54
|
-
return parent[propertyName];
|
|
55
|
-
}
|
|
56
|
-
return undefined
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return " webpackConfig: {\n fileName: '"
|
|
60
|
-
+ container.escapeExpression(((helper = (helper = lookupProperty(helpers,"webpackConfig") || (depth0 != null ? lookupProperty(depth0,"webpackConfig") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"webpackConfig","hash":{},"data":data,"loc":{"start":{"line":334,"column":17},"end":{"line":334,"column":34}}}) : helper)))
|
|
61
|
-
+ "',\n // env: {},\n // args: {},\n },\n";
|
|
62
|
-
},"21":function(container,depth0,helpers,partials,data) {
|
|
63
|
-
return " // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n";
|
|
64
|
-
},"23":function(container,depth0,helpers,partials,data) {
|
|
65
|
-
var helper, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
66
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
67
|
-
return parent[propertyName];
|
|
68
|
-
}
|
|
69
|
-
return undefined
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
return " babelConfig: {\n fileName: '"
|
|
73
|
-
+ container.escapeExpression(((helper = (helper = lookupProperty(helpers,"babelConfig") || (depth0 != null ? lookupProperty(depth0,"babelConfig") : depth0)) != null ? helper : container.hooks.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : (container.nullContext || {}),{"name":"babelConfig","hash":{},"data":data,"loc":{"start":{"line":354,"column":17},"end":{"line":354,"column":32}}}) : helper)))
|
|
74
|
-
+ "'\n },\n";
|
|
75
|
-
},"25":function(container,depth0,helpers,partials,data) {
|
|
76
|
-
return " // babelConfig: {\n // fileName: './.babelrc'\n // },\n";
|
|
77
|
-
},"compiler":[8,">= 4.3.0"],"main":function(container,depth0,helpers,partials,data) {
|
|
78
|
-
var stack1, helper, options, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=container.hooks.helperMissing, alias3="function", alias4=container.escapeExpression, lookupProperty = container.lookupProperty || function(parent, propertyName) {
|
|
79
|
-
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
|
|
80
|
-
return parent[propertyName];
|
|
81
|
-
}
|
|
82
|
-
return undefined
|
|
83
|
-
}, buffer =
|
|
84
|
-
"/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"
|
|
85
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"preset") : depth0),{"name":"if","hash":{},"fn":container.program(1, data, 0),"inverse":container.program(3, data, 0),"data":data,"loc":{"start":{"line":3,"column":0},"end":{"line":153,"column":7}}})) != null ? stack1 : "");
|
|
86
|
-
stack1 = ((helper = (helper = lookupProperty(helpers,"hasTestsOutsideSource") || (depth0 != null ? lookupProperty(depth0,"hasTestsOutsideSource") : depth0)) != null ? helper : alias2),(options={"name":"hasTestsOutsideSource","hash":{},"fn":container.program(5, data, 0),"inverse":container.noop,"data":data,"loc":{"start":{"line":154,"column":4},"end":{"line":169,"column":30}}}),(typeof helper === alias3 ? helper.call(alias1,options) : helper));
|
|
87
|
-
if (!lookupProperty(helpers,"hasTestsOutsideSource")) { stack1 = container.hooks.blockHelperMissing.call(depth0,stack1,options)}
|
|
88
|
-
if (stack1 != null) { buffer += stack1; }
|
|
89
|
-
return buffer + " {\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: '"
|
|
90
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"sourceLocationRE") || (depth0 != null ? lookupProperty(depth0,"sourceLocationRE") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"sourceLocationRE","hash":{},"data":data,"loc":{"start":{"line":192,"column":15},"end":{"line":192,"column":35}}}) : helper)))
|
|
91
|
-
+ "',\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"
|
|
92
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"tsPreCompilationDeps") : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.program(9, data, 0),"data":data,"loc":{"start":{"line":285,"column":4},"end":{"line":289,"column":11}}})) != null ? stack1 : "")
|
|
93
|
-
+ "\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"
|
|
94
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"combinedDependencies") : depth0),{"name":"if","hash":{},"fn":container.program(11, data, 0),"inverse":container.program(13, data, 0),"data":data,"loc":{"start":{"line":295,"column":4},"end":{"line":299,"column":11}}})) != null ? stack1 : "")
|
|
95
|
-
+ "\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"
|
|
96
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"useTsConfig") : depth0),{"name":"if","hash":{},"fn":container.program(15, data, 0),"inverse":container.program(17, data, 0),"data":data,"loc":{"start":{"line":312,"column":4},"end":{"line":320,"column":11}}})) != null ? stack1 : "")
|
|
97
|
-
+ "\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"
|
|
98
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"useWebpackConfig") : depth0),{"name":"if","hash":{},"fn":container.program(19, data, 0),"inverse":container.program(21, data, 0),"data":data,"loc":{"start":{"line":332,"column":4},"end":{"line":344,"column":11}}})) != null ? stack1 : "")
|
|
99
|
-
+ "\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"
|
|
100
|
-
+ ((stack1 = lookupProperty(helpers,"if").call(alias1,(depth0 != null ? lookupProperty(depth0,"useBabelConfig") : depth0),{"name":"if","hash":{},"fn":container.program(23, data, 0),"inverse":container.program(25, data, 0),"data":data,"loc":{"start":{"line":352,"column":4},"end":{"line":360,"column":11}}})) != null ? stack1 : "")
|
|
101
|
-
+ "\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: '^(node_modules|packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+',\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@"
|
|
102
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"version") || (depth0 != null ? lookupProperty(depth0,"version") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"version","hash":{},"data":data,"loc":{"start":{"line":471,"column":33},"end":{"line":471,"column":44}}}) : helper)))
|
|
103
|
-
+ " on "
|
|
104
|
-
+ alias4(((helper = (helper = lookupProperty(helpers,"date") || (depth0 != null ? lookupProperty(depth0,"date") : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"date","hash":{},"data":data,"loc":{"start":{"line":471,"column":48},"end":{"line":471,"column":56}}}) : helper)))
|
|
105
|
-
+ "\n";
|
|
106
|
-
},"useData":true});
|
|
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:314,column:17},end:{line:314,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:334,column:17},end:{line:334,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:354,column:17},end:{line:354,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 /* 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:295,column:4},end:{line:299,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:312,column:4},end:{line:320,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:332,column:4},end:{line:344,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:352,column:4},end:{line:360,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: \'^(node_modules|packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+\',\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:471,column:33},end:{line:471,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:471,column:48},end:{line:471,column:56}}}):d)+"\n"},useData:!0});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const $defaults = require("../defaults
|
|
1
|
+
const $defaults = require("../defaults");
|
|
2
2
|
const normalizeInitOptions = require("./normalize-init-options");
|
|
3
3
|
const buildConfig = require("./build-config");
|
|
4
4
|
const writeConfig = require("./write-config");
|
|
@@ -68,7 +68,7 @@ function manifestIsUpdateable(pNormalizedInitConfig) {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
module.exports = (pInit) => {
|
|
71
|
-
/*
|
|
71
|
+
/* c8 ignore start */
|
|
72
72
|
if (pInit === true) {
|
|
73
73
|
getUserInput()
|
|
74
74
|
.then(normalizeInitOptions)
|
|
@@ -77,6 +77,7 @@ module.exports = (pInit) => {
|
|
|
77
77
|
.catch((pError) => {
|
|
78
78
|
process.stderr.write(`\n ERROR: ${pError.message}\n`);
|
|
79
79
|
});
|
|
80
|
+
/* c8 ignore stop */
|
|
80
81
|
} else {
|
|
81
82
|
const lNormalizedInitConfig = normalizeInitOptions(getOneshotConfig(pInit));
|
|
82
83
|
if (!fileExists($defaults.DEFAULT_CONFIG_FILE_NAME)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const _has = require("lodash/has");
|
|
2
|
-
const
|
|
2
|
+
const { version } = require("../../../src/meta.js");
|
|
3
3
|
const {
|
|
4
4
|
getSourceFolderCandidates,
|
|
5
5
|
getTestFolderCandidates,
|
|
@@ -14,7 +14,7 @@ const {
|
|
|
14
14
|
*/
|
|
15
15
|
function populate(pInitOptions) {
|
|
16
16
|
return {
|
|
17
|
-
version
|
|
17
|
+
version,
|
|
18
18
|
date: new Date().toJSON(),
|
|
19
19
|
configType: "self-contained",
|
|
20
20
|
...pInitOptions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const fs = require("fs");
|
|
2
2
|
const figures = require("figures");
|
|
3
3
|
const chalk = require("chalk");
|
|
4
|
-
const { DEFAULT_CONFIG_FILE_NAME } = require("../defaults
|
|
4
|
+
const { DEFAULT_CONFIG_FILE_NAME } = require("../defaults");
|
|
5
5
|
const { fileExists } = require("./environment-helpers");
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -30,11 +30,12 @@ module.exports = function writeConfig(
|
|
|
30
30
|
figures.tick
|
|
31
31
|
)} Successfully created '${pFileName}'\n\n`
|
|
32
32
|
);
|
|
33
|
+
/* c8 ignore start */
|
|
33
34
|
} catch (pError) {
|
|
34
|
-
/* istanbul ignore next */
|
|
35
35
|
throw new Error(
|
|
36
36
|
`ERROR: Writing to '${pFileName}' didn't work. ${pError}\n`
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
+
/* c8 ignore stop */
|
|
39
40
|
}
|
|
40
41
|
};
|
|
@@ -3,7 +3,7 @@ const fs = require("fs");
|
|
|
3
3
|
const figures = require("figures");
|
|
4
4
|
const chalk = require("chalk");
|
|
5
5
|
const wrapAndIndent = require("../../utl/wrap-and-indent");
|
|
6
|
-
const $defaults = require("../defaults
|
|
6
|
+
const $defaults = require("../defaults");
|
|
7
7
|
const { readManifest } = require("./environment-helpers");
|
|
8
8
|
const { folderNameArrayToRE } = require("./utl");
|
|
9
9
|
|
|
@@ -5,7 +5,7 @@ const _get = require("lodash/get");
|
|
|
5
5
|
const _has = require("lodash/has");
|
|
6
6
|
const _clone = require("lodash/clone");
|
|
7
7
|
const loadConfig = require("../config-utl/extract-depcruise-config");
|
|
8
|
-
const defaults = require("./defaults
|
|
8
|
+
const defaults = require("./defaults");
|
|
9
9
|
|
|
10
10
|
const KNOWN_DEPCRUISE_OPTIONS = [
|
|
11
11
|
"babelConfig",
|