Closed shilman closed 4 years ago
Just a quick follow up here, right here in the vue-docgen-api. The api gets all exports from a file for parsing. The cleanest fix for this is to have the docgen-api maintainer expose the export name the documentation has been parsed from on the __documentation
object, and the change the component.options.__docgenInfo = ${JSON.stringify(info)}\n
line to be ${info.exportName}.options.__docgenInfo = ${JSON.stringify(info)}\n
@Aaron-Pool can you create a small PR for that change against the vue-docgen-api repo?
@shilman yeah, think so. Could be a couple of days, but I'll try to do so ASAP
@shilman Yeah, the loader should support non-SFC as well. It's hard to implement this functionality in a current way. The way which @Aaron-Pool suggested is the best solution IMO 👍
Moved to https://github.com/pocka/vue-docgen-loader/issues/1.
I moved the loader out to vue-docgen-loader and deprecated this addon's loader (storybook-addon-vue-info/loader
).
❤️❤️❤️
THANKS @pocka @Aaron-Pool @elevatebart
Hi @pocka, thank you for providing this wonderful library! As you know,
storybook-addon-vue-info
was an inspiration foraddon-docs
, andaddon-docs
depends on your loader for Vue support.To test out the new props table support in 5.3, I'm trying to instrument evergarden with @Aaron-Pool, and we've discovered that the current loader only supports Vue SFC's (which are not used by Evergarden).
The problems comes down to this line: https://github.com/pocka/storybook-addon-vue-info/blob/master/loader/index.js#L23
In SFC's
component.options
evaluates to the component that Storybook Docs inspects for the info, and the loader assumes that this exists.In Evergarden, which does not use SFC's,
component
is undefined. I was able to hack it in by, for example adding workaround code like this:But it would be great if the loader supported this case natively. Do you think you might be able to add loader support for non-SFC's like the one used in Evergarden?