title: true require() for code rather than file
body: <p>If I have a string with source code in it</p>
  
  <pre><code>var code = "console.log('I\'ve been loaded.');";
  </code></pre>
  
  <p>and want to run it in Node, normally it's suggest to use</p>
  
  <pre><code>vm.runInThisContext(code, "NOT_A_FILE.mycode");
  </code></pre>
  
  <p>This is all well and good until the code becomes more complicated:</p>
  
  <pre><code>var code2 = "require('http');\n" +
              "console.log(http);"  // TODO make more useless
  </code></pre>
  
  <p>In this case, we <em>cannot</em> run code2 in <code>vm</code> because it doesn't let the module have a <code>require()</code> function, as the vm is just a V8 VM, rather than a Node one.</p>
  
  <p>This is the only problem I've run into so far—but I don't know what other problems may be down the road.</p>
  
  <hr>
  
  <p>So, fundamentally, my question is: what extra functionality does <code>require()</code> do in making Node modules, and how can I ensure that  my "string" modules have this functionality? If I need this functionality, am I better off just making temporary files which I actually <code>require()</code>?</p>