Skip to content

chore(deps): test @sanity/[email protected] - #3565

Draft
stipsan wants to merge 8 commits into
mainfrom
cursor/test-sanity-ui-4-next-1dc3
Draft

chore(deps): test @sanity/[email protected]#3565
stipsan wants to merge 8 commits into
mainfrom
cursor/test-sanity-ui-4-next-1dc3

Conversation

@stipsan

@stipsan stipsan commented Jul 30, 2026

Copy link
Copy Markdown
Member

Draft PR to validate compatibility with @sanity/[email protected]. Merged up to date with main (including the @sanity/pkg-utils v12 bump, #3567).

Scope

@sanity/ui@4 is adopted by the two publishable packages that render in the preview frame, where they own their own React tree:

  • @sanity/visual-editing
  • @sanity/visual-editing-standalone

The Studio side (apps/studio, @repo/sanity-schema) stays on @sanity/ui@3. Those render inside the sanity React tree, so they can only move once sanity itself does. The pnpm catalog — whose only consumers are those two — therefore stays at ^3.4.3, and there is no repo-wide @sanity/ui override.

Changes

  • Pin @sanity/ui to 4.0.0-next.6 in visual-editing and visual-editing-standalone
  • Adopt next.5's subpath entry points: import Menu/MenuButton/MenuItem/MenuGroup/MenuDivider from @sanity/ui/menu, Popover from @sanity/ui/popover, Tooltip from @sanity/ui/tooltip
  • Adopt next.5's stylesheet (import '@sanity/ui/styles.css'):
    • @sanity/visual-editing: imported at the shared ThemeProvider host (Overlays) so every JS entry point + the standalone bundle + the svelte wrapper load it; package marked sideEffects: ["*.css"]
    • @sanity/visual-editing-standalone: added @tsdown/css + css.inject so the bundle emits a package-internal style.css and keeps the import — stays self-contained, with no external @sanity/ui dependency
  • Adopt next.2's removal of the private @sanity/ui/_visual-editing entrypoint
  • Refresh standalone inlinedDependencies (drops @juggle/resize-observer, removed upstream in next.4)
  • Add a patch changeset for @sanity/visual-editing and @sanity/visual-editing-standalone

Why the Studio stack stays on v3

An earlier revision forced 4.0.0-next.x on every package via a pnpm override. That broke the apps/studio Vercel build: sanity and its prebuilt plugins (@sanity/assist, @sanity/vision, @sanity/color-input, …) are compiled against @sanity/ui@3 and import Autocomplete, Breadcrumbs, Menu, MenuButton, Popover, Tooltip, useToast and friends from the package root, which next.5 moved to subpaths:

[MISSING_EXPORT] "MenuButton" is not exported by @sanity/[email protected]/dist/index.js
 - Missing export in @sanity/[email protected]/dist/index.js

Dropping the override lets those packages resolve their own ^3.4.x again, so pnpm why @sanity/ui -r now reports a clean split:

@sanity/[email protected]          -> sanity, @sanity/assist, @sanity/vision, apps/studio, @repo/sanity-schema, ...
@sanity/[email protected]   -> @sanity/visual-editing (and the standalone bundle it feeds)

Note on the pkg-utils v12 merge

@sanity/pkg-utils@12 removes the rollup.treeshake block from packages/visual-editing/package.config.ts. This branch had added moduleSideEffects: (id) => id.endsWith('.css') inside that block purely to stop preset: 'smallest' from stripping the side-effect-only import '@sanity/ui/styles.css'. With the preset gone the default moduleSideEffects: true applies, so that workaround is obsolete and has been dropped — the built chunk still emits a bare import "@sanity/ui/styles.css".

Verification

  • pnpm build, pnpm test (unit + typecheck) and pnpm lint all pass
  • apps/studio builds locally (sanity build, exit 0, 441 assets) — reverting just the dependency config reproduces the [MISSING_EXPORT] failure with exit 1, confirming the root cause
  • The published stylesheet survives bundling in both packages: visual-editing's built chunk keeps import "@sanity/ui/styles.css", and the standalone bundle emits dist/style.css and imports it relatively (publint clean)
  • pnpm exec changeset status --since=origin/main validates the patch changeset
  • Storybook overlays render correctly against 4.0.0-next.6 with the external stylesheet

overlays_after_merge_trimmed.mp4

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Bump catalog, visual-editing, and standalone pins from 3.4.3 to
4.0.0-next.0, and add a pnpm override so transitive sanity/plugin
deps resolve to the same prerelease for integration testing.

Co-authored-by: Cody Olsen <[email protected]>
@vercel

vercel Bot commented Jul 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
live-visual-editing-next Ready Ready Preview Aug 10, 2026 10:24am
visual-editing-storybook Ready Ready Preview Aug 10, 2026 10:24am
9 Skipped Deployments
Project Deployment Actions Updated (UTC)
visual-editing-astro Ignored Ignored Aug 10, 2026 10:24am
visual-editing-next Ignored Ignored Preview Aug 10, 2026 10:24am
visual-editing-next-with-i18n Ignored Ignored Aug 10, 2026 10:24am
visual-editing-nuxt Ignored Ignored Aug 10, 2026 10:24am
visual-editing-page-builder-demo Ignored Ignored Preview Aug 10, 2026 10:24am
visual-editing-page-builder-vite Ignored Ignored Aug 10, 2026 10:24am
visual-editing-remix Ignored Ignored Aug 10, 2026 10:24am
visual-editing-studio Ignored Ignored Preview Aug 10, 2026 10:24am
visual-editing-svelte Ignored Ignored Aug 10, 2026 10:24am

Request Review

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ca8d2ab

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@sanity/visual-editing Patch
@sanity/visual-editing-standalone Patch
@sanity/svelte-loader Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Also refresh visual-editing-standalone transitive pins pulled in by the
new UI release (@sanity/color, motion/framer-motion, @sanity/types).

Co-authored-by: Cody Olsen <[email protected]>
…oval

@sanity/[email protected] removed the private @_visual-editing entrypoint;
consumers should import from @sanity/ui instead now that displayName side
effects no longer block tree-shaking.

Co-authored-by: Cody Olsen <[email protected]>
Bump the catalog, visual-editing/standalone pins, and the pnpm override
to 4.0.0-next.5, then adopt the breaking changes introduced since next.3:

- next.5 moved heavy components to dedicated subpath entry points. Import
  Menu/MenuButton/MenuItem/MenuGroup/MenuDivider from '@sanity/ui/menu',
  Popover from '@sanity/ui/popover', Tooltip from '@sanity/ui/tooltip',
  and Code from '@sanity/ui/code' across the packages and the studio app.
- next.5 ships static styles as a stylesheet consumers import themselves.
  Add `import '@sanity/ui/styles.css'`:
  - visual-editing: at the shared ThemeProvider host (Overlays), so every
    JS entry point (and the standalone bundle + svelte wrapper) loads it.
    The `smallest` treeshake preset drops side-effect-only imports, so
    override `moduleSideEffects` to keep `.css` imports; mark the package
    `sideEffects: ["*.css"]`.
  - @repo/sanity-schema: at src/index.ts; mark `sideEffects: ["*.css"]`.
  - studio: at sanity.config.ts.
- standalone bundles visual-editing, so it now bundles the stylesheet.
  Add @tsdown/css and enable `css.inject` to extract a package-internal
  style.css and preserve the import, keeping the package self-contained
  (no external @sanity/ui dependency). Update the entry-point test for the
  new `./style.css` asset export.

The standalone inlinedDependencies also drop @juggle/resize-observer,
removed upstream in next.4.

Co-authored-by: Cody Olsen <[email protected]>
@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addednpm/​@​tsdown/​css@​0.22.14751008098100
Addednpm/​@​sanity/​ui@​4.0.0-next.6991008898100

View full report

Patch release ships styles.css unminified for easier cross-version diffs.
No API changes; catalog, pins, and the pnpm override all move to next.6.

Co-authored-by: Cody Olsen <[email protected]>
The repo-wide pnpm override forced 4.0.0-next.x into `sanity` and its
prebuilt plugins (@sanity/assist, @sanity/vision, @sanity/color-input, ...),
which are compiled against @sanity/ui@3 and import Autocomplete, Breadcrumbs,
Menu, MenuButton, Popover, Tooltip, useToast and friends from the package
root. next.5 moved those to subpath entry points, so the apps/studio build
failed with [MISSING_EXPORT] on Vercel.

Scope the prerelease to the packages actually under test. @sanity/visual-editing
and -standalone keep their direct 4.0.0-next.6 pins since they render in the
preview frame, while the catalog goes back to ^3.4.3: its only consumers are
apps/studio and @repo/sanity-schema, which render inside the `sanity` React
tree and so have to track whatever major `sanity` depends on.

Co-authored-by: Cody Olsen <[email protected]>
Resolves three conflicts from the `@sanity/pkg-utils` v12 bump (#3567):

- packages/visual-editing/package.config.ts: took main's version verbatim.
  v12 drops the `rollup.treeshake` block and replaces `babel.reactCompiler` +
  `reactCompilerOptions` with `reactCompiler`. This branch had added
  `moduleSideEffects: (id) => id.endsWith('.css')` inside that block purely to
  stop `preset: 'smallest'` from stripping the side-effect-only
  `import '@sanity/ui/styles.css'`. With the preset gone the default
  `moduleSideEffects: true` applies, so the workaround is obsolete — verified
  the built chunk still emits a bare `import "@sanity/ui/styles.css"`.
- packages/visual-editing-standalone/package.json: kept both sides. Both had
  already moved `@sanity/types` to 6.6.0; only `@sanity/ui` differed, and this
  branch exists to test 4.0.0-next.6.
- pnpm-lock.yaml: regenerated from main's copy via `pnpm install`.

Main's `apps/page-builder-vite/vercel.json` (`ignoreCommand: exit 0`) also
lands here, which should clear the unrelated page-builder-vite check.

Co-authored-by: Cody Olsen <[email protected]>
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.

2 participants