{"_id":"@cjser/ansi-escapes","name":"@cjser/ansi-escapes","dist-tags":{"latest":"7.3.0-cjser.2"},"versions":{"7.3.0-cjser.2":{"name":"@cjser/ansi-escapes","version":"7.3.0-cjser.2","description":"ANSI escape codes for manipulating the terminal","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","require":"./dist-cjser/index.cjs","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"ava && tsd","//test":"xo && ava && tsd"},"keywords":["ansi","terminal","console","cli","string","tty","escape","escapes","formatting","shell","xterm","log","logging","command-line","text","vt100","sequence","control","code","codes","cursor","iterm","iterm2","clear","screen","erase","scrollback"],"dependencies":{"@cjser/environment":"1.1.0-cjser.2"},"devDependencies":{"@types/node":"20.12.8","ava":"^6.1.2","tsd":"0.31.0","xo":"^0.58.0"},"types":"./index.d.ts","main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"7.3.0","cjserVersion":2,"original":{"name":"ansi-escapes","version":"7.3.0","exports":{"types":"./index.d.ts","default":"./index.js"},"repository":"sindresorhus/ansi-escapes","dependencies":{"environment":"^1.0.0"},"files":["index.js","index.d.ts","base.js","base.d.ts"],"scripts":{"test":"ava && tsd","//test":"xo && ava && tsd"}}},"_id":"@cjser/ansi-escapes@7.3.0-cjser.2","gitHead":"0168e4aac54a1a9ca6f921419fa5ed9edb53ef4a","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-5JQVj9LeuYJsaif3y1qIkNROdFzNKhez7ZQgRK8ej5LYIRxaDMrhVp9rdVFanui6B9n9hTLZYjAFP/hALW2MIQ==","shasum":"31d8b0b0e60199fa1aa282ddc8252a5368c89a85","tarball":"https://registry.npmjs.org/@cjser/ansi-escapes/-/ansi-escapes-7.3.0-cjser.2.tgz","fileCount":8,"unpackedSize":33275,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDEeKYxEdOb0X1k0OkAhsQfcoZPzrI6pa1XhaPPFOfEkAiEAgiakwH5uSO8UpGuedXpAkxezeLo0UGY0GbD63fde9UM="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ansi-escapes_7.3.0-cjser.2_1778130362729_0.37010542980380134"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T05:06:02.616Z","7.3.0-cjser.2":"2026-05-07T05:06:02.914Z","modified":"2026-05-07T05:06:03.190Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"ANSI escape codes for manipulating the terminal","keywords":["ansi","terminal","console","cli","string","tty","escape","escapes","formatting","shell","xterm","log","logging","command-line","text","vt100","sequence","control","code","codes","cursor","iterm","iterm2","clear","screen","erase","scrollback"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# ansi-escapes\n\n> [ANSI escape codes](https://www2.ccs.neu.edu/research/gpc/VonaUtils/vona/terminal/vtansi.htm) for manipulating the terminal\n\n## Install\n\n```sh\nnpm install ansi-escapes\n```\n\n## Usage\n\n```js\nimport ansiEscapes from 'ansi-escapes';\n\n// Moves the cursor two rows up and to the left\nprocess.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);\n//=> '\\u001B[2A\\u001B[1000D'\n```\n\nOr use named exports...\n\n```js\nimport {cursorUp, cursorLeft} from 'ansi-escapes';\n\n// etc, as above...\n```\n\n**You can also use it in the browser with Xterm.js:**\n\n```js\nimport ansiEscapes from 'ansi-escapes';\nimport {Terminal} from 'xterm';\nimport 'xterm/css/xterm.css';\n\nconst terminal = new Terminal({…});\n\n// Moves the cursor two rows up and to the left\nterminal.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);\n//=> '\\u001B[2A\\u001B[1000D'\n```\n\n## API\n\n### cursorTo(x, y?)\n\nSet the absolute position of the cursor. `x0` `y0` is the top left of the screen.\n\n### cursorMove(x, y?)\n\nSet the position of the cursor relative to its current position.\n\n### cursorUp(count)\n\nMove cursor up a specific amount of rows. Default is `1`.\n\n### cursorDown(count)\n\nMove cursor down a specific amount of rows. Default is `1`.\n\n### cursorForward(count)\n\nMove cursor forward a specific amount of columns. Default is `1`.\n\n### cursorBackward(count)\n\nMove cursor backward a specific amount of columns. Default is `1`.\n\n### cursorLeft\n\nMove cursor to the left side.\n\n### cursorSavePosition\n\nSave cursor position.\n\n### cursorRestorePosition\n\nRestore saved cursor position.\n\n### cursorGetPosition\n\nGet cursor position.\n\n### cursorNextLine\n\nMove cursor to the next line.\n\n### cursorPrevLine\n\nMove cursor to the previous line.\n\n### cursorHide\n\nHide cursor.\n\n### cursorShow\n\nShow cursor.\n\n### eraseLines(count)\n\nErase from the current cursor position up the specified amount of rows.\n\n### eraseEndLine\n\nErase from the current cursor position to the end of the current line.\n\n### eraseStartLine\n\nErase from the current cursor position to the start of the current line.\n\n### eraseLine\n\nErase the entire current line.\n\n### eraseDown\n\nErase the screen from the current line down to the bottom of the screen.\n\n### eraseUp\n\nErase the screen from the current line up to the top of the screen.\n\n### eraseScreen\n\nErase the screen and move the cursor the top left position.\n\n### scrollUp\n\nScroll display up one line.\n\n### scrollDown\n\nScroll display down one line.\n\n### clearViewport\n\nClear only the visible terminal screen (viewport) without affecting scrollback buffer or terminal state.\n\nThis is a safer alternative to `clearScreen` that works consistently across terminals.\n\n### clearScreen\n\nClear the terminal screen.\n\n> [!WARNING]\n> This uses RIS (Reset to Initial State) which may also clear scrollback buffer in some terminals (xterm.js, VTE) and reset terminal modes. Consider using `clearViewport()` for safer viewport-only clearing.\n\n### clearTerminal\n\nClear the whole terminal, including scrollback buffer. (Not just the visible part of it)\n\n### enterAlternativeScreen\n\nEnter the [alternative screen](https://terminalguide.namepad.de/mode/p47/).\n\n### exitAlternativeScreen\n\nExit the [alternative screen](https://terminalguide.namepad.de/mode/p47/), assuming `enterAlternativeScreen` was called before.\n\n### beginSynchronizedOutput\n\nBegin [synchronized output](https://contour-terminal.org/vt-extensions/synchronized-output/) to reduce flicker during renders.\n\n### endSynchronizedOutput\n\nEnd [synchronized output](https://contour-terminal.org/vt-extensions/synchronized-output/).\n\n### synchronizedOutput(text)\n\nWrap output in [synchronized output](https://contour-terminal.org/vt-extensions/synchronized-output/) sequences to reduce flicker during renders.\n\n### beep\n\nOutput a beeping sound.\n\n### link(text, url)\n\nCreate a clickable link.\n\n[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.\n\n### image(filePath, options?)\n\nDisplay an image.\n\nSee [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.\n\n#### input\n\nType: `Buffer`\n\nBuffer of an image. Usually read in with `fs.readFile()`.\n\n#### options\n\nType: `object`\n\n##### width\n##### height\n\nType: `string | number`\n\nThe width and height are given as a number followed by a unit, or the word \"auto\".\n\n- `N`: N character cells.\n- `Npx`: N pixels.\n- `N%`: N percent of the session's width or height.\n- `auto`: The image's inherent size will be used to determine an appropriate dimension.\n\n##### preserveAspectRatio\n\nType: `boolean`\\\nDefault: `true`\n\n### setCwd(path?)\n\nType: `string`\\\nDefault: `process.cwd()`\n\nSet the current working directory for both iTerm2 and ConEmu.\n\n### iTerm.setCwd(path?)\n\nType: `string`\\\nDefault: `process.cwd()`\n\n[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).\n\n### ConEmu.setCwd(path?)\n\nType: `string`\\\nDefault: `process.cwd()`\n\n[Inform ConEmu](https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC) about shell current working directory.\n\n### iTerm.annotation(message, options?)\n\nCreates an escape code to display an \"annotation\" in iTerm2.\n\nAn annotation looks like this when shown:\n\n<img src=\"https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png\" width=\"500\">\n\nSee the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.\n\n#### message\n\nType: `string`\n\nThe message to display within the annotation.\n\nThe `|` character is disallowed and will be stripped.\n\n#### options\n\nType: `object`\n\n##### length\n\nType: `number`\\\nDefault: The remainder of the line\n\nNonzero number of columns to annotate.\n\n##### x\n\nType: `number`\\\nDefault: Cursor position\n\nStarting X coordinate.\n\nMust be used with `y` and `length`.\n\n##### y\n\nType: `number`\\\nDefault: Cursor position\n\nStarting Y coordinate.\n\nMust be used with `x` and `length`.\n\n##### isHidden\n\nType: `boolean`\\\nDefault: `false`\n\nCreate a \"hidden\" annotation.\n\nAnnotations created this way can be shown using the \"Show Annotations\" iTerm command.\n\n## Related\n\n- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/ansi-escapes\n","readmeFilename":"readme.md","_rev":"1-f89b49fc8fa0e924f19d48fdfe87d868"}