-
Notifications
You must be signed in to change notification settings - Fork 20
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
add a 'module graph' #73
Comments
@pionxzh This sounds like an awesome idea!
@pionxzh I've only thought about this a little bit, and it depends on how 'all encompassing' you want the module graph to be, but I think it might even make sense for it (or some other metadata/graph) to capture the mapping from original files -> unmapped as well. -- For some background context (to help understand some of the things I describe for the graph later on below), the workflow I've been thinking about/following for my own needs would probably be as follows:
While that workflow might be overkill for a lot of people, I like that it allows me to keep the outputs of each of the 'intermediary steps' available, and can cross reference between them if/as needed. I might find that as I start to use this more, that I don't find it useful to keep some of those intermediate steps; but at least for now, that is my workflow. -- Now with that background context, going back to my thoughts about the graph/etc; I think it would be useful to be able to have a graph/similar that shows:
And then the actual 'internal module mapping' stuff of what imports/exports what, etc. I'm not sure exactly how to map the data, but I would probably start with identifying the main 'types' involved, and what makes sense to know/store about each of them. The following might not be complete, but it's what I came up with from a 'first pass':
This 'metadata file' / graph / etc could then potentially also include the stuff I've talked about before (Ref) for being able to 'guide' the variable/function/etc names used during unminification. -- I haven't thought deeply through the above yet; it might turn out that some of the things I described there might make sense being split into 2 different things; but I wanted to capture it all while it was in my head.
@pionxzh 👌🏻🎉
@pionxzh Definitely. Though I (or you, or someone) need to dig into the concepts a bit more and figure out a practical way to implement it; as currently it's sort of a theory in my mind, but not sure how practical it will be in reality. Created a new issue for that exploration: |
I was wanting to visualize the dependencies between my unminified modules, and stumbled across this project:
It mentioned two of it's dependencies, which sound like they could potentially be useful here:
Off the top of my head, I think the 'high level' module-graph within Some useful commands for visualising module dependencies: # Get the module dependencies as a static .svg image
madge --image graph.svg path/src/app.js
# Get the module dependencies as a graphviz DOT file
madge --dot path/src/app.js > graph.gv
# Get the module dependencies as json
madge --json path/src/app.js > dependencies.json The graphviz dot output can then be further explored through an interactive tool such as:
If there are missing dependencies, these are worth noting for how to see/improve it:
In addition to the above, a couple of other 'dependency graph' viewers I came across when I was looking for tools for this today:
|
Another pattern I just noticed, in // module-9869.js
(window.__NEXT_P = window.__NEXT_P || []).push([
"/_app",
function () {
return require(68502);
},
]); |
Not 100% sure, but Webpack's
|
The Stack Graph / Scope Graph links/references I shared in #34 (comment) may be relevant to this issue as well. |
|
See Also
un-mangle
identifiers #34The text was updated successfully, but these errors were encountered: