substack/node-detective — Issue #8: i compressed this project into 10 lines : 
Author: weepy
Created: 2012-02-23 16:19:44+00:00
State: open

var regex = {
all: /require\s*\('\s*([^'])*'\s*\)|require\s*\("\s*([^"])*"\s*\)/g,
start: /require\s*\(\s*["']/,
end: /["']\s*\)$/,
comments: /\/\*.+?\*\/|\/\/.*(?=[\n\r])/g // or /(\/\*([\s\S]*?)\*\/)|(\/\/(.*)$)/gm
}

function extract_dependencies(text) {
text = text.replace(regex.comments, '')
var requires = text.match(regex.all) || []
for(var i=0; i< requires.length; i++) {
requires[i] = requires[i].replace(regex.start, "").replace(regex.end, "")
}
return requires
}

It ignores calculated require's which are not string calls such as require(a + b), but catches all others. It's also very fast -