supports-hyperlinks 3.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/license +1 -0
- package/package.json +14 -22
- package/readme.md +4 -13
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -29,6 +29,7 @@ function parseVersion(versionString) {
|
|
29
29
|
@param {{ isTTY?: boolean | undefined }} stream
|
30
30
|
@returns {boolean}
|
31
31
|
*/
|
32
|
+
// eslint-disable-next-line complexity
|
32
33
|
function supportsHyperlink(stream) {
|
33
34
|
const {
|
34
35
|
CI,
|
@@ -37,7 +38,8 @@ function supportsHyperlink(stream) {
|
|
37
38
|
TEAMCITY_VERSION,
|
38
39
|
TERM_PROGRAM,
|
39
40
|
TERM_PROGRAM_VERSION,
|
40
|
-
VTE_VERSION
|
41
|
+
VTE_VERSION,
|
42
|
+
TERM,
|
41
43
|
} = process.env;
|
42
44
|
|
43
45
|
if (FORCE_HYPERLINK) {
|
@@ -98,6 +100,8 @@ function supportsHyperlink(stream) {
|
|
98
100
|
case 'vscode':
|
99
101
|
// eslint-disable-next-line no-mixed-operators
|
100
102
|
return version.major > 1 || version.major === 1 && version.minor >= 72;
|
103
|
+
case 'ghostty':
|
104
|
+
return true;
|
101
105
|
// No default
|
102
106
|
}
|
103
107
|
}
|
@@ -112,6 +116,13 @@ function supportsHyperlink(stream) {
|
|
112
116
|
return version.major > 0 || version.minor >= 50;
|
113
117
|
}
|
114
118
|
|
119
|
+
switch (TERM) {
|
120
|
+
case 'alacritty':
|
121
|
+
// Support added in v0.11 (2022-10-13)
|
122
|
+
return true;
|
123
|
+
// No default
|
124
|
+
}
|
125
|
+
|
115
126
|
return false;
|
116
127
|
}
|
117
128
|
|
package/license
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
MIT License
|
2
2
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
3
4
|
Copyright (c) James Talmage <james@talmage.io> (https://github.com/jamestalmage)
|
4
5
|
|
5
6
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
package/package.json
CHANGED
@@ -1,15 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "supports-hyperlinks",
|
3
|
-
"version": "3.
|
4
|
-
"description": "Detect
|
3
|
+
"version": "3.2.0",
|
4
|
+
"description": "Detect whether a terminal supports hyperlinks",
|
5
5
|
"license": "MIT",
|
6
|
-
"repository": "
|
7
|
-
"funding": "https://github.com/
|
8
|
-
"author": {
|
9
|
-
"name": "James Talmage",
|
10
|
-
"email": "james@talmage.io",
|
11
|
-
"url": "github.com/jamestalmage"
|
12
|
-
},
|
6
|
+
"repository": "chalk/supports-hyperlinks",
|
7
|
+
"funding": "https://github.com/chalk/supports-hyperlinks?sponsor=1",
|
13
8
|
"exports": {
|
14
9
|
"types": "./index.d.ts",
|
15
10
|
"default": "./index.js"
|
@@ -19,9 +14,8 @@
|
|
19
14
|
"node": ">=14.18"
|
20
15
|
},
|
21
16
|
"scripts": {
|
22
|
-
"
|
23
|
-
"test": "
|
24
|
-
"create-types": "tsc --project declaration.tsconfig.json"
|
17
|
+
"//test": "xo && ava && tsc",
|
18
|
+
"test": "ava"
|
25
19
|
},
|
26
20
|
"files": [
|
27
21
|
"index.js",
|
@@ -33,7 +27,12 @@
|
|
33
27
|
"link",
|
34
28
|
"terminal",
|
35
29
|
"hyperlink",
|
36
|
-
"cli"
|
30
|
+
"cli",
|
31
|
+
"detect",
|
32
|
+
"check",
|
33
|
+
"ansi",
|
34
|
+
"escapes",
|
35
|
+
"console"
|
37
36
|
],
|
38
37
|
"dependencies": {
|
39
38
|
"has-flag": "^4.0.0",
|
@@ -42,16 +41,9 @@
|
|
42
41
|
"devDependencies": {
|
43
42
|
"@tsconfig/node14": "^1.0.3",
|
44
43
|
"@types/supports-color": "^8.1.1",
|
45
|
-
"ava": "^
|
44
|
+
"ava": "^3.2.0",
|
46
45
|
"codecov": "^3.5.0",
|
47
|
-
"nyc": "^14.1.1",
|
48
46
|
"typescript": "^4.9.5",
|
49
|
-
"xo": "^0.
|
50
|
-
},
|
51
|
-
"nyc": {
|
52
|
-
"reporter": [
|
53
|
-
"lcov",
|
54
|
-
"text"
|
55
|
-
]
|
47
|
+
"xo": "^0.53.0"
|
56
48
|
}
|
57
49
|
}
|
package/readme.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# supports-hyperlinks
|
1
|
+
# supports-hyperlinks
|
2
2
|
|
3
|
-
> Detect whether a terminal
|
3
|
+
> Detect whether a terminal supports hyperlinks
|
4
4
|
|
5
5
|
Terminal emulators are [starting to support hyperlinks](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda). While many terminals have long detected URL's and linkified them, allowing you to Command-Click or Control-Click them to open a browser, you were forced to print the long unsightly URL's on the screen. As of spring 2017 [a few terminals](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) began supporting HTML like links, where the link text and destination could be specified separately.
|
6
6
|
|
7
7
|
This module allows you to detect if hyperlinks are supported in the current Terminal.
|
8
8
|
|
9
|
-
As this is a new development, we anticipate the list of supported
|
9
|
+
As this is a new development, we anticipate the list of supported terminals to grow rapidly. Please open an issue or submit a PR as new terminals implement support.
|
10
10
|
|
11
11
|
## Install
|
12
12
|
|
@@ -14,11 +14,10 @@ As this is a new development, we anticipate the list of supported Terminals to g
|
|
14
14
|
npm install supports-hyperlinks
|
15
15
|
```
|
16
16
|
|
17
|
-
|
18
17
|
## Usage
|
19
18
|
|
20
19
|
```js
|
21
|
-
|
20
|
+
import supportsHyperlinks from 'supports-hyperlinks';
|
22
21
|
|
23
22
|
if (supportsHyperlinks.stdout) {
|
24
23
|
console.log('Terminal stdout supports hyperlinks');
|
@@ -38,11 +37,3 @@ Returns an `Object` with a `stdout` and `stderr` property for testing either str
|
|
38
37
|
Obeys the `--no-hyperlinks`, `--hyperlink=always`, and `--hyperlink=never` CLI flags.
|
39
38
|
|
40
39
|
Can be overridden by the user with the flags `--hyperlinks=always` and `--no-hyperlinks`. For situations where using those flags are not possible, add the environment variable `FORCE_HYPERLINK=1` to forcefully enable hyperlinks or `FORCE_HYPERLINK=0` to forcefully disable. The use of `FORCE_HYPERLINK` overrides all other hyperlink support checks.
|
41
|
-
|
42
|
-
## Related
|
43
|
-
|
44
|
-
* [`hyperlinker`](https://github.com/jamestalmage/hyperlinker): Write hyperlinks for the Terminal.
|
45
|
-
|
46
|
-
## License
|
47
|
-
|
48
|
-
MIT © [James Talmage](https://github.com/jamestalmage)
|