@meteor-it/terminal
Advanced tools
Comparing version 0.5.25 to 0.6.0
40
index.js
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs = require("fs"); | ||
import * as fs from 'fs'; | ||
// By default using writeSync and fsyncSync to log | ||
@@ -13,11 +11,10 @@ let useStdoutFallback = false; | ||
*/ | ||
function startBuffering() { | ||
export function startBuffering() { | ||
buffering = true; | ||
buffer = ''; | ||
} | ||
exports.startBuffering = startBuffering; | ||
/** | ||
* Stop buffering and write buffer to stdout | ||
*/ | ||
function flushBuffer() { | ||
export function flushBuffer() { | ||
buffering = false; | ||
@@ -27,3 +24,2 @@ writeStdout(buffer); | ||
} | ||
exports.flushBuffer = flushBuffer; | ||
/** | ||
@@ -33,3 +29,3 @@ * Write string to stdout (or to buffer, if buffering is enabled) | ||
*/ | ||
function writeStdout(string) { | ||
export function writeStdout(string) { | ||
if (buffering) { | ||
@@ -56,3 +52,2 @@ buffer += string; | ||
} | ||
exports.writeStdout = writeStdout; | ||
/** | ||
@@ -62,6 +57,5 @@ * Wrap data to escape and write to stdout | ||
*/ | ||
function writeEscape(args) { | ||
export function writeEscape(args) { | ||
writeStdout('\u001B[' + args); | ||
} | ||
exports.writeEscape = writeEscape; | ||
/** | ||
@@ -72,20 +66,17 @@ * Moves cursor to specified position | ||
*/ | ||
function moveCursor(line, col = 1) { | ||
export function moveCursor(line, col = 1) { | ||
writeEscape(line + ';' + col + 'f'); | ||
} | ||
exports.moveCursor = moveCursor; | ||
/** | ||
* Hides cursor | ||
*/ | ||
function hideCursor() { | ||
export function hideCursor() { | ||
writeEscape('?25l'); | ||
} | ||
exports.hideCursor = hideCursor; | ||
/** | ||
* Shows cursor | ||
*/ | ||
function showCursor() { | ||
export function showCursor() { | ||
writeEscape('?25h'); | ||
} | ||
exports.showCursor = showCursor; | ||
/** | ||
@@ -95,3 +86,3 @@ * Clear line | ||
*/ | ||
function clearLine(line) { | ||
export function clearLine(line) { | ||
if (line) { | ||
@@ -106,25 +97,20 @@ save(); | ||
} | ||
exports.clearLine = clearLine; | ||
/** | ||
* Clears screen | ||
*/ | ||
function clearScreen() { | ||
export function clearScreen() { | ||
writeEscape('2J'); | ||
} | ||
exports.clearScreen = clearScreen; | ||
/** | ||
* Saves cursor position (Only one!) | ||
*/ | ||
function save() { | ||
export function save() { | ||
writeEscape('s'); | ||
} | ||
exports.save = save; | ||
/** | ||
* Restores cursor position (Only one!) | ||
*/ | ||
function restore() { | ||
export function restore() { | ||
writeEscape('u'); | ||
} | ||
exports.restore = restore; | ||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxvZ2dlci9ub2RlX21vZHVsZXMvQG1ldGVvci1pdC90ZXJtaW5hbC9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlCQUF5QjtBQUV6QixrREFBa0Q7QUFDbEQsSUFBSSxpQkFBaUIsR0FBRyxLQUFLLENBQUM7QUFDOUIsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLGVBQWU7SUFDOUIsaUJBQWlCLEdBQUcsSUFBSSxDQUFDO0FBRTFCLElBQUksTUFBTSxHQUFHLEVBQUUsQ0FBQztBQUNoQixJQUFJLFNBQVMsR0FBRyxLQUFLLENBQUM7QUFFdEI7O0dBRUc7QUFDSCxTQUFnQixjQUFjO0lBQzdCLFNBQVMsR0FBRyxJQUFJLENBQUM7SUFDakIsTUFBTSxHQUFHLEVBQUUsQ0FBQTtBQUNaLENBQUM7QUFIRCx3Q0FHQztBQUVEOztHQUVHO0FBQ0gsU0FBZ0IsV0FBVztJQUMxQixTQUFTLEdBQUcsS0FBSyxDQUFDO0lBQ2xCLFdBQVcsQ0FBQyxNQUFNLENBQUMsQ0FBQztJQUNwQixNQUFNLEdBQUcsRUFBRSxDQUFBO0FBQ1osQ0FBQztBQUpELGtDQUlDO0FBRUQ7OztHQUdHO0FBQ0gsU0FBZ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KTtcbn1cbi8qKlxuICogU2F2ZXMgY3Vyc29yIHBvc2l0aW9uIChPbmx5IG9uZSEpXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBzYXZlKCkge1xuXHR3cml0ZUVzY2FwZSgncycpO1xufVxuLyoqXG4gKiBSZXN0b3JlcyBjdXJzb3IgcG9zaXRpb24gKE9ubHkgb25lISlcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHJlc3RvcmUoKSB7XG5cdHdyaXRlRXNjYXBlKCd1Jyk7XG59XG4iXX0= | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@meteor-it/terminal", | ||
"version": "0.5.25", | ||
"description": "Provides utility functions for ANSI terminals", | ||
"module": "index.mjs", | ||
"main": "index.js", | ||
"keywords": [ | ||
"meteor-it", | ||
"tty", | ||
"stdout", | ||
"ansi" | ||
], | ||
"author": "CertainLach <iam@lach.pw>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "91dcc2bdff261acb0a37172c7d08e9b65952216b" | ||
} | ||
"name": "@meteor-it/terminal", | ||
"version": "0.6.0", | ||
"description": "Provides utility functions for ANSI terminals", | ||
"main": "index.js", | ||
"type": "module", | ||
"keywords": [ | ||
"meteor-it", | ||
"tty", | ||
"stdout", | ||
"ansi" | ||
], | ||
"author": "CertainLach <iam@lach.pw>", | ||
"license": "MIT", | ||
"sideEffects": false, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"gitHead": "cb3baad75ddedd6d3f188a796f7e3a2f5ccaa043" | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
3
Yes
7221
6
257