tajo / ladle

🥄 Develop, test and document your React story components faster.
https://www.ladle.dev
MIT License
2.52k stars 86 forks source link

Support ExportSpecifier defined stories #556

Closed i-am-the-slime closed 1 month ago

i-am-the-slime commented 3 months ago

This is in response to #554

In my local testing it works, however it only works for the first story in the export list, is this what we want? Otherwise I could probably loop but the code would be a bit more involved.

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: a9465c7115711e391395979637b062a19b0bc835

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages | Name | Type | | ----------------- | ----- | | @ladle/react | Patch | | example | Patch | | test-addons | Patch | | test-babel | Patch | | test-config | Patch | | test-config-ts | Patch | | test-css | Patch | | test-decorators | Patch | | test-playwright | Patch | | test-programmatic | Patch | | test-provider | Patch | | test-baseweb | Patch | | test-msw | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

tajo commented 3 months ago

In my local testing it works, however it only works for the first story in the export list, is this what we want?

It should definitely work for multiple stories/specifiers. Also, tests need to be added.

This is an interesting case:

const joe = 'joe';

export { joe, joe as jim }

Should parse outjoe and jim

i-am-the-slime commented 3 months ago

@tajo

It now

It doesn't resolve the original AST node of what's being exported so it misses the "function/class/variable" check. I don't know how to do that. I hope it's okay even without this check.

i-am-the-slime commented 2 months ago

@tajo Could you have another look, please?

tajo commented 1 month ago

lgtm

i-am-the-slime commented 1 month ago

lgtmt