require-shim

0.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i require-shim

      Weekly Downloads

      1

      Version

      0.0.1

      License

      MIT

      Last publish

      Collaborators

      • alltom