claude-code/ink/wrapAnsi.ts
kuberwastaken ec53fcbe95 init
2026-03-31 16:25:52 +05:30

20 lines
383 B
TypeScript

import wrapAnsiNpm from 'wrap-ansi'
type WrapAnsiOptions = {
hard?: boolean
wordWrap?: boolean
trim?: boolean
}
const wrapAnsiBun =
typeof Bun !== 'undefined' && typeof Bun.wrapAnsi === 'function'
? Bun.wrapAnsi
: null
const wrapAnsi: (
input: string,
columns: number,
options?: WrapAnsiOptions,
) => string = wrapAnsiBun ?? wrapAnsiNpm
export { wrapAnsi }