-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: callback on file #48
Conversation
6806f22
to
7e65236
Compare
This looks great for flexibility. Thanks for doing this. What's an example use of onAfterFile? |
@mrjoelkemp Thanks! The difference is that |
Whatever you think is best. Thanks for clarifying |
@mrjoelkemp Thanks! Just adding the options to the README (see 890d412). Let me know what you think and anything else needed before we can merge! |
@mrjoelkemp Sorry to bother. Wondering if you had any more thoughts on this, or if we're good to merge & release? I'm happy to step in as a maintainer as well if you like. Or I suppose I could fork & publish for my purposes, but would prefer to support your main line project! I'm thinking |
@XhmikosR Are you maintaining now? Thanks! |
Not really, just had some time and decided to merge a couple of changes. @mrjoelkemp should have a look at this :) |
Supports dependents/node-dependency-tree#147.
These new callback options
onFile
andonAfterFile
, in combination with dependents/node-dependency-tree#149 and dependents/node-precinct#111, will give external consumers enough info to know the position in the graph asnode-dependency-tree
crawls the project, with full access to the AST and other metadata for each processed file, on top of which we can build our own functionality.This should eliminate the need for a lot of other feature requests.
Can enhance tests and documentation for this once we have conceptual approval.
We can slowly add this to other detective packages, like the various JavaScript module systems.
Example usage:
Suppose we have a metadata object to track data about each file we process (maybe in real code we would use a
Map
):Then suppose we call the detective with this
onFile
function:Now our
metadata
will look something like this: