title: jsdoc not documenting properly nodejs modules
body: <p>I'm trying to get JSDOC (3) to properly document my NodeJS modules. While simple modules work, I can't find the way to document a slightly more complex module.</p>
  
  <p>My NodeJS module has the following structure:</p>
  
  <pre><code>/** @module MyModule */
  (function() {
  
  
       function functionToExportOne {...}
  
       function functionToExportTwo {...}
  
       /** 
        * @module MyModule.ClassToExportOne
        * @constructor 
        */
       function ClassToExportOne {
  
             this.classMethodOne=function() { ... }
             this.classMethodTwo=function() { ... }
  
       }
  
       /** @constructor */
       function ClassToExportTwo {
  
             function classMethodOne() { ... }
             function classMethodTwo() { ... }
  
             return /** @lends {ClassToExportTwo.prototype} */ {
  
                 methodOne:classMethodOne,
                 methodTwo:classMethodTwo
             }
       }
       /** @exports MyModule */  &lt;--- late addition, see comments
       module.exports={
           functionOne:functionToExportOne,
           functionTwo:functionToExportTwo,
           classOne:ClassToExportOne,
           classTwo:ClassToExportTwo
       }
  })()
  </code></pre>
  
  <p>Well, as you see, the module exports both methods and class constructors. Nothing very strange.</p>
  
  <p>The problem is, JSDOC</p>
  
  <ul>
  <li>always fails to recognize the inner classes, </li>
  <li>Mistakes <strong>the first</strong> inner class methods as the (outer) module's methods, </li>
  <li>always skips the real exported module methods.</li>
  <li>The closest I've been is, in <code>ClassToExportOne</code>, when I use <code>@module MyModule.&lt;className&gt;</code> followed by <code>@constructor</code> (in this order) : In this case the class <strong>is recognized</strong>, but <strong>only the constructor is documented</strong>, and its methods are documented as belonging to the parent module</li>
  </ul>
  
  <p>I've tried thousands of different combinations without success:</p>
  
  <ul>
  <li>defining inner classes methods with <code>this.method=function() {...}</code> (as depicted in <code>ClassToExportOne</code>) or returning an object with methods using <code>@lends {ClassToExportTwo.prototype}</code> (as depicted in <code>ClassToExportTwo</code>)</li>
  <li>using <code>@module MyModule.ClassToExportOne</code> in the header of each class</li>
  <li>defining module.exports vs exports.xxxx</li>
  <li>declaring inner classes <code>@private</code>, declaring everything <code>@private</code> but the exports</li>
  <li>moving <code>@module</code> declaration to just before the first exports (total mess then, some stuff gets promoted to "global" even though it's inside the main closure!!)</li>
  <li>if I add <code>@exports &lt;modulename&gt;</code> just before the exports declaration, the methods are documented (mixed with the class methods)</li>
  </ul>
  
  <p>I've tried everything suggested in <a href="http://usejsdoc.org/howto-commonjs-modules.html" rel="noreferrer">http://usejsdoc.org/howto-commonjs-modules.html</a> without success.</p>
  
  <p>I'm sure I'm missing something, but can't find what.</p>