fix(FN-4557): replace loose node-pty ambient shim in @fusion/desktop with accurate IPty surface
Fusion-Task-Id: FN-4557 Fusion-Task-Lineage: 53e20d45-b7e9-43d6-bf6f-2a5a3b568d4a
This commit is contained in:
74
packages/desktop/src/node-pty.d.ts
vendored
74
packages/desktop/src/node-pty.d.ts
vendored
@@ -1,12 +1,70 @@
|
||||
/** Desktop must mirror dashboard's node-pty shim because desktop typechecks dashboard source via @fusion/dashboard workspace imports. */
|
||||
declare module "node-pty" {
|
||||
/**
|
||||
* An object that can be disposed via a dispose function.
|
||||
*/
|
||||
export interface IDisposable {
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* An event that can be listened to.
|
||||
* @returns an IDisposable to stop listening.
|
||||
*/
|
||||
export interface IEvent<T> {
|
||||
(listener: (e: T) => unknown): IDisposable;
|
||||
}
|
||||
|
||||
export interface IBasePtyForkOptions {
|
||||
name?: string;
|
||||
cols?: number;
|
||||
rows?: number;
|
||||
cwd?: string;
|
||||
env?: { [key: string]: string | undefined };
|
||||
encoding?: string | null;
|
||||
handleFlowControl?: boolean;
|
||||
flowControlPause?: string;
|
||||
flowControlResume?: string;
|
||||
}
|
||||
|
||||
export interface IPtyForkOptions extends IBasePtyForkOptions {
|
||||
uid?: number;
|
||||
gid?: number;
|
||||
}
|
||||
|
||||
export interface IWindowsPtyForkOptions extends IBasePtyForkOptions {
|
||||
useConpty?: boolean;
|
||||
useConptyDll?: boolean;
|
||||
conptyInheritCursor?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An interface representing a pseudoterminal.
|
||||
*/
|
||||
export interface IPty {
|
||||
[key: string]: unknown;
|
||||
readonly pid: number;
|
||||
readonly cols: number;
|
||||
readonly rows: number;
|
||||
readonly process: string;
|
||||
handleFlowControl: boolean;
|
||||
readonly onData: IEvent<string>;
|
||||
readonly onExit: IEvent<{ exitCode: number; signal?: number }>;
|
||||
resize(columns: number, rows: number): void;
|
||||
on(event: "data", listener: (data: string) => void): void;
|
||||
on(event: "exit", listener: (exitCode: number, signal?: number) => void): void;
|
||||
clear(): void;
|
||||
write(data: string): void;
|
||||
kill(signal?: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
}
|
||||
export interface IPtyForkOptions {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export interface IWindowsPtyForkOptions extends IPtyForkOptions {
|
||||
[key: string]: unknown;
|
||||
}
|
||||
export function spawn(...args: unknown[]): IPty;
|
||||
|
||||
/**
|
||||
* Forks a process as a pseudoterminal.
|
||||
*/
|
||||
export function spawn(
|
||||
file: string,
|
||||
args: string[] | string,
|
||||
options: IPtyForkOptions | IWindowsPtyForkOptions,
|
||||
): IPty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user