UNPKG

storybook

Version:

Storybook: Develop, document, and test UI components in isolation

67 lines (66 loc) 2.57 kB
import { d as ToolsStorybookInfo, o as ToolsClientInfo } from "../../../chunk-ByoeRqRY.js"; //#region code/core/.dts-emit/code/core/src/shared/open-service/service-error-serialization.d.ts /** * Error (de)serialization for remote command execution. * * A command invoked from a runtime that has no local handler runs on a peer; when it throws, the * thrown value has to cross the channel and be rethrown on the requester. `Error` instances are not * structured-cloneable in a way that survives a websocket (JSON) or postMessage transport with their * `name`, `stack`, `cause`, and Storybook-specific fields (`code`, `fromStorybook`, …) intact, so we * convert to and from a plain, transport-safe shape here. * * The conversion is recursive: an error's `cause` (and any nested arrays/objects, e.g. the * `cause.aggregated` array used by the `.loaded()` drain) is walked so a multi-cause failure arrives * on the requester with its chain reconstructed rather than flattened to a single message. */ /** Marks a serialized object as a reconstructable `Error` rather than a plain payload object. */ declare const ERROR_MARKER: '__openServiceError__'; /** Transport-safe representation of a thrown `Error`, including its recursive `cause` chain. */ interface SerializedError { [ERROR_MARKER]: true; name: string; message: string; stack?: string; /** The error's `cause`, itself serialized (another error, a plain object, an array, …). */ cause?: unknown; /** Extra own enumerable fields (e.g. Storybook's `code`, `fromStorybook`), serialized. */ properties?: Record<string, unknown>; } //#endregion //#region code/core/.dts-emit/code/core/src/cli/tools/sdk/child-protocol.d.ts type ChildHelloMessage = { type: 'hello'; version: number; storybook: ToolsStorybookInfo; clientInfo: Required<ToolsClientInfo>; }; type ChildResultMessage = { type: 'result'; id: string; value: unknown; }; type ChildErrorMessage = { type: 'error'; id: string; error: SerializedError; }; type ChildTelemetryMessage = { type: 'telemetry'; id: string; event: string; payload: Record<string, unknown>; }; type ChildMessage = ChildHelloMessage | ChildResultMessage | ChildErrorMessage | ChildTelemetryMessage; //#endregion //#region code/core/.dts-emit/code/core/src/cli/tools/sdk/child-host.d.ts declare function runChildHost({ send, subscribe, cwd }?: { send?: (message: ChildMessage) => void; subscribe?: (handler: (message: unknown) => void) => void; cwd?: () => string; }): Promise<void>; //#endregion export { runChildHost };