Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@travetto/terminal

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/terminal - npm Package Compare versions

Comparing version 3.0.0-rc.7 to 3.0.0-rc.8

2

package.json
{
"name": "@travetto/terminal",
"version": "3.0.0-rc.7",
"version": "3.0.0-rc.8",
"description": "General terminal support",

@@ -5,0 +5,0 @@ "keywords": [

@@ -99,3 +99,3 @@ import { IterableUtil } from './iterable';

*/
static async streamLinesWithWaiting(term: TermState, lines: AsyncIterable<string>, cfg: TerminalWaitingConfig = {}): Promise<void> {
static async streamLinesWithWaiting(term: TermState, lines: AsyncIterable<string | undefined>, cfg: TerminalWaitingConfig = {}): Promise<void> {
let writer: (() => Promise<unknown>) | undefined;

@@ -107,3 +107,3 @@ let line: string | undefined;

if (line) {
const msg = `${String.fromCharCode(171)} ${line}`;
const msg = cfg.commitedPrefix ? `${cfg.commitedPrefix} ${line}` : line;
if (cfg.position === 'inline') {

@@ -114,2 +114,3 @@ await TerminalWriter.for(term).setPosition({ x: 0 }).changePosition({ y: -1 }).writeLine(msg).commit();

}
line = undefined;
}

@@ -122,5 +123,7 @@ };

await commitLine();
msg = msg.replace(/\n$/, '');
writer = this.streamWaiting(term, msg, cfg, pos);
line = msg;
if (msg !== undefined) {
msg = msg.replace(/\n$/, '');
writer = this.streamWaiting(term, msg, cfg, pos);
line = msg;
}
}

@@ -127,0 +130,0 @@ await commitLine();

@@ -53,3 +53,12 @@ import tty from 'tty';

async #readInput(query: string): Promise<Buffer> {
const isRaw = this.#input.isRaw;
const isPaused = this.#input.isPaused();
const data = this.#input.listeners('data');
try {
this.#input.removeAllListeners('data');
if (isPaused) {
this.#input.resume();
}
this.#input.setRawMode(true);

@@ -62,3 +71,10 @@ // Send data, but do not wait on it

} finally {
this.#input.setRawMode(false);
if (isPaused) {
this.#input.pause();
}
this.#input.setRawMode(isRaw);
for (const fn of data) {
// @ts-ignore
this.#input.on('data', fn);
}
}

@@ -65,0 +81,0 @@ }

@@ -131,6 +131,9 @@ import tty from 'tty';

*/
async streamLinesWithWaiting(lines: AsyncIterable<string>, config: TerminalWaitingConfig): Promise<void> {
async streamLinesWithWaiting(lines: AsyncIterable<string | undefined>, config: TerminalWaitingConfig): Promise<void> {
if (!this.interactive) {
for await (const line of lines) {
await this.writeLines(line);
if (line !== undefined) {
const out = config.commitedPrefix ? `${config.commitedPrefix} ${line}` : line;
await this.writeLines(out);
}
}

@@ -137,0 +140,0 @@ } else {

@@ -16,3 +16,3 @@ import tty from 'tty';

export type TerminalProgressRender = (ev: TerminalProgressEvent) => string;
export type TerminalWaitingConfig = { position?: TermLinePosition, end?: boolean } & DelayedConfig;
export type TerminalWaitingConfig = { position?: TermLinePosition, end?: boolean, commitedPrefix?: string } & DelayedConfig;

@@ -19,0 +19,0 @@ export type TermColorLevel = 0 | 1 | 2 | 3;

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc