Core: Switch from mlly to exsolve#32383
Conversation
8269c89 to
30cf37c
Compare
mlly resolve utils are deprecated (unjs/mlly#324 (comment)), and it is recommended to use exsolve instead. The old strip-abs-node-modules-path utility is reintroduced as there is no equivalent in exsolve, and the mlly implementation was more or less the same anyway (except using regex instead of split)
30cf37c to
1f1aa25
Compare
|
View your CI Pipeline Execution ↗ for commit ea94248
☁️ Nx Cloud last updated this comment at |
| configDirManagerEntry = resolvePathSync('./manager', { | ||
| url: options.configDir, | ||
| configDirManagerEntry = resolveModulePath('./manager', { | ||
| from: options.configDir, |
There was a problem hiding this comment.
Perf/Stability: Please make sure configDir ends with a trailing slash to indicate it is a dir otherwise resolution goes to a slow path to stat the path.
| StorybookConfigRaw, | ||
| } from 'storybook/internal/types'; | ||
|
|
||
| import { parseNodeModulePath } from 'mlly'; |
There was a problem hiding this comment.
mlly is not deprecated. Only resolution util, you can keep using mlly for parseNodeModulePath :)
There was a problem hiding this comment.
I switched it on a one-in-one-out basis - doesn't make a huge difference to end users as its bundled, but given that all this is doing is splitting by node_modules, it doesn't seem worth the extra dep.
The function is also defined in the resolve file of mlly, so might presumably get swept up in a future clean out of the deprecated resolve utils.
Package BenchmarksCommit: The following packages have significant changes to their size or dependencies:
|
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 48 | 48 | 0 |
| Self size | 30.74 MB | 30.41 MB | 🎉 -332 KB 🎉 |
| Dependency size | 17.61 MB | 17.61 MB | 0 B |
| Bundle Size Analyzer | Link | Link |
@storybook/cli
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 204 | 204 | 0 |
| Self size | 879 KB | 879 KB | 0 B |
| Dependency size | 81.72 MB | 81.38 MB | 🎉 -332 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
@storybook/codemod
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 173 | 173 | 0 |
| Self size | 35 KB | 35 KB | 0 B |
| Dependency size | 76.79 MB | 76.46 MB | 🎉 -332 KB 🎉 |
| Bundle Size Analyzer | Link | Link |
create-storybook
| Before | After | Difference | |
|---|---|---|---|
| Dependency count | 49 | 49 | 0 |
| Self size | 1.52 MB | 1.52 MB | 0 B |
| Dependency size | 48.35 MB | 48.02 MB | 🎉 -332 KB 🎉 |
| Bundle Size Analyzer | node | node |
mlly to exsolve
|
Please check comments above 😄 |
|
@JReinhold do you have a preference regarding the above? |
Closes #32364
What I did
mlly resolve utils are deprecated
(unjs/mlly#324 (comment)), and it is recommended to use exsolve instead.
The old strip-abs-node-modules-path utility is reintroduced as there is no equivalent in exsolve, and the mlly implementation was more or less the same anyway (except using regex instead of split)
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
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.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 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 canary-release-pr.yml --field pr=<PR_NUMBER>Greptile Summary
Updated On: 2025-09-03 09:05:50 UTC
This PR migrates Storybook from the deprecated
mllylibrary toexsolvefor module resolution utilities across the core package. The main changes include:mlly(^1.7.4) and addsexsolve(^1.0.7) in the core package.jsonresolvePathSyncfrom mlly withresolveModulePathfrom exsolve in multiple files, with minor parameter changes (e.g.,urlbecomesfrom)stripAbsNodeModulesPathutility function since exsolve doesn't provide an equivalent to mlly'sparseNodeModulePathposix.normalizeandslashfor better Windows path handlingThe changes affect module resolution in framework validation (
validate-config.ts), manager building (builder-manager/index.ts), and preset loading (presets.ts). This migration addresses a critical Windows compatibility issue where mlly's path parsing was causing Storybook to fail on Windows systems. The exsolve library provides the same core functionality with better cross-platform support and is the officially recommended replacement by the mlly maintainers.Confidence score: 3/5
code/core/src/common/presets.tswhich contains unused imports and potential logic issues