supports-hyperlinks
Advanced tools
Comparing version 1.0.1 to 2.0.0
14
index.js
@@ -6,2 +6,12 @@ 'use strict'; | ||
function parseVersion(versionString) { | ||
if (/^\d{3,4}$/.test(versionString)) { | ||
// Env var doesn't always use dots. example: 4601 => 46.1.0 | ||
const m = /(\d{1,2})(\d{2})/.exec(versionString); | ||
return { | ||
major: 0, | ||
minor: parseInt(m[1], 10), | ||
patch: parseInt(m[2], 10) | ||
}; | ||
} | ||
const versions = (versionString || '').split('.').map(n => parseInt(n, 10)); | ||
@@ -16,3 +26,3 @@ return { | ||
function supportsHyperlink(stream) { | ||
const env = process.env; | ||
const {env} = process; | ||
@@ -60,2 +70,3 @@ if ('FORCE_HYPERLINK' in env) { | ||
} | ||
return version.major > 3; | ||
@@ -71,2 +82,3 @@ // No default | ||
} | ||
const version = parseVersion(env.VTE_VERSION); | ||
@@ -73,0 +85,0 @@ return version.major > 0 || version.minor >= 50; |
{ | ||
"name": "supports-hyperlinks", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"description": "Detect if your terminal emulator supports hyperlinks", | ||
@@ -13,3 +13,3 @@ "license": "MIT", | ||
"engines": { | ||
"node": ">=4" | ||
"node": ">=8" | ||
}, | ||
@@ -31,21 +31,11 @@ "scripts": { | ||
"dependencies": { | ||
"has-flag": "^2.0.0", | ||
"supports-color": "^5.0.0" | ||
"has-flag": "^4.0.0", | ||
"supports-color": "^7.0.0" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.20.0", | ||
"babel-preset-env": "^1.6.1", | ||
"babel-preset-stage-3": "^6.24.1", | ||
"codecov": "^2.2.0", | ||
"nyc": "^11.0.0", | ||
"xo": "^0.18.2" | ||
"ava": "^2.2.0", | ||
"codecov": "^3.5.0", | ||
"nyc": "^14.1.1", | ||
"xo": "^0.24.0" | ||
}, | ||
"ava": { | ||
"babel": { | ||
"presets": [ | ||
"env", | ||
"stage-3" | ||
] | ||
} | ||
}, | ||
"nyc": { | ||
@@ -52,0 +42,0 @@ "reporter": [ |
@@ -42,5 +42,8 @@ # supports-hyperlinks [![Build Status](https://travis-ci.org/jamestalmage/supports-hyperlinks.svg?branch=master)](https://travis-ci.org/jamestalmage/supports-hyperlinks) [![codecov](https://codecov.io/gh/jamestalmage/supports-hyperlinks/badge.svg?branch=master)](https://codecov.io/gh/jamestalmage/supports-hyperlinks?branch=master) | ||
## Related | ||
* [`hyperlinker`](https://github.com/jamestalmage/hyperlinker): Write hyperlinks for the Terminal. | ||
## License | ||
MIT © [James Talmage](https://github.com/jamestalmage) |
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
6492
4
81
49
0
+ Addedhas-flag@4.0.0(transitive)
+ Addedsupports-color@7.2.0(transitive)
- Removedhas-flag@2.0.03.0.0(transitive)
- Removedsupports-color@5.5.0(transitive)
Updatedhas-flag@^4.0.0
Updatedsupports-color@^7.0.0