dependency-cruiser 14.1.0 → 14.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/depcruise-baseline.mjs +3 -3
- package/bin/depcruise-fmt.mjs +3 -3
- package/bin/dependency-cruise.mjs +3 -3
- package/bin/wrap-stream-in-html.mjs +1 -1
- package/package.json +23 -16
- package/src/cache/cache.mjs +12 -10
- package/src/cache/find-content-changes.mjs +9 -7
- package/src/cache/helpers.mjs +4 -4
- package/src/cache/metadata-strategy.mjs +5 -4
- package/src/cli/assert-node-environment-suitable.mjs +1 -1
- package/src/cli/format-meta-info.mjs +4 -4
- package/src/cli/format.mjs +1 -1
- package/src/cli/index.mjs +7 -9
- package/src/cli/init-config/find-extensions.mjs +7 -4
- package/src/cli/init-config/normalize-init-options.mjs +1 -1
- package/src/cli/init-config/write-run-scripts-to-manifest.mjs +1 -1
- package/src/cli/listeners/cli-feedback.mjs +5 -5
- package/src/cli/listeners/ndjson.mjs +2 -2
- package/src/cli/listeners/performance-log/format-helpers.mjs +7 -8
- package/src/cli/listeners/performance-log/index.mjs +3 -3
- package/src/cli/normalize-cli-options.mjs +10 -11
- package/src/config-utl/extract-babel-config.mjs +5 -5
- package/src/config-utl/extract-depcruise-config/index.mjs +12 -13
- package/src/config-utl/extract-ts-config.mjs +7 -7
- package/src/enrich/add-validations.mjs +2 -2
- package/src/enrich/derive/folders/aggregate-to-folders.mjs +12 -10
- package/src/enrich/derive/folders/index.mjs +3 -3
- package/src/enrich/derive/metrics/get-module-metrics.mjs +4 -4
- package/src/enrich/derive/reachable.mjs +15 -16
- package/src/enrich/enrich-modules.mjs +3 -3
- package/src/enrich/soften-known-violations.mjs +16 -16
- package/src/enrich/summarize/add-rule-set-used.mjs +2 -4
- package/src/enrich/summarize/index.mjs +2 -2
- package/src/enrich/summarize/summarize-folders.mjs +2 -2
- package/src/enrich/summarize/summarize-modules.mjs +14 -14
- package/src/extract/ast-extractors/extract-typescript-deps.mjs +8 -8
- package/src/extract/ast-extractors/swc-dependency-visitor.mjs +4 -4
- package/src/extract/gather-initial-sources.mjs +3 -3
- package/src/extract/get-dependencies.mjs +20 -20
- package/src/extract/index.mjs +17 -16
- package/src/extract/parse/to-javascript-ast.mjs +3 -3
- package/src/extract/parse/to-swc-ast.mjs +1 -1
- package/src/extract/parse/to-typescript-ast.mjs +5 -5
- package/src/extract/resolve/index.mjs +1 -1
- package/src/extract/resolve/merge-manifests.mjs +8 -7
- package/src/extract/resolve/module-classifiers.mjs +7 -7
- package/src/extract/resolve/resolve-amd.mjs +1 -1
- package/src/extract/resolve/resolve-cjs.mjs +1 -1
- package/src/extract/resolve/resolve.mjs +4 -4
- package/src/extract/transpile/babel-wrap.mjs +1 -1
- package/src/extract/transpile/coffeescript-wrap.mjs +3 -3
- package/src/extract/transpile/livescript-wrap.mjs +2 -2
- package/src/extract/transpile/meta.mjs +5 -5
- package/src/extract/transpile/svelte-wrap.mjs +3 -3
- package/src/extract/transpile/typescript-wrap.mjs +3 -3
- package/src/extract/transpile/vue-template-wrap.cjs +3 -3
- package/src/graph-utl/consolidate-module-dependencies.mjs +4 -5
- package/src/graph-utl/consolidate-modules.mjs +3 -4
- package/src/graph-utl/filter-bank.mjs +5 -6
- package/src/main/cruise.mjs +5 -6
- package/src/main/format.mjs +1 -1
- package/src/main/helpers.mjs +3 -4
- package/src/main/index.d.ts +1 -1
- package/src/main/index.mjs +4 -4
- package/src/main/options/assert-validity.mjs +1 -1
- package/src/main/options/normalize.mjs +6 -7
- package/src/main/report-wrap.mjs +8 -8
- package/src/main/resolve-options/normalize.mjs +2 -2
- package/src/main/rule-set/assert-validity.mjs +1 -1
- package/src/main/rule-set/normalize.mjs +1 -2
- package/src/meta.js +1 -1
- package/src/report/anon/index.mjs +5 -6
- package/src/report/dot/index.mjs +1 -1
- package/src/report/dot/prepare-custom-level.mjs +4 -4
- package/src/report/dot/prepare-flat-level.mjs +1 -1
- package/src/report/dot/prepare-folder-level.mjs +3 -3
- package/src/report/dot/theming.mjs +5 -6
- package/src/report/error-html/index.mjs +1 -1
- package/src/report/error-html/utl.mjs +1 -1
- package/src/report/error.mjs +15 -15
- package/src/report/markdown.mjs +7 -7
- package/src/validate/index.d.ts +0 -2
- package/src/validate/match-dependency-rule.mjs +2 -2
- package/src/validate/match-folder-dependency-rule.mjs +6 -4
- package/src/validate/match-module-rule.mjs +5 -5
- package/src/validate/matchers.mjs +17 -17
- package/src/validate/violates-required-rule.mjs +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { program } from "commander";
|
|
3
|
-
import assertNodeEnvironmentSuitable from "
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
|
|
4
|
+
import cli from "#cli/index.mjs";
|
|
5
|
+
import meta from "#meta.js";
|
|
6
6
|
|
|
7
7
|
function formatError(pError) {
|
|
8
8
|
process.stderr.write(pError.message);
|
package/bin/depcruise-fmt.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { program } from "commander";
|
|
4
|
-
import assertNodeEnvironmentSuitable from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
|
|
5
|
+
import format from "#cli/format.mjs";
|
|
6
|
+
import meta from "#meta.js";
|
|
7
7
|
|
|
8
8
|
function formatError(pError) {
|
|
9
9
|
process.stderr.write(pError.message);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { EOL } from "node:os";
|
|
3
3
|
import { program } from "commander";
|
|
4
|
-
import assertNodeEnvironmentSuitable from "
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import assertNodeEnvironmentSuitable from "#cli/assert-node-environment-suitable.mjs";
|
|
5
|
+
import cli from "#cli/index.mjs";
|
|
6
|
+
import meta from "#meta.js";
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
9
|
assertNodeEnvironmentSuitable();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dependency-cruiser",
|
|
3
|
-
"version": "14.1.
|
|
3
|
+
"version": "14.1.2",
|
|
4
4
|
"description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"static analysis",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"license": "MIT",
|
|
30
30
|
"repository": {
|
|
31
31
|
"type": "git",
|
|
32
|
-
"url": "git+https://github.com/sverweij/dependency-cruiser"
|
|
32
|
+
"url": "git+https://github.com/sverweij/dependency-cruiser.git"
|
|
33
33
|
},
|
|
34
34
|
"bugs": {
|
|
35
35
|
"url": "https://github.com/sverweij/dependency-cruiser/issues"
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
"depcruise-wrap-stream-in-html": "bin/wrap-stream-in-html.mjs"
|
|
45
45
|
},
|
|
46
46
|
"main": "src/main/index.mjs",
|
|
47
|
+
"imports": {
|
|
48
|
+
"#configuration-schema": "./src/schema/configuration.schema.mjs",
|
|
49
|
+
"#cruise-result-schema": "./src/schema/cruise-result.schema.mjs",
|
|
50
|
+
"#*": "./src/*"
|
|
51
|
+
},
|
|
47
52
|
"exports": {
|
|
48
53
|
".": {
|
|
49
54
|
"import": "./src/main/index.mjs",
|
|
@@ -155,7 +160,7 @@
|
|
|
155
160
|
"acorn-walk": "8.2.0",
|
|
156
161
|
"ajv": "8.12.0",
|
|
157
162
|
"chalk": "5.3.0",
|
|
158
|
-
"commander": "11.
|
|
163
|
+
"commander": "11.1.0",
|
|
159
164
|
"enhanced-resolve": "5.15.0",
|
|
160
165
|
"figures": "5.0.0",
|
|
161
166
|
"ignore": "5.2.4",
|
|
@@ -172,23 +177,23 @@
|
|
|
172
177
|
"semver-try-require": "6.2.3",
|
|
173
178
|
"teamcity-service-messages": "0.1.14",
|
|
174
179
|
"tsconfig-paths-webpack-plugin": "4.1.0",
|
|
175
|
-
"watskeburt": "
|
|
180
|
+
"watskeburt": "2.0.0",
|
|
176
181
|
"wrap-ansi": "8.1.0"
|
|
177
182
|
},
|
|
178
183
|
"devDependencies": {
|
|
179
|
-
"@babel/core": "7.23.
|
|
184
|
+
"@babel/core": "7.23.2",
|
|
180
185
|
"@babel/plugin-transform-modules-commonjs": "7.23.0",
|
|
181
|
-
"@babel/preset-typescript": "7.23.
|
|
182
|
-
"@swc/core": "1.3.
|
|
186
|
+
"@babel/preset-typescript": "7.23.2",
|
|
187
|
+
"@swc/core": "1.3.93",
|
|
183
188
|
"@types/lodash": "4.14.199",
|
|
184
|
-
"@types/node": "20.8.
|
|
185
|
-
"@types/prompts": "2.4.
|
|
186
|
-
"@typescript-eslint/eslint-plugin": "6.
|
|
187
|
-
"@typescript-eslint/parser": "6.
|
|
189
|
+
"@types/node": "20.8.6",
|
|
190
|
+
"@types/prompts": "2.4.6",
|
|
191
|
+
"@typescript-eslint/eslint-plugin": "6.8.0",
|
|
192
|
+
"@typescript-eslint/parser": "6.8.0",
|
|
188
193
|
"@vue/compiler-sfc": "3.3.4",
|
|
189
194
|
"c8": "8.0.1",
|
|
190
195
|
"coffeescript": "2.7.0",
|
|
191
|
-
"eslint": "8.
|
|
196
|
+
"eslint": "8.51.0",
|
|
192
197
|
"eslint-config-moving-meadow": "4.0.2",
|
|
193
198
|
"eslint-config-prettier": "9.0.0",
|
|
194
199
|
"eslint-plugin-budapestian": "5.0.1",
|
|
@@ -200,7 +205,7 @@
|
|
|
200
205
|
"eslint-plugin-unicorn": "^48.0.1",
|
|
201
206
|
"husky": "8.0.3",
|
|
202
207
|
"intercept-stdout": "0.1.2",
|
|
203
|
-
"lint-staged": "
|
|
208
|
+
"lint-staged": "15.0.1",
|
|
204
209
|
"mocha": "10.2.0",
|
|
205
210
|
"normalize-newline": "4.1.0",
|
|
206
211
|
"npm-run-all": "4.1.5",
|
|
@@ -210,15 +215,17 @@
|
|
|
210
215
|
"svelte": "3.59.1",
|
|
211
216
|
"symlink-dir": "5.2.0",
|
|
212
217
|
"typescript": "5.2.2",
|
|
213
|
-
"upem": "
|
|
218
|
+
"upem": "9.0.2",
|
|
214
219
|
"vue-template-compiler": "2.7.14",
|
|
215
220
|
"yarn": "1.22.19"
|
|
216
221
|
},
|
|
217
222
|
"overrides": {
|
|
218
|
-
"semver": "^7.5.4"
|
|
223
|
+
"semver": "^7.5.4",
|
|
224
|
+
"postcss": "^8.4.31"
|
|
219
225
|
},
|
|
220
226
|
"resolutions": {
|
|
221
|
-
"semver": "^7.5.4"
|
|
227
|
+
"semver": "^7.5.4",
|
|
228
|
+
"postcss": "^8.4.31"
|
|
222
229
|
},
|
|
223
230
|
"upem": {
|
|
224
231
|
"policies": [
|
package/src/cache/cache.mjs
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { readFile, mkdir, writeFile } from "node:fs/promises";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
import { scannableExtensions } from "../extract/transpile/meta.mjs";
|
|
5
|
-
import { bus } from "../utl/bus.mjs";
|
|
6
4
|
import { optionsAreCompatible } from "./options-compatible.mjs";
|
|
7
5
|
import MetadataStrategy from "./metadata-strategy.mjs";
|
|
8
6
|
import ContentStrategy from "./content-strategy.mjs";
|
|
7
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
8
|
+
import { scannableExtensions } from "#extract/transpile/meta.mjs";
|
|
9
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
10
|
+
import { bus } from "#utl/bus.mjs";
|
|
9
11
|
|
|
10
12
|
const CACHE_FILE_NAME = "cache.json";
|
|
11
13
|
|
|
@@ -36,19 +38,19 @@ export default class Cache {
|
|
|
36
38
|
pCruiseOptions,
|
|
37
39
|
{
|
|
38
40
|
extensions: new Set(
|
|
39
|
-
scannableExtensions.concat(pCruiseOptions.extraExtensionsToScan)
|
|
41
|
+
scannableExtensions.concat(pCruiseOptions.extraExtensionsToScan),
|
|
40
42
|
),
|
|
41
|
-
}
|
|
43
|
+
},
|
|
42
44
|
));
|
|
43
45
|
bus.debug("cache: - comparing");
|
|
44
46
|
return (
|
|
45
47
|
this.cacheStrategy.revisionDataEqual(
|
|
46
48
|
pCachedCruiseResult.revisionData,
|
|
47
|
-
this.revisionData
|
|
49
|
+
this.revisionData,
|
|
48
50
|
) &&
|
|
49
51
|
optionsAreCompatible(
|
|
50
52
|
pCachedCruiseResult.summary.optionsUsed,
|
|
51
|
-
pCruiseOptions
|
|
53
|
+
pCruiseOptions,
|
|
52
54
|
)
|
|
53
55
|
);
|
|
54
56
|
}
|
|
@@ -60,7 +62,7 @@ export default class Cache {
|
|
|
60
62
|
async read(pCacheFolder) {
|
|
61
63
|
try {
|
|
62
64
|
return JSON.parse(
|
|
63
|
-
await readFile(join(pCacheFolder, CACHE_FILE_NAME), "utf8")
|
|
65
|
+
await readFile(join(pCacheFolder, CACHE_FILE_NAME), "utf8"),
|
|
64
66
|
);
|
|
65
67
|
} catch (pError) {
|
|
66
68
|
return { modules: [], summary: {} };
|
|
@@ -81,10 +83,10 @@ export default class Cache {
|
|
|
81
83
|
JSON.stringify(
|
|
82
84
|
this.cacheStrategy.prepareRevisionDataForSaving(
|
|
83
85
|
pCruiseResult,
|
|
84
|
-
lRevisionData
|
|
85
|
-
)
|
|
86
|
+
lRevisionData,
|
|
87
|
+
),
|
|
86
88
|
),
|
|
87
|
-
"utf8"
|
|
89
|
+
"utf8",
|
|
88
90
|
);
|
|
89
91
|
}
|
|
90
92
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-inline-comments */
|
|
2
2
|
// @ts-check
|
|
3
3
|
import { join } from "node:path/posix";
|
|
4
|
-
import { bus } from "../utl/bus.mjs";
|
|
5
|
-
import findAllFiles from "../utl/find-all-files.mjs";
|
|
6
4
|
import {
|
|
7
5
|
getFileHashSync,
|
|
8
6
|
excludeFilter,
|
|
@@ -10,6 +8,10 @@ import {
|
|
|
10
8
|
hasInterestingExtension,
|
|
11
9
|
moduleIsInterestingForDiff,
|
|
12
10
|
} from "./helpers.mjs";
|
|
11
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
12
|
+
import { bus } from "#utl/bus.mjs";
|
|
13
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
14
|
+
import findAllFiles from "#utl/find-all-files.mjs";
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* @param {Set<string>} pFileSet
|
|
@@ -19,7 +21,7 @@ import {
|
|
|
19
21
|
function diffCachedModuleAgainstFileSet(
|
|
20
22
|
pFileSet,
|
|
21
23
|
pBaseDirectory,
|
|
22
|
-
pFileHashFunction = getFileHashSync
|
|
24
|
+
pFileHashFunction = getFileHashSync,
|
|
23
25
|
) {
|
|
24
26
|
return (pModule) => {
|
|
25
27
|
if (!moduleIsInterestingForDiff(pModule)) {
|
|
@@ -31,7 +33,7 @@ function diffCachedModuleAgainstFileSet(
|
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
const lNewCheckSum = pFileHashFunction(
|
|
34
|
-
join(pBaseDirectory, pModule.source)
|
|
36
|
+
join(pBaseDirectory, pModule.source),
|
|
35
37
|
);
|
|
36
38
|
if (lNewCheckSum !== pModule.checksum) {
|
|
37
39
|
return {
|
|
@@ -72,7 +74,7 @@ function diffCachedModuleAgainstFileSet(
|
|
|
72
74
|
export default function findContentChanges(
|
|
73
75
|
pDirectory,
|
|
74
76
|
pCachedCruiseResult,
|
|
75
|
-
pOptions
|
|
77
|
+
pOptions,
|
|
76
78
|
) {
|
|
77
79
|
bus.debug("cache: - getting revision data");
|
|
78
80
|
const lFileSet = new Set(
|
|
@@ -80,12 +82,12 @@ export default function findContentChanges(
|
|
|
80
82
|
baseDir: pOptions.baseDir,
|
|
81
83
|
excludeFilterFn: excludeFilter(pOptions.exclude),
|
|
82
84
|
includeOnlyFilterFn: includeOnlyFilter(pOptions.includeOnly),
|
|
83
|
-
}).filter(hasInterestingExtension(pOptions.extensions))
|
|
85
|
+
}).filter(hasInterestingExtension(pOptions.extensions)),
|
|
84
86
|
);
|
|
85
87
|
|
|
86
88
|
bus.debug("cache: - getting (cached - new)");
|
|
87
89
|
const lDiffCachedVsNew = pCachedCruiseResult.modules.map(
|
|
88
|
-
diffCachedModuleAgainstFileSet(lFileSet, pOptions.baseDir)
|
|
90
|
+
diffCachedModuleAgainstFileSet(lFileSet, pOptions.baseDir),
|
|
89
91
|
);
|
|
90
92
|
|
|
91
93
|
bus.debug("cache: - getting (new - cached)");
|
package/src/cache/helpers.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { readFileSync } from "node:fs";
|
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
5
5
|
import { extname } from "node:path";
|
|
6
6
|
import memoize from "lodash/memoize.js";
|
|
7
|
-
import { filenameMatchesPattern } from "
|
|
7
|
+
import { filenameMatchesPattern } from "#graph-utl/match-facade.mjs";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param {string} pString
|
|
@@ -101,10 +101,10 @@ export function hasInterestingExtension(pExtensions) {
|
|
|
101
101
|
export function changeHasInterestingExtension(pExtensions) {
|
|
102
102
|
return (pChange) => {
|
|
103
103
|
const lNameHasInterestingExtension = hasInterestingExtension(pExtensions)(
|
|
104
|
-
pChange.name
|
|
104
|
+
pChange.name,
|
|
105
105
|
);
|
|
106
106
|
const lOldNameHasInterestingExtension = Boolean(
|
|
107
|
-
pChange.oldName && hasInterestingExtension(pExtensions)(pChange.oldName)
|
|
107
|
+
pChange.oldName && hasInterestingExtension(pExtensions)(pChange.oldName),
|
|
108
108
|
);
|
|
109
109
|
return lNameHasInterestingExtension || lOldNameHasInterestingExtension;
|
|
110
110
|
};
|
|
@@ -128,7 +128,7 @@ const DEFAULT_INTERESTING_CHANGE_TYPES = new Set([
|
|
|
128
128
|
export function isInterestingChangeType(pInterestingChangeTypes) {
|
|
129
129
|
return (pChange) =>
|
|
130
130
|
(pInterestingChangeTypes ?? DEFAULT_INTERESTING_CHANGE_TYPES).has(
|
|
131
|
-
pChange.changeType
|
|
131
|
+
pChange.changeType,
|
|
132
132
|
);
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
// @ts-check
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
import { getSHA, list } from "watskeburt";
|
|
5
|
-
import { bus } from "../utl/bus.mjs";
|
|
6
5
|
import {
|
|
7
6
|
isInterestingChangeType,
|
|
8
7
|
addCheckSumToChangeSync,
|
|
@@ -10,6 +9,8 @@ import {
|
|
|
10
9
|
includeOnlyFilter,
|
|
11
10
|
changeHasInterestingExtension,
|
|
12
11
|
} from "./helpers.mjs";
|
|
12
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
13
|
+
import { bus } from "#utl/bus.mjs";
|
|
13
14
|
|
|
14
15
|
export default class MetaDataStrategy {
|
|
15
16
|
/**
|
|
@@ -27,7 +28,7 @@ export default class MetaDataStrategy {
|
|
|
27
28
|
_pDirectory,
|
|
28
29
|
_pCachedCruiseResult,
|
|
29
30
|
pCruiseOptions,
|
|
30
|
-
pOptions
|
|
31
|
+
pOptions,
|
|
31
32
|
) {
|
|
32
33
|
const lOptions = {
|
|
33
34
|
shaRetrievalFn: getSHA,
|
|
@@ -45,7 +46,7 @@ export default class MetaDataStrategy {
|
|
|
45
46
|
const lChanges = lDiff
|
|
46
47
|
.filter(({ name }) => excludeFilter(pCruiseOptions.exclude)(name))
|
|
47
48
|
.filter(({ name }) =>
|
|
48
|
-
includeOnlyFilter(pCruiseOptions.includeOnly)(name)
|
|
49
|
+
includeOnlyFilter(pCruiseOptions.includeOnly)(name),
|
|
49
50
|
)
|
|
50
51
|
.filter(changeHasInterestingExtension(lOptions.extensions))
|
|
51
52
|
.filter(isInterestingChangeType(lOptions.interestingChangeTypes));
|
|
@@ -56,7 +57,7 @@ export default class MetaDataStrategy {
|
|
|
56
57
|
};
|
|
57
58
|
} catch (pError) {
|
|
58
59
|
throw new Error(
|
|
59
|
-
`The --cache option works in concert with git - and it seems either the current folder isn't version managed or git isn't installed. Error:${`\n\n ${pError}\n`}
|
|
60
|
+
`The --cache option works in concert with git - and it seems either the current folder isn't version managed or git isn't installed. Error:${`\n\n ${pError}\n`}`,
|
|
60
61
|
);
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import figures from "figures";
|
|
3
3
|
|
|
4
|
-
import { getAvailableTranspilers, allExtensions } from "
|
|
4
|
+
import { getAvailableTranspilers, allExtensions } from "#main/index.mjs";
|
|
5
5
|
|
|
6
6
|
function bool2Symbol(pBool) {
|
|
7
7
|
return pBool ? chalk.green(figures.tick) : chalk.red(figures.cross);
|
|
@@ -13,7 +13,7 @@ function formatTranspilers() {
|
|
|
13
13
|
`${pAll} ${bool2Symbol(pThis.available)} ${pThis.name} (${
|
|
14
14
|
pThis.version
|
|
15
15
|
})\n`,
|
|
16
|
-
` ${bool2Symbol(true)} javascript (>es1)\n
|
|
16
|
+
` ${bool2Symbol(true)} javascript (>es1)\n`,
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -21,7 +21,7 @@ function formatExtensions(pExtensions) {
|
|
|
21
21
|
return pExtensions.reduce(
|
|
22
22
|
(pAll, pThis) =>
|
|
23
23
|
`${pAll} ${bool2Symbol(pThis.available)} ${pThis.extension}\n`,
|
|
24
|
-
""
|
|
24
|
+
"",
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ export default function formatMetaInfo() {
|
|
|
30
30
|
Supported:
|
|
31
31
|
|
|
32
32
|
If you need a supported, but not enabled transpiler ('${chalk.red(
|
|
33
|
-
figures.cross
|
|
33
|
+
figures.cross,
|
|
34
34
|
)}' below), just install
|
|
35
35
|
it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript'
|
|
36
36
|
will enable livescript support if it's installed in your project folder.
|
package/src/cli/format.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import _format from "../main/format.mjs";
|
|
2
1
|
import assertFileExistence from "./utl/assert-file-existence.mjs";
|
|
3
2
|
import normalizeOptions from "./normalize-cli-options.mjs";
|
|
4
3
|
import { getInStream, write } from "./utl/io.mjs";
|
|
4
|
+
import _format from "#main/format.mjs";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
*
|
package/src/cli/index.mjs
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import picomatch from "picomatch";
|
|
3
|
-
import cloneDeep from "lodash/cloneDeep.js";
|
|
4
3
|
import set from "lodash/set.js";
|
|
5
4
|
import isInstalledGlobally from "is-installed-globally";
|
|
6
5
|
import chalk from "chalk";
|
|
7
6
|
|
|
8
|
-
import cruise from "../main/cruise.mjs";
|
|
9
|
-
import { INFO, bus } from "../utl/bus.mjs";
|
|
10
|
-
|
|
11
7
|
import assertFileExistence from "./utl/assert-file-existence.mjs";
|
|
12
8
|
import normalizeCliOptions from "./normalize-cli-options.mjs";
|
|
13
9
|
import { write } from "./utl/io.mjs";
|
|
14
10
|
import setUpCliFeedbackListener from "./listeners/cli-feedback.mjs";
|
|
15
11
|
import setUpPerformanceLogListener from "./listeners/performance-log/index.mjs";
|
|
16
12
|
import setUpNDJSONListener from "./listeners/ndjson.mjs";
|
|
13
|
+
import cruise from "#main/cruise.mjs";
|
|
14
|
+
import { INFO, bus } from "#utl/bus.mjs";
|
|
17
15
|
|
|
18
16
|
async function extractResolveOptions(pCruiseOptions) {
|
|
19
17
|
let lResolveOptions = {};
|
|
@@ -22,7 +20,7 @@ async function extractResolveOptions(pCruiseOptions) {
|
|
|
22
20
|
|
|
23
21
|
if (lWebPackConfigFileName) {
|
|
24
22
|
const { default: extractWebpackResolveConfig } = await import(
|
|
25
|
-
"
|
|
23
|
+
"#config-utl/extract-webpack-resolve-config.mjs"
|
|
26
24
|
);
|
|
27
25
|
lResolveOptions = await extractWebpackResolveConfig(
|
|
28
26
|
lWebPackConfigFileName,
|
|
@@ -36,7 +34,7 @@ async function extractResolveOptions(pCruiseOptions) {
|
|
|
36
34
|
async function addKnownViolations(pCruiseOptions) {
|
|
37
35
|
if (pCruiseOptions.knownViolationsFile) {
|
|
38
36
|
const { default: extractKnownViolations } = await import(
|
|
39
|
-
"
|
|
37
|
+
"#config-utl/extract-known-violations.mjs"
|
|
40
38
|
);
|
|
41
39
|
const lKnownViolations = await extractKnownViolations(
|
|
42
40
|
pCruiseOptions.knownViolationsFile,
|
|
@@ -44,7 +42,7 @@ async function addKnownViolations(pCruiseOptions) {
|
|
|
44
42
|
|
|
45
43
|
// Check against json schema is already done in src/main/options/validate
|
|
46
44
|
// so here we can just concentrate on the io
|
|
47
|
-
let lCruiseOptions =
|
|
45
|
+
let lCruiseOptions = structuredClone(pCruiseOptions);
|
|
48
46
|
set(lCruiseOptions, "ruleSet.options.knownViolations", lKnownViolations);
|
|
49
47
|
return lCruiseOptions;
|
|
50
48
|
}
|
|
@@ -58,7 +56,7 @@ async function extractTSConfigOptions(pCruiseOptions) {
|
|
|
58
56
|
|
|
59
57
|
if (lTSConfigFileName) {
|
|
60
58
|
const { default: extractTSConfig } = await import(
|
|
61
|
-
"
|
|
59
|
+
"#config-utl/extract-ts-config.mjs"
|
|
62
60
|
);
|
|
63
61
|
lReturnValue = extractTSConfig(lTSConfigFileName);
|
|
64
62
|
}
|
|
@@ -72,7 +70,7 @@ async function extractBabelConfigOptions(pCruiseOptions) {
|
|
|
72
70
|
pCruiseOptions?.ruleSet?.options?.babelConfig?.fileName ?? null;
|
|
73
71
|
if (lBabelConfigFileName) {
|
|
74
72
|
const { default: extractBabelConfig } = await import(
|
|
75
|
-
"
|
|
73
|
+
"#config-utl/extract-babel-config.mjs"
|
|
76
74
|
);
|
|
77
75
|
lReturnValue = extractBabelConfig(lBabelConfigFileName);
|
|
78
76
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/* eslint-disable security/detect-object-injection */
|
|
3
|
-
|
|
4
|
-
import { scannableExtensions } from "
|
|
5
|
-
|
|
3
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
4
|
+
import { scannableExtensions } from "#extract/transpile/meta.mjs";
|
|
5
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
6
|
+
import getExtension from "#utl/get-extension.mjs";
|
|
7
|
+
// @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
|
|
8
|
+
import findAllFiles from "#utl/find-all-files.mjs";
|
|
6
9
|
|
|
7
10
|
/**
|
|
8
11
|
* @param {Record<string,number>} pAll
|
|
@@ -42,7 +45,7 @@ export default function findExtensions(pDirectories, pOptions) {
|
|
|
42
45
|
ignoreFileContents: lOptions?.ignoreFileContents,
|
|
43
46
|
})
|
|
44
47
|
.map(getExtension)
|
|
45
|
-
.filter(Boolean)
|
|
48
|
+
.filter(Boolean),
|
|
46
49
|
)
|
|
47
50
|
.reduce(reduceToCounts, {});
|
|
48
51
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import has from "lodash/has.js";
|
|
2
|
-
import meta from "../../meta.js";
|
|
3
2
|
import {
|
|
4
3
|
getSourceFolderCandidates,
|
|
5
4
|
getTestFolderCandidates,
|
|
@@ -7,6 +6,7 @@ import {
|
|
|
7
6
|
toSourceLocationArray,
|
|
8
7
|
} from "./environment-helpers.mjs";
|
|
9
8
|
import findExtensions from "./find-extensions.mjs";
|
|
9
|
+
import meta from "#meta.js";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @param {import("./types.js").IInitConfig} pInitOptions
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { writeFileSync } from "node:fs";
|
|
3
3
|
import figures from "figures";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
-
import wrapAndIndent from "../../utl/wrap-and-indent.mjs";
|
|
6
5
|
import { PACKAGE_MANIFEST as _PACKAGE_MANIFEST } from "../defaults.mjs";
|
|
7
6
|
import { readManifest } from "./environment-helpers.mjs";
|
|
8
7
|
import { folderNameArrayToRE } from "./utl.mjs";
|
|
8
|
+
import wrapAndIndent from "#utl/wrap-and-indent.mjs";
|
|
9
9
|
|
|
10
10
|
const PACKAGE_MANIFEST = `./${_PACKAGE_MANIFEST}`;
|
|
11
11
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import figures from "figures";
|
|
3
|
-
import { SUMMARY } from "
|
|
3
|
+
import { SUMMARY } from "#utl/bus.mjs";
|
|
4
4
|
|
|
5
5
|
const FULL_ON = 100;
|
|
6
6
|
|
|
@@ -19,7 +19,7 @@ function getPercentageBar(pPercentage, pParameters) {
|
|
|
19
19
|
const lBlanks = lParameters.barSize - lBlocks;
|
|
20
20
|
|
|
21
21
|
return `${chalk.green(lParameters.block.repeat(lBlocks))}${chalk.green(
|
|
22
|
-
lParameters.blank.repeat(lBlanks)
|
|
22
|
+
lParameters.blank.repeat(lBlanks),
|
|
23
23
|
)} ${Math.round(FULL_ON * lPercentage)}%`;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -36,7 +36,7 @@ function getProgressMessageWriter(pStream, pState, pMaxLogLevel) {
|
|
|
36
36
|
if (pStream.isTTY && lOptions.level <= pMaxLogLevel) {
|
|
37
37
|
pStream.clearLine(1);
|
|
38
38
|
pStream.write(
|
|
39
|
-
` ${getPercentageBar(lOptions.complete)} ${pMessage} ...\n
|
|
39
|
+
` ${getPercentageBar(lOptions.complete)} ${pMessage} ...\n`,
|
|
40
40
|
);
|
|
41
41
|
pStream.moveCursor(0, -1);
|
|
42
42
|
}
|
|
@@ -57,14 +57,14 @@ function getStartWriter(pStream) {
|
|
|
57
57
|
export default function setUpCliFeedbackListener(
|
|
58
58
|
pEventEmitter,
|
|
59
59
|
pMaxLogLevel = SUMMARY,
|
|
60
|
-
pStream = process.stderr
|
|
60
|
+
pStream = process.stderr,
|
|
61
61
|
) {
|
|
62
62
|
const lState = {
|
|
63
63
|
complete: 0,
|
|
64
64
|
};
|
|
65
65
|
pEventEmitter.on(
|
|
66
66
|
"progress",
|
|
67
|
-
getProgressMessageWriter(pStream, lState, pMaxLogLevel)
|
|
67
|
+
getProgressMessageWriter(pStream, lState, pMaxLogLevel),
|
|
68
68
|
);
|
|
69
69
|
|
|
70
70
|
pEventEmitter.on("write-start", getStartWriter(pStream));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EOL } from "node:os";
|
|
2
|
-
import { INFO, SUMMARY } from "
|
|
2
|
+
import { INFO, SUMMARY } from "#utl/bus.mjs";
|
|
3
3
|
|
|
4
4
|
const MICRO_SECONDS_PER_SECOND = 1000000;
|
|
5
5
|
|
|
@@ -72,7 +72,7 @@ function getProgressWriter(pStream, pState, pMaxLevel) {
|
|
|
72
72
|
export default function setUpNDJSONListener(
|
|
73
73
|
pEventEmitter,
|
|
74
74
|
pMaxLevel = INFO,
|
|
75
|
-
pStream = process.stderr
|
|
75
|
+
pStream = process.stderr,
|
|
76
76
|
) {
|
|
77
77
|
let lState = {
|
|
78
78
|
runStartTime: new Date(Date.now()).toISOString(),
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
1
|
import chalk from "chalk";
|
|
3
|
-
import { INFO } from "
|
|
2
|
+
import { INFO } from "#utl/bus.mjs";
|
|
4
3
|
|
|
5
4
|
const MS_PER_SECOND = 1000;
|
|
6
5
|
const MS_PER_MICRO_SECOND = 0.001;
|
|
@@ -39,7 +38,7 @@ export function formatDividerLine() {
|
|
|
39
38
|
const lMessageColumnHDivider = "-".repeat(MAX_EXPECTED_MESSAGE_LENGTH);
|
|
40
39
|
|
|
41
40
|
return `${`${lNumberColumnDivider} `.repeat(
|
|
42
|
-
NUMBER_OF_COLUMNS - 1
|
|
41
|
+
NUMBER_OF_COLUMNS - 1,
|
|
43
42
|
)}${lMessageColumnHDivider}\n`;
|
|
44
43
|
}
|
|
45
44
|
|
|
@@ -54,7 +53,7 @@ export function formatHeader() {
|
|
|
54
53
|
pad("⏱ system") +
|
|
55
54
|
pad("⏱ user") +
|
|
56
55
|
pad("⏱ real")
|
|
57
|
-
}after step...\n
|
|
56
|
+
}after step...\n`,
|
|
58
57
|
)
|
|
59
58
|
.concat(formatDividerLine());
|
|
60
59
|
}
|
|
@@ -66,24 +65,24 @@ function formatMessage(pMessage, pLevel) {
|
|
|
66
65
|
export function formatTime(
|
|
67
66
|
pNumber,
|
|
68
67
|
pConversionMultiplier = MS_PER_SECOND,
|
|
69
|
-
pLevel
|
|
68
|
+
pLevel,
|
|
70
69
|
) {
|
|
71
70
|
return formatMessage(
|
|
72
71
|
gTimeFormat(pConversionMultiplier * pNumber)
|
|
73
72
|
.padStart(MAX_EXPECTED_METRIC_LENGTH)
|
|
74
73
|
.concat(" "),
|
|
75
|
-
pLevel
|
|
74
|
+
pLevel,
|
|
76
75
|
);
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
export function formatMemory(pBytes, pLevel) {
|
|
80
79
|
const lReturnValue = gSizeFormat(pBytes / K).padStart(
|
|
81
|
-
MAX_EXPECTED_METRIC_LENGTH
|
|
80
|
+
MAX_EXPECTED_METRIC_LENGTH,
|
|
82
81
|
);
|
|
83
82
|
|
|
84
83
|
return formatMessage(
|
|
85
84
|
(pBytes < 0 ? chalk.blue(lReturnValue) : lReturnValue).concat(" "),
|
|
86
|
-
pLevel
|
|
85
|
+
pLevel,
|
|
87
86
|
);
|
|
88
87
|
}
|
|
89
88
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { INFO, SUMMARY } from "../../../utl/bus.mjs";
|
|
2
1
|
import { getHeader, getProgressLine, getEndText } from "./handlers.mjs";
|
|
2
|
+
import { INFO, SUMMARY } from "#utl/bus.mjs";
|
|
3
3
|
|
|
4
4
|
function getHeaderWriter(pStream, pMaxLevel) {
|
|
5
5
|
return (_pMessage, pOptions) => {
|
|
@@ -16,7 +16,7 @@ function getProgressWriter(pStream, pState, pMaxLevel) {
|
|
|
16
16
|
pMessage,
|
|
17
17
|
pState,
|
|
18
18
|
lOptions.level,
|
|
19
|
-
pMaxLevel
|
|
19
|
+
pMaxLevel,
|
|
20
20
|
);
|
|
21
21
|
pStream.write(lProgressLine);
|
|
22
22
|
};
|
|
@@ -32,7 +32,7 @@ function getEndWriter(pStream, pState, pMaxLevel) {
|
|
|
32
32
|
export default function setUpPerformanceLogListener(
|
|
33
33
|
pEventEmitter,
|
|
34
34
|
pMaxLevel = INFO,
|
|
35
|
-
pStream = process.stderr
|
|
35
|
+
pStream = process.stderr,
|
|
36
36
|
) {
|
|
37
37
|
let lState = {
|
|
38
38
|
previousMessage: "nodejs starting",
|