Compare Versions - inquirer
npm / inquirer / Compare Versions
- Fix broken 1.3.1 release process.
- Bump dependencies
- Fix: Keypresses happening before a prompt is rendered are now ignored.
- Fix (checkbox): Element who're both checked and disabled are now always included in the returned array.
- Feat (select/checkbox): Cursor will now hover disabled options of the list; but they still cannot be interacted with. This prevents the cursor jumping ahead in ways that can be confusing.
- Feat: various new theme options to make all prompts content localizable.
Finally, see our new @inquirer/i18n package!
- chore: Switch
wrap-ansiwithfast-wrap-ansi
- Typescript disallow
type: 'list'unless there's a plugin installed under that name. (listwas replaced byselectand marked as deprecated for a few released, v13.0.0 removed the alias.)
- Regression: previous
answersweren't provided to the validate functions as the second arguments.
- feat(
search): Add support fordefault. - feat(
rawlist): Add support fordescriptionof choices. That information is displayed under the list when the choice is highlighted. - Bump dependencies
- Feat:
rawlistnow supportsdefaultoption. - Fix:
selectnow infer return type properly when passing achoicesarray of string literals.
- Fix Typescript not discovering types when
moduleResolutionis set tocommonjs(you probably want to fix that in your project if it's still in your tsconfig)
Release Notes
🚨 Breaking Changes
This is a major release that modernizes the codebase for Node.js ≥ 20.
ESM Only - No More CommonJS Support
Impact: All packages are now ESM-only. CommonJS imports are no longer supported.
If you're on modern Node versions (≥ 20), this should be transparent and have no impact.
Node.js Version Requirement
Minimum Node.js version is now 20.x
Node.js versions below 20 are no longer supported. Please upgrade to Node.js 20 or later.
Node min versions: >=23.5.0 || ^22.13.0 || ^21.7.0 || ^20.12.0
Deprecated APIs Removed
The following deprecated APIs have been removed after being deprecated in previous releases:
list prompt alias removed (affects inquirer package only)
The list alias has been removed from the inquirer package. This only impacts users of the legacy inquirer package, not users of @inquirer/prompts or individual prompt packages.
// ❌ No longer available (inquirer package only)
import inquirer from 'inquirer';
const answer = await inquirer.prompt([
{ type: 'list', name: 'choice', message: 'Pick one:', choices: ['a', 'b'] }
]);
// ✅ Use 'select' instead
import inquirer from 'inquirer';
const answer = await inquirer.prompt([
{ type: 'select', name: 'choice', message: 'Pick one:', choices: ['a', 'b'] }
]);
helpMode theme property removed
// ❌ No longer available
const answer = await select({
theme: { helpMode: 'never' }
});
// ✅ Use theme.style.keysHelpTip instead
const answer = await select({
theme: {
style: {
keysHelpTip: () => undefined // or your custom styling function
}
}
});
This affects the following prompts:
@inquirer/checkbox@inquirer/search@inquirer/select
instructions config property removed
// ❌ No longer available
const answer = await checkbox({
instructions: 'Custom instructions'
});
// ✅ Use theme.style.keysHelpTip instead
const answer = await checkbox({
theme: {
style: {
keysHelpTip: (text) => 'Custom instructions'
}
}
});
This affects the following prompts:
@inquirer/checkbox@inquirer/search@inquirer/select
cancel() method removed
The cancel() method on prompt return custom Promise has been removed.
// ❌ No longer available
const answerPromise = input({ message: 'Name?' });
answerPromise.cancel();
const answer = await answerPromise;
// ✅ Use AbortSignal instead
const controller = new AbortController();
const answer = await input(
{ message: 'Name?' },
{ signal: controller.signal }
);
controller.abort();
Color Library Change: yoctocolors → Node.js styleText
Internal change: The project now uses Node.js built-in util.styleText() instead of the yoctocolors package for terminal colors. This makes Inquirer smaller and reduces risks of vulnerabilities coming from transitive dependencies.
- [Node 18 compat] Downgraded to mute-stream@2 to maintain Node 18 compatibility.
- [Typescript] Allow passing a
Partial<{ ... }>type as pre-filled answers.
- feat
@inquirer/input: Now support simple RegExp validation withpattern/patternError. - fix
@inquirer/editor: Fix typos/waitForUseInput/waitForUserInput - Bump dependencies
- New design for the keys help tip. Themable/localizable with
theme.style.keysHelpTip. - Re-introduce option to match up/down actions with vim or emacs keybindings. Enable with
theme.keybindings
- Reduce number of transitive dependencies
- Fix #1834: (rawlist) Allows specifying numbers as explicit keys of option within the list.
- fix: Remove "easter-egg" vim/emacs bindings conflicting with the type-to-search feature.
- Fix Unix
yesnot properly being processed by the confirm prompt. (yes | node confirm-script.js)
- Make
@types/nodean optional peer dependency.
- Replace
external-editordependency with new@inquirer/external-editor. This remove the vulnerabletmptransitive dependency from the dependency tree.
- Search prompt: New
instructionsconfig to allow localizing the help tips.
- Fix #1786 select prompt with
indexMode: numbertheme option didn't properly calculate the items indexes if separators where present in between choices.
- Fixes: a transitive dependency (
run-aysnc) loaded devDependencies unexpectedly. This is now fixed upstream. Rel #1791
- Select prompt: When pressing a number key, we'll ignore separators in counting the index of the item to jump to.
- Checkbox prompt: When pressing a number key, we'll ignore separators in counting the index of the item to select.
-input prompt: New prefill option to control if the default value is editable inline or only after pressing tab.
- Fix #1743: pagination logic of the
select,checkboxandsearchprompts was fully rewritten to handle edge cases around rendering multi-line choices and pointer positioning.
- Chore: dependencies bump
- Fix #1741: Issue with SIGINT in some scenarios leaving promises unsettled on exit.
- Fix: Remove monorepo related dependencies from all artifacts published to
npm. This removes non-standard version specifiers likeworkspace:*from the public npm packages.
- Feat(@inquirer/select): Added an
instructionsoption allowing to customize the messages in the help tips. - Feat(@inquirer/rawlist): Arrow keys will now cycle through the option, just like the
@inquirer/selectprompt. Also added aloopoption to control the list loop behaviour when reaching the boundaries.
- README: Add new sponsor
- Chore: dependency updates
- Feat (
select): Introducetheme.indexModeto control displaying an index prefix in front of each choice. (defaults to hidden) - Fix (
select): Improve search when number keys are pressed
- Fix an issue where inquirer would throw if Node is ran with the new
--frozen-intrinsicsflag.
- Mark
@types/nodeas an optional peer dependency across all packages.
- Added new
shortcutconfig to thecheckboxprompt. Allows to customize or disable shortcut keys for select all and invert selection.
- Replace 3rd party dependency
strip-ansiin favour of Node built-instripVTControlCharactersutil.
- Checkbox prompt: re-added support for an array of
defaultto be provided listing pre-checked checkboxes. This is a legacy interface brought back given this feature removal was an involuntary breaking change during thev12release. The preferred interface is to provide thecheckedproperty to choices{ value: 'bar', checked: true }.
@types/nodeis now only apeerDependencies. This reduces the install size of inquirer dramatically for folks not using Typescript. It's unlikely to break your builds if you used TS already, if it does runnpm install --dev @types/node/yarn add --dev @types/node.
- Now exports base utility Typescript types:
import type { Question, DistinctQuestion, Answers } from 'inquirer';
You should use as follow to keep the inference working properly:
const questions = [
{ ... }
] as const satisfies Question[];
// If you're not using inquirer plugins, `Question` could alternatively be replaced by `DistinctQuestion` for stricter checks.
- Fix #1555:
whenbehaviour changed unexpectedly when returning a falsy value.
No technical breaking changes; but we changed the style of the question prefix once the answer is provided. Once a question is answer, the prefix becomes a tick mark (previously it was the same ? as when the prompt is idle.)
This is theme-able, and so can be overwritten to with theme.prefix.
- Fix the
filteroption not working. - The
signal: AbortSignaldidn't work with class based prompts (OSS plugins.) Now it should work consistently with legacy style prompts.
- Fix
expandprompt being broken if a Separator was in thechoicesarray.
- Includes various fixes & new features to the different built-in prompts
- Fix: Major rework of the Typescript types. Hoping to reduce the amount of finicky type errors (or wrong types) you might've ran into.
- Fix broken backward compatibility issues with v9.
Choiceobjects withoutvalueshould default to usenameas the value. Note: Please don't rely on this weird behaviour, but we fixed it since it was an unintended breaking change.
- Adds the new
{ type: 'search' }prompt.
- Fix: Re-added missing
shorton select and checkbox prompt. - Fix: Remove type requiring a
closemethod on prompt class instances (it wasn't required.)
- Re-implemented with Typescript.
- Adding CJS support (now
inquireris publishes a dual-build CJS/ESM.) - All core prompts are now coming from
@inquirer/prompt. - Custom prompts now should be implemented with
@inquirer/core. Custom prompts built oninquirer@9.x.xwill keep working, but should plan a migration. inquirer.ui.BottomBaris deleted.
My expectation is that this release should be a drop-in replacement for people using inquirer.prompt() and built-ins 🤞🏻. Please open an issue on Github if you run into issues migrating; it's a large rewrite and there might be a few sharp edges to cut! Hope you'll like this new release.
- Fix issue with plugins relying on internal
inquirerpackages file structure.
- Fix risk of prototype injection.
- Replace
chalkwith(in 9.3.2 went topicolorsyoctocolorsto stay with Sindre's packages and reduce amount of provenance.) - Drop many dependencies in favour of native functions when possible.
No impact expected, but it's a large changes in dependencies. Let us know if you run into any issues upgrading!
editorprompt: Fixed compatibility issue betweendefaultandwaitUserInputoptions. #1405
- On windows, we will now use unicode characters whenever possible
- Modified lodash imports to help with tree-shaking
- Replace unmaintained
throughdependency (only affect users of the old bottom bar)
Fix issue with the default value disappearing from prompt.
Inquirer is now a native Node ECMAScript module. This will require your Node runtime to support es modules, and your app to be an es module. Node documentation over here: https://nodejs.org/api/esm.html#modules-ecmascript-modules
If you cannot migrate, please remember you can keep using the v8.x release line until you're ready.
- Bugfix: Fix a dependency who became ESM only
- Fix line wrapping with using with terminal links
- Fix number prompt not working with negative numbers
Fix bugs with the rawlist
- Fix bug when using both arrow keys and number keys on the
rawListprompt. - Dependencies bump
checkboxprompt: Update the help message to be more complete. And the help message is now shown until a selection is made.
Fix older Node version compatibility issue.
- Fix an error being thrown inside the
rawlistprompt
Bug Fixes
- Fix password prompt appearing when doing async filtering/validation
- User being prompted a question even though it was answered when using nested answer object format.
- Fix extra space appearing when using custom prefix.
And bump of all dependencies.
- Fix bug on
rawListprompt - Bump dependencies
Fix: Number prompt default behavior.
New features
- Now display a loading spinner while asynchronously filtering or validating data.
inquirer.prompt()now accept a shorthand object syntax instead of an array withnamed prompts:
const { foo, bar } = await inquirer.prompt({
foo: {
message: '...',
default: '...',
},
bar: {
default: '...',
}
}):
Fixes
- Fix issue with duplicate keys in
expandprompt not being caught if casing didn't match - Fix
rawlistprompt ignoringshortoption - Rollback dependencies migrated to ESM causing issue for some users
And lastly general dependency upgrade (to non-ESM versions)
- Drop support for Node 10 (through dependencies)
- Add
postfixoption to the editor prompt to allow easily turning on proper syntax highlighting
- Fix to release the readline on errors
- Security patch (lodash)
Fix the loop: false option in the checkbox prompt.
- Fix the
loop: falseoption in thelistprompt.
- New option
loop(boolean) for list type prompts. This prevents the list from looping when reaching the top or bottom of the selection. - Bug fix: multi line list type prompts
- Core: Bumped dependencies
Enhancement
- 039a55c7ec04d95887bdeb9b164cc634f26beb57 #923 Only import used lodash methods. (@merceyz)
Bug Fix
- a1171d25cdb48c147b405e3173828a8de2dc735b #918 Fix
@inquirer/confirmformatted output value. (@rbardini) - 1bf6413b71e94b52a68ba9a4d331ea67453e3390 Fix
enginesfield for Node.js 8. (@LitoMore)
Errors when running in non-TTY environment are now marked and catchable.
Revert broken fix done in 7.0.2
Work around bug affecting Windows user with Node 10 (#767) (Reverted in v7.0.3)
- Drop support for Node 6.
Bug Fix
- Fix memory leak with some event listeners not being cleaned up after a prompting session.
- Highlight the whole hovered row on the checkbox prompt
- Any keypress will remove the default value on input prompt
- Pressing backspace on an empty input prompt now clears the default value.