refactor(workbench): thread views/services as one exposes bundle#1424
Merged
Conversation
Contributor
📦 Bundle Stats —
|
| Metric | Value | vs main (651dfb4) |
|---|---|---|
| Internal (raw) | 2.7 KB | - |
| Internal (gzip) | 1.0 KB | - |
| Bundled (raw) | 11.16 MB | - |
| Bundled (gzip) | 2.10 MB | - |
| Import time | 907ms | -4ms, -0.4% |
bin:sanity
| Metric | Value | vs main (651dfb4) |
|---|---|---|
| Internal (raw) | 782 B | - |
| Internal (gzip) | 423 B | - |
| Bundled (raw) | 9.87 MB | - |
| Bundled (gzip) | 1.78 MB | - |
| Import time | 2.33s | +1ms, +0.0% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — @sanity/cli-core
Compared against main (651dfb45)
| Metric | Value | vs main (651dfb4) |
|---|---|---|
| Internal (raw) | 106.7 KB | - |
| Internal (gzip) | 26.7 KB | - |
| Bundled (raw) | 21.72 MB | - |
| Bundled (gzip) | 3.46 MB | - |
| Import time | 811ms | +7ms, +0.9% |
🗺️ View treemap · Artifacts
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
📦 Bundle Stats — create-sanity
Compared against main (651dfb45)
| Metric | Value | vs main (651dfb4) |
|---|---|---|
| Internal (raw) | 908 B | - |
| Internal (gzip) | 483 B | - |
| Bundled (raw) | 931 B | - |
| Bundled (gzip) | 491 B | - |
| Import time | ❌ ChildProcess denied: node | - |
Details
- Import time regressions over 10% are flagged with
⚠️ - Sizes shown as raw / gzip 🗜️. Internal bytes = own code only. Total bytes = with all dependencies. Import time = Node.js cold-start median.
08a446d to
63435cb
Compare
Contributor
Coverage Delta
Comparing 11 changed files against main @ Overall Coverage
|
63435cb to
ad9ff83
Compare
Every hop between the CLI config and the federation build (buildApp, buildStaticFiles, getViteConfig, devServer, workbenchVitePlugins, federation plugin, workbenchArtifacts) took views and services as parallel parameters, so adding a declaration family meant touching each one. Bundle them as a single WorkbenchExposes object — a new family now touches the type and the artifact expanders, not every hop in between. Also drops the federation plugin's unused raw exposes passthrough, which freed the name.
ad9ff83 to
d59fddb
Compare
joshuaellis
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Every hop between the CLI config and the federation build took
viewsandservicesas parallel parameters, so adding a declaration family (installation config) meant touching each one. Bundle them as a singleWorkbenchExposesobject — a new family now touches the type and the artifact expanders, not every hop in between.Also drops the federation plugin's unused raw
exposespassthrough, which freed the name.I've decided to not use
interfacesbecause e.g. installation configs aren't interfaces in the Brett-sense.Pure threading refactor: no behavior change, no public API change. Base for #1423, which adds the first new family (the media library's installation config).
Note
Low Risk
Internal parameter threading and typing only; tests updated to match; no runtime behavior change described.
Overview
Refactors workbench build/dev plumbing so declared
viewsandservicestravel as oneWorkbenchExposesbundle from CLI config throughbuildApp/buildStudio, static file bundling, Vite config, and the dev server—instead of separateviewsandserviceson every hop.CLI entry points assemble
exposes: { services, views }fromunstable_defineApp;workbenchArtifactsand the federation Vite plugin consume that object end-to-end. The federation plugin drops the unused rawexposesrecord passthrough (the name is now reserved for the declaration bundle).WorkbenchExposesis exported from@sanity/workbench-cli/buildfor@sanity/cli-build.No intended behavior or public API change—sets up adding new declaration families (e.g. installation config) by extending the type and artifact expanders only.
Reviewed by Cursor Bugbot for commit d59fddb. Bugbot is set up for automated code reviews on this repo. Configure here.