first commit

This commit is contained in:
2025-10-26 23:10:15 +08:00
commit 8f0345b7be
14961 changed files with 2356381 additions and 0 deletions

22
node_modules/inquirer/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) 2025 Simon Boudrias
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

565
node_modules/inquirer/README.md generated vendored Normal file
View File

@@ -0,0 +1,565 @@
<img width="75px" height="75px" align="right" alt="Inquirer Logo" src="https://raw.githubusercontent.com/SBoudrias/Inquirer.js/main/assets/inquirer_readme.svg?sanitize=true" title="Inquirer.js"/>
# Inquirer.js
[![npm](https://badge.fury.io/js/inquirer.svg)](https://www.npmjs.com/package/inquirer)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js?ref=badge_shield)
A collection of common interactive command line user interfaces.
> [!IMPORTANT]
> This is the legacy version of Inquirer.js. While it still receives maintenance, it is not actively developed. For the new Inquirer, see [@inquirer/prompts](https://www.npmjs.com/package/@inquirer/prompts).
# Special Thanks
<div align="center" markdown="1">
[![Graphite](https://github.com/user-attachments/assets/53db40ca-2254-481a-a094-6597f8716e29)](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)<br>
### [Graphite is the AI developer productivity platform helping teams on GitHub ship higher quality software, faster](https://graphite.dev/?utm_source=npmjs&utm_medium=repo&utm_campaign=inquirerjs)
</div>
## Table of Contents
1. [Documentation](#documentation)
1. [Installation](#installation)
2. [Examples](#examples)
3. [Methods](#methods)
4. [Objects](#objects)
5. [Question](#question)
6. [Answers](#answers)
7. [Separator](#separator)
8. [Prompt Types](#prompt-types)
2. [User Interfaces and Layouts](#user-interfaces-and-layouts)
1. [Reactive Interface](#reactive-interface)
3. [Support](#support)
4. [Known issues](#issues)
5. [News](#news)
6. [Contributing](#contributing)
7. [License](#license)
8. [Plugins](#plugins)
## Goal and Philosophy
**`Inquirer.js`** strives to be an easily embeddable and beautiful command line interface for [Node.js](https://nodejs.org/) (and perhaps the "CLI [Xanadu](https://en.wikipedia.org/wiki/Citizen_Kane)").
**`Inquirer.js`** should ease the process of
- providing _error feedback_
- _asking questions_
- _parsing_ input
- _validating_ answers
- managing _hierarchical prompts_
> **Note:** **`Inquirer.js`** provides the user interface and the inquiry session flow. If you're searching for a full blown command line program utility, then check out [commander](https://github.com/visionmedia/commander.js), [vorpal](https://github.com/dthree/vorpal) or [args](https://github.com/leo/args).
## [Documentation](#documentation)
<a name="documentation"></a>
### Installation
<a name="installation"></a>
<table>
<tr>
<th>npm</th>
<th>yarn</th>
</tr>
<tr>
<td>
```sh
npm install inquirer
```
</td>
<td>
```sh
yarn add inquirer
```
</td>
</tr>
</table>
```javascript
import inquirer from 'inquirer';
inquirer
.prompt([
/* Pass your questions in here */
])
.then((answers) => {
// Use user feedback for... whatever!!
})
.catch((error) => {
if (error.isTtyError) {
// Prompt couldn't be rendered in the current environment
} else {
// Something else went wrong
}
});
```
<a name="examples"></a>
### Examples (Run it and see it)
Check out the [`packages/inquirer/examples/`](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/inquirer/examples) folder for code and interface examples.
```shell
yarn node packages/inquirer/examples/pizza.js
yarn node packages/inquirer/examples/checkbox.js
# etc...
```
### Methods
<a name="methods"></a>
> [!WARNING]
> Those interfaces are not necessary for modern Javascript, while still maintained, they're depreciated. We highly encourage you to adopt the more ergonomic and modern API with [@inquirer/prompts](https://www.npmjs.com/package/@inquirer/prompts). Both `inquirer` and `@inquirer/prompts` are usable at the same time, so you can progressively migrate.
#### `inquirer.prompt(questions, answers) -> promise`
Launch the prompt interface (inquiry session)
- **questions** (Array) containing [Question Object](#question) (using the [reactive interface](#reactive-interface), you can also pass a `Rx.Observable` instance)
- **answers** (object) contains values of already answered questions. Inquirer will avoid asking answers already provided here. Defaults `{}`.
- returns a **Promise**
#### `inquirer.registerPrompt(name, prompt)`
Register prompt plugins under `name`.
- **name** (string) name of the this new prompt. (used for question `type`)
- **prompt** (object) the prompt object itself (the plugin)
#### `inquirer.createPromptModule() -> prompt function`
Create a self contained inquirer module. If you don't want to affect other libraries that also rely on inquirer when you overwrite or add new prompt types.
```js
const prompt = inquirer.createPromptModule();
prompt(questions).then(/* ... */);
```
### Objects
<a name="objects"></a>
#### Question
<a name="questions"></a>
A question object is a `hash` containing question related values:
- **type**: (String) Type of the prompt. Defaults: `input` - Possible values: `input`, `number`, `confirm`, `list`, `rawlist`, `expand`, `checkbox`, `password`, `editor`
- **name**: (String) The name to use when storing the answer in the answers hash. If the name contains periods, it will define a path in the answers hash.
- **message**: (String|Function) The question to print. If defined as a function, the first parameter will be the current inquirer session answers. Defaults to the value of `name` (followed by a colon).
- **default**: (String|Number|Boolean|Array|Function) Default value(s) to use if nothing is entered, or a function that returns the default value(s). If defined as a function, the first parameter will be the current inquirer session answers.
- **choices**: (Array|Function) Choices array or a function returning a choices array. If defined as a function, the first parameter will be the current inquirer session answers.
Array values can be simple `numbers`, `strings`, or `objects` containing a `name` (to display in list), a `value` (to save in the answers hash), and a `short` (to display after selection) properties. The choices array can also contain [a `Separator`](#separator).
- **validate**: (Function) Receive the user input and answers hash. Should return `true` if the value is valid, and an error message (`String`) otherwise. If `false` is returned, a default error message is provided.
- **filter**: (Function) Receive the user input and answers hash. Returns the filtered value to be used inside the program. The value returned will be added to the _Answers_ hash.
- **transformer**: (Function) Receive the user input, answers hash and option flags, and return a transformed value to display to the user. The transformation only impacts what is shown while editing. It does not modify the answers hash.
- **when**: (Function, Boolean) Receive the current user answers hash and should return `true` or `false` depending on whether or not this question should be asked. The value can also be a simple boolean.
- **pageSize**: (Number) Change the number of lines that will be rendered when using `list`, `rawList`, `expand` or `checkbox`.
- **prefix**: (String) Change the default _prefix_ message.
- **suffix**: (String) Change the default _suffix_ message.
- **askAnswered**: (Boolean) Force to prompt the question if the answer already exists.
- **loop**: (Boolean) Enable list looping. Defaults: `true`
- **waitUserInput**: (Boolean) Flag to enable/disable wait for user input before opening system editor - Defaults: `true`
`default`, `choices`(if defined as functions), `validate`, `filter` and `when` functions can be called asynchronously. Either return a promise or use `this.async()` to get a callback you'll call with the final value.
```javascript
{
/* Preferred way: with promise */
filter() {
return new Promise(/* etc... */);
},
/* Legacy way: with this.async */
validate: function (input) {
// Declare function as asynchronous, and save the done callback
const done = this.async();
// Do async stuff
setTimeout(function() {
if (typeof input !== 'number') {
// Pass the return value in the done callback
done('You need to provide a number');
} else {
// Pass the return value in the done callback
done(null, true);
}
}, 3000);
}
}
```
### Answers
<a name="answers"></a>
A key/value hash containing the client answers in each prompt.
- **Key** The `name` property of the _question_ object
- **Value** (Depends on the prompt)
- `confirm`: (Boolean)
- `input` : User input (filtered if `filter` is defined) (String)
- `number`: User input (filtered if `filter` is defined) (Number)
- `rawlist`, `list` : Selected choice value (or name if no value specified) (String)
### Separator
<a name="separator"></a>
A separator can be added to any `choices` array:
```
// In the question object
choices: [ "Choice A", new inquirer.Separator(), "choice B" ]
// Which'll be displayed this way
[?] What do you want to do?
> Order a pizza
Make a reservation
--------
Ask opening hours
Talk to the receptionist
```
The constructor takes a facultative `String` value that'll be use as the separator. If omitted, the separator will be `--------`.
Separator instances have a property `type` equal to `separator`. This should allow tools façading Inquirer interface from detecting separator types in lists.
<a name="prompt"></a>
### Prompt types
---
> **Note:**: _allowed options written inside square brackets (`[]`) are optional. Others are required._
#### List - `{type: 'list'}`
Take `type`, `name`, `message`, `choices`[, `default`, `filter`, `loop`] properties.
(Note: `default` must be set to the `index` or `value` of one of the entries in `choices`)
![List prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/list.svg)
---
#### Raw List - `{type: 'rawlist'}`
Take `type`, `name`, `message`, `choices`[, `default`, `filter`, `loop`] properties.
(Note: `default` must be set to the `index` of one of the entries in `choices`)
![Raw list prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/rawlist.svg)
---
#### Expand - `{type: 'expand'}`
Take `type`, `name`, `message`, `choices`[, `default`] properties.
Note: `default` must be the `index` of the desired default selection of the array. If `default` key not provided, then `help` will be used as default choice
Note that the `choices` object will take an extra parameter called `key` for the `expand` prompt. This parameter must be a single (lowercased) character. The `h` option is added by the prompt and shouldn't be defined by the user.
See `examples/expand.js` for a running example.
![Expand prompt closed](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/expand-y.svg)
![Expand prompt expanded](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/expand-d.svg)
---
#### Checkbox - `{type: 'checkbox'}`
Take `type`, `name`, `message`, `choices`[, `filter`, `validate`, `default`, `loop`] properties. `default` is expected to be an Array of the checked choices value.
Choices marked as `{checked: true}` will be checked by default.
Choices whose property `disabled` is truthy will be unselectable. If `disabled` is a string, then the string will be outputted next to the disabled choice, otherwise it'll default to `"Disabled"`. The `disabled` property can also be a synchronous function receiving the current answers as argument and returning a boolean or a string.
![Checkbox prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/checkbox.svg)
---
#### Confirm - `{type: 'confirm'}`
Take `type`, `name`, `message`, [`default`, `transformer`] properties. `default` is expected to be a boolean if used.
![Confirm prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/confirm.svg)
---
#### Input - `{type: 'input'}`
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `transformer`] properties.
![Input prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/input.svg)
---
#### Input - `{type: 'number'}`
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `transformer`] properties.
---
#### Password - `{type: 'password'}`
Take `type`, `name`, `message`, `mask`,[, `default`, `filter`, `validate`] properties.
![Password prompt](https://cdn.rawgit.com/SBoudrias/Inquirer.js/28ae8337ba51d93e359ef4f7ee24e79b69898962/assets/screenshots/password.svg)
---
Note that `mask` is required to hide the actual user input.
#### Editor - `{type: 'editor'}`
Take `type`, `name`, `message`[, `default`, `filter`, `validate`, `postfix`, `waitUserInput`] properties
Launches an instance of the users preferred editor on a temporary file. Once the user exits their editor, the contents of the temporary file are read in as the result. The editor to use is determined by reading the $VISUAL or $EDITOR environment variables. If neither of those are present, notepad (on Windows) or vim (Linux or Mac) is used.
The `postfix` property is useful if you want to provide an extension.
<a name="layouts"></a>
### Use in Non-Interactive Environments
`prompt()` requires that it is run in an interactive environment. (I.e. [One where `process.stdin.isTTY` is `true`](https://nodejs.org/docs/latest-v12.x/api/process.html#process_a_note_on_process_i_o)). If `prompt()` is invoked outside of such an environment, then `prompt()` will return a rejected promise with an error. For convenience, the error will have a `isTtyError` property to programmatically indicate the cause.
<a name="reactive"></a>
## Reactive interface
Internally, Inquirer uses the [JS reactive extension](https://github.com/ReactiveX/rxjs) to handle events and async flows.
This mean you can take advantage of this feature to provide more advanced flows. For example, you can dynamically add questions to be asked:
```js
const prompts = new Rx.Subject();
inquirer.prompt(prompts);
// At some point in the future, push new questions
prompts.next({
/* question... */
});
prompts.next({
/* question... */
});
// When you're done
prompts.complete();
```
And using the return value `process` property, you can access more fine grained callbacks:
```js
inquirer.prompt(prompts).ui.process.subscribe(onEachAnswer, onError, onComplete);
```
## Support (OS Terminals)
<a name="support"></a>
You should expect mostly good support for the CLI below. This does not mean we won't
look at issues found on other command line - feel free to report any!
- **Mac OS**:
- Terminal.app
- iTerm
- **Windows ([Known issues](#issues))**:
- [Windows Terminal](https://github.com/microsoft/terminal)
- [ConEmu](https://conemu.github.io/)
- cmd.exe
- Powershell
- Cygwin
- **Linux (Ubuntu, openSUSE, Arch Linux, etc)**:
- gnome-terminal (Terminal GNOME)
- konsole
## Known issues
<a name="issues"></a>
- **nodemon** - Makes the arrow keys print gibrish on list prompts.
Workaround: Add `{ stdin : false }` in the configuration file or pass `--no-stdin` in the CLI.
Please refer to [this issue](https://github.com/SBoudrias/Inquirer.js/issues/844#issuecomment-736675867)
- **grunt-exec** - Calling a node script that uses Inquirer from grunt-exec can cause the program to crash. To fix this, add to your grunt-exec config `stdio: 'inherit'`.
Please refer to [this issue](https://github.com/jharding/grunt-exec/issues/85)
- **Windows network streams** - Running Inquirer together with network streams in Windows platform inside some terminals can result in process hang.
Workaround: run inside another terminal.
Please refer to [this issue](https://github.com/nodejs/node/issues/21771)
## News on the march (Release notes)
<a name="news"></a>
Please refer to the [GitHub releases section for the changelog](https://github.com/SBoudrias/Inquirer.js/releases)
## Contributing
<a name="contributing"></a>
**Unit test**
Please add a unit test for every new feature or bug fix. `yarn test` to run the test suite.
**Documentation**
Add documentation for every API change. Feel free to send typo fixes and better docs!
We're looking to offer good support for multiple prompts and environments. If you want to
help, we'd like to keep a list of testers for each terminal/OS so we can contact you and
get feedback before release. Let us know if you want to be added to the list (just tweet
to [@vaxilart](https://twitter.com/Vaxilart)) or just add your name to [the wiki](https://github.com/SBoudrias/Inquirer.js/wiki/Testers)
## License
<a name="license"></a>
Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
Licensed under the MIT license.
## Plugins
<a name="plugins"></a>
You can build custom prompts, or use open sourced ones. See [`@inquirer/core` documentation for building custom prompts](https://github.com/SBoudrias/Inquirer.js/tree/main/packages/core).
You can either call the custom prompts directly (preferred), or you can register them (depreciated):
```js
import customPrompt from '$$$/custom-prompt';
// 1. Preferred solution with new plugins
const answer = await customPrompt({ ...config });
// 2. Depreciated interface (or for old plugins)
inquirer.registerPrompt('custom', customPrompt);
const answers = await inquirer.prompt([
{
type: 'custom',
...config,
},
]);
```
When using Typescript and `registerPrompt`, you'll also need to define your prompt signature. Since Typescript is static, we cannot infer available plugins from function calls.
```ts
import customPrompt from '$$$/custom-prompt';
declare module 'inquirer' {
interface QuestionMap {
// 1. Easiest option
custom: Parameters<typeof customPrompt>[0];
// 2. Or manually define the prompt config
custom_alt: { message: string; option: number[] };
}
}
```
### Prompts
[**autocomplete**](https://github.com/mokkabonna/inquirer-autocomplete-prompt)<br>
Presents a list of options as the user types, compatible with other packages such as fuzzy (for search)<br>
<br>
![autocomplete prompt](https://raw.githubusercontent.com/mokkabonna/inquirer-autocomplete-prompt/master/packages/inquirer-autocomplete-prompt/inquirer.gif)
[**checkbox-plus**](https://github.com/faressoft/inquirer-checkbox-plus-prompt)<br>
Checkbox list with autocomplete and other additions<br>
<br>
![checkbox-plus](https://github.com/faressoft/inquirer-checkbox-plus-prompt/raw/master/demo.gif)
[**inquirer-date-prompt**](https://github.com/haversnail/inquirer-date-prompt)<br>
Customizable date/time selector with localization support<br>
<br>
![Date Prompt](https://github.com/haversnail/inquirer-date-prompt/raw/master/examples/demo.gif)
[**datetime**](https://github.com/DerekTBrown/inquirer-datepicker-prompt)<br>
Customizable date/time selector using both number pad and arrow keys<br>
<br>
![Datetime Prompt](https://github.com/DerekTBrown/inquirer-datepicker-prompt/raw/master/example/datetime-prompt.png)
[**inquirer-select-line**](https://github.com/adam-golab/inquirer-select-line)<br>
Prompt for selecting index in array where add new element<br>
<br>
![inquirer-select-line gif](https://media.giphy.com/media/xUA7b1MxpngddUvdHW/giphy.gif)
[**command**](https://github.com/sullof/inquirer-command-prompt)<br>
Simple prompt with command history and dynamic autocomplete<br>
[**inquirer-fuzzy-path**](https://github.com/adelsz/inquirer-fuzzy-path)<br>
Prompt for fuzzy file/directory selection.<br>
<br>
![inquirer-fuzzy-path](https://raw.githubusercontent.com/adelsz/inquirer-fuzzy-path/master/recording.gif)
[**inquirer-emoji**](https://github.com/tannerntannern/inquirer-emoji)<br>
Prompt for inputting emojis.<br>
<br>
![inquirer-emoji](https://github.com/tannerntannern/inquirer-emoji/raw/master/demo.gif)
[**inquirer-chalk-pipe**](https://github.com/LitoMore/inquirer-chalk-pipe)<br>
Prompt for input chalk-pipe style strings<br>
<br>
![inquirer-chalk-pipe](https://github.com/LitoMore/inquirer-chalk-pipe/blob/main/screenshot.gif)
[**inquirer-search-checkbox**](https://github.com/clinyong/inquirer-search-checkbox)<br>
Searchable Inquirer checkbox<br>
![inquirer-search-checkbox](https://github.com/clinyong/inquirer-search-checkbox/blob/master/screenshot.png)
[**inquirer-search-list**](https://github.com/robin-rpr/inquirer-search-list)<br>
Searchable Inquirer list<br>
<br>
![inquirer-search-list](https://github.com/robin-rpr/inquirer-search-list/blob/master/preview.gif)
[**inquirer-prompt-suggest**](https://github.com/olistic/inquirer-prompt-suggest)<br>
Inquirer prompt for your less creative users.<br>
<br>
![inquirer-prompt-suggest](https://user-images.githubusercontent.com/5600126/40391192-d4f3d6d0-5ded-11e8-932f-4b75b642c09e.gif)
[**inquirer-s3**](https://github.com/HQarroum/inquirer-s3)<br>
An S3 object selector for Inquirer.<br>
<br>
![inquirer-s3](https://github.com/HQarroum/inquirer-s3/raw/master/docs/inquirer-screenshot.png)
[**inquirer-autosubmit-prompt**](https://github.com/yaodingyd/inquirer-autosubmit-prompt)<br>
Auto submit based on your current input, saving one extra enter<br>
[**inquirer-file-tree-selection-prompt**](https://github.com/anc95/inquirer-file-tree-selection)<br>
Inquirer prompt for to select a file or directory in file tree<br>
<br>
![inquirer-file-tree-selection-prompt](https://github.com/anc95/inquirer-file-tree-selection/blob/master/example/screenshot.gif)
[**inquirer-tree-prompt**](https://github.com/insightfuls/inquirer-tree-prompt)<br>
Inquirer prompt to select from a tree<br>
<br>
![inquirer-tree-prompt](https://github.com/insightfuls/inquirer-tree-prompt/blob/main/example/screenshot.gif)
[**inquirer-table-prompt**](https://github.com/eduardoboucas/inquirer-table-prompt)<br>
A table-like prompt for Inquirer.<br>
<br>
![inquirer-table-prompt](https://raw.githubusercontent.com/eduardoboucas/inquirer-table-prompt/master/screen-capture.gif)
[**inquirer-table-input**](https://github.com/edelciomolina/inquirer-table-input)<br>
A table editing prompt for Inquirer.<br>
<br>
![inquirer-table-prompt](https://raw.githubusercontent.com/edelciomolina/inquirer-table-input/master/screen-capture.gif)
[**inquirer-interrupted-prompt**](https://github.com/lnquy065/inquirer-interrupted-prompt)<br>
Turning any existing inquirer and its plugin prompts into prompts that can be interrupted with a custom key.<br>
<br>
![inquirer-interrupted-prompt](https://raw.githubusercontent.com/lnquy065/inquirer-interrupted-prompt/master/example/demo-menu.gif)
[**inquirer-press-to-continue**](https://github.com/leonzalion/inquirer-press-to-continue)<br>
A "press any key to continue" prompt for Inquirer.js<br>
<br>
![inquirer-press-to-continue](https://raw.githubusercontent.com/leonzalion/inquirer-press-to-continue/main/assets/demo.gif)

63
node_modules/inquirer/dist/commonjs/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,63 @@
/**
* Inquirer.js
* A collection of common interactive command line user interfaces.
*/
import { Separator } from '@inquirer/prompts';
import type { Prettify } from '@inquirer/type';
import PromptsRunner from './ui/prompt.ts';
import type { LegacyPromptConstructor, PromptFn } from './ui/prompt.ts';
import type { Answers, CustomQuestion, UnnamedDistinctQuestion, StreamOptions } from './types.ts';
import { Observable } from 'rxjs';
export type { QuestionMap, Question, DistinctQuestion, Answers, PromptSession, } from './types.ts';
type PromptReturnType<T> = Promise<Prettify<T>> & {
ui: PromptsRunner<Prettify<T>>;
};
/**
* Create a new self-contained prompt module.
*/
export declare function createPromptModule<Prompts extends Record<string, Record<string, unknown>> = never>(opt?: StreamOptions): {
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: ((UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>) & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
})[], answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>; }, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & Answers<Extract<keyof A, string>>>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<(UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>) & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
}>, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<A & PrefilledAnswers> | CustomQuestion<A & PrefilledAnswers, Prompts>) & {
name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
}, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
prompts: {
[x: string]: LegacyPromptConstructor | PromptFn<any, any>;
};
registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): /*elided*/ any;
restoreDefaultPrompts(): void;
};
declare function registerPrompt(name: string, newPrompt: LegacyPromptConstructor): void;
declare function restoreDefaultPrompts(): void;
declare const inquirer: {
prompt: {
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
})[], answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never>; }, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & Answers<Extract<keyof A, string>> extends infer T ? { [K in keyof T]: T[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
}>, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: UnnamedDistinctQuestion<A & PrefilledAnswers> & {
name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
}, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A>;
prompts: {
[x: string]: LegacyPromptConstructor | PromptFn<any, any>;
};
registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): /*elided*/ any;
restoreDefaultPrompts(): void;
};
ui: {
Prompt: typeof PromptsRunner;
};
createPromptModule: typeof createPromptModule;
registerPrompt: typeof registerPrompt;
restoreDefaultPrompts: typeof restoreDefaultPrompts;
Separator: typeof Separator;
};
export default inquirer;

73
node_modules/inquirer/dist/commonjs/index.js generated vendored Normal file
View File

@@ -0,0 +1,73 @@
"use strict";
/**
* Inquirer.js
* A collection of common interactive command line user interfaces.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createPromptModule = createPromptModule;
const prompts_1 = require("@inquirer/prompts");
const prompt_ts_1 = __importDefault(require("./ui/prompt.js"));
const builtInPrompts = {
input: prompts_1.input,
select: prompts_1.select,
/** @deprecated `list` is now named `select` */
list: prompts_1.select,
number: prompts_1.number,
confirm: prompts_1.confirm,
rawlist: prompts_1.rawlist,
expand: prompts_1.expand,
checkbox: prompts_1.checkbox,
password: prompts_1.password,
editor: prompts_1.editor,
search: prompts_1.search,
};
/**
* Create a new self-contained prompt module.
*/
function createPromptModule(opt) {
function promptModule(questions, answers) {
const runner = new prompt_ts_1.default(promptModule.prompts, opt);
const promptPromise = runner.run(questions, answers);
return Object.assign(promptPromise, { ui: runner });
}
promptModule.prompts = { ...builtInPrompts };
/**
* Register a prompt type
*/
promptModule.registerPrompt = function (name, prompt) {
promptModule.prompts[name] = prompt;
return this;
};
/**
* Register the defaults provider prompts
*/
promptModule.restoreDefaultPrompts = function () {
promptModule.prompts = { ...builtInPrompts };
};
return promptModule;
}
/**
* Public CLI helper interface
*/
const prompt = createPromptModule();
// Expose helper functions on the top level for easiest usage by common users
function registerPrompt(name, newPrompt) {
prompt.registerPrompt(name, newPrompt);
}
function restoreDefaultPrompts() {
prompt.restoreDefaultPrompts();
}
const inquirer = {
prompt,
ui: {
Prompt: prompt_ts_1.default,
},
createPromptModule,
registerPrompt,
restoreDefaultPrompts,
Separator: prompts_1.Separator,
};
exports.default = inquirer;

3
node_modules/inquirer/dist/commonjs/package.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "commonjs"
}

61
node_modules/inquirer/dist/commonjs/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
import { checkbox, confirm, editor, expand, input, number, password, rawlist, search, select } from '@inquirer/prompts';
import type { Context, DistributiveMerge, Prettify } from '@inquirer/type';
import { Observable } from 'rxjs';
export type Answers<Key extends string = string> = Record<Key, any>;
type AsyncCallbackFunction<R> = (...args: [error: null | undefined, value: R] | [error: Error, value: undefined]) => void;
export type AsyncGetterFunction<R, A extends Answers> = (this: {
async: () => AsyncCallbackFunction<R>;
}, answers: Prettify<Partial<A>>) => void | R | Promise<R>;
/**
* Allows to inject a custom question type into inquirer module.
*
* @example
* ```ts
* declare module 'inquirer' {
* interface QuestionMap {
* custom: { message: string };
* }
* }
* ```
*
* Globally defined question types are not correct.
*/
export interface QuestionMap {
__dummy: {
message: string;
};
}
type KeyValueOrAsyncGetterFunction<T, k extends string, A extends Answers> = T extends Record<string, any> ? T[k] | AsyncGetterFunction<T[k], A> : never;
export type Question<A extends Answers = Answers, Type extends string = string> = {
type: Type;
name: string;
message: string | AsyncGetterFunction<string, A>;
default?: any;
choices?: any;
filter?: (answer: any, answers: Partial<A>) => any;
askAnswered?: boolean;
when?: boolean | AsyncGetterFunction<boolean, A>;
};
type QuestionWithGetters<Type extends string, Q extends Record<string, any>, A extends Answers> = DistributiveMerge<Q, {
type: Type;
askAnswered?: boolean;
when?: boolean | AsyncGetterFunction<boolean, A>;
filter?(input: any, answers: A): any;
message: KeyValueOrAsyncGetterFunction<Q, 'message', A>;
default?: KeyValueOrAsyncGetterFunction<Q, 'default', A>;
choices?: KeyValueOrAsyncGetterFunction<Q, 'choices', A>;
}>;
export type UnnamedDistinctQuestion<A extends Answers = object> = QuestionWithGetters<'checkbox', Parameters<typeof checkbox>[0] & {
default: unknown[];
}, A> | QuestionWithGetters<'confirm', Parameters<typeof confirm>[0], A> | QuestionWithGetters<'editor', Parameters<typeof editor>[0], A> | QuestionWithGetters<'expand', Parameters<typeof expand>[0], A> | QuestionWithGetters<'input', Parameters<typeof input>[0], A> | QuestionWithGetters<'number', Parameters<typeof number>[0], A> | QuestionWithGetters<'password', Parameters<typeof password>[0], A> | QuestionWithGetters<'rawlist', Parameters<typeof rawlist>[0], A> | QuestionWithGetters<'search', Parameters<typeof search>[0], A> | QuestionWithGetters<'list', Parameters<typeof select>[0], A> | QuestionWithGetters<'select', Parameters<typeof select>[0], A>;
export type DistinctQuestion<A extends Answers = Answers> = Prettify<UnnamedDistinctQuestion<A> & {
name: Extract<keyof A, string>;
}>;
export type CustomQuestion<A extends Answers, Q extends Record<string, Record<string, any>>> = {
[key in Extract<keyof Q, string>]: Readonly<QuestionWithGetters<key, Q[key], A>>;
}[Extract<keyof Q, string>];
export type PromptSession<A extends Answers = Answers, Q extends Question<A> = Question<A>> = Q[] | Record<string, Omit<Q, 'name'>> | Observable<Q> | Q;
export type StreamOptions = Prettify<Context & {
skipTTYChecks?: boolean;
}>;
export {};

2
node_modules/inquirer/dist/commonjs/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });

60
node_modules/inquirer/dist/commonjs/ui/prompt.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import { Observable } from 'rxjs';
import type { InquirerReadline } from '@inquirer/type';
import type { Answers, PromptSession, StreamOptions } from '../types.ts';
export declare const _: {
set: (obj: Record<string, unknown>, path: string | undefined, value: unknown) => void;
get: (obj: object, path?: string | number | symbol, defaultValue?: unknown) => any;
};
export interface PromptBase {
/**
* Runs the prompt.
*
* @returns
* The result of the prompt.
*/
run(): Promise<any>;
}
/**
* Provides the functionality to initialize new prompts.
*/
export interface LegacyPromptConstructor {
/**
* Initializes a new instance of a prompt.
*
* @param question
* The question to prompt.
*
* @param readLine
* An object for reading from the command-line.
*
* @param answers
* The answers provided by the user.
*/
new (question: any, readLine: InquirerReadline, answers: Record<string, any>): PromptBase;
}
export type PromptFn<Value = any, Config = any> = (config: Config, context: StreamOptions & {
signal: AbortSignal;
}) => Promise<Value>;
/**
* Provides a set of prompt-constructors.
*/
export type PromptCollection = Record<string, PromptFn | LegacyPromptConstructor>;
/**
* Base interface class other can inherits from
*/
export default class PromptsRunner<A extends Answers> {
private prompts;
answers: Partial<A>;
process: Observable<any>;
private abortController;
private opt;
constructor(prompts: PromptCollection, opt?: StreamOptions);
run(questions: PromptSession<A>, answers?: Partial<A>): Promise<A>;
private prepareQuestion;
private fetchAnswer;
/**
* Close the interface and cleanup listeners
*/
close: () => void;
private shouldRun;
}

270
node_modules/inquirer/dist/commonjs/ui/prompt.js generated vendored Normal file
View File

@@ -0,0 +1,270 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports._ = void 0;
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
const node_readline_1 = __importDefault(require("node:readline"));
const rxjs_1 = require("rxjs");
const run_async_1 = __importDefault(require("run-async"));
const mute_stream_1 = __importDefault(require("mute-stream"));
const core_1 = require("@inquirer/core");
const ansi_1 = require("@inquirer/ansi");
exports._ = {
set: (obj, path = '', value) => {
let pointer = obj;
path.split('.').forEach((key, index, arr) => {
if (key === '__proto__' || key === 'constructor')
return;
if (index === arr.length - 1) {
pointer[key] = value;
}
else if (!(key in pointer) || typeof pointer[key] !== 'object') {
pointer[key] = {};
}
pointer = pointer[key];
});
},
get: (obj, path = '', defaultValue) => {
const travel = (regexp) => String.prototype.split
.call(path, regexp)
.filter(Boolean)
.reduce(
// @ts-expect-error implicit any on res[key]
(res, key) => (res == null ? res : res[key]), obj);
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
return result === undefined || result === obj ? defaultValue : result;
},
};
/**
* Resolve a question property value if it is passed as a function.
* This method will overwrite the property on the question object with the received value.
*/
async function fetchAsyncQuestionProperty(question, prop, answers) {
const propGetter = question[prop];
if (typeof propGetter === 'function') {
return (0, run_async_1.default)(propGetter)(answers);
}
return propGetter;
}
class TTYError extends Error {
name = 'TTYError';
isTtyError = true;
}
function setupReadlineOptions(opt) {
// Inquirer 8.x:
// opt.skipTTYChecks = opt.skipTTYChecks === undefined ? opt.input !== undefined : opt.skipTTYChecks;
opt.skipTTYChecks = opt.skipTTYChecks === undefined ? true : opt.skipTTYChecks;
// Default `input` to stdin
const input = opt.input || process.stdin;
// Check if prompt is being called in TTY environment
// If it isn't return a failed promise
// @ts-expect-error: ignore isTTY type error
if (!opt.skipTTYChecks && !input.isTTY) {
throw new TTYError('Prompts can not be meaningfully rendered in non-TTY environments');
}
// Add mute capabilities to the output
const ms = new mute_stream_1.default();
ms.pipe(opt.output || process.stdout);
const output = ms;
return {
terminal: true,
...opt,
input,
output,
};
}
function isQuestionArray(questions) {
return Array.isArray(questions);
}
function isQuestionMap(questions) {
return Object.values(questions).every((maybeQuestion) => typeof maybeQuestion === 'object' &&
!Array.isArray(maybeQuestion) &&
maybeQuestion != null);
}
function isPromptConstructor(prompt) {
return Boolean(prompt.prototype &&
'run' in prompt.prototype &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
typeof prompt.prototype.run === 'function');
}
/**
* Base interface class other can inherits from
*/
class PromptsRunner {
prompts;
answers = {};
process = rxjs_1.EMPTY;
abortController = new AbortController();
opt;
constructor(prompts, opt = {}) {
this.opt = opt;
this.prompts = prompts;
}
async run(questions, answers) {
this.abortController = new AbortController();
// Keep global reference to the answers
this.answers = typeof answers === 'object' ? { ...answers } : {};
let obs;
if (isQuestionArray(questions)) {
obs = (0, rxjs_1.from)(questions);
}
else if ((0, rxjs_1.isObservable)(questions)) {
obs = questions;
}
else if (isQuestionMap(questions)) {
// Case: Called with a set of { name: question }
obs = (0, rxjs_1.from)(Object.entries(questions).map(([name, question]) => {
return Object.assign({}, question, { name });
}));
}
else {
// Case: Called with a single question config
obs = (0, rxjs_1.from)([questions]);
}
this.process = obs.pipe((0, rxjs_1.concatMap)((question) => (0, rxjs_1.of)(question).pipe((0, rxjs_1.concatMap)((question) => (0, rxjs_1.from)(this.shouldRun(question).then((shouldRun) => {
if (shouldRun) {
return question;
}
return;
})).pipe((0, rxjs_1.filter)((val) => val != null))), (0, rxjs_1.concatMap)((question) => (0, rxjs_1.defer)(() => (0, rxjs_1.from)(this.fetchAnswer(question)))))));
return (0, rxjs_1.lastValueFrom)(this.process.pipe((0, rxjs_1.reduce)((answersObj, answer) => {
exports._.set(answersObj, answer.name, answer.answer);
return answersObj;
}, this.answers)))
.then(() => this.answers)
.finally(() => this.close());
}
prepareQuestion = async (question) => {
const [message, defaultValue, resolvedChoices] = await Promise.all([
fetchAsyncQuestionProperty(question, 'message', this.answers),
fetchAsyncQuestionProperty(question, 'default', this.answers),
fetchAsyncQuestionProperty(question, 'choices', this.answers),
]);
let choices;
if (Array.isArray(resolvedChoices)) {
choices = resolvedChoices.map((choice) => {
const choiceObj = typeof choice !== 'object' || choice == null
? { name: choice, value: choice }
: {
...choice,
value: 'value' in choice
? choice.value
: 'name' in choice
? choice.name
: undefined,
};
if ('value' in choiceObj && Array.isArray(defaultValue)) {
// Add checked to question for backward compatibility. default was supported as alternative of per choice checked.
return {
checked: defaultValue.includes(choiceObj.value),
...choiceObj,
};
}
return choiceObj;
});
}
return Object.assign({}, question, {
message,
default: defaultValue,
choices,
type: question.type in this.prompts ? question.type : 'input',
});
};
fetchAnswer = async (rawQuestion) => {
const question = await this.prepareQuestion(rawQuestion);
const prompt = this.prompts[question.type];
if (prompt == null) {
throw new Error(`Prompt for type ${question.type} not found`);
}
let cleanupSignal;
const promptFn = isPromptConstructor(prompt)
? (q, opt) => new Promise((resolve, reject) => {
const { signal } = opt;
if (signal.aborted) {
reject(new core_1.AbortPromptError({ cause: signal.reason }));
return;
}
const rl = node_readline_1.default.createInterface(setupReadlineOptions(opt));
/**
* Handle the ^C exit
*/
const onForceClose = () => {
this.close();
process.kill(process.pid, 'SIGINT');
console.log('');
};
const onClose = () => {
process.removeListener('exit', onForceClose);
rl.removeListener('SIGINT', onForceClose);
rl.setPrompt('');
rl.output.unmute();
rl.output.write(ansi_1.cursorShow);
rl.output.end();
rl.close();
};
// Make sure new prompt start on a newline when closing
process.on('exit', onForceClose);
rl.on('SIGINT', onForceClose);
const activePrompt = new prompt(q, rl, this.answers);
const cleanup = () => {
onClose();
cleanupSignal?.();
};
const abort = () => {
reject(new core_1.AbortPromptError({ cause: signal.reason }));
cleanup();
};
signal.addEventListener('abort', abort);
cleanupSignal = () => {
signal.removeEventListener('abort', abort);
cleanupSignal = undefined;
};
activePrompt.run().then(resolve, reject).finally(cleanup);
})
: prompt;
let cleanupModuleSignal;
const { signal: moduleSignal } = this.opt;
if (moduleSignal?.aborted) {
this.abortController.abort(moduleSignal.reason);
}
else if (moduleSignal) {
const abort = () => this.abortController.abort(moduleSignal.reason);
moduleSignal.addEventListener('abort', abort);
cleanupModuleSignal = () => {
moduleSignal.removeEventListener('abort', abort);
};
}
const { filter = (value) => value } = question;
const { signal } = this.abortController;
return promptFn(question, { ...this.opt, signal })
.then((answer) => ({
name: question.name,
answer: filter(answer, this.answers),
}))
.finally(() => {
cleanupSignal?.();
cleanupModuleSignal?.();
});
};
/**
* Close the interface and cleanup listeners
*/
close = () => {
this.abortController.abort();
};
shouldRun = async (question) => {
if (question.askAnswered !== true &&
exports._.get(this.answers, question.name) !== undefined) {
return false;
}
const { when } = question;
if (typeof when === 'function') {
const shouldRun = await (0, run_async_1.default)(when)(this.answers);
return Boolean(shouldRun);
}
return when !== false;
};
}
exports.default = PromptsRunner;

63
node_modules/inquirer/dist/esm/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,63 @@
/**
* Inquirer.js
* A collection of common interactive command line user interfaces.
*/
import { Separator } from '@inquirer/prompts';
import type { Prettify } from '@inquirer/type';
import PromptsRunner from './ui/prompt.ts';
import type { LegacyPromptConstructor, PromptFn } from './ui/prompt.ts';
import type { Answers, CustomQuestion, UnnamedDistinctQuestion, StreamOptions } from './types.ts';
import { Observable } from 'rxjs';
export type { QuestionMap, Question, DistinctQuestion, Answers, PromptSession, } from './types.ts';
type PromptReturnType<T> = Promise<Prettify<T>> & {
ui: PromptsRunner<Prettify<T>>;
};
/**
* Create a new self-contained prompt module.
*/
export declare function createPromptModule<Prompts extends Record<string, Record<string, unknown>> = never>(opt?: StreamOptions): {
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: ((UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>) & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
})[], answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>; }, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & Answers<Extract<keyof A, string>>>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<(UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> | CustomQuestion<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never, Prompts>) & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
}>, answers?: PrefilledAnswers): PromptReturnType<Prettify<PrefilledAnswers & A>>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<A & PrefilledAnswers> | CustomQuestion<A & PrefilledAnswers, Prompts>) & {
name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
}, answers?: PrefilledAnswers): PromptReturnType<PrefilledAnswers & A>;
prompts: {
[x: string]: LegacyPromptConstructor | PromptFn<any, any>;
};
registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): /*elided*/ any;
restoreDefaultPrompts(): void;
};
declare function registerPrompt(name: string, newPrompt: LegacyPromptConstructor): void;
declare function restoreDefaultPrompts(): void;
declare const inquirer: {
prompt: {
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: (UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
})[], answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: { [name in keyof A]: UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never>; }, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & Answers<Extract<keyof A, string>> extends infer T ? { [K in keyof T]: T[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: Observable<UnnamedDistinctQuestion<PrefilledAnswers & A extends infer T ? { [K in keyof T]: T[K]; } : never> & {
name: Extract<keyof PrefilledAnswers, string> | Extract<keyof A, string>;
}>, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A extends infer T_1 ? { [K in keyof T_1]: T_1[K]; } : never>;
<const A extends Answers, PrefilledAnswers extends Answers = object>(questions: UnnamedDistinctQuestion<A & PrefilledAnswers> & {
name: Extract<keyof A, string> | Extract<keyof PrefilledAnswers, string>;
}, answers?: PrefilledAnswers | undefined): PromptReturnType<PrefilledAnswers & A>;
prompts: {
[x: string]: LegacyPromptConstructor | PromptFn<any, any>;
};
registerPrompt(name: string, prompt: LegacyPromptConstructor | PromptFn): /*elided*/ any;
restoreDefaultPrompts(): void;
};
ui: {
Prompt: typeof PromptsRunner;
};
createPromptModule: typeof createPromptModule;
registerPrompt: typeof registerPrompt;
restoreDefaultPrompts: typeof restoreDefaultPrompts;
Separator: typeof Separator;
};
export default inquirer;

67
node_modules/inquirer/dist/esm/index.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
/**
* Inquirer.js
* A collection of common interactive command line user interfaces.
*/
import { input, select, number, confirm, rawlist, expand, checkbox, password, editor, search, Separator, } from '@inquirer/prompts';
import PromptsRunner from "./ui/prompt.js";
const builtInPrompts = {
input,
select,
/** @deprecated `list` is now named `select` */
list: select,
number,
confirm,
rawlist,
expand,
checkbox,
password,
editor,
search,
};
/**
* Create a new self-contained prompt module.
*/
export function createPromptModule(opt) {
function promptModule(questions, answers) {
const runner = new PromptsRunner(promptModule.prompts, opt);
const promptPromise = runner.run(questions, answers);
return Object.assign(promptPromise, { ui: runner });
}
promptModule.prompts = { ...builtInPrompts };
/**
* Register a prompt type
*/
promptModule.registerPrompt = function (name, prompt) {
promptModule.prompts[name] = prompt;
return this;
};
/**
* Register the defaults provider prompts
*/
promptModule.restoreDefaultPrompts = function () {
promptModule.prompts = { ...builtInPrompts };
};
return promptModule;
}
/**
* Public CLI helper interface
*/
const prompt = createPromptModule();
// Expose helper functions on the top level for easiest usage by common users
function registerPrompt(name, newPrompt) {
prompt.registerPrompt(name, newPrompt);
}
function restoreDefaultPrompts() {
prompt.restoreDefaultPrompts();
}
const inquirer = {
prompt,
ui: {
Prompt: PromptsRunner,
},
createPromptModule,
registerPrompt,
restoreDefaultPrompts,
Separator,
};
export default inquirer;

3
node_modules/inquirer/dist/esm/package.json generated vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"type": "module"
}

61
node_modules/inquirer/dist/esm/types.d.ts generated vendored Normal file
View File

@@ -0,0 +1,61 @@
import { checkbox, confirm, editor, expand, input, number, password, rawlist, search, select } from '@inquirer/prompts';
import type { Context, DistributiveMerge, Prettify } from '@inquirer/type';
import { Observable } from 'rxjs';
export type Answers<Key extends string = string> = Record<Key, any>;
type AsyncCallbackFunction<R> = (...args: [error: null | undefined, value: R] | [error: Error, value: undefined]) => void;
export type AsyncGetterFunction<R, A extends Answers> = (this: {
async: () => AsyncCallbackFunction<R>;
}, answers: Prettify<Partial<A>>) => void | R | Promise<R>;
/**
* Allows to inject a custom question type into inquirer module.
*
* @example
* ```ts
* declare module 'inquirer' {
* interface QuestionMap {
* custom: { message: string };
* }
* }
* ```
*
* Globally defined question types are not correct.
*/
export interface QuestionMap {
__dummy: {
message: string;
};
}
type KeyValueOrAsyncGetterFunction<T, k extends string, A extends Answers> = T extends Record<string, any> ? T[k] | AsyncGetterFunction<T[k], A> : never;
export type Question<A extends Answers = Answers, Type extends string = string> = {
type: Type;
name: string;
message: string | AsyncGetterFunction<string, A>;
default?: any;
choices?: any;
filter?: (answer: any, answers: Partial<A>) => any;
askAnswered?: boolean;
when?: boolean | AsyncGetterFunction<boolean, A>;
};
type QuestionWithGetters<Type extends string, Q extends Record<string, any>, A extends Answers> = DistributiveMerge<Q, {
type: Type;
askAnswered?: boolean;
when?: boolean | AsyncGetterFunction<boolean, A>;
filter?(input: any, answers: A): any;
message: KeyValueOrAsyncGetterFunction<Q, 'message', A>;
default?: KeyValueOrAsyncGetterFunction<Q, 'default', A>;
choices?: KeyValueOrAsyncGetterFunction<Q, 'choices', A>;
}>;
export type UnnamedDistinctQuestion<A extends Answers = object> = QuestionWithGetters<'checkbox', Parameters<typeof checkbox>[0] & {
default: unknown[];
}, A> | QuestionWithGetters<'confirm', Parameters<typeof confirm>[0], A> | QuestionWithGetters<'editor', Parameters<typeof editor>[0], A> | QuestionWithGetters<'expand', Parameters<typeof expand>[0], A> | QuestionWithGetters<'input', Parameters<typeof input>[0], A> | QuestionWithGetters<'number', Parameters<typeof number>[0], A> | QuestionWithGetters<'password', Parameters<typeof password>[0], A> | QuestionWithGetters<'rawlist', Parameters<typeof rawlist>[0], A> | QuestionWithGetters<'search', Parameters<typeof search>[0], A> | QuestionWithGetters<'list', Parameters<typeof select>[0], A> | QuestionWithGetters<'select', Parameters<typeof select>[0], A>;
export type DistinctQuestion<A extends Answers = Answers> = Prettify<UnnamedDistinctQuestion<A> & {
name: Extract<keyof A, string>;
}>;
export type CustomQuestion<A extends Answers, Q extends Record<string, Record<string, any>>> = {
[key in Extract<keyof Q, string>]: Readonly<QuestionWithGetters<key, Q[key], A>>;
}[Extract<keyof Q, string>];
export type PromptSession<A extends Answers = Answers, Q extends Question<A> = Question<A>> = Q[] | Record<string, Omit<Q, 'name'>> | Observable<Q> | Q;
export type StreamOptions = Prettify<Context & {
skipTTYChecks?: boolean;
}>;
export {};

1
node_modules/inquirer/dist/esm/types.js generated vendored Normal file
View File

@@ -0,0 +1 @@
export {};

60
node_modules/inquirer/dist/esm/ui/prompt.d.ts generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import { Observable } from 'rxjs';
import type { InquirerReadline } from '@inquirer/type';
import type { Answers, PromptSession, StreamOptions } from '../types.ts';
export declare const _: {
set: (obj: Record<string, unknown>, path: string | undefined, value: unknown) => void;
get: (obj: object, path?: string | number | symbol, defaultValue?: unknown) => any;
};
export interface PromptBase {
/**
* Runs the prompt.
*
* @returns
* The result of the prompt.
*/
run(): Promise<any>;
}
/**
* Provides the functionality to initialize new prompts.
*/
export interface LegacyPromptConstructor {
/**
* Initializes a new instance of a prompt.
*
* @param question
* The question to prompt.
*
* @param readLine
* An object for reading from the command-line.
*
* @param answers
* The answers provided by the user.
*/
new (question: any, readLine: InquirerReadline, answers: Record<string, any>): PromptBase;
}
export type PromptFn<Value = any, Config = any> = (config: Config, context: StreamOptions & {
signal: AbortSignal;
}) => Promise<Value>;
/**
* Provides a set of prompt-constructors.
*/
export type PromptCollection = Record<string, PromptFn | LegacyPromptConstructor>;
/**
* Base interface class other can inherits from
*/
export default class PromptsRunner<A extends Answers> {
private prompts;
answers: Partial<A>;
process: Observable<any>;
private abortController;
private opt;
constructor(prompts: PromptCollection, opt?: StreamOptions);
run(questions: PromptSession<A>, answers?: Partial<A>): Promise<A>;
private prepareQuestion;
private fetchAnswer;
/**
* Close the interface and cleanup listeners
*/
close: () => void;
private shouldRun;
}

263
node_modules/inquirer/dist/esm/ui/prompt.js generated vendored Normal file
View File

@@ -0,0 +1,263 @@
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-assignment */
import readline from 'node:readline';
import { defer, EMPTY, from, of, concatMap, filter, reduce, isObservable, lastValueFrom, } from 'rxjs';
import runAsync from 'run-async';
import MuteStream from 'mute-stream';
import { AbortPromptError } from '@inquirer/core';
import { cursorShow } from '@inquirer/ansi';
export const _ = {
set: (obj, path = '', value) => {
let pointer = obj;
path.split('.').forEach((key, index, arr) => {
if (key === '__proto__' || key === 'constructor')
return;
if (index === arr.length - 1) {
pointer[key] = value;
}
else if (!(key in pointer) || typeof pointer[key] !== 'object') {
pointer[key] = {};
}
pointer = pointer[key];
});
},
get: (obj, path = '', defaultValue) => {
const travel = (regexp) => String.prototype.split
.call(path, regexp)
.filter(Boolean)
.reduce(
// @ts-expect-error implicit any on res[key]
(res, key) => (res == null ? res : res[key]), obj);
const result = travel(/[,[\]]+?/) || travel(/[,.[\]]+?/);
return result === undefined || result === obj ? defaultValue : result;
},
};
/**
* Resolve a question property value if it is passed as a function.
* This method will overwrite the property on the question object with the received value.
*/
async function fetchAsyncQuestionProperty(question, prop, answers) {
const propGetter = question[prop];
if (typeof propGetter === 'function') {
return runAsync(propGetter)(answers);
}
return propGetter;
}
class TTYError extends Error {
name = 'TTYError';
isTtyError = true;
}
function setupReadlineOptions(opt) {
// Inquirer 8.x:
// opt.skipTTYChecks = opt.skipTTYChecks === undefined ? opt.input !== undefined : opt.skipTTYChecks;
opt.skipTTYChecks = opt.skipTTYChecks === undefined ? true : opt.skipTTYChecks;
// Default `input` to stdin
const input = opt.input || process.stdin;
// Check if prompt is being called in TTY environment
// If it isn't return a failed promise
// @ts-expect-error: ignore isTTY type error
if (!opt.skipTTYChecks && !input.isTTY) {
throw new TTYError('Prompts can not be meaningfully rendered in non-TTY environments');
}
// Add mute capabilities to the output
const ms = new MuteStream();
ms.pipe(opt.output || process.stdout);
const output = ms;
return {
terminal: true,
...opt,
input,
output,
};
}
function isQuestionArray(questions) {
return Array.isArray(questions);
}
function isQuestionMap(questions) {
return Object.values(questions).every((maybeQuestion) => typeof maybeQuestion === 'object' &&
!Array.isArray(maybeQuestion) &&
maybeQuestion != null);
}
function isPromptConstructor(prompt) {
return Boolean(prompt.prototype &&
'run' in prompt.prototype &&
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
typeof prompt.prototype.run === 'function');
}
/**
* Base interface class other can inherits from
*/
export default class PromptsRunner {
prompts;
answers = {};
process = EMPTY;
abortController = new AbortController();
opt;
constructor(prompts, opt = {}) {
this.opt = opt;
this.prompts = prompts;
}
async run(questions, answers) {
this.abortController = new AbortController();
// Keep global reference to the answers
this.answers = typeof answers === 'object' ? { ...answers } : {};
let obs;
if (isQuestionArray(questions)) {
obs = from(questions);
}
else if (isObservable(questions)) {
obs = questions;
}
else if (isQuestionMap(questions)) {
// Case: Called with a set of { name: question }
obs = from(Object.entries(questions).map(([name, question]) => {
return Object.assign({}, question, { name });
}));
}
else {
// Case: Called with a single question config
obs = from([questions]);
}
this.process = obs.pipe(concatMap((question) => of(question).pipe(concatMap((question) => from(this.shouldRun(question).then((shouldRun) => {
if (shouldRun) {
return question;
}
return;
})).pipe(filter((val) => val != null))), concatMap((question) => defer(() => from(this.fetchAnswer(question)))))));
return lastValueFrom(this.process.pipe(reduce((answersObj, answer) => {
_.set(answersObj, answer.name, answer.answer);
return answersObj;
}, this.answers)))
.then(() => this.answers)
.finally(() => this.close());
}
prepareQuestion = async (question) => {
const [message, defaultValue, resolvedChoices] = await Promise.all([
fetchAsyncQuestionProperty(question, 'message', this.answers),
fetchAsyncQuestionProperty(question, 'default', this.answers),
fetchAsyncQuestionProperty(question, 'choices', this.answers),
]);
let choices;
if (Array.isArray(resolvedChoices)) {
choices = resolvedChoices.map((choice) => {
const choiceObj = typeof choice !== 'object' || choice == null
? { name: choice, value: choice }
: {
...choice,
value: 'value' in choice
? choice.value
: 'name' in choice
? choice.name
: undefined,
};
if ('value' in choiceObj && Array.isArray(defaultValue)) {
// Add checked to question for backward compatibility. default was supported as alternative of per choice checked.
return {
checked: defaultValue.includes(choiceObj.value),
...choiceObj,
};
}
return choiceObj;
});
}
return Object.assign({}, question, {
message,
default: defaultValue,
choices,
type: question.type in this.prompts ? question.type : 'input',
});
};
fetchAnswer = async (rawQuestion) => {
const question = await this.prepareQuestion(rawQuestion);
const prompt = this.prompts[question.type];
if (prompt == null) {
throw new Error(`Prompt for type ${question.type} not found`);
}
let cleanupSignal;
const promptFn = isPromptConstructor(prompt)
? (q, opt) => new Promise((resolve, reject) => {
const { signal } = opt;
if (signal.aborted) {
reject(new AbortPromptError({ cause: signal.reason }));
return;
}
const rl = readline.createInterface(setupReadlineOptions(opt));
/**
* Handle the ^C exit
*/
const onForceClose = () => {
this.close();
process.kill(process.pid, 'SIGINT');
console.log('');
};
const onClose = () => {
process.removeListener('exit', onForceClose);
rl.removeListener('SIGINT', onForceClose);
rl.setPrompt('');
rl.output.unmute();
rl.output.write(cursorShow);
rl.output.end();
rl.close();
};
// Make sure new prompt start on a newline when closing
process.on('exit', onForceClose);
rl.on('SIGINT', onForceClose);
const activePrompt = new prompt(q, rl, this.answers);
const cleanup = () => {
onClose();
cleanupSignal?.();
};
const abort = () => {
reject(new AbortPromptError({ cause: signal.reason }));
cleanup();
};
signal.addEventListener('abort', abort);
cleanupSignal = () => {
signal.removeEventListener('abort', abort);
cleanupSignal = undefined;
};
activePrompt.run().then(resolve, reject).finally(cleanup);
})
: prompt;
let cleanupModuleSignal;
const { signal: moduleSignal } = this.opt;
if (moduleSignal?.aborted) {
this.abortController.abort(moduleSignal.reason);
}
else if (moduleSignal) {
const abort = () => this.abortController.abort(moduleSignal.reason);
moduleSignal.addEventListener('abort', abort);
cleanupModuleSignal = () => {
moduleSignal.removeEventListener('abort', abort);
};
}
const { filter = (value) => value } = question;
const { signal } = this.abortController;
return promptFn(question, { ...this.opt, signal })
.then((answer) => ({
name: question.name,
answer: filter(answer, this.answers),
}))
.finally(() => {
cleanupSignal?.();
cleanupModuleSignal?.();
});
};
/**
* Close the interface and cleanup listeners
*/
close = () => {
this.abortController.abort();
};
shouldRun = async (question) => {
if (question.askAnswered !== true &&
_.get(this.answers, question.name) !== undefined) {
return false;
}
const { when } = question;
if (typeof when === 'function') {
const shouldRun = await runAsync(when)(this.answers);
return Boolean(shouldRun);
}
return when !== false;
};
}

111
node_modules/inquirer/package.json generated vendored Normal file
View File

@@ -0,0 +1,111 @@
{
"name": "inquirer",
"version": "12.9.6",
"description": "A collection of common interactive command line user interfaces.",
"keywords": [
"answer",
"answers",
"ask",
"base",
"cli",
"command",
"command-line",
"confirm",
"enquirer",
"generate",
"generator",
"hyper",
"input",
"inquire",
"inquirer",
"interface",
"iterm",
"javascript",
"menu",
"node",
"nodejs",
"prompt",
"promptly",
"prompts",
"question",
"readline",
"scaffold",
"scaffolder",
"scaffolding",
"stdin",
"stdout",
"terminal",
"tty",
"ui",
"yeoman",
"yo",
"zsh"
],
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/inquirer/README.md",
"repository": {
"type": "git",
"url": "https://github.com/SBoudrias/Inquirer.js.git"
},
"license": "MIT",
"author": "Simon Boudrias <admin@simonboudrias.com>",
"sideEffects": false,
"type": "module",
"exports": {
"./package.json": "./package.json",
".": {
"import": {
"types": "./dist/esm/index.d.ts",
"default": "./dist/esm/index.js"
},
"require": {
"types": "./dist/commonjs/index.d.ts",
"default": "./dist/commonjs/index.js"
}
}
},
"main": "./dist/commonjs/index.js",
"module": "./dist/esm/index.js",
"types": "./dist/commonjs/index.d.ts",
"files": [
"dist"
],
"scripts": {
"attw": "attw --pack",
"tsc": "tshy"
},
"dependencies": {
"@inquirer/ansi": "^1.0.0",
"@inquirer/core": "^10.2.2",
"@inquirer/prompts": "^7.8.6",
"@inquirer/type": "^3.0.8",
"mute-stream": "^2.0.0",
"run-async": "^4.0.5",
"rxjs": "^7.8.2"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.2",
"@types/mute-stream": "^0.0.4",
"tshy": "^3.0.2"
},
"engines": {
"node": ">=18"
},
"tshy": {
"exclude": [
"src/**/*.test.ts"
],
"exports": {
"./package.json": "./package.json",
".": "./src/index.ts"
}
},
"peerDependencies": {
"@types/node": ">=18"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
}
},
"gitHead": "3fdf43342deb468ee41d698e407d8800700e08dc"
}