简体   繁体   中英

JSDoc with loose augmentation module not parsing some items

What is the proper way to add jsdoc documentation for a module that uses loose augmentation? Or am I simply setting up my implementation incorrectly? I ultimately expect my shared members to be included in my final documentation.

I am trying to use JSdoc on a module that I created using the loose augmentation model ( as described here ). The module is along the lines of:

/**
 * @module awesomeModuleToDocument
 * @description This module will make you awesome when setup and parsed correctly.
 */
var awseomeModuleToDocument = (function() {

var _moduleReturnObject = {};

/**
 * These awesome things are not shared but do get parsed as expected.
 * @alias module:awesomeModuleToDocument.privateThingsThatAreAwesome
 * @readonly
 * @enum
 */
var privateThingsThatAreAwesome = {
    /** 0 */
    'Unicorns' : 0,
    /** 1 */
    'Bigfoot' : 1
};

/**
 * These awesome things are shared but do not get parsed as expected.
 * @alias module:awesomeModuleToDocument.publicThingsThatAreAwesome
 * @readonly
 * @enum
 */
_moduleReturnObject.publicThingsThatAreAwesome = {
    /** 0 */
    'Beards' : 0,
    /** 1 */
    'Goats' : 1,
    /** 2 */
    'GoatBeards' : 2,
};

    return _moduleReturnObject;

}(awseomeModuleToDocument || {}));

However when I run jsdoc on this code, I get output that includes privateThingsThatAreAwesome but not the public version. Further, if I take out the @alias tag for the private enum, I don't see it in the output either.

My assumption then is that I am not using the @alias tag correctly in the public case - but a number of tests and searches have gotten me nowhere.

My output for JSDOC 3.4.3 is: Not awesome JSDOC output

Playing around with this a bit more, adding the tag @memberof seemed to give me the expected documentation results:

 /**
 * These awesome things are now parsing as I expected.
 * @memberof module:awesomeModuleToDocument
 * @alias module:awesomeModuleToDocument.publicThingsThatAreAwesome
 * @readonly
 * @enum
 */
_moduleReturnObject.publicThingsThatAreAwesome = {...}

However I imagine there is still a "more preffered" way of going about this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM