Updating NPM dependencies
This commit is contained in:
40
node_modules/prompts/dist/elements/autocomplete.js
generated
vendored
40
node_modules/prompts/dist/elements/autocomplete.js
generated
vendored
@@ -38,6 +38,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
|
||||
@@ -56,6 +57,7 @@ class AutocompletePrompt extends Prompt {
|
||||
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;
|
||||
@@ -64,7 +66,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();
|
||||
}
|
||||
@@ -120,8 +122,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');
|
||||
@@ -130,7 +146,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');
|
||||
@@ -176,14 +192,22 @@ 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();
|
||||
}
|
||||
|
||||
@@ -239,14 +263,14 @@ class AutocompletePrompt extends Prompt {
|
||||
|
||||
render() {
|
||||
if (this.closed) return;
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText));
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
let _entriesToDisplay = entriesToDisplay(this.select, this.choices.length, this.limit),
|
||||
startIndex = _entriesToDisplay.startIndex,
|
||||
endIndex = _entriesToDisplay.endIndex;
|
||||
|
||||
this.outputText = [color.bold(style.symbol(this.done, this.aborted)), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(' ');
|
||||
this.outputText = [style.symbol(this.done, this.aborted, this.exited), color.bold(this.msg), style.delimiter(this.completing), this.done && this.suggestions[this.select] ? this.suggestions[this.select].title : this.rendered = this.transform.render(this.input)].join(' ');
|
||||
|
||||
if (!this.done) {
|
||||
const suggestions = this.suggestions.slice(startIndex, endIndex).map((item, i) => this.renderOption(item, this.select === i + startIndex, i === 0 && startIndex > 0, i + startIndex === endIndex - 1 && endIndex < this.choices.length)).join('\n');
|
||||
|
||||
4
node_modules/prompts/dist/elements/autocompleteMultiselect.js
generated
vendored
4
node_modules/prompts/dist/elements/autocompleteMultiselect.js
generated
vendored
@@ -30,7 +30,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();
|
||||
}
|
||||
@@ -193,7 +193,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/dist/elements/confirm.js
generated
vendored
6
node_modules/prompts/dist/elements/confirm.js
generated
vendored
@@ -44,6 +44,10 @@ class ConfirmPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -78,7 +82,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));
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.done ? this.value ? this.yesMsg : this.noMsg : color.gray(this.initialValue ? this.yesOption : this.noOption)].join(' ');
|
||||
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
||||
|
||||
33
node_modules/prompts/dist/elements/date.js
generated
vendored
33
node_modules/prompts/dist/elements/date.js
generated
vendored
@@ -55,20 +55,19 @@ const dfltLocales = {
|
||||
monthsShort: 'Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec'.split(','),
|
||||
weekdays: 'Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday'.split(','),
|
||||
weekdaysShort: 'Sun,Mon,Tue,Wed,Thu,Fri,Sat'.split(',')
|
||||
/**
|
||||
* DatePrompt Base Element
|
||||
* @param {Object} opts Options
|
||||
* @param {String} opts.message Message
|
||||
* @param {Number} [opts.initial] Index of default value
|
||||
* @param {String} [opts.mask] The format mask
|
||||
* @param {object} [opts.locales] The date locales
|
||||
* @param {String} [opts.error] The error message shown on invalid value
|
||||
* @param {Function} [opts.validate] Function to validate the submitted value
|
||||
* @param {Stream} [opts.stdin] The Readable stream to listen to
|
||||
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
|
||||
*/
|
||||
|
||||
};
|
||||
/**
|
||||
* DatePrompt Base Element
|
||||
* @param {Object} opts Options
|
||||
* @param {String} opts.message Message
|
||||
* @param {Number} [opts.initial] Index of default value
|
||||
* @param {String} [opts.mask] The format mask
|
||||
* @param {object} [opts.locales] The date locales
|
||||
* @param {String} [opts.error] The error message shown on invalid value
|
||||
* @param {Function} [opts.validate] Function to validate the submitted value
|
||||
* @param {Stream} [opts.stdin] The Readable stream to listen to
|
||||
* @param {Stream} [opts.stdout] The Writable stream to write readline data to
|
||||
*/
|
||||
|
||||
class DatePrompt extends Prompt {
|
||||
constructor(opts = {}) {
|
||||
@@ -83,7 +82,7 @@ class DatePrompt extends Prompt {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -135,6 +134,10 @@ class DatePrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.error = false;
|
||||
@@ -230,7 +233,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));
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render(); // Print prompt
|
||||
|
||||
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(false), this.parts.reduce((arr, p, idx) => arr.concat(idx === this.cursor && !this.done ? color.cyan().underline(p.toString()) : p), []).join('')].join(' '); // Print error
|
||||
|
||||
8
node_modules/prompts/dist/elements/multiselect.js
generated
vendored
8
node_modules/prompts/dist/elements/multiselect.js
generated
vendored
@@ -54,7 +54,7 @@ class MultiselectPrompt extends Prompt {
|
||||
disabled: ch && ch.disabled
|
||||
};
|
||||
});
|
||||
this.clear = clear('');
|
||||
this.clear = clear('', this.out.columns);
|
||||
|
||||
if (!opts.overrideRender) {
|
||||
this.render();
|
||||
@@ -72,6 +72,10 @@ class MultiselectPrompt extends Prompt {
|
||||
return this.value.filter(v => v.selected);
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -277,7 +281,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/dist/elements/number.js
generated
vendored
8
node_modules/prompts/dist/elements/number.js
generated
vendored
@@ -99,6 +99,10 @@ class NumberPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
let x = this.value;
|
||||
this.value = x !== `` ? x : this.initial;
|
||||
@@ -225,8 +229,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));
|
||||
if (this.outputError) 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();
|
||||
|
||||
10
node_modules/prompts/dist/elements/prompt.js
generated
vendored
10
node_modules/prompts/dist/elements/prompt.js
generated
vendored
@@ -28,7 +28,10 @@ class Prompt extends EventEmitter {
|
||||
|
||||
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);
|
||||
const isSelect = ['SelectPrompt', 'MultiselectPrompt'].indexOf(this.constructor.name) > -1;
|
||||
@@ -50,7 +53,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;
|
||||
};
|
||||
|
||||
@@ -60,7 +63,8 @@ class Prompt extends EventEmitter {
|
||||
fire() {
|
||||
this.emit('state', {
|
||||
value: this.value,
|
||||
aborted: !!this.aborted
|
||||
aborted: !!this.aborted,
|
||||
exited: !!this.exited
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
24
node_modules/prompts/dist/elements/select.js
generated
vendored
24
node_modules/prompts/dist/elements/select.js
generated
vendored
@@ -48,7 +48,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();
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ class SelectPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -94,14 +98,22 @@ 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();
|
||||
}
|
||||
|
||||
@@ -120,7 +132,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));
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
|
||||
let _entriesToDisplay = entriesToDisplay(this.cursor, this.choices.length, this.optionsPerPage),
|
||||
|
||||
10
node_modules/prompts/dist/elements/text.js
generated
vendored
10
node_modules/prompts/dist/elements/text.js
generated
vendored
@@ -43,7 +43,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();
|
||||
}
|
||||
|
||||
@@ -71,6 +71,10 @@ class TextPrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.value = this.value || this.initial;
|
||||
this.done = this.aborted = true;
|
||||
@@ -194,8 +198,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));
|
||||
if (this.outputError) 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();
|
||||
|
||||
6
node_modules/prompts/dist/elements/toggle.js
generated
vendored
6
node_modules/prompts/dist/elements/toggle.js
generated
vendored
@@ -40,6 +40,10 @@ class TogglePrompt extends Prompt {
|
||||
this.render();
|
||||
}
|
||||
|
||||
exit() {
|
||||
this.abort();
|
||||
}
|
||||
|
||||
abort() {
|
||||
this.done = this.aborted = true;
|
||||
this.fire();
|
||||
@@ -109,7 +113,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));
|
||||
if (this.firstRender) this.out.write(cursor.hide);else this.out.write(clear(this.outputText, this.out.columns));
|
||||
super.render();
|
||||
this.outputText = [style.symbol(this.done, this.aborted), color.bold(this.msg), style.delimiter(this.done), this.value ? this.inactive : color.cyan().underline(this.inactive), color.gray('/'), this.value ? color.cyan().underline(this.active) : this.active].join(' ');
|
||||
this.out.write(erase.line + cursor.to(0) + this.outputText);
|
||||
|
||||
Reference in New Issue
Block a user