gunar / callgraph Goto Github PK
View Code? Open in Web Editor NEWGenerate call graphs for JS projects
Home Page: https://github.com/gunar/callgraph/issues/13#issuecomment-255212134
Generate call graphs for JS projects
Home Page: https://github.com/gunar/callgraph/issues/13#issuecomment-255212134
Every function call is also being treated as a function reference. Hence, there's a duplicate.
Possible solutions:
instead of just looking for all functions
Please package a new version that includes the fix of issue #15, it's quite blocking since even a simple source like :
var n;
crashes the app.
As of today, we're graphing both function calls (e.g. lib.function
) and references (e.g. var myFn = lib.function.bind(null)
) with the same black arrow. Let's use different styling please.
TypeError: Cannot read property 'expression' of null
at TreeWalker.visit (/usr/local/lib/node_modules/callgraph/parser.js:50:41)
at TreeWalker._visit (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:1339:24)
at AST_Var._walk (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:929:24)
at AST_ForIn.eval (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:654:23)
at TreeWalker._visit (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:1343:21)
at AST_ForIn._walk (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:653:24)
at walk_body (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:530:17)
at AST_BlockStatement.eval (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:541:13)
at TreeWalker._visit (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:1343:21)
at AST_BlockStatement._walk (eval at <anonymous> (/usr/local/lib/node_modules/callgraph/node_modules/uglify-js/tools/node.js:27:1), <anonymous>:540:24)
Using npm install -g gunar/callgraph
My project uses features more recent than es2015. callgraph does not support it because es2015 compilation is hardcoded. Would be great if callgraph could use my project's .babelrc directly.
Thanks for considering!
Currently we're just parsing whole files for function declarations.
We should only try and use functions that are exported.
Also, functions may be exported with a different name!!
Great idea for a tool, really missing that right now.
Why not use Babel? (I read the comment, but can't imagine that this parser misses what is needed to create a call-graph, but I may be wrong ...)
This seems like the furthest along project for JavaScript call graph visualization. If there is another one you recommend over this, please let me know. Otherwise, I am running it on some source code that I am analyzing, and I am seeing this error.
$ callgraph index.js
Processing index.js
[Error: Couldn't find preset "es2015" relative to directory "/Users/my-name/my-project/lib"]
[TypeError: S.input is not a function]
Success! Check callgraph.png
And although the success message was displayed, and although the file callgraph.png
has been generated, it is blank.
E.g. otherFn should be registered in the graph
function doStuff() {
async.series([
_.curry(otherFn),
])
}
First off, this is a great start! and a tool I've been searching for for a long time.
It appears that .prototype method calls on custom class/functions aren't graphed?
Is this something you plan on adding? Or am I missing something obvious?
Thanks again for sharing such a cool package. I might try to dig into the source code a bit if I can find the time.
Like babel-cli does, having it in node_modules/.bin/callgraph
that lead to errors when parsing file with uglify
Hi,
It would be great to let specify a function in a JS file as an entry. As a workaround, I put the targeted function alone, with it's dependencies in one file, in order to omit other functions, but this is tedious.
Context:
Optional. It could be easier to track a single function as an entry, if file contains many many functions.
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.