dependency-cruiser 16.3.2 → 16.3.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.
Files changed (35) hide show
  1. package/configs/plugins/3d-reporter-plugin.mjs +4 -7
  2. package/package.json +12 -14
  3. package/src/cache/helpers.mjs +0 -1
  4. package/src/cli/format-meta-info.mjs +2 -3
  5. package/src/cli/init-config/config-template.mjs +19 -32
  6. package/src/cli/init-config/write-config.mjs +1 -4
  7. package/src/cli/init-config/write-run-scripts-to-manifest.mjs +21 -13
  8. package/src/cli/listeners/cli-feedback.mjs +2 -3
  9. package/src/config-utl/extract-babel-config.mjs +1 -1
  10. package/src/config-utl/extract-ts-config.mjs +1 -1
  11. package/src/enrich/summarize/summarize-options.mjs +1 -0
  12. package/src/extract/swc/dependency-visitor.mjs +1 -1
  13. package/src/extract/swc/parse.mjs +1 -1
  14. package/src/extract/transpile/babel-wrap.mjs +1 -1
  15. package/src/extract/transpile/coffeescript-wrap.mjs +1 -1
  16. package/src/extract/transpile/livescript-wrap.mjs +1 -1
  17. package/src/extract/transpile/svelte-wrap.mjs +1 -1
  18. package/src/extract/transpile/typescript-wrap.mjs +1 -1
  19. package/src/extract/transpile/vue-template-wrap.cjs +1 -1
  20. package/src/extract/tsc/extract-typescript-deps.mjs +1 -1
  21. package/src/extract/tsc/parse.mjs +1 -1
  22. package/src/meta.cjs +1 -1
  23. package/src/report/error.mjs +8 -19
  24. package/src/report/text.mjs +1 -4
  25. package/src/schema/baseline-violations.schema.mjs +1 -1
  26. package/src/schema/configuration.schema.mjs +1 -1
  27. package/src/schema/cruise-result.schema.mjs +1 -1
  28. package/src/utl/extract-root-module-name.cjs +23 -0
  29. package/src/utl/try-import.mjs +67 -0
  30. package/src/utl/try-require.cjs +51 -0
  31. package/src/utl/wrap-and-indent.mjs +9 -4
  32. package/src/cli/init-config/types.d.ts +0 -101
  33. package/src/extract/transpile/meta.d.ts +0 -21
  34. package/src/main/index.d.ts +0 -4
  35. package/src/validate/index.d.ts +0 -61
@@ -1,5 +1,4 @@
1
1
  import * as path from "node:path";
2
- import figures from "figures";
3
2
 
