Skip to content

Commit 6868407

Browse files
jimgqyuclaude
andcommitted
chore: update sliceAnsi imports, tsconfig, and lockfile for Phase 0
- sliceAnsi.ts: redirect ink/ imports to compat/ and string-width npm - tsconfig.json: add skipLibCheck for ink v7 compatibility - pnpm-lock.yaml: updated for new dependency tree Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent a85fdb4 commit 6868407

3 files changed

Lines changed: 157 additions & 141 deletions

File tree

packages/tui/src/utils/sliceAnsi.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type AnsiCode, ansiCodesToString, reduceAnsiCodes, tokenize, undoAnsiCodes } from '@alcalzone/ansi-tokenize'
22

3-
import { lruEvict } from '../ink/lru.js'
4-
import { stringWidth } from '../ink/stringWidth.js'
3+
import { lruEvict } from '../compat/lru.js'
4+
import stringWidth from 'string-width'
55

66
function isEndCode(code: AnsiCode): boolean {
77
return code.code === code.endCode
@@ -66,6 +66,14 @@ function computeSlice(str: string, start: number, end?: number): string {
6666
let include = false
6767

6868
for (const token of tokens) {
69+
// v0.3.x added ControlCode — treat like ANSI (zero width, pass through)
70+
if (token.type === 'control') {
71+
if (include) {
72+
result += token.code;
73+
}
74+
continue;
75+
}
76+
6977
const width = token.type === 'ansi' ? 0 : token.fullWidth ? 2 : stringWidth(token.value)
7078

7179
if (end !== undefined && position >= end) {

packages/tui/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"tsBuildInfoFile": "./dist/.tsbuildinfo",
77
"jsx": "react-jsx",
88
"jsxImportSource": "react",
9-
"noImplicitAny": false
9+
"noImplicitAny": false,
10+
"skipLibCheck": true
1011
},
1112
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.d.ts"],
1213
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]

0 commit comments

Comments
 (0)