dependency-cruiser 11.6.0 → 11.7.1
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/configs/rules/no-duplicate-dependency-types.js +4 -0
- package/package.json +20 -18
- package/src/cli/format.js +6 -0
- package/src/cli/init-config/config.js.template.js +1 -1
- package/src/enrich/index.js +13 -0
- package/src/extract/ast-extractors/swc-dependency-visitor.js +4 -0
- package/src/extract/gather-initial-sources.js +1 -1
- package/src/extract/get-dependencies.js +14 -7
- package/src/extract/index.js +10 -0
- package/src/extract/parse/to-javascript-ast.js +8 -2
- package/src/extract/parse/to-swc-ast.js +2 -0
- package/src/extract/parse/to-typescript-ast.js +1 -0
- package/src/extract/resolve/determine-dependency-types.js +25 -2
- package/src/extract/resolve/index.js +11 -16
- package/src/extract/transpile/meta.d.ts +22 -0
- package/src/extract/transpile/meta.js +1 -1
- package/src/extract/utl/path-to-posix.js +2 -2
- package/src/graph-utl/consolidate-module-dependencies.js +2 -2
- package/src/graph-utl/rule-set.js +12 -7
- package/src/main/files-and-dirs/normalize.js +10 -1
- package/src/main/options/defaults.js +2 -1
- package/src/main/options/normalize.js +22 -6
- package/src/main/options/validate.js +13 -2
- package/src/main/report-wrap.js +6 -1
- package/src/main/resolve-options/normalize.js +16 -2
- package/src/main/rule-set/normalize.js +6 -6
- package/src/main/rule-set/validate.js +5 -1
- package/src/main/utl/normalize-re-properties.js +8 -6
- package/src/meta.js +1 -1
- package/src/report/anon/anonymize-path.js +1 -1
- package/src/report/anon/index.js +67 -10
- package/src/report/csv.js +3 -3
- package/src/report/dot/index.js +1 -7
- package/src/report/error-html/index.js +2 -2
- package/src/report/error.js +2 -2
- package/src/report/html/index.js +6 -8
- package/src/report/identity.js +2 -3
- package/src/report/index.js +2 -2
- package/src/report/json.js +2 -3
- package/src/report/metrics.js +0 -4
- package/src/report/teamcity.js +2 -3
- package/src/report/text.js +2 -6
- package/src/schema/configuration.schema.js +1 -1
- package/src/schema/cruise-result.schema.js +1 -1
- package/src/utl/array-util.js +2 -1
- package/src/utl/regex-util.js +7 -3
- package/src/validate/index.d.ts +60 -0
- package/src/validate/index.js +11 -22
- package/src/validate/match-dependency-rule.js +15 -3
- package/src/validate/match-folder-dependency-rule.js +38 -14
- package/src/validate/match-module-rule.js +62 -10
- package/src/validate/matchers.js +50 -10
- package/src/validate/rule-classifiers.js +3 -3
- package/types/cruise-result.d.ts +42 -33
- package/types/dependency-cruiser.d.ts +4 -2
- package/types/resolve-options.d.ts +15 -1
- package/types/restrictions.d.ts +24 -7
- package/types/rule-set.d.ts +5 -0
|
@@ -11,5 +11,9 @@ module.exports = {
|
|
|
11
11
|
from: {},
|
|
12
12
|
to: {
|
|
13
13
|
moreThanOneDependencyType: true,
|
|
14
|
+
// as it's pretty common to have a type import be a type only import
|
|
15
|
+
// _and_ (e.g.) a devDependency - don't consider type-only dependency
|
|
16
|
+
// types for this rule
|
|
17
|
+
dependencyTypesNot: ["type-only"],
|
|
14
18
|
},
|
|
15
19
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.7.1",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"lint:prettier": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
|
|
99
99
|
"lint:prettier:fix": "prettier --loglevel warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
|
|
100
100
|
"lint:types": "npm-run-all lint:types:tsc lint:types:lint",
|
|
101
|
-
"lint:types:tsc": "tsc --
|
|
101
|
+
"lint:types:tsc": "tsc --project types/tsconfig.json",
|
|
102
102
|
"lint:types:lint": "eslint --no-ignore --config types/.eslintrc.json types/*.d.ts",
|
|
103
103
|
"lint:types:fix": "eslint --no-ignore --config types/.eslintrc.json --fix types/*.d.ts",
|
|
104
104
|
"scm:push": "run-p --aggregate-output scm:push:*",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"version": "npm-run-all build depcruise:graph:doc scm:stage"
|
|
136
136
|
},
|
|
137
137
|
"dependencies": {
|
|
138
|
-
"acorn": "8.7.
|
|
138
|
+
"acorn": "8.7.1",
|
|
139
139
|
"acorn-jsx": "5.3.2",
|
|
140
140
|
"acorn-jsx-walk": "2.0.0",
|
|
141
141
|
"acorn-loose": "8.3.0",
|
|
@@ -149,49 +149,51 @@
|
|
|
149
149
|
"glob": "7.2.0",
|
|
150
150
|
"handlebars": "4.7.7",
|
|
151
151
|
"indent-string": "^4.0.0",
|
|
152
|
-
"inquirer": "8.2.
|
|
152
|
+
"inquirer": "8.2.4",
|
|
153
153
|
"json5": "2.2.1",
|
|
154
154
|
"lodash": "4.17.21",
|
|
155
155
|
"safe-regex": "2.1.1",
|
|
156
156
|
"semver": "^7.3.7",
|
|
157
157
|
"semver-try-require": "^5.0.2",
|
|
158
|
-
"teamcity-service-messages": "0.1.
|
|
158
|
+
"teamcity-service-messages": "0.1.14",
|
|
159
159
|
"tsconfig-paths-webpack-plugin": "3.5.2",
|
|
160
160
|
"wrap-ansi": "^7.0.0"
|
|
161
161
|
},
|
|
162
162
|
"devDependencies": {
|
|
163
|
-
"@babel/core": "7.17.
|
|
163
|
+
"@babel/core": "7.17.10",
|
|
164
164
|
"@babel/plugin-transform-modules-commonjs": "7.17.9",
|
|
165
165
|
"@babel/preset-typescript": "7.16.7",
|
|
166
|
-
"@swc/core": "1.2.
|
|
167
|
-
"@
|
|
168
|
-
"@
|
|
166
|
+
"@swc/core": "1.2.183",
|
|
167
|
+
"@types/lodash": "4.14.182",
|
|
168
|
+
"@types/node": "17.0.33",
|
|
169
|
+
"@typescript-eslint/eslint-plugin": "5.23.0",
|
|
170
|
+
"@typescript-eslint/parser": "5.23.0",
|
|
169
171
|
"@vue/compiler-sfc": "3.2.33",
|
|
170
|
-
"c8": "7.11.
|
|
172
|
+
"c8": "7.11.2",
|
|
171
173
|
"chai": "4.3.6",
|
|
172
174
|
"chai-json-schema": "1.5.1",
|
|
173
|
-
"coffeescript": "2.
|
|
174
|
-
"eslint": "^8.
|
|
175
|
+
"coffeescript": "2.7.0",
|
|
176
|
+
"eslint": "^8.15.0",
|
|
175
177
|
"eslint-config-moving-meadow": "3.0.0",
|
|
176
178
|
"eslint-config-prettier": "8.5.0",
|
|
177
|
-
"eslint-plugin-budapestian": "3.0.
|
|
179
|
+
"eslint-plugin-budapestian": "3.0.2",
|
|
178
180
|
"eslint-plugin-import": "2.26.0",
|
|
179
181
|
"eslint-plugin-mocha": "^9.0.0",
|
|
180
182
|
"eslint-plugin-node": "11.1.0",
|
|
181
|
-
"eslint-plugin-security": "1.
|
|
183
|
+
"eslint-plugin-security": "1.5.0",
|
|
182
184
|
"eslint-plugin-unicorn": "^42.0.0",
|
|
183
185
|
"husky": "^4.3.8",
|
|
184
186
|
"intercept-stdout": "0.1.2",
|
|
185
187
|
"lint-staged": "12.3.4",
|
|
186
|
-
"mocha": "
|
|
188
|
+
"mocha": "10.0.0",
|
|
187
189
|
"normalize-newline": "^3.0.0",
|
|
188
190
|
"npm-run-all": "4.1.5",
|
|
189
191
|
"prettier": "2.6.2",
|
|
190
192
|
"proxyquire": "2.1.3",
|
|
191
193
|
"shx": "0.3.4",
|
|
192
|
-
"svelte": "3.
|
|
194
|
+
"svelte": "3.48.0",
|
|
193
195
|
"symlink-dir": "5.0.1",
|
|
194
|
-
"typescript": "4.6.
|
|
196
|
+
"typescript": "4.6.4",
|
|
195
197
|
"upem": "^7.0.0",
|
|
196
198
|
"vue-template-compiler": "2.6.14",
|
|
197
199
|
"yarn": "1.22.18"
|
|
@@ -206,7 +208,7 @@
|
|
|
206
208
|
{
|
|
207
209
|
"package": "eslint-plugin-mocha",
|
|
208
210
|
"policy": "wanted",
|
|
209
|
-
"because": "version 10
|
|
211
|
+
"because": "version 10 bumps into https://github.com/lo1tuma/eslint-plugin-mocha/issues/322"
|
|
210
212
|
},
|
|
211
213
|
{
|
|
212
214
|
"package": "figures",
|
package/src/cli/format.js
CHANGED
|
@@ -15,6 +15,12 @@ const KNOWN_FMT_OPTIONS = [
|
|
|
15
15
|
"version",
|
|
16
16
|
];
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param {string} pResultFile the name of the file with cruise results
|
|
21
|
+
* @param {import("../../types/dependency-cruiser").IFormatOptions} pOptions
|
|
22
|
+
* @returns {Number} an exitCode
|
|
23
|
+
*/
|
|
18
24
|
module.exports = async (pResultFile, pOptions) => {
|
|
19
25
|
const lOptions = normalizeOptions(pOptions, KNOWN_FMT_OPTIONS);
|
|
20
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,o,t,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dotfiles (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likeley this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:162,column:18},end:{line:162,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:165,column:15},end:{line:165,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,o,t,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,o,t,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,o,t,s){return" combinedDependencies: true,\n"},13:function(e,n,o,t,s){return" // combinedDependencies: false,\n"},15:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:316,column:17},end:{line:316,column:29}}}):o)+"'\n },\n"},17:function(e,n,o,t,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},19:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:336,column:17},end:{line:336,column:34}}}):o)+"',\n // env: {},\n // args: {},\n },\n"},21:function(e,n,o,t,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n"},23:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:356,column:17},end:{line:356,column:32}}}):o)+"'\n },\n"},25:function(e,n,o,t,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},compiler:[8,">= 4.3.0"],main:function(e,n,o,t,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:152,column:7}}}))?h:""),d=null!=(d=c(o,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?d:r,u={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:153,column:4},end:{line:168,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=c(o,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,u))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(d=null!=(d=c(o,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?d:r)==a?d.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:191,column:15},end:{line:191,column:35}}}):d)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"depdency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules',\n dependencyTypes: [\n 'npm',\n 'npm-dev',\n 'npm-optional',\n 'npm-peer',\n 'npm-bundled',\n 'npm-no-pkg'\n ]\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:284,column:4},end:{line:288,column:11}}}))?h:"")+' \n /* list of extensions (typically non-parseable) to scan. Empty by default. */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(o,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:297,column:4},end:{line:301,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:314,column:4},end:{line:322,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `args` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(19,s,0),inverse:e.program(21,s,0),data:s,loc:{start:{line:334,column:4},end:{line:346,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(23,s,0),inverse:e.program(25,s,0),data:s,loc:{start:{line:354,column:4},end:{line:362,column:11}}}))?h:"")+'\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you\'ve\n redeclared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don\'t have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as \'exports\' fields in package.json. Use\n [\'exports\'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: ["exports"],\n /* List of conditions to check for in the exports field. e.g. use [\'imports\']\n if you\'re only interested in exposed es6 modules, [\'require\'] for commonjs,\n or all conditions at once `([\'import\', \'require\', \'node\', \'default\']`)\n if anything goes for you. Only works when the \'exportsFields\' array is\n non-empty.\n\n If you have a \'conditionNames\' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: ["import", "require", "node", "default"]\n },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // }\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n }\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(d=null!=(d=c(o,"version")||(null!=n?c(n,"version"):n))?d:r)==a?d.call(i,{name:"version",hash:{},data:s,loc:{start:{line:473,column:33},end:{line:473,column:44}}}):d)+" on "+l(typeof(d=null!=(d=c(o,"date")||(null!=n?c(n,"date"):n))?d:r)==a?d.call(i,{name:"date",hash:{},data:s,loc:{start:{line:473,column:48},end:{line:473,column:56}}}):d)+"\n"},useData:!0});
|
|
1
|
+
var Handlebars=require("handlebars/runtime"),template=Handlebars.template,templates=Handlebars.templates=Handlebars.templates||{};templates["config.js.template.hbs"]=template({1:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" 'extends': '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:4,column:14},end:{line:4,column:24}}}):i)+"',\n /*\n the '"+c(typeof(i=null!=(i=e(o,"preset")||(null!=n?e(n,"preset"):n))?i:a)==l?i.call(r,{name:"preset",hash:{},data:s,loc:{start:{line:6,column:10},end:{line:6,column:20}}}):i)+"' preset\n contains these rules:\n no-circular - flags all circular dependencies\n no-orphans - flags orphan modules (except typescript .d.ts files)\n no-deprecated-core - flags dependencies on deprecated node 'core' modules\n no-deprecated-npm - flags dependencies on deprecated npm modules\n no-non-package-json - flags (npm) dependencies that don't occur in package.json\n not-to-unresolvable - flags dependencies that can't be resolved`\n no-duplicate-dep-types - flags dependencies that occur more than once in package.json\n\n If you need to, you can override these rules. E.g. to ignore the\n no-duplicate-dep-types rule, you can set its severity to \"ignore\" by\n adding this to the 'forbidden' section:\n {\n name: 'no-duplicate-dep-types',\n severity: 'ignore'\n }\n\n Also, by default, the preset does not follow any external modules (things in\n node_modules or in yarn's plug'n'play magic). If you want to have that\n differently, just override it the options.doNotFollow key.\n */\n forbidden: [\n"},3:function(e,n,o,t,s){return" forbidden: [\n /* rules from the 'recommended' preset: */\n {\n name: 'no-circular',\n severity: 'warn',\n comment:\n 'This dependency is part of a circular relationship. You might want to revise ' +\n 'your solution (i.e. use dependency inversion, make sure the modules have a single responsibility) ',\n from: {},\n to: {\n circular: true\n }\n },\n {\n name: 'no-orphans',\n comment:\n \"This is an orphan module - it's likely not used (anymore?). Either use it or \" +\n \"remove it. If it's logical this module is an orphan (i.e. it's a config file), \" +\n \"add an exception for it in your dependency-cruiser configuration. By default \" +\n \"this rule does not scrutinize dotfiles (e.g. .eslintrc.js), TypeScript declaration \" +\n \"files (.d.ts), tsconfig.json and some of the babel and webpack configs.\",\n severity: 'warn',\n from: {\n orphan: true,\n pathNot: [\n '(^|/)\\\\.[^/]+\\\\.(js|cjs|mjs|ts|json)$', // dot files\n '\\\\.d\\\\.ts$', // TypeScript declaration files\n '(^|/)tsconfig\\\\.json$', // TypeScript config\n '(^|/)(babel|webpack)\\\\.config\\\\.(js|cjs|mjs|ts|json)$' // other configs\n ]\n },\n to: {},\n },\n {\n name: 'no-deprecated-core',\n comment:\n 'A module depends on a node core module that has been deprecated. Find an alternative - these are ' +\n \"bound to exist - node doesn't deprecate lightly.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'core'\n ],\n path: [\n '^(v8\\/tools\\/codemap)$',\n '^(v8\\/tools\\/consarray)$',\n '^(v8\\/tools\\/csvparser)$',\n '^(v8\\/tools\\/logreader)$',\n '^(v8\\/tools\\/profile_view)$',\n '^(v8\\/tools\\/profile)$',\n '^(v8\\/tools\\/SourceMap)$',\n '^(v8\\/tools\\/splaytree)$',\n '^(v8\\/tools\\/tickprocessor-driver)$',\n '^(v8\\/tools\\/tickprocessor)$',\n '^(node-inspect\\/lib\\/_inspect)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_client)$',\n '^(node-inspect\\/lib\\/internal\\/inspect_repl)$',\n '^(async_hooks)$',\n '^(punycode)$',\n '^(domain)$',\n '^(constants)$',\n '^(sys)$',\n '^(_linklist)$',\n '^(_stream_wrap)$'\n ],\n }\n },\n {\n name: 'not-to-deprecated',\n comment:\n 'This module uses a (version of an) npm module that has been deprecated. Either upgrade to a later ' +\n 'version of that module, or find an alternative. Deprecated modules are a security risk.',\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'deprecated'\n ]\n }\n },\n {\n name: 'no-non-package-json',\n severity: 'error',\n comment:\n \"This module depends on an npm package that isn't in the 'dependencies' section of your package.json. \" +\n \"That's problematic as the package either (1) won't be available on live (2 - worse) will be \" +\n \"available on live with an non-guaranteed version. Fix it by adding the package to the dependencies \" +\n \"in your package.json.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-no-pkg',\n 'npm-unknown'\n ]\n }\n },\n {\n name: 'not-to-unresolvable',\n comment:\n \"This module depends on a module that cannot be found ('resolved to disk'). If it's an npm \" +\n 'module: add it to your package.json. In all other cases you likely already know what to do.',\n severity: 'error',\n from: {},\n to: {\n couldNotResolve: true\n }\n },\n {\n name: 'no-duplicate-dep-types',\n comment:\n \"Likeley this module depends on an external ('npm') package that occurs more than once \" +\n \"in your package.json i.e. bot as a devDependencies and in dependencies. This will cause \" +\n \"maintenance problems later on.\",\n severity: 'warn',\n from: {},\n to: {\n moreThanOneDependencyType: true,\n // as it's pretty common to have a type import be a type only import \n // _and_ (e.g.) a devDependency - don't consider type-only dependency\n // types for this rule\n dependencyTypesNot: [\"type-only\"]\n }\n },\n\n /* rules you might want to tweak for your specific situation: */\n"},5:function(e,n,o,t,s){var i,r=null!=n?n:e.nullContext||{},a=e.hooks.helperMissing,l="function",c=e.escapeExpression,e=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" {\n name: 'not-to-test',\n comment:\n \"This module depends on code within a folder that should only contain tests. As tests don't \" +\n \"implement functionality this is odd. Either you're writing a test outside the test folder \" +\n \"or there's something in the test folder that isn't a test.\",\n severity: 'error',\n from: {\n pathNot: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:166,column:18},end:{line:166,column:36}}}):i)+"'\n },\n to: {\n path: '"+c(typeof(i=null!=(i=e(o,"testLocationRE")||(null!=n?e(n,"testLocationRE"):n))?i:a)==l?i.call(r,{name:"testLocationRE",hash:{},data:s,loc:{start:{line:169,column:15},end:{line:169,column:33}}}):i)+"'\n }\n },\n"},7:function(e,n,o,t,s){return" tsPreCompilationDeps: true,\n"},9:function(e,n,o,t,s){return" // tsPreCompilationDeps: false,\n"},11:function(e,n,o,t,s){return" combinedDependencies: true,\n"},13:function(e,n,o,t,s){return" // combinedDependencies: false,\n"},15:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"tsConfig")||(null!=n?i(n,"tsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"tsConfig",hash:{},data:s,loc:{start:{line:320,column:17},end:{line:320,column:29}}}):o)+"'\n },\n"},17:function(e,n,o,t,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},19:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:340,column:17},end:{line:340,column:34}}}):o)+"',\n // env: {},\n // args: {},\n },\n"},21:function(e,n,o,t,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n"},23:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:360,column:17},end:{line:360,column:32}}}):o)+"'\n },\n"},25:function(e,n,o,t,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},compiler:[8,">= 4.3.0"],main:function(e,n,o,t,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),d=null!=(d=c(o,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?d:r,u={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=c(o,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,u))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(d=null!=(d=c(o,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?d:r)==a?d.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):d)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"depdency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules',\n dependencyTypes: [\n 'npm',\n 'npm-dev',\n 'npm-optional',\n 'npm-peer',\n 'npm-bundled',\n 'npm-no-pkg'\n ]\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:288,column:4},end:{line:292,column:11}}}))?h:"")+' \n /* list of extensions (typically non-parseable) to scan. Empty by default. */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(o,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:301,column:4},end:{line:305,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:318,column:4},end:{line:326,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `args` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(19,s,0),inverse:e.program(21,s,0),data:s,loc:{start:{line:338,column:4},end:{line:350,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(23,s,0),inverse:e.program(25,s,0),data:s,loc:{start:{line:358,column:4},end:{line:366,column:11}}}))?h:"")+'\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you\'ve\n redeclared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don\'t have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as \'exports\' fields in package.json. Use\n [\'exports\'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: ["exports"],\n /* List of conditions to check for in the exports field. e.g. use [\'imports\']\n if you\'re only interested in exposed es6 modules, [\'require\'] for commonjs,\n or all conditions at once `([\'import\', \'require\', \'node\', \'default\']`)\n if anything goes for you. Only works when the \'exportsFields\' array is\n non-empty.\n\n If you have a \'conditionNames\' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: ["import", "require", "node", "default"]\n },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // }\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n }\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(d=null!=(d=c(o,"version")||(null!=n?c(n,"version"):n))?d:r)==a?d.call(i,{name:"version",hash:{},data:s,loc:{start:{line:477,column:33},end:{line:477,column:44}}}):d)+" on "+l(typeof(d=null!=(d=c(o,"date")||(null!=n?c(n,"date"):n))?d:r)==a?d.call(i,{name:"date",hash:{},data:s,loc:{start:{line:477,column:48},end:{line:477,column:56}}}):d)+"\n"},useData:!0});
|
package/src/enrich/index.js
CHANGED
|
@@ -3,6 +3,19 @@ const aggregateToFolders = require("./derive/folders");
|
|
|
3
3
|
const summarize = require("./summarize");
|
|
4
4
|
const clearCaches = require("./clear-caches");
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Enriches the passed modules with things like cycle detection, validations,
|
|
8
|
+
* metrics, folders and reachability & dependents analysis.
|
|
9
|
+
*
|
|
10
|
+
* Also adds a summary to the cruise result with common stats and the options
|
|
11
|
+
* used in the cruise, so consumers of the cruise result (reporters, depcruise-fmt,
|
|
12
|
+
* caching) can use that.
|
|
13
|
+
*
|
|
14
|
+
* @param {import("../../types/dependency-cruiser").IModule[]} pModules
|
|
15
|
+
* @param {import("../../types/dependency-cruiser").ICruiseOptions} pOptions
|
|
16
|
+
* @param {string[]} pFileAndDirectoryArray
|
|
17
|
+
* @returns {import("../../types/dependency-cruiser").ICruiseResult}
|
|
18
|
+
*/
|
|
6
19
|
module.exports = function enrich(pModules, pOptions, pFileAndDirectoryArray) {
|
|
7
20
|
clearCaches();
|
|
8
21
|
const lModules = enrichModules(pModules, pOptions);
|
|
@@ -148,7 +148,9 @@ if (VisitorModule) {
|
|
|
148
148
|
visitExportAllDeclration(pNode) {
|
|
149
149
|
this.pushImportExportSource(pNode);
|
|
150
150
|
/* c8 ignore start */
|
|
151
|
+
// @ts-ignore
|
|
151
152
|
if (super.visitExportAllDeclration) {
|
|
153
|
+
// @ts-ignore
|
|
152
154
|
return super.visitExportAllDeclration(pNode);
|
|
153
155
|
} else {
|
|
154
156
|
/* c8 ignore stop */
|
|
@@ -166,7 +168,9 @@ if (VisitorModule) {
|
|
|
166
168
|
visitExportNamedDeclration(pNode) {
|
|
167
169
|
this.pushImportExportSource(pNode);
|
|
168
170
|
/* c8 ignore start */
|
|
171
|
+
// @ts-ignore
|
|
169
172
|
if (super.visitExportNamedDeclration) {
|
|
173
|
+
// @ts-ignore
|
|
170
174
|
return super.visitExportNamedDeclration(pNode);
|
|
171
175
|
} else {
|
|
172
176
|
/* c8 ignore stop */
|
|
@@ -84,7 +84,7 @@ function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) {
|
|
|
84
84
|
*
|
|
85
85
|
* @param {string[]} pFileAndDirectoryArray globs and/ or paths to files or
|
|
86
86
|
* directories to be gathered
|
|
87
|
-
* @param {import('../../types/
|
|
87
|
+
* @param {import('../../types/dependency-cruiser').ICruiseOptions} pOptions options that
|
|
88
88
|
* influence what needs to be gathered/ scanned
|
|
89
89
|
* notably useful attributes:
|
|
90
90
|
* - exclude - regexp of what to exclude
|
|
@@ -108,13 +108,13 @@ function extractWithTsc(
|
|
|
108
108
|
|
|
109
109
|
/**
|
|
110
110
|
*
|
|
111
|
-
* @param {import('../../types/
|
|
111
|
+
* @param {import('../../types/dependency-cruiser').ICruiseOptions} pCruiseOptions
|
|
112
112
|
* @param {string} pFileName
|
|
113
113
|
* @param {any} pTranspileOptions
|
|
114
|
-
* @returns {
|
|
114
|
+
* @returns {import('../../types/cruise-result').IDependency[]}
|
|
115
115
|
*/
|
|
116
116
|
function extractDependencies(pCruiseOptions, pFileName, pTranspileOptions) {
|
|
117
|
-
/** @type
|
|
117
|
+
/** @type import('../../types/cruise-result').IDependency[] */
|
|
118
118
|
let lDependencies = [];
|
|
119
119
|
|
|
120
120
|
if (!pCruiseOptions.extraExtensionsToScan.includes(path.extname(pFileName))) {
|
|
@@ -179,8 +179,15 @@ function matchesPattern(pFullPathToFile, pPattern) {
|
|
|
179
179
|
return RegExp(pPattern, "g").test(pFullPathToFile);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
/**
|
|
183
|
+
*
|
|
184
|
+
* @param {import("../../types/dependency-cruiser").IDependency} pDependency
|
|
185
|
+
* @returns {string}
|
|
186
|
+
*/
|
|
182
187
|
function getDependencyUniqueKey(pDependency) {
|
|
183
|
-
return `${pDependency.module} ${pDependency.moduleSystem}
|
|
188
|
+
return `${pDependency.module} ${pDependency.moduleSystem} ${(
|
|
189
|
+
pDependency.dependencyTypes || []
|
|
190
|
+
).includes("type-only")}`;
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
function compareDeps(pLeft, pRight) {
|
|
@@ -201,9 +208,9 @@ function compareDeps(pLeft, pRight) {
|
|
|
201
208
|
*
|
|
202
209
|
*
|
|
203
210
|
* @param {string} pFileName path to the file
|
|
204
|
-
* @param {import("
|
|
205
|
-
* @param {import("../../types/
|
|
206
|
-
* @param {
|
|
211
|
+
* @param {import("../../types/dependency-cruiser").ICruiseOptions} pCruiseOptions cruise options
|
|
212
|
+
* @param {import("../../types/dependency-cruiser").IResolveOptions} pResolveOptions webpack 'enhanced-resolve' options
|
|
213
|
+
* @param {import("../../types/dependency-cruiser").ITranspileOptions} pTranspileOptions an object with tsconfig ('typescript project') options
|
|
207
214
|
* ('flattened' so there's no need for file access on any
|
|
208
215
|
* 'extends' option in there)
|
|
209
216
|
* @return {import("../../types/dependency-cruiser").IDependency[]} an array of dependency objects (see above)
|
package/src/extract/index.js
CHANGED
|
@@ -136,6 +136,16 @@ function filterExcludedDynamicDependencies(pModule, pExclude) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Recursively runs through the modules matching the pFileDirectoryArray and
|
|
141
|
+
* returns an array of all the modules it finds that way.
|
|
142
|
+
*
|
|
143
|
+
* @param {string[]} pFileDirectoryArray
|
|
144
|
+
* @param {import("../../types/dependency-cruiser").ICruiseOptions} pCruiseOptions
|
|
145
|
+
* @param {import("../../types/dependency-cruiser").IResolveOptions} pResolveOptions
|
|
146
|
+
* @param {import("../../types/dependency-cruiser").ITranspileOptions} pTranspileOptions
|
|
147
|
+
* @returns {Partial<import("../../types/dependency-cruiser").IModule[]>}
|
|
148
|
+
*/
|
|
139
149
|
module.exports = function extract(
|
|
140
150
|
pFileDirectoryArray,
|
|
141
151
|
pCruiseOptions,
|
|
@@ -7,6 +7,7 @@ const _memoize = require("lodash/memoize");
|
|
|
7
7
|
const transpile = require("../transpile");
|
|
8
8
|
const getExtension = require("../utl/get-extension");
|
|
9
9
|
|
|
10
|
+
/** @type acorn.Options */
|
|
10
11
|
const ACORN_OPTIONS = {
|
|
11
12
|
sourceType: "module",
|
|
12
13
|
ecmaVersion: 11,
|
|
@@ -33,6 +34,11 @@ function getASTFromSource(pFileRecord, pTranspileOptions) {
|
|
|
33
34
|
if (needsJSXTreatment(pFileRecord, pTranspileOptions)) {
|
|
34
35
|
return acornJsxParser.parse(lJavaScriptSource, {
|
|
35
36
|
...ACORN_OPTIONS,
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
// acornJsxParser.parse takes an acorn.Options which doesn't include
|
|
39
|
+
// allowNamespacedObjects. acornJsx.Options doesn't include sourceType
|
|
40
|
+
// though, so a bit rock < this code > hard place hence ignore it
|
|
41
|
+
// type wise
|
|
36
42
|
allowNamespacedObjects: true,
|
|
37
43
|
});
|
|
38
44
|
}
|
|
@@ -55,7 +61,7 @@ function getASTFromSource(pFileRecord, pTranspileOptions) {
|
|
|
55
61
|
* @param {string} pFileName path to the file to be parsed
|
|
56
62
|
* @param {any} pTranspileOptions options for the transpiler(s) - a tsconfig or
|
|
57
63
|
* a babel config
|
|
58
|
-
* @returns {
|
|
64
|
+
* @returns {acorn.Node} the abstract syntax tree
|
|
59
65
|
*/
|
|
60
66
|
function getAST(pFileName, pTranspileOptions) {
|
|
61
67
|
return getASTFromSource(
|
|
@@ -87,7 +93,7 @@ module.exports = {
|
|
|
87
93
|
*
|
|
88
94
|
* @param {string} pFileName - the name of the file to compile
|
|
89
95
|
* @param {any} pTranspileOptions - options for the transpiler(s) - typically a tsconfig or a babel config
|
|
90
|
-
* @return {
|
|
96
|
+
* @return {acorn.Node} - a (javascript) AST
|
|
91
97
|
*/
|
|
92
98
|
getASTCached,
|
|
93
99
|
|
|
@@ -22,6 +22,7 @@ function getASTFromSource(pSource) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
function getAST(pFileName) {
|
|
25
|
+
/** @type {import('@swc/core')} swc */
|
|
25
26
|
return swc.parseFileSync(pFileName, SWC_PARSE_OPTIONS);
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -38,6 +39,7 @@ module.exports = {
|
|
|
38
39
|
* @return {boolean} - true if the swc compiler is available,
|
|
39
40
|
* false in all other cases
|
|
40
41
|
*/
|
|
42
|
+
// @ts-ignore
|
|
41
43
|
isAvailable: () => swc !== false,
|
|
42
44
|
|
|
43
45
|
/**
|
|
@@ -47,6 +47,7 @@ function determineManifestDependencyTypes(
|
|
|
47
47
|
pPackageDependencies,
|
|
48
48
|
pResolverModulePaths
|
|
49
49
|
) {
|
|
50
|
+
/** @type {import("../../../types/shared-types").DependencyType[]} */
|
|
50
51
|
let lReturnValue = ["npm-unknown"];
|
|
51
52
|
|
|
52
53
|
if (Boolean(pPackageDependencies)) {
|
|
@@ -90,12 +91,21 @@ function dependencyIsBundled(pModule, pPackageDeps) {
|
|
|
90
91
|
return lReturnValue;
|
|
91
92
|
}
|
|
92
93
|
|
|
94
|
+
/**
|
|
95
|
+
*
|
|
96
|
+
* @param {string} pModuleName
|
|
97
|
+
* @param {string} pPackageDeps
|
|
98
|
+
* @param {string} pFileDirectory
|
|
99
|
+
* @param {import("../../../types/dependency-cruiser").IResolveOptions} pResolveOptions
|
|
100
|
+
* @returns {import("../../../types/shared-types").DependencyType[]}
|
|
101
|
+
*/
|
|
93
102
|
function determineNodeModuleDependencyTypes(
|
|
94
103
|
pModuleName,
|
|
95
104
|
pPackageDeps,
|
|
96
105
|
pFileDirectory,
|
|
97
106
|
pResolveOptions
|
|
98
107
|
) {
|
|
108
|
+
/** @type {import("../../../types/shared-types").DependencyType[]} */
|
|
99
109
|
let lReturnValue = determineManifestDependencyTypes(
|
|
100
110
|
externalModuleHelpers.getPackageRoot(pModuleName),
|
|
101
111
|
pPackageDeps,
|
|
@@ -117,17 +127,30 @@ function determineNodeModuleDependencyTypes(
|
|
|
117
127
|
return lReturnValue;
|
|
118
128
|
}
|
|
119
129
|
|
|
130
|
+
/**
|
|
131
|
+
*
|
|
132
|
+
* @param {import("../../../types/cruise-result").IDependency} pDependency
|
|
133
|
+
* @param {string} pModuleName
|
|
134
|
+
* @param {any} pPackageDeps
|
|
135
|
+
* @param {string} pFileDirectory
|
|
136
|
+
* @param {import("../../../types/dependency-cruiser").IResolveOptions} pResolveOptions
|
|
137
|
+
* @param {string} pBaseDirectory
|
|
138
|
+
* @returns {import("../../../types/shared-types").DependencyType[]}
|
|
139
|
+
*/
|
|
120
140
|
function determineExternalModuleDependencyTypes(
|
|
121
|
-
|
|
141
|
+
pDependency,
|
|
122
142
|
pModuleName,
|
|
123
143
|
pPackageDeps,
|
|
124
144
|
pFileDirectory,
|
|
125
145
|
pResolveOptions,
|
|
126
146
|
pBaseDirectory
|
|
127
147
|
) {
|
|
148
|
+
/** @type {import("../../../types/shared-types").DependencyType[]} */
|
|
128
149
|
let lReturnValue = [];
|
|
129
150
|
|
|
130
|
-
if (
|
|
151
|
+
if (
|
|
152
|
+
isExternalModule(pDependency.resolved, ["node_modules"], pBaseDirectory)
|
|
153
|
+
) {
|
|
131
154
|
lReturnValue = determineNodeModuleDependencyTypes(
|
|
132
155
|
pModuleName,
|
|
133
156
|
pPackageDeps,
|
|
@@ -10,6 +10,14 @@ const resolveHelpers = require("./resolve-helpers");
|
|
|
10
10
|
const determineDependencyTypes = require("./determine-dependency-types");
|
|
11
11
|
const getManifest = require("./get-manifest");
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {import("../../../types/dependency-cruiser").IModule} pModule
|
|
16
|
+
* @param {string} pBaseDirectory
|
|
17
|
+
* @param {string} pFileDirectory
|
|
18
|
+
* @param {import("../../../types/dependency-cruiser").IResolveOptions} pResolveOptions
|
|
19
|
+
* @returns {any}
|
|
20
|
+
*/
|
|
13
21
|
function resolveModule(
|
|
14
22
|
pModule,
|
|
15
23
|
pBaseDirectory,
|
|
@@ -33,8 +41,7 @@ function resolveModule(
|
|
|
33
41
|
lReturnValue = resolveAMD(
|
|
34
42
|
lStrippedModuleName,
|
|
35
43
|
pBaseDirectory,
|
|
36
|
-
pFileDirectory
|
|
37
|
-
pResolveOptions
|
|
44
|
+
pFileDirectory
|
|
38
45
|
);
|
|
39
46
|
}
|
|
40
47
|
return lReturnValue;
|
|
@@ -119,20 +126,8 @@ function resolveWithRetry(
|
|
|
119
126
|
* for resolved files.
|
|
120
127
|
* @param {string} pFileDirectory the directory of the file the dependency was
|
|
121
128
|
* detected in
|
|
122
|
-
* @param {import(../../../types/resolve-options").IResolveOptions} pResolveOptions
|
|
123
|
-
* @return {Partial <import("../../../types/cruise-result").IDependency>}
|
|
124
|
-
* - resolved: a string representing the pDependency
|
|
125
|
-
* resolved to a file on disk (or the pDependency
|
|
126
|
-
* name itself when it could not be resolved)
|
|
127
|
-
* - coreModule: true the dependency is a (node)
|
|
128
|
-
* core module - false in all other cases
|
|
129
|
-
* (deprecated over dependencyType === 'core')
|
|
130
|
-
* - followable: true when it is worthwhile to
|
|
131
|
-
* follow dependencies of this dependency (
|
|
132
|
-
* typically not true for .json)
|
|
133
|
-
* - couldNotResolve: true if it was not possible
|
|
134
|
-
* to resolve the dependency to a file on disk
|
|
135
|
-
* - dependencyTypes: an array of dependencyTypes
|
|
129
|
+
* @param {import("../../../types/resolve-options").IResolveOptions} pResolveOptions
|
|
130
|
+
* @return {Partial <import("../../../types/cruise-result").IDependency>}
|
|
136
131
|
*
|
|
137
132
|
*/
|
|
138
133
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface ITranspilerWrapper {
|
|
2
|
+
isAvailable: () => boolean;
|
|
3
|
+
transpile: (
|
|
4
|
+
pSource: string,
|
|
5
|
+
pFileName?: string,
|
|
6
|
+
pTranspilerOptions?: any
|
|
7
|
+
) => string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function getWrapper(pExtension, pTranspileOptions): ITranspilerWrapper;
|
|
11
|
+
|
|
12
|
+
export const scannableExtensions: string[];
|
|
13
|
+
|
|
14
|
+
export const allExtensions: string[];
|
|
15
|
+
|
|
16
|
+
export interface IAvailableTranspiler {
|
|
17
|
+
name: string;
|
|
18
|
+
version: string;
|
|
19
|
+
available: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getAvailableTranspilers(): IAvailableTranspiler[];
|
|
@@ -95,7 +95,7 @@ module.exports.getWrapper = (pExtension, pTranspilerOptions) => {
|
|
|
95
95
|
* all supported extensions and whether or not it is supported
|
|
96
96
|
* in the current environment
|
|
97
97
|
*
|
|
98
|
-
* @type {
|
|
98
|
+
* @type {IAvailableExtension[]}
|
|
99
99
|
*/
|
|
100
100
|
module.exports.allExtensions = Object.keys(EXTENSION2WRAPPER).map(
|
|
101
101
|
(pExtension) => ({
|
|
@@ -15,11 +15,11 @@ const path = require("path");
|
|
|
15
15
|
* with 100% confidence.
|
|
16
16
|
*
|
|
17
17
|
* @param {string} pFilePath the path to transform
|
|
18
|
-
* @param {
|
|
18
|
+
* @param {path} pPathModule? optional - the path module/ object to use (for testing
|
|
19
19
|
* this module on posix platforms only; defaults to require('path'))
|
|
20
20
|
* @return {string} the transformed path
|
|
21
21
|
*/
|
|
22
|
-
module.exports = function pathToPosix(pFilePath, pPathModule) {
|
|
22
|
+
module.exports = function pathToPosix(pFilePath, pPathModule = path) {
|
|
23
23
|
const lPathModule = pPathModule || path;
|
|
24
24
|
|
|
25
25
|
if (lPathModule.sep !== path.posix.sep) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
const _clone = require("lodash/clone");
|
|
2
2
|
const _get = require("lodash/get");
|
|
3
3
|
const _reject = require("lodash/reject");
|
|
4
|
-
const
|
|
4
|
+
const _uniq = require("lodash/uniq");
|
|
5
5
|
const compare = require("./compare");
|
|
6
6
|
|
|
7
7
|
function mergeDependency(pLeftDependency, pRightDependency) {
|
|
8
8
|
return {
|
|
9
9
|
...pLeftDependency,
|
|
10
10
|
...pRightDependency,
|
|
11
|
-
dependencyTypes:
|
|
11
|
+
dependencyTypes: _uniq(
|
|
12
12
|
pLeftDependency.dependencyTypes.concat(pRightDependency.dependencyTypes)
|
|
13
13
|
),
|
|
14
14
|
rules: pLeftDependency.rules
|