Files
ccs/src/types/external.d.ts
T
kaitranntt b915127b3a fix: resolve ESM/CJS compatibility for Node.js 18
Downgrade ESM-only packages to CJS-compatible versions:
- boxen: ^8.0.1 → ^5.1.2
- chalk: ^5.6.2 → ^4.1.2
- chokidar: ^5.0.0 → ^3.6.0
- get-port: ^7.0.0 → ^5.1.1
- gradient-string: ^3.0.0 → ^2.0.2
- listr2: ^9.0.5 → ^3.14.0
- open: ^10.1.0 → ^8.4.2
- ora: ^9.0.0 → ^5.4.1

Update dynamic import handling for CJS module compatibility.
Add type declarations for gradient-string.

Fixes #110
2025-12-15 15:32:34 -05:00

79 lines
1.7 KiB
TypeScript

/**
* Type shims for incomplete external dependencies
*/
declare module 'cli-table3' {
interface TableOptions {
head?: string[];
colWidths?: number[];
colAligns?: ('left' | 'center' | 'right')[];
style?: {
head?: string[];
border?: string[];
};
chars?: Record<string, string>;
}
class Table extends Array {
constructor(options?: TableOptions);
toString(): string;
}
export = Table;
}
// ora v9 has types but we want to ensure compatibility
declare module 'ora' {
interface Options {
text?: string;
color?: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white';
spinner?: string | object;
stream?: NodeJS.WritableStream;
}
interface Ora {
start(text?: string): Ora;
stop(): Ora;
succeed(text?: string): Ora;
fail(text?: string): Ora;
warn(text?: string): Ora;
info(text?: string): Ora;
text: string;
color: string;
}
function ora(options?: string | Options): Ora;
export = ora;
}
// gradient-string v2.x is CJS without bundled types
declare module 'gradient-string' {
interface Gradient {
(text: string): string;
multiline(text: string): string;
}
interface GradientString {
// Preset gradients
atlas: Gradient;
cristal: Gradient;
teen: Gradient;
mind: Gradient;
morning: Gradient;
vice: Gradient;
passion: Gradient;
fruit: Gradient;
instagram: Gradient;
retro: Gradient;
summer: Gradient;
rainbow: Gradient;
pastel: Gradient;
// Custom gradient creator
(colors: string[]): Gradient;
(...colors: string[]): Gradient;
}
const gradient: GradientString;
export = gradient;
}