dependency-cruiser 10.0.5 → 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.
Files changed (44) hide show
  1. package/bin/depcruise-fmt.js +3 -3
  2. package/bin/dependency-cruise.js +2 -2
  3. package/package.json +19 -19
  4. package/src/cli/defaults.js +15 -0
  5. package/src/cli/init-config/config.js.template.js +1 -106
  6. package/src/cli/init-config/index.js +1 -1
  7. package/src/cli/init-config/normalize-init-options.js +2 -2
  8. package/src/cli/init-config/write-config.js +1 -1
  9. package/src/cli/init-config/write-run-scripts-to-manifest.js +1 -1
  10. package/src/cli/normalize-options.js +1 -1
  11. package/src/cli/validate-node-environment.js +3 -3
  12. package/src/config-utl/extract-babel-config.js +2 -2
  13. package/src/config-utl/extract-ts-config.js +2 -5
  14. package/src/extract/ast-extractors/extract-typescript-deps.js +2 -5
  15. package/src/extract/ast-extractors/swc-dependency-visitor.js +3 -4
  16. package/src/extract/parse/to-swc-ast.js +3 -4
  17. package/src/extract/parse/to-typescript-ast.js +3 -4
  18. package/src/extract/transpile/babel-wrap.js +2 -2
  19. package/src/extract/transpile/coffeescript-wrap.js +3 -3
  20. package/src/extract/transpile/livescript-wrap.js +3 -4
  21. package/src/extract/transpile/meta.js +1 -1
  22. package/src/extract/transpile/svelte-wrap.js +3 -1
  23. package/src/extract/transpile/typescript-wrap.js +3 -4
  24. package/src/extract/transpile/vue-template-wrap.js +3 -1
  25. package/src/main/index.js +1 -1
  26. package/src/main/options/defaults.js +10 -0
  27. package/src/main/options/normalize.js +1 -1
  28. package/src/main/rule-set/validate.js +1 -1
  29. package/src/meta.js +18 -0
  30. package/src/report/dot/default-theme.js +145 -0
  31. package/src/report/dot/dot.template.js +1 -199
  32. package/src/report/dot/theming.js +1 -1
  33. package/src/report/error-html/error-html.template.js +1 -132
  34. package/src/report/error-html/utl.js +1 -1
  35. package/src/report/html/html.template.js +1 -118
  36. package/src/schema/README.md +2 -2
  37. package/src/schema/configuration.schema.js +441 -0
  38. package/src/schema/cruise-result.schema.js +595 -0
  39. package/src/cli/defaults.json +0 -15
  40. package/src/main/options/defaults.json +0 -10
  41. package/src/report/dot/default-theme.json +0 -145
  42. package/src/schema/configuration.schema.json +0 -697
  43. package/src/schema/cruise-result.schema.json +0 -988
  44. package/types/README.md +0 -1
@@ -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 $package = require("../package.json");
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($package.version)
54
+ .version(version)
55
55
  .arguments("<dependency-cruiser-json>")
56
56
  .parse(process.argv);
57
57
 
@@ -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 $package = require("../package.json");
12
+ const { version } = require("../src/meta.js");
13
13
  const cli = require("../src/cli");
14
14
 
15
15
  program
@@ -88,7 +88,7 @@ try {
88
88
  "-i, --info",
89
89
  "shows what languages and extensions dependency-cruiser supports"
90
90
  )
91
- .version($package.version)
91
+ .version(version)
92
92
  .arguments("[files-or-directories]")
93
93
  .parse(process.argv);
94
94
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "10.0.5",
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 dev-build",
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/**/*.{js,json} configs/**/*.js tools/**/*.mjs bin/* !**/*.template.js types/*.d.ts test/**/*.{spec,utl}.js",
93
- "lint:prettier:check": "prettier --loglevel warn --check src/**/*.{js,json} configs/**/*.js tools/**/*.mjs bin/* !**/*.template.js types/*.d.ts test/**/*.{spec,utl}.js",
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,7 +107,7 @@
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": "mocha --timeout 4000 \"test/**/*.spec.{js,mjs,cjs}\"",
110
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",
@@ -131,7 +132,7 @@
131
132
  "acorn-jsx-walk": "2.0.0",
132
133
  "acorn-loose": "8.1.0",
133
134
  "acorn-walk": "8.1.1",
134
- "ajv": "8.6.1",
135
+ "ajv": "8.6.2",
135
136
  "chalk": "4.1.1",
136
137
  "commander": "8.0.0",
137
138
  "enhanced-resolve": "5.8.2",
@@ -140,7 +141,7 @@
140
141
  "glob": "7.1.7",
141
142
  "handlebars": "4.7.7",
142
143
  "indent-string": "4.0.0",
143
- "inquirer": "8.1.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,17 +152,17 @@
151
152
  "wrap-ansi": "7.0.0"
152
153
  },
