Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!(extract): makes 'real' depencency type available alongside aliases BREAKING #856

Merged
merged 2 commits into from
Oct 22, 2023

Conversation

sverweij
Copy link
Owner

@sverweij sverweij commented Oct 21, 2023

Description, Motivation and Context

Before this PR dependency types that came out of an alias (subpath import, webpack alias, tsconfig path) only stated that the dependency was an alias. However, these aliases point to other dependency types - local modules, third party ('npm') modules, nodejs builtin core(!) modules. This is useful information, and actually not listing those is an omission.

After merging this PR dependency-cruiser will start listing the 'actual' dependency type alongside the alias dependency types.

Technically this is a BREAKING CHANGE because rules that triggered on these 'real' dependency types before didn't trigger because they weren't detected.

after

{
  "modules": [
    {
      "source": "bin/depcruise-baseline.mjs",
      "dependencies": [
        {
          "dynamic": false,
          "module": "#cli/assert-node-environment-suitable.mjs",
          "moduleSystem": "es6",
          "exoticallyRequired": false,
          "resolved": "src/cli/assert-node-environment-suitable.mjs",
          "coreModule": false,
          "followable": true,
          "couldNotResolve": false,
          "dependencyTypes": [
            "aliased",
            "aliased-subpath-import",
            "local" // <<---- Now also listed that it's a local dependency
          ],
          "matchesDoNotFollow": false,
          "circular": false,
          "valid": true
        },
// ...

If you have a rule that e.g. forbids the local dependencyType from being used
it before didn't trigger on the above dependency. It now will, however ...

before

{
  "modules": [
    {
      "source": "bin/depcruise-baseline.mjs",
      "dependencies": [
        {
          "dynamic": false,
          "module": "#cli/assert-node-environment-suitable.mjs",
          "moduleSystem": "es6",
          "exoticallyRequired": false,
          "resolved": "src/cli/assert-node-environment-suitable.mjs",
          "coreModule": false,
          "followable": true,
          "couldNotResolve": false,
          "dependencyTypes": [
            "aliased",
            "aliased-subpath-import"
          ],
          "matchesDoNotFollow": false,
          "circular": false,
          "valid": true
        },
// ...

How Has This Been Tested?

  • green ci
  • additional & adapted automated non-regression tests

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Documentation only change
  • Refactor (non-breaking change which fixes an issue without changing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • 📖

    • My change doesn't require a documentation update, or ...
    • it does and I have updated it
  • ⚖️

    • The contribution will be subject to The MIT license, and I'm OK with that.
    • The contribution is my own original work.
    • I am ok with the stuff in CONTRIBUTING.md.

@sverweij sverweij changed the title feat!(extract): makes 'real' depencency type on the other side of aliases available alongside aliases types BREAKING feat!(extract): makes 'real' depencency type available alongside the aliases types BREAKING Oct 22, 2023
@sverweij sverweij force-pushed the feature/output-real-dependency-type-alongside-alias branch from 33524e8 to 8000761 Compare October 22, 2023 09:21
@codeclimate
Copy link

codeclimate bot commented Oct 22, 2023

Code Climate has analyzed commit 0095b42 and detected 0 issues on this pull request.

View more on Code Climate.

@sverweij sverweij changed the title feat!(extract): makes 'real' depencency type available alongside the aliases types BREAKING feat!(extract): makes 'real' depencency type available alongside aliases BREAKING Oct 22, 2023
@sverweij sverweij merged commit a3cfcec into main Oct 22, 2023
7 checks passed
@sverweij sverweij deleted the feature/output-real-dependency-type-alongside-alias branch October 22, 2023 09:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant