Created
February 23, 2015 20:09
-
-
Save mikeal/c811b96d1dd08590d735 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mdeps = require('module-deps') | |
, builtins = require('builtins') | |
, lodash = require('lodash') | |
, used = [] | |
; | |
function filter (id) { | |
if (builtins.indexOf(id) === -1) return true | |
used.push(id) | |
return false | |
} | |
var md = mdeps({filter:filter}) | |
md.on('data', function (obj) { | |
console.log(obj.file) | |
}) | |
var request = require(__dirname+'/tmp/node_modules/request/package.json').main || 'index.js' | |
request = __dirname+'/tmp/node_modules/request/'+request | |
md.end({ file: request }); | |
md.on('end', function () { | |
console.log('used', lodash.unique(used)) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment