Skip to content

chore: Yarn upgrade#9817

Merged
snowystinger merged 47 commits intomainfrom
yarn-upgrade
Apr 30, 2026
Merged

chore: Yarn upgrade#9817
snowystinger merged 47 commits intomainfrom
yarn-upgrade

Conversation

@snowystinger
Copy link
Copy Markdown
Member

@snowystinger snowystinger commented Mar 20, 2026

Closes

See yarnpkg/berry#6746 for more information on why so many things needed updates. Probably easiest to look at the commits individually, one of them was automated.

The key thing is that, even though we're in a monorepo, every package is considered its own root. So each one must provide everything expected by peers.

And anything that we need to ensure there is only 1 copy of must be in resolutions, or we need to move to pnp.

One benefit is I found out and fixed a multiple copies of react issue we had.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

🧢 Your Project:

# Conflicts:
#	packages/@react-spectrum/accordion/package.json
#	packages/@react-spectrum/actionbar/package.json
#	packages/@react-spectrum/actiongroup/package.json
#	packages/@react-spectrum/autocomplete/package.json
#	packages/@react-spectrum/avatar/package.json
#	packages/@react-spectrum/badge/package.json
#	packages/@react-spectrum/breadcrumbs/package.json
#	packages/@react-spectrum/button/package.json
#	packages/@react-spectrum/buttongroup/package.json
#	packages/@react-spectrum/calendar/package.json
#	packages/@react-spectrum/card/package.json
#	packages/@react-spectrum/checkbox/package.json
#	packages/@react-spectrum/color/package.json
#	packages/@react-spectrum/combobox/package.json
#	packages/@react-spectrum/datepicker/package.json
#	packages/@react-spectrum/dialog/package.json
#	packages/@react-spectrum/divider/package.json
#	packages/@react-spectrum/dnd/package.json
#	packages/@react-spectrum/dropzone/package.json
#	packages/@react-spectrum/filetrigger/package.json
#	packages/@react-spectrum/form/package.json
#	packages/@react-spectrum/icon/package.json
#	packages/@react-spectrum/illustratedmessage/package.json
#	packages/@react-spectrum/image/package.json
#	packages/@react-spectrum/inlinealert/package.json
#	packages/@react-spectrum/label/package.json
#	packages/@react-spectrum/labeledvalue/package.json
#	packages/@react-spectrum/layout/package.json
#	packages/@react-spectrum/link/package.json
#	packages/@react-spectrum/list/package.json
#	packages/@react-spectrum/listbox/package.json
#	packages/@react-spectrum/menu/package.json
#	packages/@react-spectrum/meter/package.json
#	packages/@react-spectrum/numberfield/package.json
#	packages/@react-spectrum/overlays/package.json
#	packages/@react-spectrum/picker/package.json
#	packages/@react-spectrum/progress/package.json
#	packages/@react-spectrum/provider/package.json
#	packages/@react-spectrum/radio/package.json
#	packages/@react-spectrum/searchfield/package.json
#	packages/@react-spectrum/slider/package.json
#	packages/@react-spectrum/statuslight/package.json
#	packages/@react-spectrum/steplist/package.json
#	packages/@react-spectrum/story-utils/package.json
#	packages/@react-spectrum/switch/package.json
#	packages/@react-spectrum/table/package.json
#	packages/@react-spectrum/tabs/package.json
#	packages/@react-spectrum/tag/package.json
#	packages/@react-spectrum/test-utils/package.json
#	packages/@react-spectrum/text/package.json
#	packages/@react-spectrum/textfield/package.json
#	packages/@react-spectrum/theme-dark/package.json
#	packages/@react-spectrum/theme-default/package.json
#	packages/@react-spectrum/theme-express/package.json
#	packages/@react-spectrum/theme-light/package.json
#	packages/@react-spectrum/toast/package.json
#	packages/@react-spectrum/tooltip/package.json
#	packages/@react-spectrum/tree/package.json
#	packages/@react-spectrum/view/package.json
#	packages/@react-spectrum/well/package.json
#	packages/dev/test-utils/package.json
#	yarn.lock
Base automatically changed from fix-some-peers to main March 23, 2026 19:50
# Conflicts:
#	packages/@react-spectrum/button/package.json
#	packages/@react-spectrum/checkbox/package.json
#	packages/@react-spectrum/color/package.json
#	packages/@react-spectrum/dropzone/package.json
#	packages/@react-spectrum/filetrigger/package.json
#	packages/@react-spectrum/text/package.json
#	packages/@react-spectrum/toast/package.json
#	packages/dev/test-utils/package.json
This reverts commit d176995.
@rspbot
Copy link
Copy Markdown

rspbot commented Mar 23, 2026

@snowystinger
Copy link
Copy Markdown
Member Author

On hold until next release cycle

reidbarber
reidbarber previously approved these changes Mar 25, 2026
@reidbarber reidbarber dismissed their stale review March 25, 2026 14:47

on hold

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 10, 2026

# Conflicts:
#	packages/@adobe/react-spectrum/package.json
#	packages/@react-spectrum/color/package.json
#	packages/dev/test-utils/package.json
#	yarn.lock
@rspbot
Copy link
Copy Markdown

rspbot commented Apr 23, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 23, 2026

Comment thread package.json
"typescript-eslint": "^8.38.0",
"unplugin-parcel-macros": "^0.1.1",
"verdaccio": "^6.0.0",
"vite": "^7.3.2",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

where do we depend on vite?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks, looks like it was resolving to multiple versions at one point. I probably meant to put it in the resolutions and then remove it, but took a long break and forgot about it.
vitest depends on it, but not as a peer, so we shouldn't need this here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nope, found it. It's needed in the install by @vitejs/plugin-react which has it as a peer. That's a dependency in our root package.json for running real browser tests it looks like.

react-spectrum-monorepo@workspace:. doesn't provide vite (p9b69d6), requested by @vitejs/plugin-react and other dependencies.

snowystinger and others added 16 commits April 24, 2026 17:21
…p crash

Parcel bundles storybook/internal/preview-api and chunk-SZQXB3JV.js into
a CJS bundle with a circular dependency. During initialization, the chunk's
top-level highlight/preview.ts runs `(_previewApi.addons)?.ready` before the
preview-api chunk's lazy getter has resolved its internal chunk reference.
Result: `TypeError: Cannot read properties of undefined (reading 'addons')`
fires as an unhandled promise rejection and the preview never initializes.

The line is guarded by `globalThis?.FEATURES?.highlight && ...` so setting
features.highlight=false short-circuits the buggy codepath. Trade-off:
disables the highlight feature used by addon-a11y for accessibility-violation
visualization.

This is a workaround; the underlying Parcel + SB10 bundling interaction
should be investigated as a follow-up.
…re FEATURES.highlight

Root-cause fix replacing the previous symptom-workaround. Storybook's
dist/csf/index.js has a circular dependency with dist/_browser-chunks/chunk-SZQXB3JV.js
and dist/preview-api/index.js. When Parcel's CJS bundler initialises these modules,
csf/index.js runs its highlight-addon preview.ts code (line 916) before the
storybook/preview-api module's 'addons' export is fully resolved. The resulting
getter access throws TypeError during the circular-dep init window.

The fix defers the highlight initialisation one microtask tick using
Promise.resolve().then(), wrapped in try/catch for belt-and-braces safety.
By the time the callback fires all circular deps are resolved and 'addons'
holds the live AddonStore instance. Highlights initialise correctly.

Patch is applied via patch-package (already in postinstall).
Restores FEATURES.highlight to its default true, preserving accessibility-
violation visualisation that addon-a11y depends on.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s to globals

Match upstream Storybook 10 builders (@storybook/builder-vite,
@storybook/builder-webpack5) by externalizing every module key in
storybook/internal/preview/globals.js's globalsNameReferenceMap. For each
specifier, the resolver returns a synthetic ESM cache file at
node_modules/.cache/sb-parcel-externals/<key>.js with shape:

  const { addons, PreviewWeb, ... } = globalThis.__STORYBOOK_MODULE_*;
  export { addons, PreviewWeb, ... };
  export default globalThis.__STORYBOOK_MODULE_*;

The runtime bundle (storybook/internal/preview/runtime) populates these
globals via its top-level setup() side effect; once Task 1.2 hoists the
runtime import, externalized modules resolve to live bindings on the
already-populated globals — eliminating the CJS circular-dep that the
node_modules patch currently masks.

This task adds the resolver only; preview-entry generator + iframe
template alignment follow in Tasks 1.2 and 1.3, after which Task 1.4
removes the patch.
…ew-api path

Move `import { setup } from 'storybook/internal/preview/runtime'` to be the
first import in the generated preview-main.js so runtime.js's top-level setup()
call populates __STORYBOOK_MODULE_* globals before setup-addons.js (or any other
externalized specifier) evaluates and tries to destructure those globals.

Also switch `from 'storybook/internal/preview-api'` to the public
`from 'storybook/preview-api'` to match the externalize map and upstream
Vite/webpack5 ordering.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… upstream

