@sanity/workbench-cli 2.0.2 → 2.2.1
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/README.md +1 -1
- package/dist/_exports/_internal_render.d.ts +12 -0
- package/dist/_exports/_internal_render.js +3 -0
- package/dist/_exports/_internal_render.js.map +1 -0
- package/dist/_exports/build.d.ts +4 -4
- package/dist/_exports/build.js +2 -1
- package/dist/_exports/build.js.map +1 -1
- package/dist/_exports/defineApp-DldjQwq6.d.ts +375 -0
- package/dist/_exports/deploy.d.ts +10 -9
- package/dist/_exports/deploy.js +1 -0
- package/dist/_exports/deploy.js.map +1 -1
- package/dist/_exports/dev.d.ts +1 -1
- package/dist/_exports/index.d.ts +23 -16
- package/dist/_exports/index.js +2 -1
- package/dist/_exports/index.js.map +1 -1
- package/dist/_exports/preview.d.ts +1 -1
- package/dist/_exports/{registry-DI7hnTof.d.ts → registry-HE_dEHFa.d.ts} +38 -15
- package/dist/_exports/resolveWorkbenchConfig-6iznHbED.d.ts +60 -0
- package/dist/_exports/{summarizeInterfaces-DBGiAwNT.d.ts → summarizeInterfaces-CjkeWwkY.d.ts} +20 -17
- package/dist/_exports/undeploy.d.ts +12 -9
- package/dist/actions/build/artifact.js +1 -1
- package/dist/actions/build/artifact.js.map +1 -1
- package/dist/actions/build/views/artifact.js +1 -1
- package/dist/actions/build/views/artifact.js.map +1 -1
- package/dist/actions/build/vite/optimize-deps.js +3 -3
- package/dist/actions/build/vite/optimize-deps.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-module-federation.js +8 -17
- package/dist/actions/build/vite/plugins/plugin-module-federation.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js.map +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js.map +1 -1
- package/dist/actions/deploy/deployPayload.js +0 -3
- package/dist/actions/deploy/deployPayload.js.map +1 -1
- package/dist/actions/deploy/deployWorkbenchApp.js +46 -4
- package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
- package/dist/actions/deploy/getWorkbench.js +4 -5
- package/dist/actions/deploy/getWorkbench.js.map +1 -1
- package/dist/actions/deploy/summarizeInterfaces.js +14 -10
- package/dist/actions/deploy/summarizeInterfaces.js.map +1 -1
- package/dist/actions/deploy/viewDeployment.js +17 -5
- package/dist/actions/deploy/viewDeployment.js.map +1 -1
- package/dist/actions/dev/deriveConfigs.js +9 -6
- package/dist/actions/dev/deriveConfigs.js.map +1 -1
- package/dist/actions/dev/exposesSetId.js +2 -2
- package/dist/actions/dev/exposesSetId.js.map +1 -1
- package/dist/actions/dev/registry.js +31 -25
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevManifestWatcher.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +35 -60
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +15 -33
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/writeWorkbenchRuntime.js +2 -2
- package/dist/actions/dev/writeWorkbenchRuntime.js.map +1 -1
- package/dist/actions/preview/serveBuiltApplication.js +1 -1
- package/dist/actions/preview/serveBuiltApplication.js.map +1 -1
- package/dist/actions/preview/startWorkbenchPreview.js +1 -1
- package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
- package/dist/actions/undeploy/workbenchUndeployAdapter.js +24 -33
- package/dist/actions/undeploy/workbenchUndeployAdapter.js.map +1 -1
- package/dist/appId.js +13 -9
- package/dist/appId.js.map +1 -1
- package/dist/applicationReference.js +12 -0
- package/dist/applicationReference.js.map +1 -0
- package/dist/contract.js +69 -31
- package/dist/contract.js.map +1 -1
- package/dist/defineApp.js +53 -63
- package/dist/defineApp.js.map +1 -1
- package/dist/defineView.js +3 -3
- package/dist/defineView.js.map +1 -1
- package/dist/deriveInterfaces.js +45 -19
- package/dist/deriveInterfaces.js.map +1 -1
- package/dist/renderDashboard.js +63 -0
- package/dist/renderDashboard.js.map +1 -0
- package/dist/resolveWorkbenchApp.js +13 -9
- package/dist/resolveWorkbenchApp.js.map +1 -1
- package/dist/resolveWorkbenchConfig.js +30 -0
- package/dist/resolveWorkbenchConfig.js.map +1 -0
- package/dist/services/applications.js +7 -1
- package/dist/services/applications.js.map +1 -1
- package/package.json +12 -6
- package/dist/_exports/contract-DyG11fQ7.d.ts +0 -45
- package/dist/_exports/defineApp-r_CmoZfS.d.ts +0 -169
- package/dist/_exports/resolveWorkbenchApp-DqFqET9E.d.ts +0 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export type {
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/index.ts"],"sourcesContent":["export type {\n AssetSourceView,\n DefineAssetSourceViewInput,\n DefinePanelViewInput,\n DefineTileViewInput,\n DefineWebWorkerInput,\n DefineWindowViewInput,\n DockGroup,\n PanelView,\n ServiceType,\n TileSize,\n TileView,\n ViewDeclaration,\n ViewSurface,\n WebWorker,\n WindowView,\n} from '../contract.js'\nexport {\n defineAssetSourceView,\n definePanelView,\n defineTileView,\n defineWebWorker,\n defineWindowView,\n} from '../contract.js'\nexport {\n defineApplication,\n isWorkbenchApp,\n isWorkbenchConfig,\n unstable_defineMediaLibrary,\n} from '../defineApp.js'\nexport type {\n DefineAppInput,\n DefineAppResult,\n DefineMediaLibraryInput,\n MediaLibraryField,\n WorkbenchApp,\n WorkbenchConfig,\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 AssetSourceComponent,\n AssetSourceViewComponents,\n DefinedView,\n PanelComponent,\n PanelViewComponents,\n PanelViewProps,\n TileComponent,\n TileViewComponents,\n TileViewProps,\n ViewComponentsBySurface,\n WindowViewProps,\n} from '../defineView.js'\n"],"names":["defineAssetSourceView","definePanelView","defineTileView","defineWebWorker","defineWindowView","defineApplication","isWorkbenchApp","isWorkbenchConfig","unstable_defineMediaLibrary","unstable_defineService","unstable_defineView"],"mappings":"AAiBA,SACEA,qBAAqB,EACrBC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,gBAAgB,QACX,iBAAgB;AACvB,SACEC,iBAAiB,EACjBC,cAAc,EACdC,iBAAiB,EACjBC,2BAA2B,QACtB,kBAAiB;AASxB,SAAQC,sBAAsB,QAAO,sBAAqB;AAO1D,SAAQC,mBAAmB,QAAO,mBAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DevServerManifest } from "./registry-
|
|
1
|
+
import { t as DevServerManifest } from "./registry-HE_dEHFa.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. */
|
|
@@ -14,12 +14,18 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
14
14
|
}, z.core.$strip>>>;
|
|
15
15
|
host: z.ZodMiniString<string>;
|
|
16
16
|
id: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
17
|
-
interfaces: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
17
|
+
interfaces: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniUnion<readonly [z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
|
|
18
18
|
metadata: z.ZodMiniNullable<z.ZodMiniObject<{
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
dock: z.ZodMiniObject<{
|
|
20
|
+
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
21
|
+
"dock.system": "dock.system";
|
|
22
|
+
"dock.applications": "dock.applications";
|
|
23
|
+
"dock.user": "dock.user";
|
|
24
|
+
}>>;
|
|
25
|
+
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
26
|
+
}, z.core.$strip>;
|
|
21
27
|
}, z.core.$strip>>;
|
|
22
|
-
|
|
28
|
+
surface: z.ZodMiniLiteral<"app">;
|
|
23
29
|
id: z.ZodMiniString<string>;
|
|
24
30
|
moduleId: z.ZodMiniString<string>;
|
|
25
31
|
name: z.ZodMiniString<string>;
|
|
@@ -27,8 +33,17 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
27
33
|
title: z.ZodMiniString<string>;
|
|
28
34
|
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
29
35
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
30
|
-
metadata: z.
|
|
31
|
-
|
|
36
|
+
metadata: z.ZodMiniNullable<z.ZodMiniObject<{
|
|
37
|
+
dock: z.ZodMiniObject<{
|
|
38
|
+
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
39
|
+
"dock.system": "dock.system";
|
|
40
|
+
"dock.applications": "dock.applications";
|
|
41
|
+
"dock.user": "dock.user";
|
|
42
|
+
}>>;
|
|
43
|
+
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
surface: z.ZodMiniLiteral<"panel">;
|
|
32
47
|
id: z.ZodMiniString<string>;
|
|
33
48
|
moduleId: z.ZodMiniString<string>;
|
|
34
49
|
name: z.ZodMiniString<string>;
|
|
@@ -37,7 +52,7 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
37
52
|
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
38
53
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
39
54
|
metadata: z.ZodMiniNull;
|
|
40
|
-
|
|
55
|
+
surface: z.ZodMiniLiteral<"asset_source">;
|
|
41
56
|
id: z.ZodMiniString<string>;
|
|
42
57
|
moduleId: z.ZodMiniString<string>;
|
|
43
58
|
name: z.ZodMiniString<string>;
|
|
@@ -46,21 +61,21 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
46
61
|
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
47
62
|
}, z.core.$strip>, z.ZodMiniObject<{
|
|
48
63
|
metadata: z.ZodMiniObject<{
|
|
49
|
-
|
|
64
|
+
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
50
65
|
size: z.ZodMiniEnum<{
|
|
51
66
|
small: "small";
|
|
52
67
|
large: "large";
|
|
53
68
|
banner: "banner";
|
|
54
69
|
}>;
|
|
55
70
|
}, z.core.$strip>;
|
|
56
|
-
|
|
71
|
+
surface: z.ZodMiniLiteral<"tile">;
|
|
57
72
|
id: z.ZodMiniString<string>;
|
|
58
73
|
moduleId: z.ZodMiniString<string>;
|
|
59
74
|
name: z.ZodMiniString<string>;
|
|
60
75
|
src: z.ZodMiniString<string>;
|
|
61
76
|
title: z.ZodMiniString<string>;
|
|
62
77
|
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
63
|
-
}, z.core.$strip>, z.ZodMiniObject<{
|
|
78
|
+
}, z.core.$strip>], "surface">, z.ZodMiniObject<{
|
|
64
79
|
metadata: z.ZodMiniNull;
|
|
65
80
|
type: z.ZodMiniLiteral<"worker">;
|
|
66
81
|
id: z.ZodMiniString<string>;
|
|
@@ -69,25 +84,33 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
69
84
|
src: z.ZodMiniString<string>;
|
|
70
85
|
title: z.ZodMiniString<string>;
|
|
71
86
|
version: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
72
|
-
}, z.core.$strip>]
|
|
87
|
+
}, z.core.$strip>]>>>;
|
|
73
88
|
manifest: z.ZodMiniOptional<z.ZodMiniUnion<readonly [z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>, z.ZodMiniObject<{
|
|
74
|
-
|
|
89
|
+
dock: z.ZodMiniOptional<z.ZodMiniObject<{
|
|
90
|
+
group: z.ZodMiniOptional<z.ZodMiniEnum<{
|
|
91
|
+
"dock.system": "dock.system";
|
|
92
|
+
"dock.applications": "dock.applications";
|
|
93
|
+
"dock.user": "dock.user";
|
|
94
|
+
}>>;
|
|
95
|
+
order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
75
97
|
icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
76
|
-
priority: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
|
|
77
98
|
slug: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
78
99
|
title: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
79
100
|
version: z.ZodMiniString<string>;
|
|
80
101
|
}, z.core.$strip>]>>;
|
|
81
102
|
manifestUpdatedAt: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
103
|
+
name: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
82
104
|
pid: z.ZodMiniNumber<number>;
|
|
83
105
|
port: z.ZodMiniNumber<number>;
|
|
84
106
|
projectId: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
107
|
+
reference: z.ZodMiniOptional<z.ZodMiniString<string>>;
|
|
85
108
|
startedAt: z.ZodMiniString<string>;
|
|
86
109
|
type: z.ZodMiniEnum<{
|
|
87
110
|
coreApp: "coreApp";
|
|
88
111
|
studio: "studio";
|
|
89
112
|
}>;
|
|
90
|
-
version: z.ZodMiniLiteral<
|
|
113
|
+
version: z.ZodMiniLiteral<2>;
|
|
91
114
|
workDir: z.ZodMiniString<string>;
|
|
92
115
|
}, z.core.$strip>;
|
|
93
116
|
/**
|
|
@@ -99,4 +122,4 @@ declare const devServerManifestSchema: z.ZodMiniObject<{
|
|
|
99
122
|
*/
|
|
100
123
|
type DevServerManifest = z.infer<typeof devServerManifestSchema>;
|
|
101
124
|
export { DevServerManifest as t };
|
|
102
|
-
//# sourceMappingURL=registry-
|
|
125
|
+
//# sourceMappingURL=registry-HE_dEHFa.d.ts.map
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { A as WorkbenchConfigValue, t as DefineAppInput } from "./defineApp-DldjQwq6.js";
|
|
2
|
+
import { AppVisibility, CliConfig } from "@sanity/cli-core";
|
|
3
|
+
/**
|
|
4
|
+
* Bundled so adding a declaration family touches this type and the artifact
|
|
5
|
+
* expanders, not every hop of build/dev plumbing in between. `config` is sourced
|
|
6
|
+
* from `resolveWorkbenchConfig` (a config is not an app), not from this resolver.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
interface WorkbenchExposes {
|
|
10
|
+
config?: WorkbenchConfigValue;
|
|
11
|
+
views?: DefineAppInput['views'];
|
|
12
|
+
webWorkers?: DefineAppInput['webWorkers'];
|
|
13
|
+
}
|
|
14
|
+
/** @public */
|
|
15
|
+
interface ResolvedWorkbenchApp {
|
|
16
|
+
/**
|
|
17
|
+
* Stable identity, distinct from the `slug` address. Defaults to `slug`, and is
|
|
18
|
+
* what every identity key (build id, interface ids) is built from.
|
|
19
|
+
*/
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/** Organization that owns the app — part of its build-id identity. */
|
|
22
|
+
readonly organizationId: string;
|
|
23
|
+
readonly slug: string;
|
|
24
|
+
/** Views the app declares. */
|
|
25
|
+
readonly views: NonNullable<DefineAppInput['views']>;
|
|
26
|
+
/** Background web workers the app declares. */
|
|
27
|
+
readonly webWorkers: NonNullable<DefineAppInput['webWorkers']>;
|
|
28
|
+
/** Resolved app kind — `studio` or one of the SDK app types. */
|
|
29
|
+
readonly applicationType?: string;
|
|
30
|
+
/** SDK app-view entrypoint, when declared. */
|
|
31
|
+
readonly entry?: string;
|
|
32
|
+
/** Path to the app's icon SVG, resolved and shipped to Brett on deploy. */
|
|
33
|
+
readonly icon?: string;
|
|
34
|
+
/** Dashboard visibility declared by the app; `undefined` when unset. */
|
|
35
|
+
readonly visibility?: AppVisibility;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the workbench app for a CLI config, or `null` for a plain project or a
|
|
39
|
+
* config (which is not an app — read it with `resolveWorkbenchConfig`).
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
declare function resolveWorkbenchApp(cliConfig: CliConfig | null | undefined): ResolvedWorkbenchApp | null;
|
|
43
|
+
/** @public */
|
|
44
|
+
interface ResolvedMediaLibraryConfig {
|
|
45
|
+
/** Target app the config binds to — resolves the org installation on deploy. */
|
|
46
|
+
readonly appType: WorkbenchConfigValue['appType'];
|
|
47
|
+
/** The config's declared fields, expanded into the federation remote on build. */
|
|
48
|
+
readonly fields: WorkbenchConfigValue['fields'];
|
|
49
|
+
/** Organization that owns the config's target installation. */
|
|
50
|
+
readonly organizationId: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the workbench config for a CLI config, or `null` when it carries no
|
|
54
|
+
* config brand (a plain project or an app). The only config today is the Media
|
|
55
|
+
* Library, so the resolved shape is a {@link ResolvedMediaLibraryConfig}.
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
declare function resolveWorkbenchConfig(cliConfig: CliConfig | null | undefined): ResolvedMediaLibraryConfig | null;
|
|
59
|
+
export { resolveWorkbenchApp as a, WorkbenchExposes as i, resolveWorkbenchConfig as n, ResolvedWorkbenchApp as r, ResolvedMediaLibraryConfig as t };
|
|
60
|
+
//# sourceMappingURL=resolveWorkbenchConfig-6iznHbED.d.ts.map
|
package/dist/_exports/{summarizeInterfaces-DBGiAwNT.d.ts → summarizeInterfaces-CjkeWwkY.d.ts}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as ViewSurface, b as ServiceType } from "./defineApp-DldjQwq6.js";
|
|
2
|
+
import { i as WorkbenchExposes, r as ResolvedWorkbenchApp } from "./resolveWorkbenchConfig-6iznHbED.js";
|
|
2
3
|
import { CliConfig } from "@sanity/cli-core";
|
|
3
4
|
import { z } from "zod/mini";
|
|
4
5
|
/**
|
|
@@ -14,6 +15,7 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<{
|
|
|
14
15
|
name: z.ZodMiniString<string>;
|
|
15
16
|
src: z.ZodMiniString<string>;
|
|
16
17
|
type: z.ZodMiniEnum<{
|
|
18
|
+
app: "app";
|
|
17
19
|
panel: "panel";
|
|
18
20
|
asset_source: "asset_source";
|
|
19
21
|
tile: "tile";
|
|
@@ -23,8 +25,8 @@ declare const viewDeploymentPayloadSchema: z.ZodMiniObject<{
|
|
|
23
25
|
type ViewDeploymentPayload = z.infer<typeof viewDeploymentPayloadSchema>;
|
|
24
26
|
interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
|
|
25
27
|
/**
|
|
26
|
-
* Throws when the app exposes nothing (no entry, view,
|
|
27
|
-
*
|
|
28
|
+
* Throws when the app exposes nothing (no entry, view, or service) — the
|
|
29
|
+
* remote would have nothing to load. Gated before any prompt or API call.
|
|
28
30
|
*/
|
|
29
31
|
assertDeployable(): void;
|
|
30
32
|
/**
|
|
@@ -32,31 +34,32 @@ interface DeployableWorkbenchApp extends ResolvedWorkbenchApp {
|
|
|
32
34
|
* Throws when a view declaration is malformed.
|
|
33
35
|
*/
|
|
34
36
|
buildViewDeploymentPayload(applicationId: string): ViewDeploymentPayload;
|
|
35
|
-
/**
|
|
36
|
-
* A singleton (the Media Library) that carries an config — deploy
|
|
37
|
-
* persists the config to the org's installation. Independent of the interfaces,
|
|
38
|
-
* which register regardless; non-singletons never carry a config.
|
|
39
|
-
*/
|
|
40
|
-
deploySingletonConfig: boolean;
|
|
41
37
|
/** Declares something to host as an application — an entry, view, or service. */
|
|
42
38
|
hasInterfaces: boolean;
|
|
43
39
|
}
|
|
44
40
|
declare function getWorkbench(cliConfig: CliConfig | null | undefined): DeployableWorkbenchApp | null;
|
|
45
|
-
|
|
46
|
-
interface DeployedInterface {
|
|
41
|
+
interface DeployedInterfaceBase {
|
|
47
42
|
name: string;
|
|
48
43
|
src: string;
|
|
49
44
|
title: string;
|
|
50
|
-
type: string;
|
|
51
45
|
}
|
|
46
|
+
/** A view as the deploy report and `--json` output surface it. */
|
|
47
|
+
interface DeployedView extends DeployedInterfaceBase {
|
|
48
|
+
surface: ViewSurface;
|
|
49
|
+
}
|
|
50
|
+
/** A web worker as the deploy report and `--json` output surface it. */
|
|
51
|
+
interface DeployedWebWorker extends DeployedInterfaceBase {
|
|
52
|
+
type: ServiceType;
|
|
53
|
+
}
|
|
54
|
+
type DeployedInterface = DeployedView | DeployedWebWorker;
|
|
52
55
|
/**
|
|
53
56
|
* One report line per non-empty group, alongside the records `--json` reports.
|
|
54
57
|
* @internal
|
|
55
58
|
*/
|
|
56
|
-
declare function summarizeInterfaces({
|
|
59
|
+
declare function summarizeInterfaces({ views, webWorkers }: WorkbenchExposes): {
|
|
57
60
|
lines: string[];
|
|
58
|
-
services:
|
|
59
|
-
views:
|
|
61
|
+
services: DeployedWebWorker[];
|
|
62
|
+
views: DeployedView[];
|
|
60
63
|
};
|
|
61
|
-
export {
|
|
62
|
-
//# sourceMappingURL=summarizeInterfaces-
|
|
64
|
+
export { DeployableWorkbenchApp as a, summarizeInterfaces as i, DeployedView as n, getWorkbench as o, DeployedWebWorker as r, DeployedInterface as t };
|
|
65
|
+
//# sourceMappingURL=summarizeInterfaces-CjkeWwkY.d.ts.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as ResolvedMediaLibraryConfig } from "./resolveWorkbenchConfig-6iznHbED.js";
|
|
2
|
+
import { a as DeployableWorkbenchApp, n as DeployedView, r as DeployedWebWorker } from "./summarizeInterfaces-CjkeWwkY.js";
|
|
2
3
|
import "node:zlib";
|
|
3
4
|
import { UndeployAdapter, UndeployApplicationTarget, UndeployConfigTarget } from "@sanity/cli-core/undeploy";
|
|
4
5
|
interface ConfigSnapshot {
|
|
@@ -10,23 +11,25 @@ interface ConfigSnapshot {
|
|
|
10
11
|
}
|
|
11
12
|
/** The workbench extension of the shared target; serializes into `--json` as-is. */
|
|
12
13
|
type WorkbenchUndeployTarget = (UndeployApplicationTarget & {
|
|
13
|
-
services:
|
|
14
|
-
views:
|
|
14
|
+
services: DeployedWebWorker[];
|
|
15
|
+
views: DeployedView[];
|
|
15
16
|
}) | (UndeployConfigTarget & {
|
|
16
17
|
configs: ConfigSnapshot[];
|
|
17
18
|
});
|
|
18
19
|
/**
|
|
19
|
-
* The undeploy adapter for workbench apps, mirroring what a
|
|
20
|
-
* creates:
|
|
21
|
-
* server soft-deletes its deployments and refuses singletons
|
|
22
|
-
* installations); a
|
|
23
|
-
*
|
|
20
|
+
* The undeploy adapter for workbench apps and configs, mirroring what a
|
|
21
|
+
* workbench deploy creates: an app that exposes interfaces deletes its Brett
|
|
22
|
+
* application (the server soft-deletes its deployments and refuses singletons
|
|
23
|
+
* with active installations); a config — the media library — deletes its
|
|
24
|
+
* installation's config snapshots instead. The two are severed at the source,
|
|
25
|
+
* so exactly one of `workbench`/`config` is supplied and the brand decides the path.
|
|
24
26
|
*/
|
|
25
27
|
declare function createWorkbenchUndeployAdapter(options: {
|
|
26
28
|
appId: string | undefined;
|
|
29
|
+
config?: ResolvedMediaLibraryConfig;
|
|
27
30
|
organizationId: string | undefined;
|
|
28
31
|
type: 'coreApp' | 'studio';
|
|
29
|
-
workbench
|
|
32
|
+
workbench?: DeployableWorkbenchApp;
|
|
30
33
|
}): UndeployAdapter<WorkbenchUndeployTarget>;
|
|
31
34
|
export { createWorkbenchUndeployAdapter };
|
|
32
35
|
//# sourceMappingURL=undeploy.d.ts.map
|
|
@@ -22,7 +22,7 @@ import { viewArtifacts } from './views/artifact.js';
|
|
|
22
22
|
*/ export function workbenchArtifacts(exposes) {
|
|
23
23
|
return [
|
|
24
24
|
...viewArtifacts(exposes.views ?? []),
|
|
25
|
-
...serviceArtifacts(exposes.
|
|
25
|
+
...serviceArtifacts(exposes.webWorkers ?? []),
|
|
26
26
|
...configArtifacts(exposes.config)
|
|
27
27
|
];
|
|
28
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/build/artifact.ts"],"sourcesContent":["import {type WorkbenchExposes} from '../../resolveWorkbenchApp.js'\nimport {configArtifacts} from './configs/artifact.js'\nimport {serviceArtifacts} from './services/artifact.js'\nimport {viewArtifacts} from './views/artifact.js'\n\n/**\n * What a {@link GeneratedArtifact.source} builder receives from the build — the\n * one thing it can't compute on its own, since only the build knows where the\n * runtime dir sits relative to the app's `src`.\n */\ninterface ArtifactContext {\n /** Import specifier for an app `src` file, relative to this artifact. */\n resolveImport: (src: string) => string\n}\n\n/**\n * One file the federation build generates into the runtime dir for a declared\n * interface. Each interface type — views,
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/build/artifact.ts"],"sourcesContent":["import {type WorkbenchExposes} from '../../resolveWorkbenchApp.js'\nimport {configArtifacts} from './configs/artifact.js'\nimport {serviceArtifacts} from './services/artifact.js'\nimport {viewArtifacts} from './views/artifact.js'\n\n/**\n * What a {@link GeneratedArtifact.source} builder receives from the build — the\n * one thing it can't compute on its own, since only the build knows where the\n * runtime dir sits relative to the app's `src`.\n */\ninterface ArtifactContext {\n /** Import specifier for an app `src` file, relative to this artifact. */\n resolveImport: (src: string) => string\n}\n\n/**\n * One file the federation build generates into the runtime dir for a declared\n * interface. Each interface type — views, web workers — expands its declarations\n * into a flat list of these; the build then writes them and maps the ones the\n * host loads directly into the module-federation manifest.\n *\n * Adding an interface type is adding a builder that returns\n * `GeneratedArtifact[]` — the write loop and the expose mapping never change.\n */\nexport interface GeneratedArtifact {\n /** Path relative to the federation runtime dir, e.g. `views/feed/panel.js`. */\n path: string\n /** Build the file's contents. */\n source: (context: ArtifactContext) => string\n\n /**\n * Module-federation expose key when the host loads this artifact directly —\n * a view component `./views/feed/panel`, a service loader `./services/unread`.\n * Omitted for a file the host never loads on its own, like a worker bundle\n * (reached through its sibling loader).\n */\n expose?: string\n}\n\n/**\n * Map the artifacts the host loads directly (those with an `expose`) to their\n * runtime-dir paths, for the module-federation `exposes` field. `toExposePath`\n * turns a runtime-relative artifact path into the value federation wants — the\n * caller owns the runtime-dir location and any entry resolution.\n */\nexport function artifactExposes(\n artifacts: readonly GeneratedArtifact[],\n toExposePath: (artifactPath: string) => string,\n): Record<string, string> {\n const exposes: Record<string, string> = {}\n for (const artifact of artifacts) {\n if (artifact.expose) {\n exposes[artifact.expose] = toExposePath(artifact.path)\n }\n }\n return exposes\n}\n\n/**\n * Expand what the app exposes into the flat artifact set the federation build\n * writes — the single place that composes the per-type expanders, so the expose\n * mapping and the file writing read from one expansion.\n */\nexport function workbenchArtifacts(exposes: WorkbenchExposes): GeneratedArtifact[] {\n return [\n ...viewArtifacts(exposes.views ?? []),\n ...serviceArtifacts(exposes.webWorkers ?? []),\n ...configArtifacts(exposes.config),\n ]\n}\n"],"names":["configArtifacts","serviceArtifacts","viewArtifacts","artifactExposes","artifacts","toExposePath","exposes","artifact","expose","path","workbenchArtifacts","views","webWorkers","config"],"mappings":"AACA,SAAQA,eAAe,QAAO,wBAAuB;AACrD,SAAQC,gBAAgB,QAAO,yBAAwB;AACvD,SAAQC,aAAa,QAAO,sBAAqB;AAoCjD;;;;;CAKC,GACD,OAAO,SAASC,gBACdC,SAAuC,EACvCC,YAA8C;IAE9C,MAAMC,UAAkC,CAAC;IACzC,KAAK,MAAMC,YAAYH,UAAW;QAChC,IAAIG,SAASC,MAAM,EAAE;YACnBF,OAAO,CAACC,SAASC,MAAM,CAAC,GAAGH,aAAaE,SAASE,IAAI;QACvD;IACF;IACA,OAAOH;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASI,mBAAmBJ,OAAyB;IAC1D,OAAO;WACFJ,cAAcI,QAAQK,KAAK,IAAI,EAAE;WACjCV,iBAAiBK,QAAQM,UAAU,IAAI,EAAE;WACzCZ,gBAAgBM,QAAQO,MAAM;KAClC;AACH"}
|
|
@@ -12,7 +12,7 @@ import { renderRemote } from '../render-remote.js';
|
|
|
12
12
|
*/ export function viewArtifacts(views) {
|
|
13
13
|
const artifacts = [];
|
|
14
14
|
for (const view of views){
|
|
15
|
-
for (const component of VIEW_COMPONENTS[view.
|
|
15
|
+
for (const component of VIEW_COMPONENTS[view.surface]){
|
|
16
16
|
artifacts.push({
|
|
17
17
|
expose: `./${VIEWS_DIR_NAME}/${view.name}/${component}`,
|
|
18
18
|
path: `${VIEWS_DIR_NAME}/${view.name}/${component}.js`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/views/artifact.ts"],"sourcesContent":["import {type
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/views/artifact.ts"],"sourcesContent":["import {VIEW_COMPONENTS, type ViewSurface} from '../../../contract.js'\nimport {type GeneratedArtifact} from '../artifact.js'\nimport {renderRemote} from '../render-remote.js'\n\n/** Subdirectory under the federation runtime dir where view artifacts are written. */\nconst VIEWS_DIR_NAME = 'views'\n\n/**\n * An interface to generate render artifacts for. The `src` file default-exports\n * an `unstable_defineView(...)` result; the build emits one render-contract\n * artifact per component the view surface exposes.\n * @internal\n */\nexport interface InterfaceArtifact {\n /** Interface name, unique within the app. */\n name: string\n /** Path to the interface `src` file, relative to the app root (or absolute). */\n src: string\n /** Selects which components the build expands. */\n surface: ViewSurface\n}\n\n/**\n * Expand each view into one generated artifact per component it exposes. A\n * panel's `title` and `panel` each become their own render-contract module and\n * module-federation expose, so the host renders each as an independent island.\n *\n * Each artifact binds its component as the `App` the render contract renders —\n * a single-component view exports a bare function, a multi-component one keys by\n * name — behind an HMR boundary so view edits re-render through the new module.\n */\nexport function viewArtifacts(views: readonly InterfaceArtifact[]): GeneratedArtifact[] {\n const artifacts: GeneratedArtifact[] = []\n for (const view of views) {\n for (const component of VIEW_COMPONENTS[view.surface]) {\n artifacts.push({\n expose: `./${VIEWS_DIR_NAME}/${view.name}/${component}`,\n path: `${VIEWS_DIR_NAME}/${view.name}/${component}.js`,\n source: ({resolveImport}) =>\n renderRemote({\n app: `typeof view.components === 'function' ? view.components : view.components[${JSON.stringify(component)}]`,\n hmr: true,\n preamble: `import view from ${JSON.stringify(resolveImport(view.src))}`,\n version: `view.version`,\n }),\n })\n }\n }\n return artifacts\n}\n"],"names":["VIEW_COMPONENTS","renderRemote","VIEWS_DIR_NAME","viewArtifacts","views","artifacts","view","component","surface","push","expose","name","path","source","resolveImport","app","JSON","stringify","hmr","preamble","src","version"],"mappings":"AAAA,SAAQA,eAAe,QAAyB,uBAAsB;AAEtE,SAAQC,YAAY,QAAO,sBAAqB;AAEhD,oFAAoF,GACpF,MAAMC,iBAAiB;AAiBvB;;;;;;;;CAQC,GACD,OAAO,SAASC,cAAcC,KAAmC;IAC/D,MAAMC,YAAiC,EAAE;IACzC,KAAK,MAAMC,QAAQF,MAAO;QACxB,KAAK,MAAMG,aAAaP,eAAe,CAACM,KAAKE,OAAO,CAAC,CAAE;YACrDH,UAAUI,IAAI,CAAC;gBACbC,QAAQ,CAAC,EAAE,EAAER,eAAe,CAAC,EAAEI,KAAKK,IAAI,CAAC,CAAC,EAAEJ,WAAW;gBACvDK,MAAM,GAAGV,eAAe,CAAC,EAAEI,KAAKK,IAAI,CAAC,CAAC,EAAEJ,UAAU,GAAG,CAAC;gBACtDM,QAAQ,CAAC,EAACC,aAAa,EAAC,GACtBb,aAAa;wBACXc,KAAK,CAAC,0EAA0E,EAAEC,KAAKC,SAAS,CAACV,WAAW,CAAC,CAAC;wBAC9GW,KAAK;wBACLC,UAAU,CAAC,iBAAiB,EAAEH,KAAKC,SAAS,CAACH,cAAcR,KAAKc,GAAG,IAAI;wBACvEC,SAAS,CAAC,YAAY,CAAC;oBACzB;YACJ;QACF;IACF;IACA,OAAOhB;AACT"}
|
|
@@ -39,7 +39,7 @@ import path from 'node:path';
|
|
|
39
39
|
*
|
|
40
40
|
* Vite's dep scanner crawls from the app's HTML entry, which reaches only the
|
|
41
41
|
* app's `entry` (or a studio's config) — never the federation `exposes` (dock
|
|
42
|
-
* views,
|
|
42
|
+
* views, web workers, media-library config fields), which the host loads
|
|
43
43
|
* dynamically at runtime. So a dep imported only by an exposed module (e.g.
|
|
44
44
|
* `sanity/workbench` in a service or view) escapes the startup scan; Vite
|
|
45
45
|
* discovers it on first request, re-optimizes, and full-page reloads — which
|
|
@@ -55,13 +55,13 @@ import path from 'node:path';
|
|
|
55
55
|
*
|
|
56
56
|
* @param cwd - Project root; `entries` are returned relative to it.
|
|
57
57
|
* @param appSources - Absolute paths to the app's `entry` and/or studio config.
|
|
58
|
-
* @param exposes - The app's declared views/
|
|
58
|
+
* @param exposes - The app's declared views/web workers/config.
|
|
59
59
|
* @internal
|
|
60
60
|
*/ export function workbenchOptimizeDeps(options) {
|
|
61
61
|
const { appSources, cwd, exposes } = options;
|
|
62
62
|
const interfaceSources = [
|
|
63
63
|
...(exposes?.views ?? []).map((view)=>view.src),
|
|
64
|
-
...(exposes?.
|
|
64
|
+
...(exposes?.webWorkers ?? []).map((webWorker)=>webWorker.src),
|
|
65
65
|
...(exposes?.config?.fields ?? []).map((field)=>field.src)
|
|
66
66
|
].map((src)=>path.resolve(cwd, src));
|
|
67
67
|
const entries = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/vite/optimize-deps.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\n\n/**\n * React APIs only the generated render-contract modules import — the SPA\n * bootstrap (`getEntryModule`) and every render artifact (`renderRemote`)\n * `createRoot` from `react-dom/client` and `createElement` from `react`. No\n * app/interface source imports `react-dom/client` itself, so scanning `entries`\n * never surfaces it; every workbench app depends on react/react-dom, so both\n * always resolve.\n */\nconst RENDER_CONTRACT_DEPS = ['react', 'react-dom/client']\n\n/** Extensions an import-style source path may omit, in resolution order. */\nconst SOURCE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs']\n\n/**\n * Resolve an import-style source path to the file on disk. The app `entry`\n * defaults to the extensionless `./src/App` (and a user may omit the extension\n * anywhere), which the runtime imports fine through Vite's resolver — but\n * `optimizeDeps.entries` is matched against the filesystem, so an extensionless\n * path never matches and its deps go unscanned. Try the path as-is, then the\n * common source extensions; fall back to the input so an already-resolved path\n * (or a genuinely missing one) passes through unchanged.\n */\nfunction resolveSourceFile(absPath: string): string {\n if (fs.existsSync(absPath) && fs.statSync(absPath).isFile()) return absPath\n for (const extension of SOURCE_EXTENSIONS) {\n if (fs.existsSync(`${absPath}${extension}`)) return `${absPath}${extension}`\n }\n return absPath\n}\n\n/**\n * Dep pre-bundling inputs for a workbench app's dev server.\n *\n * Vite's dep scanner crawls from the app's HTML entry, which reaches only the\n * app's `entry` (or a studio's config) — never the federation `exposes` (dock\n * views,
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/vite/optimize-deps.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\n\n/**\n * React APIs only the generated render-contract modules import — the SPA\n * bootstrap (`getEntryModule`) and every render artifact (`renderRemote`)\n * `createRoot` from `react-dom/client` and `createElement` from `react`. No\n * app/interface source imports `react-dom/client` itself, so scanning `entries`\n * never surfaces it; every workbench app depends on react/react-dom, so both\n * always resolve.\n */\nconst RENDER_CONTRACT_DEPS = ['react', 'react-dom/client']\n\n/** Extensions an import-style source path may omit, in resolution order. */\nconst SOURCE_EXTENSIONS = ['.tsx', '.ts', '.jsx', '.js', '.mjs', '.cjs']\n\n/**\n * Resolve an import-style source path to the file on disk. The app `entry`\n * defaults to the extensionless `./src/App` (and a user may omit the extension\n * anywhere), which the runtime imports fine through Vite's resolver — but\n * `optimizeDeps.entries` is matched against the filesystem, so an extensionless\n * path never matches and its deps go unscanned. Try the path as-is, then the\n * common source extensions; fall back to the input so an already-resolved path\n * (or a genuinely missing one) passes through unchanged.\n */\nfunction resolveSourceFile(absPath: string): string {\n if (fs.existsSync(absPath) && fs.statSync(absPath).isFile()) return absPath\n for (const extension of SOURCE_EXTENSIONS) {\n if (fs.existsSync(`${absPath}${extension}`)) return `${absPath}${extension}`\n }\n return absPath\n}\n\n/**\n * Dep pre-bundling inputs for a workbench app's dev server.\n *\n * Vite's dep scanner crawls from the app's HTML entry, which reaches only the\n * app's `entry` (or a studio's config) — never the federation `exposes` (dock\n * views, web workers, media-library config fields), which the host loads\n * dynamically at runtime. So a dep imported only by an exposed module (e.g.\n * `sanity/workbench` in a service or view) escapes the startup scan; Vite\n * discovers it on first request, re-optimizes, and full-page reloads — which\n * flakes Playwright in e2e.\n *\n * Point `entries` at the source of every interface: the app `entry` (or, for a\n * studio, its config), plus each view, service, and installation-config source.\n * `entries` follows real import statements, so it covers whatever those sources\n * transitively use — correct subpaths and all — with no hand-maintained dep\n * list, and never crashes on an unresolvable name the way a bad `include` entry\n * does. Each source is resolved to its on-disk file so an extensionless path\n * (like the default `./src/App`) still matches `entries`' filesystem glob.\n *\n * @param cwd - Project root; `entries` are returned relative to it.\n * @param appSources - Absolute paths to the app's `entry` and/or studio config.\n * @param exposes - The app's declared views/web workers/config.\n * @internal\n */\nexport function workbenchOptimizeDeps(options: {\n appSources: readonly string[]\n cwd: string\n exposes?: WorkbenchExposes\n}): {entries: string[]; include: string[]} {\n const {appSources, cwd, exposes} = options\n\n const interfaceSources = [\n ...(exposes?.views ?? []).map((view) => view.src),\n ...(exposes?.webWorkers ?? []).map((webWorker) => webWorker.src),\n ...(exposes?.config?.fields ?? []).map((field) => field.src),\n ].map((src) => path.resolve(cwd, src))\n\n const entries = [...appSources, ...interfaceSources].map((absPath) => {\n const resolved = resolveSourceFile(absPath)\n return path.relative(cwd, resolved).split(path.sep).join('/')\n })\n\n return {\n entries: [...new Set(entries)],\n include: [...RENDER_CONTRACT_DEPS],\n }\n}\n"],"names":["fs","path","RENDER_CONTRACT_DEPS","SOURCE_EXTENSIONS","resolveSourceFile","absPath","existsSync","statSync","isFile","extension","workbenchOptimizeDeps","options","appSources","cwd","exposes","interfaceSources","views","map","view","src","webWorkers","webWorker","config","fields","field","resolve","entries","resolved","relative","split","sep","join","Set","include"],"mappings":"AAAA,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAI5B;;;;;;;CAOC,GACD,MAAMC,uBAAuB;IAAC;IAAS;CAAmB;AAE1D,0EAA0E,GAC1E,MAAMC,oBAAoB;IAAC;IAAQ;IAAO;IAAQ;IAAO;IAAQ;CAAO;AAExE;;;;;;;;CAQC,GACD,SAASC,kBAAkBC,OAAe;IACxC,IAAIL,GAAGM,UAAU,CAACD,YAAYL,GAAGO,QAAQ,CAACF,SAASG,MAAM,IAAI,OAAOH;IACpE,KAAK,MAAMI,aAAaN,kBAAmB;QACzC,IAAIH,GAAGM,UAAU,CAAC,GAAGD,UAAUI,WAAW,GAAG,OAAO,GAAGJ,UAAUI,WAAW;IAC9E;IACA,OAAOJ;AACT;AAEA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASK,sBAAsBC,OAIrC;IACC,MAAM,EAACC,UAAU,EAAEC,GAAG,EAAEC,OAAO,EAAC,GAAGH;IAEnC,MAAMI,mBAAmB;WACpB,AAACD,CAAAA,SAASE,SAAS,EAAE,AAAD,EAAGC,GAAG,CAAC,CAACC,OAASA,KAAKC,GAAG;WAC7C,AAACL,CAAAA,SAASM,cAAc,EAAE,AAAD,EAAGH,GAAG,CAAC,CAACI,YAAcA,UAAUF,GAAG;WAC5D,AAACL,CAAAA,SAASQ,QAAQC,UAAU,EAAE,AAAD,EAAGN,GAAG,CAAC,CAACO,QAAUA,MAAML,GAAG;KAC5D,CAACF,GAAG,CAAC,CAACE,MAAQlB,KAAKwB,OAAO,CAACZ,KAAKM;IAEjC,MAAMO,UAAU;WAAId;WAAeG;KAAiB,CAACE,GAAG,CAAC,CAACZ;QACxD,MAAMsB,WAAWvB,kBAAkBC;QACnC,OAAOJ,KAAK2B,QAAQ,CAACf,KAAKc,UAAUE,KAAK,CAAC5B,KAAK6B,GAAG,EAAEC,IAAI,CAAC;IAC3D;IAEA,OAAO;QACLL,SAAS;eAAI,IAAIM,IAAIN;SAAS;QAC9BO,SAAS;eAAI/B;SAAqB;IACpC;AACF"}
|
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
import { federation as moduleFederation } from '@module-federation/vite';
|
|
2
|
-
import { FEDERATION_DIR_NAME
|
|
2
|
+
import { FEDERATION_DIR_NAME } from '../constants.js';
|
|
3
3
|
export function sanityModuleFederation({ exposes, name }) {
|
|
4
4
|
const mfPlugins = moduleFederation({
|
|
5
5
|
dev: {
|
|
6
6
|
disableDynamicRemoteTypeHints: true,
|
|
7
7
|
remoteHmr: true
|
|
8
8
|
},
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
// worked around, declaration emit pulls in the user's own modules, which
|
|
14
|
-
// are noEmit projects never written to be declaration-emittable: TS2742
|
|
15
|
-
// (non-portable inferred types, endemic under pnpm) and TS4082 (private
|
|
16
|
-
// names in default exports) then fail the compile just the same.
|
|
17
|
-
dts: {
|
|
18
|
-
generateTypes: false
|
|
19
|
-
},
|
|
9
|
+
// Fully off (`false`, not `{generateTypes: false}`) so the dts plugin's
|
|
10
|
+
// dev worker and broker never load — left on, they crash `sanity dev` on
|
|
11
|
+
// Ctrl-C by sending on a still-CONNECTING websocket.
|
|
12
|
+
dts: false,
|
|
20
13
|
exposes,
|
|
21
|
-
filename: `${FEDERATION_FILE_NAME}.js`,
|
|
22
14
|
manifest: true,
|
|
23
15
|
name,
|
|
24
16
|
// Resolves the remote entry path relative to the manifest rather than the
|
|
@@ -32,10 +24,9 @@ export function sanityModuleFederation({ exposes, name }) {
|
|
|
32
24
|
// federation runtime, so we opt out of auto-share entirely.
|
|
33
25
|
shared: {}
|
|
34
26
|
});
|
|
35
|
-
// module-federation
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
// every actual plugin gets scoped.
|
|
27
|
+
// module-federation can deliver a plugin as a Promise resolving to an array;
|
|
28
|
+
// spreading a promise (or an array) yields a junk object that silently drops
|
|
29
|
+
// it. Recurse through the PluginOption shape so every actual plugin gets scoped.
|
|
39
30
|
const scopeToEnvironment = (option)=>{
|
|
40
31
|
if (!option) return option;
|
|
41
32
|
if (option instanceof Promise) return option.then((resolved)=>scopeToEnvironment(resolved));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-module-federation.ts"],"sourcesContent":["import {federation as moduleFederation, type ModuleFederationOptions} from '@module-federation/vite'\nimport {type Plugin, type PluginOption} from 'vite'\n\nimport {FEDERATION_DIR_NAME
|
|
1
|
+
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-module-federation.ts"],"sourcesContent":["import {federation as moduleFederation, type ModuleFederationOptions} from '@module-federation/vite'\nimport {type Plugin, type PluginOption} from 'vite'\n\nimport {FEDERATION_DIR_NAME} from '../constants.js'\n\n/**\n * @internal\n */\nexport interface FederationOptions extends Pick<ModuleFederationOptions, 'exposes'> {\n /**\n * namespace of the federation build, used as the global variable name for the exposed modules\n * e.g `@acme/studio` would then allow you to import modules like `import (\"@acme/studio/Button\")`\n * defaults to your package.json name if not provided.\n */\n name: string\n}\n\nexport function sanityModuleFederation({exposes, name}: FederationOptions): PluginOption {\n const mfPlugins = moduleFederation({\n dev: {\n disableDynamicRemoteTypeHints: true,\n remoteHmr: true,\n },\n // Fully off (`false`, not `{generateTypes: false}`) so the dts plugin's\n // dev worker and broker never load — left on, they crash `sanity dev` on\n // Ctrl-C by sending on a still-CONNECTING websocket.\n dts: false,\n exposes,\n manifest: true,\n name,\n // Resolves the remote entry path relative to the manifest rather than the\n // host origin.\n publicPath: 'auto',\n // @module-federation/vite auto-shares every package.json dependency\n // that exposes an `exports` field. That breaks for workspace packages with\n // subpath-only exports (no `.` entry) like `@sanity/cli-build` and\n // `@sanity/workbench`, because vite tries to resolve them as bare imports\n // and fails. Workbench remotes manage runtime sharing through the host's\n // federation runtime, so we opt out of auto-share entirely.\n shared: {},\n })\n\n // module-federation can deliver a plugin as a Promise resolving to an array;\n // spreading a promise (or an array) yields a junk object that silently drops\n // it. Recurse through the PluginOption shape so every actual plugin gets scoped.\n const scopeToEnvironment = (option: PluginOption): PluginOption => {\n if (!option) return option\n if (option instanceof Promise) return option.then((resolved) => scopeToEnvironment(resolved))\n if (Array.isArray(option)) return option.map((entry) => scopeToEnvironment(entry))\n return {\n ...option,\n // In dev, MF must run on client — the dev server serves through it.\n // In build, scope to the federation environment to keep the library build clean.\n applyToEnvironment: (env) =>\n env.config.command === 'serve' || env.name === FEDERATION_DIR_NAME,\n } satisfies Plugin\n }\n\n return mfPlugins.map((plugin: PluginOption) => scopeToEnvironment(plugin))\n}\n"],"names":["federation","moduleFederation","FEDERATION_DIR_NAME","sanityModuleFederation","exposes","name","mfPlugins","dev","disableDynamicRemoteTypeHints","remoteHmr","dts","manifest","publicPath","shared","scopeToEnvironment","option","Promise","then","resolved","Array","isArray","map","entry","applyToEnvironment","env","config","command","plugin"],"mappings":"AAAA,SAAQA,cAAcC,gBAAgB,QAAqC,0BAAyB;AAGpG,SAAQC,mBAAmB,QAAO,kBAAiB;AAcnD,OAAO,SAASC,uBAAuB,EAACC,OAAO,EAAEC,IAAI,EAAoB;IACvE,MAAMC,YAAYL,iBAAiB;QACjCM,KAAK;YACHC,+BAA+B;YAC/BC,WAAW;QACb;QACA,wEAAwE;QACxE,yEAAyE;QACzE,qDAAqD;QACrDC,KAAK;QACLN;QACAO,UAAU;QACVN;QACA,0EAA0E;QAC1E,eAAe;QACfO,YAAY;QACZ,oEAAoE;QACpE,2EAA2E;QAC3E,mEAAmE;QACnE,0EAA0E;QAC1E,yEAAyE;QACzE,4DAA4D;QAC5DC,QAAQ,CAAC;IACX;IAEA,6EAA6E;IAC7E,6EAA6E;IAC7E,iFAAiF;IACjF,MAAMC,qBAAqB,CAACC;QAC1B,IAAI,CAACA,QAAQ,OAAOA;QACpB,IAAIA,kBAAkBC,SAAS,OAAOD,OAAOE,IAAI,CAAC,CAACC,WAAaJ,mBAAmBI;QACnF,IAAIC,MAAMC,OAAO,CAACL,SAAS,OAAOA,OAAOM,GAAG,CAAC,CAACC,QAAUR,mBAAmBQ;QAC3E,OAAO;YACL,GAAGP,MAAM;YACT,oEAAoE;YACpE,iFAAiF;YACjFQ,oBAAoB,CAACC,MACnBA,IAAIC,MAAM,CAACC,OAAO,KAAK,WAAWF,IAAInB,IAAI,KAAKH;QACnD;IACF;IAEA,OAAOI,UAAUe,GAAG,CAAC,CAACM,SAAyBb,mBAAmBa;AACpE"}
|
|
@@ -24,7 +24,7 @@ const HEADLESS_APP_ENTRY = `\
|
|
|
24
24
|
// This file is auto-generated on 'sanity dev'
|
|
25
25
|
// Modifications to this file are automatically discarded
|
|
26
26
|
// This application declares no app view (no \`entry\`): it isn't navigable as a
|
|
27
|
-
// full-page app, only its panels/
|
|
27
|
+
// full-page app, only its panels/web workers are exposed.
|
|
28
28
|
export function render() {
|
|
29
29
|
throw new Error('This application has no app view: it declares no \`entry\`.')
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-federation-runtime.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport {type EnvironmentModuleNode, type Plugin} from 'vite'\n\nimport {renderRemote} from '../../render-remote.js'\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from '../constants.js'\n\nconst REMOTE_ENTRY_FILE = `${FEDERATION_FILE_NAME}.jsx`\n\n// The studio wraps `Studio` with the user's config; HMR re-renders through the\n// new module so a config edit takes effect.\nconst STUDIO_ENTRY = renderRemote({\n app: `(props) => createElement(Studio, { config, ...props })`,\n hmr: true,\n preamble: `import { Studio } from 'sanity'\nimport config from %STUDIO_CONFIG%`,\n})\n\n// An SDK app's default export is the component; it Fast-Refreshes through its\n// own dev server, so the wrapper needs no HMR boundary.\nconst APP_ENTRY = renderRemote({preamble: `import App from %APP_ENTRY%`})\n\n// A branded app that declares no `entry` (e.g. a dock-only panel/worker app)\n// has no navigable full-page view, so there's no `App` to import. The runtime\n// still needs a valid module for the federation build input, but it exposes no\n// `./App` (see `plugin.ts`) — its `render` is unreachable and throws if reached.\nconst HEADLESS_APP_ENTRY = `\\\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file are automatically discarded\n// This application declares no app view (no \\`entry\\`): it isn't navigable as a\n// full-page app, only its panels/
|
|
1
|
+
{"version":3,"sources":["../../../../../src/actions/build/vite/plugins/plugin-sanity-federation-runtime.ts"],"sourcesContent":["import fs from 'node:fs'\nimport path from 'node:path'\n\nimport {type EnvironmentModuleNode, type Plugin} from 'vite'\n\nimport {renderRemote} from '../../render-remote.js'\nimport {FEDERATION_FILE_NAME, RUNTIME_DIR} from '../constants.js'\n\nconst REMOTE_ENTRY_FILE = `${FEDERATION_FILE_NAME}.jsx`\n\n// The studio wraps `Studio` with the user's config; HMR re-renders through the\n// new module so a config edit takes effect.\nconst STUDIO_ENTRY = renderRemote({\n app: `(props) => createElement(Studio, { config, ...props })`,\n hmr: true,\n preamble: `import { Studio } from 'sanity'\nimport config from %STUDIO_CONFIG%`,\n})\n\n// An SDK app's default export is the component; it Fast-Refreshes through its\n// own dev server, so the wrapper needs no HMR boundary.\nconst APP_ENTRY = renderRemote({preamble: `import App from %APP_ENTRY%`})\n\n// A branded app that declares no `entry` (e.g. a dock-only panel/worker app)\n// has no navigable full-page view, so there's no `App` to import. The runtime\n// still needs a valid module for the federation build input, but it exposes no\n// `./App` (see `plugin.ts`) — its `render` is unreachable and throws if reached.\nconst HEADLESS_APP_ENTRY = `\\\n// This file is auto-generated on 'sanity dev'\n// Modifications to this file are automatically discarded\n// This application declares no app view (no \\`entry\\`): it isn't navigable as a\n// full-page app, only its panels/web workers are exposed.\nexport function render() {\n throw new Error('This application has no app view: it declares no \\`entry\\`.')\n}\n`\n\nexport type FederationRuntimeOptions =\n | {appEntry?: string; isApp: true}\n | {isApp: false; studioConfigPath: string}\n\nexport function sanityFederationRuntime(options: FederationRuntimeOptions): Plugin {\n let content: string\n if (options.isApp) {\n content = options.appEntry\n ? APP_ENTRY.replace(/%APP_ENTRY%/, JSON.stringify(options.appEntry))\n : HEADLESS_APP_ENTRY\n } else {\n content = STUDIO_ENTRY.replace(/%STUDIO_CONFIG%/, JSON.stringify(options.studioConfigPath))\n }\n\n let entryFileAbsPath = ''\n\n return {\n configResolved(config) {\n const dir = path.resolve(config.root, RUNTIME_DIR)\n entryFileAbsPath = path.join(dir, REMOTE_ENTRY_FILE)\n\n fs.mkdirSync(dir, {recursive: true})\n fs.writeFileSync(entryFileAbsPath, content)\n },\n hotUpdate({file, modules, timestamp}) {\n if (options.isApp) return\n if (this.environment.name !== 'client') return\n\n const {moduleGraph} = this.environment\n const studioMods = moduleGraph.getModulesByFile(entryFileAbsPath)\n if (!studioMods?.size) return\n\n // Is the changed file reachable from the studio entry?\n const visited = new Set<EnvironmentModuleNode>()\n const queue: EnvironmentModuleNode[] = [...studioMods]\n while (queue.length > 0) {\n const mod = queue.pop()!\n if (visited.has(mod)) continue\n visited.add(mod)\n if (mod.file === file) {\n // The walk from `file` up through importers dead-ends at federation\n // gaps, so invalidate changed modules ourselves and route HMR to the\n // self-accepting studio entry.\n const seen = new Set<EnvironmentModuleNode>()\n for (const m of modules) {\n moduleGraph.invalidateModule(m, seen, timestamp, true)\n }\n return [...studioMods]\n }\n for (const dep of mod.importedModules) queue.push(dep)\n }\n },\n name: 'sanity/federation-runtime',\n }\n}\n"],"names":["fs","path","renderRemote","FEDERATION_FILE_NAME","RUNTIME_DIR","REMOTE_ENTRY_FILE","STUDIO_ENTRY","app","hmr","preamble","APP_ENTRY","HEADLESS_APP_ENTRY","sanityFederationRuntime","options","content","isApp","appEntry","replace","JSON","stringify","studioConfigPath","entryFileAbsPath","configResolved","config","dir","resolve","root","join","mkdirSync","recursive","writeFileSync","hotUpdate","file","modules","timestamp","environment","name","moduleGraph","studioMods","getModulesByFile","size","visited","Set","queue","length","mod","pop","has","add","seen","m","invalidateModule","dep","importedModules","push"],"mappings":"AAAA,OAAOA,QAAQ,UAAS;AACxB,OAAOC,UAAU,YAAW;AAI5B,SAAQC,YAAY,QAAO,yBAAwB;AACnD,SAAQC,oBAAoB,EAAEC,WAAW,QAAO,kBAAiB;AAEjE,MAAMC,oBAAoB,GAAGF,qBAAqB,IAAI,CAAC;AAEvD,+EAA+E;AAC/E,4CAA4C;AAC5C,MAAMG,eAAeJ,aAAa;IAChCK,KAAK,CAAC,sDAAsD,CAAC;IAC7DC,KAAK;IACLC,UAAU,CAAC;kCACqB,CAAC;AACnC;AAEA,8EAA8E;AAC9E,wDAAwD;AACxD,MAAMC,YAAYR,aAAa;IAACO,UAAU,CAAC,2BAA2B,CAAC;AAAA;AAEvE,6EAA6E;AAC7E,8EAA8E;AAC9E,+EAA+E;AAC/E,iFAAiF;AACjF,MAAME,qBAAqB,CAAC;;;;;;;;AAQ5B,CAAC;AAMD,OAAO,SAASC,wBAAwBC,OAAiC;IACvE,IAAIC;IACJ,IAAID,QAAQE,KAAK,EAAE;QACjBD,UAAUD,QAAQG,QAAQ,GACtBN,UAAUO,OAAO,CAAC,eAAeC,KAAKC,SAAS,CAACN,QAAQG,QAAQ,KAChEL;IACN,OAAO;QACLG,UAAUR,aAAaW,OAAO,CAAC,mBAAmBC,KAAKC,SAAS,CAACN,QAAQO,gBAAgB;IAC3F;IAEA,IAAIC,mBAAmB;IAEvB,OAAO;QACLC,gBAAeC,MAAM;YACnB,MAAMC,MAAMvB,KAAKwB,OAAO,CAACF,OAAOG,IAAI,EAAEtB;YACtCiB,mBAAmBpB,KAAK0B,IAAI,CAACH,KAAKnB;YAElCL,GAAG4B,SAAS,CAACJ,KAAK;gBAACK,WAAW;YAAI;YAClC7B,GAAG8B,aAAa,CAACT,kBAAkBP;QACrC;QACAiB,WAAU,EAACC,IAAI,EAAEC,OAAO,EAAEC,SAAS,EAAC;YAClC,IAAIrB,QAAQE,KAAK,EAAE;YACnB,IAAI,IAAI,CAACoB,WAAW,CAACC,IAAI,KAAK,UAAU;YAExC,MAAM,EAACC,WAAW,EAAC,GAAG,IAAI,CAACF,WAAW;YACtC,MAAMG,aAAaD,YAAYE,gBAAgB,CAAClB;YAChD,IAAI,CAACiB,YAAYE,MAAM;YAEvB,uDAAuD;YACvD,MAAMC,UAAU,IAAIC;YACpB,MAAMC,QAAiC;mBAAIL;aAAW;YACtD,MAAOK,MAAMC,MAAM,GAAG,EAAG;gBACvB,MAAMC,MAAMF,MAAMG,GAAG;gBACrB,IAAIL,QAAQM,GAAG,CAACF,MAAM;gBACtBJ,QAAQO,GAAG,CAACH;gBACZ,IAAIA,IAAIb,IAAI,KAAKA,MAAM;oBACrB,oEAAoE;oBACpE,qEAAqE;oBACrE,+BAA+B;oBAC/B,MAAMiB,OAAO,IAAIP;oBACjB,KAAK,MAAMQ,KAAKjB,QAAS;wBACvBI,YAAYc,gBAAgB,CAACD,GAAGD,MAAMf,WAAW;oBACnD;oBACA,OAAO;2BAAII;qBAAW;gBACxB;gBACA,KAAK,MAAMc,OAAOP,IAAIQ,eAAe,CAAEV,MAAMW,IAAI,CAACF;YACpD;QACF;QACAhB,MAAM;IACR;AACF"}
|
|
@@ -15,7 +15,7 @@ import { sanityAppId } from './plugins/plugin-sanity-app-id.js';
|
|
|
15
15
|
* error downstream.
|
|
16
16
|
*/ function requireStudioConfigPath(relativeConfigLocation) {
|
|
17
17
|
if (relativeConfigLocation === null) {
|
|
18
|
-
throw new Error('Workbench studios need a sanity.config.js or sanity.config.ts file. ' + "Add one, or remove `applicationType: 'studio'` from `
|
|
18
|
+
throw new Error('Workbench studios need a sanity.config.js or sanity.config.ts file. ' + "Add one, or remove `applicationType: 'studio'` from `defineApplication` " + 'to let the CLI infer the application type.');
|
|
19
19
|
}
|
|
20
20
|
return relativeConfigLocation;
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/actions/build/vite/workbench-vite-plugins.ts"],"sourcesContent":["// The build-facing entry of the workbench federation stack: turn a workbench\n// app's build inputs into the Vite plugins that produce its module-federation\n// remote. `@sanity/cli-build`'s `getViteConfig` calls this instead of\n// assembling `federation`'s options itself, so the discriminated app-vs-studio\n// option shape, the no-app-view rule, and the studio-config requirement all\n// live here next to `federation` — the build package just hands over its inputs.\n\nimport path from 'node:path'\n\nimport {readPackageJson} from '@sanity/cli-core'\nimport {type PluginOption} from 'vite'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\nimport {federation} from './plugin.js'\nimport {sanityAppId} from './plugins/plugin-sanity-app-id.js'\n\ninterface WorkbenchViteOptions {\n /** Project root — read for the federation remote name, and the plugin workDir. */\n cwd: string\n /**\n * Build entry paths relative to the federation runtime dir. `relativeEntry` is\n * the app's `entry` (null for a dock-only app with no app view);\n * `relativeConfigLocation` is the studio's `sanity.config.*` (null when absent).\n */\n entries: {relativeConfigLocation: string | null; relativeEntry: string | null}\n\n /** The app's bus identity, stamped into its modules for `@sanity/runtime`. */\n appId?: string\n\n exposes?: WorkbenchExposes\n /** App (vs studio) build — selects the discriminated federation option shape. */\n isApp?: boolean\n}\n\n/**\n * A workbench studio renders from its `sanity.config.*`, so the build needs one.\n * An explicit `applicationType: 'studio'` wins over detection, so a studio can\n * reach here with no config file — fail with the fix rather than a cryptic build\n * error downstream.\n */\nfunction requireStudioConfigPath(relativeConfigLocation: string | null): string {\n if (relativeConfigLocation === null) {\n throw new Error(\n 'Workbench studios need a sanity.config.js or sanity.config.ts file. ' +\n \"Add one, or remove `applicationType: 'studio'` from `
|
|
1
|
+
{"version":3,"sources":["../../../../src/actions/build/vite/workbench-vite-plugins.ts"],"sourcesContent":["// The build-facing entry of the workbench federation stack: turn a workbench\n// app's build inputs into the Vite plugins that produce its module-federation\n// remote. `@sanity/cli-build`'s `getViteConfig` calls this instead of\n// assembling `federation`'s options itself, so the discriminated app-vs-studio\n// option shape, the no-app-view rule, and the studio-config requirement all\n// live here next to `federation` — the build package just hands over its inputs.\n\nimport path from 'node:path'\n\nimport {readPackageJson} from '@sanity/cli-core'\nimport {type PluginOption} from 'vite'\n\nimport {type WorkbenchExposes} from '../../../resolveWorkbenchApp.js'\nimport {federation} from './plugin.js'\nimport {sanityAppId} from './plugins/plugin-sanity-app-id.js'\n\ninterface WorkbenchViteOptions {\n /** Project root — read for the federation remote name, and the plugin workDir. */\n cwd: string\n /**\n * Build entry paths relative to the federation runtime dir. `relativeEntry` is\n * the app's `entry` (null for a dock-only app with no app view);\n * `relativeConfigLocation` is the studio's `sanity.config.*` (null when absent).\n */\n entries: {relativeConfigLocation: string | null; relativeEntry: string | null}\n\n /** The app's bus identity, stamped into its modules for `@sanity/runtime`. */\n appId?: string\n\n exposes?: WorkbenchExposes\n /** App (vs studio) build — selects the discriminated federation option shape. */\n isApp?: boolean\n}\n\n/**\n * A workbench studio renders from its `sanity.config.*`, so the build needs one.\n * An explicit `applicationType: 'studio'` wins over detection, so a studio can\n * reach here with no config file — fail with the fix rather than a cryptic build\n * error downstream.\n */\nfunction requireStudioConfigPath(relativeConfigLocation: string | null): string {\n if (relativeConfigLocation === null) {\n throw new Error(\n 'Workbench studios need a sanity.config.js or sanity.config.ts file. ' +\n \"Add one, or remove `applicationType: 'studio'` from `defineApplication` \" +\n 'to let the CLI infer the application type.',\n )\n }\n return relativeConfigLocation\n}\n\n/** Build the Vite plugins for a workbench app's module-federation remote. */\nexport async function workbenchVitePlugins(options: WorkbenchViteOptions): Promise<PluginOption> {\n const {appId, cwd, entries, exposes, isApp} = options\n const pkgJson = await readPackageJson(path.join(cwd, 'package.json'))\n\n const federationPlugin = federation({\n ...(isApp\n ? {\n // `null` relativeEntry (a branded app with no `entry`) → omit `appEntry`,\n // so the remote exposes no `./App`, only its views.\n ...(entries.relativeEntry ? {appEntry: entries.relativeEntry} : {}),\n isApp: true as const,\n }\n : {\n isApp: false as const,\n studioConfigPath: requireStudioConfigPath(entries.relativeConfigLocation),\n }),\n exposes,\n pkgJson,\n workDir: cwd,\n })\n\n return appId === undefined ? federationPlugin : [federationPlugin, sanityAppId(appId)]\n}\n"],"names":["path","readPackageJson","federation","sanityAppId","requireStudioConfigPath","relativeConfigLocation","Error","workbenchVitePlugins","options","appId","cwd","entries","exposes","isApp","pkgJson","join","federationPlugin","relativeEntry","appEntry","studioConfigPath","workDir","undefined"],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,sEAAsE;AACtE,+EAA+E;AAC/E,4EAA4E;AAC5E,iFAAiF;AAEjF,OAAOA,UAAU,YAAW;AAE5B,SAAQC,eAAe,QAAO,mBAAkB;AAIhD,SAAQC,UAAU,QAAO,cAAa;AACtC,SAAQC,WAAW,QAAO,oCAAmC;AAoB7D;;;;;CAKC,GACD,SAASC,wBAAwBC,sBAAqC;IACpE,IAAIA,2BAA2B,MAAM;QACnC,MAAM,IAAIC,MACR,yEACE,6EACA;IAEN;IACA,OAAOD;AACT;AAEA,2EAA2E,GAC3E,OAAO,eAAeE,qBAAqBC,OAA6B;IACtE,MAAM,EAACC,KAAK,EAAEC,GAAG,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,EAAC,GAAGL;IAC9C,MAAMM,UAAU,MAAMb,gBAAgBD,KAAKe,IAAI,CAACL,KAAK;IAErD,MAAMM,mBAAmBd,WAAW;QAClC,GAAIW,QACA;YACE,0EAA0E;YAC1E,oDAAoD;YACpD,GAAIF,QAAQM,aAAa,GAAG;gBAACC,UAAUP,QAAQM,aAAa;YAAA,IAAI,CAAC,CAAC;YAClEJ,OAAO;QACT,IACA;YACEA,OAAO;YACPM,kBAAkBf,wBAAwBO,QAAQN,sBAAsB;QAC1E,CAAC;QACLO;QACAE;QACAM,SAASV;IACX;IAEA,OAAOD,UAAUY,YAAYL,mBAAmB;QAACA;QAAkBb,YAAYM;KAAO;AACxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/deploy/deployPayload.ts"],"sourcesContent":["import {type DeployableWorkbenchApp} from './getWorkbench.js'\nimport {type
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/deploy/deployPayload.ts"],"sourcesContent":["import {type DeployableWorkbenchApp} from './getWorkbench.js'\nimport {type DeployedView, type DeployedWebWorker} from './summarizeInterfaces.js'\n\n/** What a workbench app contributes to a deploy payload. */\nexport interface WorkbenchDeployPayload {\n slug: string\n title: string\n\n /** Media-library config summary. */\n config?: string\n services?: DeployedWebWorker[]\n views?: DeployedView[]\n visibility?: string\n}\n\n/**\n * Gated once so a plain app can't pick up a stray key: without a workbench\n * there is nothing to contribute. `views` and `services` travel together.\n */\nexport function toWorkbenchPayload(\n workbench: DeployableWorkbenchApp | null,\n {\n config,\n interfaces,\n title,\n }: {\n config?: string\n interfaces: {services: DeployedWebWorker[]; views: DeployedView[]} | null\n title: string\n },\n): Partial<WorkbenchDeployPayload> {\n if (!workbench) return {}\n const {services, views} = interfaces ?? {services: [], views: []}\n return {\n ...(config ? {config} : {}),\n ...(services.length > 0 || views.length > 0 ? {services, views} : {}),\n slug: workbench.slug,\n title,\n ...(workbench.visibility ? {visibility: workbench.visibility} : {}),\n }\n}\n"],"names":["toWorkbenchPayload","workbench","config","interfaces","title","services","views","length","slug","visibility"],"mappings":"AAeA;;;CAGC,GACD,OAAO,SAASA,mBACdC,SAAwC,EACxC,EACEC,MAAM,EACNC,UAAU,EACVC,KAAK,EAKN;IAED,IAAI,CAACH,WAAW,OAAO,CAAC;IACxB,MAAM,EAACI,QAAQ,EAAEC,KAAK,EAAC,GAAGH,cAAc;QAACE,UAAU,EAAE;QAAEC,OAAO,EAAE;IAAA;IAChE,OAAO;QACL,GAAIJ,SAAS;YAACA;QAAM,IAAI,CAAC,CAAC;QAC1B,GAAIG,SAASE,MAAM,GAAG,KAAKD,MAAMC,MAAM,GAAG,IAAI;YAACF;YAAUC;QAAK,IAAI,CAAC,CAAC;QACpEE,MAAMP,UAAUO,IAAI;QACpBJ;QACA,GAAIH,UAAUQ,UAAU,GAAG;YAACA,YAAYR,UAAUQ,UAAU;QAAA,IAAI,CAAC,CAAC;IACpE;AACF"}
|