@sanity/workbench-cli 1.3.0 → 1.5.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.
Files changed (47) hide show
  1. package/dist/_exports/build.d.ts +10 -0
  2. package/dist/_exports/deploy.d.ts +57 -8
  3. package/dist/_exports/deploy.js +2 -1
  4. package/dist/_exports/deploy.js.map +1 -1
  5. package/dist/_exports/dev.d.ts +52 -8
  6. package/dist/_exports/index.d.ts +10 -2
  7. package/dist/_exports/undeploy.d.ts +258 -0
  8. package/dist/_exports/undeploy.js +3 -0
  9. package/dist/_exports/undeploy.js.map +1 -0
  10. package/dist/actions/build/vite/plugin.js +5 -0
  11. package/dist/actions/build/vite/plugin.js.map +1 -1
  12. package/dist/actions/build/vite/plugins/plugin-sanity-app-id.js +5 -3
  13. package/dist/actions/build/vite/plugins/plugin-sanity-app-id.js.map +1 -1
  14. package/dist/actions/build/vite/plugins/plugin-sanity-environment.js +26 -2
  15. package/dist/actions/build/vite/plugins/plugin-sanity-environment.js.map +1 -1
  16. package/dist/actions/deploy/buildExposes.js +28 -12
  17. package/dist/actions/deploy/buildExposes.js.map +1 -1
  18. package/dist/actions/deploy/checkBuiltOutput.js +4 -3
  19. package/dist/actions/deploy/checkBuiltOutput.js.map +1 -1
  20. package/dist/actions/deploy/deployConfig.js +11 -38
  21. package/dist/actions/deploy/deployConfig.js.map +1 -1
  22. package/dist/actions/deploy/deployWorkbenchApp.js +5 -81
  23. package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
  24. package/dist/actions/deploy/getWorkbench.js.map +1 -1
  25. package/dist/actions/dev/deriveInterfaces.js +40 -27
  26. package/dist/actions/dev/deriveInterfaces.js.map +1 -1
  27. package/dist/actions/dev/exposesSetId.js +2 -2
  28. package/dist/actions/dev/exposesSetId.js.map +1 -1
  29. package/dist/actions/dev/registry.js +30 -17
  30. package/dist/actions/dev/registry.js.map +1 -1
  31. package/dist/actions/undeploy/workbenchUndeployAdapter.js +150 -0
  32. package/dist/actions/undeploy/workbenchUndeployAdapter.js.map +1 -0
  33. package/dist/contract.js +32 -0
  34. package/dist/contract.js.map +1 -1
  35. package/dist/defineApp.js +11 -1
  36. package/dist/defineApp.js.map +1 -1
  37. package/dist/defineView.js.map +1 -1
  38. package/dist/resolveWorkbenchApp.js +2 -1
  39. package/dist/resolveWorkbenchApp.js.map +1 -1
  40. package/dist/services/apiVersion.js.map +1 -0
  41. package/dist/services/applications.js +101 -0
  42. package/dist/services/applications.js.map +1 -0
  43. package/dist/services/installations.js +63 -0
  44. package/dist/services/installations.js.map +1 -0
  45. package/package.json +16 -12
  46. package/dist/actions/deploy/apiVersion.js.map +0 -1
  47. /package/dist/{actions/deploy → services}/apiVersion.js +0 -0
@@ -1,3 +1,4 @@
1
+ import { AppVisibility } from "@sanity/cli-core";
1
2
  import { CliConfig } from "@sanity/cli-core";
2
3
  import { PluginOption } from "vite";
3
4
  import { z } from "zod/mini";
@@ -106,6 +107,13 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
106
107
  >
107
108
  >
108
109
  >;
110
+ visibility: z.ZodMiniOptional<
111
+ z.ZodMiniEnum<{
112
+ default: "default";
113
+ unlisted: "unlisted";
114
+ disabled: "disabled";
115
+ }>
116
+ >;
109
117
  },
110
118
  z.core.$strip
111
119
  >;
@@ -137,6 +145,8 @@ declare interface ResolvedWorkbenchApp {
137
145
  readonly isSingleton?: boolean;
138
146
  /** Hostname the application is created at on first deploy. */
139
147
  readonly slug?: string;
148
+ /** Dashboard visibility declared by the app; `undefined` when unset. */
149
+ readonly visibility?: AppVisibility;
140
150
  }
141
151
 
142
152
  /**
@@ -1,7 +1,24 @@
1
+ import { AppVisibility } from "@sanity/cli-core";
1
2
  import { CliConfig } from "@sanity/cli-core";
2
3
  import { Output } from "@sanity/cli-core";
3
4
  import { z } from "zod/mini";
4
5
 
6
+ /** @internal */
7
+ declare type AppInterfaceMetadata = z.infer<typeof AppInterfaceMetadataSchema>;
8
+
9
+ /**
10
+ * The `app` interface's dock-placement metadata. Interface metadata is
11
+ * discriminated on `type`; `app` is the only type with a shape so far.
12
+ * @internal
13
+ */
14
+ declare const AppInterfaceMetadataSchema: z.ZodMiniObject<
15
+ {
16
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
17
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
18
+ },
19
+ z.core.$strip
20
+ >;
21
+
5
22
  export declare interface Application {
6
23
  id: string;
7
24
  organizationId: string;
@@ -13,16 +30,28 @@ export declare interface Application {
13
30
  declare type ApplicationType = "coreApp" | "studio";
14
31
 
15
32
  /**
16
- * An interface as Brett stores it: the declared `type` (validated server-side,
17
- * not here) and the remote-relative `moduleId` the workbench loads it by the
18
- * host prepends the app's own id.
33
+ * An interface as Brett stores it, discriminated on `type`. `moduleId` is
34
+ * remote-relative the host prepends the app's id. Brett assigns the id.
19
35
  * @internal
20
36
  */
21
- export declare interface BrettInterface {
37
+ export declare type BrettInterface =
38
+ | (BrettInterfaceBase & {
39
+ metadata: AppInterfaceMetadata | null;
40
+ type: "app";
41
+ })
42
+ | (BrettInterfaceBase & {
43
+ metadata: null;
44
+ type: "panel";
45
+ })
46
+ | (BrettInterfaceBase & {
47
+ metadata: null;
48
+ type: "worker";
49
+ });
50
+
51
+ declare interface BrettInterfaceBase {
22
52
  moduleId: string;
23
53
  name: string;
24
54
  title: string;
25
- type: string;
26
55
  version: string;
27
56
  }
28
57
 
@@ -57,9 +86,10 @@ declare interface BuildExposesContext {
57
86
 
58
87
  /**
59
88
  * Throws unless `sourceDir` is a directory holding a federation build.
60
- * Workbench builds emit a module-federation remote instead of a static SPA,
61
- * so the usual `index.html` contract doesn't apply — `mf-manifest.json` is the
62
- * marker that `sanity build` produced a federation build.
89
+ * A workbench build always emits a module-federation remote, and may
90
+ * additionally emit a standalone `index.html` SPA (workbench remotes). Either
91
+ * way `mf-manifest.json` is the reliable marker that `sanity build` produced a
92
+ * federation build, so that — not `index.html` — is what we check for.
63
93
  */
64
94
  export declare function checkBuiltOutput(sourceDir: string): Promise<void>;
65
95
 
@@ -167,6 +197,13 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
167
197
  >
168
198
  >
169
199
  >;
200
+ visibility: z.ZodMiniOptional<
201
+ z.ZodMiniEnum<{
202
+ default: "default";
203
+ unlisted: "unlisted";
204
+ disabled: "disabled";
205
+ }>
206
+ >;
170
207
  },
171
208
  z.core.$strip
172
209
  >;
@@ -210,6 +247,7 @@ declare interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
210
247
  export declare function deployConfig(options: {
211
248
  appType: string;
212
249
  installationId: string;
250
+ organizationId: string;
213
251
  output: Output;
214
252
  sourceDir: string;
215
253
  version: string;
@@ -231,6 +269,7 @@ export declare function deployCoreApp(options: {
231
269
  sourceDir: string;
232
270
  title: string;
233
271
  version: string;
272
+ visibility?: AppVisibility;
234
273
  }): Promise<{
235
274
  applicationId: string;
236
275
  }>;
@@ -269,10 +308,17 @@ export declare function getApplication(
269
308
  applicationId: string,
270
309
  ): Promise<Application | null>;
271
310
 
311
+ /** Where a deployed application is served on its organization's workbench. */
312
+ export declare function getApplicationUrl(
313
+ application: Pick<Application, "id" | "organizationId" | "type">,
314
+ ): string;
315
+
272
316
  export declare function getWorkbench(
273
317
  cliConfig: CliConfig | null | undefined,
274
318
  ): DeployableWorkbenchApp | null;
275
319
 
320
+ export declare function getWorkbenchUrl(organizationId: string): string;
321
+
276
322
  /** @public */
277
323
  declare interface ResolvedWorkbenchApp {
278
324
  /** The app's unique `name` from `unstable_defineApp`. */
@@ -291,6 +337,8 @@ declare interface ResolvedWorkbenchApp {
291
337
  readonly isSingleton?: boolean;
292
338
  /** Hostname the application is created at on first deploy. */
293
339
  readonly slug?: string;
340
+ /** Dashboard visibility declared by the app; `undefined` when unset. */
341
+ readonly visibility?: AppVisibility;
294
342
  }
295
343
 
296
344
  /**
@@ -312,6 +360,7 @@ export declare function summarizeConfig(config: {
312
360
  appType: string;
313
361
  fields: {
314
362
  name: string;
363
+ src: string;
315
364
  title: string;
316
365
  }[];
317
366
  }): string;
@@ -1,7 +1,8 @@
1
1
  export { buildExposes, summarizeExposes } from '../actions/deploy/buildExposes.js';
2
2
  export { checkBuiltOutput } from '../actions/deploy/checkBuiltOutput.js';
3
3
  export { deployConfig, resolveInstallationId, summarizeConfig } from '../actions/deploy/deployConfig.js';
4
- export { deployCoreApp, deployStudio, getApplication } from '../actions/deploy/deployWorkbenchApp.js';
4
+ export { deployCoreApp, deployStudio } from '../actions/deploy/deployWorkbenchApp.js';
5
5
  export { getWorkbench } from '../actions/deploy/getWorkbench.js';
6
+ export { getApplication, getApplicationUrl, getWorkbenchUrl } from '../services/applications.js';
6
7
 
7
8
  //# sourceMappingURL=deploy.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {\n type BrettInterface,\n buildExposes,\n type DeployedExpose,\n summarizeExposes,\n} from '../actions/deploy/buildExposes.js'\nexport {checkBuiltOutput} from '../actions/deploy/checkBuiltOutput.js'\nexport {\n deployConfig,\n resolveInstallationId,\n summarizeConfig,\n} from '../actions/deploy/deployConfig.js'\nexport {\n type Application,\n type BrettWorkspace,\n deployCoreApp,\n deployStudio,\n getApplication,\n} from '../actions/deploy/deployWorkbenchApp.js'\nexport {getWorkbench} from '../actions/deploy/getWorkbench.js'\n"],"names":["buildExposes","summarizeExposes","checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","deployCoreApp","deployStudio","getApplication","getWorkbench"],"mappings":"AAAA,SAEEA,YAAY,EAEZC,gBAAgB,QACX,oCAAmC;AAC1C,SAAQC,gBAAgB,QAAO,wCAAuC;AACtE,SACEC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,QACV,oCAAmC;AAC1C,SAGEC,aAAa,EACbC,YAAY,EACZC,cAAc,QACT,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC"}
1
+ {"version":3,"sources":["../../src/_exports/deploy.ts"],"sourcesContent":["export {\n buildExposes,\n type DeployedExpose,\n summarizeExposes,\n} from '../actions/deploy/buildExposes.js'\nexport {checkBuiltOutput} from '../actions/deploy/checkBuiltOutput.js'\nexport {\n deployConfig,\n resolveInstallationId,\n summarizeConfig,\n} from '../actions/deploy/deployConfig.js'\nexport {deployCoreApp, deployStudio} from '../actions/deploy/deployWorkbenchApp.js'\nexport {getWorkbench} from '../actions/deploy/getWorkbench.js'\nexport {\n type Application,\n type BrettInterface,\n type BrettWorkspace,\n getApplication,\n getApplicationUrl,\n getWorkbenchUrl,\n} from '../services/applications.js'\n"],"names":["buildExposes","summarizeExposes","checkBuiltOutput","deployConfig","resolveInstallationId","summarizeConfig","deployCoreApp","deployStudio","getWorkbench","getApplication","getApplicationUrl","getWorkbenchUrl"],"mappings":"AAAA,SACEA,YAAY,EAEZC,gBAAgB,QACX,oCAAmC;AAC1C,SAAQC,gBAAgB,QAAO,wCAAuC;AACtE,SACEC,YAAY,EACZC,qBAAqB,EACrBC,eAAe,QACV,oCAAmC;AAC1C,SAAQC,aAAa,EAAEC,YAAY,QAAO,0CAAyC;AACnF,SAAQC,YAAY,QAAO,oCAAmC;AAC9D,SAIEC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,QACV,8BAA6B"}
@@ -58,14 +58,57 @@ declare const devServerManifestSchema: z.ZodMiniObject<
58
58
  id: z.ZodMiniOptional<z.ZodMiniString<string>>;
59
59
  interfaces: z.ZodMiniOptional<
60
60
  z.ZodMiniArray<
61
- z.ZodMiniObject<
62
- {
63
- entry_point: z.ZodMiniString<string>;
64
- interface_type: z.ZodMiniString<string>;
65
- name: z.ZodMiniString<string>;
66
- version: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
67
- },
68
- z.core.$strip
61
+ z.ZodMiniDiscriminatedUnion<
62
+ [
63
+ z.ZodMiniObject<
64
+ {
65
+ metadata: z.ZodMiniNullable<
66
+ z.ZodMiniObject<
67
+ {
68
+ group: z.ZodMiniOptional<z.ZodMiniString<string>>;
69
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
70
+ },
71
+ z.core.$strip
72
+ >
73
+ >;
74
+ type: z.ZodMiniLiteral<"app">;
75
+ id: z.ZodMiniString<string>;
76
+ moduleId: z.ZodMiniString<string>;
77
+ name: z.ZodMiniString<string>;
78
+ src: z.ZodMiniString<string>;
79
+ title: z.ZodMiniString<string>;
80
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
81
+ },
82
+ z.core.$strip
83
+ >,
84
+ z.ZodMiniObject<
85
+ {
86
+ metadata: z.ZodMiniNull;
87
+ type: z.ZodMiniLiteral<"panel">;
88
+ id: z.ZodMiniString<string>;
89
+ moduleId: z.ZodMiniString<string>;
90
+ name: z.ZodMiniString<string>;
91
+ src: z.ZodMiniString<string>;
92
+ title: z.ZodMiniString<string>;
93
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
94
+ },
95
+ z.core.$strip
96
+ >,
97
+ z.ZodMiniObject<
98
+ {
99
+ metadata: z.ZodMiniNull;
100
+ type: z.ZodMiniLiteral<"worker">;
101
+ id: z.ZodMiniString<string>;
102
+ moduleId: z.ZodMiniString<string>;
103
+ name: z.ZodMiniString<string>;
104
+ src: z.ZodMiniString<string>;
105
+ title: z.ZodMiniString<string>;
106
+ version: z.ZodMiniOptional<z.ZodMiniString<string>>;
107
+ },
108
+ z.core.$strip
109
+ >,
110
+ ],
111
+ "type"
69
112
  >
70
113
  >
71
114
  >;
@@ -78,6 +121,7 @@ declare const devServerManifestSchema: z.ZodMiniObject<
78
121
  group: z.ZodMiniOptional<z.ZodMiniString<string>>;
79
122
  icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
80
123
  priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
124
+ slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
81
125
  title: z.ZodMiniOptional<z.ZodMiniString<string>>;
82
126
  version: z.ZodMiniString<string>;
83
127
  },
@@ -104,6 +104,13 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
104
104
  >
105
105
  >
106
106
  >;
107
+ visibility: z.ZodMiniOptional<
108
+ z.ZodMiniEnum<{
109
+ default: "default";
110
+ unlisted: "unlisted";
111
+ disabled: "disabled";
112
+ }>
113
+ >;
107
114
  },
108
115
  z.core.$strip
109
116
  >;
@@ -217,9 +224,10 @@ export declare interface PanelViewComponents {
217
224
  * @public
218
225
  */
219
226
  export declare type PanelViewProps = ViewComponentBaseProps<{
220
- entry_point: string;
221
- interface_type: "panel";
222
227
  name: string;
228
+ src: string;
229
+ title: string;
230
+ type: "panel";
223
231
  }>;
224
232
 
225
233
  /** @internal */
@@ -0,0 +1,258 @@
1
+ import { AppVisibility } from "@sanity/cli-core";
2
+ import { UndeployAdapter } from "@sanity/cli-core/undeploy";
3
+ import { UndeployApplicationTarget } from "@sanity/cli-core/undeploy";
4
+ import { UndeployConfigTarget } from "@sanity/cli-core/undeploy";
5
+ import { z } from "zod/mini";
6
+
7
+ /**
8
+ * The undeploy adapter for workbench apps, mirroring what a workbench deploy
9
+ * creates: apps that expose interfaces delete their Brett application (the
10
+ * server soft-deletes its deployments and refuses singletons with active
11
+ * installations); a singleton without interfaces — the media library — deletes
12
+ * its installation's config snapshots instead.
13
+ */
14
+ export declare function createWorkbenchUndeployAdapter(options: {
15
+ appId: string | undefined;
16
+ organizationId: string | undefined;
17
+ type: "coreApp" | "studio";
18
+ workbench: DeployableWorkbenchApp;
19
+ }): UndeployAdapter<WorkbenchUndeployTarget>;
20
+
21
+ /**
22
+ * User-facing input for `unstable_defineApp`. Excludes the internal
23
+ * `applicationType`, `isSingleton`, and `config` — validated by the
24
+ * schema but not part of the public surface (Sanity-owned apps set them via
25
+ * `@ts-expect-error`).
26
+ * @public
27
+ */
28
+ declare type DefineAppInput = Omit<
29
+ z.output<typeof DefineAppInputSchema>,
30
+ "applicationType" | "config" | "isSingleton"
31
+ >;
32
+
33
+ /**
34
+ * Runtime-validation schema for `unstable_defineApp`. Validates the full shape
35
+ * including the internal `applicationType`; the user-facing `DefineAppInput`
36
+ * type below omits that field.
37
+ * @internal
38
+ */
39
+ declare const DefineAppInputSchema: z.ZodMiniObject<
40
+ {
41
+ applicationType: z.ZodMiniOptional<
42
+ z.ZodMiniEnum<{
43
+ "media-library": "media-library";
44
+ coreApp: "coreApp";
45
+ studio: "studio";
46
+ canvas: "canvas";
47
+ dashboard: "dashboard";
48
+ }>
49
+ >;
50
+ config: z.ZodMiniOptional<
51
+ z.ZodMiniDiscriminatedUnion<
52
+ [
53
+ z.ZodMiniObject<
54
+ {
55
+ appType: z.ZodMiniLiteral<"media-library">;
56
+ fields: z.ZodMiniArray<
57
+ z.ZodMiniObject<
58
+ {
59
+ public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
60
+ title: z.ZodMiniString<string>;
61
+ name: z.ZodMiniString<string>;
62
+ src: z.ZodMiniString<string>;
63
+ },
64
+ z.core.$strip
65
+ >
66
+ >;
67
+ },
68
+ z.core.$strip
69
+ >,
70
+ ],
71
+ "appType"
72
+ >
73
+ >;
74
+ entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
75
+ group: z.ZodMiniOptional<
76
+ z.ZodMiniEnum<{
77
+ "dock.system": "dock.system";
78
+ "dock.applications": "dock.applications";
79
+ "dock.user": "dock.user";
80
+ }>
81
+ >;
82
+ icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
83
+ isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
84
+ name: z.ZodMiniString<string>;
85
+ organizationId: z.ZodMiniString<string>;
86
+ priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
87
+ services: z.ZodMiniOptional<
88
+ z.ZodMiniArray<
89
+ z.ZodMiniDiscriminatedUnion<
90
+ [
91
+ z.ZodMiniObject<
92
+ {
93
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
94
+ name: z.ZodMiniString<string>;
95
+ src: z.ZodMiniString<string>;
96
+ type: z.ZodMiniLiteral<"worker">;
97
+ },
98
+ z.core.$strip
99
+ >,
100
+ ],
101
+ "type"
102
+ >
103
+ >
104
+ >;
105
+ slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
106
+ title: z.ZodMiniString<string>;
107
+ views: z.ZodMiniOptional<
108
+ z.ZodMiniArray<
109
+ z.ZodMiniDiscriminatedUnion<
110
+ [
111
+ z.ZodMiniObject<
112
+ {
113
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
114
+ name: z.ZodMiniString<string>;
115
+ src: z.ZodMiniString<string>;
116
+ type: z.ZodMiniLiteral<"panel">;
117
+ },
118
+ z.core.$strip
119
+ >,
120
+ ],
121
+ "type"
122
+ >
123
+ >
124
+ >;
125
+ visibility: z.ZodMiniOptional<
126
+ z.ZodMiniEnum<{
127
+ default: "default";
128
+ unlisted: "unlisted";
129
+ disabled: "disabled";
130
+ }>
131
+ >;
132
+ },
133
+ z.core.$strip
134
+ >;
135
+
136
+ /**
137
+ * The branded result of `unstable_defineApp`. Carries the same fields as the
138
+ * input plus the internal brand — users only ever see `DefineAppInput`.
139
+ * @public
140
+ */
141
+ declare interface DefineAppResult extends DefineAppInput {
142
+ readonly [WORKBENCH_APP]: true;
143
+ }
144
+
145
+ declare interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
146
+ /**
147
+ * Throws when the app exposes nothing (no entry, view, service, or config) —
148
+ * the remote would have nothing to load. Gated before any prompt or API call.
149
+ */
150
+ assertDeployable(): void;
151
+ /**
152
+ * Validates the app's declared views into the application-service payload.
153
+ * Throws when a view declaration is malformed.
154
+ */
155
+ buildViewDeploymentPayload(applicationId: string): ViewDeploymentPayload;
156
+ /**
157
+ * A singleton (the Media Library) that carries an config — deploy
158
+ * persists the config to the org's installation. Independent of the interfaces,
159
+ * which register regardless; non-singletons never carry a config.
160
+ */
161
+ deploySingletonConfig: boolean;
162
+ /** Declares something to host as an application — an entry, view, or service. */
163
+ hasInterfaces: boolean;
164
+ }
165
+
166
+ /** A view or service as the deploy report and `--json` output surface it. */
167
+ declare interface DeployedExpose {
168
+ name: string;
169
+ src: string;
170
+ title: string;
171
+ type: string;
172
+ }
173
+
174
+ /** @public */
175
+ declare interface ResolvedWorkbenchApp {
176
+ /** The app's unique `name` from `unstable_defineApp`. */
177
+ readonly name: string;
178
+ /** Background worker services the app declares. */
179
+ readonly services: NonNullable<DefineAppInput["services"]>;
180
+ /** Dock panel views the app declares. */
181
+ readonly views: NonNullable<DefineAppInput["views"]>;
182
+ /** Resolved app kind — `studio` or one of the SDK app types. */
183
+ readonly applicationType?: string;
184
+ /** Deploys on its own path, separate from the interfaces. */
185
+ readonly config?: WorkbenchApp["config"];
186
+ /** SDK app-view entrypoint, when declared. */
187
+ readonly entry?: string;
188
+ /** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
189
+ readonly isSingleton?: boolean;
190
+ /** Hostname the application is created at on first deploy. */
191
+ readonly slug?: string;
192
+ /** Dashboard visibility declared by the app; `undefined` when unset. */
193
+ readonly visibility?: AppVisibility;
194
+ }
195
+
196
+ declare type ViewDeploymentPayload = z.infer<
197
+ typeof viewDeploymentPayloadSchema
198
+ >;
199
+
200
+ /**
201
+ * Payload registering an app's views with the application service on deploy.
202
+ *
203
+ * Phase 1 stub: the service that stores views does not exist yet, so the
204
+ * payload is validated and logged only — never sent. Builds the contract the
205
+ * application-service endpoint will accept.
206
+ */
207
+ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<
208
+ {
209
+ applicationId: z.ZodMiniString<string>;
210
+ views: z.ZodMiniArray<
211
+ z.ZodMiniObject<
212
+ {
213
+ name: z.ZodMiniString<string>;
214
+ src: z.ZodMiniString<string>;
215
+ type: z.ZodMiniEnum<{
216
+ panel: "panel";
217
+ }>;
218
+ },
219
+ z.core.$loose
220
+ >
221
+ >;
222
+ },
223
+ z.core.$strip
224
+ >;
225
+
226
+ /**
227
+ * Nominal brand the CLI discriminates on to enable the workbench build/deploy
228
+ * codepath. Registered via `Symbol.for` so the marker survives module-realm
229
+ * boundaries — `@sanity/cli-core` re-derives the same global symbol with
230
+ * `Symbol.for` rather than importing it, so it stays internal to this module.
231
+ */
232
+ declare const WORKBENCH_APP: unique symbol;
233
+
234
+ /**
235
+ * A branded app as the CLI reads it — the full schema shape, including the
236
+ * internal fields `DefineAppInput` omits. Schema-derived so the narrowing
237
+ * can't drift from what the schema validates.
238
+ * @public
239
+ */
240
+ declare type WorkbenchApp = DefineAppResult &
241
+ z.output<typeof DefineAppInputSchema>;
242
+
243
+ /** The workbench extension of the shared target; serializes into `--json` as-is. */
244
+ declare type WorkbenchUndeployTarget =
245
+ | (UndeployApplicationTarget & {
246
+ /** Interfaces (views and services) registered by the application. */
247
+ interfaces: DeployedExpose[];
248
+ })
249
+ | (UndeployConfigTarget & {
250
+ /** The deployed config snapshots an undeploy deletes. */
251
+ configs: {
252
+ createdAt: string | null;
253
+ deployedBy: string | null;
254
+ id: string;
255
+ }[];
256
+ });
257
+
258
+ export {};
@@ -0,0 +1,3 @@
1
+ export { createWorkbenchUndeployAdapter } from '../actions/undeploy/workbenchUndeployAdapter.js';
2
+
3
+ //# sourceMappingURL=undeploy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/_exports/undeploy.ts"],"sourcesContent":["export {createWorkbenchUndeployAdapter} from '../actions/undeploy/workbenchUndeployAdapter.js'\n"],"names":["createWorkbenchUndeployAdapter"],"mappings":"AAAA,SAAQA,8BAA8B,QAAO,kDAAiD"}
@@ -48,8 +48,13 @@ import { sanityFederationRuntime } from './plugins/plugin-sanity-federation-runt
48
48
  isApp: false,
49
49
  studioConfigPath: options.studioConfigPath
50
50
  };
51
+ // A workbench remote can also serve itself standalone. When the remote flag is
52
+ // set (and there's an `./App` to mount — never for a dock-only app), build the
53
+ // SPA client environment from the runtime bootstrap cli-build writes.
54
+ const clientInput = process.env.SANITY_INTERNAL_IS_WORKBENCH_REMOTE === 'true' && exposesApp ? path.join(workDir, '.sanity', 'runtime', 'app.js') : undefined;
51
55
  return [
52
56
  sanityEnvironmentPlugin({
57
+ clientInput,
53
58
  input: entryPath
54
59
  }),
55
60
  sanityFederationRuntime(runtimeOptions),
@@ -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 return [\n sanityEnvironmentPlugin({input: entryPath}),\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","name","defaultName","pkgJson","workDir","process","cwd","Error","generatedEntry","resolveEntryPath","entry","resolvedPath","resolve","entryPath","artifacts","artifactModuleExposes","artifactPath","exposesApp","isApp","appEntry","undefined","federationExposes","runtimeOptions","studioConfigPath","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;AA2CtD;;CAEC,GACD,OAAO,MAAMC,aAAa,CAACC;IACzB,MAAM,EAACC,OAAO,EAAEC,MAAMC,WAAW,EAAEC,OAAO,EAAEC,UAAUC,QAAQC,GAAG,EAAE,EAAC,GAAGP;IAEvE,IAAIE,OAAOC;IAEX,IAAI,CAACD,MAAM;QACTA,OAAOE,SAASF;IAClB;IAEA,IAAI,CAACA,MAAM;QACT,MAAM,IAAIM,MAAM;IAClB;IAEA,MAAMC,iBAAiB,CAAC,EAAE,EAAEf,YAAY,CAAC,EAAED,qBAAqB,IAAI,CAAC;IAErE,SAASiB,iBAAiBC,KAAa;QACrC,MAAMC,eAAetB,KAAKuB,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,YAAYvB,mBAAmBS,WAAW,CAAC;IACjD,MAAMe,wBAAwBzB,gBAAgBwB,WAAW,CAACE,eACxDP,iBAAiB,CAAC,EAAE,EAAEhB,YAAY,CAAC,EAAEuB,cAAc;IAGrD,0EAA0E;IAC1E,4EAA4E;IAC5E,qDAAqD;IACrD,MAAMC,aAAa,CAAClB,QAAQmB,KAAK,IAAInB,QAAQoB,QAAQ,KAAKC;IAE1D,MAAMC,oBAAqE;QACzE,GAAIJ,aAAa;YAAC,SAASJ;QAAS,IAAI,CAAC,CAAC;QAC1C,GAAGE,qBAAqB;IAC1B;IAEA,MAAMO,iBAA2CvB,QAAQmB,KAAK,GAC1D;QAACC,UAAUpB,QAAQoB,QAAQ;QAAED,OAAO;IAAI,IACxC;QAACA,OAAO;QAAOK,kBAAkBxB,QAAQwB,gBAAgB;IAAA;IAE7D,OAAO;QACL5B,wBAAwB;YAAC6B,OAAOX;QAAS;QACzChB,wBAAwByB;QACxB1B,yBAAyB;YAACkB;QAAS;QACnCpB,uBAAuB;YAACM,SAASqB;YAAmBpB;QAAI;KACzD;AACH,EAAC"}
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 // A workbench remote can also serve itself standalone. When the remote flag is\n // set (and there's an `./App` to mount — never for a dock-only app), build the\n // SPA client environment from the runtime bootstrap cli-build writes.\n const clientInput =\n process.env.SANITY_INTERNAL_IS_WORKBENCH_REMOTE === 'true' && exposesApp\n ? path.join(workDir, '.sanity', 'runtime', 'app.js')\n : undefined\n\n return [\n sanityEnvironmentPlugin({clientInput, input: entryPath}),\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","name","defaultName","pkgJson","workDir","process","cwd","Error","generatedEntry","resolveEntryPath","entry","resolvedPath","resolve","entryPath","artifacts","artifactModuleExposes","artifactPath","exposesApp","isApp","appEntry","undefined","federationExposes","runtimeOptions","studioConfigPath","clientInput","env","SANITY_INTERNAL_IS_WORKBENCH_REMOTE","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;AA2CtD;;CAEC,GACD,OAAO,MAAMC,aAAa,CAACC;IACzB,MAAM,EAACC,OAAO,EAAEC,MAAMC,WAAW,EAAEC,OAAO,EAAEC,UAAUC,QAAQC,GAAG,EAAE,EAAC,GAAGP;IAEvE,IAAIE,OAAOC;IAEX,IAAI,CAACD,MAAM;QACTA,OAAOE,SAASF;IAClB;IAEA,IAAI,CAACA,MAAM;QACT,MAAM,IAAIM,MAAM;IAClB;IAEA,MAAMC,iBAAiB,CAAC,EAAE,EAAEf,YAAY,CAAC,EAAED,qBAAqB,IAAI,CAAC;IAErE,SAASiB,iBAAiBC,KAAa;QACrC,MAAMC,eAAetB,KAAKuB,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,YAAYvB,mBAAmBS,WAAW,CAAC;IACjD,MAAMe,wBAAwBzB,gBAAgBwB,WAAW,CAACE,eACxDP,iBAAiB,CAAC,EAAE,EAAEhB,YAAY,CAAC,EAAEuB,cAAc;IAGrD,0EAA0E;IAC1E,4EAA4E;IAC5E,qDAAqD;IACrD,MAAMC,aAAa,CAAClB,QAAQmB,KAAK,IAAInB,QAAQoB,QAAQ,KAAKC;IAE1D,MAAMC,oBAAqE;QACzE,GAAIJ,aAAa;YAAC,SAASJ;QAAS,IAAI,CAAC,CAAC;QAC1C,GAAGE,qBAAqB;IAC1B;IAEA,MAAMO,iBAA2CvB,QAAQmB,KAAK,GAC1D;QAACC,UAAUpB,QAAQoB,QAAQ;QAAED,OAAO;IAAI,IACxC;QAACA,OAAO;QAAOK,kBAAkBxB,QAAQwB,gBAAgB;IAAA;IAE7D,+EAA+E;IAC/E,+EAA+E;IAC/E,sEAAsE;IACtE,MAAMC,cACJnB,QAAQoB,GAAG,CAACC,mCAAmC,KAAK,UAAUT,aAC1D5B,KAAKsC,IAAI,CAACvB,SAAS,WAAW,WAAW,YACzCgB;IAEN,OAAO;QACLzB,wBAAwB;YAAC6B;YAAaI,OAAOf;QAAS;QACtDhB,wBAAwByB;QACxB1B,yBAAyB;YAACkB;QAAS;QACnCpB,uBAAuB;YAACM,SAASqB;YAAmBpB;QAAI;KACzD;AACH,EAAC"}
@@ -2,7 +2,7 @@
2
2
  * Bake the app's bus identity into its bundle: `@sanity/runtime` reads
3
3
  * `__SANITY_APP_ID__` where it connects. `define` covers everything the
4
4
  * pipeline transforms (all of a production build, and dev-served source); the
5
- * esbuild define covers dev's pre-bundled dependencies, which skip Vite's
5
+ * rolldown define covers dev's pre-bundled dependencies, which skip Vite's
6
6
  * define transform.
7
7
  */ export function sanityAppId(appId) {
8
8
  const define = {
@@ -12,8 +12,10 @@
12
12
  config: ()=>({
13
13
  define,
14
14
  optimizeDeps: {
15
- esbuildOptions: {
16
- define
15
+ rolldownOptions: {
16
+ transform: {
17
+ define
18
+ }
17
19
  }
18
20
  }
19
21
  }),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-app-id.ts"],"sourcesContent":["import {type Plugin} from 'vite'\n\n/**\n * Bake the app's bus identity into its bundle: `@sanity/runtime` reads\n * `__SANITY_APP_ID__` where it connects. `define` covers everything the\n * pipeline transforms (all of a production build, and dev-served source); the\n * esbuild define covers dev's pre-bundled dependencies, which skip Vite's\n * define transform.\n */\nexport function sanityAppId(appId: string): Plugin {\n const define = {__SANITY_APP_ID__: JSON.stringify(appId)}\n return {\n config: () => ({define, optimizeDeps: {esbuildOptions: {define}}}),\n name: 'sanity/workbench/app-id',\n }\n}\n"],"names":["sanityAppId","appId","define","__SANITY_APP_ID__","JSON","stringify","config","optimizeDeps","esbuildOptions","name"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,SAASA,YAAYC,KAAa;IACvC,MAAMC,SAAS;QAACC,mBAAmBC,KAAKC,SAAS,CAACJ;IAAM;IACxD,OAAO;QACLK,QAAQ,IAAO,CAAA;gBAACJ;gBAAQK,cAAc;oBAACC,gBAAgB;wBAACN;oBAAM;gBAAC;YAAC,CAAA;QAChEO,MAAM;IACR;AACF"}
1
+ {"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-app-id.ts"],"sourcesContent":["import {type Plugin} from 'vite'\n\n/**\n * Bake the app's bus identity into its bundle: `@sanity/runtime` reads\n * `__SANITY_APP_ID__` where it connects. `define` covers everything the\n * pipeline transforms (all of a production build, and dev-served source); the\n * rolldown define covers dev's pre-bundled dependencies, which skip Vite's\n * define transform.\n */\nexport function sanityAppId(appId: string): Plugin {\n const define = {__SANITY_APP_ID__: JSON.stringify(appId)}\n return {\n config: () => ({define, optimizeDeps: {rolldownOptions: {transform: {define}}}}),\n name: 'sanity/workbench/app-id',\n }\n}\n"],"names":["sanityAppId","appId","define","__SANITY_APP_ID__","JSON","stringify","config","optimizeDeps","rolldownOptions","transform","name"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,SAASA,YAAYC,KAAa;IACvC,MAAMC,SAAS;QAACC,mBAAmBC,KAAKC,SAAS,CAACJ;IAAM;IACxD,OAAO;QACLK,QAAQ,IAAO,CAAA;gBAACJ;gBAAQK,cAAc;oBAACC,iBAAiB;wBAACC,WAAW;4BAACP;wBAAM;oBAAC;gBAAC;YAAC,CAAA;QAC9EQ,MAAM;IACR;AACF"}