@sanity/workbench-cli 2.2.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_exports/build.d.ts +54 -2
- package/dist/_exports/build.js +1 -0
- package/dist/_exports/build.js.map +1 -1
- package/dist/_exports/{defineApp-Dmrf4GjS.d.ts → defineApp-KCHd3Vab.d.ts} +29 -29
- package/dist/_exports/deploy.d.ts +3 -3
- package/dist/_exports/dev.d.ts +1 -1
- package/dist/_exports/index.d.ts +3 -3
- package/dist/_exports/init.d.ts +2 -2
- package/dist/_exports/preview.d.ts +1 -1
- package/dist/_exports/{registry-HE_dEHFa.d.ts → registry-BCLMbrla.d.ts} +11 -11
- package/dist/_exports/{resolveWorkbenchConfig-0Crh5P9n.d.ts → resolveWorkbenchConfig-1CV651GT.d.ts} +2 -2
- package/dist/_exports/{summarizeInterfaces-CaYUOK3F.d.ts → summarizeInterfaces-DoG6OunM.d.ts} +4 -4
- package/dist/_exports/undeploy.d.ts +2 -2
- package/dist/actions/build/resource-bindings.js +56 -0
- package/dist/actions/build/resource-bindings.js.map +1 -0
- package/dist/actions/build/vite/plugin.js +10 -7
- package/dist/actions/build/vite/plugin.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-environment.js +22 -3
- package/dist/actions/build/vite/plugins/plugin-sanity-environment.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js +16 -4
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js.map +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js +2 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js.map +1 -1
- package/dist/actions/deploy/deployConfig.js +6 -6
- package/dist/actions/deploy/deployConfig.js.map +1 -1
- package/dist/actions/deploy/deployWorkbenchApp.js +11 -11
- package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
- package/dist/actions/deploy/summarizeInterfaces.js.map +1 -1
- package/dist/actions/deploy/viewDeployment.js +2 -2
- package/dist/actions/deploy/viewDeployment.js.map +1 -1
- package/dist/actions/dev/appServerSupervisor.js.map +1 -1
- package/dist/actions/dev/registry.js +1 -1
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +3 -1
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/toWireInterface.js +1 -1
- package/dist/actions/dev/toWireInterface.js.map +1 -1
- package/dist/actions/init/cliConfig.js +6 -6
- package/dist/actions/init/cliConfig.js.map +1 -1
- package/dist/contract.js +12 -12
- package/dist/contract.js.map +1 -1
- package/dist/defineView.js.map +1 -1
- package/dist/deriveInterfaces.js +5 -5
- package/dist/deriveInterfaces.js.map +1 -1
- package/package.json +9 -10
package/dist/_exports/build.d.ts
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
|
-
import { a as resolveWorkbenchApp, i as WorkbenchExposes, n as resolveWorkbenchConfig, r as ResolvedWorkbenchApp, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-
|
|
1
|
+
import { a as resolveWorkbenchApp, i as WorkbenchExposes, n as resolveWorkbenchConfig, r as ResolvedWorkbenchApp, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-1CV651GT.js";
|
|
2
2
|
import { PluginOption } from "vite";
|
|
3
|
+
/**
|
|
4
|
+
* Resource bindings ride in a dedicated module in the app's bundle rather than an
|
|
5
|
+
* index.html script tag, so both standalone studios and federated apps resolve
|
|
6
|
+
* them the same way (a federated host pulls modules, not HTML).
|
|
7
|
+
*
|
|
8
|
+
* The module is emitted at a stable, unhashed path (`sanity-resource-bindings.js`)
|
|
9
|
+
* at the bundle root and is statically imported first, so it is evaluated before
|
|
10
|
+
* any app code. At deploy time Brett replaces the `__SANITY_RESOURCE_BINDINGS__`
|
|
11
|
+
* token with the resolved bindings JSON. The token is invalid JSON on purpose: a
|
|
12
|
+
* minifier can't constant-fold `JSON.parse` of it, so the call — and the token —
|
|
13
|
+
* survive minification for Brett to rewrite.
|
|
14
|
+
*
|
|
15
|
+
* These constants are the single source of truth shared by the standalone studio
|
|
16
|
+
* build (`@sanity/cli-build`) and the federated app build here. They must stay in
|
|
17
|
+
* lockstep with Brett's replacement (see SDK-2413).
|
|
18
|
+
*/
|
|
19
|
+
/** Rolldown chunk name used to force the bindings module into its own chunk. */
|
|
20
|
+
declare const RESOURCE_BINDINGS_CHUNK_NAME = "sanity-resource-bindings";
|
|
21
|
+
/** Stable, unhashed file name Brett looks for at the bundle root. */
|
|
22
|
+
declare const RESOURCE_BINDINGS_FILENAME = "sanity-resource-bindings.js";
|
|
23
|
+
/** Token Brett replaces with the resolved bindings JSON at deploy. */
|
|
24
|
+
declare const RESOURCE_BINDINGS_TOKEN = "__SANITY_RESOURCE_BINDINGS__";
|
|
25
|
+
/**
|
|
26
|
+
* Contents of the generated bindings module. The `JSON.parse` result is assigned
|
|
27
|
+
* to a global so the module has an observable side effect and isn't tree-shaken
|
|
28
|
+
* when nothing imports its export yet (the reader lands in SDK-2295). The
|
|
29
|
+
* try/catch keeps a local, un-deployed build (e.g. `sanity preview`) working: an
|
|
30
|
+
* unreplaced token throws, and we fall back to an empty array.
|
|
31
|
+
*/
|
|
32
|
+
declare const RESOURCE_BINDINGS_MODULE_SOURCE = "// This file is auto-generated on 'sanity build' / 'sanity dev'\n// Modifications to this file are automatically discarded\nlet resourceBindings = []\ntry {\n resourceBindings = JSON.parse('__SANITY_RESOURCE_BINDINGS__')\n} catch {\n // Built but not deployed through Brett (e.g. local preview): keep the default.\n}\nglobalThis.__SANITY_RESOURCE_BINDINGS__ = resourceBindings\nexport {resourceBindings}\n";
|
|
33
|
+
/** Side-effect import placed first in each entry so the module evaluates before app code. */
|
|
34
|
+
declare const RESOURCE_BINDINGS_ENTRY_IMPORT = "import './sanity-resource-bindings.js'";
|
|
35
|
+
/**
|
|
36
|
+
* Rolldown `codeSplitting` group that isolates the bindings module into its own
|
|
37
|
+
* chunk. `minSize`/`minModuleSize` of 0 are scoped to this group (not the
|
|
38
|
+
* enclosing `codeSplitting` object) so they only affect the bindings module and
|
|
39
|
+
* never the automatic chunking of everything else. They stop Rolldown folding
|
|
40
|
+
* the tiny module back into its importer.
|
|
41
|
+
*/
|
|
42
|
+
declare const resourceBindingsCodeSplittingGroup: {
|
|
43
|
+
minModuleSize: number;
|
|
44
|
+
minSize: number;
|
|
45
|
+
name: string;
|
|
46
|
+
test: RegExp;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* `chunkFileNames` value for the bindings chunk (unhashed, at the bundle root),
|
|
50
|
+
* or `undefined` for any other chunk so the caller can apply its own default.
|
|
51
|
+
*/
|
|
52
|
+
declare function resourceBindingsChunkFileName(chunkName: string): string | undefined;
|
|
3
53
|
/**
|
|
4
54
|
* Dep pre-bundling inputs for a workbench app's dev server.
|
|
5
55
|
*
|
|
@@ -49,6 +99,8 @@ interface WorkbenchViteOptions {
|
|
|
49
99
|
exposes?: WorkbenchExposes;
|
|
50
100
|
/** App (vs studio) build — selects the discriminated federation option shape. */
|
|
51
101
|
isApp?: boolean;
|
|
102
|
+
/** Blueprints build (via `@sanity/runtime-cli`) — emit the resource-bindings module. */
|
|
103
|
+
isBlueprints?: boolean;
|
|
52
104
|
}
|
|
53
105
|
/** Build the Vite plugins for a workbench app's module-federation remote. */
|
|
54
106
|
declare function workbenchVitePlugins(options: WorkbenchViteOptions): Promise<PluginOption>;
|
|
@@ -59,5 +111,5 @@ declare function workbenchVitePlugins(options: WorkbenchViteOptions): Promise<Pl
|
|
|
59
111
|
* its own id from the applications API.
|
|
60
112
|
*/
|
|
61
113
|
declare function buildAppId(app: ResolvedWorkbenchApp): Promise<string>;
|
|
62
|
-
export { type ResolvedMediaLibraryConfig, type WorkbenchExposes, buildAppId, resolveWorkbenchApp, resolveWorkbenchConfig, workbenchOptimizeDeps, workbenchVitePlugins };
|
|
114
|
+
export { RESOURCE_BINDINGS_CHUNK_NAME, RESOURCE_BINDINGS_ENTRY_IMPORT, RESOURCE_BINDINGS_FILENAME, RESOURCE_BINDINGS_MODULE_SOURCE, RESOURCE_BINDINGS_TOKEN, type ResolvedMediaLibraryConfig, type WorkbenchExposes, buildAppId, resolveWorkbenchApp, resolveWorkbenchConfig, resourceBindingsChunkFileName, resourceBindingsCodeSplittingGroup, workbenchOptimizeDeps, workbenchVitePlugins };
|
|
63
115
|
//# sourceMappingURL=build.d.ts.map
|
package/dist/_exports/build.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// resolver the build reads declared views/web workers from. The build needs no
|
|
4
4
|
// deploy-time guards, so it takes the bare `resolveWorkbenchApp` — the guarded
|
|
5
5
|
// view (`getWorkbench`) is the deploy entry's export.
|
|
6
|
+
export { RESOURCE_BINDINGS_CHUNK_NAME, RESOURCE_BINDINGS_ENTRY_IMPORT, RESOURCE_BINDINGS_FILENAME, RESOURCE_BINDINGS_MODULE_SOURCE, RESOURCE_BINDINGS_TOKEN, resourceBindingsChunkFileName, resourceBindingsCodeSplittingGroup } from '../actions/build/resource-bindings.js';
|
|
6
7
|
export { workbenchOptimizeDeps } from '../actions/build/vite/optimize-deps.js';
|
|
7
8
|
export { workbenchVitePlugins } from '../actions/build/vite/workbench-vite-plugins.js';
|
|
8
9
|
export { buildAppId } from '../appId.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/build.ts"],"sourcesContent":["// Node-only build entry: the module-federation Vite plugins that\n// `@sanity/cli-build`'s `getViteConfig` swaps in for a workbench app, plus the\n// resolver the build reads declared views/web workers from. The build needs no\n// deploy-time guards, so it takes the bare `resolveWorkbenchApp` — the guarded\n// view (`getWorkbench`) is the deploy entry's export.\n\nexport {workbenchOptimizeDeps} from '../actions/build/vite/optimize-deps.js'\nexport {workbenchVitePlugins} from '../actions/build/vite/workbench-vite-plugins.js'\nexport {buildAppId} from '../appId.js'\nexport {resolveWorkbenchApp, type WorkbenchExposes} from '../resolveWorkbenchApp.js'\nexport {type ResolvedMediaLibraryConfig, resolveWorkbenchConfig} from '../resolveWorkbenchConfig.js'\n"],"names":["workbenchOptimizeDeps","workbenchVitePlugins","buildAppId","resolveWorkbenchApp","resolveWorkbenchConfig"],"mappings":"AAAA,iEAAiE;AACjE,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,sDAAsD;AAEtD,
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/build.ts"],"sourcesContent":["// Node-only build entry: the module-federation Vite plugins that\n// `@sanity/cli-build`'s `getViteConfig` swaps in for a workbench app, plus the\n// resolver the build reads declared views/web workers from. The build needs no\n// deploy-time guards, so it takes the bare `resolveWorkbenchApp` — the guarded\n// view (`getWorkbench`) is the deploy entry's export.\n\nexport {\n RESOURCE_BINDINGS_CHUNK_NAME,\n RESOURCE_BINDINGS_ENTRY_IMPORT,\n RESOURCE_BINDINGS_FILENAME,\n RESOURCE_BINDINGS_MODULE_SOURCE,\n RESOURCE_BINDINGS_TOKEN,\n resourceBindingsChunkFileName,\n resourceBindingsCodeSplittingGroup,\n} from '../actions/build/resource-bindings.js'\nexport {workbenchOptimizeDeps} from '../actions/build/vite/optimize-deps.js'\nexport {workbenchVitePlugins} from '../actions/build/vite/workbench-vite-plugins.js'\nexport {buildAppId} from '../appId.js'\nexport {resolveWorkbenchApp, type WorkbenchExposes} from '../resolveWorkbenchApp.js'\nexport {type ResolvedMediaLibraryConfig, resolveWorkbenchConfig} from '../resolveWorkbenchConfig.js'\n"],"names":["RESOURCE_BINDINGS_CHUNK_NAME","RESOURCE_BINDINGS_ENTRY_IMPORT","RESOURCE_BINDINGS_FILENAME","RESOURCE_BINDINGS_MODULE_SOURCE","RESOURCE_BINDINGS_TOKEN","resourceBindingsChunkFileName","resourceBindingsCodeSplittingGroup","workbenchOptimizeDeps","workbenchVitePlugins","buildAppId","resolveWorkbenchApp","resolveWorkbenchConfig"],"mappings":"AAAA,iEAAiE;AACjE,+EAA+E;AAC/E,+EAA+E;AAC/E,+EAA+E;AAC/E,sDAAsD;AAEtD,SACEA,4BAA4B,EAC5BC,8BAA8B,EAC9BC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,uBAAuB,EACvBC,6BAA6B,EAC7BC,kCAAkC,QAC7B,wCAAuC;AAC9C,SAAQC,qBAAqB,QAAO,yCAAwC;AAC5E,SAAQC,oBAAoB,QAAO,kDAAiD;AACpF,SAAQC,UAAU,QAAO,cAAa;AACtC,SAAQC,mBAAmB,QAA8B,4BAA2B;AACpF,SAAyCC,sBAAsB,QAAO,+BAA8B"}
|
|
@@ -15,10 +15,10 @@ interface ViewComponentBaseProps<TView> {
|
|
|
15
15
|
}
|
|
16
16
|
/** Component slots per view surface; windows load outside the component artifact path. @internal */
|
|
17
17
|
declare const VIEW_COMPONENTS: {
|
|
18
|
-
readonly app: readonly [];
|
|
19
18
|
readonly asset_source: readonly ["asset_source"];
|
|
20
19
|
readonly panel: readonly ["title", "panel"];
|
|
21
20
|
readonly tile: readonly ["tile"];
|
|
21
|
+
readonly window: readonly [];
|
|
22
22
|
};
|
|
23
23
|
/** @public */
|
|
24
24
|
type ViewSurface = keyof typeof VIEW_COMPONENTS;
|
|
@@ -39,18 +39,18 @@ type TileSize = z.infer<typeof TileSizeSchema>;
|
|
|
39
39
|
/** @public */
|
|
40
40
|
type ServiceType = 'worker';
|
|
41
41
|
declare const DockGroupSchema: z.ZodMiniEnum<{
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
system: "system";
|
|
43
|
+
applications: "applications";
|
|
44
|
+
user: "user";
|
|
45
45
|
}>;
|
|
46
46
|
/** @public */
|
|
47
47
|
type DockGroup = z.output<typeof DockGroupSchema>;
|
|
48
48
|
declare const PanelViewSchema: z.ZodMiniObject<{
|
|
49
49
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
50
50
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
system: "system";
|
|
52
|
+
applications: "applications";
|
|
53
|
+
user: "user";
|
|
54
54
|
}>>;
|
|
55
55
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
56
56
|
}, z.core.$strip>>;
|
|
@@ -68,16 +68,16 @@ declare function definePanelView(view: DefinePanelViewInput): PanelView;
|
|
|
68
68
|
declare const WindowViewSchema: z.ZodMiniObject<{
|
|
69
69
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
70
70
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
system: "system";
|
|
72
|
+
applications: "applications";
|
|
73
|
+
user: "user";
|
|
74
74
|
}>>;
|
|
75
75
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
76
76
|
}, z.core.$strip>>;
|
|
77
77
|
title: z.ZodMiniString<string>;
|
|
78
78
|
name: z.ZodMiniString<string>;
|
|
79
79
|
src: z.ZodMiniString<string>;
|
|
80
|
-
surface: z.ZodMiniLiteral<"
|
|
80
|
+
surface: z.ZodMiniLiteral<"window">;
|
|
81
81
|
}, z.core.$strip>;
|
|
82
82
|
/** @public */
|
|
83
83
|
type WindowView = z.output<typeof WindowViewSchema>;
|
|
@@ -119,22 +119,22 @@ declare function defineTileView(view: DefineTileViewInput): TileView;
|
|
|
119
119
|
declare const InterfaceDeclarationSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
120
120
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
121
121
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
system: "system";
|
|
123
|
+
applications: "applications";
|
|
124
|
+
user: "user";
|
|
125
125
|
}>>;
|
|
126
126
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
127
127
|
}, z.core.$strip>>;
|
|
128
128
|
title: z.ZodMiniString<string>;
|
|
129
129
|
name: z.ZodMiniString<string>;
|
|
130
130
|
src: z.ZodMiniString<string>;
|
|
131
|
-
surface: z.ZodMiniLiteral<"
|
|
131
|
+
surface: z.ZodMiniLiteral<"window">;
|
|
132
132
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
133
133
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
134
134
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
135
|
+
system: "system";
|
|
136
|
+
applications: "applications";
|
|
137
|
+
user: "user";
|
|
138
138
|
}>>;
|
|
139
139
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
140
140
|
}, z.core.$strip>>;
|
|
@@ -206,9 +206,9 @@ declare const DefineAppInputSchema: z.ZodMiniObject<{
|
|
|
206
206
|
}>>;
|
|
207
207
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
208
208
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
209
|
+
system: "system";
|
|
210
|
+
applications: "applications";
|
|
211
|
+
user: "user";
|
|
212
212
|
}>>;
|
|
213
213
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
214
214
|
}, z.core.$strip>>;
|
|
@@ -222,22 +222,22 @@ declare const DefineAppInputSchema: z.ZodMiniObject<{
|
|
|
222
222
|
views: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
223
223
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
224
224
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
225
|
+
system: "system";
|
|
226
|
+
applications: "applications";
|
|
227
|
+
user: "user";
|
|
228
228
|
}>>;
|
|
229
229
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
230
230
|
}, z.core.$strip>>;
|
|
231
231
|
title: z.ZodMiniString<string>;
|
|
232
232
|
name: z.ZodMiniString<string>;
|
|
233
233
|
src: z.ZodMiniString<string>;
|
|
234
|
-
surface: z.ZodMiniLiteral<"
|
|
234
|
+
surface: z.ZodMiniLiteral<"window">;
|
|
235
235
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
236
236
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
237
237
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
system: "system";
|
|
239
|
+
applications: "applications";
|
|
240
|
+
user: "user";
|
|
241
241
|
}>>;
|
|
242
242
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
243
243
|
}, z.core.$strip>>;
|
|
@@ -373,4 +373,4 @@ declare function isWorkbenchConfig(app: unknown): app is WorkbenchConfig;
|
|
|
373
373
|
*/
|
|
374
374
|
declare function unstable_defineMediaLibrary(input: DefineMediaLibraryInput): WorkbenchConfig;
|
|
375
375
|
export { WorkbenchConfigValue as A, VIEW_CONTRACT_VERSION as C, ViewSurface as D, ViewDeclaration as E, defineWindowView as F, definePanelView as M, defineTileView as N, WebWorker as O, defineWebWorker as P, TileView as S, ViewComponentBaseProps as T, DockGroup as _, WorkbenchApp as a, ServiceType as b, isWorkbenchApp as c, AssetSourceView as d, DefineAssetSourceViewInput as f, DefineWindowViewInput as g, DefineWebWorkerInput as h, MediaLibraryField as i, defineAssetSourceView as j, WindowView as k, isWorkbenchConfig as l, DefineTileViewInput as m, DefineAppResult as n, WorkbenchConfig as o, DefinePanelViewInput as p, DefineMediaLibraryInput as r, defineApplication as s, DefineAppInput as t, unstable_defineMediaLibrary as u, PanelView as v, ViewComponent as w, TileSize as x, SERVICE_CONTRACT_VERSION as y };
|
|
376
|
-
//# sourceMappingURL=defineApp-
|
|
376
|
+
//# sourceMappingURL=defineApp-KCHd3Vab.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./defineApp-
|
|
2
|
-
import { n as resolveWorkbenchConfig, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-
|
|
3
|
-
import { a as DeployableWorkbenchApp, i as summarizeInterfaces, n as DeployedView, o as getWorkbench, r as DeployedWebWorker, t as DeployedInterface } from "./summarizeInterfaces-
|
|
1
|
+
import "./defineApp-KCHd3Vab.js";
|
|
2
|
+
import { n as resolveWorkbenchConfig, t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-1CV651GT.js";
|
|
3
|
+
import { a as DeployableWorkbenchApp, i as summarizeInterfaces, n as DeployedView, o as getWorkbench, r as DeployedWebWorker, t as DeployedInterface } from "./summarizeInterfaces-DoG6OunM.js";
|
|
4
4
|
import { AppVisibility, CliConfig, Output } from "@sanity/cli-core";
|
|
5
5
|
import "node:zlib";
|
|
6
6
|
/**
|
package/dist/_exports/dev.d.ts
CHANGED
package/dist/_exports/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as VIEW_CONTRACT_VERSION, D as ViewSurface, E as ViewDeclaration, F as defineWindowView, M as definePanelView, N as defineTileView, O as WebWorker, P as defineWebWorker, S as TileView, T as ViewComponentBaseProps, _ as DockGroup, a as WorkbenchApp, b as ServiceType, c as isWorkbenchApp, d as AssetSourceView, f as DefineAssetSourceViewInput, g as DefineWindowViewInput, h as DefineWebWorkerInput, i as MediaLibraryField, j as defineAssetSourceView, k as WindowView, l as isWorkbenchConfig, m as DefineTileViewInput, n as DefineAppResult, o as WorkbenchConfig, p as DefinePanelViewInput, r as DefineMediaLibraryInput, s as defineApplication, t as DefineAppInput, u as unstable_defineMediaLibrary, v as PanelView, w as ViewComponent, x as TileSize, y as SERVICE_CONTRACT_VERSION } from "./defineApp-
|
|
1
|
+
import { C as VIEW_CONTRACT_VERSION, D as ViewSurface, E as ViewDeclaration, F as defineWindowView, M as definePanelView, N as defineTileView, O as WebWorker, P as defineWebWorker, S as TileView, T as ViewComponentBaseProps, _ as DockGroup, a as WorkbenchApp, b as ServiceType, c as isWorkbenchApp, d as AssetSourceView, f as DefineAssetSourceViewInput, g as DefineWindowViewInput, h as DefineWebWorkerInput, i as MediaLibraryField, j as defineAssetSourceView, k as WindowView, l as isWorkbenchConfig, m as DefineTileViewInput, n as DefineAppResult, o as WorkbenchConfig, p as DefinePanelViewInput, r as DefineMediaLibraryInput, s as defineApplication, t as DefineAppInput, u as unstable_defineMediaLibrary, v as PanelView, w as ViewComponent, x as TileSize, y as SERVICE_CONTRACT_VERSION } from "./defineApp-KCHd3Vab.js";
|
|
2
2
|
import { AssetSourceComponentProps } from "@sanity/types";
|
|
3
3
|
/**
|
|
4
4
|
* The service's own declaration, surfaced to the callback.
|
|
@@ -52,7 +52,7 @@ declare function unstable_defineService<TType extends ServiceType>(type: TType,
|
|
|
52
52
|
type WindowViewProps = ViewComponentBaseProps<{
|
|
53
53
|
name: string;
|
|
54
54
|
src: string;
|
|
55
|
-
surface: '
|
|
55
|
+
surface: 'window';
|
|
56
56
|
title: string;
|
|
57
57
|
}>;
|
|
58
58
|
/**
|
|
@@ -130,10 +130,10 @@ type TileComponent = keyof TileViewComponents;
|
|
|
130
130
|
* @public
|
|
131
131
|
*/
|
|
132
132
|
interface ViewComponentsBySurface {
|
|
133
|
-
app: ViewComponent<WindowViewProps>;
|
|
134
133
|
asset_source: AssetSourceViewComponents;
|
|
135
134
|
panel: PanelViewComponents;
|
|
136
135
|
tile: TileViewComponents;
|
|
136
|
+
window: ViewComponent<WindowViewProps>;
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* The result of `unstable_defineView`: the author's component(s), the view surface,
|
package/dist/_exports/init.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/** App scaffold — `entry` auto-declares the navigable app view. */
|
|
2
|
-
declare const workbenchAppConfigTemplate = "\nimport {
|
|
2
|
+
declare const workbenchAppConfigTemplate = "\nimport {defineApplication, defineCliConfig} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: defineApplication({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
|
|
3
3
|
/**
|
|
4
4
|
* Studio scaffold — brands with slug/title only, no `entry` (studio app views
|
|
5
5
|
* aren't implemented yet).
|
|
6
6
|
*/
|
|
7
|
-
declare const workbenchStudioConfigTemplate = "\nimport {
|
|
7
|
+
declare const workbenchStudioConfigTemplate = "\nimport {defineApplication, defineCliConfig} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: defineApplication({\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n }),\n deployment: {\n /**\n * Enable auto-updates for studios.\n * Learn more at https://www.sanity.io/docs/studio/latest-version-of-sanity#k47faf43faf56\n */\n autoUpdates: __BOOL__autoUpdates__,\n },\n})\n";
|
|
8
8
|
declare function toAppSlug(value: string): string | null;
|
|
9
9
|
export { toAppSlug, workbenchAppConfigTemplate, workbenchStudioConfigTemplate };
|
|
10
10
|
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DevServerManifest } from "./registry-
|
|
1
|
+
import { t as DevServerManifest } from "./registry-BCLMbrla.js";
|
|
2
2
|
import { CliConfig, Output } from "@sanity/cli-core";
|
|
3
3
|
interface StartWorkbenchPreviewOptions {
|
|
4
4
|
/** Directory for the workbench Vite server's dependency cache. */
|
|
@@ -18,14 +18,14 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
18
18
|
metadata: z.ZodMiniNullable<z.ZodMiniObject<{
|
|
19
19
|
dock: z.ZodMiniObject<{
|
|
20
20
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
system: "system";
|
|
22
|
+
applications: "applications";
|
|
23
|
+
user: "user";
|
|
24
24
|
}>>;
|
|
25
25
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
26
26
|
}, z.core.$strip>;
|
|
27
27
|
}, z.core.$strip>>;
|
|
28
|
-
surface: z.ZodMiniLiteral<"
|
|
28
|
+
surface: z.ZodMiniLiteral<"window">;
|
|
29
29
|
id: z.ZodMiniString<string>;
|
|
30
30
|
moduleId: z.ZodMiniString<string>;
|
|
31
31
|
name: z.ZodMiniString<string>;
|
|
@@ -36,9 +36,9 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
36
36
|
metadata: z.ZodMiniNullable<z.ZodMiniObject<{
|
|
37
37
|
dock: z.ZodMiniObject<{
|
|
38
38
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
system: "system";
|
|
40
|
+
applications: "applications";
|
|
41
|
+
user: "user";
|
|
42
42
|
}>>;
|
|
43
43
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
44
44
|
}, z.core.$strip>;
|
|
@@ -88,9 +88,9 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
88
88
|
manifest: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniObject<{
|
|
89
89
|
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
90
90
|
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
system: "system";
|
|
92
|
+
applications: "applications";
|
|
93
|
+
user: "user";
|
|
94
94
|
}>>;
|
|
95
95
|
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
96
96
|
}, z.core.$strip>>;
|
|
@@ -122,4 +122,4 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
122
122
|
*/
|
|
123
123
|
type DevServerManifest = z.infer<typeof devServerManifestSchema>;
|
|
124
124
|
export { DevServerManifest as t };
|
|
125
|
-
//# sourceMappingURL=registry-
|
|
125
|
+
//# sourceMappingURL=registry-BCLMbrla.d.ts.map
|
package/dist/_exports/{resolveWorkbenchConfig-0Crh5P9n.d.ts → resolveWorkbenchConfig-1CV651GT.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as WorkbenchConfigValue, t as DefineAppInput } from "./defineApp-
|
|
1
|
+
import { A as WorkbenchConfigValue, t as DefineAppInput } from "./defineApp-KCHd3Vab.js";
|
|
2
2
|
import { AppVisibility, CliConfig } from "@sanity/cli-core";
|
|
3
3
|
/**
|
|
4
4
|
* Bundled so adding a declaration family touches this type and the artifact
|
|
@@ -59,4 +59,4 @@ interface ResolvedMediaLibraryConfig {
|
|
|
59
59
|
*/
|
|
60
60
|
declare function resolveWorkbenchConfig(cliConfig: CliConfig | null | undefined): ResolvedMediaLibraryConfig | null;
|
|
61
61
|
export { resolveWorkbenchApp as a, WorkbenchExposes as i, resolveWorkbenchConfig as n, ResolvedWorkbenchApp as r, ResolvedMediaLibraryConfig as t };
|
|
62
|
-
//# sourceMappingURL=resolveWorkbenchConfig-
|
|
62
|
+
//# sourceMappingURL=resolveWorkbenchConfig-1CV651GT.d.ts.map
|
package/dist/_exports/{summarizeInterfaces-CaYUOK3F.d.ts → summarizeInterfaces-DoG6OunM.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { D as ViewSurface, b as ServiceType } from "./defineApp-
|
|
2
|
-
import { i as WorkbenchExposes, r as ResolvedWorkbenchApp } from "./resolveWorkbenchConfig-
|
|
1
|
+
import { D as ViewSurface, b as ServiceType } from "./defineApp-KCHd3Vab.js";
|
|
2
|
+
import { i as WorkbenchExposes, r as ResolvedWorkbenchApp } from "./resolveWorkbenchConfig-1CV651GT.js";
|
|
3
3
|
import { CliConfig } from "@sanity/cli-core";
|
|
4
4
|
import { z } from "zod/mini";
|
|
5
5
|
/**
|
|
@@ -15,7 +15,7 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<{
|
|
|
15
15
|
name: z.ZodMiniString<string>;
|
|
16
16
|
src: z.ZodMiniString<string>;
|
|
17
17
|
type: z.ZodMiniEnum<{
|
|
18
|
-
|
|
18
|
+
window: "window";
|
|
19
19
|
panel: "panel";
|
|
20
20
|
asset_source: "asset_source";
|
|
21
21
|
tile: "tile";
|
|
@@ -62,4 +62,4 @@ declare function summarizeInterfaces({ views, webWorkers }: WorkbenchExposes): {
|
|
|
62
62
|
views: DeployedView[];
|
|
63
63
|
};
|
|
64
64
|
export { DeployableWorkbenchApp as a, summarizeInterfaces as i, DeployedView as n, getWorkbench as o, DeployedWebWorker as r, DeployedInterface as t };
|
|
65
|
-
//# sourceMappingURL=summarizeInterfaces-
|
|
65
|
+
//# sourceMappingURL=summarizeInterfaces-DoG6OunM.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-
|
|
2
|
-
import { a as DeployableWorkbenchApp, n as DeployedView, r as DeployedWebWorker } from "./summarizeInterfaces-
|
|
1
|
+
import { t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-1CV651GT.js";
|
|
2
|
+
import { a as DeployableWorkbenchApp, n as DeployedView, r as DeployedWebWorker } from "./summarizeInterfaces-DoG6OunM.js";
|
|
3
3
|
import "node:zlib";
|
|
4
4
|
import { UndeployAdapter, UndeployApplicationTarget, UndeployConfigTarget } from "@sanity/cli-core/undeploy";
|
|
5
5
|
interface ConfigSnapshot {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resource bindings ride in a dedicated module in the app's bundle rather than an
|
|
3
|
+
* index.html script tag, so both standalone studios and federated apps resolve
|
|
4
|
+
* them the same way (a federated host pulls modules, not HTML).
|
|
5
|
+
*
|
|
6
|
+
* The module is emitted at a stable, unhashed path (`sanity-resource-bindings.js`)
|
|
7
|
+
* at the bundle root and is statically imported first, so it is evaluated before
|
|
8
|
+
* any app code. At deploy time Brett replaces the `__SANITY_RESOURCE_BINDINGS__`
|
|
9
|
+
* token with the resolved bindings JSON. The token is invalid JSON on purpose: a
|
|
10
|
+
* minifier can't constant-fold `JSON.parse` of it, so the call — and the token —
|
|
11
|
+
* survive minification for Brett to rewrite.
|
|
12
|
+
*
|
|
13
|
+
* These constants are the single source of truth shared by the standalone studio
|
|
14
|
+
* build (`@sanity/cli-build`) and the federated app build here. They must stay in
|
|
15
|
+
* lockstep with Brett's replacement (see SDK-2413).
|
|
16
|
+
*/ /** Rolldown chunk name used to force the bindings module into its own chunk. */ export const RESOURCE_BINDINGS_CHUNK_NAME = 'sanity-resource-bindings';
|
|
17
|
+
/** Stable, unhashed file name Brett looks for at the bundle root. */ export const RESOURCE_BINDINGS_FILENAME = `${RESOURCE_BINDINGS_CHUNK_NAME}.js`;
|
|
18
|
+
/** Token Brett replaces with the resolved bindings JSON at deploy. */ export const RESOURCE_BINDINGS_TOKEN = '__SANITY_RESOURCE_BINDINGS__';
|
|
19
|
+
/**
|
|
20
|
+
* Contents of the generated bindings module. The `JSON.parse` result is assigned
|
|
21
|
+
* to a global so the module has an observable side effect and isn't tree-shaken
|
|
22
|
+
* when nothing imports its export yet (the reader lands in SDK-2295). The
|
|
23
|
+
* try/catch keeps a local, un-deployed build (e.g. `sanity preview`) working: an
|
|
24
|
+
* unreplaced token throws, and we fall back to an empty array.
|
|
25
|
+
*/ export const RESOURCE_BINDINGS_MODULE_SOURCE = `// This file is auto-generated on 'sanity build' / 'sanity dev'
|
|
26
|
+
// Modifications to this file are automatically discarded
|
|
27
|
+
let resourceBindings = []
|
|
28
|
+
try {
|
|
29
|
+
resourceBindings = JSON.parse('${RESOURCE_BINDINGS_TOKEN}')
|
|
30
|
+
} catch {
|
|
31
|
+
// Built but not deployed through Brett (e.g. local preview): keep the default.
|
|
32
|
+
}
|
|
33
|
+
globalThis.${RESOURCE_BINDINGS_TOKEN} = resourceBindings
|
|
34
|
+
export {resourceBindings}
|
|
35
|
+
`;
|
|
36
|
+
/** Side-effect import placed first in each entry so the module evaluates before app code. */ export const RESOURCE_BINDINGS_ENTRY_IMPORT = `import './${RESOURCE_BINDINGS_FILENAME}'`;
|
|
37
|
+
/**
|
|
38
|
+
* Rolldown `codeSplitting` group that isolates the bindings module into its own
|
|
39
|
+
* chunk. `minSize`/`minModuleSize` of 0 are scoped to this group (not the
|
|
40
|
+
* enclosing `codeSplitting` object) so they only affect the bindings module and
|
|
41
|
+
* never the automatic chunking of everything else. They stop Rolldown folding
|
|
42
|
+
* the tiny module back into its importer.
|
|
43
|
+
*/ export const resourceBindingsCodeSplittingGroup = {
|
|
44
|
+
minModuleSize: 0,
|
|
45
|
+
minSize: 0,
|
|
46
|
+
name: RESOURCE_BINDINGS_CHUNK_NAME,
|
|
47
|
+
test: new RegExp(RESOURCE_BINDINGS_CHUNK_NAME)
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* `chunkFileNames` value for the bindings chunk (unhashed, at the bundle root),
|
|
51
|
+
* or `undefined` for any other chunk so the caller can apply its own default.
|
|
52
|
+
*/ export function resourceBindingsChunkFileName(chunkName) {
|
|
53
|
+
return chunkName === RESOURCE_BINDINGS_CHUNK_NAME ? RESOURCE_BINDINGS_FILENAME : undefined;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=resource-bindings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/build/resource-bindings.ts"],"sourcesContent":["/**\n * Resource bindings ride in a dedicated module in the app's bundle rather than an\n * index.html script tag, so both standalone studios and federated apps resolve\n * them the same way (a federated host pulls modules, not HTML).\n *\n * The module is emitted at a stable, unhashed path (`sanity-resource-bindings.js`)\n * at the bundle root and is statically imported first, so it is evaluated before\n * any app code. At deploy time Brett replaces the `__SANITY_RESOURCE_BINDINGS__`\n * token with the resolved bindings JSON. The token is invalid JSON on purpose: a\n * minifier can't constant-fold `JSON.parse` of it, so the call — and the token —\n * survive minification for Brett to rewrite.\n *\n * These constants are the single source of truth shared by the standalone studio\n * build (`@sanity/cli-build`) and the federated app build here. They must stay in\n * lockstep with Brett's replacement (see SDK-2413).\n */\n\n/** Rolldown chunk name used to force the bindings module into its own chunk. */\nexport const RESOURCE_BINDINGS_CHUNK_NAME = 'sanity-resource-bindings'\n\n/** Stable, unhashed file name Brett looks for at the bundle root. */\nexport const RESOURCE_BINDINGS_FILENAME = `${RESOURCE_BINDINGS_CHUNK_NAME}.js`\n\n/** Token Brett replaces with the resolved bindings JSON at deploy. */\nexport const RESOURCE_BINDINGS_TOKEN = '__SANITY_RESOURCE_BINDINGS__'\n\n/**\n * Contents of the generated bindings module. The `JSON.parse` result is assigned\n * to a global so the module has an observable side effect and isn't tree-shaken\n * when nothing imports its export yet (the reader lands in SDK-2295). The\n * try/catch keeps a local, un-deployed build (e.g. `sanity preview`) working: an\n * unreplaced token throws, and we fall back to an empty array.\n */\nexport const RESOURCE_BINDINGS_MODULE_SOURCE = `// This file is auto-generated on 'sanity build' / 'sanity dev'\n// Modifications to this file are automatically discarded\nlet resourceBindings = []\ntry {\n resourceBindings = JSON.parse('${RESOURCE_BINDINGS_TOKEN}')\n} catch {\n // Built but not deployed through Brett (e.g. local preview): keep the default.\n}\nglobalThis.${RESOURCE_BINDINGS_TOKEN} = resourceBindings\nexport {resourceBindings}\n`\n\n/** Side-effect import placed first in each entry so the module evaluates before app code. */\nexport const RESOURCE_BINDINGS_ENTRY_IMPORT = `import './${RESOURCE_BINDINGS_FILENAME}'`\n\n/**\n * Rolldown `codeSplitting` group that isolates the bindings module into its own\n * chunk. `minSize`/`minModuleSize` of 0 are scoped to this group (not the\n * enclosing `codeSplitting` object) so they only affect the bindings module and\n * never the automatic chunking of everything else. They stop Rolldown folding\n * the tiny module back into its importer.\n */\nexport const resourceBindingsCodeSplittingGroup = {\n minModuleSize: 0,\n minSize: 0,\n name: RESOURCE_BINDINGS_CHUNK_NAME,\n test: new RegExp(RESOURCE_BINDINGS_CHUNK_NAME),\n}\n\n/**\n * `chunkFileNames` value for the bindings chunk (unhashed, at the bundle root),\n * or `undefined` for any other chunk so the caller can apply its own default.\n */\nexport function resourceBindingsChunkFileName(chunkName: string): string | undefined {\n return chunkName === RESOURCE_BINDINGS_CHUNK_NAME ? RESOURCE_BINDINGS_FILENAME : undefined\n}\n"],"names":["RESOURCE_BINDINGS_CHUNK_NAME","RESOURCE_BINDINGS_FILENAME","RESOURCE_BINDINGS_TOKEN","RESOURCE_BINDINGS_MODULE_SOURCE","RESOURCE_BINDINGS_ENTRY_IMPORT","resourceBindingsCodeSplittingGroup","minModuleSize","minSize","name","test","RegExp","resourceBindingsChunkFileName","chunkName","undefined"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,8EAA8E,GAC9E,OAAO,MAAMA,+BAA+B,2BAA0B;AAEtE,mEAAmE,GACnE,OAAO,MAAMC,6BAA6B,GAAGD,6BAA6B,GAAG,CAAC,CAAA;AAE9E,oEAAoE,GACpE,OAAO,MAAME,0BAA0B,+BAA8B;AAErE;;;;;;CAMC,GACD,OAAO,MAAMC,kCAAkC,CAAC;;;;iCAIf,EAAED,wBAAwB;;;;WAIhD,EAAEA,wBAAwB;;AAErC,CAAC,CAAA;AAED,2FAA2F,GAC3F,OAAO,MAAME,iCAAiC,CAAC,UAAU,EAAEH,2BAA2B,CAAC,CAAC,CAAA;AAExF;;;;;;CAMC,GACD,OAAO,MAAMI,qCAAqC;IAChDC,eAAe;IACfC,SAAS;IACTC,MAAMR;IACNS,MAAM,IAAIC,OAAOV;AACnB,EAAC;AAED;;;CAGC,GACD,OAAO,SAASW,8BAA8BC,SAAiB;IAC7D,OAAOA,cAAcZ,+BAA+BC,6BAA6BY;AACnF"}
|
|
@@ -8,7 +8,7 @@ import { sanityFederationRuntime } from './plugins/plugin-sanity-federation-runt
|
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/ export const federation = (options)=>{
|
|
11
|
-
const { exposes, name: defaultName, pkgJson, workDir = process.cwd() } = options;
|
|
11
|
+
const { exposes, isBlueprints, name: defaultName, pkgJson, workDir = process.cwd() } = options;
|
|
12
12
|
let name = defaultName;
|
|
13
13
|
if (!name) {
|
|
14
14
|
name = pkgJson?.name;
|
|
@@ -43,19 +43,22 @@ import { sanityFederationRuntime } from './plugins/plugin-sanity-federation-runt
|
|
|
43
43
|
};
|
|
44
44
|
const runtimeOptions = options.isApp ? {
|
|
45
45
|
appEntry: options.appEntry,
|
|
46
|
-
isApp: true
|
|
46
|
+
isApp: true,
|
|
47
|
+
isBlueprints
|
|
47
48
|
} : {
|
|
48
49
|
isApp: false,
|
|
50
|
+
isBlueprints,
|
|
49
51
|
studioConfigPath: options.studioConfigPath
|
|
50
52
|
};
|
|
51
|
-
//
|
|
52
|
-
//
|
|
53
|
-
//
|
|
54
|
-
const clientInput =
|
|
53
|
+
// Every federated app and studio also serves itself standalone. Whenever there's
|
|
54
|
+
// an `./App` to mount (never for a dock-only app), build the SPA client
|
|
55
|
+
// environment from the runtime bootstrap cli-build writes.
|
|
56
|
+
const clientInput = exposesApp ? path.join(workDir, '.sanity', 'runtime', 'app.js') : undefined;
|
|
55
57
|
return [
|
|
56
58
|
sanityEnvironmentPlugin({
|
|
57
59
|
clientInput,
|
|
58
|
-
input: entryPath
|
|
60
|
+
input: entryPath,
|
|
61
|
+
isBlueprints
|
|
59
62
|
}),
|
|
60
63
|
sanityFederationRuntime(runtimeOptions),
|
|
61
64
|
sanityExtensionArtifacts({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/vite/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type ModuleFederationOptions} from '@module-federation/vite'\nimport {type PackageJson} from '@sanity/cli-core'\nimport {type PluginOption} from 'vite'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\nimport {artifactExposes, workbenchArtifacts} from '../artifact.js'\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from './constants.js'\nimport {type FederationOptions, sanityModuleFederation} from './plugins/plugin-module-federation.js'\nimport {sanityEnvironmentPlugin} from './plugins/plugin-sanity-environment.js'\nimport {sanityExtensionArtifacts} from './plugins/plugin-sanity-extension-artifacts.js'\nimport {\n type FederationRuntimeOptions,\n sanityFederationRuntime,\n} from './plugins/plugin-sanity-federation-runtime.js'\n\ninterface FederationPluginOptionsBase extends Omit<Partial<FederationOptions>, 'exposes'> {\n exposes?: WorkbenchExposes\n pkgJson?: PackageJson\n /**\n * Current working directory to read package.json from, defaults to process.cwd()\n */\n workDir?: string\n}\n\ninterface AppFederationPluginOptions extends FederationPluginOptionsBase {\n isApp: true\n\n /**\n * Relative path to the App entry from the runtime directory, e.g.\n * `../../src/App.tsx`. Omit it for a dock-only app that declares no `entry`:\n * no `./App` is exposed and the remote serves only its views.\n */\n appEntry?: string\n studioConfigPath?: never\n}\n\ninterface StudioFederationPluginOptions extends FederationPluginOptionsBase {\n /** relative path to the Studio config file from the runtime directory (e.g. `../../sanity.config.ts`). */\n studioConfigPath: string\n\n appEntry?: never\n /** @defaultValue false */\n isApp?: false\n}\n\n/**\n * Plugin options for the federation vite plugin.\n *\n * Discriminated on `isApp`:\n * - `isApp: true` → requires `appEntry`\n * - `isApp: false` (default) → requires `studioConfigPath`\n *\n * @internal\n */\ntype FederationPluginOptions = AppFederationPluginOptions | StudioFederationPluginOptions\n\n/**\n * @internal\n */\nexport const federation = (options: FederationPluginOptions): PluginOption => {\n const {exposes, name: defaultName, pkgJson, workDir = process.cwd()} = options\n\n let name = defaultName\n\n if (!name) {\n name = pkgJson?.name\n }\n\n if (!name) {\n throw new Error('\"name\" option is required but could not be inferred from package.json')\n }\n\n const generatedEntry = `./${RUNTIME_DIR}/${FEDERATION_FILE_NAME}.jsx`\n\n function resolveEntryPath(entry: string) {\n const resolvedPath = path.resolve(workDir, entry)\n\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve path for entry \"${entry}\". Please check that the file exists and the path is correct.`,\n )\n }\n\n return resolvedPath\n }\n\n const entryPath = resolveEntryPath(generatedEntry)\n\n // Each view component (`./views/<view>/<component>`) and each service loader\n // (`./services/<name>`) is exposed straight to the host, pointing at the file\n // the extension-artifacts plugin generates under RUNTIME_DIR. A service's\n // worker bundle carries no expose — the host reaches it through its loader.\n const artifacts = workbenchArtifacts(exposes ?? {})\n const artifactModuleExposes = artifactExposes(artifacts, (artifactPath) =>\n resolveEntryPath(`./${RUNTIME_DIR}/${artifactPath}`),\n )\n\n // A dock-only app (`isApp` with no `appEntry`) has no navigable full-page\n // view, so it exposes no `./App` — only its views. Studios and apps with an\n // entry expose `./App` (the generated render entry).\n const exposesApp = !options.isApp || options.appEntry !== undefined\n\n const federationExposes: NonNullable<ModuleFederationOptions['exposes']> = {\n ...(exposesApp ? {'./App': entryPath} : {}),\n ...artifactModuleExposes,\n }\n\n const runtimeOptions: FederationRuntimeOptions = options.isApp\n ? {appEntry: options.appEntry, isApp: true}\n : {isApp: false, studioConfigPath: options.studioConfigPath}\n\n //
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/vite/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {type ModuleFederationOptions} from '@module-federation/vite'\nimport {type PackageJson} from '@sanity/cli-core'\nimport {type PluginOption} from 'vite'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\nimport {artifactExposes, workbenchArtifacts} from '../artifact.js'\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from './constants.js'\nimport {type FederationOptions, sanityModuleFederation} from './plugins/plugin-module-federation.js'\nimport {sanityEnvironmentPlugin} from './plugins/plugin-sanity-environment.js'\nimport {sanityExtensionArtifacts} from './plugins/plugin-sanity-extension-artifacts.js'\nimport {\n type FederationRuntimeOptions,\n sanityFederationRuntime,\n} from './plugins/plugin-sanity-federation-runtime.js'\n\ninterface FederationPluginOptionsBase extends Omit<Partial<FederationOptions>, 'exposes'> {\n exposes?: WorkbenchExposes\n /** Blueprints build (via `@sanity/runtime-cli`) — emit the resource-bindings module. */\n isBlueprints?: boolean\n pkgJson?: PackageJson\n /**\n * Current working directory to read package.json from, defaults to process.cwd()\n */\n workDir?: string\n}\n\ninterface AppFederationPluginOptions extends FederationPluginOptionsBase {\n isApp: true\n\n /**\n * Relative path to the App entry from the runtime directory, e.g.\n * `../../src/App.tsx`. Omit it for a dock-only app that declares no `entry`:\n * no `./App` is exposed and the remote serves only its views.\n */\n appEntry?: string\n studioConfigPath?: never\n}\n\ninterface StudioFederationPluginOptions extends FederationPluginOptionsBase {\n /** relative path to the Studio config file from the runtime directory (e.g. `../../sanity.config.ts`). */\n studioConfigPath: string\n\n appEntry?: never\n /** @defaultValue false */\n isApp?: false\n}\n\n/**\n * Plugin options for the federation vite plugin.\n *\n * Discriminated on `isApp`:\n * - `isApp: true` → requires `appEntry`\n * - `isApp: false` (default) → requires `studioConfigPath`\n *\n * @internal\n */\ntype FederationPluginOptions = AppFederationPluginOptions | StudioFederationPluginOptions\n\n/**\n * @internal\n */\nexport const federation = (options: FederationPluginOptions): PluginOption => {\n const {exposes, isBlueprints, name: defaultName, pkgJson, workDir = process.cwd()} = options\n\n let name = defaultName\n\n if (!name) {\n name = pkgJson?.name\n }\n\n if (!name) {\n throw new Error('\"name\" option is required but could not be inferred from package.json')\n }\n\n const generatedEntry = `./${RUNTIME_DIR}/${FEDERATION_FILE_NAME}.jsx`\n\n function resolveEntryPath(entry: string) {\n const resolvedPath = path.resolve(workDir, entry)\n\n if (!resolvedPath) {\n throw new Error(\n `Could not resolve path for entry \"${entry}\". Please check that the file exists and the path is correct.`,\n )\n }\n\n return resolvedPath\n }\n\n const entryPath = resolveEntryPath(generatedEntry)\n\n // Each view component (`./views/<view>/<component>`) and each service loader\n // (`./services/<name>`) is exposed straight to the host, pointing at the file\n // the extension-artifacts plugin generates under RUNTIME_DIR. A service's\n // worker bundle carries no expose — the host reaches it through its loader.\n const artifacts = workbenchArtifacts(exposes ?? {})\n const artifactModuleExposes = artifactExposes(artifacts, (artifactPath) =>\n resolveEntryPath(`./${RUNTIME_DIR}/${artifactPath}`),\n )\n\n // A dock-only app (`isApp` with no `appEntry`) has no navigable full-page\n // view, so it exposes no `./App` — only its views. Studios and apps with an\n // entry expose `./App` (the generated render entry).\n const exposesApp = !options.isApp || options.appEntry !== undefined\n\n const federationExposes: NonNullable<ModuleFederationOptions['exposes']> = {\n ...(exposesApp ? {'./App': entryPath} : {}),\n ...artifactModuleExposes,\n }\n\n const runtimeOptions: FederationRuntimeOptions = options.isApp\n ? {appEntry: options.appEntry, isApp: true, isBlueprints}\n : {isApp: false, isBlueprints, studioConfigPath: options.studioConfigPath}\n\n // Every federated app and studio also serves itself standalone. Whenever there's\n // an `./App` to mount (never for a dock-only app), build the SPA client\n // environment from the runtime bootstrap cli-build writes.\n const clientInput = exposesApp ? path.join(workDir, '.sanity', 'runtime', 'app.js') : undefined\n\n return [\n sanityEnvironmentPlugin({clientInput, input: entryPath, isBlueprints}),\n sanityFederationRuntime(runtimeOptions),\n sanityExtensionArtifacts({artifacts}),\n sanityModuleFederation({exposes: federationExposes, name}),\n ]\n}\n"],"names":["path","artifactExposes","workbenchArtifacts","FEDERATION_FILE_NAME","RUNTIME_DIR","sanityModuleFederation","sanityEnvironmentPlugin","sanityExtensionArtifacts","sanityFederationRuntime","federation","options","exposes","isBlueprints","name","defaultName","pkgJson","workDir","process","cwd","Error","generatedEntry","resolveEntryPath","entry","resolvedPath","resolve","entryPath","artifacts","artifactModuleExposes","artifactPath","exposesApp","isApp","appEntry","undefined","federationExposes","runtimeOptions","studioConfigPath","clientInput","join","input"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAO5B,SAAQC,eAAe,EAAEC,kBAAkB,QAAO,iBAAgB;AAClE,SAAQC,oBAAoB,EAAEC,WAAW,QAAO,iBAAgB;AAChE,SAAgCC,sBAAsB,QAAO,wCAAuC;AACpG,SAAQC,uBAAuB,QAAO,yCAAwC;AAC9E,SAAQC,wBAAwB,QAAO,iDAAgD;AACvF,SAEEC,uBAAuB,QAClB,gDAA+C;AA6CtD;;CAEC,GACD,OAAO,MAAMC,aAAa,CAACC;IACzB,MAAM,EAACC,OAAO,EAAEC,YAAY,EAAEC,MAAMC,WAAW,EAAEC,OAAO,EAAEC,UAAUC,QAAQC,GAAG,EAAE,EAAC,GAAGR;IAErF,IAAIG,OAAOC;IAEX,IAAI,CAACD,MAAM;QACTA,OAAOE,SAASF;IAClB;IAEA,IAAI,CAACA,MAAM;QACT,MAAM,IAAIM,MAAM;IAClB;IAEA,MAAMC,iBAAiB,CAAC,EAAE,EAAEhB,YAAY,CAAC,EAAED,qBAAqB,IAAI,CAAC;IAErE,SAASkB,iBAAiBC,KAAa;QACrC,MAAMC,eAAevB,KAAKwB,OAAO,CAACR,SAASM;QAE3C,IAAI,CAACC,cAAc;YACjB,MAAM,IAAIJ,MACR,CAAC,kCAAkC,EAAEG,MAAM,6DAA6D,CAAC;QAE7G;QAEA,OAAOC;IACT;IAEA,MAAME,YAAYJ,iBAAiBD;IAEnC,6EAA6E;IAC7E,8EAA8E;IAC9E,0EAA0E;IAC1E,4EAA4E;IAC5E,MAAMM,YAAYxB,mBAAmBS,WAAW,CAAC;IACjD,MAAMgB,wBAAwB1B,gBAAgByB,WAAW,CAACE,eACxDP,iBAAiB,CAAC,EAAE,EAAEjB,YAAY,CAAC,EAAEwB,cAAc;IAGrD,0EAA0E;IAC1E,4EAA4E;IAC5E,qDAAqD;IACrD,MAAMC,aAAa,CAACnB,QAAQoB,KAAK,IAAIpB,QAAQqB,QAAQ,KAAKC;IAE1D,MAAMC,oBAAqE;QACzE,GAAIJ,aAAa;YAAC,SAASJ;QAAS,IAAI,CAAC,CAAC;QAC1C,GAAGE,qBAAqB;IAC1B;IAEA,MAAMO,iBAA2CxB,QAAQoB,KAAK,GAC1D;QAACC,UAAUrB,QAAQqB,QAAQ;QAAED,OAAO;QAAMlB;IAAY,IACtD;QAACkB,OAAO;QAAOlB;QAAcuB,kBAAkBzB,QAAQyB,gBAAgB;IAAA;IAE3E,iFAAiF;IACjF,wEAAwE;IACxE,2DAA2D;IAC3D,MAAMC,cAAcP,aAAa7B,KAAKqC,IAAI,CAACrB,SAAS,WAAW,WAAW,YAAYgB;IAEtF,OAAO;QACL1B,wBAAwB;YAAC8B;YAAaE,OAAOb;YAAWb;QAAY;QACpEJ,wBAAwB0B;QACxB3B,yBAAyB;YAACmB;QAAS;QACnCrB,uBAAuB;YAACM,SAASsB;YAAmBpB;QAAI;KACzD;AACH,EAAC"}
|
|
@@ -1,6 +1,23 @@
|
|
|
1
|
+
import { resourceBindingsChunkFileName, resourceBindingsCodeSplittingGroup } from '../../resource-bindings.js';
|
|
1
2
|
import { FEDERATION_DIR_NAME } from '../constants.js';
|
|
3
|
+
// Keep the resource-bindings module in its own unhashed chunk at the bundle root
|
|
4
|
+
// so Brett can rewrite it at deploy. `@module-federation/vite` preserves user
|
|
5
|
+
// `codeSplitting` groups (clamped below its own), so this survives the federation
|
|
6
|
+
// build. The chunk sizing lives on the group itself (see
|
|
7
|
+
// `resourceBindingsCodeSplittingGroup`), so it only affects the bindings module.
|
|
8
|
+
const resourceBindingsOutput = {
|
|
9
|
+
chunkFileNames: (chunk)=>resourceBindingsChunkFileName(chunk.name) ?? 'static/[name]-[hash].js',
|
|
10
|
+
codeSplitting: {
|
|
11
|
+
groups: [
|
|
12
|
+
resourceBindingsCodeSplittingGroup
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
};
|
|
2
16
|
export function sanityEnvironmentPlugin(options) {
|
|
3
|
-
const { clientInput, input } = options;
|
|
17
|
+
const { clientInput, input, isBlueprints } = options;
|
|
18
|
+
// Blueprints only: force the resource-bindings module into its own unhashed
|
|
19
|
+
// chunk so Brett can rewrite it at deploy. Off Blueprints, no such chunk.
|
|
20
|
+
const output = isBlueprints ? resourceBindingsOutput : undefined;
|
|
4
21
|
return {
|
|
5
22
|
config () {
|
|
6
23
|
return {
|
|
@@ -26,7 +43,8 @@ export function sanityEnvironmentPlugin(options) {
|
|
|
26
43
|
rolldownOptions: {
|
|
27
44
|
input: {
|
|
28
45
|
sanity: clientInput
|
|
29
|
-
}
|
|
46
|
+
},
|
|
47
|
+
output
|
|
30
48
|
}
|
|
31
49
|
},
|
|
32
50
|
consumer: 'client'
|
|
@@ -39,7 +57,8 @@ export function sanityEnvironmentPlugin(options) {
|
|
|
39
57
|
emptyOutDir: false,
|
|
40
58
|
outDir: `dist`,
|
|
41
59
|
rolldownOptions: {
|
|
42
|
-
input
|
|
60
|
+
input,
|
|
61
|
+
output
|
|
43
62
|
}
|
|
44
63
|
},
|
|
45
64
|
consumer: 'client'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-environment.ts"],"sourcesContent":["import {type Plugin} from 'vite'\n\nimport {FEDERATION_DIR_NAME} from '../constants.js'\n\ninterface EnvironmentOptions {\n input: string\n\n /**\n * When set, also build a standalone `client` SPA environment (its own\n * `index.html` + bootstrap) alongside the federation remote, from this entry.\n *
|
|
1
|
+
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-environment.ts"],"sourcesContent":["import {type Plugin} from 'vite'\n\nimport {\n resourceBindingsChunkFileName,\n resourceBindingsCodeSplittingGroup,\n} from '../../resource-bindings.js'\nimport {FEDERATION_DIR_NAME} from '../constants.js'\n\n// Keep the resource-bindings module in its own unhashed chunk at the bundle root\n// so Brett can rewrite it at deploy. `@module-federation/vite` preserves user\n// `codeSplitting` groups (clamped below its own), so this survives the federation\n// build. The chunk sizing lives on the group itself (see\n// `resourceBindingsCodeSplittingGroup`), so it only affects the bindings module.\nconst resourceBindingsOutput = {\n chunkFileNames: (chunk: {name: string}) =>\n resourceBindingsChunkFileName(chunk.name) ?? 'static/[name]-[hash].js',\n codeSplitting: {\n groups: [resourceBindingsCodeSplittingGroup],\n },\n}\n\ninterface EnvironmentOptions {\n input: string\n\n /**\n * When set, also build a standalone `client` SPA environment (its own\n * `index.html` + bootstrap) alongside the federation remote, from this entry.\n * Set for every federated app and studio; omitted only for a dock-only app.\n */\n clientInput?: string\n\n /** Blueprints build (via `@sanity/runtime-cli`) — emit the resource-bindings module. */\n isBlueprints?: boolean\n}\n\nexport function sanityEnvironmentPlugin(options: EnvironmentOptions): Plugin {\n const {clientInput, input, isBlueprints} = options\n\n // Blueprints only: force the resource-bindings module into its own unhashed\n // chunk so Brett can rewrite it at deploy. Off Blueprints, no such chunk.\n const output = isBlueprints ? resourceBindingsOutput : undefined\n\n return {\n config() {\n return {\n builder: {\n async buildApp(builder) {\n // `emptyOutDir` is false on both environments and the CLI clears\n // `dist` once up-front, so the SPA and federation outputs coexist\n // without either build wiping the other's files.\n if (clientInput) {\n await builder.build(builder.environments.client)\n }\n await builder.build(builder.environments[FEDERATION_DIR_NAME])\n },\n },\n environments: {\n ...(clientInput\n ? {\n client: {\n build: {\n assetsDir: 'static',\n copyPublicDir: false,\n emptyOutDir: false,\n outDir: `dist`,\n rolldownOptions: {\n input: {sanity: clientInput},\n output,\n },\n },\n consumer: 'client',\n },\n }\n : {}),\n [FEDERATION_DIR_NAME]: {\n build: {\n assetsDir: 'static',\n copyPublicDir: false,\n emptyOutDir: false,\n outDir: `dist`,\n rolldownOptions: {input, output},\n },\n consumer: 'client',\n },\n },\n }\n },\n name: 'sanity/environment',\n }\n}\n"],"names":["resourceBindingsChunkFileName","resourceBindingsCodeSplittingGroup","FEDERATION_DIR_NAME","resourceBindingsOutput","chunkFileNames","chunk","name","codeSplitting","groups","sanityEnvironmentPlugin","options","clientInput","input","isBlueprints","output","undefined","config","builder","buildApp","build","environments","client","assetsDir","copyPublicDir","emptyOutDir","outDir","rolldownOptions","sanity","consumer"],"mappings":"AAEA,SACEA,6BAA6B,EAC7BC,kCAAkC,QAC7B,6BAA4B;AACnC,SAAQC,mBAAmB,QAAO,kBAAiB;AAEnD,iFAAiF;AACjF,8EAA8E;AAC9E,kFAAkF;AAClF,yDAAyD;AACzD,iFAAiF;AACjF,MAAMC,yBAAyB;IAC7BC,gBAAgB,CAACC,QACfL,8BAA8BK,MAAMC,IAAI,KAAK;IAC/CC,eAAe;QACbC,QAAQ;YAACP;SAAmC;IAC9C;AACF;AAgBA,OAAO,SAASQ,wBAAwBC,OAA2B;IACjE,MAAM,EAACC,WAAW,EAAEC,KAAK,EAAEC,YAAY,EAAC,GAAGH;IAE3C,4EAA4E;IAC5E,0EAA0E;IAC1E,MAAMI,SAASD,eAAeV,yBAAyBY;IAEvD,OAAO;QACLC;YACE,OAAO;gBACLC,SAAS;oBACP,MAAMC,UAASD,OAAO;wBACpB,iEAAiE;wBACjE,kEAAkE;wBAClE,iDAAiD;wBACjD,IAAIN,aAAa;4BACf,MAAMM,QAAQE,KAAK,CAACF,QAAQG,YAAY,CAACC,MAAM;wBACjD;wBACA,MAAMJ,QAAQE,KAAK,CAACF,QAAQG,YAAY,CAAClB,oBAAoB;oBAC/D;gBACF;gBACAkB,cAAc;oBACZ,GAAIT,cACA;wBACEU,QAAQ;4BACNF,OAAO;gCACLG,WAAW;gCACXC,eAAe;gCACfC,aAAa;gCACbC,QAAQ,CAAC,IAAI,CAAC;gCACdC,iBAAiB;oCACfd,OAAO;wCAACe,QAAQhB;oCAAW;oCAC3BG;gCACF;4BACF;4BACAc,UAAU;wBACZ;oBACF,IACA,CAAC,CAAC;oBACN,CAAC1B,oBAAoB,EAAE;wBACrBiB,OAAO;4BACLG,WAAW;4BACXC,eAAe;4BACfC,aAAa;4BACbC,QAAQ,CAAC,IAAI,CAAC;4BACdC,iBAAiB;gCAACd;gCAAOE;4BAAM;wBACjC;wBACAc,UAAU;oBACZ;gBACF;YACF;QACF;QACAtB,MAAM;IACR;AACF"}
|