Skip to content

Conversation

@chrisgroks
Copy link
Owner

@chrisgroks chrisgroks commented Nov 23, 2025

This PR addresses issue adobe#8777 by converting key singleton packages to peer dependencies, preventing duplicate package installations in consumer projects.

Problem

Internal packages like `@react-types/shared`, `@react-aria/utils`, and `@react-stately/utils` are declared as regular dependencies with version ranges. This causes duplicate installations when consumers pin specific versions, breaking type overrides and singleton behavior.

Solution

Implements Solution B from issue adobe#8777: converting internal singleton packages to peer dependencies.

Changes

  • 185 packages modified: Moved 343 internal dependencies to `peerDependencies`
  • Singleton packages (now peer dependencies):
    • `@react-types/shared`
    • `@react-aria/utils`
    • `@react-aria/ssr`
    • `@react-stately/utils`
    • `@react-stately/flags`
    • `@internationalized/string`
    • `@internationalized/date`
    • `@internationalized/number`
    • `@internationalized/message`

Testing

  • ✅ All existing tests pass
  • ✅ Dependencies install successfully
  • ✅ Sample test suite passes

Breaking Changes

npm & pnpm: Auto-install peer dependencies by default (no action needed)
Yarn: May require explicit declaration of singleton packages

Related

Fixes adobe#8777" --base main --head fix/peer-deps-singleton-8777


Note

Converts internal singleton packages to peerDependencies across the monorepo and updates aggregator packages to declare required peers, preventing duplicate installs.

  • Dependencies (monorepo-wide):
    • Convert internal singletons to peerDependencies across packages: @react-types/shared, @react-aria/utils, @react-aria/ssr, @react-stately/utils, @react-stately/flags, and @internationalized/{date,number,string,message}.
    • Update aggregator packages (react-aria, react-stately, react-aria-components, @adobe/react-spectrum) to declare required transitive peers.
    • Remove corresponding entries from dependencies and adjust peerDependencies in affected @react-aria/*, @react-spectrum/*, @react-stately/*, and @react-types/* packages.
  • Repo maintenance/docs:
    • Add PR helper script and implementation materials; update environment snapshot.

Written by Cursor Bugbot for commit 189f5c1. This will update automatically on new commits. Configure here.

Chris Diaz and others added 4 commits November 23, 2025 15:48
Addresses issue adobe#8777 by converting key singleton packages to peer
dependencies, preventing duplicate package installations in consumer
projects.

This change ensures that packages like @react-types/shared,
@react-aria/utils, @react-stately/utils, and the @internationalized/*
packages are treated as true singletons across the dependency tree.

Changes:
- Moved 343 internal dependencies to peerDependencies across 185 packages
- Updated aggregator packages (react-aria, react-stately) to declare
  all required singleton peer dependencies
- Ensures singleton behavior for:
  * @react-types/shared
  * @react-aria/utils
  * @react-aria/ssr
  * @react-stately/utils
  * @react-stately/flags
  * @internationalized/string
  * @internationalized/date
  * @internationalized/number
  * @internationalized/message

Benefits:
- Prevents duplicate installations when version ranges overlap
- Ensures type overrides work correctly in consumer projects
- Maintains true singleton behavior for RouterProvider and other
  context-based features
- Allows consumers to explicitly control singleton versions

Breaking Changes:
- Consumers now need to explicitly declare singleton peer dependencies
- Package managers (npm/pnpm) will auto-install these by default
- Yarn users may need to declare these dependencies explicitly

Fixes adobe#8777
Repository owner deleted a comment from cursor bot Nov 23, 2025
@chrisgroks
Copy link
Owner Author

@cursor review
bugbot run

Repository owner deleted a comment from cursor bot Nov 23, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

"@internationalized/string": "^3.2.7",
"@react-stately/flags": "^3.1.2",
"@react-stately/utils": "^3.10.8",
"@react-types/shared": "^3.32.1",
Copy link

Choose a reason for hiding this comment

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

Bug: Missing peer dependency in react-stately aggregator

The react-stately aggregator package is missing @internationalized/date in its peerDependencies, even though it depends on @react-stately/calendar and @react-stately/datepicker which both declare @internationalized/date as a peer dependency. This creates an incomplete transitive peer dependency declaration, potentially causing installation issues for consumers who don't have @internationalized/date installed, especially when using Yarn which doesn't auto-install peer dependencies.

Fix in Cursor Fix in Web

Add all required singleton peer dependencies (@internationalized/date,
@internationalized/message, @internationalized/number, @react-stately/flags,
@react-stately/utils) to ensure proper transitive peer dependency resolution.
"@react-aria/ssr": "^3.9.10",
"@react-aria/utils": "^3.31.0",
"@react-stately/utils": "^3.10.8",
"@react-types/shared": "^3.32.1",
Copy link

Choose a reason for hiding this comment

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

Bug: Missing peer dependencies in react-aria-components

The react-aria-components package depends on react-aria which requires @internationalized/message, @internationalized/number, and @react-stately/flags as peer dependencies, but react-aria-components doesn't declare these in its own peerDependencies. This creates incomplete transitive peer dependency declarations, potentially causing missing dependency errors for consumers.

Fix in Cursor Fix in Web

"@internationalized/number": "^3.6.5",
"@react-aria/utils": "^3.31.0",
"@react-stately/utils": "^3.10.8",
"@react-types/shared": "^3.32.1",
Copy link

Choose a reason for hiding this comment

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

Bug: Missing peer dependencies in @react-spectrum/s2

The @react-spectrum/s2 package depends on react-aria and react-stately but is missing several required transitive peer dependencies: @internationalized/message, @internationalized/string, @react-aria/ssr, and @react-stately/flags. These are all required by the aggregator packages it depends on, and their absence will cause peer dependency warnings or errors for consumers.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make internal package references strict (or peer dependencies)

3 participants