var _ = require('lodash');
var module = require('module');

var _load = module._load;

var moduleNames = {};
var processed = [];

exports.module = function(name, fn) {
  moduleNames[name] = fn;
};

module._load = function(path) {
  var mdl = _load.apply(this, arguments);
  var hasPatch = moduleNames.hasOwnProperty(path)
  var alreadyProcessed = processed.indexOf(path) > -1;
  if (hasPatch && !alreadyProcessed) {
    console.log('Instrumenting ', path)
    moduleNames[path](mdl);
    processed.push(path);
  }
  return mdl;
};

@@ -105,28 +105,8 @@
  %7B%7D;
-%0Avar processed = %5B%5D;
 %0A%0Aex
@@ -301,94 +301,48 @@
 )%0A  
-var alreadyProcessed = processed.indexOf(path) %3E -1;%0A  if (hasPatch && !alreadyProcess
+if (hasPatch && !mdl.__supersamplesPatch
 ed) 
@@ -419,28 +419,40 @@
     
-processed.push(path)
+mdl.__supersamplesPatched = true
 ;%0A  

Fix module require patching