Skip to content

Core: Switch from mlly to exsolve#32383

Merged
ndelangen merged 2 commits into
storybookjs:nextfrom
mrginglymus:s-mlly-exsolve
Sep 15, 2025
Merged

Core: Switch from mlly to exsolve#32383
ndelangen merged 2 commits into
storybookjs:nextfrom
mrginglymus:s-mlly-exsolve

Conversation

@mrginglymus
Copy link
Copy Markdown
Contributor

@mrginglymus mrginglymus commented Sep 3, 2025

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:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make 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/core team 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 mlly library to exsolve for module resolution utilities across the core package. The main changes include:

  1. Dependency Migration: Removes mlly (^1.7.4) and adds exsolve (^1.0.7) in the core package.json
  2. API Updates: Replaces resolvePathSync from mlly with resolveModulePath from exsolve in multiple files, with minor parameter changes (e.g., url becomes from)
  3. Utility Reintroduction: Adds a new stripAbsNodeModulesPath utility function since exsolve doesn't provide an equivalent to mlly's parseNodeModulePath
  4. Cross-Platform Compatibility: The new utility uses posix.normalize and slash for better Windows path handling

The 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

  • This PR addresses a legitimate deprecation issue but has some implementation concerns that could cause problems
  • Score reflects the presence of unused imports and incomplete migration patterns that suggest hasty implementation
  • Pay close attention to code/core/src/common/presets.ts which contains unused imports and potential logic issues

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Comment thread code/core/src/common/presets.ts Outdated
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)
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented Sep 3, 2025

View your CI Pipeline Execution ↗ for commit ea94248

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 44s View ↗

☁️ Nx Cloud last updated this comment at 2025-09-11 11:18:35 UTC

configDirManagerEntry = resolvePathSync('./manager', {
url: options.configDir,
configDirManagerEntry = resolveModulePath('./manager', {
from: options.configDir,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mlly is not deprecated. Only resolution util, you can keep using mlly for parseNodeModulePath :)

Copy link
Copy Markdown
Contributor Author

@mrginglymus mrginglymus Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@storybook-app-bot
Copy link
Copy Markdown

storybook-app-bot Bot commented Sep 8, 2025

Package Benchmarks

Commit: ea94248, ran on 11 September 2025 at 10:31:14 UTC

The following packages have significant changes to their size or dependencies:

storybook

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

@ndelangen ndelangen changed the title Switch from mlly to exsolve Core: Switch from mlly to exsolve Sep 11, 2025
@ndelangen ndelangen added the core label Sep 11, 2025
@ndelangen ndelangen added this to the 10 milestone Sep 11, 2025
@pi0
Copy link
Copy Markdown

pi0 commented Sep 11, 2025

Please check comments above 😄

@ndelangen
Copy link
Copy Markdown
Member

@JReinhold do you have a preference regarding the above?

@ndelangen ndelangen merged commit 9ba51ff into storybookjs:next Sep 15, 2025
51 of 52 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 15, 2025
24 tasks
@mrginglymus mrginglymus deleted the s-mlly-exsolve branch September 15, 2025 09:33
@github-actions github-actions Bot mentioned this pull request Sep 16, 2025
23 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:normal core maintenance User-facing maintenance tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SB 10.0.0-beta.0 not working on windows

4 participants