dependency-cruiser

Validate and visualize dependencies. Your rules. JavaScript, TypeScript, CoffeeScript. ES6, CommonJS, AMD.

MIT License

Downloads
1.5M
Stars
4.9K
Committers
47

Bot releases are hidden (Show)

dependency-cruiser - Latest Release

Published by sverweij 6 months ago

๐Ÿ› fixes

  • 15d692ee fix(graph-utl): lets findRuleByName also search in 'required' rules (#931) (thanks to @jrencz for finding and reporting the issue!)

๐Ÿ‘ท maintenance

  • 5504f35a build(npm): updates external dependencies
dependency-cruiser -

Published by sverweij 6 months ago

โœจ features

  • 0cabd8b2 feat(report/metrics): adds experimental stats (#929)
  • 2ef8eb54 feat(enrich): adds experimental stats to folders (#928)
  • bbd5c08f fix(cache): adds experimentalStats to cache invalidation algorithm
  • 2bead212 feat(extract): adds first sketch to get basic stats from the parsed AST's (#926)
  • 8c71ca4e feat(dot): displays re-export dependencies with an 'inverse' arrow

๐Ÿ› fixes

  • 1d0e32fb fix(report): also show metrics in the x-dot-webpage reporter output (#927)
  • 70008a09 fix(tools/schema): corrects two typos

๐Ÿ‘ท maintenance

  • bb70db62 build(npm): updates external dependencies
  • b966c0a6 refactor(extract): reorganizes so it's easier to expand functionality (#925)
  • d2c7cd4b chore(dependabot): groups minor and patch bumps for GHA's
  • 5bb969ff refactor: dedups uniq
dependency-cruiser -

Published by sverweij 7 months ago

๐Ÿ› fixes

  • 1c2920e1 fix(resolve): makes dependency classifier handle more flavours of the 'workspaces' type alias field (#920) (thanks @danroberts for raising the clearly documented bug report that led to this fix)
  • 593d29f6 doc(cli): adds command line example for mermaid (thanks @asmrtfm for notIcing the omission!)

๐Ÿ‘ท maintenance

  • 320d2eec build(npm): updates external dependencies
  • fea1abe0 refactor: replaces lodash/has & lodash/get with native options where possible (#924)
  • 24370fc4 refactor(extract|graph-utl): uniq ourselves
  • c9d8b97b refactor: replaces lodash/memoize with memoize (#923)
  • dcc8c10c refactor: for randomness use node:crypto (#921)
dependency-cruiser -

Published by sverweij 7 months ago

๐Ÿ› fixes

  • 717ef45d fix(resolve): also take yarn@1 workspaces.packages arrays into account for workspaces alias detection
  • e49d6982 fix(resolve): ignores 'workspaces' field when it isn't an array
dependency-cruiser -

Published by sverweij 7 months ago

๐Ÿ› fixes

  • e49d6982 fix(resolve): ignores 'workspaces' field when it isn't an array (thanks danroberts for raising the issue that led to this fix!)
dependency-cruiser -

Published by sverweij 8 months ago

๐Ÿ› fixes

  • f8b7839d fix(init): adds a comment to the generated EHR 'mainFields' option
  • 885d7540 fix(npm): fixes typo in the contributors array
  • 0c5ed568 fix(init): adds often used suffixes to some of the initial rules (#917) - thanks @jg210 for raising the clear, well documented issue that led to this fix!

๐Ÿ‘ท maintenance

  • a89719d8 build(npm): updates external dependencies
dependency-cruiser -

Published by sverweij 8 months ago

๐Ÿ› fixes

  • b196bbbe fix(init): uses backticks in the prefix example
  • cabbf2eb chore: makes sources type:module ready & publish as type:module (#915)

๐Ÿ‘ท maintenance

  • 3959d33a chore(package.json): removes mention of !.hbs in files list
  • 2a6b6d4c/ 525281dd chore: corrects typo in config & re-baseline
  • 24aec38e/ 1dcb73db chore(cache): migrates to watskeburt 4 (#914 / #912)
  • 1afc27f6 build(npm): updates external dependencies
dependency-cruiser -

Published by sverweij 8 months ago

๐Ÿ“– documentation

  • b32fb108 doc: adds list of contributors to package.json
  • 1488c99b doc(init-config): trims down the amount of comments in the .dependency-cruiser.js --init generates
  • 69572ac2 doc: copy tweaks

๐Ÿ‘ท maintenance

  • 45e7a27c build(npm): updates external dependencies
  • 0e3e5387 chore: restores package.json after packaging
dependency-cruiser -

Published by sverweij 9 months ago

โœจ features

  • 0f9fac9d/ 231ad6ea feat(report): adds a reporter that combines a dot reporter with executing dot and running the wrap-stream-in-html command (#907)

๐Ÿ“– documentation

  • 0fd45198 doc: rewrites copy on experimental features (which in some cases weren't experimental anymore)

๐Ÿ‘ท maintenance

  • b5922644 refactor(cli|report): moves responsibility to ensure output ends on an EOL to the individual reporters (#908)
  • af96c16c chore: for the local depcruise:graph:view commands use the experimental all-in-one reporter
  • bba4ee17 build(npm): updates external dependencies
dependency-cruiser -

Published by sverweij 9 months ago

โœจ features

  • 54fb588c feat(init): adds 'types' to the enhanced resolve export condition names
  • 24b3b2e2 feat(manifest): on publish removes devDependencies & scripts (#905)

๐Ÿ› fixes

  • 49fb96f4 fix(init): also shows an error if config file already exists with one shot configs

๐Ÿ‘ท maintenance

  • 263ef240 / bb4ec369 build(npm): updates external dependencies & devDependencies
  • 04b0274b chore: happy 2024
  • fbba9eaa test(cli): precises (and denoises) e2e test emitting to stdout
  • daa8a1ec test(enrich): adds a few test cases for cycle detection
  • 1a5d9949 chore: tweaks the rules that mandate type-only ness for more precission
  • b9d4d2bf refactor(cli): makes stderr, stdout configurable - so we can test their uses more easily (#898)
  • 3d31cc37 refactor(init-config): makes stderr, stdout configurable - so we can test their uses more easily (#897)
dependency-cruiser -

Published by sverweij 9 months ago

  • 46cb50ed ci: on publish remove devDependencies & scripts
  • 263ef240 build(npm): updates external dependencies
  • bb4ec369 ci(deps): bump actions/cache from 3 to 4 (#904)
  • 54fb588c feat(init): adds 'types' to the enhanced resolve export condition names
  • 04b0274b chore: happy 2024
  • 49fb96f4 fix(init): also shows an error if config file already exists with one shot configs
  • fbba9eaa test(cli): precises (and denoises) e2e test emitting to stdout
  • daa8a1ec test(enrich): adds a few test cases for cycle detection
  • 1a5d9949 chore: tweaks the rules that mandate type-only ness for more precission
  • b9d4d2bf refactor(cli): makes stderr, stdout configurable - so we can test their uses more easily (#898)
  • 3d31cc37 refactor(init-config): makes stderr, stdout configurable - so we can test their uses more easily (#897)
dependency-cruiser -

Published by sverweij 10 months ago

โšก Is this release breaking for me?

TL;DR: Not likely, if you only use the command line interface

๐Ÿ‘ฉ I use the command line interface

When you have rules defined on dependency type type-only or on the
aliased-* ones, dependency-cruiser might start to report issues it didn't
in previous versions as it now more precisely detects those.

  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875) (@alvaro-cuesta)

๐Ÿค– I use the API

  • 05d97951 feat!: restructures the via* sub-restrictions to also accept & validate against dependency types (BREAKING for API users) (#894). See rules-reference.md#circular for details.

    • before: in rules cycles can be restricted with the restrictions via, viaOnly, viaNot and viaSomeNot, each of which would accept a regular expression (or an array of them) to match against the module names in the cycle.
    • after: in rules cycles can be restricted with the restrictions via and viaOnly each of which takes an object with the following properties:
      • path: a regular expression (or an array of them) to match against the module names in the cycle.
      • pathNot: a regular expression (or an array of them) to match against the module names in the cycle.
      • dependencyTypes: an array of strings (dependency types) match against the dependency types in the cycle.
      • dependencyTypesNot: an array of strings (dependency types) match against the dependency types in the cycle.
  • c6421e3c feat!: makes entries in 'cycle' contain more information (BREAKING for API users) (#888)

    • before: a cycle in the dependency graph would be reported as an array of strings (the module names)
    • after: a cycle in the dependency graph is reported as an array of objects with the following properties:
      • name: the name of the module
      • dependencyTypes: the types of dependency the module has with the previous
        module in the cycle.
  • e8cda75a feat!: makes entries in reachability via's contain more information (BREAKING for API users) (#895)

    • before: a route ('via') in the dependency graph would be reported as an array of strings (the module names)
    • after: a route ('via') in the dependency graph is reported as an array of objects with the following properties:
      • name: the name of the module
      • dependencyTypes: the types of dependency the module has with the previous
        module in the route.

โค๏ธ Thanks

  • @camillef - for raising the clear & complete issue that asks to check against dependency types over the entire cycle for circular dependencies
  • @alvaro-cuesta - for the PR that made the type-only detection more precise
  • @throrin19 - for raising #863 that led to better detection of aliased-* dependencies and for testing the fixes
  • @stelescuraul - on adding a test case for workspace aliases on that issue and for testing the fixes for them
  • @martinslota - for a PR that made sure the output ends with a newline
  • @quentindemetz - for a PR that fixed a typo in the options reference

โœจ features

โœจ finer grained dependency types

In addition to the dependency types dependency-cruiser already distinguished
(local, npm, npm-dev, core, type-only unknown, etc) this release adds a few
that enables rules (and styling) against a few more fine grained ones. E.g.
whether it's a triple slash reference, and if so, what kind (triple-slash-file-reference,
triple-slash-type-reference) whether the dependency is defined in a normal
import, in a dynamic one or instead by way of a (re-)export statement (import,
dynamic-import, export). See rules-reference.md#dependencytypes-and-dependencytypesnot
for the entire list.

  • 11127b52 feat(extract): adds more granularity to dependency types (#884)
  • 6d4c72c3 fix(extract): prevents classifying core modules as aliased-tsconfig-base-url (#886)
  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 0278445e feat(extract): adds "pre-compilation-only" to the dependencyTypes as well, when detected (#892)

โœจ finer grained control on cycle rules

As asked in #695 dependency-cruiser now allows you to restrict cycles based on
the dependency types as well as the module names. See rules-reference.md#circular with
attributes in the via and viaOnly sub-restrictions.

  // ...

  // log an error for all circular dependencies which consist of only non-`type-only`
  // dependencies, so e.g.
  // violation : a -import-> b -import->           c -import-> a 
  // OK        : a -import-> b -import,type-only-> c -import-> a
  {
    name: 'no-circular-at-runtime',
    severity: 'error',
    from: {
    },
    to: {
      circular: true,
      viaOnly: {
        dependencyTypesNot: ['type-only']
      }
    }
  },

  // ...
  • 05d97951 feat!: restructures the via* sub-restrictions to also accept & validate against dependency types (BREAKING for API users) (#894)
  • c6421e3c feat!: makes entries in 'cycle' contain more information (BREAKING for API users) (#888)

The old notation for via and viaOnly still works, but is deprecated. To ensure
future working we've added these features to dependency-cruiser that guarantee
that the old notation will still work.

  • 433e0dc3 refactor(graph-utl): normalizes name attribute of dependencies on construction to simplify processing (#887)
  • 20e5b942 feat(config-utl): makes possibly old format known violations forward compatible (#890)
  • 7ddf2db7 feat(cache): adds cache format version & checks against it (#891)

โœจ detection of type-only dependencies within the curly brackets

This PR/ commit enables dependency-cruiser to detect type-only dependencies
that are

    // ...
    import type { SomeType } from 'some-module' // was already detected
    import { type SomeType } from 'some-module' // now also detected as type only
    // ...
    ```
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)(@alvaro-cuesta)

โœจ others

  • 7abbe47d feat(report/dot): adds ability to match arrays for conditional coloring (#882)
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879) (@martinslota)
  • e8cda75a feat!: makes entries in reachability via's contain more information (BREAKING for API users) (#895)

๐Ÿ‘ท maintenance

๐Ÿ“– documentation

  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 83fafe19 doc: updates alerts to use GH markdown alerts
  • 97e7c03b doc(options-reference): fix typo in swc dependency (#893) (@quentindemetz)
  • 52dee75a doc(types): swaps the comments for via and viaOnly

๐Ÿงน chores

  • 92c5782e ci: sets up semantic PR title check
  • 33978afe chore(ci): ensures our own dependency graphs only show red lines when the severity tells it so
  • 27485a47 ci: adds a few rules to own .dependency-cruiser.json
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always
  • c5eea789 chore(test): raises branch coverage limit

โ™ป๏ธ LCM

  • 83a55897 ci(deps): bump actions/stale from 8 to 9 (#885)
  • 875813e7 ci(deps): bump github/codeql-action from 2 to 3 (#889)
  • bfb3e2ba build(npm): updates external dependencies
dependency-cruiser -

Published by sverweij 10 months ago

features

finer grained dependency types

  • 11127b52 feat(extract): adds more granularity to dependency types (#884)
  • 6d4c72c3 fix(extract): prevents classifying core modules as aliased-tsconfig-base-url (#886)
  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 0278445e feat(extract): adds "pre-compilation-only" to the dependencyTypes as well, when detected (#892)

finer grained control on cycle rules

  • 05d97951 feat!: restructures the via* sub-restrictions to also accept & validate against dependency types (BREAKING for API users) (#894)
  • 433e0dc3 refactor(graph-utl): normalizes name attribute of dependencies on construction to simplify processing (#887)
  • c6421e3c feat!: makes entries in 'cycle' contain more information (BREAKING for API users) (#888)
  • 20e5b942 feat(config-utl): makes possibly old format known violations forward compatible (#890)
  • 7ddf2db7 feat(cache): adds cache format version & checks against it (#891)

other

  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
  • 76db5f0c feat(init): reduces the moduleSystems in the template to cjs and es6
  • 7abbe47d feat(report/dot): adds ability to match arrays for conditional coloring (#882)
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879)

maintenance

documentation

  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 83fafe19 doc: updates alerts to use GH markdown alerts
  • 97e7c03b doc(options-reference): fix typo in swc dependency (#893)

chores

  • 92c5782e ci: sets up semantic PR title check
  • 33978afe chore(ci): ensures our own dependency graphs only show red lines when the severity tells it so
  • 27485a47 ci: adds a few rules to own .dependency-cruiser.json
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always

LCM

  • 83a55897 ci(deps): bump actions/stale from 8 to 9 (#885)
  • 875813e7 ci(deps): bump github/codeql-action from 2 to 3 (#889)
dependency-cruiser -

Published by sverweij 10 months ago

  • 7ddf2db7 feat(cache): adds cache format version & checks against it (#891)
  • 875813e7 ci(deps): bump github/codeql-action from 2 to 3 (#889)
  • 20e5b942 feat(config-utl): makes possibly old format known violations forward compatible (#890)
  • c6421e3c feat!: makes entries in 'cycle' contain more information (BREAKING for API users) (#888)
  • 433e0dc3 refactor(graph-utl): normalizes name attribute of dependencies on construction to simplify processing (#887)
  • 6d4c72c3 fix(extract): prevents classifying core modules as aliased-tsconfig-base-url (#886)
  • 27485a47 ci: adds a few rules to own .dependency-cruiser.json
  • 76db5f0c feat(init): reduces the moduleSystems in the template to cjs and es6
  • 11127b52 feat(extract): adds more granularity to dependency types (#884)
  • 83a55897 ci(deps): bump actions/stale from 8 to 9 (#885)
  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 83fafe19 doc: updates alerts to use GH markdown alerts
  • 7abbe47d feat(report/dot): adds ability to match arrays for conditional coloring (#882)
  • 33978afe chore(ci): ensures our own dependency graphs only show red lines when the severity tells it so
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always
  • 92c5782e ci: sets up semantic PR title check
  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879)
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
dependency-cruiser -

Published by sverweij 10 months ago

  • 6d4c72c3 fix(extract): prevents classifying core modules as aliased-tsconfig-base-url (#886)
  • 27485a47 ci: adds a few rules to own .dependency-cruiser.json
  • 76db5f0c feat(init): reduces the moduleSystems in the template to cjs and es6
  • 11127b52 feat(extract): adds more granularity to dependency types (#884)
  • 83a55897 ci(deps): bump actions/stale from 8 to 9 (#885)
  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 83fafe19 doc: updates alerts to use GH markdown alerts
  • 7abbe47d feat(report/dot): adds ability to match arrays for conditional coloring (#882)
  • 33978afe chore(ci): ensures our own dependency graphs only show red lines when the severity tells it so
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always
  • 92c5782e ci: sets up semantic PR title check
  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879)
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
dependency-cruiser -

Published by sverweij 10 months ago

  • 76db5f0c feat(init): reduces the moduleSystems in the template to cjs and es6
  • 11127b52 feat(extract): adds more granularity to dependency types (#884)
  • 83a55897 ci(deps): bump actions/stale from 8 to 9 (#885)
  • 03bdda23 fix(resolve)!: makes alias type derivation more correct and precise BREAKING (#867)
  • 83fafe19 doc: updates alerts to use GH markdown alerts
  • 7abbe47d feat(report/dot): adds ability to match arrays for conditional coloring (#882)
  • 33978afe chore(ci): ensures our own dependency graphs only show red lines when the severity tells it so
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always
  • 92c5782e ci: sets up semantic PR title check
  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879)
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
dependency-cruiser -

Published by sverweij 11 months ago

  • xxxxxxxx fix(resolve)!: makes alias type derivation more correct and precise - BREAKING (#867)
  • f0d1fe32 build: ensures dependencies on .d.[cm]?ts$ are type only always
  • 92c5782e ci: sets up semantic PR title check
  • 1af5706d doc(cli): point to picomatch instead of node-glob
  • 17c7e1cc Ensure trailing newline is written to files and stdout (#879)
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
dependency-cruiser -

Published by sverweij 11 months ago

  • fix(resolve): takes 'workspaces' field into account when merging package manifests(#867) probably to be considered BREAKING
  • 19033e87 feat(extract)!: detect 'type-only' with inline imports/exports - BREAKING (#875)
dependency-cruiser -

Published by sverweij 11 months ago

โœจ features

  • 8aa2a3d5 feat(init): adds exception to not-to-dev-dep for type-only dependencies (#874) - thanks to @alvaro-cuesta for the suggestion
  • 91f36a5c/ 38c4a460 feat(wrap-stream-in-html): adds a gradient on highlighted edges (#878)

๐Ÿ“– documentation

  • 9415a847 fix(doc): re-organizes types folder, improves typing of extract-webpack-resolve-config
  • 6d808db0 fix(doc): improves package type exports (#876) making are the types wrong a little more happy

๐Ÿ‘ท maintenance

  • ae0c3d60 build(npm): updates external devDependencies
  • c6a33b18 refactor(wrap-stream-in-html): makes the wrapper easier to maintain (#877)
dependency-cruiser -

Published by sverweij 11 months ago

โœจ features

  • ba4533fe feat(resolve): enables passing 'aliasFields' to enhanced-resolve (#870) - thanks to @JakeSidSmith for not only raising the issue that led to this fix, but also for the detailed & well documented research that made this addition a very easy one to implement.
  • dfdb385d feat(reporter/dot): only considers rule severity for coloring invalid modules/ dependencies (#869)

๐Ÿ› fixes

  • 3445a3bb fix(init): makes initial regular expressions more specific (#872)- thanks @mx-bernhard for raising the issue and suggesting an elegant fix.

๐Ÿ“– documentation

  • aca64898 doc: modify semicolons to commas (#866)

๐Ÿ‘ท maintenance

  • a6d562b7 build(npm): updates external dependencies