4
3
  const TEMPLATE = `
5
4
  <html>
@@ -74,9 +73,7 @@ function formatFileName(pFileName) {
74
73
  return `${path.dirname(pFileName)}/<b>${path.basename(pFileName)}</b>`;
75
74
  }
76
75
  function formatDependency(pFrom, pTo) {
77
- return `${formatFileName(pFrom)} ${figures.arrowRight}</br>${formatFileName(
78
- pTo
79
- )}`;
76
+ return `${formatFileName(pFrom)} →</br>${formatFileName(pTo)}`;
80
77
  }
81
78
 
82
79
  /**
@@ -100,14 +97,14 @@ function render3DThing(pCruiseResult) {
100
97
  source: pCurrentModule.source,
101
98
  target: pDependency.resolved,
102
99
  label: formatDependency(pCurrentModule.source, pDependency.resolved),
103
- }))
100
+ })),
104
101
  ),
105
- []
102
+ [],
106
103
  );
107
104
 
108
105
  return TEMPLATE.replace(/@@NODES@@/g, JSON.stringify(lNodes)).replace(
109
106
  /@@LINKS@@/g,
110
- JSON.stringify(lLinks)
107
+ JSON.stringify(lLinks),
111
108
  );
112
109
  }
113
110
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "16.3.2",
3
+ "version": "16.3.4",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -59,6 +59,7 @@
59
59
  "electrovir (https://github.com/electrovir)",
60
60
  "fusheng (https://github.com/lin-hun)"
61
61
  ],
62
+ "type": "module",
62
63
  "license": "MIT",
63
64
  "repository": {
64
65
  "type": "git",
@@ -127,6 +128,7 @@
127
128
  "configs/plugins/",
128
129
  "src",
129
130
  "!src/**/*.json",
131
+ "!src/**/*.ts",
130
132
  "!src/**/*.md",
131
133
  "!**/*.DS_Store",
132
134
  "types/**/*.d.mts",
@@ -135,18 +137,16 @@
135
137
  "README.md"
136
138
  ],
137
139
  "dependencies": {
138
- "acorn": "8.11.3",
140
+ "acorn": "8.12.0",
139
141
  "acorn-jsx": "5.3.2",
140
142
  "acorn-jsx-walk": "2.0.0",
141
143
  "acorn-loose": "8.4.0",
142
- "acorn-walk": "8.3.2",
143
- "ajv": "8.13.0",
144
+ "acorn-walk": "8.3.3",
145
+ "ajv": "8.16.0",
144
146
  "chalk": "5.3.0",
145
- "commander": "12.0.0",
146
- "enhanced-resolve": "5.16.1",
147
- "figures": "6.1.0",
147
+ "commander": "12.1.0",
148
+ "enhanced-resolve": "5.17.0",
148
149
  "ignore": "5.3.1",
149
- "indent-string": "5.0.0",
150
150
  "interpret": "^3.1.1",
151
151
  "is-installed-globally": "1.0.0",
152
152
  "json5": "2.2.3",
@@ -156,19 +156,18 @@
156
156
  "prompts": "2.4.2",
157
157
  "rechoir": "^0.8.0",
158
158
  "safe-regex": "2.1.1",
159
- "semver": "^7.6.1",
160
- "semver-try-require": "7.0.0",
159
+ "semver": "^7.6.2",
161
160
  "teamcity-service-messages": "0.1.14",
162
161
  "tsconfig-paths-webpack-plugin": "4.1.0",
163
162
  "watskeburt": "4.0.2",
164
163
  "wrap-ansi": "9.0.0"
165
164
  },
166
165
  "overrides": {
167
- "semver": "^7.6.1",
166
+ "semver": "^7.6.2",
168
167
  "postcss": "^8.4.31"
169
168
  },
170
169
  "resolutions": {
171
- "semver": "^7.6.1",
170
+ "semver": "^7.6.2",
172
171
  "postcss": "^8.4.31"
173
172
  },
174
173
  "engines": {
@@ -176,6 +175,5 @@
176
175
  },
177
176
  "scripts": {
178
177
  "test": "echo for test, build and static analysis scripts: see the github repository"
179
- },
180
- "type": "module"
178
+ }
181
179
  }
@@ -3,7 +3,6 @@ import { createHash } from "node:crypto";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { extname } from "node:path";
5
5
  import memoize from "memoize";
6
- // @ts-expect-error ts(2307) - the ts compiler is not privy to the existence of #imports in package.json
7
6
  import { filenameMatchesPattern } from "#graph-utl/match-facade.mjs";
8
7
 
9
8
  /**
@@ -1,10 +1,9 @@
1
1
  import chalk from "chalk";
2
- import figures from "figures";
3
2
 
4
3
  import { getAvailableTranspilers, allExtensions } from "#main/index.mjs";
5
4
 
6
5
  function bool2Symbol(pBool) {
7
- return pBool ? chalk.green(figures.tick) : chalk.red(figures.cross);
6
+ return pBool ? chalk.green("✔") : chalk.red("x");
8
7
  }
9
8
 
10
9
  function formatTranspilers() {
@@ -30,7 +29,7 @@ export default function formatMetaInfo() {
30
29
  Supported:
31
30
 
32
31
  If you need a supported, but not enabled transpiler ('${chalk.red(
33
- figures.cross,
32
+ "x",
34
33
  )}' below), just install
35
34
  it in the same folder dependency-cruiser is installed. E.g. 'npm i livescript'
36
35
  will enable livescript support if it's installed in your project folder.
@@ -136,7 +136,7 @@ module.exports = {
136
136
  severity: 'error',
137
137
  from: {},
138
138
  to: {
139
- path: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$'
139
+ path: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$'
140
140
  }
141
141
  },
142
142
  {
@@ -150,7 +150,7 @@ module.exports = {
150
150
  'from.pathNot re of the not-to-dev-dep rule in the dependency-cruiser configuration',
151
151
  from: {
152
152
  path: '{{sourceLocationRE}}',
153
- pathNot: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx|ls|coffee|litcoffee|coffee[.]md)$'
153
+ pathNot: '[.](?:spec|test)[.](?:js|mjs|cjs|jsx|ts|mts|cts|tsx)$'
154
154
  },
155
155
  to: {
156
156
  dependencyTypes: [
@@ -216,12 +216,6 @@ module.exports = {
216
216
  */
217
217
  // includeOnly : [''],
218
218
 
219
- /* dependency-cruiser will include modules matching against the focus
220
- regular expression in its output, as well as their direct neighbours
221
- (dependencies and dependents)
222
- */
223
- // focus : '',
224
-
225
219
  /* List of module systems to cruise.
226
220
  When left out dependency-cruiser will fall back to the list of _all_
227
221
  module systems it knows of. It's the default because it's the safe option
@@ -234,7 +228,7 @@ module.exports = {
234
228
 
235
229
  // moduleSystems: ['cjs', 'es6'],
236
230
 
237
- /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/develop/'
231
+ /* prefix for links in html and svg output (e.g. 'https://github.com/you/yourrepo/blob/main/'
238
232
  to open it on your online repo or \`vscode://file/$\{process.cwd()}/\` to
239
233
  open it in visual studio code),
240
234
  */
@@ -277,15 +271,14 @@ module.exports = {
277
271
  to dependency-cruiser's current working directory. When not provided defaults
278
272
  to './webpack.conf.js'.
279
273
 
280
- The (optional) \`env\` and \`arguments\` attributes contain the parameters to be passed if
281
- your webpack config is a function and takes them (see webpack documentation
282
- for details)
274
+ The (optional) \`env\` and \`arguments\` attributes contain the parameters
275
+ to be passed if your webpack config is a function and takes them (see
276
+ webpack documentation for details)
283
277
  */
284
278
  {{webpackConfigAttribute}}
285
279
 
286
280
  /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use
287
- for compilation (and whatever other naughty things babel plugins do to
288
- source code).
281
+ for compilation
289
282
  */
290
283
  {{babelConfigAttribute}}
291
284
 
@@ -313,10 +306,9 @@ module.exports = {
313
306
  /*
314
307
  The extensions, by default are the same as the ones dependency-cruiser
315
308
  can access (run \`npx depcruise --info\` to see which ones that are in
316
- _your_ environment. If that list is larger than you need you can pass
309
+ _your_ environment). If that list is larger than you need you can pass
317
310
  the extensions you actually use (e.g. [".js", ".jsx"]). This can speed
318
- up the most expensive step in dependency cruising (module resolution)
319
- quite a bit.
311
+ up module resolution, which is the most expensive step.
320
312
  */
321
313
  {{extensionsAttribute}}
322
314
  /* What to consider a 'main' field in package.json */
@@ -324,10 +316,10 @@ module.exports = {
324
316
  /*
325
317
  A list of alias fields in package.jsons
326
318
  See [this specification](https://github.com/defunctzombie/package-browser-field-spec) and
327
- the [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields)
328
- documentation in the webpack docs.
319
+ the webpack [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields)
320
+ documentation
329
321
 
330
- Defaults to an empty array (don't use any alias fields).
322
+ Defaults to an empty array (= don't use alias fields).
331
323
  */
332
324
  // aliasFields: ["browser"],
333
325
  },
@@ -336,21 +328,19 @@ module.exports = {
336
328
  /* pattern of modules that can be consolidated in the detailed
337
329
  graphical dependency graph. The default pattern in this configuration
338
330
  collapses everything in node_modules to one folder deep so you see
339
- the external modules, but not the innards your app depends upon.
331
+ the external modules, but their innards.
340
332
  */
341
333
  collapsePattern: 'node_modules/(?:@[^/]+/[^/]+|[^/]+)',
342
334
 
343
335
  /* Options to tweak the appearance of your graph.See
344
336
  https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
345
337
  for details and some examples. If you don't specify a theme
346
- don't worry - dependency-cruiser will fall back to the default one.
338
+ dependency-cruiser falls back to a built-in one.
347
339
  */
348
340
  // theme: {
349
341
  // graph: {
350
- // /* splines: "ortho" will give you straight lines at the expense of
351
- // being slow to render on big graphs
352
- // splines: "true" will give you bezier curves which are faster
353
- // but might not look as nice
342
+ // /* splines: "ortho" gives straight lines, but is slow on big graphs
343
+ // splines: "true" gives bezier curves (fast, not as nice as ortho)
354
344
  // */
355
345
  // splines: "true"
356
346
  // },
@@ -364,14 +354,11 @@ module.exports = {
364
354
  */
365
355
  collapsePattern: '^(?:packages|src|lib(s?)|app(s?)|bin|test(s?)|spec(s?))/[^/]+|node_modules/(?:@[^/]+/[^/]+|[^/]+)',
366
356
 
367
- /* Options to tweak the appearance of your graph.See
368
- https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
369
- for details and some examples. If you don't specify a theme
370
- for 'archi' dependency-cruiser will use the one specified in the
357
+ /* Options to tweak the appearance of your graph. If you don't specify a
358
+ theme for 'archi' dependency-cruiser will use the one specified in the
371
359
  dot section above and otherwise use the default one.
372
360
  */
373
- // theme: {
374
- // },
361
+ // theme: { },
375
362
  },
376
363
  "text": {
377
364
  "highlightFocused": true
@@ -1,5 +1,4 @@
1
1
  import { writeFileSync } from "node:fs";
2
- import figures from "figures";
3
2
  import chalk from "chalk";
4
3
  import {
5
4
  fileExists,
@@ -30,9 +29,7 @@ export default function writeConfig(
30
29
  try {
31
30
  writeFileSync(pFileName, pConfig);
32
31
  pOutStream.write(
33
- `\n ${chalk.green(
34
- figures.tick,
35
- )} Successfully created '${pFileName}'\n\n`,
32
+ `\n ${chalk.green("✔")} Successfully created '${pFileName}'\n\n`,
36
33
  );
37
34
  /* c8 ignore start */
38
35
  } catch (pError) {
@@ -1,11 +1,11 @@
1
+ /* eslint-disable prefer-template */
1
2
  /* eslint-disable security/detect-object-injection */
2
3
  import { writeFileSync } from "node:fs";
3
- import figures from "figures";
4
+ import { EOL } from "node:os";
4
5
  import chalk from "chalk";
5
6
  import { PACKAGE_MANIFEST as _PACKAGE_MANIFEST } from "../defaults.mjs";
6
7
  import { readManifest } from "./environment-helpers.mjs";
7
8
  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
 
@@ -14,37 +14,47 @@ const EXPERIMENTAL_SCRIPT_DOC = [
14
14
  name: "depcruise",
15
15
  headline: "npm run depcruise",
16
16
  description:
17
- "validates against the rules in .dependency-cruiser.js and writes the outcome to stdout",
17
+ " validates against the rules in .dependency-cruiser.js and writes the" +
18
+ EOL +
19
+ " outcome to stdout",
18
20
  },
19
21
  {
20
22
  name: "depcruise:html",
21
23
  headline: "npm run depcruise:html",
22
24
  description:
23
- "validates against the rules in .dependency-cruiser.js and writes it to 'dependency-violation-report.html' with a friendly layout",
25
+ " validates against the rules in .dependency-cruiser.js and writes it to" +
26
+ EOL +
27
+ " 'dependency-violation-report.html' with a friendly layout",
24
28
  },
25
29
  {
26
30
  name: "depcruise:graph",
27
31
  headline: "npm run depcruise:graph",
28
32
  description:
29
- "writes a detailed internal graph of your app to 'dependency-graph.html'",
33
+ " writes a detailed internal graph of your app to 'dependency-graph.html'",
30
34
  },
31
35
  {
32
36
  name: "depcruise:graph:dev",
33
37
  headline: "npm run depcruise:graph:dev",
34
38
  description:
35
- "opens a detailed internal graph of your app in your default browser (uses the 'browser' command line program)",
39
+ " opens a detailed internal graph of your app in your default browser" +
40
+ EOL +
41
+ " (uses the 'browser' command line program)",
36
42
  },
37
43
  {
38
44
  name: "depcruise:graph:archi",
39
45
  headline: "depcruise:graph:archi",
40
46
  description:
41
- "writes a high-level internal graph of your app to 'high-level-dependency-graph.html",
47
+ " writes a high-level internal graph of your app to" +
48
+ EOL +
49
+ " 'high-level-dependency-graph.html",
42
50
  },
43
51
  {
44
52
  name: "depcruise:focus",
45
53
  headline: "npm run depcruise:focus <regex>",
46
54
  description:
47
- "writes all dependencies to and from modules matching the given <regex> to stdout - in simple text",
55
+ " writes all dependencies to and from modules matching the given <regex>" +
56
+ EOL +
57
+ " to stdout - in simple text",
48
58
  },
49
59
  // {
50
60
  // name: "depcruise:text",
@@ -121,13 +131,11 @@ function getSuccessMessage(pDestinationManifestFileName) {
121
131
  return EXPERIMENTAL_SCRIPT_DOC.reduce(
122
132
  (pAll, pScript) => {
123
133
  return `${pAll}${
124
- `\n ${chalk.green(figures.play)} ${pScript.headline}` +
125
- `\n${wrapAndIndent(`${pScript.description}`, lExplanationIndent)}\n\n`
134
+ `\n ${chalk.green("►")} ${pScript.headline}` +
135
+ `\n${pScript.description}\n\n`
126
136
  }`;
127
137
  },
128
- ` ${chalk.green(
129
- figures.tick,
130
- )} Run scripts added to '${pDestinationManifestFileName}':\n`,
138
+ ` ${chalk.green("✔")} Run scripts added to '${pDestinationManifestFileName}':\n`,
131
139
  );
132
140
  }
133
141
 
@@ -1,5 +1,4 @@
1
1
  import chalk from "chalk";
2
- import figures from "figures";
3
2
  import { SUMMARY } from "#utl/bus.mjs";
4
3
 
5
4
  const FULL_ON = 100;
@@ -7,8 +6,8 @@ const FULL_ON = 100;
7
6
  function normalizeParameters(pParameters) {
8
7
  return {
9
8
  barSize: 10,
10
- block: figures.squareSmallFilled,
11
- blank: figures.squareSmall,
9
+ block: "■",
10
+ blank: "□",
12
11
  ...(pParameters || {}),
13
12
  };
14
13
  }
@@ -2,8 +2,8 @@ import { readFile } from "node:fs/promises";
2
2
 
3
3
  import { extname } from "node:path";
4
4
  import json5 from "json5";
5
- import tryImport from "semver-try-require";
6
5
  import makeAbsolute from "./make-absolute.mjs";
6
+ import tryImport from "#utl/try-import.mjs";
7
7
  import meta from "#meta.cjs";
8
8
 
9
9
  async function getJSConfig(pBabelConfigFileName) {
@@ -1,5 +1,5 @@
1
1
  import { dirname, resolve } from "node:path";
2
- import tryImport from "semver-try-require";
2
+ import tryImport from "#utl/try-import.mjs";
3
3
  import meta from "#meta.cjs";
4
4
 
5
5
  const typescript = await tryImport(
@@ -9,6 +9,7 @@ const SHAREABLE_OPTIONS = [
9
9
  "exclude",
10
10
  "exoticallyRequired",
11
11
  "exoticRequireStrings",
12
+ "experimentalStats",
12
13
  "externalModuleResolutionStrategy",
13
14
  "focus",
14
15
  "focusDepth",
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable no-inline-comments */
2
2
  /* eslint-disable max-classes-per-file */
3
- import tryImport from "semver-try-require";
3
+ import tryImport from "#utl/try-import.mjs";
4
4
  import meta from "#meta.cjs";
5
5
 
6
6
  /** @type {import('@swc/core/Visitor')} */
@@ -1,5 +1,5 @@
1
- import tryImport from "semver-try-require";
2
1
  import memoize, { memoizeClear } from "memoize";
2
+ import tryImport from "#utl/try-import.mjs";
3
3
  import meta from "#meta.cjs";
4
4
 
5
5
  /** @type {import('@swc/core')} */
@@ -1,4 +1,4 @@
1
- import tryImport from "semver-try-require";
1
+ import tryImport from "#utl/try-import.mjs";
2
2
  import meta from "#meta.cjs";
3
3
 
4
4
  const babel = await tryImport("@babel/core", meta.supportedTranspilers.babel);
@@ -1,4 +1,4 @@
1
- import tryImport from "semver-try-require";
1
+ import tryImport from "#utl/try-import.mjs";
2
2
  import meta from "#meta.cjs";
3
3
 
4
4
  /*
@@ -1,4 +1,4 @@
1
- import tryImport from "semver-try-require";
1
+ import tryImport from "#utl/try-import.mjs";
2
2
  import meta from "#meta.cjs";
3
3
 
4
4
  const livescript = await tryImport(
@@ -1,5 +1,5 @@
1
- import tryImport from "semver-try-require";
2
1
  import preProcess from "./svelte-preprocess.mjs";
2
+ import tryImport from "#utl/try-import.mjs";
3
3
  import meta from "#meta.cjs";
4
4
 
5
5
  const { compile } = await tryImport(
@@ -1,4 +1,4 @@
1
- import tryImport from "semver-try-require";
1
+ import tryImport from "#utl/try-import.mjs";
2
2
  import meta from "#meta.cjs";
3
3
 
4
4
  const typescript = await tryImport(
@@ -1,6 +1,6 @@
1
1
  const { EOL } = require("node:os");
2
2
  const isEmpty = require("lodash/isEmpty");
3
- const tryRequire = require("semver-try-require");
3
+ const tryRequire = require("#utl/try-require.cjs");
4
4
  const meta = require("#meta.cjs");
5
5
 
6
6
  /*
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable max-lines */
2
2
  /* eslint-disable no-inline-comments */
3
- import tryImport from "semver-try-require";
3
+ import tryImport from "#utl/try-import.mjs";
4
4
  import meta from "#meta.cjs";
5
5
 
6
6
  /** @type {import("typescript")} */
@@ -1,7 +1,7 @@
1
1
  import { readFileSync } from "node:fs";
2
- import tryImport from "semver-try-require";
3
2
  import memoize, { memoizeClear } from "memoize";
4
3
  import transpile from "../transpile/index.mjs";
4
+ import tryImport from "#utl/try-import.mjs";
5
5
  import meta from "#meta.cjs";
6
6
  import getExtension from "#utl/get-extension.mjs";
7
7
 
package/src/meta.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "16.3.2",
4
+ version: "16.3.4",
5
5
  engines: {
6
6
  node: "^18.17||>=20",
7
7
  },
@@ -1,6 +1,5 @@
1
1
  import { EOL } from "node:os";
2
2
  import chalk from "chalk";
3
- import figures from "figures";
4
3
  import {
5
4
  formatPercentage,
6
5
  formatViolation as _formatViolation,
@@ -20,9 +19,7 @@ const EXTRA_PATH_INFORMATION_INDENT = 6;
20
19
  function formatMiniDependency(pMiniDependency) {
21
20
  return EOL.concat(
22
21
  wrapAndIndent(
23
- pMiniDependency
24
- .map(({ name }) => name)
25
- .join(` ${figures.arrowRight} ${EOL}`),
22
+ pMiniDependency.map(({ name }) => name).join(` → ${EOL}`),
26
23
  EXTRA_PATH_INFORMATION_INDENT,
27
24
  ),
28
25
  );
@@ -33,19 +30,15 @@ function formatModuleViolation(pViolation) {
33
30
  }
34
31
 
35
32
  function formatDependencyViolation(pViolation) {
36
- return `${chalk.bold(pViolation.from)} ${figures.arrowRight} ${chalk.bold(
37
- pViolation.to,
38
- )}`;
33
+ return `${chalk.bold(pViolation.from)} ${chalk.bold(pViolation.to)}`;
39
34
  }
40
35
 
41
36
  function formatCycleViolation(pViolation) {
42
- return `${chalk.bold(pViolation.from)} ${
43
- figures.arrowRight
44
- } ${formatMiniDependency(pViolation.cycle)}`;
37
+ return `${chalk.bold(pViolation.from)} ${formatMiniDependency(pViolation.cycle)}`;
45
38
  }
46
39
 
47
40
  function formatReachabilityViolation(pViolation) {
48
- return `${chalk.bold(pViolation.from)} ${figures.arrowRight} ${chalk.bold(
41
+ return `${chalk.bold(pViolation.from)} ${chalk.bold(
49
42
  pViolation.to,
50
43
  )}${formatMiniDependency(pViolation.via)}`;
51
44
  }
@@ -53,9 +46,7 @@ function formatReachabilityViolation(pViolation) {
53
46
  function formatInstabilityViolation(pViolation) {
54
47
  return `${formatDependencyViolation(pViolation)}${EOL}${wrapAndIndent(
55
48
  chalk.dim(
56
- `instability: ${formatPercentage(pViolation.metrics.from.instability)} ${
57
- figures.arrowRight
58
- } ${formatPercentage(pViolation.metrics.to.instability)}`,
49
+ `instability: ${formatPercentage(pViolation.metrics.from.instability)} ${formatPercentage(pViolation.metrics.to.instability)}`,
59
50
  ),
60
51
  EXTRA_PATH_INFORMATION_INDENT,
61
52
  )}`;
@@ -96,7 +87,7 @@ function sumMeta(pMeta) {
96
87
  }
97
88
 
98
89
  function formatSummary(pSummary) {
99
- let lMessage = `${EOL}${figures.cross} ${sumMeta(
90
+ let lMessage = `${EOL}x ${sumMeta(
100
91
  pSummary,
101
92
  )} dependency violations (${formatMeta(pSummary)}). ${
102
93
  pSummary.totalCruised
@@ -117,7 +108,7 @@ function addExplanation(pRuleSet, pLong) {
117
108
  function formatIgnoreWarning(pNumberOfIgnoredViolations) {
118
109
  if (pNumberOfIgnoredViolations > 0) {
119
110
  return chalk.yellow(
120
- `${figures.warning} ${pNumberOfIgnoredViolations} known violations ignored. Run with --no-ignore-known to see them.${EOL}`,
111
+ `‼ ${pNumberOfIgnoredViolations} known violations ignored. Run with --no-ignore-known to see them.${EOL}`,
121
112
  );
122
113
  }
123
114
  return "";
@@ -129,9 +120,7 @@ function report(pResults, pLong) {
129
120
  );
130
121
 
131
122
  if (lNonIgnorableViolations.length === 0) {
132
- return `${EOL}${chalk.green(
133
- figures.tick,
134
- )} no dependency violations found (${
123
+ return `${EOL}${chalk.green("✔")} no dependency violations found (${
135
124
  pResults.summary.totalCruised
136
125
  } modules, ${
137
126
  pResults.summary.totalDependenciesCruised
@@ -1,4 +1,3 @@
1
- import figures from "figures";
2
1
  import chalk from "chalk";
3
2
 
4
3
  const DEFAULT_OPTIONS = {
@@ -41,9 +40,7 @@ function stringifyModule(pModule) {
41
40
  }
42
41
 
43
42
  function stringify(pFlatDependency) {
44
- return `${stringifyModule(pFlatDependency.from)} ${
45
- figures.arrowRight
46
- } ${stringifyModule(pFlatDependency.to)}`;
43
+ return `${stringifyModule(pFlatDependency.from)} ${stringifyModule(pFlatDependency.to)}`;
47
44
  }
48
45
 
49
46
  /**
@@ -1 +1 @@
1
- /* generated - don't edit */export default {"title":"dependency-cruiser baseline ('known errors') format","$schema":"http://json-schema.org/draft-07/schema#","$id":"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json","$ref":"#/definitions/ViolationsType","definitions":{"ViolationsType":{"type":"array","items":{"$ref":"#/definitions/ViolationType"}},"ViolationType":{"type":"object","required":["from","to","rule"],"additionalProperties":false,"properties":{"from":{"type":"string"},"to":{"type":"string"},"type":{"$ref":"#/definitions/ViolationTypeType"},"rule":{"$ref":"#/definitions/RuleSummaryType"},"cycle":{"type":"array","items":{"$ref":"#/definitions/MiniDependency"}},"via":{"type":"array","items":{"$ref":"#/definitions/MiniDependency"}},"metrics":{"type":"object","required":["from","to"],"additionalProperties":false,"properties":{"from":{"type":"object","required":["instability"],"additionalProperties":false,"properties":{"instability":{"type":"number"}}},"to":{"type":"object","required":["instability"],"additionalProperties":false,"properties":{"instability":{"type":"number"}}}}},"comment":{"type":"string"}}},"RuleSummaryType":{"type":"object","required":["name","severity"],"additionalProperties":false,"properties":{"name":{"type":"string"},"severity":{"$ref":"#/definitions/SeverityType"}}},"SeverityType":{"type":"string","enum":["error","warn","info","ignore"]},"ViolationTypeType":{"type":"string","enum":["dependency","module","reachability","cycle","instability","folder"]},"MiniDependency":{"type":"object","required":["name","dependencyTypes"],"additionalProperties":false,"properties":{"name":{"type":"string"},"dependencyTypes":{"type":"array","items":{"$ref":"#/definitions/DependencyTypeType"}}}},"DependencyTypeType":{"type":"string","enum":["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]}}}
1
+ /* generated - don't edit */export default{title:"dependency-cruiser baseline ('known errors') format",$schema:"http://json-schema.org/draft-07/schema#",$id:"https://dependency-cruiser.js.org/schema/baseline-violations.schema.json",$ref:"#/definitions/ViolationsType",definitions:{ViolationsType:{type:"array",items:{$ref:"#/definitions/ViolationType"}},ViolationType:{type:"object",required:["from","to","rule"],additionalProperties:false,properties:{from:{type:"string"},to:{type:"string"},type:{$ref:"#/definitions/ViolationTypeType"},rule:{$ref:"#/definitions/RuleSummaryType"},cycle:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},via:{type:"array",items:{$ref:"#/definitions/MiniDependency"}},metrics:{type:"object",required:["from","to"],additionalProperties:false,properties:{from:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}},to:{type:"object",required:["instability"],additionalProperties:false,properties:{instability:{type:"number"}}}}},comment:{type:"string"}}},RuleSummaryType:{type:"object",required:["name","severity"],additionalProperties:false,properties:{name:{type:"string"},severity:{$ref:"#/definitions/SeverityType"}}},SeverityType:{type:"string",enum:["error","warn","info","ignore"]},ViolationTypeType:{type:"string",enum:["dependency","module","reachability","cycle","instability","folder"]},MiniDependency:{type:"object",required:["name","dependencyTypes"],additionalProperties:false,properties:{name:{type:"string"},dependencyTypes:{type:"array",items:{$ref:"#/definitions/DependencyTypeType"}}}},DependencyTypeType:{type:"string",enum:["aliased-subpath-import","aliased-tsconfig-base-url","aliased-tsconfig-paths","aliased-tsconfig","aliased-webpack","aliased-workspace","aliased","amd-define","amd-require","amd-exotic-require","core","deprecated","dynamic-import","exotic-require","export","import-equals","import","local","localmodule","npm-bundled","npm-dev","npm-no-pkg","npm-optional","npm-peer","npm-unknown","npm","pre-compilation-only","require","triple-slash-amd-dependency","triple-slash-directive","triple-slash-file-reference","triple-slash-type-reference","type-import","type-only","undetermined","unknown"]}}};