@inquirer/core 12.0.4 → 12.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +12 -12
- package/dist/lib/create-prompt.js +14 -5
- package/dist/lib/hook-engine.js +1 -1
- package/dist/lib/make-theme.js +1 -1
- package/dist/lib/pagination/use-pagination.js +2 -2
- package/dist/lib/screen-manager.js +1 -1
- package/dist/lib/theme.js +1 -1
- package/dist/lib/use-effect.js +1 -1
- package/dist/lib/use-keypress.js +3 -3
- package/dist/lib/use-memo.js +1 -1
- package/dist/lib/use-prefix.js +3 -3
- package/dist/lib/use-ref.js +1 -1
- package/dist/lib/use-state.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/package.json +7 -7
- package/dist/lib/__probe/p1.d.ts +0 -9
- package/dist/lib/__probe/p1.js +0 -4
- package/dist/lib/__probe/p2.d.ts +0 -9
- package/dist/lib/__probe/p2.js +0 -3
- package/dist/lib/__probe/p3.d.ts +0 -9
- package/dist/lib/__probe/p3.js +0 -5
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export { isUpKey, isDownKey, isSpaceKey, isBackspaceKey, isTabKey, isNumberKey, isEnterKey, isShiftKey, } from
|
|
2
|
-
export * from
|
|
3
|
-
export { usePrefix } from
|
|
4
|
-
export { useState } from
|
|
5
|
-
export { useEffect } from
|
|
6
|
-
export { useMemo } from
|
|
7
|
-
export { useRef } from
|
|
8
|
-
export { useKeypress } from
|
|
9
|
-
export { makeTheme } from
|
|
10
|
-
export { usePagination } from
|
|
11
|
-
export { createPrompt } from
|
|
12
|
-
export { Separator } from
|
|
1
|
+
export { isUpKey, isDownKey, isSpaceKey, isBackspaceKey, isTabKey, isNumberKey, isEnterKey, isShiftKey, } from './lib/key.js';
|
|
2
|
+
export * from './lib/errors.js';
|
|
3
|
+
export { usePrefix } from './lib/use-prefix.js';
|
|
4
|
+
export { useState } from './lib/use-state.js';
|
|
5
|
+
export { useEffect } from './lib/use-effect.js';
|
|
6
|
+
export { useMemo } from './lib/use-memo.js';
|
|
7
|
+
export { useRef } from './lib/use-ref.js';
|
|
8
|
+
export { useKeypress } from './lib/use-keypress.js';
|
|
9
|
+
export { makeTheme } from './lib/make-theme.js';
|
|
10
|
+
export { usePagination } from './lib/pagination/use-pagination.js';
|
|
11
|
+
export { createPrompt } from './lib/create-prompt.js';
|
|
12
|
+
export { Separator } from './lib/Separator.js';
|
|
@@ -3,13 +3,14 @@ import { AsyncResource } from 'node:async_hooks';
|
|
|
3
3
|
import { withResolver } from '@inquirer/type';
|
|
4
4
|
import MuteStream from 'mute-stream';
|
|
5
5
|
import { onExit as onSignalExit } from 'signal-exit';
|
|
6
|
-
import ScreenManager from
|
|
7
|
-
import { withHooks, effectScheduler } from
|
|
8
|
-
import { AbortPromptError, CancelPromptError, ExitPromptError } from
|
|
6
|
+
import ScreenManager from './screen-manager.js';
|
|
7
|
+
import { withHooks, effectScheduler } from './hook-engine.js';
|
|
8
|
+
import { AbortPromptError, CancelPromptError, ExitPromptError } from './errors.js';
|
|
9
9
|
import path from 'node:path';
|
|
10
10
|
// Capture the real setImmediate at module load time so it works even when test
|
|
11
11
|
// frameworks mock timers with vi.useFakeTimers() or similar.
|
|
12
12
|
const nativeSetImmediate = globalThis.setImmediate;
|
|
13
|
+
const nativeClearImmediate = globalThis.clearImmediate;
|
|
13
14
|
/**
|
|
14
15
|
* Register an event listener and return its disposer, so registrations collapse
|
|
15
16
|
* into a single statement: `cleanups.add(listenTo(rl, 'close', handler))`.
|
|
@@ -168,12 +169,20 @@ export function createPrompt(view) {
|
|
|
168
169
|
// poll) lets that stale data flow through readline harmlessly—no keypress
|
|
169
170
|
// handlers are registered yet and the output is muted, so the stale
|
|
170
171
|
// keystrokes are silently discarded.
|
|
172
|
+
// This only applies to TTY inputs, where early data is stale keystrokes
|
|
173
|
+
// the user typed before the prompt started. Piped input (stdin from a
|
|
174
|
+
// script or test harness) is intentional: deferring there risks dropping
|
|
175
|
+
// the answer itself, since data already waiting on the pipe flows
|
|
176
|
+
// through readline during the deferral tick and is then discarded,
|
|
177
|
+
// leaving the prompt waiting forever (seen as intermittent 30s timeouts
|
|
178
|
+
// in the Deno integration suite).
|
|
171
179
|
// Old-style streams (like MuteStream) have no such buffering, so the
|
|
172
180
|
// render cycle starts immediately.
|
|
173
181
|
//
|
|
174
182
|
// @see https://github.com/SBoudrias/Inquirer.js/issues/1303
|
|
175
|
-
if ('readableFlowing' in input) {
|
|
176
|
-
nativeSetImmediate(startCycle);
|
|
183
|
+
if ('readableFlowing' in input && input.isTTY) {
|
|
184
|
+
const immediate = nativeSetImmediate(startCycle);
|
|
185
|
+
cleanups.add(() => nativeClearImmediate(immediate));
|
|
177
186
|
}
|
|
178
187
|
else {
|
|
179
188
|
startCycle();
|
package/dist/lib/hook-engine.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint @typescript-eslint/no-explicit-any: ["off"] */
|
|
2
2
|
import { AsyncLocalStorage, AsyncResource } from 'node:async_hooks';
|
|
3
|
-
import { HookError, ValidationError } from
|
|
3
|
+
import { HookError, ValidationError } from './errors.js';
|
|
4
4
|
const hookStorage = new AsyncLocalStorage();
|
|
5
5
|
function createStore(rl) {
|
|
6
6
|
const store = {
|
package/dist/lib/make-theme.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRef } from
|
|
2
|
-
import { readlineWidth, breakLines } from
|
|
1
|
+
import { useRef } from '../use-ref.js';
|
|
2
|
+
import { readlineWidth, breakLines } from '../utils.js';
|
|
3
3
|
function usePointerPosition({ active, renderedItems, pageSize, loop, }) {
|
|
4
4
|
const state = useRef({
|
|
5
5
|
lastPointer: active,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from 'node:util';
|
|
2
|
-
import { breakLines, readlineWidth } from
|
|
2
|
+
import { breakLines, readlineWidth } from './utils.js';
|
|
3
3
|
import { cursorDown, cursorLeft, cursorUp, cursorTo, cursorShow, eraseLines, } from '@inquirer/ansi';
|
|
4
4
|
const height = (content) => content.split('\n').length;
|
|
5
5
|
const lastLine = (content) => content.split('\n').pop() ?? '';
|
package/dist/lib/theme.js
CHANGED
package/dist/lib/use-effect.js
CHANGED
package/dist/lib/use-keypress.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useRef } from
|
|
2
|
-
import { useEffect } from
|
|
3
|
-
import { withUpdates } from
|
|
1
|
+
import { useRef } from './use-ref.js';
|
|
2
|
+
import { useEffect } from './use-effect.js';
|
|
3
|
+
import { withUpdates } from './hook-engine.js';
|
|
4
4
|
export function useKeypress(userHandler) {
|
|
5
5
|
const signal = useRef(userHandler);
|
|
6
6
|
signal.current = userHandler;
|
package/dist/lib/use-memo.js
CHANGED
package/dist/lib/use-prefix.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useState } from
|
|
2
|
-
import { useEffect } from
|
|
3
|
-
import { makeTheme } from
|
|
1
|
+
import { useState } from './use-state.js';
|
|
2
|
+
import { useEffect } from './use-effect.js';
|
|
3
|
+
import { makeTheme } from './make-theme.js';
|
|
4
4
|
export function usePrefix({ status = 'idle', theme, }) {
|
|
5
5
|
const [showLoader, setShowLoader] = useState(false);
|
|
6
6
|
const [tick, setTick] = useState(0);
|
package/dist/lib/use-ref.js
CHANGED
package/dist/lib/use-state.js
CHANGED
package/dist/lib/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import cliWidth from 'cli-width';
|
|
2
2
|
import { wrapAnsi } from 'fast-wrap-ansi';
|
|
3
|
-
import { readline } from
|
|
3
|
+
import { readline } from './hook-engine.js';
|
|
4
4
|
/**
|
|
5
5
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
6
6
|
* ignore invisible codes during width calculation.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.6",
|
|
4
4
|
"description": "Core Inquirer prompt API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"yo",
|
|
42
42
|
"zsh"
|
|
43
43
|
],
|
|
44
|
-
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/
|
|
44
|
+
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/HEAD/packages/core/README.md",
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
|
47
47
|
"repository": {
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"tsc": "tsc"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@inquirer/ansi": "^2.0.
|
|
71
|
-
"@inquirer/figures": "^2.0.
|
|
72
|
-
"@inquirer/type": "4.2.
|
|
70
|
+
"@inquirer/ansi": "^2.0.10",
|
|
71
|
+
"@inquirer/figures": "^2.0.10",
|
|
72
|
+
"@inquirer/type": "4.2.1",
|
|
73
73
|
"cli-width": "^4.1.0",
|
|
74
74
|
"fast-wrap-ansi": "^0.2.0",
|
|
75
75
|
"mute-stream": "^3.0.0",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@repo/tsconfig": "0.0.0",
|
|
80
80
|
"@types/mute-stream": "^0.0.4",
|
|
81
81
|
"@types/node": "^26.1.1",
|
|
82
|
-
"typescript": "^
|
|
82
|
+
"typescript": "^7.0.2"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@types/node": ">=18"
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
},
|
|
95
95
|
"main": "./dist/index.js",
|
|
96
96
|
"types": "./dist/index.d.ts",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "672b77f0486388d7f5c35487d89a5ff63f4c54dd"
|
|
98
98
|
}
|
package/dist/lib/__probe/p1.d.ts
DELETED
package/dist/lib/__probe/p1.js
DELETED
package/dist/lib/__probe/p2.d.ts
DELETED
package/dist/lib/__probe/p2.js
DELETED
package/dist/lib/__probe/p3.d.ts
DELETED