Deployed the page to Github Pages.
This commit is contained in:
parent
1d79754e93
commit
2c89899458
62797 changed files with 6551425 additions and 15279 deletions
22
node_modules/@inquirer/editor/LICENSE
generated
vendored
Normal file
22
node_modules/@inquirer/editor/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
Copyright (c) 2023 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.
|
||||
95
node_modules/@inquirer/editor/README.md
generated
vendored
Normal file
95
node_modules/@inquirer/editor/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
# `@inquirer/editor`
|
||||
|
||||
Prompt that'll open the user preferred editor with default content and allow for a convenient multi-line input controlled through the command line.
|
||||
|
||||
# Installation
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>npm</th>
|
||||
<th>yarn</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
npm install @inquirer/prompts
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/prompts
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colSpan="2" align="center">Or</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
npm install @inquirer/editor
|
||||
```
|
||||
|
||||
</td>
|
||||
<td>
|
||||
|
||||
```sh
|
||||
yarn add @inquirer/editor
|
||||
```
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
# Usage
|
||||
|
||||
```js
|
||||
import { editor } from '@inquirer/prompts';
|
||||
// Or
|
||||
// import editor from '@inquirer/editor';
|
||||
|
||||
const answer = await editor({
|
||||
message: 'Enter a description',
|
||||
});
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
| Property | Type | Required | Description |
|
||||
| --------------- | ----------------------------------------------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| message | `string` | yes | The question to ask |
|
||||
| default | `string` | no | Default value which will automatically be present in the editor |
|
||||
| validate | `string => boolean \| string \| Promise<boolean \| string>` | no | On submit, validate the content. When returning a string, it'll be used as the error message displayed to the user. Note: returning a rejected promise, we'll assume a code error happened and crash. |
|
||||
| postfix | `string` | no (default to `.txt`) | The postfix of the file being edited. Adding this will add color highlighting to the file content in most editors. |
|
||||
| waitForUseInput | `boolean` | no (default to `true`) | Open the editor automatically without waiting for the user to press enter. Note that this mean the user will not see the question! So make sure you have a default value that provide guidance if it's unclear what input is expected. |
|
||||
| theme | [See Theming](#Theming) | no | Customize look of the prompt. |
|
||||
|
||||
## Theming
|
||||
|
||||
You can theme a prompt by passing a `theme` object option. The theme object only need to includes the keys you wish to modify, we'll fallback on the defaults for the rest.
|
||||
|
||||
```ts
|
||||
type Theme = {
|
||||
prefix: string;
|
||||
spinner: {
|
||||
interval: number;
|
||||
frames: string[];
|
||||
};
|
||||
style: {
|
||||
message: (text: string) => string;
|
||||
error: (text: string) => string;
|
||||
help: (text: string) => string;
|
||||
key: (text: string) => string;
|
||||
};
|
||||
};
|
||||
```
|
||||
|
||||
# License
|
||||
|
||||
Copyright (c) 2023 Simon Boudrias (twitter: [@vaxilart](https://twitter.com/Vaxilart))<br/>
|
||||
Licensed under the MIT license.
|
||||
76
node_modules/@inquirer/editor/dist/cjs/index.js
generated
vendored
Normal file
76
node_modules/@inquirer/editor/dist/cjs/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_async_hooks_1 = require("node:async_hooks");
|
||||
const external_editor_1 = require("external-editor");
|
||||
const core_1 = require("@inquirer/core");
|
||||
exports.default = (0, core_1.createPrompt)((config, done) => {
|
||||
const { waitForUseInput = true, postfix = '.txt', validate = () => true } = config;
|
||||
const theme = (0, core_1.makeTheme)(config.theme);
|
||||
const [status, setStatus] = (0, core_1.useState)('pending');
|
||||
const [value, setValue] = (0, core_1.useState)(config.default || '');
|
||||
const [errorMsg, setError] = (0, core_1.useState)();
|
||||
const isLoading = status === 'loading';
|
||||
const prefix = (0, core_1.usePrefix)({ isLoading, theme });
|
||||
function startEditor(rl) {
|
||||
rl.pause();
|
||||
// Note: The bind call isn't strictly required. But we need it for our mocks to work as expected.
|
||||
const editCallback = node_async_hooks_1.AsyncResource.bind((error, answer) => __awaiter(this, void 0, void 0, function* () {
|
||||
rl.resume();
|
||||
if (error) {
|
||||
setError(error.toString());
|
||||
}
|
||||
else {
|
||||
setStatus('loading');
|
||||
const isValid = yield validate(answer);
|
||||
if (isValid === true) {
|
||||
setError(undefined);
|
||||
setStatus('done');
|
||||
done(answer);
|
||||
}
|
||||
else {
|
||||
setValue(answer);
|
||||
setError(isValid || 'You must provide a valid value');
|
||||
setStatus('pending');
|
||||
}
|
||||
}
|
||||
}));
|
||||
(0, external_editor_1.editAsync)(value, (error, answer) => void editCallback(error, answer), { postfix });
|
||||
}
|
||||
(0, core_1.useEffect)((rl) => {
|
||||
if (!waitForUseInput) {
|
||||
startEditor(rl);
|
||||
}
|
||||
}, []);
|
||||
(0, core_1.useKeypress)((key, rl) => {
|
||||
// Ignore keypress while our prompt is doing other processing.
|
||||
if (status !== 'pending') {
|
||||
return;
|
||||
}
|
||||
if ((0, core_1.isEnterKey)(key)) {
|
||||
startEditor(rl);
|
||||
}
|
||||
});
|
||||
const message = theme.style.message(config.message);
|
||||
let helpTip = '';
|
||||
if (status === 'loading') {
|
||||
helpTip = theme.style.help('Received');
|
||||
}
|
||||
else if (status === 'pending') {
|
||||
const enterKey = theme.style.key('enter');
|
||||
helpTip = theme.style.help(`Press ${enterKey} to launch your preferred editor.`);
|
||||
}
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [[prefix, message, helpTip].filter(Boolean).join(' '), error];
|
||||
});
|
||||
12
node_modules/@inquirer/editor/dist/cjs/types/index.d.ts
generated
vendored
Normal file
12
node_modules/@inquirer/editor/dist/cjs/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type EditorConfig = {
|
||||
message: string;
|
||||
default?: string;
|
||||
postfix?: string;
|
||||
waitForUseInput?: boolean;
|
||||
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
||||
theme?: PartialDeep<Theme>;
|
||||
};
|
||||
declare const _default: import("@inquirer/type").Prompt<string, EditorConfig>;
|
||||
export default _default;
|
||||
65
node_modules/@inquirer/editor/dist/esm/index.mjs
generated
vendored
Normal file
65
node_modules/@inquirer/editor/dist/esm/index.mjs
generated
vendored
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
import { AsyncResource } from 'node:async_hooks';
|
||||
import { editAsync } from 'external-editor';
|
||||
import { createPrompt, useEffect, useState, useKeypress, usePrefix, isEnterKey, makeTheme, } from '@inquirer/core';
|
||||
export default createPrompt((config, done) => {
|
||||
const { waitForUseInput = true, postfix = '.txt', validate = () => true } = config;
|
||||
const theme = makeTheme(config.theme);
|
||||
const [status, setStatus] = useState('pending');
|
||||
const [value, setValue] = useState(config.default || '');
|
||||
const [errorMsg, setError] = useState();
|
||||
const isLoading = status === 'loading';
|
||||
const prefix = usePrefix({ isLoading, theme });
|
||||
function startEditor(rl) {
|
||||
rl.pause();
|
||||
// Note: The bind call isn't strictly required. But we need it for our mocks to work as expected.
|
||||
const editCallback = AsyncResource.bind(async (error, answer) => {
|
||||
rl.resume();
|
||||
if (error) {
|
||||
setError(error.toString());
|
||||
}
|
||||
else {
|
||||
setStatus('loading');
|
||||
const isValid = await validate(answer);
|
||||
if (isValid === true) {
|
||||
setError(undefined);
|
||||
setStatus('done');
|
||||
done(answer);
|
||||
}
|
||||
else {
|
||||
setValue(answer);
|
||||
setError(isValid || 'You must provide a valid value');
|
||||
setStatus('pending');
|
||||
}
|
||||
}
|
||||
});
|
||||
editAsync(value, (error, answer) => void editCallback(error, answer), { postfix });
|
||||
}
|
||||
useEffect((rl) => {
|
||||
if (!waitForUseInput) {
|
||||
startEditor(rl);
|
||||
}
|
||||
}, []);
|
||||
useKeypress((key, rl) => {
|
||||
// Ignore keypress while our prompt is doing other processing.
|
||||
if (status !== 'pending') {
|
||||
return;
|
||||
}
|
||||
if (isEnterKey(key)) {
|
||||
startEditor(rl);
|
||||
}
|
||||
});
|
||||
const message = theme.style.message(config.message);
|
||||
let helpTip = '';
|
||||
if (status === 'loading') {
|
||||
helpTip = theme.style.help('Received');
|
||||
}
|
||||
else if (status === 'pending') {
|
||||
const enterKey = theme.style.key('enter');
|
||||
helpTip = theme.style.help(`Press ${enterKey} to launch your preferred editor.`);
|
||||
}
|
||||
let error = '';
|
||||
if (errorMsg) {
|
||||
error = theme.style.error(errorMsg);
|
||||
}
|
||||
return [[prefix, message, helpTip].filter(Boolean).join(' '), error];
|
||||
});
|
||||
12
node_modules/@inquirer/editor/dist/esm/types/index.d.mts
generated
vendored
Normal file
12
node_modules/@inquirer/editor/dist/esm/types/index.d.mts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type EditorConfig = {
|
||||
message: string;
|
||||
default?: string;
|
||||
postfix?: string;
|
||||
waitForUseInput?: boolean;
|
||||
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
||||
theme?: PartialDeep<Theme>;
|
||||
};
|
||||
declare const _default: import("@inquirer/type").Prompt<string, EditorConfig>;
|
||||
export default _default;
|
||||
12
node_modules/@inquirer/editor/dist/types/index.d.ts
generated
vendored
Normal file
12
node_modules/@inquirer/editor/dist/types/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { type Theme } from '@inquirer/core';
|
||||
import type { PartialDeep } from '@inquirer/type';
|
||||
type EditorConfig = {
|
||||
message: string;
|
||||
default?: string;
|
||||
postfix?: string;
|
||||
waitForUseInput?: boolean;
|
||||
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
||||
theme?: PartialDeep<Theme>;
|
||||
};
|
||||
declare const _default: import("@inquirer/type").Prompt<string, EditorConfig>;
|
||||
export default _default;
|
||||
90
node_modules/@inquirer/editor/package.json
generated
vendored
Normal file
90
node_modules/@inquirer/editor/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
{
|
||||
"name": "@inquirer/editor",
|
||||
"version": "2.2.0",
|
||||
"description": "Inquirer multiline editor prompt",
|
||||
"main": "./dist/cjs/index.js",
|
||||
"typings": "./dist/cjs/types/index.d.ts",
|
||||
"files": [
|
||||
"dist/**/*"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/SBoudrias/Inquirer.js.git"
|
||||
},
|
||||
"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"
|
||||
],
|
||||
"author": "Simon Boudrias <admin@simonboudrias.com>",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/main/packages/editor/README.md",
|
||||
"dependencies": {
|
||||
"@inquirer/core": "^9.1.0",
|
||||
"@inquirer/type": "^1.5.3",
|
||||
"external-editor": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@inquirer/testing": "^2.1.32"
|
||||
},
|
||||
"scripts": {
|
||||
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
||||
"tsc:esm": "rm -rf dist/esm && tsc -p ./tsconfig.json",
|
||||
"tsc:cjs": "rm -rf dist/cjs && tsc -p ./tsconfig.cjs.json && node ../../tools/fix-ext.mjs",
|
||||
"attw": "attw --pack"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/types/index.d.mts",
|
||||
"default": "./dist/esm/index.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/types/index.d.ts",
|
||||
"default": "./dist/cjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"sideEffects": false,
|
||||
"gitHead": "0c039599ef88fe9eb804fe083ee386ec906a856f"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue