Skip to content

Commit 48311c2

Browse files
committed
fix: coderabbit comments
1 parent 28d2d0f commit 48311c2

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

cli/src/node-pty.d.ts

Lines changed: 39 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,53 @@
11
// @lydell/node-pty package.json does not export its types so for nodenext target we need to add them
22
declare module '@lydell/node-pty' {
3-
interface IDisposable {
4-
dispose(): void
3+
export function spawn(
4+
file: string,
5+
args: string[] | string,
6+
options: IPtyForkOptions | IWindowsPtyForkOptions,
7+
): IPty
8+
export interface IBasePtyForkOptions {
9+
name?: string
10+
cols?: number
11+
rows?: number
12+
cwd?: string
13+
env?: { [key: string]: string | undefined }
14+
encoding?: string | null
15+
handleFlowControl?: boolean
16+
flowControlPause?: string
17+
flowControlResume?: string
518
}
619

7-
interface IEvent<T> {
8-
(listener: (e: T) => any): IDisposable
20+
export interface IPtyForkOptions extends IBasePtyForkOptions {
21+
uid?: number
22+
gid?: number
23+
}
24+
25+
export interface IWindowsPtyForkOptions extends IBasePtyForkOptions {
26+
useConpty?: boolean
27+
useConptyDll?: boolean
28+
conptyInheritCursor?: boolean
929
}
1030

11-
interface IPty {
31+
export interface IPty {
1232
readonly pid: number
33+
readonly cols: number
34+
readonly rows: number
35+
readonly process: string
36+
handleFlowControl: boolean
1337
readonly onData: IEvent<string>
1438
readonly onExit: IEvent<{ exitCode: number; signal?: number }>
39+
resize(columns: number, rows: number): void
40+
clear(): void
1541
write(data: string | Buffer): void
1642
kill(signal?: string): void
43+
pause(): void
44+
resume(): void
1745
}
1846

19-
export function spawn(
20-
file: string,
21-
args: string[] | string,
22-
options: {
23-
name?: string
24-
cols?: number
25-
rows?: number
26-
env?: Record<string, string | undefined>
27-
},
28-
): IPty
47+
export interface IDisposable {
48+
dispose(): void
49+
}
50+
export interface IEvent<T> {
51+
(listener: (e: T) => any): IDisposable
52+
}
2953
}

cli/src/npm-client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import './node-pty.d.ts'
21
import crypto from 'node:crypto'
32
import process from 'node:process'
43
import { execFile } from 'node:child_process'

cli/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import './node-pty.d.ts'
2+
13
export interface ConnectorConfig {
24
port: number
35
host: string

0 commit comments

Comments
 (0)