On Tue, Aug 21, 2012 at 4:01 PM, Azer Koçulu <[email protected]> wrote:
> Hi All,
>
> Is there any library that can list all the require calls in a project?
> (Already checked out require-analyzer, it looks like a
> dependency-analyzer rather than require)
>
> Ideas?

It sounds like you're probably looking for static analysis, but
'mockery' can help you with runtime analysis, if that would be helpful
for you. It won't locate the source of the require() calls, but it
will tell you what was require()d.

https://github.com/mfncooper/mockery

If you require('mockery'), enable() it, but don't register anything,
by default you'll get a warning on the console for every module that's
subsequently require()d. What it reports will depend on your code
path, and it might miss conditional require() calls because of that,
but otherwise it'll catch every module require()d.

As a simple experiment, you can try this and see if the output might help you:

node -pe "require('mockery').enable();require('your-lib')"

(This is a long way from what 'mockery' was designed for, but may just help!)

--
Martin Cooper


> Best,
>
> Azer
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines: 
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to