dependency-cruiser 11.7.0-beta-1 → 11.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/bin/depcruise-fmt.js +4 -0
  2. package/bin/dependency-cruise.js +1 -1
  3. package/configs/plugins/mermaid-reporter-plugin.js +111 -0
  4. package/configs/rules/no-duplicate-dependency-types.js +4 -0
  5. package/package.json +26 -23
  6. package/src/cli/format.js +7 -0
  7. package/src/cli/init-config/config.js.template.js +1 -1
  8. package/src/cli/init-config/environment-helpers.js +8 -1
  9. package/src/cli/init-config/get-user-input.js +16 -0
  10. package/src/cli/init-config/index.js +4 -0
  11. package/src/enrich/index.js +13 -0
  12. package/src/extract/ast-extractors/swc-dependency-visitor.js +4 -0
  13. package/src/extract/gather-initial-sources.js +1 -1
  14. package/src/extract/get-dependencies.js +14 -7
  15. package/src/extract/index.js +10 -0
  16. package/src/extract/parse/to-javascript-ast.js +8 -2
  17. package/src/extract/parse/to-swc-ast.js +2 -0
  18. package/src/extract/parse/to-typescript-ast.js +1 -0
  19. package/src/extract/resolve/determine-dependency-types.js +25 -2
  20. package/src/extract/resolve/index.js +11 -16
  21. package/src/extract/transpile/meta.d.ts +22 -0
  22. package/src/extract/transpile/meta.js +1 -1
  23. package/src/extract/utl/path-to-posix.js +2 -2
  24. package/src/graph-utl/consolidate-module-dependencies.js +2 -2
  25. package/src/graph-utl/rule-set.js +12 -7
  26. package/src/main/files-and-dirs/normalize.js +10 -1
  27. package/src/main/options/defaults.js +2 -1
  28. package/src/main/options/normalize.js +22 -6
  29. package/src/main/options/validate.js +13 -2
  30. package/src/main/report-wrap.js +6 -1
  31. package/src/main/resolve-options/normalize.js +16 -2
  32. package/src/main/rule-set/normalize.js +6 -6
  33. package/src/main/rule-set/validate.js +5 -1
  34. package/src/main/utl/normalize-re-properties.js +8 -6
  35. package/src/meta.js +1 -1
  36. package/src/report/anon/anonymize-path.js +1 -1
  37. package/src/report/anon/index.js +67 -10
  38. package/src/report/csv.js +3 -3
  39. package/src/report/dot/index.js +1 -7
  40. package/src/report/error-html/index.js +2 -2
  41. package/src/report/error.js +2 -2
  42. package/src/report/html/index.js +6 -8
  43. package/src/report/identity.js +2 -3
  44. package/src/report/index.js +2 -2
  45. package/src/report/json.js +2 -3
  46. package/src/report/metrics.js +0 -4
  47. package/src/report/teamcity.js +2 -3
  48. package/src/report/text.js +2 -6
  49. package/src/schema/configuration.schema.js +1 -1
  50. package/src/schema/cruise-result.schema.js +1 -1
  51. package/src/utl/array-util.js +2 -1
  52. package/src/utl/regex-util.js +7 -3
  53. package/src/validate/index.d.ts +60 -0
  54. package/src/validate/index.js +11 -22
  55. package/src/validate/match-dependency-rule.js +12 -2
  56. package/src/validate/match-folder-dependency-rule.js +38 -14
  57. package/src/validate/match-module-rule.js +62 -10
  58. package/src/validate/matchers.js +15 -33
  59. package/src/validate/rule-classifiers.js +3 -3
  60. package/types/cruise-result.d.ts +42 -33
  61. package/types/dependency-cruiser.d.ts +4 -2
  62. package/types/options.d.ts +6 -0
  63. package/types/resolve-options.d.ts +15 -1
  64. package/types/restrictions.d.ts +1 -1
  65. package/types/rule-set.d.ts +5 -0
@@ -46,6 +46,10 @@ try {
46
46
  "regex to collapse to a pattern E.g. ^packages/[^/]+/ would collapse to " +
47
47
  "modules/ folders directly under your packages folder. "
48
48
  )
49
+ .option(
50
+ "-P, --prefix <prefix>",
51
+ "prefix to use for links in the dot and err-html reporters"
52
+ )
49
53
  .option(
50
54
  "-e, --exit-code",
51
55
  "exit with a non-zero exit code when the input json contains error level " +
@@ -53,7 +53,7 @@ try {
53
53
  )
54
54
  .option(
55
55
  "--ts-config [file]",
56
- "use a typescript configuration (e.g. tsconfig.json)"
56
+ "use a TypeScript configuration (e.g. tsconfig.json) or it's JavaScript counterpart (e.g. jsconfig.json)"
57
57
  )
58
58
  .option(
59
59
  "--webpack-config [file]",
@@ -0,0 +1,111 @@
1
+ const ACORN_DUMMY_VALUE = "✖";
2
+
3
+ /* eslint-disable security/detect-object-injection */
4
+ const mermaidNode = (pNode, pText) => {
5
+ const lNode = pNode
6
+ .replace(ACORN_DUMMY_VALUE, "__unknown__")
7
+ .replace(/^\.$|^\.\//g, "__currentPath__")
8
+ .replace(/^\.{2}$|^\.{2}\//g, "__prevPath__")
9
+ .replace(/[[\]/.@]/g, "_");
10
+ const lText = pText ? `["${pText}"]` : "";
11
+ return `${lNode}${lText}`;
12
+ };
13
+
14
+ const mermaidEdge = (pFrom, pTo) => {
15
+ const lFromNode = mermaidNode(pFrom.node);
16
+ const lToNode = mermaidNode(pTo.node);
17
+ return `${lFromNode} --> ${lToNode}`;
18
+ };
19
+
20
+ const mermaidEdges = (pEdges) => {
21
+ return pEdges.map((pEdge) => mermaidEdge(pEdge.from, pEdge.to)).join("\n");
22
+ };
23
+
24
+ const convertedEdgeSources = (pCruiseResult) => {
25
+ return pCruiseResult.modules.flatMap((pModule) => {
26
+ const lFrom = {
27
+ node: pModule.source,
28
+ text: pModule.source.split("/").slice(-1)[0],
29
+ };
30
+
31
+ return pModule.dependencies.map((pDep) => {
32
+ return {
33
+ from: lFrom,
34
+ to: {
35
+ node: pDep.resolved,
36
+ text: pDep.resolved.split("/").slice(-1)[0],
37
+ },
38
+ };
39
+ });
40
+ });
41
+ };
42
+
43
+ const indent = (pDepth = 0) => {
44
+ return " ".repeat(pDepth);
45
+ };
46
+
47
+ const mermaidSubgraph = (pNode, pText, pChildren, pDepth) => {
48
+ return `${indent(pDepth)}subgraph ${mermaidNode(pNode, pText)}
49
+ ${pChildren}
50
+ ${indent(pDepth)}end`;
51
+ };
52
+
53
+ const mermaidSubgraphs = (pSource, pDepth = 0) => {
54
+ return Object.keys(pSource)
55
+ .map((pName) => {
56
+ const source = pSource[pName];
57
+ const children = mermaidSubgraphs(source.children, pDepth + 1);
58
+ if (children === "")
59
+ return `${indent(pDepth)}${mermaidNode(source.node, source.text)}`;
60
+
61
+ return mermaidSubgraph(source.node, source.text, children, pDepth);
62
+ })
63
+ .join("\n");
64
+ };
65
+
66
+ const convertedSubgraphSources = (pCruiseResult) => {
67
+ let lTree = {};
68
+
69
+ pCruiseResult.modules.forEach((pModule) => {
70
+ const paths = pModule.source.split("/");
71
+
72
+ paths.reduce((pChildren, pCurrentPath, pIndex) => {
73
+ if (!pChildren[pCurrentPath]) {
74
+ pChildren[pCurrentPath] = {
75
+ node: paths.slice(0, pIndex + 1).join("/"),
76
+ text: pCurrentPath,
77
+ children: {},
78
+ };
79
+ }
80
+ return pChildren[pCurrentPath].children;
81
+ }, lTree);
82
+ });
83
+
84
+ return lTree;
85
+ };
86
+
87
+ const renderMermaidThing = (pCruiseResult) => {
88
+ const subgraphs = convertedSubgraphSources(pCruiseResult);
89
+ const edges = convertedEdgeSources(pCruiseResult);
90
+
91
+ return `flowchart LR
92
+
93
+ ${mermaidSubgraphs(subgraphs)}
94
+ ${mermaidEdges(edges)}
95
+ `;
96
+ };
97
+
98
+ /**
99
+ * mermaid reporter plugin
100
+ *
101
+ * @param {import('../../types/dependency-cruiser').ICruiseResult} pCruiseResult -
102
+ * the output of a dependency-cruise adhering to dependency-cruiser's
103
+ * cruise result schema
104
+ * @return {import('../../types/dependency-cruiser').IReporterOutput} -
105
+ * output: a string
106
+ * exitCode: 0
107
+ */
108
+ module.exports = (pCruiseResult) => ({
109
+ output: renderMermaidThing(pCruiseResult),
110
+ exitCode: 0,
111
+ });
@@ -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.7.0-beta-1",
3
+ "version": "11.8.0",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -51,7 +51,8 @@
51
51
  "./config-utl/extract-ts-config": "./src/config-utl/extract-ts-config.js",
52
52
  "./config-utl/extract-webpack-resolve-config": "./src/config-utl/extract-webpack-resolve-config.js",
53
53
  "./sample-reporter-plugin": "./configs/plugins/stats-reporter-plugin.js",
54
- "./sample-3d-reporter-plugin": "./configs/plugins/3d-reporter-plugin.js"
54
+ "./sample-3d-reporter-plugin": "./configs/plugins/3d-reporter-plugin.js",
55
+ "./mermaid-reporter-plugin": "./configs/plugins/mermaid-reporter-plugin.js"
55
56
  },
56
57
  "types": "types/dependency-cruiser.d.ts",
57
58
  "files": [
@@ -98,7 +99,7 @@
98
99
  "lint:prettier": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
99
100
  "lint:prettier:fix": "prettier --loglevel warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
100
101
  "lint:types": "npm-run-all lint:types:tsc lint:types:lint",
101
- "lint:types:tsc": "tsc --noEmit --strict --types --noUnusedLocals --noUnusedParameters types/dependency-cruiser.d.ts",
102
+ "lint:types:tsc": "tsc --project types/tsconfig.json",
102
103
  "lint:types:lint": "eslint --no-ignore --config types/.eslintrc.json types/*.d.ts",
103
104
  "lint:types:fix": "eslint --no-ignore --config types/.eslintrc.json --fix types/*.d.ts",
104
105
  "scm:push": "run-p --aggregate-output scm:push:*",
@@ -135,63 +136,65 @@
135
136
  "version": "npm-run-all build depcruise:graph:doc scm:stage"
136
137
  },
137
138
  "dependencies": {
138
- "acorn": "8.7.0",
139
+ "acorn": "8.7.1",
139
140
  "acorn-jsx": "5.3.2",
140
141
  "acorn-jsx-walk": "2.0.0",
141
142
  "acorn-loose": "8.3.0",
142
143
  "acorn-walk": "8.2.0",
143
144
  "ajv": "8.11.0",
144
145
  "chalk": "^4.1.2",
145
- "commander": "9.2.0",
146
+ "commander": "9.3.0",
146
147
  "enhanced-resolve": "5.9.3",
147
148
  "figures": "^3.2.0",
148
149
  "get-stream": "^6.0.1",
149
150
  "glob": "7.2.0",
150
151
  "handlebars": "4.7.7",
151
152
  "indent-string": "^4.0.0",
152
- "inquirer": "8.2.2",
153
+ "inquirer": "8.2.4",
153
154
  "json5": "2.2.1",
154
155
  "lodash": "4.17.21",
155
156
  "safe-regex": "2.1.1",
156
157
  "semver": "^7.3.7",
157
158
  "semver-try-require": "^5.0.2",
158
- "teamcity-service-messages": "0.1.12",
159
+ "teamcity-service-messages": "0.1.14",
159
160
  "tsconfig-paths-webpack-plugin": "3.5.2",
160
161
  "wrap-ansi": "^7.0.0"
161
162
  },
162
163
  "devDependencies": {
163
- "@babel/core": "7.17.9",
164
- "@babel/plugin-transform-modules-commonjs": "7.17.9",
165
- "@babel/preset-typescript": "7.16.7",
166
- "@swc/core": "1.2.167",
167
- "@typescript-eslint/eslint-plugin": "5.19.0",
168
- "@typescript-eslint/parser": "5.19.0",
169
- "@vue/compiler-sfc": "3.2.33",
170
- "c8": "7.11.0",
164
+ "@babel/core": "7.18.2",
165
+ "@babel/plugin-transform-modules-commonjs": "7.18.2",
166
+ "@babel/preset-typescript": "7.17.12",
167
+ "@swc/core": "1.2.194",
168
+ "@types/lodash": "4.14.182",
169
+ "@types/node": "17.0.36",
170
+ "@typescript-eslint/eslint-plugin": "5.26.0",
171
+ "@typescript-eslint/parser": "5.26.0",
172
+ "@vue/compiler-sfc": "3.2.36",
173
+ "c8": "7.11.3",
171
174
  "chai": "4.3.6",
172
175
  "chai-json-schema": "1.5.1",
173
- "coffeescript": "2.6.1",
174
- "eslint": "^8.13.0",
176
+ "coffeescript": "2.7.0",
177
+ "eslint": "^8.16.0",
175
178
  "eslint-config-moving-meadow": "3.0.0",
176
179
  "eslint-config-prettier": "8.5.0",
177
- "eslint-plugin-budapestian": "3.0.1",
180
+ "eslint-plugin-budapestian": "3.0.2",
178
181
  "eslint-plugin-import": "2.26.0",
179
182
  "eslint-plugin-mocha": "^9.0.0",
180
183
  "eslint-plugin-node": "11.1.0",
181
- "eslint-plugin-security": "1.4.0",
184
+ "eslint-plugin-security": "1.5.0",
182
185
  "eslint-plugin-unicorn": "^42.0.0",
183
186
  "husky": "^4.3.8",
184
187
  "intercept-stdout": "0.1.2",
185
188
  "lint-staged": "12.3.4",
186
- "mocha": "9.2.2",
189
+ "mocha": "10.0.0",
187
190
  "normalize-newline": "^3.0.0",
188
191
  "npm-run-all": "4.1.5",
189
192
  "prettier": "2.6.2",
190
193
  "proxyquire": "2.1.3",
191
194
  "shx": "0.3.4",
192
- "svelte": "3.47.0",
195
+ "svelte": "3.48.0",
193
196
  "symlink-dir": "5.0.1",
194
- "typescript": "4.6.3",
197
+ "typescript": "4.7.2",
195
198
  "upem": "^7.0.0",
196
199
  "vue-template-compiler": "2.6.14",
197
200
  "yarn": "1.22.18"
@@ -206,7 +209,7 @@
206
209
  {
207
210
  "package": "eslint-plugin-mocha",
208
211
  "policy": "wanted",
209
- "because": "version 10 dropped support for node 12, which we still do support"
212
+ "because": "version 10 bumps into https://github.com/lo1tuma/eslint-plugin-mocha/issues/322"
210
213
  },
211
214
  {
212
215
  "package": "figures",
package/src/cli/format.js CHANGED
@@ -12,9 +12,16 @@ const KNOWN_FMT_OPTIONS = [
12
12
  "includeOnly",
13
13
  "outputTo",
14
14
  "outputType",
15
+ "prefix",
15
16
  "version",
16
17
  ];
17
18
 
19
+ /**
20
+ *
21
+ * @param {string} pResultFile the name of the file with cruise results
22
+ * @param {import("../../types/dependency-cruiser").IFormatOptions} pOptions
23
+ * @returns {Number} an exitCode
24
+ */
18
25
  module.exports = async (pResultFile, pOptions) => {
19
26
  const lOptions = normalizeOptions(pOptions, KNOWN_FMT_OPTIONS);
20
27
 
@@ -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:312,column:17},end:{line:312,column:29}}}):o)+"'\n },\n"},17:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return null!=(o=i(o,"if").call(null!=n?n:e.nullContext||{},null!=n?i(n,"useJsConfig"):n,{name:"if",hash:{},fn:e.program(18,s,0),inverse:e.program(20,s,0),data:s,loc:{start:{line:315,column:6},end:{line:323,column:13}}}))?o:""},18:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" tsConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"jsConfig")||(null!=n?i(n,"jsConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"jsConfig",hash:{},data:s,loc:{start:{line:317,column:17},end:{line:317,column:29}}}):o)+"'\n },\n"},20:function(e,n,o,t,s){return" // tsConfig: {\n // fileName: './tsconfig.json'\n // },\n"},22:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" webpackConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"webpackConfig")||(null!=n?i(n,"webpackConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"webpackConfig",hash:{},data:s,loc:{start:{line:338,column:17},end:{line:338,column:34}}}):o)+"',\n // env: {},\n // args: {},\n },\n"},24:function(e,n,o,t,s){return" // webpackConfig: {\n // fileName: './webpack.config.js',\n // env: {},\n // args: {},\n // },\n"},26:function(e,n,o,t,s){var i=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]};return" babelConfig: {\n fileName: '"+e.escapeExpression("function"==typeof(o=null!=(o=i(o,"babelConfig")||(null!=n?i(n,"babelConfig"):n))?o:e.hooks.helperMissing)?o.call(null!=n?n:e.nullContext||{},{name:"babelConfig",hash:{},data:s,loc:{start:{line:358,column:17},end:{line:358,column:32}}}):o)+"'\n },\n"},28:function(e,n,o,t,s){return" // babelConfig: {\n // fileName: './.babelrc'\n // },\n"},compiler:[8,">= 4.3.0"],main:function(e,n,o,t,s){var i=null!=n?n:e.nullContext||{},r=e.hooks.helperMissing,a="function",l=e.escapeExpression,c=e.lookupProperty||function(e,n){if(Object.prototype.hasOwnProperty.call(e,n))return e[n]},p="/** @type {import('dependency-cruiser').IConfiguration} */\nmodule.exports = {\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"preset"):n,{name:"if",hash:{},fn:e.program(1,s,0),inverse:e.program(3,s,0),data:s,loc:{start:{line:3,column:0},end:{line:156,column:7}}}))?h:""),d=null!=(d=c(o,"hasTestsOutsideSource")||(null!=n?c(n,"hasTestsOutsideSource"):n))?d:r,u={name:"hasTestsOutsideSource",hash:{},fn:e.program(5,s,0),inverse:e.noop,data:s,loc:{start:{line:157,column:4},end:{line:172,column:30}}},h=typeof d==a?d.call(i,u):d;return null!=(h=c(o,"hasTestsOutsideSource")?h:e.hooks.blockHelperMissing.call(n,h,u))&&(p+=h),p+" {\n name: 'not-to-spec',\n comment:\n 'This module depends on a spec (test) file. The sole responsibility of a spec file is to test code. ' +\n \"If there's something in a spec that's of use to other modules, it doesn't have that single \" +\n 'responsibility anymore. Factor it out into (e.g.) a separate utility/ helper or a mock.',\n severity: 'error',\n from: {},\n to: {\n path: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n }\n },\n {\n name: 'not-to-dev-dep',\n severity: 'error',\n comment:\n \"This module depends on an npm package from the 'devDependencies' section of your \" +\n 'package.json. It looks like something that ships to production, though. To prevent problems ' +\n \"with npm packages that aren't there on production declare it (only!) in the 'dependencies'\" +\n 'section of your package.json. If this module is development only - add it to the ' +\n 'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',\n from: {\n path: '"+l(typeof(d=null!=(d=c(o,"sourceLocationRE")||(null!=n?c(n,"sourceLocationRE"):n))?d:r)==a?d.call(i,{name:"sourceLocationRE",hash:{},data:s,loc:{start:{line:195,column:15},end:{line:195,column:35}}}):d)+"',\n pathNot: '\\\\.(spec|test)\\\\.(js|mjs|cjs|ts|ls|coffee|litcoffee|coffee\\\\.md)$'\n },\n to: {\n dependencyTypes: [\n 'npm-dev'\n ]\n }\n },\n {\n name: 'optional-deps-used',\n severity: 'info',\n comment:\n \"This module depends on an npm package that is declared as an optional dependency \" +\n \"in your package.json. As this makes sense in limited situations only, it's flagged here. \" +\n \"If you're using an optional dependency here by design - add an exception to your\" +\n \"depdency-cruiser configuration.\",\n from: {},\n to: {\n dependencyTypes: [\n 'npm-optional'\n ]\n }\n },\n {\n name: 'peer-deps-used',\n comment:\n \"This module depends on an npm package that is declared as a peer dependency \" +\n \"in your package.json. This makes sense if your package is e.g. a plugin, but in \" +\n \"other cases - maybe not so much. If the use of a peer dependency is intentional \" +\n \"add an exception to your dependency-cruiser configuration.\",\n severity: 'warn',\n from: {},\n to: {\n dependencyTypes: [\n 'npm-peer'\n ]\n }\n }\n ],\n options: {\n\n /* conditions specifying which files not to follow further when encountered:\n - path: a regular expression to match\n - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/master/doc/rules-reference.md#dependencytypes-and-dependencytypesnot\n for a complete list\n */\n doNotFollow: {\n path: 'node_modules'\n },\n\n /* conditions specifying which dependencies to exclude\n - path: a regular expression to match\n - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.\n leave out if you want to exclude neither (recommended!)\n */\n // exclude : {\n // path: '',\n // dynamic: true\n // },\n\n /* pattern specifying which files to include (regular expression)\n dependency-cruiser will skip everything not matching this pattern\n */\n // includeOnly : '',\n\n /* dependency-cruiser will include modules matching against the focus\n regular expression in its output, as well as their neighbours (direct\n dependencies and dependents)\n */\n // focus : '',\n\n /* list of module systems to cruise */\n // moduleSystems: ['amd', 'cjs', 'es6', 'tsd'],\n\n /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'\n to open it on your online repo or `vscode://file/${process.cwd()}/` to \n open it in visual studio code),\n */\n // prefix: '',\n\n /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation\n true: also detect dependencies that only exist before typescript-to-javascript compilation\n \"specify\": for each dependency identify whether it only exists before compilation or also after\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"tsPreCompilationDeps"):n,{name:"if",hash:{},fn:e.program(7,s,0),inverse:e.program(9,s,0),data:s,loc:{start:{line:280,column:4},end:{line:284,column:11}}}))?h:"")+' \n /* list of extensions (typically non-parseable) to scan. Empty by default. */\n // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],\n\n /* if true combines the package.jsons found from the module up to the base\n folder the cruise is initiated from. Useful for how (some) mono-repos\n manage dependencies & dependency definitions.\n */\n'+(null!=(h=c(o,"if").call(i,null!=n?c(n,"combinedDependencies"):n,{name:"if",hash:{},fn:e.program(11,s,0),inverse:e.program(13,s,0),data:s,loc:{start:{line:293,column:4},end:{line:297,column:11}}}))?h:"")+"\n /* if true leave symlinks untouched, otherwise use the realpath */\n // preserveSymlinks: false,\n\n /* TypeScript project file ('tsconfig.json') to use for\n (1) compilation and\n (2) resolution (e.g. with the paths property)\n\n The (optional) fileName attribute specifies which file to take (relative to\n dependency-cruiser's current working directory). When not provided\n defaults to './tsconfig.json'.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useTsConfig"):n,{name:"if",hash:{},fn:e.program(15,s,0),inverse:e.program(17,s,0),data:s,loc:{start:{line:310,column:4},end:{line:324,column:11}}}))?h:"")+"\n /* Webpack configuration to use to get resolve options from.\n\n The (optional) fileName attribute specifies which file to take (relative\n to dependency-cruiser's current working directory. When not provided defaults\n to './webpack.conf.js'.\n\n The (optional) `env` and `args` attributes contain the parameters to be passed if\n your webpack config is a function and takes them (see webpack documentation\n for details)\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useWebpackConfig"):n,{name:"if",hash:{},fn:e.program(22,s,0),inverse:e.program(24,s,0),data:s,loc:{start:{line:336,column:4},end:{line:348,column:11}}}))?h:"")+"\n /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use\n for compilation (and whatever other naughty things babel plugins do to\n source code). This feature is well tested and usable, but might change\n behavior a bit over time (e.g. more precise results for used module \n systems) without dependency-cruiser getting a major version bump.\n */\n"+(null!=(h=c(o,"if").call(i,null!=n?c(n,"useBabelConfig"):n,{name:"if",hash:{},fn:e.program(26,s,0),inverse:e.program(28,s,0),data:s,loc:{start:{line:356,column:4},end:{line:364,column:11}}}))?h:"")+'\n /* List of strings you have in use in addition to cjs/ es6 requires\n & imports to declare module dependencies. Use this e.g. if you\'ve\n redeclared require, use a require-wrapper or use window.require as\n a hack.\n */\n // exoticRequireStrings: [],\n /* options to pass on to enhanced-resolve, the package dependency-cruiser\n uses to resolve module references to disk. You can set most of these\n options in a webpack.conf.js - this section is here for those\n projects that don\'t have a separate webpack config file.\n\n Note: settings in webpack.conf.js override the ones specified here.\n */\n enhancedResolveOptions: {\n /* List of strings to consider as \'exports\' fields in package.json. Use\n [\'exports\'] when you use packages that use such a field and your environment\n supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).\n\n If you have an `exportsFields` attribute in your webpack config, that one\n will have precedence over the one specified here.\n */ \n exportsFields: ["exports"],\n /* List of conditions to check for in the exports field. e.g. use [\'imports\']\n if you\'re only interested in exposed es6 modules, [\'require\'] for commonjs,\n or all conditions at once `([\'import\', \'require\', \'node\', \'default\']`)\n if anything goes for you. Only works when the \'exportsFields\' array is\n non-empty.\n\n If you have a \'conditionNames\' attribute in your webpack config, that one will\n have precedence over the one specified here.\n */\n conditionNames: ["import", "require", "node", "default"]\n },\n reporterOptions: {\n dot: {\n /* pattern of modules that can be consolidated in the detailed\n graphical dependency graph. The default pattern in this configuration\n collapses everything in node_modules to one folder deep so you see\n the external modules, but not the innards your app depends upon.\n */\n collapsePattern: \'node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n don\'t worry - dependency-cruiser will fall back to the default one.\n */\n // theme: {\n // graph: {\n // /* use splines: "ortho" for straight lines. Be aware though\n // graphviz might take a long time calculating ortho(gonal)\n // routings.\n // */\n // splines: "true"\n // },\n // modules: [\n // {\n // criteria: { source: "^src/model" },\n // attributes: { fillcolor: "#ccccff" }\n // },\n // {\n // criteria: { source: "^src/view" },\n // attributes: { fillcolor: "#ccffcc" }\n // }\n // ],\n // dependencies: [\n // {\n // criteria: { "rules[0].severity": "error" },\n // attributes: { fontcolor: "red", color: "red" }\n // },\n // {\n // criteria: { "rules[0].severity": "warn" },\n // attributes: { fontcolor: "orange", color: "orange" }\n // },\n // {\n // criteria: { "rules[0].severity": "info" },\n // attributes: { fontcolor: "blue", color: "blue" }\n // },\n // {\n // criteria: { resolved: "^src/model" },\n // attributes: { color: "#0000ff77" }\n // },\n // {\n // criteria: { resolved: "^src/view" },\n // attributes: { color: "#00770077" }\n // }\n // ]\n // }\n },\n archi: {\n /* pattern of modules that can be consolidated in the high level\n graphical dependency graph. If you use the high level graphical\n dependency graph reporter (`archi`) you probably want to tweak\n this collapsePattern to your situation.\n */\n collapsePattern: \'^(packages|src|lib|app|bin|test(s?)|spec(s?))/[^/]+|node_modules/[^/]+\',\n\n /* Options to tweak the appearance of your graph.See\n https://github.com/sverweij/dependency-cruiser/blob/master/doc/options-reference.md#reporteroptions\n for details and some examples. If you don\'t specify a theme\n for \'archi\' dependency-cruiser will use the one specified in the\n dot section (see above), if any, and otherwise use the default one.\n */\n // theme: {\n // },\n }\n }\n }\n};\n// generated: dependency-cruiser@'+l(typeof(d=null!=(d=c(o,"version")||(null!=n?c(n,"version"):n))?d:r)==a?d.call(i,{name:"version",hash:{},data:s,loc:{start:{line:475,column:33},end:{line:475,column:44}}}):d)+" on "+l(typeof(d=null!=(d=c(o,"date")||(null!=n?c(n,"date"):n))?d:r)==a?d.call(i,{name:"date",hash:{},data:s,loc:{start:{line:475,column:48},end:{line:475,column:56}}}):d)+"\n"},useData:!0});
@@ -7,7 +7,8 @@ const { DEFAULT_CONFIG_FILE_NAME } = require("../defaults");
7
7
  const LIKELY_SOURCE_FOLDERS = ["src", "lib", "app", "bin", "sources"];
8
8
  const LIKELY_TEST_FOLDERS = ["test", "spec", "tests", "specs", "bdd"];
9
9
  const LIKELY_PACKAGES_FOLDERS = ["packages"];
10
- const TSCONFIG_CANDIDATE_PATTERN = /.*[tj]sconfig.*\.json$/gi;
10
+ const TSCONFIG_CANDIDATE_PATTERN = /.*tsconfig.*\.json$/gi;
11
+ const JSCONFIG_CANDIDATE_PATTERN = /.*jsconfig.*\.json$/gi;
11
12
  const WEBPACK_CANDIDATE_PATTERN = /.*webpack.*\.c?js(on)?$/gi;
12
13
  const BABEL_CONFIG_CANDIDATE_PATTERN = /^\.babelrc$|.*babel.*\.json/gi;
13
14
 
@@ -119,6 +120,10 @@ const getTSConfigCandidates = (pFolderName = process.cwd()) =>
119
120
  getMatchingFileNames(TSCONFIG_CANDIDATE_PATTERN, pFolderName);
120
121
  const hasTSConfigCandidates = (pFolderName = process.cwd()) =>
121
122
  getTSConfigCandidates(pFolderName).length > 0;
123
+ const getJSConfigCandidates = (pFolderName = process.cwd()) =>
124
+ getMatchingFileNames(JSCONFIG_CANDIDATE_PATTERN, pFolderName);
125
+ const hasJSConfigCandidates = (pFolderName = process.cwd()) =>
126
+ getJSConfigCandidates(pFolderName).length > 0;
122
127
 
123
128
  const getWebpackConfigCandidates = () =>
124
129
  getMatchingFileNames(WEBPACK_CANDIDATE_PATTERN);
@@ -149,6 +154,8 @@ module.exports = {
149
154
  hasWebpackConfigCandidates,
150
155
  getTSConfigCandidates,
151
156
  hasTSConfigCandidates,
157
+ getJSConfigCandidates,
158
+ hasJSConfigCandidates,
152
159
  getSourceFolderCandidates,
153
160
  getTestFolderCandidates,
154
161
  getMonoRepoPackagesCandidates,
@@ -4,6 +4,8 @@ const {
4
4
  getTestFolderCandidates,
5
5
  hasBabelConfigCandidates,
6
6
  getBabelConfigCandidates,
7
+ hasJSConfigCandidates,
8
+ getJSConfigCandidates,
7
9
  hasTSConfigCandidates,
8
10
  getTSConfigCandidates,
9
11
  hasWebpackConfigCandidates,
@@ -67,6 +69,20 @@ const INQUIRER_QUESTIONS = [
67
69
  validate: validateLocation,
68
70
  when: (pAnswers) => pAnswers.hasTestsOutsideSource && !pAnswers.isMonoRepo,
69
71
  },
72
+ {
73
+ name: "useJsConfig",
74
+ type: "confirm",
75
+ message: "Looks like you're using a 'jsconfig.json'. Use that?",
76
+ default: true,
77
+ when: () => hasJSConfigCandidates() && !hasTSConfigCandidates(),
78
+ },
79
+ {
80
+ name: "jsConfig",
81
+ type: "list",
82
+ message: "Full path to your 'jsconfig.json':",
83
+ choices: getJSConfigCandidates(),
84
+ when: (pAnswers) => pAnswers.useJsConfig,
85
+ },
70
86
  {
71
87
  name: "useTsConfig",
72
88
  type: "confirm",
@@ -13,6 +13,8 @@ const {
13
13
  hasTSConfigCandidates,
14
14
  getTSConfigCandidates,
15
15
  getDefaultConfigFileName,
16
+ hasJSConfigCandidates,
17
+ getJSConfigCandidates,
16
18
  } = require("./environment-helpers");
17
19
  const {
18
20
  writeRunScriptsToManifest,
@@ -32,6 +34,8 @@ function getOneshotConfig(pOneShotConfigId) {
32
34
  const lBaseConfig = {
33
35
  isMonoRepo: isLikelyMonoRepo(),
34
36
  combinedDependencies: false,
37
+ useJsConfig: hasJSConfigCandidates() && !hasTSConfigCandidates(),
38
+ jsConfig: getJSConfigCandidates().shift(),
35
39
  useTsConfig: hasTSConfigCandidates(),
36
40
  tsConfig: getTSConfigCandidates().shift(),
37
41
  tsPreCompilationDeps: hasTSConfigCandidates(),
@@ -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/options').ICruiseOptions} pOptions options that
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/options').ICruiseOptions} pCruiseOptions
111
+ * @param {import('../../types/dependency-cruiser').ICruiseOptions} pCruiseOptions
112
112
  * @param {string} pFileName
113
113
  * @param {any} pTranspileOptions
114
- * @returns {Partial<import('../../types/cruise-result').IDependency[]>}
114
+ * @returns {import('../../types/cruise-result').IDependency[]}
115
115
  */
116
116
  function extractDependencies(pCruiseOptions, pFileName, pTranspileOptions) {
117
- /** @type Partial<import('../../types/cruise-result').IDependency[]> */
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("../../../types/dependency-cruiser").ICruiseOptions} pCruiseOptions cruise options
205
- * @param {import("../../types/resolve-options").IResolveOptions} pResolveOptions webpack 'enhanced-resolve' options
206
- * @param {any} pTranspileOptions an object with tsconfig ('typescript project') options
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)
@@ -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 {any} the abstract syntax tree
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 {any} - a (typescript) AST
96
+ * @return {acorn.Node} - a (javascript) AST
91
97
  */
92
98
  getASTCached,
93
99