Replace: Use empathic over find-up#32472
Conversation
|
View your CI Pipeline Execution ↗ for commit a4b6af6
☁️ 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 | 11 | 11 | 0 |
| Self size | 374 KB | 319 KB | 🎉 -55 KB 🎉 |
| Dependency size | 1.30 MB | 1.30 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 48 | 48 | 0 |
| Self size | 30.42 MB | 30.49 MB | 🚨 +79 KB 🚨 |
| Dependency size | 17.64 MB | 17.64 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/html-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 14 | 14 | 0 |
| Self size | 23 KB | 23 KB | 🎉 -18 B 🎉 |
| Dependency size | 1.71 MB | 1.66 MB | 🎉 -55 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/nextjs-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 130 | 124 | 🎉 -6 🎉 |
| Self size | 4.00 MB | 4.00 MB | 0 B |
| Dependency size | 21.66 MB | 21.57 MB | 🎉 -91 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/preact-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 14 | 14 | 0 |
| Self size | 14 KB | 14 KB | 0 B |
| Dependency size | 1.70 MB | 1.64 MB | 🎉 -55 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-native-web-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 163 | 157 | 🎉 -6 🎉 |
| Self size | 31 KB | 31 KB | 🚨 +24 B 🚨 |
| Dependency size | 23.05 MB | 22.96 MB | 🎉 -91 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/react-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 120 | 114 | 🎉 -6 🎉 |
| Self size | 36 KB | 36 KB | 🚨 +23 B 🚨 |
| Dependency size | 19.60 MB | 19.51 MB | 🎉 -91 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/svelte-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 22 | 22 | 0 |
| Self size | 59 KB | 59 KB | 0 B |
| Dependency size | 26.95 MB | 26.89 MB | 🎉 -55 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/sveltekit
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 23 | 23 | 0 |
| Self size | 49 KB | 49 KB | 0 B |
| Dependency size | 27.01 MB | 26.95 MB | 🎉 -55 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/vue3-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 110 | 109 | 🎉 -1 🎉 |
| Self size | 38 KB | 38 KB | 🎉 -47 B 🎉 |
| Dependency size | 43.82 MB | 43.76 MB | 🎉 -64 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/web-components-vite
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 15 | 15 | 0 |
| Self size | 20 KB | 20 KB | 🚨 +18 B 🚨 |
| Dependency size | 1.74 MB | 1.68 MB | 🎉 -55 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 205 | 205 | 0 |
| Self size | 886 KB | 883 KB | 🎉 -3 KB 🎉 |
| Dependency size | 81.72 MB | 81.79 MB | 🚨 +75 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 174 | 174 | 0 |
| Self size | 35 KB | 35 KB | 🚨 +42 B 🚨 |
| Dependency size | 76.78 MB | 76.86 MB | 🚨 +79 KB 🚨 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 49 | 49 | 0 |
| Self size | 1.52 MB | 1.52 MB | 🎉 -5 KB 🎉 |
| Dependency size | 48.06 MB | 48.13 MB | 🚨 +79 KB 🚨 |
| Bundle Size Analyzer | node | node |
@storybook/preset-react-webpack
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 170 | 170 | 0 |
| Self size | 26 KB | 21 KB | 🎉 -6 KB 🎉 |
| Dependency size | 30.84 MB | 30.84 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
| cwd: process.cwd(), | ||
| stopAt: getProjectRoot(), | ||
| }); | ||
| const tsconfigPath = find.up('tsconfig.json', { cwd: process.cwd(), last: getProjectRoot() }); |
There was a problem hiding this comment.
logic: Critical: This synchronous call will block the event loop. The original findUp() was async and required await, but find.up() is synchronous. This could cause performance issues in webpack builds.
| cwd: options.configDir, | ||
| stopAt: getProjectRoot(), | ||
| }); | ||
| const location = pkg.up({ cwd: options.configDir, last: getProjectRoot() }); |
There was a problem hiding this comment.
logic: Critical: pkg.up appears synchronous but findUp was async. Verify this doesn't block the event loop or cause type mismatches since the function remains async.
|
|
||
| import boxen, { type Options } from 'boxen'; | ||
| import { findUpMultipleSync } from 'find-up'; | ||
| import * as walk from 'empathic/walk'; |
There was a problem hiding this comment.
logic: Verify 'empathic' is added to dependencies, not just devDependencies, since it's imported in production code
| { cwd: this.primaryPackageJson.operationDir, stopAt: getProjectRoot() } | ||
| ); | ||
| const wantedPath = join('node_modules', packageName, 'package.json'); | ||
| const packageJsonPath = find.up(wantedPath, { cwd: this.cwd, last: getProjectRoot() }); |
There was a problem hiding this comment.
logic: Critical: find.up() is likely async but called without await. This will cause runtime errors if it returns a Promise.
| const mockContext: any = { | ||
| ...liveContext, | ||
| findUp: async ([name]: string[]) => name, | ||
| empathic: { any: ([name]: string[]) => name }, |
There was a problem hiding this comment.
logic: API mismatch: mock uses any method but implementation calls find.any() with different parameters (last vs stopAt)
| const wantedPath = join('node_modules', packageName, 'package.json'); | ||
| const packageJsonPath = find.up(wantedPath, { cwd: this.cwd, last: getProjectRoot() }); |
There was a problem hiding this comment.
logic: find.up from empathic is synchronous but the method is async. Also, the parameter last is empathic-specific (find-up uses stopAt). This suggests the wrong direction of changes.
| import * as find from 'empathic/find'; | ||
| import * as pkg from 'empathic/package'; |
There was a problem hiding this comment.
logic: Critical inconsistency: PR claims to revert FROM empathic TO traditional packages, but these imports use empathic instead of expected 'find-up' and 'fd-package-json'
| const docTSConfig = find.up('tsconfig.doc.json', { | ||
| cwd: options.configDir, | ||
| stopAt: getProjectRoot(), | ||
| last: getProjectRoot(), |
There was a problem hiding this comment.
logic: API parameter mismatch: empathic uses 'last' while find-up uses 'stopAt' - this suggests wrong direction of conversion
|
|
||
| export default { | ||
| packageJson: sync({ cwd: process.cwd() }).packageJson, | ||
| packageJson: JSON.parse(readFileSync(pkg.up({ cwd: process.cwd() }))), |
There was a problem hiding this comment.
style: Using JSON.parse(readFileSync(...)) removes error handling that read-pkg-up provided. This could throw if the file doesn't exist or contains invalid JSON.
| "@storybook/global": "^5.0.0", | ||
| "babel-loader": "9.1.3", | ||
| "find-up": "^7.0.0" | ||
| "empathic": "2.0.0" |
There was a problem hiding this comment.
logic: This dependency change appears to be backwards - adding empathic instead of removing it. For a revert PR, this should be changing back to find-up.
Reverts #32470
Greptile Summary
Updated On: 2025-09-16 11:53:08 UTC
This PR reverts a previous revert (PR #32470) to re-introduce the
empathicpackage across the Storybook codebase, consolidating multiple file system utility packages (find-up,find-cache-dir,resolve-from,fd-package-json,read-pkg-up) into a single unified package. The change affects critical infrastructure throughout Storybook including:Key API changes include switching from asynchronous
find-upoperations to synchronousempathicoperations, parameter name changes (e.g.,stopAtbecomeslast), and consolidating separate package functionality into unified empathic modules (empathic/find,empathic/package,empathic/walk,empathic/resolve). The change aims to improve performance and reduce bundle size by eliminating multiple utility dependencies in favor of a single optimized package.Confidence score: 1/5