[pull] next from storybookjs:next#810
Merged
Merged
Conversation
Co-authored-by: valentinpalkovic <5889929+valentinpalkovic@users.noreply.github.com>
First concrete open-service consumer: a per-component docgen service backed by an `experimental_docgen` middleware-style preset. Renderers and addons can register extractors that wrap the previous accumulated extractor and merge results. Phase 1 ships the service definition, registration, static-snapshot wiring under `docgen/<componentId>.json`, and a mock extractor in the React renderer. Phase 2 will teach RCM per-component extraction; phase 3 replaces the mock with the real RCM-backed extractor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…rovider Rename DocgenExtractor → DocgenProvider (and matching field/variable names) to better reflect that registrants supply data rather than extract it from a single source. Adds a second docgen provider in addon-docs that enriches description and appends a synthetic prop. With the React mock provider also registered, this exercises the middleware-merge path end-to-end across two packages, validating that the chosen preset chaining pattern composes correctly. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…er; drop per-provider identity fallback The preset slot, type re-exports, Presets.apply overload, and every preset file's named export now use `experimental_docgenProvider` — keeps the preset name consistent with the DocgenProvider type. Each provider file no longer carries its own identity-provider seed. Providers call `nextDocgen?.(input)` and treat the downstream payload as optional, falling back to literals where needed. Core still seeds the chain with an identity provider so the composed result is always a defined function, but individual provider files no longer need to know about that detail. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The open-service registration API recently moved from a single
`static: { path, inputs }` block to a definition-time `filePath`
plus a registration-time `staticInputs`. Snapshot paths now also
auto-prefix by service id, so the docgen `filePath` only needs to
produce `<componentId>.json` (the runtime turns it into
`core/docgen/<componentId>.json`).
Updates server.ts, the definition, and the matching static-build
test to the new shape. Phase-1 tests all pass.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…d as properties of a parent component
Matches the existing "Loading presets" / "Building manager.." / "Building preview.." CLI breadcrumbs so users can see when the open-service snapshot step is running. Only emits the log (and only schedules the work) when at least one service is registered, so installations without any service consumers stay quiet. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…perimentalDocgenServer
Three changes to the phase-1 docgen surface:
1. DocgenProvider input is now { importPath } instead of { componentId, entries }.
The service resolves an entry for the requested componentId and hands the
raw importPath to the provider chain — providers that don't know how to
handle a given path (e.g. the React mock provider seeing an .mdx attached
docs file) bail to nextDocgen.
2. DocgenProvider can return undefined. The identity seed in core's services
preset now returns undefined so a chain with no real providers signals
"no docgen here" instead of producing an empty payload. The addon-docs
enricher mirrors this — it returns undefined when nothing downstream
produced a payload, rather than fabricating one.
3. The whole docgen-service registration is gated behind a new
`experimentalDocgenServer` feature flag (sibling of
experimentalReactComponentMeta). When the flag is off, no service is
registered, no preset chain is built, and the static-build log step
already correctly skips itself via the existing registered-services
length check.
Also picks up an upstream rename: query `filePath` → `staticPath`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The command's output schema was `void`, so callers had to follow up with a separate `getDocgen` read to see what was extracted. The work was already in scope — return the payload (or undefined) directly so a single extractDocgen call gives consumers the data alongside the state write. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ttern Captures a lesson from building the docgen service: when query.load and a command both look plausible for the same work, the work belongs in the command. The load body should be a one-line passthrough that calls it. Extends the Load concept section with the rationale (reusability, testability, clarity) and adds a matching bullet to the Design Rules. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Four review nits, addressed together because they overlap: H2 — Docgen static build wasn't gated by ignorePreview, so a manager-only build forced full story-index generation (staticInputs calls getIndex()). Mirror the !options.ignorePreview gate around index.json / writeManifests at the registration boundary: don't register the service at all when previewing is off. L1 — `nextDocgen?.(input)` defended an impossible state (core always seeds the chain). New `defineDocgenProvider` helper from `storybook/internal/common` types `next` as required and throws a clear error if the seed is ever missing, instead of silently degrading to empty payloads. M3 + M5 — The two phase-1 mocks merged downstream inconsistently (React rebuilt the payload field-by-field; addon-docs used spread). A future provider adding a `DocgenPayload` field would be silently dropped by the React mock. Document the spread + `??` convention on the DocgenProvider type's JSDoc and on `defineDocgenProvider`, and update the React mock to match. The convention preserves both unknown fields and explicit downstream values. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Lets us dogfood the docgen service against real components in storybook:ui:build and storybook:ui dev runs. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…oundFunctions from testing-library. This improves integration with user interactions in tests.
Resolve conflict in code/renderers/react/src/docs/jsxDecorator.test.tsx by keeping both independently-added test cases (subcomponent display-name resolution + #27127 boolean-false prop regression).
…ck-react-route-group # Conflicts: # code/frameworks/tanstack-react/vitest.config.ts Co-authored-by: huang-julien <63512348+huang-julien@users.noreply.github.com>
Co-authored-by: huang-julien <63512348+huang-julien@users.noreply.github.com>
CSF: Fix Canvas and userEvent types under Yarn PnP
Docgen: Add mock open service
UI: Prevent docs page scroll reset on HMR re-render
…lay-names React: Add support for resolving subcomponents attached as properties of a parent component
…act-route-group TanStack: Normalize route-group handling in createRoute mock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )