title: JavaScript dependency management
body: <p>I am currently maintaining a large number of JS files and the dependency issue is growing over my head. Right now I have each function in a separate file and I manually maintain a database to work out the dependencies between functions.</p>
  
  <p>This I would like to automate. For instance if I have the function f</p>
  
  <pre><code>Array.prototype.f = function() {};
  </code></pre>
  
  <p>which is referenced in another function g</p>
  
  <pre><code>MyObject.g = function() {
      var a = new Array();
      a.f();
  };
  </code></pre>
  
  <p>I want to be able to detect that g is referencing f.</p>
  
  <p>How do I go about this? Where do I start? Do I need to actually write a compiler or can I tweak Spidermonkey for instance? Did anyone else already do this?</p>
  
  <p>Any pointers to get me started is very much appreciated</p>
  
  <p>Thanks
  Dok</p>