Repository navigation
Core: Extract React CSF tools into Core - #35766
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughChangesCSF story-shape tooling
Sequence Diagram(s)sequenceDiagram
participant ComponentManifest
participant normalizeStoryDeclaration
participant metaObjectPath
participant collectImportBindings
ComponentManifest->>normalizeStoryDeclaration: normalize story declaration
ComponentManifest->>metaObjectPath: resolve CSF metadata object
ComponentManifest->>collectImportBindings: collect runtime import bindings
normalizeStoryDeclaration-->>ComponentManifest: return story shape
metaObjectPath-->>ComponentManifest: return metadata path
collectImportBindings-->>ComponentManifest: return import map
Possibly related PRs
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@code/core/src/csf-tools/story-shape/utils.ts`:
- Around line 6-7: Update keyOf to return null when the ObjectProperty key is
computed, including computed identifier keys such as {[render]: value}; only
return identifier names for non-computed keys. Preserve the existing support for
non-computed string literal keys such as {"render": value}.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 90be1f34-b097-4652-aab7-237e280d2641
📒 Files selected for processing (10)
code/core/src/csf-tools/index.tscode/core/src/csf-tools/story-shape/args.tscode/core/src/csf-tools/story-shape/imports.tscode/core/src/csf-tools/story-shape/index.tscode/core/src/csf-tools/story-shape/jsdoc.tscode/core/src/csf-tools/story-shape/normalize-story.tscode/core/src/csf-tools/story-shape/utils.tscode/renderers/react/src/componentManifest/generateCodeSnippet.tscode/renderers/react/src/componentManifest/getComponentImports.tscode/renderers/react/src/componentManifest/resolveComponents.ts
|
I think some of the helpers deserve some unit tests :) |
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 73 | 73 | 0 |
| Self size | 21.45 MB | 21.46 MB | 🚨 +11 KB 🚨 |
| Dependency size | 31.21 MB | 31.21 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 205 | 205 | 0 |
| Self size | 831 KB | 831 KB | 🎉 -84 B 🎉 |
| Dependency size | 86.14 MB | 86.15 MB | 🚨 +11 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 198 | 198 | 0 |
| Self size | 32 KB | 32 KB | 0 B |
| Dependency size | 84.62 MB | 84.63 MB | 🚨 +11 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 74 | 74 | 0 |
| Self size | 1.09 MB | 1.09 MB | 0 B |
| Dependency size | 52.66 MB | 52.67 MB | 🚨 +11 KB 🚨 |
| Bundle Size Analyzer | node | node |
|
@huang-julien This broke windows, I fixed it here: |
What I did
This PR moves the CSF-interpretation helpers used by React's component manifest ( for story snippet generation) into a new csf-tools/story-shape module in core, so other frameworks can reuse them instead of re-implementing the same AST logic.
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
Caution
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:mergedorci:dailyGH 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.tsDeclare whether manual QA will be needed for this PR during the next release, through
qa:neededorqa:skipMake 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/coreteam here.core team members can create a canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>