@codesandbox/sandpack-client
Version:
<img style="width:100%" src="https://user-images.githubusercontent.com/4838076/143581035-ebee5ba2-9cb1-4fe8-a05b-2f44bd69bb4b.gif" alt="Component toolkit for live running code editing experiences" />
65 lines (64 loc) • 1.52 kB
TypeScript
import type { FilesMap, WorkerStatusUpdate } from "@codesandbox/nodebox";
import type { BaseSandpackMessage, SandpackErrorMessage, SandpackLogLevel } from "../..";
type SandpackStandartMessages = {
type: "start";
firstLoad?: boolean;
} | {
type: "done";
compilatonError: boolean;
};
type SandpackBundlerMessages = {
type: "compile";
modules: FilesMap;
template?: string;
logLevel?: SandpackLogLevel;
} | ({
type: "action";
action: "show-error";
} & SandpackErrorMessage) | {
type: "action";
action: "notification";
notificationType: "error";
title: string;
};
type SandpackFSMessages = {
type: "fs/change";
path: string;
content: string;
} | {
type: "fs/remove";
path: string;
};
type SandpackURLsMessages = {
type: "urlchange";
url: string;
back: boolean;
forward: boolean;
} | {
type: "refresh";
} | {
type: "urlback";
} | {
type: "urlforward";
};
type SandpackShellMessages = {
type: "shell/restart";
} | {
type: "shell/openPreview";
} | {
type: "shell/progress";
data: WorkerStatusUpdate & {
command?: string;
};
};
export type SandpackNodeMessage = BaseSandpackMessage & (SandpackStandartMessages | SandpackURLsMessages | SandpackBundlerMessages | SandpackShellMessages | {
type: "connected";
} | {
type: "stdout";
payload: SandpackShellStdoutData;
} | SandpackFSMessages);
export interface SandpackShellStdoutData {
data?: string;
type?: "out" | "err";
}
export {};