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 9.0.6 to 9.0.7

22

dist/cjs/lib/create-prompt.js

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

const readline = __importStar(require("node:readline"));
const node_async_hooks_1 = require("node:async_hooks");
const type_1 = require("@inquirer/type");

@@ -54,3 +55,3 @@ const mute_stream_1 = __importDefault(require("mute-stream"));

const answer = new type_1.CancelablePromise((resolve, reject) => {
(0, hook_engine_mjs_1.withHooks)(rl, (store) => {
(0, hook_engine_mjs_1.withHooks)(rl, (cycle) => {
function checkCursorPos() {

@@ -63,7 +64,5 @@ screen.checkCursorPos();

});
function onExit() {
const onExit = node_async_hooks_1.AsyncResource.bind(() => {
try {
store.hooksCleanup.forEach((cleanFn) => {
cleanFn === null || cleanFn === void 0 ? void 0 : cleanFn();
});
hook_engine_mjs_1.effectScheduler.clearAll();
}

@@ -81,4 +80,4 @@ catch (error) {

removeExitListener();
store.rl.input.removeListener('keypress', checkCursorPos);
}
rl.input.removeListener('keypress', checkCursorPos);
});
cancel = () => {

@@ -96,4 +95,3 @@ onExit();

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

@@ -109,5 +107,3 @@ const nextView = view(config, done);

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

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

// by a state change sets the cursor to the right position.
store.rl.input.on('keypress', checkCursorPos);
rl.input.on('keypress', checkCursorPos);
});

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

@@ -28,3 +28,10 @@ "use strict";

return hookStorage.run(store, () => {
cb(store);
function cycle(render) {
store.handleChange = () => {
store.index = 0;
render();
};
store.handleChange();
}
cb(cycle);
});

@@ -105,2 +112,10 @@ }

},
clearAll() {
const store = getStore();
store.hooksCleanup.forEach((cleanFn) => {
cleanFn === null || cleanFn === void 0 ? void 0 : cleanFn();
});
store.hooksEffect.length = 0;
store.hooksCleanup.length = 0;
},
};
import type { InquirerReadline } from '@inquirer/type';
type HookStore = {
rl: InquirerReadline;
hooks: any[];
hooksCleanup: Array<void | (() => void)>;
hooksEffect: Array<() => void>;
index: number;
handleChange: () => void;
};
export declare function withHooks(rl: InquirerReadline, cb: (store: HookStore) => void): void;
export declare function withHooks(rl: InquirerReadline, cb: (cycle: (render: () => void) => void) => void): void;
export declare function readline(): InquirerReadline;

@@ -29,3 +21,4 @@ export declare function withUpdates<T extends (...args: any) => any>(fn: T): (...args: Parameters<T>) => ReturnType<T>;

run(): void;
clearAll(): void;
};
export {};
{
"name": "@inquirer/core",
"version": "9.0.6",
"version": "9.0.7",
"engines": {

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

"@types/mute-stream": "^0.0.4",
"@types/node": "^20.14.13",
"@types/node": "^22.0.0",
"@types/wrap-ansi": "^3.0.0",

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

"devDependencies": {
"@inquirer/testing": "^2.1.29"
"@inquirer/testing": "^2.1.30"
},

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

"sideEffects": false,
"gitHead": "7a061f13e053dd64ef7373b08e8a10130131ea59"
"gitHead": "b89972b992a65005afd6397b57aa4635010a5ef7"
}

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