@sanity/workbench-cli 1.5.0 → 1.7.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 +47 -3
- package/dist/_exports/build.js +2 -0
- package/dist/_exports/build.js.map +1 -1
- package/dist/_exports/deploy.d.ts +60 -37
- package/dist/_exports/deploy.js +1 -1
- package/dist/_exports/deploy.js.map +1 -1
- package/dist/_exports/dev.d.ts +0 -2
- package/dist/_exports/index.d.ts +39 -1
- package/dist/_exports/index.js +1 -0
- package/dist/_exports/index.js.map +1 -1
- package/dist/_exports/init.d.ts +2 -2
- package/dist/_exports/preview.d.ts +169 -0
- package/dist/_exports/preview.js +3 -0
- package/dist/_exports/preview.js.map +1 -0
- package/dist/_exports/undeploy.d.ts +7 -3
- package/dist/actions/build/vite/optimize-deps.js +84 -0
- package/dist/actions/build/vite/optimize-deps.js.map +1 -0
- package/dist/actions/build/vite/plugins/plugin-sanity-app-id.js +15 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-app-id.js.map +1 -1
- package/dist/actions/deploy/checkBuiltOutput.js +16 -2
- package/dist/actions/deploy/checkBuiltOutput.js.map +1 -1
- package/dist/actions/deploy/deployWorkbenchApp.js +55 -73
- package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
- package/dist/actions/dev/registry.js +69 -1
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +9 -2
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDev.js +7 -43
- package/dist/actions/dev/startWorkbenchDev.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +7 -3
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/init/cliConfig.js +2 -0
- package/dist/actions/init/cliConfig.js.map +1 -1
- package/dist/actions/preview/serveBuiltApplication.js +53 -0
- package/dist/actions/preview/serveBuiltApplication.js.map +1 -0
- package/dist/actions/preview/startWorkbenchPreview.js +107 -0
- package/dist/actions/preview/startWorkbenchPreview.js.map +1 -0
- package/dist/appId.js +52 -0
- package/dist/appId.js.map +1 -0
- package/dist/defineApp.js +2 -5
- package/dist/defineApp.js.map +1 -1
- package/dist/resolveWorkbenchApp.js +2 -0
- package/dist/resolveWorkbenchApp.js.map +1 -1
- package/dist/services/applications.js +37 -20
- package/dist/services/applications.js.map +1 -1
- package/dist/util/serverOrchestration.js +75 -0
- package/dist/util/serverOrchestration.js.map +1 -0
- package/package.json +7 -3
package/dist/_exports/build.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ import { CliConfig } from "@sanity/cli-core";
|
|
|
3
3
|
import { PluginOption } from "vite";
|
|
4
4
|
import { z } from "zod/mini";
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* The `build`/`start` id for a workbench app — a hash of its declared shape.
|
|
8
|
+
* Shared so the bundle inlined by `sanity build` and the registry entry advertised
|
|
9
|
+
* by `sanity start` resolve to the same id.
|
|
10
|
+
*/
|
|
11
|
+
export declare function buildAppId(app: ResolvedWorkbenchApp): string;
|
|
12
|
+
|
|
6
13
|
/**
|
|
7
14
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
8
15
|
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
@@ -87,7 +94,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
87
94
|
>
|
|
88
95
|
>
|
|
89
96
|
>;
|
|
90
|
-
slug: z.
|
|
97
|
+
slug: z.ZodMiniString<string>;
|
|
91
98
|
title: z.ZodMiniString<string>;
|
|
92
99
|
views: z.ZodMiniOptional<
|
|
93
100
|
z.ZodMiniArray<
|
|
@@ -131,8 +138,12 @@ declare interface DefineAppResult extends DefineAppInput {
|
|
|
131
138
|
declare interface ResolvedWorkbenchApp {
|
|
132
139
|
/** The app's unique `name` from `unstable_defineApp`. */
|
|
133
140
|
readonly name: string;
|
|
141
|
+
/** Organization that owns the app — part of its build-id identity. */
|
|
142
|
+
readonly organizationId: string;
|
|
134
143
|
/** Background worker services the app declares. */
|
|
135
144
|
readonly services: NonNullable<DefineAppInput["services"]>;
|
|
145
|
+
/** Hostname the application is created at on first deploy. */
|
|
146
|
+
readonly slug: string;
|
|
136
147
|
/** Dock panel views the app declares. */
|
|
137
148
|
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
138
149
|
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
@@ -141,10 +152,10 @@ declare interface ResolvedWorkbenchApp {
|
|
|
141
152
|
readonly config?: WorkbenchApp["config"];
|
|
142
153
|
/** SDK app-view entrypoint, when declared. */
|
|
143
154
|
readonly entry?: string;
|
|
155
|
+
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
156
|
+
readonly icon?: string;
|
|
144
157
|
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
145
158
|
readonly isSingleton?: boolean;
|
|
146
|
-
/** Hostname the application is created at on first deploy. */
|
|
147
|
-
readonly slug?: string;
|
|
148
159
|
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
149
160
|
readonly visibility?: AppVisibility;
|
|
150
161
|
}
|
|
@@ -185,6 +196,39 @@ export declare interface WorkbenchExposes {
|
|
|
185
196
|
views?: DefineAppInput["views"];
|
|
186
197
|
}
|
|
187
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Dep pre-bundling inputs for a workbench app's dev server.
|
|
201
|
+
*
|
|
202
|
+
* Vite's dep scanner crawls from the app's HTML entry, which reaches only the
|
|
203
|
+
* app's `entry` (or a studio's config) — never the federation `exposes` (dock
|
|
204
|
+
* views, worker services, media-library config fields), which the host loads
|
|
205
|
+
* dynamically at runtime. So a dep imported only by an exposed module (e.g.
|
|
206
|
+
* `sanity/workbench` in a service or view) escapes the startup scan; Vite
|
|
207
|
+
* discovers it on first request, re-optimizes, and full-page reloads — which
|
|
208
|
+
* flakes Playwright in e2e.
|
|
209
|
+
*
|
|
210
|
+
* Point `entries` at the source of every interface: the app `entry` (or, for a
|
|
211
|
+
* studio, its config), plus each view, service, and installation-config source.
|
|
212
|
+
* `entries` follows real import statements, so it covers whatever those sources
|
|
213
|
+
* transitively use — correct subpaths and all — with no hand-maintained dep
|
|
214
|
+
* list, and never crashes on an unresolvable name the way a bad `include` entry
|
|
215
|
+
* does. Each source is resolved to its on-disk file so an extensionless path
|
|
216
|
+
* (like the default `./src/App`) still matches `entries`' filesystem glob.
|
|
217
|
+
*
|
|
218
|
+
* @param cwd - Project root; `entries` are returned relative to it.
|
|
219
|
+
* @param appSources - Absolute paths to the app's `entry` and/or studio config.
|
|
220
|
+
* @param exposes - The app's declared views/services/config.
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
export declare function workbenchOptimizeDeps(options: {
|
|
224
|
+
appSources: readonly string[];
|
|
225
|
+
cwd: string;
|
|
226
|
+
exposes?: WorkbenchExposes;
|
|
227
|
+
}): {
|
|
228
|
+
entries: string[];
|
|
229
|
+
include: string[];
|
|
230
|
+
};
|
|
231
|
+
|
|
188
232
|
declare interface WorkbenchViteOptions {
|
|
189
233
|
/** Project root — read for the federation remote name, and the plugin workDir. */
|
|
190
234
|
cwd: string;
|
package/dist/_exports/build.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
// resolver the build reads declared views/services 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 { workbenchOptimizeDeps } from '../actions/build/vite/optimize-deps.js';
|
|
6
7
|
export { workbenchVitePlugins } from '../actions/build/vite/workbench-vite-plugins.js';
|
|
8
|
+
export { buildAppId } from '../appId.js';
|
|
7
9
|
export { resolveWorkbenchApp } from '../resolveWorkbenchApp.js';
|
|
8
10
|
|
|
9
11
|
//# sourceMappingURL=build.js.map
|
|
@@ -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/services 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 {workbenchVitePlugins} from '../actions/build/vite/workbench-vite-plugins.js'\nexport {resolveWorkbenchApp, type WorkbenchExposes} from '../resolveWorkbenchApp.js'\n"],"names":["workbenchVitePlugins","resolveWorkbenchApp"],"mappings":"AAAA,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,sDAAsD;AAEtD,SAAQA,oBAAoB,QAAO,kDAAiD;AACpF,SAAQC,mBAAmB,QAA8B,4BAA2B"}
|
|
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/services 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'\n"],"names":["workbenchOptimizeDeps","workbenchVitePlugins","buildAppId","resolveWorkbenchApp"],"mappings":"AAAA,iEAAiE;AACjE,+EAA+E;AAC/E,4EAA4E;AAC5E,+EAA+E;AAC/E,sDAAsD;AAEtD,SAAQA,qBAAqB,QAAO,yCAAwC;AAC5E,SAAQC,oBAAoB,QAAO,kDAAiD;AACpF,SAAQC,UAAU,QAAO,cAAa;AACtC,SAAQC,mBAAmB,QAA8B,4BAA2B"}
|
|
@@ -59,6 +59,8 @@ declare interface BrettInterfaceBase {
|
|
|
59
59
|
export declare interface BrettWorkspace {
|
|
60
60
|
dataset: string;
|
|
61
61
|
projectId: string;
|
|
62
|
+
/** Lexicon schema descriptor id; Brett requires one per workspace. */
|
|
63
|
+
schemaDescriptorId: string;
|
|
62
64
|
basePath?: string;
|
|
63
65
|
icon?: string;
|
|
64
66
|
name?: string;
|
|
@@ -93,6 +95,41 @@ declare interface BuildExposesContext {
|
|
|
93
95
|
*/
|
|
94
96
|
export declare function checkBuiltOutput(sourceDir: string): Promise<void>;
|
|
95
97
|
|
|
98
|
+
/**
|
|
99
|
+
* Create a coreApp record (no deployment), so the CLI can build with its id
|
|
100
|
+
* before shipping the first deployment. First deploy only.
|
|
101
|
+
* @internal
|
|
102
|
+
*/
|
|
103
|
+
export declare function createCoreApp(options: {
|
|
104
|
+
isSingleton?: boolean;
|
|
105
|
+
organizationId: string;
|
|
106
|
+
slug: string;
|
|
107
|
+
title: string;
|
|
108
|
+
visibility?: AppVisibility;
|
|
109
|
+
}): Promise<CreatedApplication>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* A freshly created application record: its id, plus a way to undo the creation.
|
|
113
|
+
* The caller builds and deploys with the id, and calls `rollback` if a later
|
|
114
|
+
* step fails so the record isn't stranded at its slug.
|
|
115
|
+
* @internal
|
|
116
|
+
*/
|
|
117
|
+
export declare interface CreatedApplication {
|
|
118
|
+
applicationId: string;
|
|
119
|
+
rollback: () => Promise<void>;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Create a studio record (no deployment).
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
export declare function createStudio(options: {
|
|
127
|
+
organizationId: string;
|
|
128
|
+
projectId: string | undefined;
|
|
129
|
+
slug: string;
|
|
130
|
+
title: string;
|
|
131
|
+
}): Promise<CreatedApplication>;
|
|
132
|
+
|
|
96
133
|
/**
|
|
97
134
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
98
135
|
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
@@ -177,7 +214,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
177
214
|
>
|
|
178
215
|
>
|
|
179
216
|
>;
|
|
180
|
-
slug: z.
|
|
217
|
+
slug: z.ZodMiniString<string>;
|
|
181
218
|
title: z.ZodMiniString<string>;
|
|
182
219
|
views: z.ZodMiniOptional<
|
|
183
220
|
z.ZodMiniArray<
|
|
@@ -253,27 +290,6 @@ export declare function deployConfig(options: {
|
|
|
253
290
|
version: string;
|
|
254
291
|
}): Promise<void>;
|
|
255
292
|
|
|
256
|
-
/**
|
|
257
|
-
* Deploy a workbench coreApp through Brett: redeploy when `appId` is set,
|
|
258
|
-
* otherwise create the application at `slug`. Returns the application id for the
|
|
259
|
-
* shell to report.
|
|
260
|
-
* @internal
|
|
261
|
-
*/
|
|
262
|
-
export declare function deployCoreApp(options: {
|
|
263
|
-
appId: string | undefined;
|
|
264
|
-
interfaces: readonly BrettInterface[];
|
|
265
|
-
isAutoUpdating: boolean;
|
|
266
|
-
isSingleton?: boolean;
|
|
267
|
-
organizationId: string;
|
|
268
|
-
slug: string;
|
|
269
|
-
sourceDir: string;
|
|
270
|
-
title: string;
|
|
271
|
-
version: string;
|
|
272
|
-
visibility?: AppVisibility;
|
|
273
|
-
}): Promise<{
|
|
274
|
-
applicationId: string;
|
|
275
|
-
}>;
|
|
276
|
-
|
|
277
293
|
/** A view or service as the deploy report and `--json` output surface it. */
|
|
278
294
|
export declare interface DeployedExpose {
|
|
279
295
|
name: string;
|
|
@@ -283,26 +299,29 @@ export declare interface DeployedExpose {
|
|
|
283
299
|
}
|
|
284
300
|
|
|
285
301
|
/**
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
302
|
+
* Ship a deployment to an already-created (or `deployment.appId`) application,
|
|
303
|
+
* then sync its mutable metadata (`title`, and `icon`/`visibility` when set)
|
|
304
|
+
* from config. The deploy endpoint ignores these, so a redeploy patches them
|
|
305
|
+
* here alongside the new deployment.
|
|
306
|
+
*
|
|
307
|
+
* `onDeployed` fires the instant the deployment is live, before the metadata
|
|
308
|
+
* sync — so a caller can disarm a create-time rollback that must not delete an
|
|
309
|
+
* application once it has an active deployment.
|
|
289
310
|
* @internal
|
|
290
311
|
*/
|
|
291
|
-
export declare function
|
|
292
|
-
|
|
312
|
+
export declare function deployWorkbenchApp(options: {
|
|
313
|
+
applicationId: string;
|
|
314
|
+
icon?: string;
|
|
293
315
|
interfaces: readonly BrettInterface[];
|
|
294
316
|
isAutoUpdating: boolean;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
projectId: string | undefined;
|
|
317
|
+
label?: string;
|
|
318
|
+
onDeployed?: () => void;
|
|
298
319
|
sourceDir: string;
|
|
299
|
-
studioHost: string | undefined;
|
|
300
320
|
title: string;
|
|
301
321
|
version: string;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
}>;
|
|
322
|
+
visibility?: AppVisibility;
|
|
323
|
+
workspaces?: readonly BrettWorkspace[];
|
|
324
|
+
}): Promise<void>;
|
|
306
325
|
|
|
307
326
|
export declare function getApplication(
|
|
308
327
|
applicationId: string,
|
|
@@ -323,8 +342,12 @@ export declare function getWorkbenchUrl(organizationId: string): string;
|
|
|
323
342
|
declare interface ResolvedWorkbenchApp {
|
|
324
343
|
/** The app's unique `name` from `unstable_defineApp`. */
|
|
325
344
|
readonly name: string;
|
|
345
|
+
/** Organization that owns the app — part of its build-id identity. */
|
|
346
|
+
readonly organizationId: string;
|
|
326
347
|
/** Background worker services the app declares. */
|
|
327
348
|
readonly services: NonNullable<DefineAppInput["services"]>;
|
|
349
|
+
/** Hostname the application is created at on first deploy. */
|
|
350
|
+
readonly slug: string;
|
|
328
351
|
/** Dock panel views the app declares. */
|
|
329
352
|
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
330
353
|
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
@@ -333,10 +356,10 @@ declare interface ResolvedWorkbenchApp {
|
|
|
333
356
|
readonly config?: WorkbenchApp["config"];
|
|
334
357
|
/** SDK app-view entrypoint, when declared. */
|
|
335
358
|
readonly entry?: string;
|
|
359
|
+
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
360
|
+
readonly icon?: string;
|
|
336
361
|
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
337
362
|
readonly isSingleton?: boolean;
|
|
338
|
-
/** Hostname the application is created at on first deploy. */
|
|
339
|
-
readonly slug?: string;
|
|
340
363
|
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
341
364
|
readonly visibility?: AppVisibility;
|
|
342
365
|
}
|
package/dist/_exports/deploy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 {
|
|
4
|
+
export { createCoreApp, createStudio, deployWorkbenchApp } from '../actions/deploy/deployWorkbenchApp.js';
|
|
5
5
|
export { getWorkbench } from '../actions/deploy/getWorkbench.js';
|
|
6
6
|
export { getApplication, getApplicationUrl, getWorkbenchUrl } from '../services/applications.js';
|
|
7
7
|
|
|
@@ -1 +1 @@
|
|
|
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 {
|
|
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 {\n createCoreApp,\n type CreatedApplication,\n createStudio,\n deployWorkbenchApp,\n} 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","createCoreApp","createStudio","deployWorkbenchApp","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,SACEC,aAAa,EAEbC,YAAY,EACZC,kBAAkB,QACb,0CAAyC;AAChD,SAAQC,YAAY,QAAO,oCAAmC;AAC9D,SAIEC,cAAc,EACdC,iBAAiB,EACjBC,eAAe,QACV,8BAA6B"}
|
package/dist/_exports/dev.d.ts
CHANGED
|
@@ -162,8 +162,6 @@ export declare function startWorkbenchDev(
|
|
|
162
162
|
}>;
|
|
163
163
|
|
|
164
164
|
export declare interface StartWorkbenchDevOptions {
|
|
165
|
-
/** Resolved app id for the registry entry (the CLI owns id resolution). */
|
|
166
|
-
appId: string | undefined;
|
|
167
165
|
/** Directory for the workbench Vite server's dependency cache. */
|
|
168
166
|
cacheDir: string;
|
|
169
167
|
/** CLI-domain `app.id`/`deployment.appId` deprecation check, run before registering. */
|
package/dist/_exports/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { z } from "zod/mini";
|
|
2
2
|
|
|
3
|
+
/** The declared shape hashed into a build id — the app's identity, not its code. */
|
|
4
|
+
declare interface BuildAppIdentity {
|
|
5
|
+
name: string;
|
|
6
|
+
organizationId: string;
|
|
7
|
+
entry?: string;
|
|
8
|
+
exposes?: WorkbenchExposes;
|
|
9
|
+
}
|
|
10
|
+
|
|
3
11
|
/**
|
|
4
12
|
* User-facing input for `unstable_defineApp`. Excludes the internal
|
|
5
13
|
* `applicationType`, `isSingleton`, and `config` — validated by the
|
|
@@ -84,7 +92,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
84
92
|
>
|
|
85
93
|
>
|
|
86
94
|
>;
|
|
87
|
-
slug: z.
|
|
95
|
+
slug: z.ZodMiniString<string>;
|
|
88
96
|
title: z.ZodMiniString<string>;
|
|
89
97
|
views: z.ZodMiniOptional<
|
|
90
98
|
z.ZodMiniArray<
|
|
@@ -230,6 +238,25 @@ export declare type PanelViewProps = ViewComponentBaseProps<{
|
|
|
230
238
|
type: "panel";
|
|
231
239
|
}>;
|
|
232
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Mints the id the workbench keys everything on (React keys, panel ownership, the
|
|
243
|
+
* message bus, and the bundle's `__SANITY_APP_ID__`). Each run mode derives it
|
|
244
|
+
* differently so a running dev app, a local build, and a deployed twin can't
|
|
245
|
+
* share one: `sanity dev` uses the bound address, `sanity build`/`start` a hash
|
|
246
|
+
* of the declared shape. `sanity deploy` resolves its own id from the
|
|
247
|
+
* applications API, so it isn't handled here.
|
|
248
|
+
*/
|
|
249
|
+
export declare function resolveAppId(
|
|
250
|
+
source:
|
|
251
|
+
| {
|
|
252
|
+
app: BuildAppIdentity;
|
|
253
|
+
}
|
|
254
|
+
| {
|
|
255
|
+
host: string;
|
|
256
|
+
port: number;
|
|
257
|
+
},
|
|
258
|
+
): string;
|
|
259
|
+
|
|
233
260
|
/** @internal */
|
|
234
261
|
declare const SERVICE_CONTRACT_VERSION = 1;
|
|
235
262
|
|
|
@@ -366,4 +393,15 @@ declare const WORKBENCH_APP: unique symbol;
|
|
|
366
393
|
export declare type WorkbenchApp = DefineAppResult &
|
|
367
394
|
z.output<typeof DefineAppInputSchema>;
|
|
368
395
|
|
|
396
|
+
/**
|
|
397
|
+
* Bundled so adding a declaration family touches this type and the artifact
|
|
398
|
+
* expanders, not every hop of build/dev plumbing in between.
|
|
399
|
+
* @internal
|
|
400
|
+
*/
|
|
401
|
+
declare interface WorkbenchExposes {
|
|
402
|
+
config?: WorkbenchApp["config"];
|
|
403
|
+
services?: DefineAppInput["services"];
|
|
404
|
+
views?: DefineAppInput["views"];
|
|
405
|
+
}
|
|
406
|
+
|
|
369
407
|
export {};
|
package/dist/_exports/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export type {InterfaceType, ServiceType} from '../contract.js'\nexport {isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary} from '../defineApp.js'\nexport type {\n DefineAppInput,\n DefineAppResult,\n DefineMediaLibraryInput,\n DockGroup,\n MediaLibraryField,\n WorkbenchApp,\n} from '../defineApp.js'\nexport {unstable_defineService} from '../defineService.js'\nexport type {\n DefinedService,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n} from '../defineService.js'\nexport {unstable_defineView} from '../defineView.js'\nexport type {\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n ViewComponentsByType,\n} from '../defineView.js'\n"],"names":["isWorkbenchApp","unstable_defineApp","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export {resolveAppId} from '../appId.js'\nexport type {InterfaceType, ServiceType} from '../contract.js'\nexport {isWorkbenchApp, unstable_defineApp, unstable_defineMediaLibrary} from '../defineApp.js'\nexport type {\n DefineAppInput,\n DefineAppResult,\n DefineMediaLibraryInput,\n DockGroup,\n MediaLibraryField,\n WorkbenchApp,\n} from '../defineApp.js'\nexport {unstable_defineService} from '../defineService.js'\nexport type {\n DefinedService,\n ServiceCallback,\n ServiceContext,\n ServiceInfo,\n} from '../defineService.js'\nexport {unstable_defineView} from '../defineView.js'\nexport type {\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n ViewComponentsByType,\n} from '../defineView.js'\n"],"names":["resolveAppId","isWorkbenchApp","unstable_defineApp","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"AAAA,SAAQA,YAAY,QAAO,cAAa;AAExC,SAAQC,cAAc,EAAEC,kBAAkB,EAAEC,2BAA2B,QAAO,kBAAiB;AAS/F,SAAQC,sBAAsB,QAAO,sBAAqB;AAO1D,SAAQC,mBAAmB,QAAO,mBAAkB"}
|
package/dist/_exports/init.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/** App scaffold — `entry` auto-declares the navigable app view. */
|
|
2
2
|
export declare const workbenchAppConfigTemplate =
|
|
3
|
-
"\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n name: '%name%',\n title: '%title%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
|
|
3
|
+
"\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n app: unstable_defineApp({\n name: '%name%',\n title: '%title%',\n slug: '%slug%',\n organizationId: '%organizationId%',\n entry: '%entry%',\n }),\n})\n";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Studio scaffold — brands with name/title only, no `entry` (studio app views
|
|
7
7
|
* aren't implemented yet).
|
|
8
8
|
*/
|
|
9
9
|
export declare const workbenchStudioConfigTemplate =
|
|
10
|
-
"\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: unstable_defineApp({\n name: '%name%',\n title: '%title%',\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";
|
|
10
|
+
"\nimport {defineCliConfig, unstable_defineApp} from 'sanity/cli'\n\nexport default defineCliConfig({\n api: {\n projectId: '%projectId%',\n dataset: '%dataset%'\n },\n app: unstable_defineApp({\n name: '%name%',\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";
|
|
11
11
|
|
|
12
12
|
export {};
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { CliConfig } from "@sanity/cli-core";
|
|
2
|
+
import { Output } from "@sanity/cli-core";
|
|
3
|
+
import { z } from "zod/mini";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A manifest describing a running dev server process (studio or app).
|
|
7
|
+
* Stored as `~/.sanity/dev-servers/<pid>.json`.
|
|
8
|
+
*
|
|
9
|
+
* The workbench singleton is tracked separately via the lock file — see
|
|
10
|
+
* `acquireWorkbenchLock` and `readWorkbenchLock` below.
|
|
11
|
+
*/
|
|
12
|
+
declare type DevServerManifest = z.infer<typeof devServerManifestSchema>;
|
|
13
|
+
|
|
14
|
+
declare const devServerManifestSchema: z.ZodMiniObject<
|
|
15
|
+
{
|
|
16
|
+
configs: z.ZodMiniOptional<
|
|
17
|
+
z.ZodMiniArray<
|
|
18
|
+
z.ZodMiniObject<
|
|
19
|
+
{
|
|
20
|
+
appType: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
21
|
+
fields: z.ZodMiniArray<
|
|
22
|
+
z.ZodMiniObject<
|
|
23
|
+
{
|
|
24
|
+
name: z.ZodMiniString<string>;
|
|
25
|
+
public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
|
|
26
|
+
src: z.ZodMiniString<string>;
|
|
27
|
+
title: z.ZodMiniString<string>;
|
|
28
|
+
},
|
|
29
|
+
z.core.$strip
|
|
30
|
+
>
|
|
31
|
+
>;
|
|
32
|
+
id: z.ZodMiniString<string>;
|
|
33
|
+
moduleName: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
34
|
+
version: z.ZodMiniNumber<number>;
|
|
35
|
+
},
|
|
36
|
+
z.core.$strip
|
|
37
|
+
>
|
|
38
|
+
>
|
|
39
|
+
>;
|
|
40
|
+
host: z.ZodMiniString<string>;
|
|
41
|
+
id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
42
|
+
interfaces: z.ZodMiniOptional<
|
|
43
|
+
z.ZodMiniArray<
|
|
44
|
+
z.ZodMiniDiscriminatedUnion<
|
|
45
|
+
[
|
|
46
|
+
z.ZodMiniObject<
|
|
47
|
+
{
|
|
48
|
+
metadata: z.ZodMiniNullable<
|
|
49
|
+
z.ZodMiniObject<
|
|
50
|
+
{
|
|
51
|
+
group: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
52
|
+
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
53
|
+
},
|
|
54
|
+
z.core.$strip
|
|
55
|
+
>
|
|
56
|
+
>;
|
|
57
|
+
type: z.ZodMiniLiteral<"app">;
|
|
58
|
+
id: z.ZodMiniString<string>;
|
|
59
|
+
moduleId: z.ZodMiniString<string>;
|
|
60
|
+
name: z.ZodMiniString<string>;
|
|
61
|
+
src: z.ZodMiniString<string>;
|
|
62
|
+
title: z.ZodMiniString<string>;
|
|
63
|
+
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
64
|
+
},
|
|
65
|
+
z.core.$strip
|
|
66
|
+
>,
|
|
67
|
+
z.ZodMiniObject<
|
|
68
|
+
{
|
|
69
|
+
metadata: z.ZodMiniNull;
|
|
70
|
+
type: z.ZodMiniLiteral<"panel">;
|
|
71
|
+
id: z.ZodMiniString<string>;
|
|
72
|
+
moduleId: z.ZodMiniString<string>;
|
|
73
|
+
name: z.ZodMiniString<string>;
|
|
74
|
+
src: z.ZodMiniString<string>;
|
|
75
|
+
title: z.ZodMiniString<string>;
|
|
76
|
+
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
77
|
+
},
|
|
78
|
+
z.core.$strip
|
|
79
|
+
>,
|
|
80
|
+
z.ZodMiniObject<
|
|
81
|
+
{
|
|
82
|
+
metadata: z.ZodMiniNull;
|
|
83
|
+
type: z.ZodMiniLiteral<"worker">;
|
|
84
|
+
id: z.ZodMiniString<string>;
|
|
85
|
+
moduleId: z.ZodMiniString<string>;
|
|
86
|
+
name: z.ZodMiniString<string>;
|
|
87
|
+
src: z.ZodMiniString<string>;
|
|
88
|
+
title: z.ZodMiniString<string>;
|
|
89
|
+
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
90
|
+
},
|
|
91
|
+
z.core.$strip
|
|
92
|
+
>,
|
|
93
|
+
],
|
|
94
|
+
"type"
|
|
95
|
+
>
|
|
96
|
+
>
|
|
97
|
+
>;
|
|
98
|
+
manifest: z.ZodMiniOptional<
|
|
99
|
+
z.ZodMiniUnion<
|
|
100
|
+
readonly [
|
|
101
|
+
z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>,
|
|
102
|
+
z.ZodMiniObject<
|
|
103
|
+
{
|
|
104
|
+
group: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
105
|
+
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
106
|
+
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
107
|
+
slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
108
|
+
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
109
|
+
version: z.ZodMiniString<string>;
|
|
110
|
+
},
|
|
111
|
+
z.core.$strip
|
|
112
|
+
>,
|
|
113
|
+
]
|
|
114
|
+
>
|
|
115
|
+
>;
|
|
116
|
+
manifestUpdatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
117
|
+
pid: z.ZodMiniNumber<number>;
|
|
118
|
+
port: z.ZodMiniNumber<number>;
|
|
119
|
+
projectId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
120
|
+
startedAt: z.ZodMiniString<string>;
|
|
121
|
+
type: z.ZodMiniEnum<{
|
|
122
|
+
coreApp: "coreApp";
|
|
123
|
+
studio: "studio";
|
|
124
|
+
}>;
|
|
125
|
+
version: z.ZodMiniLiteral<1>;
|
|
126
|
+
workDir: z.ZodMiniString<string>;
|
|
127
|
+
},
|
|
128
|
+
z.core.$strip
|
|
129
|
+
>;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* `sanity start` for a workbench app: serve a production build the way dev serves
|
|
133
|
+
* a live one. The same singleton workbench shell renders it and the same registry
|
|
134
|
+
* advertises it — only the remote differs, static files from the build output
|
|
135
|
+
* instead of a live Vite dev server. There's no config watcher or rebuild: a
|
|
136
|
+
* build is fixed, so nothing re-syncs.
|
|
137
|
+
*
|
|
138
|
+
* A running workbench claims the configured port, so the built remote binds the
|
|
139
|
+
* next one. Without one the remote takes the configured port and announces its
|
|
140
|
+
* own URL.
|
|
141
|
+
*/
|
|
142
|
+
export declare function startWorkbenchPreview(
|
|
143
|
+
options: StartWorkbenchPreviewOptions,
|
|
144
|
+
): Promise<{
|
|
145
|
+
close: () => Promise<void>;
|
|
146
|
+
}>;
|
|
147
|
+
|
|
148
|
+
export declare interface StartWorkbenchPreviewOptions {
|
|
149
|
+
/** Directory for the workbench Vite server's dependency cache. */
|
|
150
|
+
cacheDir: string;
|
|
151
|
+
/** CLI-domain `app.id`/`deployment.appId` deprecation check, run before registering. */
|
|
152
|
+
checkForDeprecatedAppId: () => void;
|
|
153
|
+
cliConfig: CliConfig;
|
|
154
|
+
/** Extract the project manifest to inline into the registry (studio-vs-app handled by the CLI). */
|
|
155
|
+
extractManifest: (params: {
|
|
156
|
+
configPath: string;
|
|
157
|
+
workDir: string;
|
|
158
|
+
}) => Promise<DevServerManifest["manifest"]>;
|
|
159
|
+
httpHost: string;
|
|
160
|
+
httpPort: number;
|
|
161
|
+
isApp: boolean;
|
|
162
|
+
/** The built `dist` directory to serve as the federation remote. */
|
|
163
|
+
outDir: string;
|
|
164
|
+
output: Output;
|
|
165
|
+
reactStrictMode: boolean;
|
|
166
|
+
workDir: string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/preview.ts"],"sourcesContent":["export {\n startWorkbenchPreview,\n type StartWorkbenchPreviewOptions,\n} from '../actions/preview/startWorkbenchPreview.js'\n"],"names":["startWorkbenchPreview"],"mappings":"AAAA,SACEA,qBAAqB,QAEhB,8CAA6C"}
|
|
@@ -102,7 +102,7 @@ declare const DefineAppInputSchema: z.ZodMiniObject<
|
|
|
102
102
|
>
|
|
103
103
|
>
|
|
104
104
|
>;
|
|
105
|
-
slug: z.
|
|
105
|
+
slug: z.ZodMiniString<string>;
|
|
106
106
|
title: z.ZodMiniString<string>;
|
|
107
107
|
views: z.ZodMiniOptional<
|
|
108
108
|
z.ZodMiniArray<
|
|
@@ -175,8 +175,12 @@ declare interface DeployedExpose {
|
|
|
175
175
|
declare interface ResolvedWorkbenchApp {
|
|
176
176
|
/** The app's unique `name` from `unstable_defineApp`. */
|
|
177
177
|
readonly name: string;
|
|
178
|
+
/** Organization that owns the app — part of its build-id identity. */
|
|
179
|
+
readonly organizationId: string;
|
|
178
180
|
/** Background worker services the app declares. */
|
|
179
181
|
readonly services: NonNullable<DefineAppInput["services"]>;
|
|
182
|
+
/** Hostname the application is created at on first deploy. */
|
|
183
|
+
readonly slug: string;
|
|
180
184
|
/** Dock panel views the app declares. */
|
|
181
185
|
readonly views: NonNullable<DefineAppInput["views"]>;
|
|
182
186
|
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
@@ -185,10 +189,10 @@ declare interface ResolvedWorkbenchApp {
|
|
|
185
189
|
readonly config?: WorkbenchApp["config"];
|
|
186
190
|
/** SDK app-view entrypoint, when declared. */
|
|
187
191
|
readonly entry?: string;
|
|
192
|
+
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
193
|
+
readonly icon?: string;
|
|
188
194
|
/** Explicit singleton flag (a Sanity-owned app); `undefined` when the app doesn't set it. */
|
|
189
195
|
readonly isSingleton?: boolean;
|
|
190
|
-
/** Hostname the application is created at on first deploy. */
|
|
191
|
-
readonly slug?: string;
|
|
192
196
|
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
193
197
|
readonly visibility?: AppVisibility;
|
|
194
198
|
}
|