Comparing version 3.1.0 to 4.0.0
@@ -1,45 +0,47 @@ | ||
/// <reference types="node"/> | ||
declare const cliCursor: { | ||
/** | ||
Show cursor. | ||
/** | ||
Show cursor. | ||
@param stream - Default: `process.stderr`. | ||
@param stream - Default: `process.stderr`. | ||
@example | ||
``` | ||
import cliCursor from 'cli-cursor'; | ||
@example | ||
``` | ||
import * as cliCursor from 'cli-cursor'; | ||
cliCursor.show(); | ||
``` | ||
*/ | ||
show(stream?: NodeJS.WritableStream): void; | ||
cliCursor.show(); | ||
``` | ||
*/ | ||
export function show(stream?: NodeJS.WritableStream): void; | ||
/** | ||
Hide cursor. | ||
/** | ||
Hide cursor. | ||
@param stream - Default: `process.stderr`. | ||
@param stream - Default: `process.stderr`. | ||
@example | ||
``` | ||
import cliCursor from 'cli-cursor'; | ||
@example | ||
``` | ||
import * as cliCursor from 'cli-cursor'; | ||
cliCursor.hide(); | ||
``` | ||
*/ | ||
hide(stream?: NodeJS.WritableStream): void; | ||
cliCursor.hide(); | ||
``` | ||
*/ | ||
export function hide(stream?: NodeJS.WritableStream): void; | ||
/** | ||
Toggle cursor visibility. | ||
/** | ||
Toggle cursor visibility. | ||
@param force - Is useful to show or hide the cursor based on a boolean. | ||
@param stream - Default: `process.stderr`. | ||
@param force - Is useful to show or hide the cursor based on a boolean. | ||
@param stream - Default: `process.stderr`. | ||
@example | ||
``` | ||
import cliCursor from 'cli-cursor'; | ||
@example | ||
``` | ||
import * as cliCursor from 'cli-cursor'; | ||
const unicornsAreAwesome = true; | ||
cliCursor.toggle(unicornsAreAwesome); | ||
``` | ||
*/ | ||
toggle(force?: boolean, stream?: NodeJS.WritableStream): void; | ||
}; | ||
const unicornsAreAwesome = true; | ||
cliCursor.toggle(unicornsAreAwesome); | ||
``` | ||
*/ | ||
export function toggle(force?: boolean, stream?: NodeJS.WritableStream): void; | ||
export default cliCursor; |
18
index.js
@@ -1,7 +0,9 @@ | ||
'use strict'; | ||
const restoreCursor = require('restore-cursor'); | ||
import process from 'node:process'; | ||
import restoreCursor from 'restore-cursor'; | ||
let isHidden = false; | ||
exports.show = (writableStream = process.stderr) => { | ||
const cliCursor = {}; | ||
cliCursor.show = (writableStream = process.stderr) => { | ||
if (!writableStream.isTTY) { | ||
@@ -15,3 +17,3 @@ return; | ||
exports.hide = (writableStream = process.stderr) => { | ||
cliCursor.hide = (writableStream = process.stderr) => { | ||
if (!writableStream.isTTY) { | ||
@@ -26,3 +28,3 @@ return; | ||
exports.toggle = (force, writableStream) => { | ||
cliCursor.toggle = (force, writableStream) => { | ||
if (force !== undefined) { | ||
@@ -33,6 +35,8 @@ isHidden = force; | ||
if (isHidden) { | ||
exports.show(writableStream); | ||
cliCursor.show(writableStream); | ||
} else { | ||
exports.hide(writableStream); | ||
cliCursor.hide(writableStream); | ||
} | ||
}; | ||
export default cliCursor; |
{ | ||
"name": "cli-cursor", | ||
"version": "3.1.0", | ||
"version": "4.0.0", | ||
"description": "Toggle the CLI cursor", | ||
"license": "MIT", | ||
"repository": "sindresorhus/cli-cursor", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -38,10 +41,10 @@ "scripts": { | ||
"dependencies": { | ||
"restore-cursor": "^3.1.0" | ||
"restore-cursor": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.7", | ||
"ava": "^2.1.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"@types/node": "^16.7.1", | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.44.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# cli-cursor [![Build Status](https://travis-ci.org/sindresorhus/cli-cursor.svg?branch=master)](https://travis-ci.org/sindresorhus/cli-cursor) | ||
# cli-cursor | ||
@@ -7,3 +7,2 @@ > Toggle the CLI cursor | ||
## Install | ||
@@ -15,7 +14,6 @@ | ||
## Usage | ||
```js | ||
const cliCursor = require('cli-cursor'); | ||
import cliCursor from 'cli-cursor'; | ||
@@ -28,3 +26,2 @@ cliCursor.hide(); | ||
## API | ||
@@ -44,6 +41,5 @@ | ||
Type: `stream.Writable`<br> | ||
Type: `stream.Writable`\ | ||
Default: `process.stderr` | ||
--- | ||
@@ -50,0 +46,0 @@ |
Sorry, the diff of this file is not supported yet
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
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
4450
65
Yes
52
+ Addedrestore-cursor@4.0.0(transitive)
- Removedrestore-cursor@3.1.0(transitive)
Updatedrestore-cursor@^4.0.0