dependency-cruiser 12.11.1 → 13.0.0-beta-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.
Files changed (203) hide show
  1. package/README.md +4 -4
  2. package/bin/{depcruise-baseline.js → depcruise-baseline.mjs} +6 -11
  3. package/bin/{depcruise-fmt.js → depcruise-fmt.mjs} +10 -17
  4. package/bin/{dependency-cruise.js → dependency-cruise.mjs} +9 -13
  5. package/bin/wrap-stream-in-html.mjs +5 -0
  6. package/configs/plugins/3d-reporter-plugin.js +1 -1
  7. package/package.json +65 -95
  8. package/src/cache/{cache.js → cache.mjs} +16 -18
  9. package/src/cache/{content-strategy.js → content-strategy.mjs} +19 -19
  10. package/src/cache/{find-content-changes.js → find-content-changes.mjs} +10 -8
  11. package/src/cache/{utl.js → helpers.mjs} +18 -28
  12. package/src/cache/{metadata-strategy.js → metadata-strategy.mjs} +14 -16
  13. package/src/cache/{options-compatible.js → options-compatible.mjs} +8 -18
  14. package/src/cli/defaults.mjs +17 -0
  15. package/src/cli/{format-meta-info.js → format-meta-info.mjs} +14 -15
  16. package/src/cli/format.mjs +26 -0
  17. package/src/cli/{index.js → index.mjs} +42 -47
  18. package/src/cli/init-config/{build-config.js → build-config.mjs} +6 -6
  19. package/src/cli/init-config/{environment-helpers.js → environment-helpers.mjs} +28 -47
  20. package/src/cli/init-config/{find-extensions.js → find-extensions.mjs} +6 -6
  21. package/src/cli/init-config/{get-user-input.js → get-user-input.mjs} +6 -6
  22. package/src/cli/init-config/{index.js → index.mjs} +11 -13
  23. package/src/cli/init-config/{normalize-init-options.js → normalize-init-options.mjs} +14 -14
  24. package/src/cli/init-config/utl.mjs +3 -0
  25. package/src/cli/init-config/{validators.js → validators.mjs} +4 -8
  26. package/src/cli/init-config/{write-config.js → write-config.mjs} +8 -8
  27. package/src/cli/init-config/{write-run-scripts-to-manifest.js → write-run-scripts-to-manifest.mjs} +28 -32
  28. package/src/cli/listeners/{cli-feedback.js → cli-feedback.mjs} +9 -7
  29. package/src/cli/listeners/{ndjson.js → ndjson.mjs} +4 -4
  30. package/src/cli/listeners/performance-log/{format-helpers.js → format-helpers.mjs} +6 -14
  31. package/src/cli/listeners/performance-log/{handlers.js → handlers.mjs} +5 -11
  32. package/src/cli/listeners/performance-log/{index.js → index.mjs} +4 -4
  33. package/src/cli/{normalize-cli-options.js → normalize-cli-options.mjs} +39 -39
  34. package/src/cli/tools/{wrap-stream-in-html.js → wrap-stream-in-html.mjs} +13 -19
  35. package/src/cli/utl/{io.js → io.mjs} +7 -11
  36. package/src/cli/utl/validate-file-existence.mjs +11 -0
  37. package/src/cli/{validate-node-environment.js → validate-node-environment.mjs} +6 -6
  38. package/src/config-utl/{extract-babel-config.js → extract-babel-config.mjs} +31 -30
  39. package/src/config-utl/extract-depcruise-config/{index.js → index.mjs} +23 -26
  40. package/src/config-utl/extract-depcruise-config/{merge-configs.js → merge-configs.mjs} +22 -24
  41. package/src/config-utl/extract-depcruise-config/read-config.mjs +13 -0
  42. package/src/config-utl/{extract-known-violations.js → extract-known-violations.mjs} +5 -5
  43. package/src/config-utl/{extract-ts-config.js → extract-ts-config.mjs} +10 -7
  44. package/src/config-utl/{extract-webpack-resolve-config.js → extract-webpack-resolve-config.mjs} +51 -37
  45. package/src/config-utl/make-absolute.mjs +10 -0
  46. package/src/enrich/{add-validations.js → add-validations.mjs} +7 -6
  47. package/src/enrich/derive/{circular.js → circular.mjs} +2 -2
  48. package/src/enrich/derive/dependents/{get-dependents.js → get-dependents.mjs} +3 -3
  49. package/src/enrich/derive/dependents/index.mjs +8 -0
  50. package/src/enrich/derive/folders/{aggregate-to-folders.js → aggregate-to-folders.mjs} +11 -11
  51. package/src/enrich/derive/folders/index.mjs +42 -0
  52. package/src/enrich/derive/folders/{utl.js → utl.mjs} +8 -16
  53. package/src/enrich/derive/metrics/{get-module-metrics.js → get-module-metrics.mjs} +9 -9
  54. package/src/enrich/derive/metrics/{index.js → index.mjs} +4 -4
  55. package/src/enrich/derive/{module-utl.js → module-utl.mjs} +6 -9
  56. package/src/enrich/derive/orphan/{index.js → index.mjs} +3 -3
  57. package/src/enrich/derive/orphan/{is-orphan.js → is-orphan.mjs} +3 -3
  58. package/src/enrich/derive/{reachable.js → reachable.mjs} +7 -8
  59. package/src/enrich/{enrich-modules.js → enrich-modules.mjs} +13 -13
  60. package/src/enrich/{index.js → index.mjs} +8 -8
  61. package/src/enrich/{soften-known-violations.js → soften-known-violations.mjs} +13 -13
  62. package/src/enrich/summarize/{add-rule-set-used.js → add-rule-set-used.mjs} +3 -3
  63. package/src/enrich/summarize/{get-stats.js → get-stats.mjs} +3 -9
  64. package/src/enrich/summarize/{index.js → index.mjs} +13 -13
  65. package/src/enrich/summarize/{is-same-violation.js → is-same-violation.mjs} +2 -2
  66. package/src/enrich/summarize/{summarize-folders.js → summarize-folders.mjs} +4 -4
  67. package/src/enrich/summarize/{summarize-modules.js → summarize-modules.mjs} +9 -9
  68. package/src/enrich/summarize/{summarize-options.js → summarize-options.mjs} +3 -3
  69. package/src/extract/ast-extractors/{estree-helpers.js → estree-helpers.mjs} +1 -1
  70. package/src/extract/ast-extractors/{extract-amd-deps.js → extract-amd-deps.mjs} +7 -7
  71. package/src/extract/ast-extractors/{extract-cjs-deps.js → extract-cjs-deps.mjs} +6 -6
  72. package/src/extract/ast-extractors/{extract-es6-deps.js → extract-es6-deps.mjs} +8 -8
  73. package/src/extract/ast-extractors/{extract-swc-deps.js → extract-swc-deps.mjs} +3 -7
  74. package/src/extract/ast-extractors/{extract-typescript-deps.js → extract-typescript-deps.mjs} +11 -8
  75. package/src/extract/ast-extractors/swc-dependency-visitor.mjs +253 -0
  76. package/src/extract/clear-caches.mjs +17 -0
  77. package/src/extract/{gather-initial-sources.js → gather-initial-sources.mjs} +25 -31
  78. package/src/extract/get-dependencies.mjs +247 -0
  79. package/src/extract/helpers.mjs +76 -0
  80. package/src/extract/{index.js → index.mjs} +20 -24
  81. package/src/extract/parse/{to-javascript-ast.js → to-javascript-ast.mjs} +25 -26
  82. package/src/extract/parse/{to-swc-ast.js → to-swc-ast.mjs} +9 -8
  83. package/src/extract/parse/{to-typescript-ast.js → to-typescript-ast.mjs} +16 -12
  84. package/src/extract/resolve/{determine-dependency-types.js → determine-dependency-types.mjs} +24 -25
  85. package/src/extract/resolve/{external-module-helpers.js → external-module-helpers.mjs} +18 -21
  86. package/src/extract/resolve/{get-manifest/index.js → get-manifest.mjs} +19 -18
  87. package/src/extract/resolve/{index.js → index.mjs} +29 -30
  88. package/src/extract/resolve/{get-manifest/merge-manifests.js → merge-manifests.mjs} +4 -4
  89. package/src/extract/resolve/{module-classifiers.js → module-classifiers.mjs} +12 -19
  90. package/src/extract/resolve/{resolve-amd.js → resolve-amd.mjs} +11 -14
  91. package/src/extract/resolve/{resolve-cjs.js → resolve-cjs.mjs} +8 -8
  92. package/src/extract/resolve/resolve-helpers.mjs +30 -0
  93. package/src/extract/resolve/{resolve.js → resolve.mjs} +6 -7
  94. package/src/extract/transpile/{babel-wrap.js → babel-wrap.mjs} +4 -4
  95. package/src/extract/transpile/{coffeescript-wrap.js → coffeescript-wrap.mjs} +10 -10
  96. package/src/extract/transpile/{index.js → index.mjs} +5 -5
  97. package/src/extract/transpile/{javascript-wrap.js → javascript-wrap.mjs} +1 -1
  98. package/src/extract/transpile/livescript-wrap.mjs +15 -0
  99. package/src/extract/transpile/{meta.js → meta.mjs} +35 -31
  100. package/src/extract/transpile/{svelte-preprocess.js → svelte-preprocess.mjs} +2 -2
  101. package/src/extract/transpile/svelte-wrap.mjs +26 -0
  102. package/src/extract/transpile/{typescript-wrap.js → typescript-wrap.mjs} +8 -5
  103. package/src/extract/transpile/{vue-template-wrap.js → vue-template-wrap.cjs} +15 -18
  104. package/src/graph-utl/{add-focus.js → add-focus.mjs} +8 -7
  105. package/src/graph-utl/{compare.js → compare.mjs} +5 -5
  106. package/src/graph-utl/{consolidate-module-dependencies.js → consolidate-module-dependencies.mjs} +6 -6
  107. package/src/graph-utl/{consolidate-modules.js → consolidate-modules.mjs} +6 -6
  108. package/src/graph-utl/{consolidate-to-folder.js → consolidate-to-folder.mjs} +7 -7
  109. package/src/graph-utl/{consolidate-to-pattern.js → consolidate-to-pattern.mjs} +4 -4
  110. package/src/graph-utl/{filter-bank.js → filter-bank.mjs} +17 -25
  111. package/src/graph-utl/{indexed-module-graph.js → indexed-module-graph.mjs} +2 -2
  112. package/src/graph-utl/match-facade.mjs +11 -0
  113. package/src/graph-utl/{rule-set.js → rule-set.mjs} +7 -13
  114. package/src/graph-utl/{strip-self-transitions.js → strip-self-transitions.mjs} +2 -2
  115. package/src/main/files-and-dirs/{normalize.js → normalize.mjs} +6 -9
  116. package/src/main/{utl/normalize-re-properties.js → helpers.mjs} +6 -11
  117. package/src/main/{index.js → index.mjs} +44 -44
  118. package/src/main/options/{defaults.js → defaults.mjs} +1 -1
  119. package/src/main/options/{normalize.js → normalize.mjs} +21 -30
  120. package/src/main/options/{validate.js → validate.mjs} +8 -14
  121. package/src/main/{report-wrap.js → report-wrap.mjs} +20 -22
  122. package/src/main/resolve-options/{normalize.js → normalize.mjs} +33 -35
  123. package/src/main/rule-set/{normalize.js → normalize.mjs} +11 -11
  124. package/src/main/rule-set/{validate.js → validate.mjs} +10 -10
  125. package/src/meta.js +2 -2
  126. package/src/report/anon/{anonymize-path-element.js → anonymize-path-element.mjs} +5 -7
  127. package/src/report/anon/{anonymize-path.js → anonymize-path.mjs} +4 -6
  128. package/src/report/anon/{index.js → index.mjs} +16 -20
  129. package/src/report/anon/{random-string.js → random-string.mjs} +4 -3
  130. package/src/report/{baseline.js → baseline.mjs} +4 -4
  131. package/src/report/{csv.js → csv.mjs} +12 -11
  132. package/src/report/dot/{default-theme.js → default-theme.mjs} +1 -1
  133. package/src/report/dot/{index.js → index.mjs} +14 -14
  134. package/src/report/dot/{module-utl.js → module-utl.mjs} +22 -22
  135. package/src/report/dot/prepare-custom-level.mjs +23 -0
  136. package/src/report/dot/prepare-flat-level.mjs +11 -0
  137. package/src/report/dot/prepare-folder-level.mjs +14 -0
  138. package/src/report/dot/{theming.js → theming.mjs} +5 -5
  139. package/src/report/error-html/{index.js → index.mjs} +7 -8
  140. package/src/report/error-html/{utl.js → utl.mjs} +8 -7
  141. package/src/report/error-long.mjs +5 -0
  142. package/src/report/{error.js → error.mjs} +31 -27
  143. package/src/report/html/{index.js → index.mjs} +7 -8
  144. package/src/report/{identity.js → identity.mjs} +3 -3
  145. package/src/report/index.mjs +75 -0
  146. package/src/report/{json.js → json.mjs} +3 -3
  147. package/src/report/{markdown.js → markdown.mjs} +18 -18
  148. package/src/report/{mermaid.js → mermaid.mjs} +7 -7
  149. package/src/report/{metrics.js → metrics.mjs} +11 -11
  150. package/src/report/{plugins.js → plugins.mjs} +12 -17
  151. package/src/report/{teamcity.js → teamcity.mjs} +17 -18
  152. package/src/report/{text.js → text.mjs} +8 -7
  153. package/src/report/utl/{dependency-to-incidence-transformer.js → dependency-to-incidence-transformer.mjs} +2 -2
  154. package/src/report/utl/{index.js → index.mjs} +4 -5
  155. package/src/schema/baseline-violations.schema.mjs +1 -0
  156. package/src/schema/configuration.schema.mjs +1 -0
  157. package/src/schema/cruise-result.schema.mjs +1 -0
  158. package/src/utl/{array-util.js → array-util.mjs} +1 -5
  159. package/src/utl/{bus-log-levels.js → bus-log-levels.mjs} +1 -1
  160. package/src/utl/bus.mjs +5 -0
  161. package/src/utl/{find-all-files.js → find-all-files.mjs} +6 -6
  162. package/src/utl/{get-extension.js → get-extension.mjs} +4 -4
  163. package/src/utl/{path-to-posix.js → path-to-posix.mjs} +3 -3
  164. package/src/utl/{regex-util.js → regex-util.mjs} +3 -3
  165. package/src/utl/{wrap-and-indent.js → wrap-and-indent.mjs} +5 -4
  166. package/src/validate/{index.js → index.mjs} +22 -14
  167. package/src/validate/{match-dependency-rule.js → match-dependency-rule.mjs} +6 -6
  168. package/src/validate/{match-folder-dependency-rule.js → match-folder-dependency-rule.mjs} +6 -9
  169. package/src/validate/{match-module-rule.js → match-module-rule.mjs} +22 -25
  170. package/src/validate/{matchers.js → matchers.mjs} +4 -4
  171. package/src/validate/{rule-classifiers.js → rule-classifiers.mjs} +5 -5
  172. package/src/validate/{violates-required-rule.js → violates-required-rule.mjs} +6 -6
  173. package/types/README.md +1 -0
  174. package/types/dependency-cruiser.d.ts +3 -29
  175. package/bin/wrap-stream-in-html.js +0 -5
  176. package/src/cli/defaults.js +0 -17
  177. package/src/cli/format.js +0 -26
  178. package/src/cli/init-config/utl.js +0 -6
  179. package/src/cli/utl/validate-file-existence.js +0 -11
  180. package/src/config-utl/extract-depcruise-config/read-config.js +0 -12
  181. package/src/config-utl/make-absolute.js +0 -10
  182. package/src/enrich/derive/dependents/index.js +0 -10
  183. package/src/enrich/derive/folders/index.js +0 -45
  184. package/src/extract/ast-extractors/swc-dependency-visitor.js +0 -249
  185. package/src/extract/clear-caches.js +0 -17
  186. package/src/extract/get-dependencies.js +0 -243
  187. package/src/extract/resolve/resolve-helpers.js +0 -35
  188. package/src/extract/transpile/livescript-wrap.js +0 -12
  189. package/src/extract/transpile/svelte-wrap.js +0 -26
  190. package/src/extract/utl/compare.js +0 -17
  191. package/src/extract/utl/detect-pre-compilation-ness.js +0 -12
  192. package/src/extract/utl/extract-module-attributes.js +0 -38
  193. package/src/extract/utl/strip-query-parameters.js +0 -15
  194. package/src/graph-utl/match-facade.js +0 -17
  195. package/src/report/dot/prepare-custom-level.js +0 -24
  196. package/src/report/dot/prepare-flat-level.js +0 -12
  197. package/src/report/dot/prepare-folder-level.js +0 -19
  198. package/src/report/error-long.js +0 -5
  199. package/src/report/index.js +0 -73
  200. package/src/schema/baseline-violations.schema.js +0 -2
  201. package/src/schema/configuration.schema.js +0 -2
  202. package/src/schema/cruise-result.schema.js +0 -2
  203. package/src/utl/bus.js +0 -5
package/README.md CHANGED
@@ -56,14 +56,14 @@ cruiser with output type `dot` and run _GraphViz dot_[^3] on the result. In
56
56
  a one liner:
57
57
 
58
58
  ```shell
59
- npx depcruise src --include-only "^src" --config --output-type dot | dot -T svg > dependency-graph.svg
59
+ npx depcruise src --include-only "^src" --output-type dot | dot -T svg > dependency-graph.svg
60
60
  ```
61
61
 
62
62
  - You can read more about what you can do with `--include-only` and other command line
63
63
  options in the [command line interface](./doc/cli.md) documentation.
64
64
  - _[Real world samples](./doc/real-world-samples.md)_
65
65
  contains dependency cruises of some of the most used projects on npm.
66
- - If our grandma is more into formats like `mermaid`, `json`, `csv`, `html` or plain text
66
+ - If your grandma is more into formats like `mermaid`, `json`, `csv`, `html` or plain text
67
67
  we've [got her covered](./doc/cli.md#--output-type-specify-the-output-format)
68
68
  as well.
69
69
 
@@ -77,7 +77,7 @@ npx depcruise src --include-only "^src" --config --output-type dot | dot -T svg
77
77
 
78
78
  #### Declare some rules
79
79
 
80
- When you ran the `depcruise --init command` above, the command also added some rules
80
+ When you ran `depcruise --init` above, the command also added some rules
81
81
  to `.dependency-cruiser.js` that make sense in most projects, like detecting
82
82
  **circular dependencies**, dependencies **missing** in package.json, **orphans**,
83
83
  and production code relying on dev- or optionalDependencies.
@@ -107,7 +107,7 @@ Sample rule:
107
107
  #### Report them
108
108
 
109
109
  ```sh
110
- npx depcruise --config .dependency-cruiser.js src
110
+ npx depcruise src
111
111
  ```
112
112
 
113
113
  This will validate against your rules and shows any violations in an eslint-like format:
@@ -1,5 +1,8 @@
1
1
  #!/usr/bin/env node
2
- const validateNodeEnvironment = require("../src/cli/validate-node-environment");
2
+ import { program } from "commander";
3
+ import validateNodeEnvironment from "../src/cli/validate-node-environment.mjs";
4
+ import meta from "../src/meta.js";
5
+ import cli from "../src/cli/index.mjs";
3
6
 
4
7
  function formatError(pError) {
5
8
  process.stderr.write(pError.message);
@@ -9,14 +12,6 @@ function formatError(pError) {
9
12
  try {
10
13
  validateNodeEnvironment();
11
14
 
12
- // importing things only after the validateNodeEnv check so we can show an understandable
13
- // error. Otherwise, on unsupported platforms we would show a stack trace, which is
14
- // not so nice
15
- /* eslint-disable node/global-require */
16
- const program = require("commander");
17
- const { version } = require("../src/meta.js");
18
- const cli = require("../src/cli");
19
-
20
15
  program
21
16
  .description(
22
17
  "Writes all known violations of rules in a .dependency-cruiser.js to a file.\n" +
@@ -29,12 +24,12 @@ try {
29
24
  "file to write output to; - for stdout",
30
25
  ".dependency-cruiser-known-violations.json"
31
26
  )
32
- .version(version)
27
+ .version(meta.version)
33
28
  .arguments("<files-or-directories>")
34
29
  .parse(process.argv);
35
30
 
36
31
  if (Boolean(program.args[0])) {
37
- process.exitCode = cli(program.args, {
32
+ process.exitCode = await cli(program.args, {
38
33
  ...program.opts(),
39
34
  cache: false,
40
35
  outputType: "baseline",
@@ -1,5 +1,9 @@
1
1
  #!/usr/bin/env node
2
- const validateNodeEnvironment = require("../src/cli/validate-node-environment");
2
+
3
+ import { program } from "commander";
4
+ import validateNodeEnvironment from "../src/cli/validate-node-environment.mjs";
5
+ import meta from "../src/meta.js";
6
+ import format from "../src/cli/format.mjs";
3
7
 
4
8
  function formatError(pError) {
5
9
  process.stderr.write(pError.message);
@@ -9,14 +13,6 @@ function formatError(pError) {
9
13
  try {
10
14
  validateNodeEnvironment();
11
15
 
12
- // importing things only after the validateNodeEnv check so we can show an understandable
13
- // error. Otherwise, on unsupported platforms we would show a stack trace, which is
14
- // not so nice
15
- /* eslint-disable node/global-require */
16
- const program = require("commander");
17
- const { version } = require("../src/meta.js");
18
- const format = require("../src/cli/format.js");
19
-
20
16
  program
21
17
  .description(
22
18
  "Format dependency-cruiser output json.\nDetails: https://github.com/sverweij/dependency-cruiser"
@@ -69,18 +65,15 @@ try {
69
65
  "exit with a non-zero exit code when the input json contains error level " +
70
66
  "dependency violations. Works for err, err-long and teamcity output types"
71
67
  )
72
- .version(version)
68
+ .version(meta.version)
73
69
  .arguments("<dependency-cruiser-json>")
74
70
  .parse(process.argv);
75
71
 
76
72
  if (program.args[0]) {
77
- format(program.args[0], program.opts())
78
- .then((pExitCode) => {
79
- if (program.opts().exitCode) {
80
- process.exitCode = pExitCode;
81
- }
82
- })
83
- .catch(formatError);
73
+ const lExitCode = await format(program.args[0], program.opts());
74
+ if (program.opts().exitCode) {
75
+ process.exitCode = lExitCode;
76
+ }
84
77
  } else {
85
78
  program.help();
86
79
  }
@@ -1,18 +1,13 @@
1
1
  #!/usr/bin/env node
2
- const validateNodeEnvironment = require("../src/cli/validate-node-environment");
2
+ import { EOL } from "node:os";
3
+ import { program } from "commander";
4
+ import validateNodeEnvironment from "../src/cli/validate-node-environment.mjs";
5
+ import meta from "../src/meta.js";
6
+ import cli from "../src/cli/index.mjs";
3
7
 
4
8
  try {
5
9
  validateNodeEnvironment();
6
10
 
7
- // importing things only after the validateNodeEnv check so we can show an understandable
8
- // error. Otherwise, on unsupported platforms we could show a stack trace, which is
9
- // not so nice
10
- /* eslint-disable node/global-require */
11
- const { EOL } = require("os");
12
- const program = require("commander");
13
- const { version } = require("../src/meta.js");
14
- const cli = require("../src/cli");
15
-
16
11
  program
17
12
  .description(
18
13
  `Validate and visualize dependencies.${EOL}Details: https://github.com/sverweij/dependency-cruiser`
@@ -23,7 +18,8 @@ try {
23
18
  )
24
19
  .option(
25
20
  "-c, --config [file]",
26
- "read rules and options from [file] (e.g. .dependency-cruiser.js)"
21
+ "read rules and options from [file] (e.g. .dependency-cruiser.js)",
22
+ true
27
23
  )
28
24
  .addOption(
29
25
  new program.Option(
@@ -168,12 +164,12 @@ try {
168
164
  `${EOL}Other options:` +
169
165
  `${EOL} see https://github.com/sverweij/dependency-cruiser/blob/master/doc/cli.md${EOL}`
170
166
  )
171
- .version(version)
167
+ .version(meta.version)
172
168
  .arguments("[files-or-directories]")
173
169
  .parse(process.argv);
174
170
 
175
171
  if (Boolean(program.args[0]) || program.opts().info || program.opts().init) {
176
- process.exitCode = cli(program.args, program.opts());
172
+ process.exitCode = await cli(program.args, program.opts());
177
173
  } else {
178
174
  program.help();
179
175
  }
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import wrapStreamInHtml from "../src/cli/tools/wrap-stream-in-html.mjs";
4
+
5
+ wrapStreamInHtml(process.stdin, process.stdout);
@@ -1,4 +1,4 @@
1
- const path = require("path");
1
+ const path = require("node:path");
2
2
  const figures = require("figures");
3
3
 
4
4
  const TEMPLATE = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "12.11.1",
3
+ "version": "13.0.0-beta-2",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -36,23 +36,33 @@
36
36
  },
37
37
  "homepage": "https://github.com/sverweij/dependency-cruiser",
38
38
  "bin": {
39
- "dependency-cruiser": "bin/dependency-cruise.js",
40
- "dependency-cruise": "bin/dependency-cruise.js",
41
- "depcruise": "bin/dependency-cruise.js",
42
- "depcruise-baseline": "bin/depcruise-baseline.js",
43
- "depcruise-fmt": "bin/depcruise-fmt.js",
44
- "depcruise-wrap-stream-in-html": "bin/wrap-stream-in-html.js"
39
+ "dependency-cruiser": "bin/dependency-cruise.mjs",
40
+ "dependency-cruise": "bin/dependency-cruise.mjs",
41
+ "depcruise": "bin/dependency-cruise.mjs",
42
+ "depcruise-baseline": "bin/depcruise-baseline.mjs",
43
+ "depcruise-fmt": "bin/depcruise-fmt.mjs",
44
+ "depcruise-wrap-stream-in-html": "bin/wrap-stream-in-html.mjs"
45
45
  },
46
- "main": "src/main/index.js",
46
+ "main": "src/main/index.mjs",
47
47
  "exports": {
48
- ".": "./src/main/index.js",
49
- "./config-utl/extract-babel-config": "./src/config-utl/extract-babel-config.js",
50
- "./config-utl/extract-depcruise-config": "./src/config-utl/extract-depcruise-config/index.js",
51
- "./config-utl/extract-ts-config": "./src/config-utl/extract-ts-config.js",
52
- "./config-utl/extract-webpack-resolve-config": "./src/config-utl/extract-webpack-resolve-config.js",
48
+ ".": {
49
+ "import": "./src/main/index.mjs"
50
+ },
51
+ "./config-utl/extract-babel-config": {
52
+ "import": "./src/config-utl/extract-babel-config.mjs"
53
+ },
54
+ "./config-utl/extract-depcruise-config": {
55
+ "import": "./src/config-utl/extract-depcruise-config/index.mjs"
56
+ },
57
+ "./config-utl/extract-ts-config": {
58
+ "import": "./src/config-utl/extract-ts-config.mjs"
59
+ },
60
+ "./config-utl/extract-webpack-resolve-config": {
61
+ "import": "./src/config-utl/extract-webpack-resolve-config.mjs"
62
+ },
53
63
  "./sample-reporter-plugin": "./configs/plugins/stats-reporter-plugin.js",
54
64
  "./sample-3d-reporter-plugin": "./configs/plugins/3d-reporter-plugin.js",
55
- "./mermaid-reporter-plugin": "./src/report/mermaid.js"
65
+ "./mermaid-reporter-plugin": "./src/report/mermaid.mjs"
56
66
  },
57
67
  "types": "types/dependency-cruiser.d.ts",
58
68
  "files": [
@@ -72,31 +82,31 @@
72
82
  "build": "make build",
73
83
  "build:clean": "make clean",
74
84
  "check": "npm-run-all build lint depcruise test:cover",
75
- "check:full": "npm-run-all check test:glob test:yarn-pnp",
76
- "depcruise": "node ./bin/dependency-cruise.js src bin test configs types tools --config --ignore-known",
77
- "depcruise:all": "node ./bin/dependency-cruise.js src bin test configs types tools --config",
78
- "depcruise:baseline": "node ./bin/depcruise-baseline.js src bin test configs types tools",
79
- "depcruise:explain": "node ./bin/dependency-cruise.js src bin test configs types tools --output-type err-long --config --progress none",
85
+ "check:full": "npm-run-all check test:glob",
86
+ "depcruise": "node ./bin/dependency-cruise.mjs src bin test configs types tools --ignore-known",
87
+ "depcruise:all": "node ./bin/dependency-cruise.mjs src bin test configs types tools",
88
+ "depcruise:baseline": "node ./bin/depcruise-baseline.mjs src bin test configs types tools",
89
+ "depcruise:explain": "node ./bin/dependency-cruise.mjs src bin test configs types tools --output-type err-long --progress none",
80
90
  "depcruise:graph:doc": "npm-run-all depcruise:graph:doc:json --parallel depcruise:graph:doc:fmt-* depcruise:graph:doc:samples",
81
- "depcruise:graph:doc:json": "node ./bin/dependency-cruise.js bin src test --config --output-type json --output-to tmp_graph_deps.json --progress",
82
- "depcruise:graph:doc:fmt-detail": "./bin/depcruise-fmt.js -T dot -f - tmp_graph_deps.json | dot -T svg | tee doc/real-world-samples/dependency-cruiser-without-node_modules.svg | node bin/wrap-stream-in-html.js > docs/dependency-cruiser-dependency-graph.html",
83
- "depcruise:graph:doc:fmt-archi": "./bin/depcruise-fmt.js -T archi -f - tmp_graph_deps.json | dot -T svg -Gordering=in -Grankdir=TD | tee doc/real-world-samples/dependency-cruiser-archi-graph.svg | node bin/wrap-stream-in-html.js > docs/dependency-cruiser-archi-graph.html",
84
- "depcruise:graph:doc:fmt-dir": "./bin/depcruise-fmt.js -T ddot -f - tmp_graph_deps.json | dot -T svg -Grankdir=TD | tee doc/real-world-samples/dependency-cruiser-dir-graph.svg | node bin/wrap-stream-in-html.js > docs/dependency-cruiser-dir-graph.html",
85
- "depcruise:graph:doc:fmt-schema": "cd tools/schema && node ../../bin/dependency-cruise.js . --config --output-type dot | dot -T svg | tee ../overview.svg | node ../../bin/wrap-stream-in-html.js > ../../docs/schema-overview.html && cd -",
86
- "depcruise:graph:doc:fmt-types": "cd types && node ../bin/dependency-cruise.js . --ts-pre-compilation-deps --config --output-type dot | dot -T svg > overview.svg && cd -",
91
+ "depcruise:graph:doc:json": "node ./bin/dependency-cruise.mjs bin src test --output-type json --output-to tmp_graph_deps.json --progress",
92
+ "depcruise:graph:doc:fmt-detail": "./bin/depcruise-fmt.mjs -T dot -f - tmp_graph_deps.json | dot -T svg | tee doc/real-world-samples/dependency-cruiser-without-node_modules.svg | node bin/wrap-stream-in-html.mjs > docs/dependency-cruiser-dependency-graph.html",
93
+ "depcruise:graph:doc:fmt-archi": "./bin/depcruise-fmt.mjs -T archi -f - tmp_graph_deps.json | dot -T svg -Gordering=in -Grankdir=TD | tee doc/real-world-samples/dependency-cruiser-archi-graph.svg | node bin/wrap-stream-in-html.mjs > docs/dependency-cruiser-archi-graph.html",
94
+ "depcruise:graph:doc:fmt-dir": "./bin/depcruise-fmt.mjs -T ddot -f - tmp_graph_deps.json | dot -T svg -Grankdir=TD | tee doc/real-world-samples/dependency-cruiser-dir-graph.svg | node bin/wrap-stream-in-html.mjs > docs/dependency-cruiser-dir-graph.html",
95
+ "depcruise:graph:doc:fmt-schema": "cd tools/schema && node ../../bin/dependency-cruise.mjs . --output-type dot | dot -T svg | tee ../overview.svg | node ../../bin/wrap-stream-in-html.mjs > ../../docs/schema-overview.html && cd -",
96
+ "depcruise:graph:doc:fmt-types": "cd types && node ../bin/dependency-cruise.mjs . --output-type dot | dot -T svg > overview.svg && cd -",
87
97
  "depcruise:graph:doc:samples": "sh tools/generate-samples.sh",
88
- "depcruise:graph:mermaid": "node ./bin/dependency-cruise.js bin src --include-only ^src/ --config --collapse 2 --output-type mermaid",
89
- "depcruise:graph:mermaid:diff": "node ./bin/dependency-cruise.js bin src test types tools --config configs/.dependency-cruiser-unlimited.json --output-type mermaid --reaches \"$(watskeburt $SHA)\"",
90
- "depcruise:graph:view": "node ./bin/dependency-cruise.js bin src --prefix vscode://file/$(pwd)/ --config configs/.dependency-cruiser-show-metrics-config.json --output-type dot --progress cli-feedback --highlight \"$(watskeburt develop)\" | dot -T svg | node ./bin/wrap-stream-in-html.js | browser",
91
- "depcruise:graph:view:diff": "node ./bin/dependency-cruise.js 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.js | browser",
92
- "depcruise:report": "node ./bin/dependency-cruise.js src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.json --output-to dependency-violations.html",
93
- "depcruise:report:view": "node ./bin/dependency-cruise.js src bin test configs types --output-type err-html --config configs/.dependency-cruiser-show-metrics-config.json --output-to - | browser",
94
- "depcruise:focus": "node ./bin/dependency-cruise.js src bin test configs types tools --progress --config --output-type text --focus",
95
- "depcruise:reaches": "node ./bin/dependency-cruise.js src bin test configs types tools --progress --config configs/.dependency-cruiser-unlimited.json --output-type text --reaches",
98
+ "depcruise:graph:mermaid": "node ./bin/dependency-cruise.mjs bin src --include-only ^src/ --collapse 2 --output-type mermaid",
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 v13)\" | dot -T svg | node ./bin/wrap-stream-in-html.mjs | browser",
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
+ "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
+ "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",
104
+ "depcruise:focus": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --output-type text --focus",
105
+ "depcruise:reaches": "node ./bin/dependency-cruise.mjs src bin test configs types tools --progress --no-cache --config configs/.dependency-cruiser-unlimited.json --output-type text --reaches",
96
106
  "format": "prettier --loglevel warn --write \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
97
107
  "format:check": "prettier --loglevel warn --check \"src/**/*.js\" \"configs/**/*.js\" \"tools/**/*.mjs\" \"bin/*\" \"types/*.d.ts\" \"test/**/*.spec.{cjs,js}\" \"test/**/*.{spec,utl}.mjs\"",
98
108
  "lint": "npm-run-all --parallel --aggregate-output lint:eslint format:check lint:types",
99
- "lint:eslint": "eslint bin/dependency-cruise.js bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
109
+ "lint:eslint": "eslint bin/dependency-cruise.mjs bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
100
110
  "lint:eslint:fix": "eslint --fix bin src test configs tools/**/*.mjs --cache --cache-location node_modules/.cache/eslint/",
101
111
  "lint:eslint:clear-caches": "rm -rf node_modules/.cache/eslint/",
102
112
  "lint:fix": "npm-run-all lint:eslint:fix format lint:types:fix",
@@ -121,19 +131,9 @@
121
131
  "test:u": "LANG=en_US.UTF-8 mocha --grep \"^\\[[U]\\]\"",
122
132
  "test:e": "LANG=en_US.UTF-8 mocha --grep \"^\\[[E]\\]\"",
123
133
  "test:cover": "LANG=en_US.UTF-8 c8 mocha",
124
- "test:glob": "set -f && test \"`bin/dependency-cruise.js test/extract/__mocks__/gather-globbing/packages/**/src/**/*.js | grep \"no dependency violations found\"`\" = \"✔ no dependency violations found (6 modules, 0 dependencies cruised)\"",
125
- "test:yarn-pnp": "npm-run-all test:yarn-pnp:cleanup test:yarn-pnp:cache-clean test:yarn-pnp:pack test:yarn-pnp:copy test:yarn-pnp:install test:yarn-pnp:version test:yarn-pnp:run test:yarn-pnp:test test:yarn-pnp:cleanup",
126
- "test:yarn-pnp:pack": "npm pack",
127
- "test:yarn-pnp:copy": "shx cp -r test/integration/yarn-pnp.template test/integration/yarn-pnp.testing-ground",
128
- "test:yarn-pnp:install": "cd test/integration/yarn-pnp.testing-ground && yarn && yarn add -D ../../../dependency-cruiser*.tgz",
129
- "test:yarn-pnp:version": "cd test/integration/yarn-pnp.testing-ground && yarn dependency-cruise:version",
130
- "test:yarn-pnp:run": "cd test/integration/yarn-pnp.testing-ground && yarn dependency-cruise:json",
131
- "test:yarn-pnp:test": "cd test/integration/yarn-pnp.testing-ground && yarn test",
132
- "test:yarn-pnp:cache-clean": "yarn cache clean",
133
- "test:yarn-pnp:cleanup": "shx rm -rf test/integration/yarn-pnp.testing-ground dependency-cruiser*.tgz",
134
- "test:load": "hyperfine --warmup 3 --runs 30 \"bin/dependency-cruise.js src bin test configs types tools --ignore-known --validate --no-cache --no-progress\"",
135
- "test:load:short": "hyperfine --warmup 1 --runs 5 \"bin/dependency-cruise.js src bin test configs types tools --ignore-known --validate --no-cache --no-progress\"",
136
- "test:watch": "mocha --watch --watch-extensions=json --reporter=min test/\\*\\*/\\*.spec.js",
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
+ "test:load": "hyperfine --warmup 3 --runs 30 \"bin/dependency-cruise.mjs src bin test configs types tools --ignore-known --no-cache --no-progress\"",
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
137
  "update-dependencies": "npm-run-all upem:update upem:install build:clean build lint:eslint:clear-caches lint:fix depcruise test:cover",
138
138
  "upem-outdated": "npm outdated --json --long | upem --dry-run",
139
139
  "upem:install": "npm install",
@@ -147,15 +147,15 @@
147
147
  "acorn-loose": "8.3.0",
148
148
  "acorn-walk": "8.2.0",
149
149
  "ajv": "8.12.0",
150
- "chalk": "^4.1.2",
151
- "commander": "10.0.0",
150
+ "chalk": "5.2.0",
151
+ "commander": "10.0.1",
152
152
  "enhanced-resolve": "5.12.0",
153
- "figures": "^3.2.0",
153
+ "figures": "5.0.0",
154
154
  "get-stream": "^6.0.1",
155
- "glob": "7.2.0",
155
+ "glob": "10.1.0",
156
156
  "handlebars": "4.7.7",
157
157
  "ignore": "5.2.4",
158
- "indent-string": "^4.0.0",
158
+ "indent-string": "5.0.0",
159
159
  "interpret": "^3.1.1",
160
160
  "is-installed-globally": "0.4.0",
161
161
  "json5": "2.2.3",
@@ -163,29 +163,29 @@
163
163
  "prompts": "2.4.2",
164
164
  "rechoir": "^0.8.0",
165
165
  "safe-regex": "2.1.1",
166
- "semver": "^7.3.7",
167
- "semver-try-require": "6.2.0",
166
+ "semver": "^7.4.0",
167
+ "semver-try-require": "6.2.2",
168
168
  "teamcity-service-messages": "0.1.14",
169
169
  "tsconfig-paths-webpack-plugin": "4.0.1",
170
- "watskeburt": "0.10.1",
171
- "wrap-ansi": "^7.0.0"
170
+ "watskeburt": "0.10.2",
171
+ "wrap-ansi": "8.1.0"
172
172
  },
173
173
  "devDependencies": {
174
174
  "@babel/core": "7.21.4",
175
175
  "@babel/plugin-transform-modules-commonjs": "7.21.2",
176
176
  "@babel/preset-typescript": "7.21.4",
177
- "@swc/core": "1.3.44",
178
- "@types/lodash": "4.14.192",
177
+ "@swc/core": "1.3.50",
178
+ "@types/lodash": "4.14.194",
179
179
  "@types/node": "18.15.11",
180
180
  "@types/prompts": "2.4.4",
181
- "@typescript-eslint/eslint-plugin": "5.57.0",
182
- "@typescript-eslint/parser": "5.57.0",
181
+ "@typescript-eslint/eslint-plugin": "5.58.0",
182
+ "@typescript-eslint/parser": "5.58.0",
183
183
  "@vue/compiler-sfc": "3.2.47",
184
184
  "c8": "7.13.0",
185
185
  "chai": "4.3.7",
186
186
  "chai-json-schema": "1.5.1",
187
187
  "coffeescript": "2.7.0",
188
- "eslint": "8.37.0",
188
+ "eslint": "8.38.0",
189
189
  "eslint-config-moving-meadow": "4.0.2",
190
190
  "eslint-config-prettier": "8.8.0",
191
191
  "eslint-plugin-budapestian": "5.0.1",
@@ -197,66 +197,36 @@
197
197
  "eslint-plugin-unicorn": "^46.0.0",
198
198
  "husky": "8.0.3",
199
199
  "intercept-stdout": "0.1.2",
200
- "lint-staged": "13.2.0",
200
+ "lint-staged": "13.2.1",
201
201
  "mocha": "10.2.0",
202
- "normalize-newline": "^3.0.0",
202
+ "normalize-newline": "4.1.0",
203
203
  "npm-run-all": "4.1.5",
204
204
  "prettier": "2.8.7",
205
205
  "proxyquire": "2.1.3",
206
206
  "shx": "0.3.4",
207
207
  "svelte": "3.58.0",
208
208
  "symlink-dir": "5.1.1",
209
- "typescript": "5.0.3",
209
+ "typescript": "5.0.4",
210
210
  "upem": "7.3.2",
211
211
  "vue-template-compiler": "2.7.14",
212
212
  "yarn": "1.22.19"
213
213
  },
214
214
  "upem": {
215
215
  "policies": [
216
- {
217
- "package": "chalk",
218
- "policy": "wanted",
219
- "because": "version 5 only exports esm - and we use cjs and don't transpile"
220
- },
221
- {
222
- "package": "figures",
223
- "policy": "wanted",
224
- "because": "version 4 only exports esm - and we use cjs and don't transpile"
225
- },
226
- {
227
- "package": "glob",
228
- "policy": "pin",
229
- "because": "from version 7.2.1 behavior on windows changes - in a potentially breaking fashion. Wait with upgrading until we're majoring or from when there's a vuln in 7.2.0"
230
- },
231
- {
232
- "package": "indent-string",
233
- "policy": "wanted",
234
- "because": "version 5 only exports esm - and we use cjs and don't transpile"
235
- },
236
216
  {
237
217
  "package": "interpret",
238
218
  "policy": "wanted",
239
219
  "because": "we want to keep interpret ~similar to what webpack-cli uses (which is ^3.1.1 since 2022-11-15). See https://github.com/webpack/webpack-cli/blame/master/packages/webpack-cli/package.json"
240
220
  },
241
- {
242
- "package": "normalize-newline",
243
- "policy": "wanted",
244
- "because": "version 4 only exports esm - and we use cjs and don't transpile (this only used in unit tests - but one of'em is a cjs one ...)"
245
- },
246
221
  {
247
222
  "package": "rechoir",
248
223
  "policy": "wanted",
249
224
  "because": "we want to keep rechoir ~similar to what webpack-cli uses (which is ^0.8.0 since 2022-11-15). See https://github.com/webpack/webpack-cli/blame/master/packages/webpack-cli/package.json"
250
- },
251
- {
252
- "package": "wrap-ansi",
253
- "policy": "wanted",
254
- "because": "version 8 only exports esm - and we use cjs and don't transpile"
255
225
  }
256
226
  ]
257
227
  },
258
228
  "engines": {
259
- "node": "^14||^16||>=18"
229
+ "node": "^16.14||>=18"
260
230
  },
261
231
  "supportedTranspilers": {
262
232
  "babel": ">=7.0.0 <8.0.0",
@@ -1,15 +1,15 @@
1
- const { readFileSync, mkdirSync, writeFileSync } = require("fs");
2
- const { join } = require("path");
3
- const meta = require("../extract/transpile/meta");
4
- const { optionsAreCompatible } = require("./options-compatible");
5
- const MetadataStrategy = require("./metadata-strategy");
6
- const ContentStrategy = require("./content-strategy");
1
+ import { readFileSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { scannableExtensions } from "../extract/transpile/meta.mjs";
4
+ import { optionsAreCompatible } from "./options-compatible.mjs";
5
+ import MetadataStrategy from "./metadata-strategy.mjs";
6
+ import ContentStrategy from "./content-strategy.mjs";
7
7
 
8
8
  const CACHE_FILE_NAME = "cache.json";
9
9
 
10
- module.exports = class Cache {
10
+ export default class Cache {
11
11
  /**
12
- * @param {import("../../types/cache-options").cacheStrategyType=} pCacheStrategy
12
+ * @param {import("../../types/cache-options.js").cacheStrategyType=} pCacheStrategy
13
13
  */
14
14
  constructor(pCacheStrategy) {
15
15
  this.revisionData = null;
@@ -20,9 +20,9 @@ module.exports = class Cache {
20
20
  }
21
21
 
22
22
  /**
23
- * @param {import("../../types/strict-options").IStrictCruiseOptions} pCruiseOptions
24
- * @param {import("../..").ICruiseResult} pCachedCruiseResult
25
- * @param {import("../..").IRevisionData=} pRevisionData
23
+ * @param {import("../../types/strict-options.js").IStrictCruiseOptions} pCruiseOptions
24
+ * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCachedCruiseResult
25
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pRevisionData
26
26
  * @returns {boolean}
27
27
  */
28
28
  canServeFromCache(pCruiseOptions, pCachedCruiseResult, pRevisionData) {
@@ -34,9 +34,7 @@ module.exports = class Cache {
34
34
  pCruiseOptions,
35
35
  {
36
36
  extensions: new Set(
37
- meta.scannableExtensions.concat(
38
- pCruiseOptions.extraExtensionsToScan
39
- )
37
+ scannableExtensions.concat(pCruiseOptions.extraExtensionsToScan)
40
38
  ),
41
39
  }
42
40
  );
@@ -54,7 +52,7 @@ module.exports = class Cache {
54
52
 
55
53
  /**
56
54
  * @param {string} pCacheFolder
57
- * @returns {import("../..").ICruiseResult}
55
+ * @returns {import("../../types/dependency-cruiser.js").ICruiseResult}
58
56
  */
59
57
  read(pCacheFolder) {
60
58
  try {
@@ -68,8 +66,8 @@ module.exports = class Cache {
68
66
 
69
67
  /**
70
68
  * @param {string} pCacheFolder
71
- * @param {import("../..").ICruiseResult} pCruiseResult
72
- * @param {import("../..").IRevisionData=} pRevisionData
69
+ * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCruiseResult
70
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData=} pRevisionData
73
71
  */
74
72
  write(pCacheFolder, pCruiseResult, pRevisionData) {
75
73
  const lRevisionData = pRevisionData ?? this.revisionData;
@@ -86,4 +84,4 @@ module.exports = class Cache {
86
84
  "utf8"
87
85
  );
88
86
  }
89
- };
87
+ }
@@ -1,16 +1,16 @@
1
- const { join } = require("path").posix;
2
- const { isDeepStrictEqual } = require("util");
3
- const findContentChanges = require("./find-content-changes");
4
- const {
1
+ import { isDeepStrictEqual } from "node:util";
2
+ import { join } from "node:path/posix";
3
+ import findContentChanges from "./find-content-changes.mjs";
4
+ import {
5
5
  getFileHash,
6
6
  isInterestingChangeType,
7
7
  addCheckSumToChange,
8
8
  moduleIsInterestingForDiff,
9
- } = require("./utl");
9
+ } from "./helpers.mjs";
10
10
 
11
11
  /**
12
12
  * @param {string} pBaseDirectory
13
- * @returns {(pModule: import("../..").IModule) => import("../..").IModule}
13
+ * @returns {(pModule: import("../../types/dependency-cruiser.js").IModule) => import("../../types/dependency-cruiser.js").IModule}
14
14
  */
15
15
  function addCheckSumToModule(pBaseDirectory) {
16
16
  return (pModule) => {
@@ -25,9 +25,9 @@ function addCheckSumToModule(pBaseDirectory) {
25
25
  }
26
26
 
27
27
  /**
28
- * @param {import("../..").IRevisionChange[]} pChanges
29
- * @param {import("../..").IModule[]} pModules
30
- * @returns {import("../..").IRevisionChange[]}
28
+ * @param {import("../../types/dependency-cruiser.js").IRevisionChange[]} pChanges
29
+ * @param {import("../../types/dependency-cruiser.js").IModule[]} pModules
30
+ * @returns {import("../../types/dependency-cruiser.js").IRevisionChange[]}
31
31
  */
32
32
  function refreshChanges(pChanges, pModules) {
33
33
  return pChanges.filter(
@@ -40,18 +40,18 @@ function refreshChanges(pChanges, pModules) {
40
40
  );
41
41
  }
42
42
 
43
- module.exports = class ContentStrategy {
43
+ export default class ContentStrategy {
44
44
  /**
45
45
  * @param {string} pDirectory
46
- * @param {import("../..").ICruiseResult} pCachedCruiseResult
47
- * @param {import("../../types/strict-options").IStrictCruiseOptions} pCruiseOptions
46
+ * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCachedCruiseResult
47
+ * @param {import("../../types/strict-options.js").IStrictCruiseOptions} pCruiseOptions
48
48
  * @param {Object} pOptions
49
49
  * @param {Set<string>} pOptions.extensions
50
50
  * @param {Set<import("watskeburt").changeTypeType>} pOptions.interestingChangeTypes
51
51
  * @param {string} pOptions.baseDir
52
52
  * @param {(pString:string) => Array<import("watskeburt").IChange>} pOptions.diffListFn
53
53
  * @param {(import("watskeburt").IChange) => import("../..").IRevisionChange} pOptions.checksumFn
54
- * @returns {import("../..").IRevisionData}
54
+ * @returns {import("../../types/dependency-cruiser.js").IRevisionData}
55
55
  */
56
56
  getRevisionData(pDirectory, pCachedCruiseResult, pCruiseOptions, pOptions) {
57
57
  const lOptions = {
@@ -74,8 +74,8 @@ module.exports = class ContentStrategy {
74
74
  }
75
75
 
76
76
  /**
77
- * @param {import("../..").IRevisionData} pExistingRevisionData
78
- * @param {import("../..").IRevisionData} pNewRevisionData
77
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData} pExistingRevisionData
78
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData} pNewRevisionData
79
79
  * @returns {boolean}
80
80
  */
81
81
  revisionDataEqual(pExistingRevisionData, pNewRevisionData) {
@@ -91,9 +91,9 @@ module.exports = class ContentStrategy {
91
91
  }
92
92
 
93
93
  /**
94
- * @param {import("../..").ICruiseResult} pCruiseResult
95
- * @param {import("../..").IRevisionData} pRevisionData
96
- * @returns {import("../..").ICruiseResult}
94
+ * @param {import("../../types/dependency-cruiser.js").ICruiseResult} pCruiseResult
95
+ * @param {import("../../types/dependency-cruiser.js").IRevisionData} pRevisionData
96
+ * @returns {import("../../types/dependency-cruiser.js").ICruiseResult}
97
97
  */
98
98
  prepareRevisionDataForSaving(pCruiseResult, pRevisionData) {
99
99
  const lModulesWithCheckSum = pCruiseResult.modules.map(
@@ -110,4 +110,4 @@ module.exports = class ContentStrategy {
110
110
  revisionData: lRevisionData,
111
111
  };
112
112
  }
113
- };
113
+ }