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 8.2.2 to 8.2.3

6

dist/cjs/lib/create-prompt.js

@@ -92,5 +92,4 @@ "use strict";

}
function workLoop(resolvedConfig) {
function workLoop() {
store.index = 0;
store.handleChange = () => workLoop(resolvedConfig);
try {

@@ -107,3 +106,4 @@ const nextView = view(config, done);

}
workLoop(config);
store.handleChange = () => workLoop();
workLoop();
// Re-renders only happen when the state change; but the readline cursor could change position

@@ -110,0 +110,0 @@ // and that also requires a re-render (and a manual one because we mute the streams).

@@ -9,2 +9,3 @@ "use strict";

function usePrefix({ isLoading = false, theme, }) {
const [showLoader, setShowLoader] = (0, use_state_mjs_1.useState)(false);
const [tick, setTick] = (0, use_state_mjs_1.useState)(0);

@@ -14,11 +15,23 @@ const { prefix, spinner } = (0, make_theme_mjs_1.makeTheme)(theme);

if (isLoading) {
const timeout = setTimeout(node_async_hooks_1.AsyncResource.bind(() => {
setTick(tick + 1);
}), spinner.interval);
return () => clearTimeout(timeout);
let tickInterval;
let inc = -1;
// Delay displaying spinner by 300ms, to avoid flickering
const delayTimeout = setTimeout(node_async_hooks_1.AsyncResource.bind(() => {
setShowLoader(true);
tickInterval = setInterval(node_async_hooks_1.AsyncResource.bind(() => {
inc = inc + 1;
setTick(inc % spinner.frames.length);
}), spinner.interval);
}), 300);
return () => {
clearTimeout(delayTimeout);
clearInterval(tickInterval);
};
}
}, [isLoading, tick]);
if (isLoading) {
const frame = tick % spinner.frames.length;
return spinner.frames[frame];
else {
setShowLoader(false);
}
}, [isLoading]);
if (showLoader) {
return spinner.frames[tick];
}

@@ -25,0 +38,0 @@ return prefix;

{
"name": "@inquirer/core",
"version": "8.2.2",
"version": "8.2.3",
"engines": {

@@ -63,3 +63,3 @@ "node": ">=18"

"@types/mute-stream": "^0.0.4",
"@types/node": "^20.12.13",
"@types/node": "^20.14.6",
"@types/wrap-ansi": "^3.0.0",

@@ -76,3 +76,3 @@ "ansi-escapes": "^4.3.2",

"devDependencies": {
"@inquirer/testing": "^2.1.21"
"@inquirer/testing": "^2.1.22"
},

@@ -102,3 +102,3 @@ "scripts": {

"sideEffects": false,
"gitHead": "209b4ce30fe71f8e2f0e066a1a98e385eecb15f4"
"gitHead": "cc52a353abb1b7f3b3dc81b9e6da7ed478099dbf"
}

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