Release: Prerelease 10.4.0-alpha.4#34278
Merged
Merged
Conversation
Enhance the appearance of code elements within links by applying underline and spacing styles. This change ensures better visibility and consistency across typography components.
Add reactComponentMeta — a probe-free extraction engine built on @volar/typescript that uses React's own type system to detect components and extract props from existing story files. Architecture mirrors Vue Component Meta: - ComponentMetaProject: one LanguageService per tsconfig - ComponentMetaManager: multi-project manager with file watching - Path 1: resolvePropsFromStoryFile() via getResolvedSignature() - Path 2: resolvePropsFromComponentType() fallback for args-only stories Tested against Flowbite, Reshaped, Mantine, Primer, and Park UI.
Phase 1 — Error handling hardening: - Wrap per-entry/per-export loops in extractPropsFromStories with try/catch - Replace silent catches in ComponentMetaManager with logger.debug Phase 2 — Correctness fixes: - Fix TypeFlags.Undefined check: use bitwise AND instead of strict equality - Fix JSDoc: jsxDepth 1 = outermost JSX element (not 0) Phase 3 — Generator cleanup: - Remove unnecessary async/Promise.all on synchronous map - Move componentMetaStartTime after await managerWarmup - Rename shadowed `results` to `extractionResults` Phase 4 — Manager robustness: - Normalize Windows paths in rootTsConfigs and onConfigChanged - Watch newly discovered projects when watching is active - Fix typo prepareClosestootCommandLine → prepareClosestRootCommandLine Phase 5 — Nice-to-haves: - extractPropsFromStory takes StoryExtractionEntry object instead of positional params - Add MAX_UNWRAP_DEPTH constant, unify depth limit (was inconsistent 5/10) - Cache getPropSourceFile in getBulkSourceExclusions - Add comment explaining watch option type widening - Fix test timeout for multi-tsconfig test
- ComponentMetaManager: clear searchedDirs on config delete so findMatchTSConfig re-scans directories for new tsconfigs - ComponentMetaProject: bump projectVersion on created events, move shouldCheckRootFiles outside deleted-only branch - componentMetaExtractor: add depth guard to isReactNodeLike recursion, fix union forceOptional to check after collecting all members instead of per-member during iteration
…test - getComponentImports: restore react-docgen / react-docgen-typescript conditional execution (was accidentally changed to always-run) - getComponentImports: move docgenTimings above getComponents JSDoc so the doc comment is attached to the function it documents - ComponentMetaManager: add explanatory comment on prepareClosestRoot - ComponentMetaManager: deduplicate narrower watchers when broader dir is added, preventing duplicate events and wasted file descriptors - ComponentMetaProject.test: replace flaky Date.now() timing assertion with toStrictEqual for cache hit verification
The version was alpha.5 (from the branch) while versions.ts had alpha.12 (from rebase on next). This caused sandbox creation failures because the local registry published alpha.5 but sandboxes tried to install alpha.12.
- Remove extractDocs() and tryAddFile() in favor of extractPropsFromStories() + ensureFiles() - Replace broad getSemanticDiagnostics() warmup with targeted entry replay - Refactor watchers: single Map<dir, FSWatcher> that properly closes subsumed watchers - Eager manager initialization at module load (TS imports in parallel with startup) - Run all 3 docgen engines unconditionally for QA comparison - Add lowercase export guard and isReactComponentType check to prevent false positives - Pass watch flag through manifests preset options
Trigger the first extraction in the background as soon as routes are registered, so the TypeScript LanguageService, program, and type checker are ready before the first HTTP request arrives.
- Add no-unused-vars override for __testfixtures__ in root .eslintrc.js
- Extract runManifests() test helper to centralize partial-options cast
- Use WeakMap<object, ...> instead of WeakMap<(...args: any[]) => any, ...>
- Remove unnecessary `: any` from cachedResolveImport (no overloads)
- Type PropItem.defaultValue as { value: string } (always a string)
- Split optional-chained type guard for proper TS narrowing
- Remove unnecessary `as any` casts where types already match
- Use unknown[] instead of any[] in reactDocgenTypescript test
- Remove dead reactDocgenConfig variable
- Use parameterless catch in reactDocgen.ts
Added examples of inline code within links to the Markdown and DocumentWrapper stories for better demonstration of typography features. Adjusted padding styles in DocumentWrapper and A components for improved layout consistency.
The static import of ComponentMetaManager eagerly loaded @volar/language-core and @volar/typescript, adding significant memory overhead that pushed the internal storybook CI build past its 4GB heap limit. Switch to a dynamic import inside the async managerWarmup IIFE so these heavy deps are only loaded when TypeScript is available.
The manager was created eagerly at module load time via a top-level IIFE, importing TypeScript + @volar + creating a TS Language Service even when experimentalReactComponentMeta was disabled. For the internal storybook build (which doesn't enable this feature), this added ~1-2GB of memory for unused TS programs, pushing the 4GB heap limit and causing OOM. Now the manager is only created on first call to getOrCreateManager(), which only happens when experimentalReactComponentMeta is true.
Path 2 fallback now reads the component type directly from the story file's `meta.component` property instead of scanning the component file's exports. This is inherently gated on the user explicitly setting `component:` in their meta object — no heuristic detection needed. Removes isReactComponentType/isReactNodeLike (~95 lines).
- Remove timings from ComponentsManifest meta - Add DocgenEngine discriminant type for clear 3-way branching - Split manifest .map() into resolve/batch-extract/build steps - Add batchExtract to ComponentMetaManager for per-project batching - Remove per-component extractReactComponentMeta in favor of map lookup
- Add static getInstance() for lazy singleton with dynamic TS import - Have batchExtract accept component objects directly, no field renaming - Remove getManager/managerPromise from generator.ts
- Exact match by componentName when meta.component is set - Remove namespace fallback heuristic (dead logic) - Move title trimming into the function
…/storybookjs/storybook into kasper/react-prop-extraction-lsp
56b9eb1 to
1bc2a84
Compare
Cleanup: Unify oxlint at root and add more file to format
1bc2a84 to
5744cba
Compare
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Build: Add back fmt:check into nx
5744cba to
570cdba
Compare
…k-nextjs-3.2.4 Dependencies: Update `vite-plugin-storybook-nextjs` to ^3.2.4
…sion-change-detection StatusValue: Add 'status-value:new' and 'status-value:modified'
570cdba to
ae8fdfc
Compare
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 49 | 50 | 🚨 +1 🚨 |
| Self size | 20.46 MB | 20.47 MB | 🚨 +9 KB 🚨 |
| Dependency size | 16.54 MB | 16.55 MB | 🚨 +10 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 534 | 534 | 0 |
| Self size | 650 KB | 650 KB | 🚨 +120 B 🚨 |
| Dependency size | 59.95 MB | 60.20 MB | 🚨 +248 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 92 | 92 | 0 |
| Self size | 1.12 MB | 1.12 MB | 🎉 -15 B 🎉 |
| Dependency size | 22.48 MB | 22.73 MB | 🚨 +248 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-native-web-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 121 | 121 | 0 |
| Self size | 30 KB | 30 KB | 0 B |
| Dependency size | 23.55 MB | 23.80 MB | 🚨 +248 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 82 | 82 | 0 |
| Self size | 35 KB | 35 KB | 🎉 -36 B 🎉 |
| Dependency size | 20.26 MB | 20.51 MB | 🚨 +248 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-webpack5
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 271 | 271 | 0 |
| Self size | 24 KB | 24 KB | 0 B |
| Dependency size | 44.56 MB | 44.81 MB | 🚨 +248 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 183 | 184 | 🚨 +1 🚨 |
| Self size | 780 KB | 780 KB | 🎉 -84 B 🎉 |
| Dependency size | 67.66 MB | 67.68 MB | 🚨 +20 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 176 | 177 | 🚨 +1 🚨 |
| Self size | 32 KB | 32 KB | 🚨 +36 B 🚨 |
| Dependency size | 66.19 MB | 66.21 MB | 🚨 +19 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 50 | 51 | 🚨 +1 🚨 |
| Self size | 1.04 MB | 1.04 MB | 🚨 +144 B 🚨 |
| Dependency size | 37.00 MB | 37.02 MB | 🚨 +19 KB 🚨 |
| Bundle Size Analyzer | node | node |
@storybook/react
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 58 | 58 | 0 |
| Self size | 1.19 MB | 1.44 MB | 🚨 +248 KB 🚨 |
| Dependency size | 13.21 MB | 13.21 MB | 🚨 +92 B 🚨 |
| Bundle Size Analyzer | Link | Link |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is an automated pull request that bumps the version from
10.4.0-alpha.3to10.4.0-alpha.4.Once this pull request is merged, it will trigger a new release of version
10.4.0-alpha.4.If you're not a core maintainer with permissions to release you can ignore this pull request.
To do
Before merging the PR, there are a few QA steps to go through:
And for each change below:
This is a list of all the PRs merged and commits pushed directly to
next, that will be part of this release:vite-plugin-storybook-nextjsto ^3.2.4 #34280c25004ac1b7d88c5f57f5e17abc1e96ada8ed95a9ffa6c73128b2bd63b4d070eb57a3c49c8d9622fIf you've made any changes doing the above QA (change PR titles, revert PRs), manually trigger a re-generation of this PR with this workflow and wait for it to finish. It will wipe your progress in this to do, which is expected.
Feel free to manually commit any changes necessary to this branch after you've done the last re-generation, following the Make Manual Changes section in the docs, especially if you're making changes to the changelog.
When everything above is done:
Generated changelog
10.4.0-alpha.4
vite-plugin-storybook-nextjsto ^3.2.4 - #34280, thanks k35o!