Updating NPM dependencies
This commit is contained in:
38
node_modules/prompts/lib/elements/autocomplete.js
generated
vendored
38
node_modules/prompts/lib/elements/autocomplete.js
generated
vendored
@@ -23,6 +23,7 @@ const getIndex = (arr, valOrTitle) => {
|
||||
* @param {String} [opts.style='default'] Render style
|
||||
* @param {String} [opts.fallback] Fallback message - initial to default value
|
||||
* @param {String} [opts.initial] Index of the default value
|
||||
* @param {Boolean} [opts.clearFirst] The first ESCAPE keypress will clear the input
|
||||
* @param {Stream} [opts.stdin] The Readable stream to listen to
|
||||
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
|
||||
* @param {String} [opts.noMatches] The no matches found label
|
||||
@@ -39,6 +40,7 @@ class AutocompletePrompt extends Prompt {
|
||||
this.select = this.initial || opts.cursor || 0;
|
||||
this.i18n = { noMatches: opts.noMatches || 'no matches found' };
|
||||
this.fallback = opts.fallback || this.initial;
|
||||
this.clearFirst = opts.clearFirst || false;
|
||||
this.suggestions = [];
|
||||
this.input = '';
|
||||
this.limit = opts.limit || 10;
|
||||
@@ -47,7 +49,7 @@ class AutocompletePrompt extends Prompt {
|
||||
this.scale = this.transform.scale;
|
||||
this.render = this.render.bind(this);
|
||||
this.complete = this.complete.bind(this);
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
this.complete(this.render);
|
||||
this.render();
|
||||
}
|
||||
@@ -96,8 +98,22 @@ class AutocompletePrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
if (this.clearFirst && this.input.length > 0) {
|
||||
this.reset();
|
||||
} else {
|
||||
this.done = this.exited = true;
|
||||
this.aborted = false;
|
||||
this.fire();
|
||||
this.render();
|
||||
this.out.write('\n');
|
||||
this.close();
|
||||
}
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.exited = false;
|
||||
this.fire();
|
||||
this.render();
|
||||
this.out.write('\n');
|
||||
@@ -106,7 +122,7 @@ class AutocompletePrompt extends Prompt {
|
||||
|
||||
submit() {
|
||||
this.done = true;
|
||||
this.aborted = false;
|
||||
this.aborted = this.exited = false;
|
||||
this.fire();
|
||||
this.render();
|
||||
this.out.write('\n');
|
||||
@@ -152,14 +168,20 @@ class AutocompletePrompt extends Prompt {
|
||||
}
|
||||
|
||||
up() {
|
||||
if (this.select <= 0) return this.bell();
|
||||
this.moveSelect(this.select - 1);
|
||||
if (this.select === 0) {
|
||||
this.moveSelect(this.suggestions.length - 1);
|
||||
} else {
|
||||
this.moveSelect(this.select - 1);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
|
||||
down() {
|
||||
if (this.select >= this.suggestions.length - 1) return this.bell();
|
||||
this.moveSelect(this.select + 1);
|
||||
if (this.select === this.suggestions.length - 1) {
|
||||
this.moveSelect(0);
|
||||
} else {
|
||||
this.moveSelect(this.select + 1);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -210,13 +232,13 @@ class AutocompletePrompt extends Prompt {
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);
|
||||
else this.out.write(clear(this.outputText));
|
||||
else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
let { startIndex, endIndex } = entriesToDisplay(this.select, this.choices.length, this.limit);
|
||||
|
||||
this.outputText = [
|
||||
color.bold(style.symbol(this.done, this.aborted)),
|
||||
style.symbol(this.done, this.aborted, this.exited),
|
||||
color.bold(this.msg),
|
||||
style.delimiter(this.completing),
|
||||
this.done && this.suggestions[this.select]
|
||||
|
||||
4
node_modules/prompts/lib/elements/autocompleteMultiselect.js
generated
vendored
4
node_modules/prompts/lib/elements/autocompleteMultiselect.js
generated
vendored
@@ -21,7 +21,7 @@ class AutocompleteMultiselectPrompt extends MultiselectPrompt {
|
||||
opts.overrideRender = true;
|
||||
super(opts);
|
||||
this.inputValue = '';
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
this.filteredOptions = this.value;
|
||||
this.render();
|
||||
}
|
||||
@@ -187,7 +187,7 @@ Filtered results for: ${this.inputValue ? this.inputValue : color.gray('Enter so
|
||||
prompt += this.renderOptions(this.filteredOptions);
|
||||
|
||||
this.out.write(this.clear + prompt);
|
||||
this.clear = clear(prompt);
|
||||
this.clear = clear(prompt, this.out.columns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
6
node_modules/prompts/lib/elements/confirm.js
generated
vendored
6
node_modules/prompts/lib/elements/confirm.js
generated
vendored
@@ -34,6 +34,10 @@ class ConfirmPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -67,7 +71,7 @@ class ConfirmPrompt extends Prompt {
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);
|
||||
else this.out.write(clear(this.outputText));
|
||||
else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
this.outputText = [
|
||||
|
||||
8
node_modules/prompts/lib/elements/date.js
generated
vendored
8
node_modules/prompts/lib/elements/date.js
generated
vendored
@@ -50,7 +50,7 @@ class DatePrompt extends Prompt {
|
||||
this.errorMsg = opts.error || 'Please Enter A Valid Value';
|
||||
this.validator = opts.validate || (() => true);
|
||||
this.mask = opts.mask || 'YYYY-MM-DD HH:mm:ss';
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -101,6 +101,10 @@ class DatePrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.error = false;
|
||||
@@ -180,7 +184,7 @@ class DatePrompt extends Prompt {
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);
|
||||
else this.out.write(clear(this.outputText));
|
||||
else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
// Print prompt
|
||||
|
||||
8
node_modules/prompts/lib/elements/multiselect.js
generated
vendored
8
node_modules/prompts/lib/elements/multiselect.js
generated
vendored
@@ -42,7 +42,7 @@ class MultiselectPrompt extends Prompt {
|
||||
disabled: ch && ch.disabled
|
||||
};
|
||||
});
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
if (!opts.overrideRender) {
|
||||
this.render();
|
||||
}
|
||||
@@ -59,6 +59,10 @@ class MultiselectPrompt extends Prompt {
|
||||
return this.value.filter(v => v.selected);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -260,7 +264,7 @@ class MultiselectPrompt extends Prompt {
|
||||
prompt += this.renderOptions(this.value);
|
||||
|
||||
this.out.write(this.clear + prompt);
|
||||
this.clear = clear(prompt);
|
||||
this.clear = clear(prompt, this.out.columns);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
8
node_modules/prompts/lib/elements/number.js
generated
vendored
8
node_modules/prompts/lib/elements/number.js
generated
vendored
@@ -78,6 +78,10 @@ class NumberPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
let x = this.value;
|
||||
this.value = x !== `` ? x : this.initial;
|
||||
@@ -181,8 +185,8 @@ class NumberPrompt extends Prompt {
|
||||
if (this.closed) return;
|
||||
if (!this.firstRender) {
|
||||
if (this.outputError)
|
||||
this.out.write(cursor.down(lines(this.outputError) - 1) + clear(this.outputError));
|
||||
this.out.write(clear(this.outputText));
|
||||
this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
|
||||
this.out.write(clear(this.outputText, this.out.columns));
|
||||
}
|
||||
super.render();
|
||||
this.outputError = '';
|
||||
|
||||
7
node_modules/prompts/lib/elements/prompt.js
generated
vendored
7
node_modules/prompts/lib/elements/prompt.js
generated
vendored
@@ -19,7 +19,7 @@ class Prompt extends EventEmitter {
|
||||
this.in = opts.stdin || process.stdin;
|
||||
this.out = opts.stdout || process.stdout;
|
||||
this.onRender = (opts.onRender || (() => void 0)).bind(this);
|
||||
const rl = readline.createInterface(this.in);
|
||||
const rl = readline.createInterface({ input:this.in, escapeCodeTimeout:50 });
|
||||
readline.emitKeypressEvents(this.in, rl);
|
||||
|
||||
if (this.in.isTTY) this.in.setRawMode(true);
|
||||
@@ -40,7 +40,7 @@ class Prompt extends EventEmitter {
|
||||
this.in.removeListener('keypress', keypress);
|
||||
if (this.in.isTTY) this.in.setRawMode(false);
|
||||
rl.close();
|
||||
this.emit(this.aborted ? 'abort' : 'submit', this.value);
|
||||
this.emit(this.aborted ? 'abort' : this.exited ? 'exit' : 'submit', this.value);
|
||||
this.closed = true;
|
||||
};
|
||||
|
||||
@@ -50,7 +50,8 @@ class Prompt extends EventEmitter {
|
||||
fire() {
|
||||
this.emit('state', {
|
||||
value: this.value,
|
||||
aborted: !!this.aborted
|
||||
aborted: !!this.aborted,
|
||||
exited: !!this.exited
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
22
node_modules/prompts/lib/elements/select.js
generated
vendored
22
node_modules/prompts/lib/elements/select.js
generated
vendored
@@ -36,7 +36,7 @@ class SelectPrompt extends Prompt {
|
||||
});
|
||||
this.optionsPerPage = opts.optionsPerPage || 10;
|
||||
this.value = (this.choices[this.cursor] || {}).value;
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ class SelectPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -83,14 +87,20 @@ class SelectPrompt extends Prompt {
|
||||
}
|
||||
|
||||
up() {
|
||||
if (this.cursor === 0) return this.bell();
|
||||
this.moveCursor(this.cursor - 1);
|
||||
if (this.cursor === 0) {
|
||||
this.moveCursor(this.choices.length - 1);
|
||||
} else {
|
||||
this.moveCursor(this.cursor - 1);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
|
||||
down() {
|
||||
if (this.cursor === this.choices.length - 1) return this.bell();
|
||||
this.moveCursor(this.cursor + 1);
|
||||
if (this.cursor === this.choices.length - 1) {
|
||||
this.moveCursor(0);
|
||||
} else {
|
||||
this.moveCursor(this.cursor + 1);
|
||||
}
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -110,7 +120,7 @@ class SelectPrompt extends Prompt {
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);
|
||||
else this.out.write(clear(this.outputText));
|
||||
else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
let { startIndex, endIndex } = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage);
|
||||
|
||||
10
node_modules/prompts/lib/elements/text.js
generated
vendored
10
node_modules/prompts/lib/elements/text.js
generated
vendored
@@ -25,7 +25,7 @@ class TextPrompt extends Prompt {
|
||||
this.value = ``;
|
||||
this.errorMsg = opts.error || `Please Enter A Valid Value`;
|
||||
this.cursor = Number(!!this.initial);
|
||||
this.clear = clear(``);
|
||||
this.clear = clear(``, this.out.columns);
|
||||
this.render();
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ class TextPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.value = this.value || this.initial;
|
||||
this.done = this.aborted = true;
|
||||
@@ -156,8 +160,8 @@ class TextPrompt extends Prompt {
|
||||
if (this.closed) return;
|
||||
if (!this.firstRender) {
|
||||
if (this.outputError)
|
||||
this.out.write(cursor.down(lines(this.outputError) - 1) + clear(this.outputError));
|
||||
this.out.write(clear(this.outputText));
|
||||
this.out.write(cursor.down(lines(this.outputError, this.out.columns) - 1) + clear(this.outputError, this.out.columns));
|
||||
this.out.write(clear(this.outputText, this.out.columns));
|
||||
}
|
||||
super.render();
|
||||
this.outputError = '';
|
||||
|
||||
6
node_modules/prompts/lib/elements/toggle.js
generated
vendored
6
node_modules/prompts/lib/elements/toggle.js
generated
vendored
@@ -30,6 +30,10 @@ class TogglePrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -95,7 +99,7 @@ class TogglePrompt extends Prompt {
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);
|
||||
else this.out.write(clear(this.outputText));
|
||||
else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
this.outputText = [
|
||||
|
||||
Reference in New Issue
Block a user