153
154
  "devDependencies": {
154
- "@babel/core": "7.14.6",
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.63",
158
- "@typescript-eslint/eslint-plugin": "4.28.2",
159
- "@typescript-eslint/parser": "4.28.2",
158
+ "@swc/core": "1.2.66",
159
+ "@typescript-eslint/eslint-plugin": "4.28.4",
160
+ "@typescript-eslint/parser": "4.28.4",
160
161
  "c8": "7.7.3",
161
162
  "chai": "4.3.4",
162
163
  "chai-json-schema": "1.5.1",
163
164
  "coffeescript": "2.5.1",
164
- "eslint": "7.30.0",
165
+ "eslint": "7.31.0",
165
166
  "eslint-config-moving-meadow": "2.0.9",
166
167
  "eslint-config-prettier": "8.3.0",
167
168
  "eslint-plugin-budapestian": "2.3.0",
@@ -172,13 +173,13 @@
172
173
  "eslint-plugin-unicorn": "34.0.1",
173
174
  "husky": "4.3.0",
174
175
  "intercept-stdout": "0.1.2",
175
- "lint-staged": "11.0.0",
176
+ "lint-staged": "11.1.1",
176
177
  "mocha": "9.0.2",
177
- "normalize-newline": "3.0.0",
178
+ "normalize-newline": "4.1.0",
178
179
  "npm-run-all": "4.1.5",
179
180
  "prettier": "2.2.1",
180
181
  "shx": "0.3.3",
181
- "svelte": "3.38.3",
182
+ "svelte": "3.40.2",
182
183
  "symlink-dir": "5.0.1",
183
184
  "typescript": "4.3.5",
184
185
  "upem": "6.0.0",
@@ -199,10 +200,6 @@
199
200
  "package": "indent-string",
200
201
  "because": "version 5 only exports ejs - and we use cjs and don't transpile"
201
202
  },
202
- {
203
- "package": "normalize-newline",
204
- "because": "version 4 only exports ejs - and we use cjs and don't transpile"
205
- },
206
203
  {
207
204
  "package": "prettier",
208
205
  "because": "version 2.3.0 gives different results between local (macOS) and the ci (linux)"
@@ -217,11 +214,14 @@
217
214
  "node_modules",
218
215
  "coverage",
219
216
  "tmp",
217
+ "src/**/*.schema.js",
220
218
  "src/**/*.template.js",
221
219
  "src/cli/tools/svg-in-html-snippets/script.snippet.js",
222
220
  "test/integration/**",
223
221
  "test/*/fixtures/**",
224
222
  "test/*/*/fixtures/**",
223
+ "test/*/mocks/**",
224
+ "test/*/*/mocks/**",
225
225
  "types/**"
226
226
  ],
227
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
+ };
@@ -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.json");
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");
@@ -1,5 +1,5 @@
1
1
  const _has = require("lodash/has");
2
- const $dependencyCruiserManifest = require("../../../package.json");
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: $dependencyCruiserManifest.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.json");
4
+ const { DEFAULT_CONFIG_FILE_NAME } = require("../defaults");
5
5
  const { fileExists } = require("./environment-helpers");
6
6
 
7
7
  /**
@@ -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.json");
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.json");
8
+ const defaults = require("./defaults");
9
9
 
10
10
  const KNOWN_DEPCRUISE_OPTIONS = [
11
11
  "babelConfig",
@@ -1,5 +1,5 @@
1
1
  const semver = require("semver");
2
- const $package = require("../../package.json");
2
+ const { engines } = require("../../src/meta.js");
3
3
 
4
4
  module.exports = function validateNodeEnvironment(pNodeVersion) {
5
5
  // not using default parameter here because the check should run
@@ -7,12 +7,12 @@ module.exports = function validateNodeEnvironment(pNodeVersion) {
7
7
  const lNodeVersion = pNodeVersion || process.versions.node;
8
8
  const VERSION_ERR = `\nERROR: Your node version (${lNodeVersion}) is not supported. dependency-cruiser
9
9
  follows the node.js release cycle and runs on these node versions:
10
- ${$package.engines.node}
10
+ ${engines.node}
11
11
  See https://nodejs.org/en/about/releases/ for details.
12
12
 
13
13
  `;
14
14
 
15
- if (!semver.satisfies(lNodeVersion, $package.engines.node)) {
15
+ if (!semver.satisfies(lNodeVersion, engines.node)) {
16
16
  throw new Error(VERSION_ERR);
17
17
  }
18
18
  };
@@ -7,7 +7,7 @@ const json5 = require("json5");
7
7
  const _get = require("lodash/get");
8
8
  const _has = require("lodash/has");
9
9
  const tryRequire = require("semver-try-require");
10
- const $package = require("../../package.json");
10
+ const { supportedTranspilers } = require("../../src/meta.js");
11
11
  const makeAbsolute = require("./make-absolute");
12
12
 
13
13
  function getCommonJSConfig(pBabelConfigFileName) {
@@ -87,7 +87,7 @@ function getConfig(pBabelConfigFileName) {
87
87
  */
88
88
  module.exports = function extractBabelConfig(pBabelConfigFileName) {
89
89
  let lReturnValue = {};
90
- const babel = tryRequire("@babel/core", $package.supportedTranspilers.babel);
90
+ const babel = tryRequire("@babel/core", supportedTranspilers.babel);
91
91
 
92
92
  if (babel) {
93
93
  const lConfig = {
@@ -1,12 +1,9 @@
1
1
  const path = require("path");
2
2
  const tryRequire = require("semver-try-require");
3
3
  const _get = require("lodash/get");
4
- const $package = require("../../package.json");
4
+ const { supportedTranspilers } = require("../../src/meta.js");
5
5
 
6
- const typescript = tryRequire(
7
- "typescript",
8
- _get($package, "supportedTranspilers.typescript", null)
9
- );
6
+ const typescript = tryRequire("typescript", supportedTranspilers.typescript);
10
7
 
11
8
  const FORMAT_DIAGNOSTICS_HOST = {
12
9
  getCanonicalFileName(pFileName) {
@@ -1,11 +1,8 @@
1
1
  /* eslint-disable valid-jsdoc, no-inline-comments */
2
2
  const tryRequire = require("semver-try-require");
3
- const $package = require("../../../package.json");
3
+ const { supportedTranspilers } = require("../../../src/meta.js");
4
4
 
5
- const typescript = tryRequire(
6
- "typescript",
7
- $package.supportedTranspilers.typescript
8
- );
5
+ const typescript = tryRequire("typescript", supportedTranspilers.typescript);
9
6
 
10
7
  /*
11
8
  * Both extractImport* assume the imports/ exports can only occur at
@@ -1,9 +1,8 @@
1
1
  const tryRequire = require("semver-try-require");
2
+ const { supportedTranspilers } = require("../../../src/meta.js");
3
+
2
4
  /** @type {import('@swc/core/Visitor')} */
3
- const VisitorModule = tryRequire(
4
- "@swc/core/Visitor",
5
- require("../../../package.json").supportedTranspilers.swc
6
- );
5
+ const VisitorModule = tryRequire("@swc/core/Visitor", supportedTranspilers.swc);
7
6
 
8
7
  const Visitor = VisitorModule.default;
9
8
 
@@ -1,10 +1,9 @@
1
1
  const tryRequire = require("semver-try-require");
2
2
  const _memoize = require("lodash/memoize");
3
+ const { supportedTranspilers } = require("../../../src/meta.js");
4
+
3
5
  /** @type {import('@swc/core')} */
4
- const swc = tryRequire(
5
- "@swc/core",
6
- require("../../../package.json").supportedTranspilers.swc
7
- );
6
+ const swc = tryRequire("@swc/core", supportedTranspilers.swc);
8
7
 
9
8
  const SWC_PARSE_OPTIONS = {
10
9
  dynamicImport: true,
@@ -1,10 +1,9 @@
1
1
  const fs = require("fs");
2
2
  const tryRequire = require("semver-try-require");
3
3
  const _memoize = require("lodash/memoize");
4
- const typescript = tryRequire(
5
- "typescript",
6
- require("../../../package.json").supportedTranspilers.typescript
7
- );
4
+ const { supportedTranspilers } = require("../../../src/meta.js");
5
+
6
+ const typescript = tryRequire("typescript", supportedTranspilers.typescript);
8
7
 
9
8
  /**
10
9
  * Compiles pTypescriptSource into a (typescript) AST
@@ -1,7 +1,7 @@
1
1
  const tryRequire = require("semver-try-require");
2
- const $package = require("../../../package.json");
2
+ const { supportedTranspilers } = require("../../../src/meta.js");
3
3
 
4
- const babel = tryRequire("@babel/core", $package.supportedTranspilers.babel);
4
+ const babel = tryRequire("@babel/core", supportedTranspilers.babel);
5
5
 
6
6
  module.exports = {
7
7
  isAvailable: () => babel !== false,
@@ -1,5 +1,5 @@
1
1
  const tryRequire = require("semver-try-require");
2
- const $package = require("../../../package.json");
2
+ const { supportedTranspilers } = require("../../../src/meta.js");
3
3
 
4
4
  /*
5
5
  * coffeescript's npm repo was renamed from coffee-script to coffeescript
@@ -9,14 +9,14 @@ const $package = require("../../../package.json");
9
9
  function getCoffeeScriptModule() {
10
10
  let lReturnValue = tryRequire(
11
11
  "coffeescript",
12
- $package.supportedTranspilers.coffeescript
12
+ supportedTranspilers.coffeescript
13
13
  );
14
14
 
15
15
  /* c8 ignore start */
16
16
  if (lReturnValue === false) {
17
17
  lReturnValue = tryRequire(
18
18
  "coffee-script",
19
- $package.supportedTranspilers["coffee-script"]
19
+ supportedTranspilers["coffee-script"]
20
20
  );
21
21
  }
22
22
  /* c8 ignore stop */
@@ -1,8 +1,7 @@
1
1
  const tryRequire = require("semver-try-require");
2
- const livescript = tryRequire(
3
- "livescript",
4
- require("../../../package.json").supportedTranspilers.livescript
5
- );
2
+ const { supportedTranspilers } = require("../../../src/meta.js");
3
+
4
+ const livescript = tryRequire("livescript", supportedTranspilers.livescript);
6
5
 
7
6
  /* c8 ignore start */
8
7
  module.exports = {