terminal-link
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -1,23 +0,43 @@ | ||
export interface Options { | ||
/** | ||
* Override the default fallback. | ||
* | ||
* @default `${text} (${url})` | ||
*/ | ||
fallback?: (text: string, url: string) => string; | ||
declare namespace terminalLink { | ||
interface Options { | ||
/** | ||
Override the default fallback. | ||
@default `${text} (${url})` | ||
*/ | ||
fallback?: (text: string, url: string) => string; | ||
} | ||
} | ||
/** | ||
* Create a clickable link in the terminal. | ||
* | ||
* [Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) | ||
* For unsupported terminals, the link will be printed in parens after the text: `My website (https://sindresorhus.com)`. | ||
*/ | ||
export default function terminalLink(text: string, url: string, options?: Options): string; | ||
declare const terminalLink: { | ||
/** | ||
Create a clickable link in the terminal. | ||
/** | ||
* Check whether the terminal support links. | ||
* | ||
* Prefer just using the default fallback or the `fallback` option whenever possible. | ||
*/ | ||
export const isSupported: boolean; | ||
[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) | ||
For unsupported terminals, the link will be printed in parens after the text: `My website (https://sindresorhus.com)`. | ||
@param text - Text to linkify. | ||
@param url - URL to link to. | ||
@example | ||
``` | ||
import terminalLink = require('terminal-link'); | ||
const link = terminalLink('My Website', 'https://sindresorhus.com'); | ||
console.log(link); | ||
``` | ||
*/ | ||
(text: string, url: string, options?: terminalLink.Options): string; | ||
/** | ||
Check whether the terminal support links. | ||
Prefer just using the default fallback or the `fallback` option whenever possible. | ||
*/ | ||
readonly isSupported: boolean; | ||
// TODO: Remove this for the next major release | ||
default: typeof terminalLink; | ||
}; | ||
export = terminalLink; |
@@ -13,3 +13,4 @@ 'use strict'; | ||
// TODO: Remove this for the next major release | ||
module.exports.default = module.exports; | ||
module.exports.isSupported = supportsHyperlinks.stdout; |
{ | ||
"name": "terminal-link", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Create clickable links in the terminal", | ||
@@ -16,3 +16,3 @@ "license": "MIT", | ||
"scripts": { | ||
"test": "xo && ava && tsd-check" | ||
"test": "xo && ava && tsd" | ||
}, | ||
@@ -35,11 +35,11 @@ "files": [ | ||
"dependencies": { | ||
"ansi-escapes": "^3.1.0", | ||
"ansi-escapes": "^3.2.0", | ||
"supports-hyperlinks": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "^1.0.1", | ||
"clear-module": "^3.0.0", | ||
"tsd-check": "^0.2.1", | ||
"xo": "^0.23.0" | ||
"ava": "^1.4.1", | ||
"clear-module": "^3.1.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
} | ||
} |
4861
45
Updatedansi-escapes@^3.2.0