Socket
Socket
Sign inDemoInstall

inquirer

Package Overview
Dependencies
Maintainers
4
Versions
179
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

inquirer - npm Package Compare versions

Comparing version 10.0.0 to 10.0.1

6

dist/cjs/index.js

@@ -37,5 +37,3 @@ "use strict";

const promise = Promise.reject(error);
// @ts-expect-error Monkey patch the UI on the promise object so
promise.ui = runner;
return promise;
return Object.assign(promise, { ui: runner });
}

@@ -55,3 +53,3 @@ }

promptModule.restoreDefaultPrompts = function () {
this.prompts = Object.assign({}, defaultPrompts);
promptModule.prompts = Object.assign({}, defaultPrompts);
};

@@ -58,0 +56,0 @@ promptModule.restoreDefaultPrompts();

@@ -6,2 +6,3 @@ /**

import { Separator } from '@inquirer/prompts';
import type { Prettify } from '@inquirer/type';
import { default as PromptsRunner } from './ui/prompt.js';

@@ -14,4 +15,4 @@ import type { LegacyPromptConstructor, PromptFn } from './ui/prompt.js';

export declare function createPromptModule(opt?: StreamOptions): {
<T extends Answers = Answers>(questions: Question<T> | QuestionAnswerMap<T> | QuestionObservable<T> | QuestionArray<T>, answers?: Partial<T>): Promise<T> & {
ui: PromptsRunner;
<T extends Answers>(questions: QuestionArray<T> | QuestionAnswerMap<T> | QuestionObservable<T> | Question<T>, answers?: Partial<T>): Promise<Prettify<T>> & {
ui: PromptsRunner<T>;
};

@@ -34,4 +35,4 @@ prompts: {

prompt: {
<T extends Answers = Answers>(questions: Question<T> | QuestionAnswerMap<T> | QuestionObservable<T> | QuestionArray<T>, answers?: Partial<T>): Promise<T> & {
ui: PromptsRunner;
<T extends Answers>(questions: QuestionArray<T> | QuestionAnswerMap<T> | QuestionObservable<T> | Question<T>, answers?: Partial<T>): Promise<Prettify<T>> & {
ui: PromptsRunner<T>;
};

@@ -38,0 +39,0 @@ prompts: {

import { input, select, number, confirm, rawlist, expand, checkbox, password, editor } from '@inquirer/prompts';
import type { Prettify } from '@inquirer/type';
import { Observable } from 'rxjs';
type LiteralUnion<T extends F, F = string> = T | (F & {});
type KeyUnion<T> = LiteralUnion<Extract<keyof T, string>>;
export type Answers = {
[key: string]: any;
};
interface QuestionMap {
input: {
type whenFunction<T extends Answers> = ((answers: Partial<T>) => boolean | Promise<boolean>) | ((this: {
async: () => () => void;
}, answers: Partial<T>) => void);
type InquirerFields<T extends Answers> = {
name: KeyUnion<T>;
when?: boolean | whenFunction<T>;
askAnswered?: boolean;
};
interface QuestionMap<T extends Answers> {
input: Prettify<{
type: 'input';
} & Parameters<typeof input>[0];
select: {
} & Parameters<typeof input>[0] & InquirerFields<T>>;
select: Prettify<{
type: 'select';
} & Parameters<typeof select>[0];
/** @deprecated Prompt type `list` is renamed to `select` */
list: {
} & Parameters<typeof select>[0] & InquirerFields<T>>;
list: Prettify<{
type: 'list';
} & Parameters<typeof select>[0];
number: {
} & Parameters<typeof select>[0] & InquirerFields<T>>;
number: Prettify<{
type: 'number';
} & Parameters<typeof number>[0];
confirm: {
} & Parameters<typeof number>[0] & InquirerFields<T>>;
confirm: Prettify<{
type: 'confirm';
} & Parameters<typeof confirm>[0];
rawlist: {
} & Parameters<typeof confirm>[0] & InquirerFields<T>>;
rawlist: Prettify<{
type: 'rawlist';
} & Parameters<typeof rawlist>[0];
expand: {
} & Parameters<typeof rawlist>[0] & InquirerFields<T>>;
expand: Prettify<{
type: 'expand';
} & Parameters<typeof expand>[0];
checkbox: {
} & Parameters<typeof expand>[0] & InquirerFields<T>>;
checkbox: Prettify<{
type: 'checkbox';
} & Parameters<typeof checkbox>[0];
password: {
} & Parameters<typeof checkbox>[0] & InquirerFields<T>>;
password: Prettify<{
type: 'password';
} & Parameters<typeof password>[0];
editor: {
} & Parameters<typeof password>[0] & InquirerFields<T>>;
editor: Prettify<{
type: 'editor';
} & Parameters<typeof editor>[0];
} & Parameters<typeof editor>[0] & InquirerFields<T>>;
}
type whenFunction<T extends Answers = Answers> = ((answers: Partial<T>) => boolean | Promise<boolean>) | ((this: {
async: () => () => void;
}, answers: Partial<T>) => void);
type InquirerFields<T extends Answers = Answers> = {
name: keyof T;
when?: boolean | whenFunction<T>;
askAnswered?: boolean;
};
export type Question<T extends Answers = Answers> = QuestionMap[keyof QuestionMap] & InquirerFields<T>;
export type QuestionAnswerMap<T extends Answers = Answers> = Record<keyof T, Omit<Question<T>, 'name'>>;
export type QuestionArray<T extends Answers = Answers> = Array<Question<T>>;
export type QuestionObservable<T extends Answers = Answers> = Observable<Question<T>>;
export type Question<T extends Answers> = QuestionMap<T>[keyof QuestionMap<T>];
export type QuestionAnswerMap<T extends Answers> = Record<KeyUnion<T>, Prettify<Omit<Question<T>, 'name'>>>;
export type QuestionArray<T extends Answers> = Question<T>[];
export type QuestionObservable<T extends Answers> = Observable<Question<T>>;
export type StreamOptions = Prettify<Parameters<typeof input>[1] & {

@@ -53,0 +54,0 @@ skipTTYChecks?: boolean;

@@ -41,3 +41,3 @@ import { Observable } from 'rxjs';

*/
export default class PromptsRunner<T extends Answers = Answers> extends Base {
export default class PromptsRunner<T extends Answers> extends Base {
prompts: PromptCollection;

@@ -49,4 +49,4 @@ answers: Partial<T>;

constructor(prompts: PromptCollection, opt?: StreamOptions);
run(questions: Question<T> | QuestionAnswerMap<T> | QuestionObservable<T> | QuestionArray<T>, answers?: Partial<T>): Promise<T> & {
ui: PromptsRunner;
run(questions: QuestionArray<T> | QuestionAnswerMap<T> | QuestionObservable<T> | Question<T>, answers?: Partial<T>): Promise<T> & {
ui: PromptsRunner<T>;
};

@@ -59,7 +59,7 @@ /**

processQuestion(question: Question<T>): Observable<{
name: keyof T;
name: string | Extract<keyof T, string>;
answer: any;
}>;
fetchAnswer(question: Question<T>): Observable<{
name: keyof T;
name: string | Extract<keyof T, string>;
answer: any;

@@ -66,0 +66,0 @@ }>;

@@ -159,5 +159,3 @@ "use strict";

}, this.answers))).then(() => this.onCompletion(), (error) => this.onError(error));
// @ts-expect-error Monkey patch the UI on the promise object so
promise.ui = this;
return promise;
return Object.assign(promise, { ui: this });
}

@@ -164,0 +162,0 @@ /**

{
"name": "inquirer",
"version": "10.0.0",
"version": "10.0.1",
"description": "A collection of common interactive command line user interfaces.",

@@ -88,3 +88,3 @@ "author": "Simon Boudrias <admin@simonboudrias.com>",

"typings": "./dist/cjs/types/index.d.ts",
"gitHead": "a9ee70f34327e2af1712dd984ea43993645de9ff"
"gitHead": "f3dfcce462de9a6b77d50be78925003e1ebff245"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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