@sanity/workbench-cli 2.14.0 → 2.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_exports/_internal_auto_updates.d.ts +14 -0
- package/dist/_exports/_internal_auto_updates.js +3 -0
- package/dist/_exports/_internal_auto_updates.js.map +1 -0
- package/dist/_exports/_internal_worker_bus.d.ts +1 -1
- package/dist/_exports/build.d.ts +8 -0
- package/dist/_exports/{defineService-D_DFLM8x.d.ts → defineService-DPZwNN6_.d.ts} +5 -2
- package/dist/_exports/deploy.d.ts +15 -1
- package/dist/_exports/deploy.js +1 -0
- package/dist/_exports/deploy.js.map +1 -1
- package/dist/_exports/dev.d.ts +23 -2
- package/dist/_exports/dev.js +1 -0
- package/dist/_exports/dev.js.map +1 -1
- package/dist/_exports/index.d.ts +1 -1
- package/dist/_exports/preview.d.ts +1 -1
- package/dist/_exports/{registry-DCjjQ1sS.d.ts → registry-NvtHmoN1.d.ts} +3 -1
- package/dist/actions/build/autoUpdatesLoader.js +36 -0
- package/dist/actions/build/autoUpdatesLoader.js.map +1 -0
- package/dist/actions/build/render-remote.js +22 -7
- package/dist/actions/build/render-remote.js.map +1 -1
- package/dist/actions/build/services/workerBus.js +6 -7
- package/dist/actions/build/services/workerBus.js.map +1 -1
- package/dist/actions/build/vite/plugin.js +3 -1
- package/dist/actions/build/vite/plugin.js.map +1 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-auto-updates.js +125 -0
- package/dist/actions/build/vite/plugins/plugin-sanity-auto-updates.js.map +1 -0
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js +3 -1
- package/dist/actions/build/vite/plugins/plugin-sanity-federation-runtime.js.map +1 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js +5 -1
- package/dist/actions/build/vite/workbench-vite-plugins.js.map +1 -1
- package/dist/actions/deploy/selectWorkbenchAppId.js +31 -0
- package/dist/actions/deploy/selectWorkbenchAppId.js.map +1 -0
- package/dist/actions/dev/registry.js +20 -1
- package/dist/actions/dev/registry.js.map +1 -1
- package/dist/actions/dev/startDevManifestWatcher.js +33 -73
- package/dist/actions/dev/startDevManifestWatcher.js.map +1 -1
- package/dist/actions/dev/startDevServerRegistration.js +11 -19
- package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
- package/dist/actions/dev/startWorkbenchDevServer.js +2 -1
- package/dist/actions/dev/startWorkbenchDevServer.js.map +1 -1
- package/dist/actions/dev/watchCliConfig.js +58 -0
- package/dist/actions/dev/watchCliConfig.js.map +1 -0
- package/dist/actions/dev/watchForWorkbenchOptIn.js +51 -0
- package/dist/actions/dev/watchForWorkbenchOptIn.js.map +1 -0
- package/dist/actions/preview/startWorkbenchPreview.js +3 -4
- package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
- package/dist/defineService.js +4 -1
- package/dist/defineService.js.map +1 -1
- package/package.json +8 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/preview/startWorkbenchPreview.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {type CliConfig, findProjectRoot, type Output} from '@sanity/cli-core'\n\nimport {buildAppId, SANITY_APP_ID_FILE} from '../../appId.js'\nimport {deriveInterfaces} from '../../deriveInterfaces.js'\nimport {resolveWorkbenchApp} from '../../resolveWorkbenchApp.js'\nimport {createServerLifecycle, toDisplayHost} from '../../util/serverOrchestration.js'\nimport {deriveConfigs} from '../dev/deriveConfigs.js'\nimport {dashboardPath
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/preview/startWorkbenchPreview.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport {styleText} from 'node:util'\n\nimport {type CliConfig, findProjectRoot, type Output} from '@sanity/cli-core'\n\nimport {buildAppId, SANITY_APP_ID_FILE} from '../../appId.js'\nimport {deriveInterfaces} from '../../deriveInterfaces.js'\nimport {resolveWorkbenchApp} from '../../resolveWorkbenchApp.js'\nimport {createServerLifecycle, toDisplayHost} from '../../util/serverOrchestration.js'\nimport {deriveConfigs} from '../dev/deriveConfigs.js'\nimport {\n dashboardPath,\n type DevServerManifest,\n localAppIdentity,\n registerDevServer,\n} from '../dev/registry.js'\nimport {startWorkbenchDevServer} from '../dev/startWorkbenchDevServer.js'\nimport {serveBuiltApplication} from './serveBuiltApplication.js'\n\nexport interface StartWorkbenchPreviewOptions {\n /** Directory for the workbench Vite server's dependency cache. */\n cacheDir: string\n /** CLI-domain `app.id`/`deployment.appId` deprecation check, run before registering. */\n checkForDeprecatedAppId: () => void\n cliConfig: CliConfig\n /** Extract the project manifest to inline into the registry (studio-vs-app handled by the CLI). */\n extractManifest: (params: {\n applicationId?: string\n configPath: string\n workDir: string\n }) => Promise<DevServerManifest['manifest']>\n httpHost: string\n httpPort: number\n isApp: boolean\n /** The built `dist` directory to serve as the federation remote. */\n outDir: string\n output: Output\n reactStrictMode: boolean\n workDir: string\n}\n\n/**\n * `sanity start` for a workbench app: serve a production build the way dev serves\n * a live one. The same singleton workbench shell renders it and the same registry\n * advertises it — only the remote differs, static files from the build output\n * instead of a live Vite dev server. There's no config watcher or rebuild: a\n * build is fixed, so nothing re-syncs.\n *\n * A running workbench claims the configured port, so the built remote binds the\n * next one. Without one the remote takes the configured port and announces its\n * own URL.\n */\nexport async function startWorkbenchPreview(\n options: StartWorkbenchPreviewOptions,\n): Promise<{close: () => Promise<void>}> {\n const {\n cacheDir,\n checkForDeprecatedAppId,\n cliConfig,\n extractManifest,\n httpHost,\n httpPort,\n isApp,\n outDir,\n output,\n reactStrictMode,\n workDir,\n } = options\n\n const {close, closers, installSignalHandlers} = createServerLifecycle()\n\n const workbench = await startWorkbenchDevServer({\n cacheDir,\n cliConfig,\n httpHost,\n httpPort,\n output,\n reactStrictMode,\n workDir,\n })\n closers.push(workbench.close)\n\n const remotePort = workbench.workbenchAvailable ? workbench.workbenchPort + 1 : httpPort\n\n const remote = await serveBuiltApplication({\n cacheDir,\n httpHost,\n httpPort: remotePort,\n outDir,\n workDir,\n }).catch(async (err) => {\n await close()\n throw err\n })\n closers.push(remote.close)\n\n let dashboardAppPath: string | undefined\n try {\n // Callers provide CLI-only validation and manifest extraction to keep them\n // out of workbench-cli.\n checkForDeprecatedAppId()\n const configPath = (await findProjectRoot(workDir)).path\n const workbench = resolveWorkbenchApp(cliConfig)\n\n if (!workbench) {\n throw new Error(\n '`sanity start` was invoked in an application that is not set up for the Dashboard',\n )\n }\n const inlinedId = await readInlinedAppId(outDir)\n const configs = await deriveConfigs(cliConfig)\n const id = inlinedId ?? (await buildAppId(workbench))\n const interfaces = deriveInterfaces(cliConfig.app, {isApp})\n const registration = registerDevServer({\n applicationId: cliConfig.deployment?.appId,\n configs,\n host: remote.host,\n id,\n interfaces,\n manifest: await extractManifest({applicationId: id, configPath, workDir}),\n manifestUpdatedAt: new Date().toISOString(),\n port: remote.port,\n projectId: cliConfig?.api?.projectId,\n ...localAppIdentity(workbench),\n type: isApp ? 'coreApp' : 'studio',\n workDir,\n })\n closers.push(async () => registration.release())\n dashboardAppPath = dashboardPath({id, interfaces})\n } catch (err) {\n await close()\n throw err\n }\n\n if (workbench.workbenchAvailable) {\n const appUrl = `http://${toDisplayHost(workbench.httpHost)}:${workbench.workbenchPort}${dashboardAppPath ?? ''}`\n output.log(`Dashboard preview server started at ${styleText(['blue', 'underline'], appUrl)}`)\n } else {\n const remoteUrl = `http://${toDisplayHost(remote.host)}:${remote.port}`\n output.log(`Serving build at ${styleText(['blue', 'underline'], remoteUrl)}`)\n }\n\n installSignalHandlers()\n\n return {close}\n}\n\n/** The id the build inlined into its bundle, or undefined when absent. */\nasync function readInlinedAppId(outDir: string): Promise<string | undefined> {\n try {\n return (await readFile(path.join(outDir, SANITY_APP_ID_FILE), 'utf8')).trim() || undefined\n } catch {\n return undefined\n }\n}\n"],"names":["readFile","path","styleText","findProjectRoot","buildAppId","SANITY_APP_ID_FILE","deriveInterfaces","resolveWorkbenchApp","createServerLifecycle","toDisplayHost","deriveConfigs","dashboardPath","localAppIdentity","registerDevServer","startWorkbenchDevServer","serveBuiltApplication","startWorkbenchPreview","options","cacheDir","checkForDeprecatedAppId","cliConfig","extractManifest","httpHost","httpPort","isApp","outDir","output","reactStrictMode","workDir","close","closers","installSignalHandlers","workbench","push","remotePort","workbenchAvailable","workbenchPort","remote","catch","err","dashboardAppPath","configPath","Error","inlinedId","readInlinedAppId","configs","id","interfaces","app","registration","applicationId","deployment","appId","host","manifest","manifestUpdatedAt","Date","toISOString","port","projectId","api","type","release","appUrl","log","remoteUrl","join","trim","undefined"],"mappings":"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"}
|
package/dist/defineService.js
CHANGED
|
@@ -9,7 +9,10 @@ import { SERVICE_CONTRACT_VERSION } from './contract.js';
|
|
|
9
9
|
* new value of a state topic, or on each event of an event topic, until its
|
|
10
10
|
* `signal` aborts. A refused, unanswered or timed-out `emit` or `query` rejects
|
|
11
11
|
* with an `Error` named `MessageBusError` whose `code` says why; it is not an
|
|
12
|
-
* instance of the SDK's `MessageBusError` class.
|
|
12
|
+
* instance of the SDK's `MessageBusError` class. When the Dashboard's refusal
|
|
13
|
+
* says how to fix it, the error also carries `fix` and `docsUrl`. A refused
|
|
14
|
+
* `subscribe` has no error: its handler never runs, and the Dashboard reports
|
|
15
|
+
* the refusal in the browser console.
|
|
13
16
|
*
|
|
14
17
|
* An event handler answers the sender with `message.reply(value)` or refuses
|
|
15
18
|
* with `message.reject(reason)`; one that throws refuses with code
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/defineService.ts"],"sourcesContent":["import {\n type EventTopic,\n type MessageBus,\n type MessageBusAbortOptions,\n type MessageBusMessage,\n type PayloadOf,\n type ReplyOf,\n type StateTopic,\n type ValueOf,\n} from '@sanity/sdk/dashboard'\n\nimport {SERVICE_CONTRACT_VERSION, type ServiceType} from './contract.js'\n\n/**\n * The service's own declaration, surfaced to the callback.\n * @public\n */\nexport interface ServiceInfo {\n readonly name: string\n readonly type: string\n}\n\n/**\n * The message bus as a service sees it: the SDK's `MessageBus` without the\n * `subscribe` forms that return observables, which would make the service's\n * project install rxjs. There is no `disconnect`: Dashboard owns the connection\n * and ends it when it stops the worker.\n * @public\n */\nexport interface ServiceBus extends Omit<MessageBus, 'subscribe'> {\n /** Runs a responder for each event until its signal aborts. */\n subscribe<K extends EventTopic>(\n type: K,\n handler: (message: MessageBusMessage<PayloadOf<K>, ReplyOf<K>, K>) => void,\n options?: MessageBusAbortOptions,\n ): void\n /** Runs a handler for each state value until its signal aborts. */\n subscribe<K extends StateTopic>(\n type: K,\n handler: (value: ValueOf<K>) => void,\n options?: MessageBusAbortOptions,\n ): void\n}\n\n/**\n * Context every service callback receives when its worker starts. Mirrors how a\n * view component receives its `view` — the service receives its own `service`.\n * @public\n */\nexport interface ServiceContext {\n readonly bus: ServiceBus\n readonly service: ServiceInfo\n}\n\n/**\n * A service callback. Runs once inside the worker on start; returns an optional\n * disposer the host calls before terminating the worker.\n * @public\n */\nexport type ServiceCallback = (context: ServiceContext) => (() => void) | void\n\n/** The callback shape each service type defines, keyed by type. */\ninterface ServiceCallbacksByType {\n worker: ServiceCallback\n}\n\n/**\n * The result of `unstable_defineService`: the author's callback, the service\n * type, and the internal contract version the worker artifact targets.\n * @public\n */\nexport interface DefinedService<TType extends ServiceType = ServiceType> {\n readonly run: ServiceCallbacksByType[TType]\n readonly type: TType\n /** @internal */\n readonly version: typeof SERVICE_CONTRACT_VERSION\n}\n\n/**\n * Define a Sanity Dashboard background service. The first argument narrows the\n * callback shape — `\"worker\"` runs the callback inside a Web Worker.\n *\n * The callback receives `bus`, its connection to the Dashboard message bus:\n * `bus.emit` sends an event (such as a dock-badge update), `bus.query` reads the\n * current value of a state topic, and `bus.subscribe` runs a handler on each\n * new value of a state topic, or on each event of an event topic, until its\n * `signal` aborts. A refused, unanswered or timed-out `emit` or `query` rejects\n * with an `Error` named `MessageBusError` whose `code` says why; it is not an\n * instance of the SDK's `MessageBusError` class.\n *\n * An event handler answers the sender with `message.reply(value)` or refuses\n * with `message.reject(reason)`; one that throws refuses with code\n * `HANDLER_THREW`. For example, a service that keeps a snapshot for its app's\n * views, which listen with `useWorker` first and then post to it. A view's post\n * arrives on `workers.post` as `{name, payload}`, and `workers.message` reaches\n * only this app's views:\n *\n * ```ts\n * export default unstable_defineService('worker', ({bus}) => {\n * const controller = new AbortController()\n * bus.subscribe('workers.post', (message) => message.reply(snapshot), {\n * signal: controller.signal,\n * })\n * // Views that are already listening post again.\n * bus.emit('workers.message', {type: 'welcome'})\n * return () => controller.abort()\n * })\n * ```\n *\n * The callback can return a disposer, which runs when Dashboard stops the\n * worker. By then the bus is closed: subscriptions have ended, `emit` and\n * `query` reject with code `ABORTED`, and `subscribe` throws that error.\n *\n * Identity at runtime: returns the callback tagged with its type and the contract\n * version, for the CLI build to generate a worker artifact from. Used as the\n * default export of a service's `src` file.\n * @public\n */\nexport function unstable_defineService<TType extends ServiceType>(\n type: TType,\n run: ServiceCallbacksByType[TType],\n): DefinedService<TType> {\n return {run, type, version: SERVICE_CONTRACT_VERSION}\n}\n"],"names":["SERVICE_CONTRACT_VERSION","unstable_defineService","type","run","version"],"mappings":"AAWA,SAAQA,wBAAwB,QAAyB,gBAAe;AAmExE
|
|
1
|
+
{"version":3,"sources":["../src/defineService.ts"],"sourcesContent":["import {\n type EventTopic,\n type MessageBus,\n type MessageBusAbortOptions,\n type MessageBusMessage,\n type PayloadOf,\n type ReplyOf,\n type StateTopic,\n type ValueOf,\n} from '@sanity/sdk/dashboard'\n\nimport {SERVICE_CONTRACT_VERSION, type ServiceType} from './contract.js'\n\n/**\n * The service's own declaration, surfaced to the callback.\n * @public\n */\nexport interface ServiceInfo {\n readonly name: string\n readonly type: string\n}\n\n/**\n * The message bus as a service sees it: the SDK's `MessageBus` without the\n * `subscribe` forms that return observables, which would make the service's\n * project install rxjs. There is no `disconnect`: Dashboard owns the connection\n * and ends it when it stops the worker.\n * @public\n */\nexport interface ServiceBus extends Omit<MessageBus, 'subscribe'> {\n /** Runs a responder for each event until its signal aborts. */\n subscribe<K extends EventTopic>(\n type: K,\n handler: (message: MessageBusMessage<PayloadOf<K>, ReplyOf<K>, K>) => void,\n options?: MessageBusAbortOptions,\n ): void\n /** Runs a handler for each state value until its signal aborts. */\n subscribe<K extends StateTopic>(\n type: K,\n handler: (value: ValueOf<K>) => void,\n options?: MessageBusAbortOptions,\n ): void\n}\n\n/**\n * Context every service callback receives when its worker starts. Mirrors how a\n * view component receives its `view` — the service receives its own `service`.\n * @public\n */\nexport interface ServiceContext {\n readonly bus: ServiceBus\n readonly service: ServiceInfo\n}\n\n/**\n * A service callback. Runs once inside the worker on start; returns an optional\n * disposer the host calls before terminating the worker.\n * @public\n */\nexport type ServiceCallback = (context: ServiceContext) => (() => void) | void\n\n/** The callback shape each service type defines, keyed by type. */\ninterface ServiceCallbacksByType {\n worker: ServiceCallback\n}\n\n/**\n * The result of `unstable_defineService`: the author's callback, the service\n * type, and the internal contract version the worker artifact targets.\n * @public\n */\nexport interface DefinedService<TType extends ServiceType = ServiceType> {\n readonly run: ServiceCallbacksByType[TType]\n readonly type: TType\n /** @internal */\n readonly version: typeof SERVICE_CONTRACT_VERSION\n}\n\n/**\n * Define a Sanity Dashboard background service. The first argument narrows the\n * callback shape — `\"worker\"` runs the callback inside a Web Worker.\n *\n * The callback receives `bus`, its connection to the Dashboard message bus:\n * `bus.emit` sends an event (such as a dock-badge update), `bus.query` reads the\n * current value of a state topic, and `bus.subscribe` runs a handler on each\n * new value of a state topic, or on each event of an event topic, until its\n * `signal` aborts. A refused, unanswered or timed-out `emit` or `query` rejects\n * with an `Error` named `MessageBusError` whose `code` says why; it is not an\n * instance of the SDK's `MessageBusError` class. When the Dashboard's refusal\n * says how to fix it, the error also carries `fix` and `docsUrl`. A refused\n * `subscribe` has no error: its handler never runs, and the Dashboard reports\n * the refusal in the browser console.\n *\n * An event handler answers the sender with `message.reply(value)` or refuses\n * with `message.reject(reason)`; one that throws refuses with code\n * `HANDLER_THREW`. For example, a service that keeps a snapshot for its app's\n * views, which listen with `useWorker` first and then post to it. A view's post\n * arrives on `workers.post` as `{name, payload}`, and `workers.message` reaches\n * only this app's views:\n *\n * ```ts\n * export default unstable_defineService('worker', ({bus}) => {\n * const controller = new AbortController()\n * bus.subscribe('workers.post', (message) => message.reply(snapshot), {\n * signal: controller.signal,\n * })\n * // Views that are already listening post again.\n * bus.emit('workers.message', {type: 'welcome'})\n * return () => controller.abort()\n * })\n * ```\n *\n * The callback can return a disposer, which runs when Dashboard stops the\n * worker. By then the bus is closed: subscriptions have ended, `emit` and\n * `query` reject with code `ABORTED`, and `subscribe` throws that error.\n *\n * Identity at runtime: returns the callback tagged with its type and the contract\n * version, for the CLI build to generate a worker artifact from. Used as the\n * default export of a service's `src` file.\n * @public\n */\nexport function unstable_defineService<TType extends ServiceType>(\n type: TType,\n run: ServiceCallbacksByType[TType],\n): DefinedService<TType> {\n return {run, type, version: SERVICE_CONTRACT_VERSION}\n}\n"],"names":["SERVICE_CONTRACT_VERSION","unstable_defineService","type","run","version"],"mappings":"AAWA,SAAQA,wBAAwB,QAAyB,gBAAe;AAmExE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CC,GACD,OAAO,SAASC,uBACdC,IAAW,EACXC,GAAkC;IAElC,OAAO;QAACA;QAAKD;QAAME,SAASJ;IAAwB;AACtD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/workbench-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.15.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",
|
|
@@ -51,6 +51,10 @@
|
|
|
51
51
|
"source": "./src/_exports/_internal_worker_bus.ts",
|
|
52
52
|
"default": "./dist/_exports/_internal_worker_bus.js"
|
|
53
53
|
},
|
|
54
|
+
"./_internal_auto_updates": {
|
|
55
|
+
"source": "./src/_exports/_internal_auto_updates.ts",
|
|
56
|
+
"default": "./dist/_exports/_internal_auto_updates.js"
|
|
57
|
+
},
|
|
54
58
|
"./undeploy": {
|
|
55
59
|
"source": "./src/_exports/undeploy.ts",
|
|
56
60
|
"default": "./dist/_exports/undeploy.js"
|
|
@@ -63,7 +67,7 @@
|
|
|
63
67
|
"dependencies": {
|
|
64
68
|
"@module-federation/runtime": "2.9.2",
|
|
65
69
|
"@module-federation/vite": "1.23.5",
|
|
66
|
-
"@sanity/cli-core": "^3.
|
|
70
|
+
"@sanity/cli-core": "^3.14.1",
|
|
67
71
|
"@sanity/sdk": "^3.8.0",
|
|
68
72
|
"@sanity/types": "^6.17.0",
|
|
69
73
|
"@vitejs/plugin-react": "^6.1.2",
|
|
@@ -78,12 +82,12 @@
|
|
|
78
82
|
"@eslint/compat": "^2.1.0",
|
|
79
83
|
"@repo/package.config": "0.0.1",
|
|
80
84
|
"@repo/tsconfig": "3.70.0",
|
|
81
|
-
"@sanity/cli-test": "
|
|
85
|
+
"@sanity/cli-test": "24.0.1",
|
|
82
86
|
"@sanity/eslint-config-cli": "^1.1.3",
|
|
83
87
|
"@sanity/pkg-utils": "^12.3.4",
|
|
84
88
|
"@swc/cli": "^0.8.1",
|
|
85
89
|
"@swc/core": "^1.15.43",
|
|
86
|
-
"@types/node": "^22.20.
|
|
90
|
+
"@types/node": "^22.20.5",
|
|
87
91
|
"@types/react": "^19.3.0",
|
|
88
92
|
"@types/semver": "^7.7.1",
|
|
89
93
|
"@vitest/coverage-istanbul": "^4.1.11",
|