@sanity/workbench-cli 2.18.0 → 2.19.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 (32) hide show
  1. package/dist/_exports/_internal_worker_bus.d.ts +2 -2
  2. package/dist/_exports/deploy.d.ts +22 -6
  3. package/dist/_exports/deploy.js +1 -0
  4. package/dist/_exports/deploy.js.map +1 -1
  5. package/dist/_exports/dev.d.ts +2 -0
  6. package/dist/_exports/index.d.ts +67 -2
  7. package/dist/_exports/preview.d.ts +2 -0
  8. package/dist/_exports/{summarizeInterfaces-CpCUSMrz.d.ts → summarizeInterfaces-DGh6ARce.d.ts} +2 -2
  9. package/dist/_exports/undeploy.d.ts +1 -1
  10. package/dist/actions/build/webWorkers/workerBus.js.map +1 -1
  11. package/dist/actions/deploy/deployWorkbenchApp.js +21 -7
  12. package/dist/actions/deploy/deployWorkbenchApp.js.map +1 -1
  13. package/dist/actions/dev/deriveConfigs.js +1 -1
  14. package/dist/actions/dev/deriveConfigs.js.map +1 -1
  15. package/dist/actions/dev/startDevServerRegistration.js +16 -1
  16. package/dist/actions/dev/startDevServerRegistration.js.map +1 -1
  17. package/dist/actions/dev/startWorkbenchDev.js.map +1 -1
  18. package/dist/actions/preview/serveBuiltApplication.js +12 -1
  19. package/dist/actions/preview/serveBuiltApplication.js.map +1 -1
  20. package/dist/actions/preview/startWorkbenchPreview.js +11 -0
  21. package/dist/actions/preview/startWorkbenchPreview.js.map +1 -1
  22. package/dist/appId.js +1 -1
  23. package/dist/appId.js.map +1 -1
  24. package/dist/defineApp.js +4 -3
  25. package/dist/defineApp.js.map +1 -1
  26. package/dist/readAppIcon.js +31 -0
  27. package/dist/readAppIcon.js.map +1 -0
  28. package/dist/services/applications.js +18 -0
  29. package/dist/services/applications.js.map +1 -1
  30. package/dist/webWorker.js.map +1 -1
  31. package/package.json +12 -13
  32. package/dist/_exports/webWorker-TWUbh0uo.d.ts +0 -123
@@ -1,123 +0,0 @@
1
- import { g as WEB_WORKER_CONTRACT_VERSION, v as WebWorkerType } from "./contract-WrU3aOYd.js";
2
- import { EventTopic, MessageBus, MessageBusAbortOptions, MessageBusMessage, PayloadOf, ReplyOf, StateTopic, ValueOf } from "@sanity/sdk/dashboard";
3
- /**
4
- * The web worker's own declaration.
5
- * @public
6
- */
7
- interface WebWorkerInfo {
8
- readonly name: string;
9
- readonly type: string;
10
- }
11
- /**
12
- * The message bus as a web worker sees it: the SDK's `MessageBus` without the
13
- * `subscribe` forms that return observables, which would make the web worker's
14
- * project install rxjs. There is no `disconnect`: Dashboard owns the connection
15
- * and ends it when it stops the worker.
16
- * @public
17
- */
18
- interface WebWorkerBus extends Omit<MessageBus, 'subscribe'> {
19
- /** Runs a responder for each event until its signal aborts. */
20
- subscribe<K extends EventTopic>(type: K, handler: (message: MessageBusMessage<PayloadOf<K>, ReplyOf<K>, K>) => void, options?: MessageBusAbortOptions): void;
21
- /** Runs a handler for each state value until its signal aborts. */
22
- subscribe<K extends StateTopic>(type: K, handler: (value: ValueOf<K>) => void, options?: MessageBusAbortOptions): void;
23
- }
24
- /**
25
- * Context every service callback receives when its worker starts. Mirrors how a
26
- * view component receives its `view` — the service receives its own `service`.
27
- * @deprecated Use {@link WebWorkerProps}.
28
- * @public
29
- */
30
- interface ServiceContext {
31
- readonly bus: WebWorkerBus;
32
- readonly service: WebWorkerInfo;
33
- }
34
- /**
35
- * Props a web worker function receives when its worker starts. The default
36
- * export of a web worker's `src` file runs once inside the worker.
37
- *
38
- * `bus` is its connection to the Dashboard message bus:
39
- * `bus.emit` sends an event (such as a dock-badge update), `bus.query` reads the
40
- * current value of a state topic, and `bus.subscribe` runs a handler on each
41
- * new value of a state topic, or on each event of an event topic, until its
42
- * `signal` aborts. A refused, unanswered or timed-out `emit` or `query` rejects
43
- * with an `Error` named `MessageBusError` whose `code` says why; it is not an
44
- * instance of the SDK's `MessageBusError` class. When the Dashboard's refusal
45
- * says how to fix it, the error also carries `fix` and `docsUrl`. A refused
46
- * `subscribe` has no error: its handler never runs, and the Dashboard reports
47
- * the refusal in the browser console.
48
- *
49
- * An event handler answers the sender with `message.reply(value)` or refuses
50
- * with `message.reject(reason)`; one that throws refuses with code
51
- * `HANDLER_THREW`. For example, a worker that keeps a snapshot for its app's
52
- * views, which listen with `useWorker` first and then post to it. A view's post
53
- * arrives on `workers.post` as `{name, payload}`, and `workers.message` reaches
54
- * only this app's views:
55
- *
56
- * ```ts
57
- * export default ({bus}: WebWorkerProps) => {
58
- * const controller = new AbortController()
59
- * bus.subscribe('workers.post', (message) => message.reply(snapshot), {
60
- * signal: controller.signal,
61
- * })
62
- * // Views that are already listening post again.
63
- * bus.emit('workers.message', {type: 'welcome'})
64
- * return () => controller.abort()
65
- * }
66
- * ```
67
- *
68
- * The function can return a disposer, which runs when Dashboard stops the
69
- * worker. By then the bus is closed: subscriptions have ended, `emit` and
70
- * `query` reject with code `ABORTED`, and `subscribe` throws that error.
71
- * @public
72
- */
73
- interface WebWorkerProps {
74
- readonly bus: WebWorkerBus;
75
- readonly worker: WebWorkerInfo;
76
- }
77
- /**
78
- * A service callback. Runs once inside the worker on start; returns an optional
79
- * disposer the host calls before terminating the worker.
80
- * @deprecated Default-export a plain function that receives {@link WebWorkerProps} instead.
81
- * @public
82
- */
83
- type ServiceCallback = (context: ServiceContext) => (() => void) | void;
84
- /** The callback shape each service type defines, keyed by type. */
85
- interface ServiceCallbacksByType {
86
- worker: ServiceCallback;
87
- }
88
- /**
89
- * The result of `unstable_defineService`: the author's callback, the service
90
- * type, and the internal contract version the worker artifact targets.
91
- * @deprecated Default-export a plain function that receives {@link WebWorkerProps} instead.
92
- * @public
93
- */
94
- interface DefinedService<TType extends WebWorkerType = WebWorkerType> {
95
- readonly run: ServiceCallbacksByType[TType];
96
- readonly type: TType;
97
- /** @internal */
98
- readonly version: typeof WEB_WORKER_CONTRACT_VERSION;
99
- }
100
- /**
101
- * Define a Sanity Dashboard background service. The first argument narrows the
102
- * callback shape — `"worker"` runs the callback inside a Web Worker with the
103
- * bus described on {@link WebWorkerProps}.
104
- *
105
- * Identity at runtime: returns the callback tagged with its type and the contract
106
- * version, for the CLI build to generate a worker artifact from. Used as the
107
- * default export of a service's `src` file.
108
- * @deprecated Default-export a plain function that receives {@link WebWorkerProps} from the web worker's `src` file instead.
109
- * @public
110
- */
111
- declare function unstable_defineService<TType extends WebWorkerType>(type: TType, run: ServiceCallbacksByType[TType]): DefinedService<TType>;
112
- /**
113
- * @deprecated Use `WebWorkerBus`.
114
- * @public
115
- */
116
- type ServiceBus = WebWorkerBus;
117
- /**
118
- * @deprecated Use `WebWorkerInfo`.
119
- * @public
120
- */
121
- type ServiceInfo = WebWorkerInfo;
122
- export { ServiceInfo as a, WebWorkerProps as c, ServiceContext as i, unstable_defineService as l, ServiceBus as n, WebWorkerBus as o, ServiceCallback as r, WebWorkerInfo as s, DefinedService as t };
123
- //# sourceMappingURL=webWorker-TWUbh0uo.d.ts.map