[READ-ONLY] Mirror of https://github.com/bombshell-dev/clack. Effortlessly build beautiful command-line apps bomb.sh/docs/clack/basics/getting-started/
cli command-line command-line-app node prompt prompts
5

Configure Feed

Select the types of activity you want to include in your feed.

chore: use fast-wrap-ansi (#366)

authored by

James Garbutt and committed by
GitHub
(Aug 10, 2025, 11:01 PM +0100) 1a45f93c db8e5a42

+39 -64
+6
.changeset/light-waves-jog.md
··· 1 + --- 2 + "@clack/prompts": patch 3 + "@clack/core": patch 4 + --- 5 + 6 + Switched from wrap-ansi to fast-wrap-ansi
+1 -1
packages/core/package.json
··· 58 58 }, 59 59 "devDependencies": { 60 60 "vitest": "^3.2.4", 61 - "wrap-ansi": "^8.1.0" 61 + "fast-wrap-ansi": "^0.1.3" 62 62 } 63 63 }
+3 -3
packages/core/src/prompts/prompt.ts
··· 1 1 import { stdin, stdout } from 'node:process'; 2 2 import readline, { type Key, type ReadLine } from 'node:readline'; 3 3 import type { Readable, Writable } from 'node:stream'; 4 + import { wrapAnsi } from 'fast-wrap-ansi'; 4 5 import { cursor, erase } from 'sisteransi'; 5 - import wrap from 'wrap-ansi'; 6 6 import type { ClackEvents, ClackState } from '../types.js'; 7 7 import type { Action } from '../utils/index.js'; 8 8 import { CANCEL_SYMBOL, diffLines, isActionKey, setRawMode, settings } from '../utils/index.js'; ··· 253 253 254 254 private restoreCursor() { 255 255 const lines = 256 - wrap(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split('\n') 256 + wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split('\n') 257 257 .length - 1; 258 258 this.output.write(cursor.move(-999, lines * -1)); 259 259 } 260 260 261 261 private render() { 262 - const frame = wrap(this._render(this) ?? '', process.stdout.columns, { 262 + const frame = wrapAnsi(this._render(this) ?? '', process.stdout.columns, { 263 263 hard: true, 264 264 trim: false, 265 265 });
+1 -1
packages/prompts/package.json
··· 62 62 "memfs": "^4.17.2", 63 63 "vitest": "^3.2.4", 64 64 "vitest-ansi-serializer": "^0.1.2", 65 - "wrap-ansi": "^8.1.0" 65 + "fast-wrap-ansi": "^0.1.3" 66 66 } 67 67 }
+3 -3
packages/prompts/src/spinner.ts
··· 1 1 import { block, getColumns, settings } from '@clack/core'; 2 + import { wrapAnsi } from 'fast-wrap-ansi'; 2 3 import color from 'picocolors'; 3 4 import { cursor, erase } from 'sisteransi'; 4 - import wrap from 'wrap-ansi'; 5 5 import { 6 6 type CommonOptions, 7 7 isCI as isCIFn, ··· 96 96 const clearPrevMessage = () => { 97 97 if (_prevMessage === undefined) return; 98 98 if (isCI) output.write('\n'); 99 - const wrapped = wrap(_prevMessage, columns, { 99 + const wrapped = wrapAnsi(_prevMessage, columns, { 100 100 hard: true, 101 101 trim: false, 102 102 }); ··· 144 144 outputMessage = `${frame} ${_message}${loadingDots}`; 145 145 } 146 146 147 - const wrapped = wrap(outputMessage, columns, { 147 + const wrapped = wrapAnsi(outputMessage, columns, { 148 148 hard: true, 149 149 trim: false, 150 150 });
+25 -56
pnpm-lock.yaml
··· 67 67 specifier: ^1.0.5 68 68 version: 1.0.5 69 69 devDependencies: 70 + fast-wrap-ansi: 71 + specifier: ^0.1.3 72 + version: 0.1.3 70 73 vitest: 71 74 specifier: ^3.2.4 72 75 version: 3.2.4(@types/node@24.1.0)(jiti@2.5.0) 73 - wrap-ansi: 74 - specifier: ^8.1.0 75 - version: 8.1.0 76 76 77 77 packages/prompts: 78 78 dependencies: ··· 86 86 specifier: ^1.0.5 87 87 version: 1.0.5 88 88 devDependencies: 89 + fast-wrap-ansi: 90 + specifier: ^0.1.3 91 + version: 0.1.3 89 92 is-unicode-supported: 90 93 specifier: ^1.3.0 91 94 version: 1.3.0 ··· 98 101 vitest-ansi-serializer: 99 102 specifier: ^0.1.2 100 103 version: 0.1.2(vitest@3.2.4(@types/node@24.1.0)(jiti@2.5.0)) 101 - wrap-ansi: 102 - specifier: ^8.1.0 103 - version: 8.1.0 104 104 105 105 packages: 106 106 ··· 747 747 resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} 748 748 engines: {node: '>=8'} 749 749 750 - ansi-regex@6.1.0: 751 - resolution: {integrity: sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==} 752 - engines: {node: '>=12'} 753 - 754 - ansi-styles@6.2.1: 755 - resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} 756 - engines: {node: '>=12'} 757 - 758 750 argparse@1.0.10: 759 751 resolution: {integrity: sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==} 760 752 ··· 938 930 domutils@3.1.0: 939 931 resolution: {integrity: sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==} 940 932 941 - eastasianwidth@0.2.0: 942 - resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} 943 - 944 933 electron-to-chromium@1.5.190: 945 934 resolution: {integrity: sha512-k4McmnB2091YIsdCgkS0fMVMPOJgxl93ltFzaryXqwip1AaxeDqKCGLxkXODDA5Ab/D+tV5EL5+aTx76RvLRxw==} 946 - 947 - emoji-regex@9.2.2: 948 - resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} 949 935 950 936 enquirer@2.4.1: 951 937 resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} ··· 995 981 fast-glob@3.3.3: 996 982 resolution: {integrity: sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==} 997 983 engines: {node: '>=8.6.0'} 984 + 985 + fast-string-truncated-width@1.2.1: 986 + resolution: {integrity: sha512-Q9acT/+Uu3GwGj+5w/zsGuQjh9O1TyywhIwAxHudtWrgF09nHOPrvTLhQevPbttcxjr/SNN7mJmfOw/B1bXgow==} 987 + 988 + fast-string-width@1.1.0: 989 + resolution: {integrity: sha512-O3fwIVIH5gKB38QNbdg+3760ZmGz0SZMgvwJbA1b2TGXceKE6A2cOlfogh1iw8lr049zPyd7YADHy+B7U4W9bQ==} 990 + 991 + fast-wrap-ansi@0.1.3: 992 + resolution: {integrity: sha512-iLg8mLuZBztzm8jmY6/xjr+ci4WYo6eYgHAioTA1ElxkE1BJ9J4tPuDlnHaLfljkRZ2vYfP0CDIpCHBBag4InA==} 998 993 999 994 fastq@1.17.1: 1000 995 resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} ··· 1620 1615 std-env@3.9.0: 1621 1616 resolution: {integrity: sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==} 1622 1617 1623 - string-width@5.1.2: 1624 - resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} 1625 - engines: {node: '>=12'} 1626 - 1627 1618 strip-ansi@6.0.1: 1628 1619 resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} 1629 1620 engines: {node: '>=8'} 1630 1621 1631 - strip-ansi@7.1.0: 1632 - resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} 1633 - engines: {node: '>=12'} 1634 - 1635 1622 strip-bom@3.0.0: 1636 1623 resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} 1637 1624 engines: {node: '>=4'} ··· 1835 1822 resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} 1836 1823 engines: {node: '>=8'} 1837 1824 hasBin: true 1838 - 1839 - wrap-ansi@8.1.0: 1840 - resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} 1841 - engines: {node: '>=12'} 1842 1825 1843 1826 zod-validation-error@3.4.0: 1844 1827 resolution: {integrity: sha512-ZOPR9SVY6Pb2qqO5XHt+MkkTRxGXb4EVtnjc9JpXUOtUB1T9Ru7mZOT361AN3MsetVe7R0a1KZshJDZdgp9miQ==} ··· 2424 2407 2425 2408 ansi-regex@5.0.1: {} 2426 2409 2427 - ansi-regex@6.1.0: {} 2428 - 2429 - ansi-styles@6.2.1: {} 2430 - 2431 2410 argparse@1.0.10: 2432 2411 dependencies: 2433 2412 sprintf-js: 1.0.3 ··· 2624 2603 domelementtype: 2.3.0 2625 2604 domhandler: 5.0.3 2626 2605 2627 - eastasianwidth@0.2.0: {} 2628 - 2629 2606 electron-to-chromium@1.5.190: {} 2630 - 2631 - emoji-regex@9.2.2: {} 2632 2607 2633 2608 enquirer@2.4.1: 2634 2609 dependencies: ··· 2698 2673 merge2: 1.4.1 2699 2674 micromatch: 4.0.8 2700 2675 2676 + fast-string-truncated-width@1.2.1: {} 2677 + 2678 + fast-string-width@1.1.0: 2679 + dependencies: 2680 + fast-string-truncated-width: 1.2.1 2681 + 2682 + fast-wrap-ansi@0.1.3: 2683 + dependencies: 2684 + fast-string-width: 1.1.0 2685 + 2701 2686 fastq@1.17.1: 2702 2687 dependencies: 2703 2688 reusify: 1.0.4 ··· 3290 3275 3291 3276 std-env@3.9.0: {} 3292 3277 3293 - string-width@5.1.2: 3294 - dependencies: 3295 - eastasianwidth: 0.2.0 3296 - emoji-regex: 9.2.2 3297 - strip-ansi: 7.1.0 3298 - 3299 3278 strip-ansi@6.0.1: 3300 3279 dependencies: 3301 3280 ansi-regex: 5.0.1 3302 - 3303 - strip-ansi@7.1.0: 3304 - dependencies: 3305 - ansi-regex: 6.1.0 3306 3281 3307 3282 strip-bom@3.0.0: {} 3308 3283 ··· 3512 3487 dependencies: 3513 3488 siginfo: 2.0.0 3514 3489 stackback: 0.0.2 3515 - 3516 - wrap-ansi@8.1.0: 3517 - dependencies: 3518 - ansi-styles: 6.2.1 3519 - string-width: 5.1.2 3520 - strip-ansi: 7.1.0 3521 3490 3522 3491 zod-validation-error@3.4.0(zod@3.22.4): 3523 3492 dependencies: