Socket
Socket
Sign inDemoInstall

supports-hyperlinks

Package Overview
Dependencies
2
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 3.0.0

index.d.ts

43

index.js

@@ -5,6 +5,10 @@ 'use strict';

/**
@param {string} versionString
@returns {{ major: number, minor: number, patch: number }}
*/
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);
const m = /(\d{1,2})(\d{2})/.exec(versionString) || [];
return {

@@ -25,7 +29,19 @@ major: 0,

/**
@param {{ isTTY?: boolean | undefined }} stream
@returns {boolean}
*/
function supportsHyperlink(stream) {
const {env} = process;
const {
CI,
FORCE_HYPERLINK,
NETLIFY,
TEAMCITY_VERSION,
TERM_PROGRAM,
TERM_PROGRAM_VERSION,
VTE_VERSION
} = process.env;
if ('FORCE_HYPERLINK' in env) {
return !(env.FORCE_HYPERLINK.length > 0 && parseInt(env.FORCE_HYPERLINK, 10) === 0);
if (FORCE_HYPERLINK) {
return !(FORCE_HYPERLINK.length > 0 && parseInt(FORCE_HYPERLINK, 10) === 0);
}

@@ -42,3 +58,3 @@

// Netlify does not run a TTY, it does not need `supportsColor` check
if ('NETLIFY' in env) {
if (NETLIFY) {
return true;

@@ -60,14 +76,14 @@ }

if ('CI' in env) {
if (CI) {
return false;
}
if ('TEAMCITY_VERSION' in env) {
if (TEAMCITY_VERSION) {
return false;
}
if ('TERM_PROGRAM' in env) {
const version = parseVersion(env.TERM_PROGRAM_VERSION);
if (TERM_PROGRAM) {
const version = parseVersion(TERM_PROGRAM_VERSION || '');
switch (env.TERM_PROGRAM) {
switch (TERM_PROGRAM) {
case 'iTerm.app':

@@ -82,2 +98,3 @@ if (version.major === 3) {

case 'vscode':
// eslint-disable-next-line no-mixed-operators
return version.major > 1 || version.major === 1 && version.minor >= 72;

@@ -88,9 +105,9 @@ // No default

if ('VTE_VERSION' in env) {
if (VTE_VERSION) {
// 0.50.0 was supposed to support hyperlinks, but throws a segfault
if (env.VTE_VERSION === '0.50.0') {
if (VTE_VERSION === '0.50.0') {
return false;
}
const version = parseVersion(env.VTE_VERSION);
const version = parseVersion(VTE_VERSION);
return version.major > 0 || version.minor >= 50;

@@ -97,0 +114,0 @@ }

{
"name": "supports-hyperlinks",
"version": "2.3.0",
"version": "3.0.0",
"description": "Detect if your terminal emulator supports hyperlinks",

@@ -13,11 +13,12 @@ "license": "MIT",

"engines": {
"node": ">=8"
"node": ">=14.18"
},
"scripts": {
"prepublishOnly": "npm run create-types",
"test": "xo && nyc ava",
"create-types": "tsc index.js --allowJs --declaration --emitDeclarationOnly"
"test": "xo && nyc ava && tsc",
"create-types": "tsc --project declaration.tsconfig.json"
},
"files": [
"index.js",
"index.d.ts",
"browser.js"

@@ -37,6 +38,8 @@ ],

"devDependencies": {
"@tsconfig/node14": "^1.0.3",
"@types/supports-color": "^8.1.1",
"ava": "^2.2.0",
"codecov": "^3.5.0",
"nyc": "^14.1.1",
"typescript": "^3.7.2",
"typescript": "^4.9.5",
"xo": "^0.24.0"

@@ -43,0 +46,0 @@ },

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc