dependency-cruiser 16.2.0 → 16.2.1

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/README.md CHANGED
@@ -42,7 +42,7 @@ a `.dependency-cruiser.js` configuration file attuned to your project[^1][^2].
42
42
  `npx`.
43
43
 
44
44
  [^2]:
45
- If you don't don't want to use `npx`, but instead `pnpx` (from the `pnpm`
45
+ If you don't want to use `npx`, but instead `pnpx` (from the `pnpm`
46
46
  package manager) or `yarn` - please refer to that tool's documentation.
47
47
  Particularly `pnpx` has semantics that differ from `npx` quite significantly
48
48
  and that you want to be aware of before using it. In the mean time: `npx`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dependency-cruiser",
3
- "version": "16.2.0",
3
+ "version": "16.2.1",
4
4
  "description": "Validate and visualize dependencies. With your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.",
5
5
  "keywords": [
6
6
  "static analysis",
@@ -16,15 +16,48 @@
16
16
  "validation",
17
17
  "spelunking"
18
18
  ],
19
- "author": {
20
- "name": "Sander Verweij",
21
- "url": "https://sverweij.github.io"
22
- },
19
+ "author": "Sander Verweij (https://sverweij.github.io)",
23
20
  "contributors": [
24
- {
25
- "name": "Klaus Meinhardt",
26
- "url": "https://github.com/ajafff"
27
- }
21
+ "Hirotaka Miyagi (https://mh4gf.dev)",
22
+ "TruongSinh Tran-Nguyen (https://truongsinh.pro)",
23
+ "Bastian Hess (https://github.com/bashess)",
24
+ "Álvaro Cuesta (https://github.com/alvaro-cuesta)",
25
+ "anna (https://github.com/annamooseity)",
26
+ "Radosław Kłos (https://klos.dev)",
27
+ "Joshua T (https://github.com/radiantly)",
28
+ "Ivan (https://github.com/Winner95)",
29
+ "Frieder Bluemle (https://github.com/friederbluemle)",
30
+ "davidparkagoda (https://github.com/davidparkagoda)",
31
+ "Matt Button (https://github.com/BRMatt)",
32
+ "Jon Lauridsen (https://jonlauridsen.com)",
33
+ "Klaus Meinhardt (https://github.com/ajafff)",
34
+ "cunzaizhuyi (https://github.com/cunzaizhuyi)",
35
+ "Greg Lockwood (https://github.com/greglockwood)",
36
+ "Jeremy Magland (https://github.com/magland)",
37
+ "Sebastian Landwehr (https://sebastianlandwehr.com)",
38
+ "Brody McKee (https://github.com/mrmckeb)",
39
+ "Bin (https://github.com/soulhat)",
40
+ "정건우 (https://www.zigae.com/)",
41
+ "Roy Swinkels (https://github.com/donroyco)",
42
+ "Martin Slota (https://github.com/martinslota)",
43
+ "Luke Page (https://github.com/lukeapage)",
44
+ "Emily Marigold Klassen (https://forivall.com)",
45
+ "Christian Vuerings (https://github.com/christianvuerings)",
46
+ "Yuanhai He (https://bestmike007.com)",
47
+ "Quentin de Metz (https://github.com/quentindemetz)",
48
+ "Lars Artmann (https://larsartmann.com)",
49
+ "Jessica Kerr (https://jessitron.com)",
50
+ "Creative Ataraxia (https://github.com/Creative-Ataraxia)",
51
+ "0xflotus (https://github.com/0xflotus)",
52
+ "Daniel Edholm Ignat (https://github.com/dignite)",
53
+ "Daniel Rodríguez Rivero (https://danielorodriguez.com)",
54
+ "Nick Ribal (https://github.com/elektronik2k5)",
55
+ "Richard Musiol https(://github.com/neelance)",
56
+ "Sharang Pai (https://sharangpai.me)",
57
+ "Stefan Gojan (https://stefan-gojan.de)",
58
+ "Tharun Rajendran (https://github.com/tharun208)",
59
+ "electrovir (https://github.com/electrovir)",
60
+ "fusheng (https://github.com/lin-hun)"
28
61
  ],
29
62
  "license": "MIT",
30
63
  "repository": {
@@ -115,11 +148,11 @@
115
148
  "is-installed-globally": "1.0.0",
116
149
  "json5": "2.2.3",
117
150
  "lodash": "4.17.21",
118
- "picomatch": "3.0.1",
151
+ "picomatch": "4.0.1",
119
152
  "prompts": "2.4.2",
120
153
  "rechoir": "^0.8.0",
121
154
  "safe-regex": "2.1.1",
122
- "semver": "^7.5.4",
155
+ "semver": "^7.6.0",
123
156
  "semver-try-require": "6.2.3",
124
157
  "teamcity-service-messages": "0.1.14",
125
158
  "tsconfig-paths-webpack-plugin": "4.1.0",
@@ -127,11 +160,11 @@
127
160
  "wrap-ansi": "9.0.0"
128
161
  },
129
162
  "overrides": {
130
- "semver": "^7.5.4",
163
+ "semver": "^7.6.0",
131
164
  "postcss": "^8.4.31"
132
165
  },
133
166
  "resolutions": {
134
- "semver": "^7.5.4",
167
+ "semver": "^7.6.0",
135
168
  "postcss": "^8.4.31"
136
169
  },
137
170
  "engines": {
@@ -199,38 +199,31 @@ module.exports = {
199
199
  ],
200
200
  options: {
201
201
 
202
- /* conditions specifying which files not to follow further when encountered:
203
- - path: a regular expression to match
204
- - dependencyTypes: see https://github.com/sverweij/dependency-cruiser/blob/main/doc/rules-reference.md#dependencytypes-and-dependencytypesnot
205
- for a complete list
206
- */
202
+ /* Which modules not to follow further when encountered */
207
203
  doNotFollow: {
208
- path: 'node_modules'
204
+ /* path: an array of regular expressions in strings to match against */
205
+ path: ['node_modules']
209
206
  },
210
207
 
211
- /* conditions specifying which dependencies to exclude
212
- - path: a regular expression to match
213
- - dynamic: a boolean indicating whether to ignore dynamic (true) or static (false) dependencies.
214
- leave out if you want to exclude neither (recommended!)
215
- */
208
+ /* Which modules to exclude */
216
209
  // exclude : {
210
+ // /* path: an array of regular expressions in strings to match against */
217
211
  // path: '',
218
- // dynamic: true
219
212
  // },
220
213
 
221
- /* pattern specifying which files to include (regular expression)
214
+ /* Which modules to exclusively include (array of regular expressions in strings)
222
215
  dependency-cruiser will skip everything not matching this pattern
223
216
  */
224
- // includeOnly : '',
217
+ // includeOnly : [''],
225
218
 
226
219
  /* dependency-cruiser will include modules matching against the focus
227
- regular expression in its output, as well as their neighbours (direct
228
- dependencies and dependents)
220
+ regular expression in its output, as well as their direct neighbours
221
+ (dependencies and dependents)
229
222
  */
230
223
  // focus : '',
231
224
 
232
- /* List of module systems to cruise.
233
- When left out dependency-cruiser will fall back to the list of _all_
225
+ /* List of module systems to cruise.
226
+ When left out dependency-cruiser will fall back to the list of _all_
234
227
  module systems it knows of. It's the default because it's the safe option
235
228
  It might come at a performance penalty, though.
236
229
  moduleSystems: ['amd', 'cjs', 'es6', 'tsd']
@@ -245,7 +238,7 @@ module.exports = {
245
238
  to open it on your online repo or \`vscode://file/$\{process.cwd()}/\` to
246
239
  open it in visual studio code),
247
240
  */
248
- // prefix: '',
241
+ // prefix: 'vscode://file/$\{process.cwd()}/\',
249
242
 
250
243
  /* false (the default): ignore dependencies that only exist before typescript-to-javascript compilation
251
244
  true: also detect dependencies that only exist before typescript-to-javascript compilation
@@ -253,10 +246,9 @@ module.exports = {
253
246
  */
254
247
  {{tsPreCompilationDepsAttribute}}
255
248
 
256
- /*
257
- list of extensions to scan that aren't javascript or compile-to-javascript.
249
+ /* list of extensions to scan that aren't javascript or compile-to-javascript.
258
250
  Empty by default. Only put extensions in here that you want to take into
259
- account that are _not_ parsable.
251
+ account that are _not_ parsable.
260
252
  */
261
253
  // extraExtensionsToScan: [".json", ".jpg", ".png", ".svg", ".webp"],
262
254
 
@@ -293,9 +285,7 @@ module.exports = {
293
285
 
294
286
  /* Babel config ('.babelrc', '.babelrc.json', '.babelrc.json5', ...) to use
295
287
  for compilation (and whatever other naughty things babel plugins do to
296
- source code). This feature is well tested and usable, but might change
297
- behavior a bit over time (e.g. more precise results for used module
298
- systems) without dependency-cruiser getting a major version bump.
288
+ source code).
299
289
  */
300
290
  {{babelConfigAttribute}}
301
291
 
@@ -305,57 +295,37 @@ module.exports = {
305
295
  a hack.
306
296
  */
307
297
  // exoticRequireStrings: [],
298
+
308
299
  /* options to pass on to enhanced-resolve, the package dependency-cruiser
309
- uses to resolve module references to disk. You can set most of these
310
- options in a webpack.conf.js - this section is here for those
311
- projects that don't have a separate webpack config file.
300
+ uses to resolve module references to disk. The values below should be
301
+ suitable for most situations
312
302
 
313
- Note: settings in webpack.conf.js override the ones specified here.
303
+ If you use webpack: you can also set these in webpack.conf.js. The set
304
+ there will override the ones specified here.
314
305
  */
315
306
  enhancedResolveOptions: {
316
- /* List of strings to consider as 'exports' fields in package.json. Use
317
- ['exports'] when you use packages that use such a field and your environment
318
- supports it (e.g. node ^12.19 || >=14.7 or recent versions of webpack).
319
-
320
- If you have an \`exportsFields\` attribute in your webpack config, that one
321
- will have precedence over the one specified here.
322
- */
307
+ /* What to consider as an 'exports' field in package.jsons */
323
308
  exportsFields: ["exports"],
324
- /* List of conditions to check for in the exports field. e.g. use ['imports']
325
- if you're only interested in exposed es6 modules, ['require'] for commonjs,
326
- or all conditions at once \`(['import', 'require', 'node', 'default']\`)
327
- if anything goes for you. Only works when the 'exportsFields' array is
328
- non-empty.
329
-
330
- If you have a 'conditionNames' attribute in your webpack config, that one will
331
- have precedence over the one specified here.
309
+ /* List of conditions to check for in the exports field.
310
+ Only works when the 'exportsFields' array is non-empty.
332
311
  */
333
312
  conditionNames: ["import", "require", "node", "default", "types"],
334
313
  /*
335
314
  The extensions, by default are the same as the ones dependency-cruiser
336
315
  can access (run \`npx depcruise --info\` to see which ones that are in
337
- _your_ environment. If that list is larger than what you need (e.g.
338
- it contains .js, .jsx, .ts, .tsx, .cts, .mts - but you don't use
339
- TypeScript you can pass just the extensions you actually use (e.g.
340
- [".js", ".jsx"]). This can speed up the most expensive step in
341
- dependency cruising (module resolution) quite a bit.
316
+ _your_ environment. If that list is larger than you need you can pass
317
+ 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.
342
320
  */
343
321
  {{extensionsAttribute}}
344
- /*
345
- If your TypeScript project makes use of types specified in 'types'
346
- fields in package.jsons of external dependencies, specify "types"
347
- in addition to "main" in here, so enhanced-resolve (the resolver
348
- dependency-cruiser uses) knows to also look there. You can also do
349
- this if you're not sure, but still use TypeScript. In a future version
350
- of dependency-cruiser this will likely become the default.
351
- */
322
+ /* What to consider a 'main' field in package.json */
352
323
  {{mainFieldsAttribute}}
353
324
  /*
354
- A list of alias fields in manifests (package.jsons).
355
- Specify a field, such as browser, to be parsed according to
356
- [this specification](https://github.com/defunctzombie/package-browser-field-spec).
357
- Also see [resolve.alias](https://webpack.js.org/configuration/resolve/#resolvealiasfields)
358
- in the webpack docs.
325
+ A list of alias fields in package.jsons
326
+ 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.
359
329
 
360
330
  Defaults to an empty array (don't use any alias fields).
361
331
  */
@@ -377,70 +347,13 @@ module.exports = {
377
347
  */
378
348
  // theme: {
379
349
  // graph: {
380
- // /* use splines: "ortho" for straight lines. Be aware though
381
- // graphviz might take a long time calculating ortho(gonal)
382
- // routings.
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
383
354
  // */
384
355
  // splines: "true"
385
356
  // },
386
- // modules: [
387
- // {
388
- // criteria: { matchesFocus: true },
389
- // attributes: {
390
- // fillcolor: "lime",
391
- // penwidth: 2,
392
- // },
393
- // },
394
- // {
395
- // criteria: { matchesFocus: false },
396
- // attributes: {
397
- // fillcolor: "lightgrey",
398
- // },
399
- // },
400
- // {
401
- // criteria: { matchesReaches: true },
402
- // attributes: {
403
- // fillcolor: "lime",
404
- // penwidth: 2,
405
- // },
406
- // },
407
- // {
408
- // criteria: { matchesReaches: false },
409
- // attributes: {
410
- // fillcolor: "lightgrey",
411
- // },
412
- // },
413
- // {
414
- // criteria: { source: "^src/model" },
415
- // attributes: { fillcolor: "#ccccff" }
416
- // },
417
- // {
418
- // criteria: { source: "^src/view" },
419
- // attributes: { fillcolor: "#ccffcc" }
420
- // },
421
- // ],
422
- // dependencies: [
423
- // {
424
- // criteria: { "rules[0].severity": "error" },
425
- // attributes: { fontcolor: "red", color: "red" }
426
- // },
427
- // {
428
- // criteria: { "rules[0].severity": "warn" },
429
- // attributes: { fontcolor: "orange", color: "orange" }
430
- // },
431
- // {
432
- // criteria: { "rules[0].severity": "info" },
433
- // attributes: { fontcolor: "blue", color: "blue" }
434
- // },
435
- // {
436
- // criteria: { resolved: "^src/model" },
437
- // attributes: { color: "#0000ff77" }
438
- // },
439
- // {
440
- // criteria: { resolved: "^src/view" },
441
- // attributes: { color: "#00770077" }
442
- // }
443
- // ]
444
357
  // }
445
358
  },
446
359
  archi: {
@@ -455,7 +368,7 @@ module.exports = {
455
368
  https://github.com/sverweij/dependency-cruiser/blob/main/doc/options-reference.md#reporteroptions
456
369
  for details and some examples. If you don't specify a theme
457
370
  for 'archi' dependency-cruiser will use the one specified in the
458
- dot section (see above), if any, and otherwise use the default one.
371
+ dot section above and otherwise use the default one.
459
372
  */
460
373
  // theme: {
461
374
  // },
@@ -102,7 +102,7 @@ export function addRunScriptsToManifest(pManifest, pAdditionalRunScripts) {
102
102
  const lManifest = { ...(pManifest || {}) };
103
103
  const lExistingRunScripts = lManifest.scripts || {};
104
104
 
105
- // This could instead simply be done with
105
+ // This could instead be done with
106
106
  // {...pAdditionalScriptEntries, ...lManifest} and no logic at all,
107
107
  // but that'd add the new scripts on top, which doesn't feel right
108
108
  //
@@ -37,8 +37,9 @@ async function processExtends(pReturnValue, pAlreadyVisited, pBaseDirectory) {
37
37
  * Reads the file with name `pConfigFileName` returns the parsed cruise
38
38
  * options.
39
39
  *
40
- * You can safely ignore the optional parameters. Simply this should work (given
41
- * `.dependency-cruiser.js` exists and contains a valid dependency-cruiser config)
40
+ * You can safely ignore the optional parameters. This should work (given
41
+ * `.dependency-cruiser.js` exists and contains a valid dependency-cruiser
42
+ * config)
42
43
  *
43
44
  * ```javascript
44
45
  * const depcruiseConfig = extractDepcruiseConfig("./.dependency-cruiser.js")
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable max-lines */
2
2
  import { isAbsolute, resolve as path_resolve } from "node:path";
3
3
  import { join as posix_join } from "node:path/posix";
4
- import { isMatch } from "picomatch";
4
+ import picomatch from "picomatch";
5
5
  import getExtension from "#utl/get-extension.mjs";
6
6
 
7
7
  let gFollowableExtensionsCache = new Set();
@@ -158,7 +158,7 @@ function isWorkspaceAliased(pModuleName, pResolvedModuleName, pManifest) {
158
158
  (pWorkspace) =>
159
159
  pWorkspace.endsWith("/") ? `${pWorkspace}**` : `${pWorkspace}/**`,
160
160
  );
161
- if (isMatch(pResolvedModuleName, lModuleFriendlyWorkspaceGlobs)) {
161
+ if (picomatch.isMatch(pResolvedModuleName, lModuleFriendlyWorkspaceGlobs)) {
162
162
  return true;
163
163
  }
164
164
  // it's possible to run node with --preserve-symlinks, in which case
@@ -176,7 +176,10 @@ function isWorkspaceAliased(pModuleName, pResolvedModuleName, pManifest) {
176
176
  lModuleFriendlyWorkspaceGlobs.map(
177
177
  (pWorkspace) => `(node_modules/)?${pWorkspace}`,
178
178
  );
179
- return isMatch(pModuleName, lModuleFriendlyWorkspaceGlobsWithNodeModules);
179
+ return picomatch.isMatch(
180
+ pModuleName,
181
+ lModuleFriendlyWorkspaceGlobsWithNodeModules,
182
+ );
180
183
  }
181
184
  return false;
182
185
  }
package/src/meta.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /* generated - don't edit */
2
2
 
3
3
  module.exports = {
4
- version: "16.2.0",
4
+ version: "16.2.1",
5
5
  engines: {
6
6
  node: "^18.17||>=20",
7
7
  },
@@ -4,8 +4,9 @@ import type { ICruiseOptions } from "../options.mjs";
4
4
  * Reads the file with name `pConfigFileName` returns the parsed cruise
5
5
  * options.
6
6
  *
7
- * You can safely ignore the optional parameters. Simply this should work (given
8
- * `.dependency-cruiser.js` exists and contains a valid dependency-cruiser config)
7
+ * You can safely ignore the optional parameters. This should work (given
8
+ * `.dependency-cruiser.js` exists and contains a valid dependency-cruiser
9
+ * config)
9
10
  *
10
11
  * ```javascript
11
12
  * const depcruiseConfig = extractDepcruiseConfig("./.dependency-cruiser.js")