Socket
Socket
Sign inDemoInstall

@inquirer/core

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inquirer/core - npm Package Compare versions

Comparing version 0.0.26-alpha.0 to 0.0.29-alpha.0

README.md

7

dist/index.d.ts
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import readline from 'node:readline';
import type { Prompt } from '@inquirer/type';
import MuteStream from 'mute-stream';

@@ -8,7 +9,2 @@ export { usePrefix } from './lib/prefix.js';

export * from './lib/Paginator.js';
declare type Context = {
input?: NodeJS.ReadableStream;
output?: NodeJS.WritableStream;
clearPromptOnDone?: boolean;
};
export declare type InquirerReadline = readline.ReadLine & {

@@ -36,3 +32,2 @@ output: MuteStream;

};
export declare type Prompt<Value, Config> = (options: Config, context?: Context) => Promise<Value>;
export declare function createPrompt<Value, Config extends AsyncPromptConfig>(view: (config: Config & ResolvedPromptConfig, done: (value: Value) => void) => string | [string, string | undefined]): Prompt<Value, Config>;

@@ -67,3 +67,3 @@ import readline from 'node:readline';

export function createPrompt(view) {
const prompt = async (options, context) => {
const prompt = async (config, context) => {
// Default `input` to stdin

@@ -81,3 +81,3 @@ const input = context?.input ?? process.stdin;

// TODO: we should display a loader while we get the default options.
const resolvedConfig = await getPromptConfig(options);
const resolvedConfig = await getPromptConfig(config);
return new Promise((resolve) => {

@@ -105,11 +105,11 @@ const done = (value) => {

hooks = [];
const workLoop = (config) => {
const workLoop = () => {
sessionRl = rl;
index = 0;
handleChange = () => workLoop(config);
const nextView = view(config, done);
handleChange = () => workLoop();
const nextView = view(resolvedConfig, done);
const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;
screen.render(content, bottomContent);
};
workLoop(resolvedConfig);
workLoop();
});

@@ -116,0 +116,0 @@ };

@@ -1,3 +0,15 @@

export const isUpKey = (key) => key.name === 'up' || key.name === 'k' || (key.name === 'p' && key.ctrl);
export const isDownKey = (key) => key.name === 'down' || key.name === 'j' || (key.name === 'n' && key.ctrl);
export const isUpKey = (key) =>
// The up key
key.name === 'up' ||
// Vim keybinding
key.name === 'k' ||
// Emacs keybinding
(key.ctrl && key.name === 'p');
export const isDownKey = (key) =>
// The down key
key.name === 'down' ||
// Vim keybinding
key.name === 'j' ||
// Emacs keybinding
(key.ctrl && key.name === 'n');
export const isSpaceKey = (key) => key.name === 'space';

@@ -4,0 +16,0 @@ export const isBackspaceKey = (key) => key.name === 'backspace';

{
"name": "@inquirer/core",
"type": "module",
"version": "0.0.26-alpha.0",
"version": "0.0.29-alpha.0",
"description": "Core Inquirer prompt API",

@@ -13,12 +13,48 @@ "main": "dist/index.js",

"keywords": [
"answer",
"answers",
"ask",
"base",
"cli",
"cli",
"command",
"command-line",
"confirm",
"enquirer",
"generate",
"generator",
"hyper",
"input",
"inquire",
"inquirer",
"interface",
"iterm",
"javascript",
"menu",
"node",
"nodejs",
"prompt",
"inquirer",
"command-line"
"promptly",
"prompts",
"question",
"readline",
"scaffold",
"scaffolder",
"scaffolding",
"stdin",
"stdout",
"terminal",
"tty",
"ui",
"yeoman",
"yo",
"zsh"
],
"author": "Simon Boudrias",
"license": "MIT",
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/core/README.md",
"dependencies": {
"@inquirer/type": "^0.0.4-alpha.0",
"ansi-escapes": "^5.0.0",
"chalk": "^5.0.1",
"chalk": "^5.1.0",
"cli-spinners": "^2.7.0",

@@ -34,3 +70,3 @@ "cli-width": "^4.0.0",

"devDependencies": {
"@inquirer/testing": "^0.0.2-alpha.0"
"@inquirer/testing": "^0.0.5-alpha.0"
},

@@ -42,4 +78,3 @@ "scripts": {

"access": "public"
},
"gitHead": "3d7124020ee2a316a601f6006880018eec01f3a6"
}
}
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