0.0.1 • Published 7 years ago

require-shim v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

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();