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

Feature request: Take the dependencies map from the bundler, and analyze/visualize it #392

Open
truongsinh opened this issue Nov 12, 2020 · 2 comments
Labels
enhancement this will make dependency-cruiser sweeter

Comments

@truongsinh
Copy link
Contributor

truongsinh commented Nov 12, 2020

Context

Right now, dependency-cruiser has to do the transpiling and generating the dependencies graph by itself. It's not scalable, and could violate DRY. Think about adding any new alt-JS such as Svelte. Moreover, what about all the preprocessor for assets, such as .css or .png (keep in mind a .css file can import another .css file). On the other hand, dependencies graph generation is the core business of any bundler, such as rollup/rollup#1250 (comment) or https://webpack.js.org/configuration/stats/#statsdependentmodules

Expected Behavior

workflow: receive source path to analyze --> generating dep-graph --> validate against rules

Current Behavior

workflow: receive dep-graph (in JSON format?) --> validate against tules

Possible Solution

  • Unix pipe input
  • accept an argument for existing JSON file

Considered alternatives

Life cycle hooks

@sverweij sverweij added the enhancement this will make dependency-cruiser sweeter label Nov 13, 2020
@sverweij
Copy link
Owner

Hi @truongsinh the more I think about it, the more I like the idea. I don't think the internal extract step is going to be removed soon, but at least having the option of using output from external tools for validation/ visualisation is valuable.

Dependency-cruiser takes roughly these steps: extract bare dependency tree => enrich => report. It's already possible to feed input into the first step (cli: depcruise) and into the last (cli: depcruise-fmt). It shouldn't be too hard to cook something to feed input into the second step. The most work will be transforming output from e.g. parcel into a dependency-tree that matches what the extract step emits.

@gajus
Copy link

gajus commented May 6, 2022

Is there currently a way to combine dependency-cruiser with rollup?

Dependency cruiser is showing a dependency graph but fails to identify branches that would not be there if tree-shaking was used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement this will make dependency-cruiser sweeter
Projects
None yet
Development

No branches or pull requests

3 participants