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
90 stars 7 forks source link

Exported events using an identifier are not parsed #57

Closed soft-decay closed 3 years ago

soft-decay commented 3 years ago

At this line, identifiers are added to this.identifiers if they are top level variable declarations.

But later in the code, there is a similar code block handling variable declarations that are also exported (inside an ExportNamedDeclaration node), which does not add identifiers to this.identifiers.

Because of that, this is parsed ok:

const SIMPLE_EVENT = 'plain-notify';
dispatch(SIMPLE_EVENT); // emits event 'plain-notify'

But this is not:

export const SIMPLE_EVENT = 'plain-notify';
dispatch(SIMPLE_EVENT); // emits event SIMPLE_EVENT

Edit: This will be fixed by #56 but I'm creating a separate issue to help track bug fixes.