alexprey / sveltedoc-parser

Generate a JSON documentation for a Svelte (https://github.com/sveltejs/svelte) component
https://www.npmjs.com/package/sveltedoc-parser
MIT License
89 stars 7 forks source link

Default value and keywords of exported aliases not merged #83

Closed ekhaled closed 2 years ago

ekhaled commented 2 years ago

It would be nice if we could get the default values and keywords of exported aliases

    /**
     * CSS class for the component
     * @type {'main' | 'sidebar'}
     * 
     */
    let klass = "main";

    export {klass as class}

Current output:

    {
      "visibility": "public",
      "description": "CSS class for the component",
      "keywords": [],
      ...
      "type": {
        "kind": "union",
        "text": "'main' | 'sidebar'",
        "type": [
          {
            ...
          },
          {
            ...
          }
        ]
      },
      "localName": "klass"
    }

Preferred output:

    {
      "keywords": [
        {
          "name": "type",
          "description": "{'main' | 'sidebar'}"
        }
      ],
      "visibility": "public",
      "description": "CSS class for the component",
      ...
      "type": {
        "kind": "union",
        "text": "'main' | 'sidebar'",
        "type": [...] //same as above
      },
      "localName": "klass",
      "defaultValue": "main"
    }
alexprey commented 2 years ago

Hi, you are completelly right!