Comments (1)
Hello @Klemensas, thanks for the feedback.
Would you be for making this tool a more generalized one, to cover a broader range of use cases?
Yes, sure thing but it depends on the use case. Many things could be exposed by skott to hook into the core and extend its range of features, but skott was thought to be centered around dependencies and for now there is no further static analysis within the script to know how dependencies are used, at least in the core, but that could be done through plugins.
Would you consider extending the library to support call graph visualizations for specified entry points?
Could you please provide me examples of static call graphs and how this would be useful? I'm aware of call graphs but mostly dynamic ones, that could be done at the runtime level. Statically this would be hard as you would need to trace all branches of code and all that, I'm not sure what type of information we could extract from it.
For now, skott only keeps the information of the module Import Literal (the imported module) to establish relationships, but does not keep what is imported from the module that is all the Imports Specifiers (import { identifiers } from "./module"
). Then another problem arises which is determining if the identifier is used within the imported module. All that depends on how far we would want to go.
To be honest, even outside of the scope of static call graphs I feel like it would make sense to add additional information of what is imported and not only keep the information of "from where" its imported.
Let's take a small example
a.js
import { someFunction } from "./b.js";
For now, skott only keeps the information of "a.js" importing "b.js" hence creating a->b
dependency. When walking the AST we could also capture associated identifiers. But from that you won't be able to determine a precise call graph, as I said for now there is only an analysis around Import Declarations, but they are not followed. Consequently this is the only thing that would make sense within the core itself.
For your specific use case we could discuss is providing inversion of control for the entire script in addition to the module resolution part that can be already done. That way, skott would help you traverse all the module tree starting from the entrypoints and then you would have to do the work on your own using your own plugin that would have access to the entire graph context.
from skott.
Related Issues (20)
- Allow "import { type X }" to be part of the "typeOnly" tracking process
- webapp display mode throws error in wsl HOT 9
- skott installation adds 544 MB to node_modules HOT 9
- Failed to Resolve with index.tsx files HOT 3
- Support imports map in package.json HOT 1
- Feature request: group modules in visualizaton using project structure HOT 28
- Refresh application HOT 5
- Resolving paths using path aliases HOT 10
- It's so useful, just to express my gratitude. HOT 1
- Feature Request: Allow path grouping to visualize relationships between monorepo packages as a whole HOT 6
- Introduce diagnostics collection to monitor performance
- fs-tree-structure is using a lodash.set that has high severity vulnerability! HOT 2
- Issue installing `[email protected]` with pnpm HOT 2
- Can support for vue projects be added? HOT 1
- provde option to ignore barrel files HOT 7
- Ship a bundled and standalone version of skott's cli
- process.chdir does not affect working directory used by skott for creating node id paths HOT 21
- Resolving "import type" statements HOT 3
- Watch mode not always working HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from skott.