@optique/inquirer 1.3.0-dev.2417 → 1.3.0-dev.2420
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.cjs +15 -1
- package/dist/index.d.cts +17 -4
- package/dist/index.d.ts +17 -4
- package/dist/index.js +5 -3
- package/package.json +6 -6
package/dist/index.cjs
CHANGED
|
@@ -88,7 +88,9 @@ const validPromptTypes = new Set([
|
|
|
88
88
|
* user.
|
|
89
89
|
*
|
|
90
90
|
* @param parser Inner parser that reads CLI values.
|
|
91
|
-
* @param config Type-safe Inquirer.js prompt configuration
|
|
91
|
+
* @param config Type-safe Inquirer.js prompt configuration, or a
|
|
92
|
+
* configuration derived from dependency sources via
|
|
93
|
+
* `derivePromptConfig()`.
|
|
92
94
|
* @returns A parser with interactive prompt fallback, always in async mode.
|
|
93
95
|
* @throws {Error} If prompt execution fails with an unexpected error or if the
|
|
94
96
|
* inner parser throws while parsing or completing.
|
|
@@ -231,4 +233,16 @@ function normalizeChoices(choices) {
|
|
|
231
233
|
|
|
232
234
|
//#endregion
|
|
233
235
|
exports.Separator = __inquirer_prompts.Separator;
|
|
236
|
+
Object.defineProperty(exports, 'derivePromptConfig', {
|
|
237
|
+
enumerable: true,
|
|
238
|
+
get: function () {
|
|
239
|
+
return __optique_prompt.derivePromptConfig;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
Object.defineProperty(exports, 'isDerivedPromptConfig', {
|
|
243
|
+
enumerable: true,
|
|
244
|
+
get: function () {
|
|
245
|
+
return __optique_prompt.isDerivedPromptConfig;
|
|
246
|
+
}
|
|
247
|
+
});
|
|
234
248
|
exports.prompt = prompt;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Separator } from "@inquirer/prompts";
|
|
2
2
|
import { FluentParser } from "@optique/core/fluent";
|
|
3
3
|
import { Mode, Parser } from "@optique/core/parser";
|
|
4
|
-
import { PromptCondition } from "@optique/prompt";
|
|
4
|
+
import { DerivePromptConfigContext, DerivePromptConfigOptions, DerivePromptConfigsContext, DerivePromptConfigsOptions, DerivedPromptConfig, DerivedPromptConfig as DerivedPromptConfig$1, PromptCondition, derivePromptConfig, isDerivedPromptConfig } from "@optique/prompt";
|
|
5
5
|
|
|
6
6
|
//#region src/index.d.ts
|
|
7
7
|
|
|
@@ -222,6 +222,17 @@ type StringPromptConfig = InputConfig | PasswordConfig | EditorConfig | SelectCo
|
|
|
222
222
|
*/
|
|
223
223
|
type PromptConfig<T> = BasePromptConfig<Exclude<T, null | undefined>> & PromptCondition<T>;
|
|
224
224
|
type BasePromptConfig<T> = T extends boolean ? ConfirmConfig : T extends number ? NumberPromptConfig : T extends string ? StringPromptConfig : T extends readonly string[] ? CheckboxConfig : never;
|
|
225
|
+
/**
|
|
226
|
+
* Union of every prompt configuration this package can execute,
|
|
227
|
+
* regardless of the parser value type.
|
|
228
|
+
*
|
|
229
|
+
* Derived prompt configurations resolve against this union: the adapter's
|
|
230
|
+
* configuration type supplies the resolver's return type, so a resolver
|
|
231
|
+
* may produce any prompt kind the adapter supports.
|
|
232
|
+
*
|
|
233
|
+
* @since 1.3.0
|
|
234
|
+
*/
|
|
235
|
+
type RuntimePromptConfig = ConfirmConfig | NumberPromptConfig | StringPromptConfig | CheckboxConfig;
|
|
225
236
|
/**
|
|
226
237
|
* Wraps a parser with an interactive Inquirer.js prompt fallback.
|
|
227
238
|
*
|
|
@@ -230,12 +241,14 @@ type BasePromptConfig<T> = T extends boolean ? ConfirmConfig : T extends number
|
|
|
230
241
|
* user.
|
|
231
242
|
*
|
|
232
243
|
* @param parser Inner parser that reads CLI values.
|
|
233
|
-
* @param config Type-safe Inquirer.js prompt configuration
|
|
244
|
+
* @param config Type-safe Inquirer.js prompt configuration, or a
|
|
245
|
+
* configuration derived from dependency sources via
|
|
246
|
+
* `derivePromptConfig()`.
|
|
234
247
|
* @returns A parser with interactive prompt fallback, always in async mode.
|
|
235
248
|
* @throws {Error} If prompt execution fails with an unexpected error or if the
|
|
236
249
|
* inner parser throws while parsing or completing.
|
|
237
250
|
* @since 1.0.0
|
|
238
251
|
*/
|
|
239
|
-
declare function prompt<M extends Mode, TValue, TState>(parser: Parser<M, TValue, TState>, config: PromptConfig<TValue>): FluentParser<"async", TValue, TState>;
|
|
252
|
+
declare function prompt<M extends Mode, TValue, TState>(parser: Parser<M, TValue, TState>, config: PromptConfig<TValue> | DerivedPromptConfig$1<RuntimePromptConfig, NoInfer<TValue>>): FluentParser<"async", TValue, TState>;
|
|
240
253
|
//#endregion
|
|
241
|
-
export { CheckboxChoice, CheckboxConfig, Choice, ConfirmConfig, EditorConfig, ExpandChoice, ExpandConfig, InputConfig, NumberPromptConfig, PasswordConfig, PromptConfig, RawlistConfig, SelectConfig, Separator, StringPromptConfig, prompt };
|
|
254
|
+
export { CheckboxChoice, CheckboxConfig, Choice, ConfirmConfig, type DerivePromptConfigContext, type DerivePromptConfigOptions, type DerivePromptConfigsContext, type DerivePromptConfigsOptions, type DerivedPromptConfig, EditorConfig, ExpandChoice, ExpandConfig, InputConfig, NumberPromptConfig, PasswordConfig, PromptConfig, RawlistConfig, RuntimePromptConfig, SelectConfig, Separator, StringPromptConfig, derivePromptConfig, isDerivedPromptConfig, prompt };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Separator } from "@inquirer/prompts";
|
|
2
|
-
import { PromptCondition } from "@optique/prompt";
|
|
2
|
+
import { DerivePromptConfigContext, DerivePromptConfigOptions, DerivePromptConfigsContext, DerivePromptConfigsOptions, DerivedPromptConfig, DerivedPromptConfig as DerivedPromptConfig$1, PromptCondition, derivePromptConfig, isDerivedPromptConfig } from "@optique/prompt";
|
|
3
3
|
import { FluentParser } from "@optique/core/fluent";
|
|
4
4
|
import { Mode, Parser } from "@optique/core/parser";
|
|
5
5
|
|
|
@@ -222,6 +222,17 @@ type StringPromptConfig = InputConfig | PasswordConfig | EditorConfig | SelectCo
|
|
|
222
222
|
*/
|
|
223
223
|
type PromptConfig<T> = BasePromptConfig<Exclude<T, null | undefined>> & PromptCondition<T>;
|
|
224
224
|
type BasePromptConfig<T> = T extends boolean ? ConfirmConfig : T extends number ? NumberPromptConfig : T extends string ? StringPromptConfig : T extends readonly string[] ? CheckboxConfig : never;
|
|
225
|
+
/**
|
|
226
|
+
* Union of every prompt configuration this package can execute,
|
|
227
|
+
* regardless of the parser value type.
|
|
228
|
+
*
|
|
229
|
+
* Derived prompt configurations resolve against this union: the adapter's
|
|
230
|
+
* configuration type supplies the resolver's return type, so a resolver
|
|
231
|
+
* may produce any prompt kind the adapter supports.
|
|
232
|
+
*
|
|
233
|
+
* @since 1.3.0
|
|
234
|
+
*/
|
|
235
|
+
type RuntimePromptConfig = ConfirmConfig | NumberPromptConfig | StringPromptConfig | CheckboxConfig;
|
|
225
236
|
/**
|
|
226
237
|
* Wraps a parser with an interactive Inquirer.js prompt fallback.
|
|
227
238
|
*
|
|
@@ -230,12 +241,14 @@ type BasePromptConfig<T> = T extends boolean ? ConfirmConfig : T extends number
|
|
|
230
241
|
* user.
|
|
231
242
|
*
|
|
232
243
|
* @param parser Inner parser that reads CLI values.
|
|
233
|
-
* @param config Type-safe Inquirer.js prompt configuration
|
|
244
|
+
* @param config Type-safe Inquirer.js prompt configuration, or a
|
|
245
|
+
* configuration derived from dependency sources via
|
|
246
|
+
* `derivePromptConfig()`.
|
|
234
247
|
* @returns A parser with interactive prompt fallback, always in async mode.
|
|
235
248
|
* @throws {Error} If prompt execution fails with an unexpected error or if the
|
|
236
249
|
* inner parser throws while parsing or completing.
|
|
237
250
|
* @since 1.0.0
|
|
238
251
|
*/
|
|
239
|
-
declare function prompt<M extends Mode, TValue, TState>(parser: Parser<M, TValue, TState>, config: PromptConfig<TValue>): FluentParser<"async", TValue, TState>;
|
|
252
|
+
declare function prompt<M extends Mode, TValue, TState>(parser: Parser<M, TValue, TState>, config: PromptConfig<TValue> | DerivedPromptConfig$1<RuntimePromptConfig, NoInfer<TValue>>): FluentParser<"async", TValue, TState>;
|
|
240
253
|
//#endregion
|
|
241
|
-
export { CheckboxChoice, CheckboxConfig, Choice, ConfirmConfig, EditorConfig, ExpandChoice, ExpandConfig, InputConfig, NumberPromptConfig, PasswordConfig, PromptConfig, RawlistConfig, SelectConfig, Separator, StringPromptConfig, prompt };
|
|
254
|
+
export { CheckboxChoice, CheckboxConfig, Choice, ConfirmConfig, type DerivePromptConfigContext, type DerivePromptConfigOptions, type DerivePromptConfigsContext, type DerivePromptConfigsOptions, type DerivedPromptConfig, EditorConfig, ExpandChoice, ExpandConfig, InputConfig, NumberPromptConfig, PasswordConfig, PromptConfig, RawlistConfig, RuntimePromptConfig, SelectConfig, Separator, StringPromptConfig, derivePromptConfig, isDerivedPromptConfig, prompt };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Separator, checkbox, confirm, editor, expand, input, number, password, rawlist, select } from "@inquirer/prompts";
|
|
2
2
|
import { message } from "@optique/core/message";
|
|
3
|
-
import { createPromptAdapter } from "@optique/prompt";
|
|
3
|
+
import { createPromptAdapter, derivePromptConfig, isDerivedPromptConfig } from "@optique/prompt";
|
|
4
4
|
|
|
5
5
|
//#region src/index.ts
|
|
6
6
|
const promptFunctionsOverrideSymbol = Symbol.for("@optique/inquirer/prompt-functions");
|
|
@@ -65,7 +65,9 @@ const validPromptTypes = new Set([
|
|
|
65
65
|
* user.
|
|
66
66
|
*
|
|
67
67
|
* @param parser Inner parser that reads CLI values.
|
|
68
|
-
* @param config Type-safe Inquirer.js prompt configuration
|
|
68
|
+
* @param config Type-safe Inquirer.js prompt configuration, or a
|
|
69
|
+
* configuration derived from dependency sources via
|
|
70
|
+
* `derivePromptConfig()`.
|
|
69
71
|
* @returns A parser with interactive prompt fallback, always in async mode.
|
|
70
72
|
* @throws {Error} If prompt execution fails with an unexpected error or if the
|
|
71
73
|
* inner parser throws while parsing or completing.
|
|
@@ -207,4 +209,4 @@ function normalizeChoices(choices) {
|
|
|
207
209
|
}
|
|
208
210
|
|
|
209
211
|
//#endregion
|
|
210
|
-
export { Separator, prompt };
|
|
212
|
+
export { Separator, derivePromptConfig, isDerivedPromptConfig, prompt };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/inquirer",
|
|
3
|
-
"version": "1.3.0-dev.
|
|
3
|
+
"version": "1.3.0-dev.2420",
|
|
4
4
|
"description": "Inquirer.js prompt support for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -62,13 +62,13 @@
|
|
|
62
62
|
"sideEffects": false,
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@inquirer/prompts": "^8.3.0",
|
|
65
|
-
"@optique/core": "1.3.0-dev.
|
|
66
|
-
"@optique/prompt": "1.3.0-dev.
|
|
65
|
+
"@optique/core": "1.3.0-dev.2420+df049a85",
|
|
66
|
+
"@optique/prompt": "1.3.0-dev.2420+df049a85"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@optique/config": "1.3.0-dev.
|
|
70
|
-
"@optique/env": "1.3.0-dev.
|
|
71
|
-
"@optique/run": "1.3.0-dev.
|
|
69
|
+
"@optique/config": "1.3.0-dev.2420+df049a85",
|
|
70
|
+
"@optique/env": "1.3.0-dev.2420+df049a85",
|
|
71
|
+
"@optique/run": "1.3.0-dev.2420+df049a85",
|
|
72
72
|
"@types/node": "^24.0.0",
|
|
73
73
|
"fast-check": "^4.7.0",
|
|
74
74
|
"tsdown": "^0.13.0",
|