@sanity/workbench-cli 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/_exports/_internal_worker_bus.d.ts +29 -0
  2. package/dist/_exports/_internal_worker_bus.js +3 -0
  3. package/dist/_exports/_internal_worker_bus.js.map +1 -0
  4. package/dist/_exports/build.d.ts +1 -1
  5. package/dist/_exports/contract-D_HnLQtT.d.ts +197 -0
  6. package/dist/_exports/defineApp-4hImcIIe.d.ts +182 -0
  7. package/dist/_exports/defineService-C1MhDwmh.d.ts +74 -0
  8. package/dist/_exports/deploy.d.ts +11 -3
  9. package/dist/_exports/index.d.ts +4 -50
  10. package/dist/_exports/index.js.map +1 -1
  11. package/dist/_exports/init.d.ts +3 -3
  12. package/dist/_exports/{resolveWorkbenchConfig-KhXnVKZ6.d.ts → resolveWorkbenchConfig-s3msa3Hu.d.ts} +3 -2
  13. package/dist/_exports/{summarizeInterfaces-noqbAtVC.d.ts → summarizeInterfaces-C0TCOa0J.d.ts} +4 -4
  14. package/dist/_exports/undeploy.d.ts +2 -2
  15. package/dist/actions/build/services/artifact.js +13 -3
  16. package/dist/actions/build/services/artifact.js.map +1 -1
  17. package/dist/actions/build/services/workerBus.js +159 -0
  18. package/dist/actions/build/services/workerBus.js.map +1 -0
  19. package/dist/actions/build/vite/plugins/plugin-sanity-extension-artifacts.js +17 -0
  20. package/dist/actions/build/vite/plugins/plugin-sanity-extension-artifacts.js.map +1 -1
  21. package/dist/actions/deploy/checkBuiltOutput.js +10 -2
  22. package/dist/actions/deploy/checkBuiltOutput.js.map +1 -1
  23. package/dist/actions/deploy/deployWorkbenchApp.js +10 -3
  24. package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
  25. package/dist/actions/dev/registry.js +9 -0
  26. package/dist/actions/dev/registry.js.map +1 -1
  27. package/dist/actions/dev/startDevServerRegistration.js +6 -2
  28. package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
  29. package/dist/actions/dev/startWorkbenchDev.js +4 -4
  30. package/dist/actions/dev/startWorkbenchDev.js.map +1 -1
  31. package/dist/actions/init/cliConfig.js +3 -1
  32. package/dist/actions/init/cliConfig.js.map +1 -1
  33. package/dist/actions/preview/startWorkbenchPreview.js +12 -6
  34. package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
  35. package/dist/defineService.js +11 -2
  36. package/dist/defineService.js.map +1 -1
  37. package/dist/services/applications.js +20 -8
  38. package/dist/services/applications.js.map +1 -1
  39. package/package.json +14 -9
  40. package/dist/_exports/defineApp-DOJE2kjo.d.ts +0 -376
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/services/applications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {type AppVisibility, getGlobalCliClient} from '@sanity/cli-core'\nimport {isStaging} from '@sanity/cli-core/util'\nimport FormData from 'form-data'\n\nimport {type TileInterfaceMetadata, type ViewPlacementMetadata} from '../contract.js'\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport type ApplicationType = 'coreApp' | 'studio'\n\nexport interface Application {\n id: string\n organizationId: string\n slug: string | null\n title: string\n type: ApplicationType\n}\n\ninterface BrettInterfaceBase {\n moduleId: string\n name: string\n title: string\n version: string\n}\n\n/**\n * An interface as Brett stores it, discriminated on `type`. `moduleId` is\n * remote-relative — the host prepends the app's id. Brett assigns the id.\n * @internal\n */\nexport type BrettInterface =\n | (BrettInterfaceBase & {metadata: null; type: 'asset_source'})\n | (BrettInterfaceBase & {metadata: null; type: 'worker'})\n | (BrettInterfaceBase & {metadata: TileInterfaceMetadata; type: 'tile'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'app'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'panel'})\n\n/**\n * A resource a deployment may interact with, as Brett stores it. Per-deployment\n * and forbidden for singletons (the server 400s).\n */\nexport interface BrettAccess {\n resourceId: string\n resourceType: 'canvas' | 'dashboard' | 'dataset' | 'media-library'\n}\n\n/** A studio workspace as Brett stores it. */\nexport interface BrettWorkspace {\n dataset: string\n projectId: string\n /** Lexicon schema descriptor id; Brett requires one per workspace. */\n schemaDescriptorId: string\n\n basePath?: string\n icon?: string\n name?: string\n subtitle?: string\n title?: string\n}\n\nexport function getWorkbenchUrl(organizationId: string): string {\n return `https://${organizationId}.${isStaging() ? 'run.sanity.work' : 'sanity.run'}`\n}\n\n/** Where a deployed application is served on its organization's workbench. */\nexport function getApplicationUrl(\n application: Pick<Application, 'id' | 'organizationId' | 'type'>,\n): string {\n const segment = application.type === 'studio' ? 'studios' : 'applications'\n return `${getWorkbenchUrl(application.organizationId)}/${segment}/${application.id}`\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\nexport async function getApplication(applicationId: string): Promise<Application | null> {\n const client = await getClient()\n try {\n return await client.request({url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode === 404) return null\n throw err\n }\n}\n\n/** Every application in an organization, in one page (`limit=none`). */\nexport async function listApplications(organizationId: string): Promise<Application[]> {\n const client = await getClient()\n const {data}: {data: Application[]} = await client.request({\n query: {limit: 'none', organizationId},\n url: '/applications',\n })\n return data\n}\n\n/**\n * Create an application record (no deployment), so the CLI can build with the\n * returned id, then ship it via {@link createDeployment}.\n */\nexport async function createApplication(options: {\n isSingleton?: boolean\n name?: string\n organizationId: string\n projectId?: string\n slug: string\n title: string\n type: ApplicationType\n visibility?: AppVisibility\n}): Promise<Application> {\n const {isSingleton, name, organizationId, projectId, slug, title, type, visibility} = options\n const client = await getClient()\n return client.request({\n body: {\n organizationId,\n slug,\n title,\n type,\n // Identity, distinct from the slug address. Omitted → Brett defaults it to slug.\n ...(name ? {name} : {}),\n // Brett requires `isSingleton` on `POST /applications`, so the request\n // builder keeps forwarding it even though the CLI itself never sets it.\n ...(isSingleton === undefined ? {} : {isSingleton}),\n ...(visibility ? {visibility} : {}),\n // Studio config is set once, at create — it's immutable on redeploy.\n ...(projectId ? {config: {studio: {projectId}}} : {}),\n },\n method: 'POST',\n url: `/applications`,\n })\n}\n\n/** Mutable application fields the deploy flow patches after create. */\nexport interface ApplicationUpdate {\n icon?: string | null\n /** The address the application is served at; renaming moves it. */\n slug?: string\n title?: string\n visibility?: AppVisibility\n}\n\n// Patch an application's mutable fields.\nexport async function updateApplication(\n applicationId: string,\n update: ApplicationUpdate,\n): Promise<void> {\n const client = await getClient()\n await client.request({body: update, method: 'PATCH', url: `/applications/${applicationId}`})\n}\n\n/** Deploy a new active version to an existing application. */\nexport async function createDeployment(options: {\n access?: readonly BrettAccess[]\n applicationId: string\n interfaces: readonly BrettInterface[]\n isAutoUpdating: boolean\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n}): Promise<{id: string}> {\n const {access, applicationId, interfaces, isAutoUpdating, tarball, version, workspaces} = options\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n appendDeploymentParts(formData, {access, interfaces, tarball, version, workspaces})\n return request(`/applications/${applicationId}/deployments`, formData)\n}\n\n/** Soft-deletes the application and all its deployments; already deleted counts as done. */\nexport async function deleteApplication(applicationId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({method: 'DELETE', url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n\nfunction appendDeploymentParts(\n formData: FormData,\n {\n access,\n interfaces,\n tarball,\n version,\n workspaces,\n }: {\n access?: readonly BrettAccess[]\n interfaces: readonly BrettInterface[]\n tarball: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n },\n): void {\n formData.append('version', version)\n appendJson(formData, 'interfaces', interfaces)\n // Studio-only — the server rejects a workspaces part on non-studio types.\n if (workspaces?.length) appendJson(formData, 'workspaces', workspaces)\n // Per-deployment; forbidden for singletons, so callers omit it there.\n if (access?.length) appendJson(formData, 'access', access)\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n}\n\n/** Structured parts must arrive as JSON so the server parses them. */\nfunction appendJson(formData: FormData, name: string, value: unknown): void {\n formData.append(name, JSON.stringify(value), {contentType: 'application/json'})\n}\n\nasync function request<T>(url: string, formData: FormData): Promise<T> {\n const client = await getClient()\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n url,\n })\n}\n"],"names":["PassThrough","getGlobalCliClient","isStaging","FormData","APP_WORKBENCH_API_VERSION","getWorkbenchUrl","organizationId","getApplicationUrl","application","segment","type","id","getClient","apiVersion","requireUser","getApplication","applicationId","client","request","url","err","statusCode","listApplications","data","query","limit","createApplication","options","isSingleton","name","projectId","slug","title","visibility","body","undefined","config","studio","method","updateApplication","update","createDeployment","access","interfaces","isAutoUpdating","tarball","version","workspaces","formData","append","toString","appendDeploymentParts","deleteApplication","appendJson","length","contentType","filename","value","JSON","stringify","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAA4BC,kBAAkB,QAAO,mBAAkB;AACvE,SAAQC,SAAS,QAAO,wBAAuB;AAC/C,OAAOC,cAAc,YAAW;AAGhC,SAAQC,yBAAyB,QAAO,kBAAiB;AAsDzD,OAAO,SAASC,gBAAgBC,cAAsB;IACpD,OAAO,CAAC,QAAQ,EAAEA,eAAe,CAAC,EAAEJ,cAAc,oBAAoB,cAAc;AACtF;AAEA,4EAA4E,GAC5E,OAAO,SAASK,kBACdC,WAAgE;IAEhE,MAAMC,UAAUD,YAAYE,IAAI,KAAK,WAAW,YAAY;IAC5D,OAAO,GAAGL,gBAAgBG,YAAYF,cAAc,EAAE,CAAC,EAAEG,QAAQ,CAAC,EAAED,YAAYG,EAAE,EAAE;AACtF;AAEA,eAAeC;IACb,OAAOX,mBAAmB;QAACY,YAAYT;QAA2BU,aAAa;IAAI;AACrF;AAEA,OAAO,eAAeC,eAAeC,a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AAkB;AAC/E;AAEA,eAAerC,QAAWC,GAAW,EAAE6B,QAAkB;IACvD,MAAM/B,SAAS,MAAML;IACrB,OAAOK,OAAOC,OAAO,CAAC;QACpBgB,MAAMc,SAASY,IAAI,CAAC,IAAI5D;QACxB6D,SAASb,SAASc,UAAU;QAC5BxB,QAAQ;QACRnB;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/services/applications.ts"],"sourcesContent":["import {PassThrough} from 'node:stream'\nimport {type Gzip} from 'node:zlib'\n\nimport {type AppVisibility, getGlobalCliClient} from '@sanity/cli-core'\nimport {isStaging} from '@sanity/cli-core/util'\nimport FormData from 'form-data'\n\nimport {type TileInterfaceMetadata, type ViewPlacementMetadata} from '../contract.js'\nimport {APP_WORKBENCH_API_VERSION} from './apiVersion.js'\n\nexport type ApplicationType = 'coreApp' | 'studio'\n\nexport interface Application {\n id: string\n organizationId: string\n slug: string | null\n title: string\n type: ApplicationType\n\n /** Set when the customer serves the build; such an application never receives a tarball. */\n externalUrl?: string\n}\n\ninterface BrettInterfaceBase {\n moduleId: string\n name: string\n title: string\n version: string\n}\n\n/**\n * An interface as Brett stores it, discriminated on `type`. `moduleId` is\n * remote-relative — the host prepends the app's id. Brett assigns the id.\n * @internal\n */\nexport type BrettInterface =\n | (BrettInterfaceBase & {metadata: null; type: 'asset_source'})\n | (BrettInterfaceBase & {metadata: null; type: 'worker'})\n | (BrettInterfaceBase & {metadata: TileInterfaceMetadata; type: 'tile'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'app'})\n | (BrettInterfaceBase & {metadata: ViewPlacementMetadata | null; type: 'panel'})\n\n/**\n * A resource a deployment may interact with, as Brett stores it. Per-deployment\n * and forbidden for singletons (the server 400s).\n */\nexport interface BrettAccess {\n resourceId: string\n resourceType: 'canvas' | 'dashboard' | 'dataset' | 'media-library'\n}\n\n/** A studio workspace as Brett stores it. */\nexport interface BrettWorkspace {\n dataset: string\n projectId: string\n /** Lexicon schema descriptor id; Brett requires one per workspace. */\n schemaDescriptorId: string\n\n basePath?: string\n icon?: string\n name?: string\n subtitle?: string\n title?: string\n}\n\nexport function getWorkbenchUrl(organizationId: string): string {\n return `https://${organizationId}.${isStaging() ? 'run.sanity.work' : 'sanity.run'}`\n}\n\n/** Where a deployed application is served on its organization's workbench. */\nexport function getApplicationUrl(\n application: Pick<Application, 'id' | 'organizationId' | 'type'>,\n): string {\n const segment = application.type === 'studio' ? 'studios' : 'applications'\n return `${getWorkbenchUrl(application.organizationId)}/${segment}/${application.id}`\n}\n\nasync function getClient() {\n return getGlobalCliClient({apiVersion: APP_WORKBENCH_API_VERSION, requireUser: true})\n}\n\nexport async function getApplication(applicationId: string): Promise<Application | null> {\n const client = await getClient()\n try {\n return await client.request({url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode === 404) return null\n throw err\n }\n}\n\n/** Every application in an organization, in one page (`limit=none`). */\nexport async function listApplications(organizationId: string): Promise<Application[]> {\n const client = await getClient()\n const {data}: {data: Application[]} = await client.request({\n query: {limit: 'none', organizationId},\n url: '/applications',\n })\n return data\n}\n\n/**\n * Create an application record (no deployment), so the CLI can build with the\n * returned id, then ship it via {@link createDeployment}.\n */\nexport async function createApplication(options: {\n /** The origin a customer serves the build from; Brett then never hosts a bundle for it. */\n externalUrl?: string\n isSingleton?: boolean\n name?: string\n organizationId: string\n projectId?: string\n slug: string\n title: string\n type: ApplicationType\n visibility?: AppVisibility\n}): Promise<Application> {\n const {externalUrl, isSingleton, name, organizationId, projectId, slug, title, type, visibility} =\n options\n const client = await getClient()\n return client.request({\n body: {\n organizationId,\n slug,\n title,\n type,\n // Identity, distinct from the slug address. Omitted → Brett defaults it to slug.\n ...(name ? {name} : {}),\n // Brett requires `isSingleton` on `POST /applications`, so the request\n // builder keeps forwarding it even though the CLI itself never sets it.\n ...(isSingleton === undefined ? {} : {isSingleton}),\n ...(visibility ? {visibility} : {}),\n ...(externalUrl ? {externalUrl} : {}),\n // Studio config is set once, at create — it's immutable on redeploy.\n ...(projectId ? {config: {studio: {projectId}}} : {}),\n },\n method: 'POST',\n url: `/applications`,\n })\n}\n\n/** Mutable application fields the deploy flow patches after create. */\nexport interface ApplicationUpdate {\n icon?: string | null\n /** The address the application is served at; renaming moves it. */\n slug?: string\n title?: string\n visibility?: AppVisibility\n}\n\n// Patch an application's mutable fields.\nexport async function updateApplication(\n applicationId: string,\n update: ApplicationUpdate,\n): Promise<void> {\n const client = await getClient()\n await client.request({body: update, method: 'PATCH', url: `/applications/${applicationId}`})\n}\n\n/**\n * Deploy a new active version to an existing application. `mfManifest` is the\n * build's `mf-manifest.json`; `tarball` is omitted for an external application,\n * whose build the customer serves themselves.\n */\nexport async function createDeployment(options: {\n access?: readonly BrettAccess[]\n applicationId: string\n interfaces: readonly BrettInterface[]\n isAutoUpdating: boolean\n mfManifest: unknown\n tarball?: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n}): Promise<{id: string}> {\n const {\n access,\n applicationId,\n interfaces,\n isAutoUpdating,\n mfManifest,\n tarball,\n version,\n workspaces,\n } = options\n const formData = new FormData()\n formData.append('isAutoUpdating', isAutoUpdating.toString())\n appendDeploymentParts(formData, {access, interfaces, mfManifest, tarball, version, workspaces})\n return request(`/applications/${applicationId}/deployments`, formData)\n}\n\n/** Soft-deletes the application and all its deployments; already deleted counts as done. */\nexport async function deleteApplication(applicationId: string): Promise<void> {\n const client = await getClient()\n try {\n await client.request({method: 'DELETE', url: `/applications/${applicationId}`})\n } catch (err) {\n if ((err as {statusCode?: number})?.statusCode !== 404) throw err\n }\n}\n\nfunction appendDeploymentParts(\n formData: FormData,\n {\n access,\n interfaces,\n mfManifest,\n tarball,\n version,\n workspaces,\n }: {\n access?: readonly BrettAccess[]\n interfaces: readonly BrettInterface[]\n mfManifest: unknown\n tarball?: Gzip\n version: string\n workspaces?: readonly BrettWorkspace[]\n },\n): void {\n formData.append('version', version)\n appendJson(formData, 'interfaces', interfaces)\n // Studio-only — the server rejects a workspaces part on non-studio types.\n if (workspaces?.length) appendJson(formData, 'workspaces', workspaces)\n // Per-deployment; forbidden for singletons, so callers omit it there.\n if (access?.length) appendJson(formData, 'access', access)\n appendJson(formData, 'mfManifest', mfManifest)\n // Last: the server requires every field part to precede the tarball.\n if (tarball) {\n formData.append('tarball', tarball, {contentType: 'application/gzip', filename: 'app.tar.gz'})\n }\n}\n\n/** Structured parts must arrive as JSON so the server parses them. */\nfunction appendJson(formData: FormData, name: string, value: unknown): void {\n formData.append(name, JSON.stringify(value), {contentType: 'application/json'})\n}\n\nasync function request<T>(url: string, formData: FormData): Promise<T> {\n const client = await getClient()\n return client.request({\n body: formData.pipe(new PassThrough()),\n headers: formData.getHeaders(),\n method: 'POST',\n url,\n })\n}\n"],"names":["PassThrough","getGlobalCliClient","isStaging","FormData","APP_WORKBENCH_API_VERSION","getWorkbenchUrl","organizationId","getApplicationUrl","application","segment","type","id","getClient","apiVersion","requireUser","getApplication","applicationId","client","request","url","err","statusCode","listApplications","data","query","limit","createApplication","options","externalUrl","isSingleton","name","projectId","slug","title","visibility","body","undefined","config","studio","method","updateApplication","update","createDeployment","access","interfaces","isAutoUpdating","mfManifest","tarball","version","workspaces","formData","append","toString","appendDeploymentParts","deleteApplication","appendJson","length","contentType","filename","value","JSON","stringify","pipe","headers","getHeaders"],"mappings":"AAAA,SAAQA,WAAW,QAAO,cAAa;AAGvC,SAA4BC,kBAAkB,QAAO,mBAAkB;AACvE,SAAQC,SAAS,QAAO,wBAAuB;AAC/C,OAAOC,cAAc,YAAW;AAGhC,SAAQC,yBAAyB,QAAO,kBAAiB;AAyDzD,OAAO,SAASC,gBAAgBC,cAAsB;IACpD,OAAO,CAAC,QAAQ,EAAEA,eAAe,CAAC,EAAEJ,cAAc,oBAAoB,cAAc;AACtF;AAEA,4EAA4E,GAC5E,OAAO,SAASK,kBACdC,WAAgE;IAEhE,MAAMC,UAAUD,YAAYE,IAAI,KAAK,WAAW,YAAY;IAC5D,OAAO,GAAGL,gBAAgBG,YA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IN,QAAQa,QAAQD,WAAWL,UAAU,UAAUP;IACnDY,WAAWL,UAAU,cAAcJ;IACnC,qEAAqE;IACrE,IAAIC,SAAS;QACXG,SAASC,MAAM,CAAC,WAAWJ,SAAS;YAACU,aAAa;YAAoBC,UAAU;QAAY;IAC9F;AACF;AAEA,oEAAoE,GACpE,SAASH,WAAWL,QAAkB,EAAEpB,IAAY,EAAE6B,KAAc;IAClET,SAASC,MAAM,CAACrB,MAAM8B,KAAKC,SAAS,CAACF,QAAQ;QAACF,aAAa;IAAkB;AAC/E;AAEA,eAAevC,QAAWC,GAAW,EAAE+B,QAAkB;IACvD,MAAMjC,SAAS,MAAML;IACrB,OAAOK,OAAOC,OAAO,CAAC;QACpBiB,MAAMe,SAASY,IAAI,CAAC,IAAI9D;QACxB+D,SAASb,SAASc,UAAU;QAC5BzB,QAAQ;QACRpB;IACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/workbench-cli",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "description": "Internal implementation detail of the Sanity CLI's unstable workbench support. Not intended for direct use.",
5
5
  "homepage": "https://github.com/sanity-io/cli",
6
6
  "bugs": "https://github.com/sanity-io/cli/issues",
@@ -47,6 +47,10 @@
47
47
  "source": "./src/_exports/_internal_render.ts",
48
48
  "default": "./dist/_exports/_internal_render.js"
49
49
  },
50
+ "./_internal_worker_bus": {
51
+ "source": "./src/_exports/_internal_worker_bus.ts",
52
+ "default": "./dist/_exports/_internal_worker_bus.js"
53
+ },
50
54
  "./undeploy": {
51
55
  "source": "./src/_exports/undeploy.ts",
52
56
  "default": "./dist/_exports/undeploy.js"
@@ -58,35 +62,36 @@
58
62
  },
59
63
  "dependencies": {
60
64
  "@module-federation/runtime": "2.9.2",
61
- "@module-federation/vite": "1.23.2",
62
- "@sanity/cli-core": "^3.8.2",
63
- "@sanity/types": "^6.15.0",
65
+ "@module-federation/vite": "1.23.4",
66
+ "@sanity/cli-core": "^3.9.1",
67
+ "@sanity/sdk": "^3.8.0",
68
+ "@sanity/types": "^6.17.0",
64
69
  "@vitejs/plugin-react": "^6.1.2",
65
70
  "form-data": "^4.0.5",
66
71
  "rxjs": "^7.8.2",
67
72
  "semver": "^7.8.1",
68
73
  "tar": "^7.5.18",
69
- "vite": "^8.3.2",
74
+ "vite": "^8.3.3",
70
75
  "zod": "^4.5.2"
71
76
  },
72
77
  "devDependencies": {
73
78
  "@eslint/compat": "^2.1.0",
74
79
  "@repo/package.config": "0.0.1",
75
80
  "@repo/tsconfig": "3.70.0",
76
- "@sanity/cli-test": "18.0.2",
81
+ "@sanity/cli-test": "19.0.1",
77
82
  "@sanity/eslint-config-cli": "^1.1.3",
78
83
  "@sanity/pkg-utils": "^12.3.4",
79
84
  "@swc/cli": "^0.8.1",
80
85
  "@swc/core": "^1.15.43",
81
86
  "@types/node": "^22.20.0",
82
- "@types/react": "^19.2.17",
87
+ "@types/react": "^19.3.0",
83
88
  "@types/semver": "^7.7.1",
84
89
  "@vitest/coverage-istanbul": "^4.1.11",
85
90
  "eslint": "^10.7.0",
86
91
  "jsdom": "^29.1.1",
87
92
  "publint": "^0.3.21",
88
- "react": "^19.2.7",
89
- "react-dom": "^19.2.7",
93
+ "react": "^19.3.0",
94
+ "react-dom": "^19.3.0",
90
95
  "typescript": "^6.0.3",
91
96
  "vitest": "^4.1.11"
92
97
  },
@@ -1,376 +0,0 @@
1
- import { z } from "zod/mini";
2
- /** @internal */
3
- declare const VIEW_CONTRACT_VERSION = 1;
4
- /** @internal */
5
- declare const SERVICE_CONTRACT_VERSION = 1;
6
- /**
7
- * A view component. The return is opaque so the runtime helpers carry no React
8
- * dependency — the generated artifact renders it with the app's own React.
9
- * @public
10
- */
11
- type ViewComponent<TProps> = (props: TProps) => unknown;
12
- /** @public */
13
- interface ViewComponentBaseProps<TView> {
14
- view: TView;
15
- }
16
- /** Component slots per view surface; windows load outside the component artifact path. @internal */
17
- declare const VIEW_COMPONENTS: {
18
- readonly asset_source: readonly ["asset_source"];
19
- readonly panel: readonly ["title", "panel"];
20
- readonly tile: readonly ["tile"];
21
- readonly window: readonly [];
22
- };
23
- /** @public */
24
- type ViewSurface = keyof typeof VIEW_COMPONENTS;
25
- /**
26
- * A tile's footprint family — the shape it occupies on the dashboard. Modelled
27
- * on iOS WidgetKit families, not a linear scale: `banner` is full-width and
28
- * shallow, which a `small`→`large` magnitude can't express. The host maps a
29
- * family to a layout slot; the component reads it to render per footprint.
30
- * @public
31
- */
32
- declare const TileSizeSchema: z.ZodMiniEnum<{
33
- small: "small";
34
- large: "large";
35
- banner: "banner";
36
- }>;
37
- /** @public */
38
- type TileSize = z.infer<typeof TileSizeSchema>;
39
- /** @public */
40
- type ServiceType = 'worker';
41
- declare const DockGroupSchema: z.ZodMiniEnum<{
42
- system: "system";
43
- applications: "applications";
44
- user: "user";
45
- }>;
46
- /** @public */
47
- type DockGroup = z.output<typeof DockGroupSchema>;
48
- declare const PanelViewSchema: z.ZodMiniObject<{
49
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
50
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
51
- system: "system";
52
- applications: "applications";
53
- user: "user";
54
- }>>;
55
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
56
- }, z.core.$strip>>;
57
- title: z.ZodMiniString<string>;
58
- name: z.ZodMiniString<string>;
59
- src: z.ZodMiniString<string>;
60
- surface: z.ZodMiniLiteral<"panel">;
61
- }, z.core.$strip>;
62
- /** @public */
63
- type PanelView = z.output<typeof PanelViewSchema>;
64
- /** @public */
65
- type DefinePanelViewInput = Omit<PanelView, 'surface'>;
66
- /** @public */
67
- declare function definePanelView(view: DefinePanelViewInput): PanelView;
68
- declare const WindowViewSchema: z.ZodMiniObject<{
69
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
70
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
71
- system: "system";
72
- applications: "applications";
73
- user: "user";
74
- }>>;
75
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
76
- }, z.core.$strip>>;
77
- title: z.ZodMiniString<string>;
78
- name: z.ZodMiniString<string>;
79
- src: z.ZodMiniString<string>;
80
- surface: z.ZodMiniLiteral<"window">;
81
- }, z.core.$strip>;
82
- /** @public */
83
- type WindowView = z.output<typeof WindowViewSchema>;
84
- /** @public */
85
- type DefineWindowViewInput = Omit<WindowView, 'surface'>;
86
- /** @public */
87
- declare function defineWindowView(view: DefineWindowViewInput): WindowView;
88
- declare const AssetSourceViewSchema: z.ZodMiniObject<{
89
- title: z.ZodMiniString<string>;
90
- name: z.ZodMiniString<string>;
91
- src: z.ZodMiniString<string>;
92
- surface: z.ZodMiniLiteral<"asset_source">;
93
- }, z.core.$strip>;
94
- /** @public */
95
- type AssetSourceView = z.output<typeof AssetSourceViewSchema>;
96
- /** @public */
97
- type DefineAssetSourceViewInput = Omit<AssetSourceView, 'surface'>;
98
- /** @public */
99
- declare function defineAssetSourceView(view: DefineAssetSourceViewInput): AssetSourceView;
100
- declare const TileViewSchema: z.ZodMiniObject<{
101
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
102
- size: z.ZodMiniEnum<{
103
- small: "small";
104
- large: "large";
105
- banner: "banner";
106
- }>;
107
- title: z.ZodMiniString<string>;
108
- name: z.ZodMiniString<string>;
109
- src: z.ZodMiniString<string>;
110
- surface: z.ZodMiniLiteral<"tile">;
111
- }, z.core.$strip>;
112
- /** @public */
113
- type TileView = z.output<typeof TileViewSchema>;
114
- /** @public */
115
- type DefineTileViewInput = Omit<TileView, 'surface'>;
116
- /** @public */
117
- declare function defineTileView(view: DefineTileViewInput): TileView;
118
- /** @internal */
119
- declare const InterfaceDeclarationSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
120
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
121
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
122
- system: "system";
123
- applications: "applications";
124
- user: "user";
125
- }>>;
126
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
127
- }, z.core.$strip>>;
128
- title: z.ZodMiniString<string>;
129
- name: z.ZodMiniString<string>;
130
- src: z.ZodMiniString<string>;
131
- surface: z.ZodMiniLiteral<"window">;
132
- }, z.core.$strip>, z.ZodMiniObject<{
133
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
134
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
135
- system: "system";
136
- applications: "applications";
137
- user: "user";
138
- }>>;
139
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
140
- }, z.core.$strip>>;
141
- title: z.ZodMiniString<string>;
142
- name: z.ZodMiniString<string>;
143
- src: z.ZodMiniString<string>;
144
- surface: z.ZodMiniLiteral<"panel">;
145
- }, z.core.$strip>, z.ZodMiniObject<{
146
- title: z.ZodMiniString<string>;
147
- name: z.ZodMiniString<string>;
148
- src: z.ZodMiniString<string>;
149
- surface: z.ZodMiniLiteral<"asset_source">;
150
- }, z.core.$strip>, z.ZodMiniObject<{
151
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
152
- size: z.ZodMiniEnum<{
153
- small: "small";
154
- large: "large";
155
- banner: "banner";
156
- }>;
157
- title: z.ZodMiniString<string>;
158
- name: z.ZodMiniString<string>;
159
- src: z.ZodMiniString<string>;
160
- surface: z.ZodMiniLiteral<"tile">;
161
- }, z.core.$strip>], "surface">;
162
- /** @public */
163
- type ViewDeclaration = z.output<typeof InterfaceDeclarationSchema>;
164
- declare const WebWorkerSchema: z.ZodMiniObject<{
165
- title: z.ZodMiniString<string>;
166
- name: z.ZodMiniString<string>;
167
- src: z.ZodMiniString<string>;
168
- type: z.ZodMiniLiteral<"worker">;
169
- }, z.core.$strip>;
170
- /** @public */
171
- type WebWorker = z.output<typeof WebWorkerSchema>;
172
- /** @public */
173
- type DefineWebWorkerInput = Omit<WebWorker, 'type'>;
174
- /** @public */
175
- declare function defineWebWorker(webWorker: DefineWebWorkerInput): WebWorker;
176
- /**
177
- * A workbench config's built value, keyed by `appType`; deploys as a versioned
178
- * snapshot, not an interface.
179
- * @internal
180
- */
181
- declare const ConfigSchema: z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
182
- appType: z.ZodMiniLiteral<"media-library">;
183
- fields: z.ZodMiniArray<z.ZodMiniObject<{
184
- public: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
185
- title: z.ZodMiniString<string>;
186
- name: z.ZodMiniString<string>;
187
- src: z.ZodMiniString<string>;
188
- }, z.core.$strip>>;
189
- }, z.core.$strip>], "appType">;
190
- /**
191
- * The `{appType, fields}` config value the build expands into a federation
192
- * remote and the deploy summarizes.
193
- * @internal
194
- */
195
- type WorkbenchConfigValue = z.output<typeof ConfigSchema>;
196
- /**
197
- * Runtime-validation schema for `defineApplication`.
198
- * @internal
199
- */
200
- declare const DefineAppInputSchema: z.ZodMiniObject<{
201
- applicationType: z.ZodMiniOptional<z.ZodMiniEnum<{
202
- coreApp: "coreApp";
203
- studio: "studio";
204
- canvas: "canvas";
205
- dashboard: "dashboard";
206
- }>>;
207
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
208
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
209
- system: "system";
210
- applications: "applications";
211
- user: "user";
212
- }>>;
213
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
214
- }, z.core.$strip>>;
215
- entry: z.ZodMiniOptional<z.ZodMiniString<string>>;
216
- icon: z.ZodMiniOptional<z.ZodMiniString<string>>;
217
- isSingleton: z.ZodMiniOptional<z.ZodMiniBoolean<boolean>>;
218
- name: z.ZodMiniOptional<z.ZodMiniString<string>>;
219
- organizationId: z.ZodMiniString<string>;
220
- slug: z.ZodMiniString<string>;
221
- title: z.ZodMiniString<string>;
222
- views: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
223
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
224
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
225
- system: "system";
226
- applications: "applications";
227
- user: "user";
228
- }>>;
229
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
230
- }, z.core.$strip>>;
231
- title: z.ZodMiniString<string>;
232
- name: z.ZodMiniString<string>;
233
- src: z.ZodMiniString<string>;
234
- surface: z.ZodMiniLiteral<"window">;
235
- }, z.core.$strip>, z.ZodMiniObject<{
236
- dock: z.ZodMiniOptional<z.ZodMiniObject<{
237
- group: z.ZodMiniOptional<z.ZodMiniEnum<{
238
- system: "system";
239
- applications: "applications";
240
- user: "user";
241
- }>>;
242
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
243
- }, z.core.$strip>>;
244
- title: z.ZodMiniString<string>;
245
- name: z.ZodMiniString<string>;
246
- src: z.ZodMiniString<string>;
247
- surface: z.ZodMiniLiteral<"panel">;
248
- }, z.core.$strip>, z.ZodMiniObject<{
249
- title: z.ZodMiniString<string>;
250
- name: z.ZodMiniString<string>;
251
- src: z.ZodMiniString<string>;
252
- surface: z.ZodMiniLiteral<"asset_source">;
253
- }, z.core.$strip>, z.ZodMiniObject<{
254
- order: z.ZodMiniOptional<z.ZodMiniNumber<number>>;
255
- size: z.ZodMiniEnum<{
256
- small: "small";
257
- large: "large";
258
- banner: "banner";
259
- }>;
260
- title: z.ZodMiniString<string>;
261
- name: z.ZodMiniString<string>;
262
- src: z.ZodMiniString<string>;
263
- surface: z.ZodMiniLiteral<"tile">;
264
- }, z.core.$strip>], "surface">>>;
265
- visibility: z.ZodMiniOptional<z.ZodMiniEnum<{
266
- default: "default";
267
- unlisted: "unlisted";
268
- disabled: "disabled";
269
- }>>;
270
- webWorkers: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniDiscriminatedUnion<[z.ZodMiniObject<{
271
- title: z.ZodMiniString<string>;
272
- name: z.ZodMiniString<string>;
273
- src: z.ZodMiniString<string>;
274
- type: z.ZodMiniLiteral<"worker">;
275
- }, z.core.$strip>], "type">>>;
276
- }, z.core.$strip>;
277
- /**
278
- * User-facing input for `defineApplication`. Excludes the internal
279
- * `applicationType` and `isSingleton`.
280
- * @public
281
- */
282
- type DefineAppInput = Omit<z.output<typeof DefineAppInputSchema>, 'applicationType' | 'isSingleton'>;
283
- /**
284
- * Nominal brand the CLI discriminates on to enable the workbench build/deploy
285
- * codepath. Registered via `Symbol.for` so the marker survives module-realm
286
- * boundaries — `@sanity/cli-core` re-derives the same global symbol with
287
- * `Symbol.for` rather than importing it, so it stays internal to this module.
288
- */
289
- declare const WORKBENCH_APP: unique symbol;
290
- /**
291
- * The branded result of `defineApplication`. Carries the same fields as the
292
- * input plus the internal brand — users only ever see `DefineAppInput`.
293
- * @public
294
- */
295
- type DefineAppResult = DefineAppInput & {
296
- readonly [WORKBENCH_APP]: true;
297
- };
298
- /**
299
- * A branded app as the CLI reads it — the full schema shape, including the
300
- * internal fields `DefineAppInput` omits. Schema-derived so the narrowing
301
- * can't drift from what the schema validates.
302
- * @public
303
- */
304
- type WorkbenchApp = DefineAppResult & z.output<typeof DefineAppInputSchema>;
305
- /**
306
- * Whether `app` is a branded `defineApplication(...)` result — the sole
307
- * workbench opt-in.
308
- * @public
309
- */
310
- declare function isWorkbenchApp(app: unknown): app is WorkbenchApp;
311
- /**
312
- * Declare a Sanity Dashboard application. Identity at runtime — returns the same
313
- * object reference, tagged with the Dashboard brand. Field validation (the
314
- * `slug` pattern etc.) runs at build time in the CLI via `DefineAppInputSchema`;
315
- * this helper stays a thin, pure identity wrapper.
316
- * @public
317
- */
318
- declare function defineApplication(input: DefineAppInput): DefineAppResult;
319
- /**
320
- * One custom field a media library exposes. `src` default-exports a `defineField(...)` schema type.
321
- * @public
322
- */
323
- interface MediaLibraryField {
324
- /** Unique within the media library. */
325
- name: string;
326
- src: string;
327
- title: string;
328
- /** Readable outside the owning organization. */
329
- public?: boolean;
330
- }
331
- /**
332
- * Sanity-owned singleton, so authors don't name or title the app — only `organizationId` is required.
333
- * @public
334
- */
335
- interface DefineMediaLibraryInput {
336
- /** Organization that owns the media library — the CLI runs and deploys against it. */
337
- organizationId: string;
338
- fields?: MediaLibraryField[];
339
- }
340
- /**
341
- * Nominal brand the CLI discriminates a config on. A config is *not* an app: it
342
- * carries no `slug`/`title`/application identity, only a target `appType`, its
343
- * owning `organizationId`, and its `fields`. Registered via `Symbol.for` so the
344
- * marker survives module-realm boundaries — `@sanity/cli-core` re-derives the
345
- * same global symbol rather than importing it.
346
- */
347
- declare const WORKBENCH_CONFIG: unique symbol;
348
- /**
349
- * A branded workbench config as the CLI reads it: bound to its target app by
350
- * `appType`, not carrying its own app identity. The deploy/undeploy/build paths
351
- * discriminate it via {@link isWorkbenchConfig}.
352
- * @public
353
- */
354
- interface WorkbenchConfig {
355
- appType: 'media-library';
356
- fields: MediaLibraryField[];
357
- organizationId: string;
358
- readonly [WORKBENCH_CONFIG]: true;
359
- }
360
- /**
361
- * Whether `app` is a branded `unstable_defineMediaLibrary(...)` config — a
362
- * config-carrier rather than an app. Configs live in `cliConfig.app` alongside
363
- * apps but resolve through `resolveWorkbenchConfig`, not `resolveWorkbenchApp`.
364
- * @public
365
- */
366
- declare function isWorkbenchConfig(app: unknown): app is WorkbenchConfig;
367
- /**
368
- * Declare the Sanity Media Library config. The Media Library is a Sanity-owned
369
- * singleton, so this is not an app — it carries no slug or title, only the
370
- * target `appType`, its owning organization, and the `fields` it contributes to
371
- * the installation's config.
372
- * @public
373
- */
374
- declare function unstable_defineMediaLibrary(input: DefineMediaLibraryInput): WorkbenchConfig;
375
- export { WorkbenchConfigValue as A, VIEW_CONTRACT_VERSION as C, ViewSurface as D, ViewDeclaration as E, defineWindowView as F, definePanelView as M, defineTileView as N, WebWorker as O, defineWebWorker as P, TileView as S, ViewComponentBaseProps as T, DockGroup as _, WorkbenchApp as a, ServiceType as b, isWorkbenchApp as c, AssetSourceView as d, DefineAssetSourceViewInput as f, DefineWindowViewInput as g, DefineWebWorkerInput as h, MediaLibraryField as i, defineAssetSourceView as j, WindowView as k, isWorkbenchConfig as l, DefineTileViewInput as m, DefineAppResult as n, WorkbenchConfig as o, DefinePanelViewInput as p, DefineMediaLibraryInput as r, defineApplication as s, DefineAppInput as t, unstable_defineMediaLibrary as u, PanelView as v, ViewComponent as w, TileSize as x, SERVICE_CONTRACT_VERSION as y };
376
- //# sourceMappingURL=defineApp-DOJE2kjo.d.ts.map