After externalizing storybook runtime modules (Task 1.1) and hoisting
the runtime import (Task 1.2), runtime.js's setup() populates every
__STORYBOOK_MODULE_* global plus __STORYBOOK_ADDONS_PREVIEW and
__STORYBOOK_ADDONS_CHANNEL__. Our hand-rolled init-addons IIFE and
preview.js bootstrap entry exist only to mask the cycle that those
populate-the-globals tasks now resolve at the source.

- iframe.html: drop the inline init IIFE, add TAGS_OPTIONS / OTHER_GLOBALS
  placeholders, set window.module=undefined and window.global=window
  (matches upstream Vite); script tag now points at preview-main.js
- gen-preview-modern.mjs: remove generatePreviewBootstrap and
  generateInitAddonsGlobal helpers and their exports
- preset.mjs: stop emitting preview.js and init-addons-global.js to
  generated-entries; only setup-addons.js and preview-main.js are needed

The patch (patches/storybook+10.3.5.patch) is still in place and
removed in Task 1.4.
…externalize-runtime alignment)

Tasks 1.1-1.3 ported the upstream Storybook 10 externalize-the-runtime
pattern: storybook/preview-api and 9 sibling specifiers are now resolved
to synthetic cache files reading from globalThis.__STORYBOOK_MODULE_*,
populated by storybook/internal/preview/runtime's setup() side effect
which runs first in the preview entry. The Parcel CJS circular-dep
that motivated the patch (storybook/preview-api <-> chunk-SZQXB3JV.js
through dist/csf/index.js) no longer exists in our bundle graph because
storybook/preview-api is no longer bundled at all.

FEATURES.highlight is restored to its default true; addon-a11y's
violation visualization works again. Verified across all four config
dirs (.storybook, .storybook-s2, .chromatic, .chromatic-fc) for both
dev and build modes.
The @vueless/storybook-dark-mode toolbar toggle was a no-op in the v3/rac
Storybook because nothing in .storybook reacted to its DARK_MODE event.

- preview.js: subscribe to DARK_MODE_EVENT_NAME on the addons channel and
  reflect the state on document.documentElement.dataset.colorScheme.
  Initial value reads from the addon's `sb-addon-themes-3` localStorage key
  so the first paint is correct (matches the .storybook-s2 pattern).
- custom-addons/provider/index.js: consume useDarkMode() and feed isDark
  through to the React Spectrum Provider's `colorScheme` prop whenever the
  ProviderSwitcher dropdown is set to "Auto". An explicit dropdown choice
  still wins.
Add succinct comments at non-obvious decision points across the custom
Parcel-based Storybook 10 builder, referencing the official Builder API
docs (https://storybook.js.org/docs/builders/builder-api) and the upstream
@storybook/builder-vite and @storybook/builder-webpack5 reference
implementations. Highlights:

- parcel-resolver-storybook: top-of-file block explaining the
  externalize-the-runtime pattern, the globalsNameReferenceMap source,
  the .cache layout, and the CJS-cycle issue it sidesteps; per-branch
  comments for externals / react-dom/client shim / story: pipeline.
- storybook-builder-parcel/preset.mjs: Builder API contract summary,
  rationale for the 9003->3000 reverse proxy, list of the five generated
  files, and the bail() / module-scope watcher rationale.
- gen-preview-modern.mjs: explicit ordering rationale for runtime ->
  setup-addons -> PreviewWeb, why processPreviewAnnotation needs
  toPackageExportSpecifier under Parcel, and why toImportFn uses static
  imports + Object.assign instead of Promise.all + spread.
- gen-iframe-modern.mjs / templates/iframe.html: provenance from
  upstream Vite's input/iframe.html and the OTHER_GLOBALS placeholder
  workaround.
- StoryTransformer.ts / StorybookMDXTransformer.mjs: brief headers
  describing what each transformer does and the IPC-based docgen
  optimization.

No code logic changes; comments only.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…torybook-10-upgrade"

This reverts commit bf62a86, reversing
changes made to edc24b0.
@rspbot
Copy link
Copy Markdown

rspbot commented Apr 27, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 28, 2026

LFDanLu
LFDanLu previously approved these changes Apr 28, 2026
# Conflicts:
#	yarn.lock
@rspbot
Copy link
Copy Markdown

rspbot commented Apr 30, 2026

@snowystinger snowystinger added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit 1b4438c Apr 30, 2026
29 checks passed
@snowystinger snowystinger deleted the yarn-upgrade branch April 30, 2026 23:21
@yihuiliao yihuiliao added the no testing Does not require manual testing during testing session label May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no testing Does not require manual testing during testing session RAC ready for review S2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants