Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-escapes

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-escapes - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

14

index.d.ts
/* eslint-disable @typescript-eslint/member-ordering */
import {LiteralUnion} from 'type-fest';
import type {Buffer} from 'node:buffer';
import type {LiteralUnion} from 'type-fest';
export interface ImageOptions {
export type ImageOptions = {
/**

@@ -25,6 +26,9 @@ The width is given as a number followed by a unit, or the word `'auto'`.

/**
@default true
*/
readonly preserveAspectRatio?: boolean;
}
};
export interface AnnotationOptions {
export type AnnotationOptions = {
/**

@@ -61,3 +65,3 @@ Nonzero number of columns to annotate.

readonly isHidden?: boolean;
}
};

@@ -64,0 +68,0 @@ declare const ansiEscapes: {

@@ -0,1 +1,3 @@

import process from 'node:process';
const ESC = '\u001B[';

@@ -5,2 +7,3 @@ const OSC = '\u001B]';

const SEP = ';';
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';

@@ -19,3 +22,3 @@

return ESC + (y + 1) + ';' + (x + 1) + 'H';
return ESC + (y + 1) + SEP + (x + 1) + 'H';
};

@@ -84,4 +87,4 @@

ansiEscapes.clearTerminal = process.platform === 'win32' ?
`${ansiEscapes.eraseScreen}${ESC}0f` :
ansiEscapes.clearTerminal = process.platform === 'win32'
? `${ansiEscapes.eraseScreen}${ESC}0f`
// 1. Erases the screen (Only done in case `2` is not supported)

@@ -91,22 +94,20 @@ // 2. Erases the whole screen including scrollback buffer

// More info: https://www.real-world-systems.com/docs/ANSIcode.html
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
: `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
ansiEscapes.beep = BEL;
ansiEscapes.link = (text, url) => {
return [
OSC,
'8',
SEP,
SEP,
url,
BEL,
text,
OSC,
'8',
SEP,
SEP,
BEL
].join('');
};
ansiEscapes.link = (text, url) => [
OSC,
'8',
SEP,
SEP,
url,
BEL,
text,
OSC,
'8',
SEP,
SEP,
BEL,
].join('');

@@ -134,3 +135,3 @@ ansiEscapes.image = (buffer, options = {}) => {

annotation: (message, options = {}) => {
annotation(message, options = {}) {
let returnValue = `${OSC}1337;`;

@@ -149,6 +150,7 @@

if (options.length > 0) {
returnValue +=
(hasX ?
[message, options.length, options.x, options.y] :
[options.length, message]).join('|');
returnValue += (
hasX
? [message, options.length, options.x, options.y]
: [options.length, message]
).join('|');
} else {

@@ -159,5 +161,5 @@ returnValue += message;

return returnValue + BEL;
}
},
};
export default ansiEscapes;
{
"name": "ansi-escapes",
"version": "5.0.0",
"version": "6.0.0",
"description": "ANSI escape codes for manipulating the terminal",

@@ -15,4 +15,5 @@ "license": "MIT",

"exports": "./index.js",
"types": "./index.d.ts",
"engines": {
"node": ">=12"
"node": ">=14.16"
},

@@ -52,10 +53,10 @@ "scripts": {

"dependencies": {
"type-fest": "^1.0.2"
"type-fest": "^3.0.0"
},
"devDependencies": {
"@types/node": "^14.14.41",
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
"@types/node": "^18.7.18",
"ava": "^4.3.3",
"tsd": "^0.24.1",
"xo": "^0.52.3"
}
}

@@ -7,5 +7,5 @@ # ansi-escapes

```sh
npm install ansi-escapes
```
$ npm install ansi-escapes
```

@@ -235,13 +235,1 @@ ## Usage

- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
---
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-ansi-escapes?utm_source=npm-ansi-escapes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc