Code Monkey home page Code Monkey logo

Comments (1)

antoine-coulon avatar antoine-coulon commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.