@inquirer/core 10.0.0 → 10.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/commonjs/lib/create-prompt.js +1 -1
- package/dist/commonjs/lib/hook-engine.d.ts +1 -1
- package/dist/commonjs/lib/theme.d.ts +2 -1
- package/dist/commonjs/lib/use-prefix.js +1 -1
- package/dist/esm/lib/create-prompt.js +1 -1
- package/dist/esm/lib/hook-engine.d.ts +1 -1
- package/dist/esm/lib/theme.d.ts +2 -1
- package/dist/esm/lib/use-prefix.js +1 -1
- package/package.json +7 -7
|
@@ -102,7 +102,7 @@ function createPrompt(view) {
|
|
|
102
102
|
// Wait for the promise to settle, then cleanup.
|
|
103
103
|
.finally(() => {
|
|
104
104
|
cleanups.forEach((cleanup) => cleanup());
|
|
105
|
-
screen.done({ clearContent: Boolean(context
|
|
105
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
106
106
|
output.end();
|
|
107
107
|
})
|
|
108
108
|
// Once cleanup is done, let the expose promise resolve/reject to the internal one.
|
|
@@ -16,7 +16,7 @@ type Pointer<Value> = SetPointer<Value> | UnsetPointer<Value>;
|
|
|
16
16
|
export declare function withPointer<Value, ReturnValue>(cb: (pointer: Pointer<Value>) => ReturnValue): ReturnValue;
|
|
17
17
|
export declare function handleChange(): void;
|
|
18
18
|
export declare const effectScheduler: {
|
|
19
|
-
queue(cb: (readline: InquirerReadline) => void): void;
|
|
19
|
+
queue(cb: (readline: InquirerReadline) => void | (() => void)): void;
|
|
20
20
|
run(): void;
|
|
21
21
|
clearAll(): void;
|
|
22
22
|
};
|
|
@@ -6,8 +6,9 @@ import type { Prettify } from '@inquirer/type';
|
|
|
6
6
|
* - `'idle'`: The prompt is loaded and currently waiting for the user to
|
|
7
7
|
* submit an answer.
|
|
8
8
|
* - `'done'`: The user has submitted an answer and the prompt is finished.
|
|
9
|
+
* - `string`: Any other string: The prompt is in a custom state.
|
|
9
10
|
*/
|
|
10
|
-
export type Status = 'loading' | 'idle' | 'done';
|
|
11
|
+
export type Status = 'loading' | 'idle' | 'done' | (string & {});
|
|
11
12
|
type DefaultTheme = {
|
|
12
13
|
/**
|
|
13
14
|
* Prefix to prepend to the message. If a function is provided, it will be
|
|
@@ -35,5 +35,5 @@ function usePrefix({ status = 'idle', theme, }) {
|
|
|
35
35
|
}
|
|
36
36
|
// There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.
|
|
37
37
|
const iconName = status === 'loading' ? 'idle' : status;
|
|
38
|
-
return typeof prefix === 'string' ? prefix : prefix[iconName];
|
|
38
|
+
return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']);
|
|
39
39
|
}
|
|
@@ -73,7 +73,7 @@ export function createPrompt(view) {
|
|
|
73
73
|
// Wait for the promise to settle, then cleanup.
|
|
74
74
|
.finally(() => {
|
|
75
75
|
cleanups.forEach((cleanup) => cleanup());
|
|
76
|
-
screen.done({ clearContent: Boolean(context
|
|
76
|
+
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
77
77
|
output.end();
|
|
78
78
|
})
|
|
79
79
|
// Once cleanup is done, let the expose promise resolve/reject to the internal one.
|
|
@@ -16,7 +16,7 @@ type Pointer<Value> = SetPointer<Value> | UnsetPointer<Value>;
|
|
|
16
16
|
export declare function withPointer<Value, ReturnValue>(cb: (pointer: Pointer<Value>) => ReturnValue): ReturnValue;
|
|
17
17
|
export declare function handleChange(): void;
|
|
18
18
|
export declare const effectScheduler: {
|
|
19
|
-
queue(cb: (readline: InquirerReadline) => void): void;
|
|
19
|
+
queue(cb: (readline: InquirerReadline) => void | (() => void)): void;
|
|
20
20
|
run(): void;
|
|
21
21
|
clearAll(): void;
|
|
22
22
|
};
|
package/dist/esm/lib/theme.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import type { Prettify } from '@inquirer/type';
|
|
|
6
6
|
* - `'idle'`: The prompt is loaded and currently waiting for the user to
|
|
7
7
|
* submit an answer.
|
|
8
8
|
* - `'done'`: The user has submitted an answer and the prompt is finished.
|
|
9
|
+
* - `string`: Any other string: The prompt is in a custom state.
|
|
9
10
|
*/
|
|
10
|
-
export type Status = 'loading' | 'idle' | 'done';
|
|
11
|
+
export type Status = 'loading' | 'idle' | 'done' | (string & {});
|
|
11
12
|
type DefaultTheme = {
|
|
12
13
|
/**
|
|
13
14
|
* Prefix to prepend to the message. If a function is provided, it will be
|
|
@@ -32,5 +32,5 @@ export function usePrefix({ status = 'idle', theme, }) {
|
|
|
32
32
|
}
|
|
33
33
|
// There's a delay before we show the loader. So we want to ignore `loading` here, and pass idle instead.
|
|
34
34
|
const iconName = status === 'loading' ? 'idle' : status;
|
|
35
|
-
return typeof prefix === 'string' ? prefix : prefix[iconName];
|
|
35
|
+
return typeof prefix === 'string' ? prefix : (prefix[iconName] ?? prefix['idle']);
|
|
36
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"description": "Core Inquirer prompt API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"answer",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"tsc": "tshy"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@inquirer/figures": "^1.0.
|
|
78
|
-
"@inquirer/type": "^3.0.
|
|
77
|
+
"@inquirer/figures": "^1.0.8",
|
|
78
|
+
"@inquirer/type": "^3.0.1",
|
|
79
79
|
"ansi-escapes": "^4.3.2",
|
|
80
80
|
"cli-width": "^4.1.0",
|
|
81
81
|
"mute-stream": "^2.0.0",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
"yoctocolors-cjs": "^2.1.2"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@arethetypeswrong/cli": "^0.
|
|
89
|
-
"@inquirer/testing": "^2.1.
|
|
88
|
+
"@arethetypeswrong/cli": "^0.17.0",
|
|
89
|
+
"@inquirer/testing": "^2.1.37",
|
|
90
90
|
"@repo/tsconfig": "workspace:*",
|
|
91
91
|
"@types/mute-stream": "^0.0.4",
|
|
92
|
-
"@types/node": "^22.
|
|
92
|
+
"@types/node": "^22.9.0",
|
|
93
93
|
"@types/wrap-ansi": "^3.0.0",
|
|
94
94
|
"tshy": "^3.0.2"
|
|
95
95
|
},
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
".": "./src/index.ts"
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "84e49bdb552e1cb4f035d644190913f367a66e74"
|
|
112
112
|
}
|