wooorm / module-exports

Get the exports of a module
MIT License
12 stars 0 forks source link

Add support for JSDoc markup #5

Closed wooorm closed 6 months ago

wooorm commented 7 months ago

From the JSDoc site:

Inline tags also begin with an at sign. However, inline tags and their text must be enclosed in curly braces ({ and }). The { denotes the start of the inline tag, and the } denotes the end of the inline tag. If your tag's text includes a closing curly brace (}), you must escape it with a leading backslash (\). You do not need to use a line break after inline tags.


From the TS AST:

type JSDocComment = JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain;

    interface JSDocText extends Node {
        readonly kind: SyntaxKind.JSDocText;
        text: string;
    }
    interface JSDocLink extends Node {
        readonly kind: SyntaxKind.JSDocLink;
        readonly name?: EntityName | JSDocMemberName;
        text: string;
    }
    interface JSDocLinkCode extends Node {
        readonly kind: SyntaxKind.JSDocLinkCode;
        readonly name?: EntityName | JSDocMemberName;
        text: string;
    }
    interface JSDocLinkPlain extends Node {
        readonly kind: SyntaxKind.JSDocLinkPlain;
        readonly name?: EntityName | JSDocMemberName;
        text: string;
    }

    /** Class#method reference in JSDoc */
    interface JSDocMemberName extends Node {
        readonly kind: SyntaxKind.JSDocMemberName;
        readonly left: EntityName | JSDocMemberName;
        readonly right: Identifier;
    }
wooorm commented 6 months ago

This was mostly done in https://github.com/wooorm/module-exports/commit/14fdd44d9d3b974f8945e5d3df092a681df96718.