dependency-cruiser 13.0.0-beta-2 → 13.0.0-beta-4
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/package.json +18 -16
- package/src/cli/index.mjs +23 -18
- package/src/extract/gather-initial-sources.mjs +4 -0
- package/src/main/index.mjs +10 -9
- package/src/meta.js +1 -1
- package/src/report/dot/dot-custom.mjs +3 -0
- package/src/report/dot/dot-flat.mjs +3 -0
- package/src/report/dot/dot-folder.mjs +3 -0
- package/src/report/dot/dot-module.mjs +3 -0
- package/src/report/index.mjs +32 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "13.0.0-beta-
|
|
3
|
+
"version": "13.0.0-beta-4",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"depcruise:graph:doc:samples": "sh tools/generate-samples.sh",
|
|
98
98
|
"depcruise:graph:mermaid": "node ./bin/dependency-cruise.mjs bin src --include-only ^src/ --collapse 2 --output-type mermaid",
|
|
99
99
|
"depcruise:graph:mermaid:diff": "node ./bin/dependency-cruise.mjs bin src test types tools --config configs/.dependency-cruiser-unlimited.json --output-type mermaid --reaches \"$(watskeburt $SHA)\"",
|
|
100
|
-
"depcruise:graph:view": "node ./bin/dependency-cruise.mjs bin src --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-show-metrics-config.mjs --output-type dot --progress cli-feedback --highlight \"$(watskeburt
|
|
100
|
+
"depcruise:graph:view": "node ./bin/dependency-cruise.mjs bin src --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-show-metrics-config.mjs --output-type dot --progress cli-feedback --highlight \"$(watskeburt develop)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
|
|
101
101
|
"depcruise:graph:view:diff": "node ./bin/dependency-cruise.mjs bin src test --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-unlimited.json --output-type dot --progress cli-feedback --reaches \"$(watskeburt develop)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
|
|
102
102
|
"depcruise:report": "node ./bin/dependency-cruise.mjs src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.mjs --output-to dependency-violations.html",
|
|
103
103
|
"depcruise:report:view": "node ./bin/dependency-cruise.mjs src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.mjs --output-to - | browser",
|
|
@@ -126,14 +126,16 @@
|
|
|
126
126
|
"scm:push:gitlab-mirror:commits": "git push gitlab-mirror",
|
|
127
127
|
"scm:push:gitlab-mirror:tags": "git push --tags gitlab-mirror",
|
|
128
128
|
"scm:stage": "git add .",
|
|
129
|
-
"test": "LANG=en_US.UTF-8 mocha",
|
|
130
|
-
"test:i": "LANG=en_US.UTF-8 mocha --grep \"^\\[[I]\\]\"",
|
|
131
|
-
"test:u": "LANG=en_US.UTF-8 mocha --grep \"^\\[[U]\\]\"",
|
|
132
|
-
"test:e": "LANG=en_US.UTF-8 mocha --grep \"^\\[[E]\\]\"",
|
|
133
|
-
"test:cover": "LANG=en_US.UTF-8 c8 mocha",
|
|
129
|
+
"test": "LANG=en_US.UTF-8 NODE_OPTIONS=--no-warnings mocha",
|
|
130
|
+
"test:i": "LANG=en_US.UTF-8 NODE_OPTIONS=--no-warnings mocha --grep \"^\\[[I]\\]\"",
|
|
131
|
+
"test:u": "LANG=en_US.UTF-8 NODE_OPTIONS=--no-warnings mocha --grep \"^\\[[U]\\]\"",
|
|
132
|
+
"test:e": "LANG=en_US.UTF-8 NODE_OPTIONS=--no-warnings mocha --grep \"^\\[[E]\\]\"",
|
|
133
|
+
"test:cover": "LANG=en_US.UTF-8 NODE_OPTIONS=--no-warnings c8 mocha",
|
|
134
134
|
"test:glob": "set -f && test \"`bin/dependency-cruise.mjs --no-config test/extract/__mocks__/gather-globbing/packages/**/src/**/*.js | grep \"no dependency violations found\"`\" = \"✔ no dependency violations found (6 modules, 0 dependencies cruised)\"",
|
|
135
135
|
"test:load": "hyperfine --warmup 3 --runs 30 \"bin/dependency-cruise.mjs src bin test configs types tools --ignore-known --no-cache --no-progress\"",
|
|
136
136
|
"test:load:short": "hyperfine --warmup 1 --runs 5 \"bin/dependency-cruise.mjs src bin test configs types tools --ignore-known --no-cache --no-progress\"",
|
|
137
|
+
"test:load:cached": "hyperfine --warmup 3 --runs 30 \"bin/dependency-cruise.mjs src bin test configs types tools --ignore-known --cache node_modules/.cache/dependency-cruiser/load-cached --no-progress\"",
|
|
138
|
+
"test:load:cached:short": "hyperfine --warmup 1 --runs 5 \"bin/dependency-cruise.mjs src bin test configs types tools --ignore-known --cache node_modules/.cache/dependency-cruiser/load-cached --no-progress\"",
|
|
137
139
|
"update-dependencies": "npm-run-all upem:update upem:install build:clean build lint:eslint:clear-caches lint:fix depcruise test:cover",
|
|
138
140
|
"upem-outdated": "npm outdated --json --long | upem --dry-run",
|
|
139
141
|
"upem:install": "npm install",
|
|
@@ -149,10 +151,10 @@
|
|
|
149
151
|
"ajv": "8.12.0",
|
|
150
152
|
"chalk": "5.2.0",
|
|
151
153
|
"commander": "10.0.1",
|
|
152
|
-
"enhanced-resolve": "5.
|
|
154
|
+
"enhanced-resolve": "5.13.0",
|
|
153
155
|
"figures": "5.0.0",
|
|
154
156
|
"get-stream": "^6.0.1",
|
|
155
|
-
"glob": "10.
|
|
157
|
+
"glob": "10.2.2",
|
|
156
158
|
"handlebars": "4.7.7",
|
|
157
159
|
"ignore": "5.2.4",
|
|
158
160
|
"indent-string": "5.0.0",
|
|
@@ -163,7 +165,7 @@
|
|
|
163
165
|
"prompts": "2.4.2",
|
|
164
166
|
"rechoir": "^0.8.0",
|
|
165
167
|
"safe-regex": "2.1.1",
|
|
166
|
-
"semver": "^7.
|
|
168
|
+
"semver": "^7.5.0",
|
|
167
169
|
"semver-try-require": "6.2.2",
|
|
168
170
|
"teamcity-service-messages": "0.1.14",
|
|
169
171
|
"tsconfig-paths-webpack-plugin": "4.0.1",
|
|
@@ -174,18 +176,18 @@
|
|
|
174
176
|
"@babel/core": "7.21.4",
|
|
175
177
|
"@babel/plugin-transform-modules-commonjs": "7.21.2",
|
|
176
178
|
"@babel/preset-typescript": "7.21.4",
|
|
177
|
-
"@swc/core": "1.3.
|
|
179
|
+
"@swc/core": "1.3.53",
|
|
178
180
|
"@types/lodash": "4.14.194",
|
|
179
|
-
"@types/node": "18.
|
|
181
|
+
"@types/node": "18.16.0",
|
|
180
182
|
"@types/prompts": "2.4.4",
|
|
181
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
182
|
-
"@typescript-eslint/parser": "5.
|
|
183
|
+
"@typescript-eslint/eslint-plugin": "5.59.0",
|
|
184
|
+
"@typescript-eslint/parser": "5.59.0",
|
|
183
185
|
"@vue/compiler-sfc": "3.2.47",
|
|
184
186
|
"c8": "7.13.0",
|
|
185
187
|
"chai": "4.3.7",
|
|
186
188
|
"chai-json-schema": "1.5.1",
|
|
187
189
|
"coffeescript": "2.7.0",
|
|
188
|
-
"eslint": "8.
|
|
190
|
+
"eslint": "8.39.0",
|
|
189
191
|
"eslint-config-moving-meadow": "4.0.2",
|
|
190
192
|
"eslint-config-prettier": "8.8.0",
|
|
191
193
|
"eslint-plugin-budapestian": "5.0.1",
|
|
@@ -201,7 +203,7 @@
|
|
|
201
203
|
"mocha": "10.2.0",
|
|
202
204
|
"normalize-newline": "4.1.0",
|
|
203
205
|
"npm-run-all": "4.1.5",
|
|
204
|
-
"prettier": "2.8.
|
|
206
|
+
"prettier": "2.8.8",
|
|
205
207
|
"proxyquire": "2.1.3",
|
|
206
208
|
"shx": "0.3.4",
|
|
207
209
|
"svelte": "3.58.0",
|
package/src/cli/index.mjs
CHANGED
|
@@ -9,19 +9,13 @@ import chalk from "chalk";
|
|
|
9
9
|
import { cruise } from "../main/index.mjs";
|
|
10
10
|
import bus from "../utl/bus.mjs";
|
|
11
11
|
|
|
12
|
-
import extractTSConfig from "../config-utl/extract-ts-config.mjs";
|
|
13
|
-
import extractBabelConfig from "../config-utl/extract-babel-config.mjs";
|
|
14
|
-
import extractWebpackResolveConfig from "../config-utl/extract-webpack-resolve-config.mjs";
|
|
15
|
-
import extractKnownViolations from "../config-utl/extract-known-violations.mjs";
|
|
16
12
|
import busLogLevels from "../utl/bus-log-levels.mjs";
|
|
17
13
|
import validateFileExistence from "./utl/validate-file-existence.mjs";
|
|
18
14
|
import normalizeCliOptions from "./normalize-cli-options.mjs";
|
|
19
15
|
import { write } from "./utl/io.mjs";
|
|
20
|
-
import formatMetaInfo from "./format-meta-info.mjs";
|
|
21
16
|
import setUpCliFeedbackListener from "./listeners/cli-feedback.mjs";
|
|
22
17
|
import setUpPerformanceLogListener from "./listeners/performance-log/index.mjs";
|
|
23
18
|
import setUpNDJSONListener from "./listeners/ndjson.mjs";
|
|
24
|
-
import initConfig from "./init-config/index.mjs";
|
|
25
19
|
|
|
26
20
|
async function extractResolveOptions(pCruiseOptions) {
|
|
27
21
|
let lResolveOptions = {};
|
|
@@ -29,7 +23,10 @@ async function extractResolveOptions(pCruiseOptions) {
|
|
|
29
23
|
pCruiseOptions?.ruleSet?.options?.webpackConfig?.fileName ?? null;
|
|
30
24
|
|
|
31
25
|
if (lWebPackConfigFileName) {
|
|
32
|
-
|
|
26
|
+
const extractWebpackResolveConfig = await import(
|
|
27
|
+
"../config-utl/extract-webpack-resolve-config.mjs"
|
|
28
|
+
);
|
|
29
|
+
lResolveOptions = await extractWebpackResolveConfig.default(
|
|
33
30
|
lWebPackConfigFileName,
|
|
34
31
|
pCruiseOptions?.ruleSet?.options?.webpackConfig?.env ?? null,
|
|
35
32
|
pCruiseOptions?.ruleSet?.options?.webpackConfig?.arguments ?? null
|
|
@@ -38,9 +35,12 @@ async function extractResolveOptions(pCruiseOptions) {
|
|
|
38
35
|
return lResolveOptions;
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
function addKnownViolations(pCruiseOptions) {
|
|
38
|
+
async function addKnownViolations(pCruiseOptions) {
|
|
42
39
|
if (pCruiseOptions.knownViolationsFile) {
|
|
43
|
-
const
|
|
40
|
+
const extractKnownViolations = await import(
|
|
41
|
+
"../config-utl/extract-known-violations.mjs"
|
|
42
|
+
);
|
|
43
|
+
const lKnownViolations = extractKnownViolations.default(
|
|
44
44
|
pCruiseOptions.knownViolationsFile
|
|
45
45
|
);
|
|
46
46
|
|
|
@@ -53,25 +53,28 @@ function addKnownViolations(pCruiseOptions) {
|
|
|
53
53
|
return pCruiseOptions;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
function extractTSConfigOptions(pCruiseOptions) {
|
|
56
|
+
async function extractTSConfigOptions(pCruiseOptions) {
|
|
57
57
|
let lReturnValue = {};
|
|
58
58
|
const lTSConfigFileName =
|
|
59
59
|
pCruiseOptions?.ruleSet?.options?.tsConfig?.fileName ?? null;
|
|
60
60
|
|
|
61
61
|
if (lTSConfigFileName) {
|
|
62
|
-
|
|
62
|
+
const extractTSConfig = await import("../config-utl/extract-ts-config.mjs");
|
|
63
|
+
lReturnValue = extractTSConfig.default(lTSConfigFileName);
|
|
63
64
|
}
|
|
64
65
|
|
|
65
66
|
return lReturnValue;
|
|
66
67
|
}
|
|
67
68
|
|
|
68
|
-
function extractBabelConfigOptions(pCruiseOptions) {
|
|
69
|
+
async function extractBabelConfigOptions(pCruiseOptions) {
|
|
69
70
|
let lReturnValue = {};
|
|
70
71
|
const lBabelConfigFileName =
|
|
71
72
|
pCruiseOptions?.ruleSet?.options?.babelConfig?.fileName ?? null;
|
|
72
|
-
|
|
73
73
|
if (lBabelConfigFileName) {
|
|
74
|
-
|
|
74
|
+
const extractBabelConfig = await import(
|
|
75
|
+
"../config-utl/extract-babel-config.mjs"
|
|
76
|
+
);
|
|
77
|
+
lReturnValue = extractBabelConfig.default(lBabelConfigFileName);
|
|
75
78
|
}
|
|
76
79
|
|
|
77
80
|
return lReturnValue;
|
|
@@ -99,7 +102,7 @@ function setUpListener(pCruiseOptions) {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
async function runCruise(pFileDirectoryArray, pCruiseOptions) {
|
|
102
|
-
const lCruiseOptions = addKnownViolations(
|
|
105
|
+
const lCruiseOptions = await addKnownViolations(
|
|
103
106
|
await normalizeCliOptions(pCruiseOptions)
|
|
104
107
|
);
|
|
105
108
|
|
|
@@ -120,7 +123,7 @@ async function runCruise(pFileDirectoryArray, pCruiseOptions) {
|
|
|
120
123
|
lCruiseOptions,
|
|
121
124
|
await extractResolveOptions(lCruiseOptions),
|
|
122
125
|
{
|
|
123
|
-
tsConfig: extractTSConfigOptions(lCruiseOptions),
|
|
126
|
+
tsConfig: await extractTSConfigOptions(lCruiseOptions),
|
|
124
127
|
babelConfig: await extractBabelConfigOptions(lCruiseOptions),
|
|
125
128
|
}
|
|
126
129
|
);
|
|
@@ -159,9 +162,11 @@ export default async function executeCli(pFileDirectoryArray, pCruiseOptions) {
|
|
|
159
162
|
}
|
|
160
163
|
/* c8 ignore stop */
|
|
161
164
|
if (lCruiseOptions.info === true) {
|
|
162
|
-
|
|
165
|
+
const formatMetaInfo = await import("./format-meta-info.mjs");
|
|
166
|
+
process.stdout.write(await formatMetaInfo.default());
|
|
163
167
|
} else if (lCruiseOptions.init) {
|
|
164
|
-
initConfig(
|
|
168
|
+
const initConfig = await import("./init-config/index.mjs");
|
|
169
|
+
initConfig.default(lCruiseOptions.init);
|
|
165
170
|
} else {
|
|
166
171
|
lExitCode = await runCruise(pFileDirectoryArray, lCruiseOptions);
|
|
167
172
|
}
|
|
@@ -90,6 +90,10 @@ function gatherScannableFilesFromDirectory(pDirectoryName, pOptions) {
|
|
|
90
90
|
export default function gatherInitialSources(pFileAndDirectoryArray, pOptions) {
|
|
91
91
|
const lOptions = { baseDir: process.cwd(), ...pOptions };
|
|
92
92
|
|
|
93
|
+
// these are `.reduce`s and not `.map`s because they typically return larger
|
|
94
|
+
// arrays than the pFileAndDirectoryArray:
|
|
95
|
+
// - `glob` returns an array of strings
|
|
96
|
+
// - so does `gatherScannableFilesFromDirectory`
|
|
93
97
|
return pFileAndDirectoryArray
|
|
94
98
|
.reduce(
|
|
95
99
|
(pAll, pFileOrDirectory) =>
|
package/src/main/index.mjs
CHANGED
|
@@ -3,18 +3,14 @@
|
|
|
3
3
|
|
|
4
4
|
import Ajv from "ajv";
|
|
5
5
|
|
|
6
|
-
import extract from "../extract/index.mjs";
|
|
7
|
-
import enrich from "../enrich/index.mjs";
|
|
8
6
|
import cruiseResultSchema from "../schema/cruise-result.schema.mjs";
|
|
9
7
|
import bus from "../utl/bus.mjs";
|
|
10
|
-
import Cache from "../cache/cache.mjs";
|
|
11
8
|
import {
|
|
12
9
|
allExtensions,
|
|
13
10
|
getAvailableTranspilers,
|
|
14
11
|
} from "../extract/transpile/meta.mjs";
|
|
15
12
|
import normalizeFilesAndDirectories from "./files-and-dirs/normalize.mjs";
|
|
16
13
|
import validateRuleSet from "./rule-set/validate.mjs";
|
|
17
|
-
import normalizeRuleSet from "./rule-set/normalize.mjs";
|
|
18
14
|
import {
|
|
19
15
|
validateCruiseOptions,
|
|
20
16
|
validateFormatOptions,
|
|
@@ -23,7 +19,6 @@ import {
|
|
|
23
19
|
normalizeCruiseOptions,
|
|
24
20
|
normalizeFormatOptions,
|
|
25
21
|
} from "./options/normalize.mjs";
|
|
26
|
-
import normalizeResolveOptions from "./resolve-options/normalize.mjs";
|
|
27
22
|
import reportWrap from "./report-wrap.mjs";
|
|
28
23
|
|
|
29
24
|
const TOTAL_STEPS = 9;
|
|
@@ -74,6 +69,8 @@ export async function cruise(
|
|
|
74
69
|
c(2)
|
|
75
70
|
);
|
|
76
71
|
|
|
72
|
+
const CacheModule = await import("../cache/cache.mjs");
|
|
73
|
+
const Cache = CacheModule.default;
|
|
77
74
|
lCache = new Cache(lCruiseOptions.cache.strategy);
|
|
78
75
|
const lCachedResults = lCache.read(lCruiseOptions.cache.folder);
|
|
79
76
|
|
|
@@ -85,7 +82,8 @@ export async function cruise(
|
|
|
85
82
|
|
|
86
83
|
if (Boolean(lCruiseOptions.ruleSet)) {
|
|
87
84
|
bus.emit("progress", "parsing rule set", c(3));
|
|
88
|
-
|
|
85
|
+
const normalizeRuleSet = await import("./rule-set/normalize.mjs");
|
|
86
|
+
lCruiseOptions.ruleSet = normalizeRuleSet.default(
|
|
89
87
|
validateRuleSet(lCruiseOptions.ruleSet)
|
|
90
88
|
);
|
|
91
89
|
}
|
|
@@ -95,14 +93,16 @@ export async function cruise(
|
|
|
95
93
|
);
|
|
96
94
|
|
|
97
95
|
bus.emit("progress", "determining how to resolve", c(4));
|
|
98
|
-
|
|
96
|
+
let normalizeResolveOptions = await import("./resolve-options/normalize.mjs");
|
|
97
|
+
const lNormalizedResolveOptions = await normalizeResolveOptions.default(
|
|
99
98
|
pResolveOptions,
|
|
100
99
|
lCruiseOptions,
|
|
101
100
|
pTranspileOptions?.tsConfig
|
|
102
101
|
);
|
|
103
102
|
|
|
104
103
|
bus.emit("progress", "reading files", c(5));
|
|
105
|
-
const
|
|
104
|
+
const extract = await import("../extract/index.mjs");
|
|
105
|
+
const lExtractionResult = extract.default(
|
|
106
106
|
lNormalizedFileAndDirectoryArray,
|
|
107
107
|
lCruiseOptions,
|
|
108
108
|
lNormalizedResolveOptions,
|
|
@@ -110,7 +110,8 @@ export async function cruise(
|
|
|
110
110
|
);
|
|
111
111
|
|
|
112
112
|
bus.emit("progress", "analyzing", c(6));
|
|
113
|
-
const
|
|
113
|
+
const enrich = await import("../enrich/index.mjs");
|
|
114
|
+
const lCruiseResult = enrich.default(
|
|
114
115
|
lExtractionResult,
|
|
115
116
|
lCruiseOptions,
|
|
116
117
|
lNormalizedFileAndDirectoryArray
|
package/src/meta.js
CHANGED
package/src/report/index.mjs
CHANGED
|
@@ -1,45 +1,25 @@
|
|
|
1
|
-
import anon from "./anon/index.mjs";
|
|
2
|
-
import csv from "./csv.mjs";
|
|
3
|
-
import dotBase from "./dot/index.mjs";
|
|
4
|
-
import errorHtml from "./error-html/index.mjs";
|
|
5
|
-
import error from "./error.mjs";
|
|
6
|
-
import errorLong from "./error-long.mjs";
|
|
7
|
-
import html from "./html/index.mjs";
|
|
8
|
-
import identity from "./identity.mjs";
|
|
9
|
-
import json from "./json.mjs";
|
|
10
|
-
import teamcity from "./teamcity.mjs";
|
|
11
|
-
import text from "./text.mjs";
|
|
12
|
-
import baseline from "./baseline.mjs";
|
|
13
|
-
import metrics from "./metrics.mjs";
|
|
14
1
|
import { getExternalPluginReporter } from "./plugins.mjs";
|
|
15
|
-
import markdown from "./markdown.mjs";
|
|
16
|
-
import mermaid from "./mermaid.mjs";
|
|
17
2
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
dot,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
teamcity,
|
|
39
|
-
text,
|
|
40
|
-
baseline,
|
|
41
|
-
metrics,
|
|
42
|
-
mermaid,
|
|
3
|
+
const TYPE2MODULE = {
|
|
4
|
+
anon: "./anon/index.mjs",
|
|
5
|
+
csv: "./csv.mjs",
|
|
6
|
+
dot: "./dot/dot-module.mjs",
|
|
7
|
+
ddot: "./dot/dot-folder.mjs",
|
|
8
|
+
cdot: "./dot/dot-custom.mjs",
|
|
9
|
+
archi: "./dot/dot-custom.mjs",
|
|
10
|
+
fdot: "./dot/dot-flat.mjs",
|
|
11
|
+
flat: "./dot/dot-flat.mjs",
|
|
12
|
+
"err-html": "./error-html/index.mjs",
|
|
13
|
+
markdown: "./markdown.mjs",
|
|
14
|
+
"err-long": "./error-long.mjs",
|
|
15
|
+
err: "./error.mjs",
|
|
16
|
+
html: "./html/index.mjs",
|
|
17
|
+
json: "./json.mjs",
|
|
18
|
+
teamcity: "./teamcity.mjs",
|
|
19
|
+
text: "./text.mjs",
|
|
20
|
+
baseline: "./baseline.mjs",
|
|
21
|
+
metrics: "./metrics.mjs",
|
|
22
|
+
mermaid: "./mermaid.mjs",
|
|
43
23
|
};
|
|
44
24
|
|
|
45
25
|
/**
|
|
@@ -52,12 +32,17 @@ const TYPE2REPORTER = {
|
|
|
52
32
|
* and returns an IReporterOutput
|
|
53
33
|
*/
|
|
54
34
|
async function getReporter(pOutputType) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
let lReturnValue = {};
|
|
36
|
+
if (pOutputType?.startsWith("plugin:")) {
|
|
37
|
+
lReturnValue = await getExternalPluginReporter(pOutputType);
|
|
38
|
+
} else {
|
|
39
|
+
const lModuleToImport =
|
|
40
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
41
|
+
TYPE2MODULE[pOutputType] || "./identity.mjs";
|
|
42
|
+
const lModule = await import(lModuleToImport);
|
|
43
|
+
lReturnValue = lModule.default;
|
|
44
|
+
}
|
|
45
|
+
return lReturnValue;
|
|
61
46
|
}
|
|
62
47
|
|
|
63
48
|
/**
|
|
@@ -66,7 +51,7 @@ async function getReporter(pOutputType) {
|
|
|
66
51
|
* @returns {import("../../types/shared-types.js").OutputType[]} -
|
|
67
52
|
*/
|
|
68
53
|
function getAvailableReporters() {
|
|
69
|
-
return Object.keys(
|
|
54
|
+
return Object.keys(TYPE2MODULE);
|
|
70
55
|
}
|
|
71
56
|
|
|
72
57
|
export default {
|