React: Add subcomponents to component manifests#34428
Conversation
|
View your CI Pipeline Execution ↗ for commit 0dce105
☁️ Nx Cloud last updated this comment at |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds declared subcomponents end-to-end: new core types, React extraction of declared subcomponents from CSF, threading resolved subcomponents and their docgen into generated manifests, rendering a subcomponents panel in the manifest HTML, and tests/docs/memfs updates. Changes
Sequence Diagram(s)sequenceDiagram
participant CSF as Story CSF
participant Extractor as extractDeclaredSubcomponents
participant Resolver as getComponents / findExactComponentMatch
participant Docgen as react-docgen / manager.batchExtract
participant Generator as generator.ts
participant CoreRender as render-components-manifest
participant FS as writeManifests (memfs)
CSF->>Extractor: parse subcomponents field
Extractor->>Resolver: provide component names
Resolver->>Docgen: request component/import resolution & docgen
Docgen-->>Resolver: docgen/meta (or error)
Resolver->>Generator: resolved ComponentRef + docgen data
Generator->>CoreRender: emit manifest with subcomponents
CoreRender->>FS: write HTML manifest with subcomponents panel
FS-->>CoreRender: confirm write
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Comment |
…orybookjs/storybook into kasper/add-mcp-subcomponents-manifest
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
|
Thanks for the feedback @Powerplex! It sounds more like something we should handle better, automatically, than something we need an explicit API for. Sounds like a bug to me. If you could provide us with some minimal code snippets that demonstrates this behavior, that would make it a lot easier for us to fix. 🙏 |
I have this branch using your canary version: https://github.com/leboncoin/spark-web/pull/3018/changes#diff-d36927dce8b753153bad94b9be26eaf06084082dc614e8c6c411c03bbe24843eR25-R34 Basically I had to do Instead of To resolve the correct jsdoc description. You can see how the compound itself is assembled here: https://github.com/leboncoin/spark-web/blob/13179d09b7ca6a4d9018cfa0741c4a2f885e551b/packages/components/src/carousel/index.ts |


Closes #
What I did
Added explicit
subcomponentssupport to the React component manifest used by MCP. The manifest generator now readsmeta.subcomponents, reuses the existing component resolution/docgen pipeline for child components, resolves declared subcomponents even when they are not rendered in JSX, and attaches their docs under a newsubcomponentssection on the parent manifest. I also updated the manifest debugger and AI manifests docs so the new data is visible and documented.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!
No manual testing performed. Validation was done with targeted manifest tests and
yarn nx run-many -t compile.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.tsMake 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 pull request has been released as version
0.0.0-pr-34428-sha-d7a905aa. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-34428-sha-d7a905aa sandboxor in an existing project withnpx storybook@0.0.0-pr-34428-sha-d7a905aa upgrade.More information
0.0.0-pr-34428-sha-d7a905aakasper/add-mcp-subcomponents-manifestd7a905aa1775052873)To request a new release of this pull request, mention the
@storybookjs/coreteam.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook publish.yml --field pr=34428Summary by CodeRabbit
New Features
Documentation
Tests
Chores