require-shim
v0.0.1
Published
Helper for pre-processing JavaScript files as they're require()'d.
Readme
require-shim
Helper for pre-processing JavaScript files as they're require()'d.
Typical Usage
If you save this as foo.js and invoke it as node foo.js bar.js, then it would execute bar.js and print "Start!" at the start of the execution of bar.js and any other .js files that bar.js require()'d:
var shim = require('require-shim');
shim.install(function(content, filename, mod) {
return 'console.log("Start!");\n' + content;
});
shim.emulateNode();