-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(svelte-vite): Use compiled AST output as source of truth for getting component name #30369
base: next
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 file(s) reviewed, 5 comment(s)
Edit PR Review Bot Settings | Greptile
I wanted to write tests for this case, but given that the changes were applied to And also a quick question. Should I make three separate errors inside |
View your CI Pipeline Execution ↗ for commit 04ab7b9.
☁️ Nx Cloud last updated this comment at |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
Before | After | Difference | |
---|---|---|---|
Dependency count | 17 | 17 | 0 |
Self size | 2.26 MB | 2.20 MB | 🎉 -61 KB 🎉 |
Dependency size | 7.92 MB | 7.91 MB | 🎉 -3 KB 🎉 |
Bundle Size Analyzer | Link | Link |
@storybook/addon-essentials
Before | After | Difference | |
---|---|---|---|
Dependency count | 36 | 36 | 0 |
Self size | 12 KB | 12 KB | 0 B |
Dependency size | 13.93 MB | 13.87 MB | 🎉 -65 KB 🎉 |
Bundle Size Analyzer | Link | Link |
@storybook/core
Before | After | Difference | |
---|---|---|---|
Dependency count | 54 | 54 | 0 |
Self size | 19.05 MB | 19.09 MB | 🚨 +37 KB 🚨 |
Dependency size | 14.44 MB | 14.44 MB | 0 B |
Bundle Size Analyzer | Link | Link |
@storybook/preact-vite
Before | After | Difference | |
---|---|---|---|
Dependency count | 13 | 13 | 0 |
Self size | 5 KB | 6 KB | 🚨 +743 B 🚨 |
Dependency size | 1.31 MB | 1.31 MB | 🎉 -1 KB 🎉 |
Bundle Size Analyzer | Link | Link |
storybook
Before | After | Difference | |
---|---|---|---|
Dependency count | 55 | 55 | 0 |
Self size | 22 KB | 22 KB | 0 B |
Dependency size | 33.49 MB | 33.53 MB | 🚨 +37 KB 🚨 |
Bundle Size Analyzer | Link | Link |
sb
Before | After | Difference | |
---|---|---|---|
Dependency count | 56 | 56 | 0 |
Self size | 1 KB | 1 KB | 0 B |
Dependency size | 33.52 MB | 33.55 MB | 🚨 +37 KB 🚨 |
Bundle Size Analyzer | Link | Link |
@storybook/cli
Before | After | Difference | |
---|---|---|---|
Dependency count | 388 | 388 | 0 |
Self size | 503 KB | 503 KB | 🚨 +310 B 🚨 |
Dependency size | 75.37 MB | 75.40 MB | 🚨 +31 KB 🚨 |
Bundle Size Analyzer | Link | Link |
@storybook/codemod
Before | After | Difference | |
---|---|---|---|
Dependency count | 277 | 277 | 0 |
Self size | 617 KB | 612 KB | 🎉 -6 KB 🎉 |
Dependency size | 65.45 MB | 65.48 MB | 🚨 +37 KB 🚨 |
Bundle Size Analyzer | Link | Link |
create-storybook
Before | After | Difference | |
---|---|---|---|
Dependency count | 113 | 113 | 0 |
Self size | 1.11 MB | 1.11 MB | 🚨 +463 B 🚨 |
Dependency size | 42.63 MB | 42.67 MB | 🚨 +37 KB 🚨 |
Bundle Size Analyzer | Link | Link |
Closes #29636
Closes #30212
What I did
I've replaced the previous implementation of getting the component name - which was copied from Svelte internals. It doesn't cover edge cases.
Now, it access the AST of compiled output of Svelte file. I believe this is a final source of truth to avoid naming collision with other identifiers. This function handles legacy and modern version of Svelte.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli-storybook/src/sandbox-templates.ts
Make sure this PR contains one of the labels below:
Available labels
bug
: Internal changes that fixes incorrect behavior.maintenance
: User-facing maintenance tasks.dependencies
: Upgrading (sometimes downgrading) dependencies.build
: Internal-facing build tooling & test updates. Will not show up in release changelog.cleanup
: Minor cleanup style change. Will not show up in release changelog.documentation
: Documentation only changes. Will not show up in release changelog.feature request
: Introducing a new feature.BREAKING CHANGE
: Changes that break compatibility in some way with current major version.other
: Changes that don't fit in the above categories.🦋 Canary release
This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the
@storybookjs/core
team here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>
Greptile Summary
This PR updates the component name extraction logic in the Svelte docgen plugin to handle both Svelte 4 and 5 compatibility by using compiled AST output.
getComponentName
function incode/frameworks/svelte-vite/src/plugins/svelte-docgen.ts
to extract names from compiled ASTIS_SVELTE_V4
flag incode/frameworks/svelte-vite/src/utils.ts
to handle version-specific logic+page.svelte
)💡 (4/5) You can add custom instructions or style guidelines for the bot here!