ansi-escapes
Advanced tools
Comparing version 5.0.0 to 6.0.0
/* 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: { |
54
index.js
@@ -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> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
311
15997
234
2
+ Addedtype-fest@3.13.1(transitive)
- Removedtype-fest@1.4.0(transitive)
Updatedtype-fest@^3.0.0