@inquirer/core 12.0.5 → 12.1.0
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 +11 -4
- package/dist/lib/hook-engine.js +1 -1
- package/dist/lib/make-theme.js +4 -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 +10 -10
- 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,9 +3,9 @@ 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.
|
|
@@ -169,11 +169,18 @@ export function createPrompt(view) {
|
|
|
169
169
|
// poll) lets that stale data flow through readline harmlessly—no keypress
|
|
170
170
|
// handlers are registered yet and the output is muted, so the stale
|
|
171
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).
|
|
172
179
|
// Old-style streams (like MuteStream) have no such buffering, so the
|
|
173
180
|
// render cycle starts immediately.
|
|
174
181
|
//
|
|
175
182
|
// @see https://github.com/SBoudrias/Inquirer.js/issues/1303
|
|
176
|
-
if ('readableFlowing' in input) {
|
|
183
|
+
if ('readableFlowing' in input && input.isTTY) {
|
|
177
184
|
const immediate = nativeSetImmediate(startCycle);
|
|
178
185
|
cleanups.add(() => nativeClearImmediate(immediate));
|
|
179
186
|
}
|
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,4 +1,4 @@
|
|
|
1
|
-
import { getDefaultTheme } from
|
|
1
|
+
import { getDefaultTheme } from './theme.js';
|
|
2
2
|
function isPlainObject(value) {
|
|
3
3
|
if (typeof value !== 'object' || value === null)
|
|
4
4
|
return false;
|
|
@@ -12,6 +12,9 @@ function deepMerge(...objects) {
|
|
|
12
12
|
const output = {};
|
|
13
13
|
for (const obj of objects) {
|
|
14
14
|
for (const [key, value] of Object.entries(obj)) {
|
|
15
|
+
// A key explicitly set to `undefined` keeps the value from the previous theme.
|
|
16
|
+
if (value === undefined)
|
|
17
|
+
continue;
|
|
15
18
|
const prevValue = output[key];
|
|
16
19
|
output[key] =
|
|
17
20
|
isPlainObject(prevValue) && isPlainObject(value)
|
|
@@ -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.1.0",
|
|
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,19 +67,19 @@
|
|
|
67
67
|
"tsc": "tsc"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@inquirer/ansi": "^2.0
|
|
71
|
-
"@inquirer/figures": "^2.0
|
|
72
|
-
"@inquirer/type": "4.
|
|
70
|
+
"@inquirer/ansi": "^2.1.0",
|
|
71
|
+
"@inquirer/figures": "^2.1.0",
|
|
72
|
+
"@inquirer/type": "4.3.0",
|
|
73
73
|
"cli-width": "^4.1.0",
|
|
74
74
|
"fast-wrap-ansi": "^0.2.0",
|
|
75
|
-
"mute-stream": "^
|
|
75
|
+
"mute-stream": "^4.0.0",
|
|
76
76
|
"signal-exit": "^4.1.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@repo/tsconfig": "0.
|
|
79
|
+
"@repo/tsconfig": "0.1.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"
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
92
|
"engines": {
|
|
93
|
-
"node": "
|
|
93
|
+
"node": "^22.22.2 || ^24.15.0 || >=26.0.0"
|
|
94
94
|
},
|
|
95
95
|
"main": "./dist/index.js",
|
|
96
96
|
"types": "./dist/index.d.ts",
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "00ded073f80523aaeaf8a903bbfb535994990475"
|
|
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