@inquirer/core 4.1.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/lib/Separator.js +5 -2
- package/dist/cjs/lib/create-prompt.js +30 -4
- package/dist/cjs/lib/screen-manager.js +6 -3
- package/dist/cjs/lib/use-pagination.js +5 -2
- package/dist/cjs/lib/use-prefix.js +6 -3
- package/dist/cjs/lib/utils.js +4 -1
- package/dist/cjs/types/index.d.ts +1 -1
- package/dist/cjs/types/lib/create-prompt.d.ts +4 -4
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/lib/create-prompt.mjs +0 -1
- package/dist/esm/lib/use-prefix.mjs +1 -1
- package/dist/esm/types/index.d.mts +1 -1
- package/dist/esm/types/lib/create-prompt.d.mts +4 -4
- package/package.json +4 -4
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Separator = void 0;
|
|
4
|
-
const chalk_1 = require("chalk");
|
|
5
|
-
const figures_1 = require("figures");
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const figures_1 = __importDefault(require("figures"));
|
|
6
9
|
/**
|
|
7
10
|
* Separator object
|
|
8
11
|
* Used to space/separate choices group
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -8,19 +31,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
32
|
});
|
|
10
33
|
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
11
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
38
|
exports.createPrompt = void 0;
|
|
13
|
-
const readline = require("node:readline");
|
|
39
|
+
const readline = __importStar(require("node:readline"));
|
|
14
40
|
const type_1 = require("@inquirer/type");
|
|
15
|
-
const mute_stream_1 = require("mute-stream");
|
|
41
|
+
const mute_stream_1 = __importDefault(require("mute-stream"));
|
|
16
42
|
const signal_exit_1 = require("signal-exit");
|
|
17
|
-
const screen_manager_mjs_1 = require('./screen-manager.js');
|
|
43
|
+
const screen_manager_mjs_1 = __importDefault(require('./screen-manager.js'));
|
|
18
44
|
const hook_engine_mjs_1 = require('./hook-engine.js');
|
|
19
45
|
// Take an AsyncPromptConfig and resolves all it's values.
|
|
20
46
|
function getPromptConfig(config) {
|
|
21
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
48
|
const message = typeof config.message === 'function' ? config.message() : config.message;
|
|
23
|
-
return Object.assign(Object.assign({
|
|
49
|
+
return Object.assign(Object.assign({}, config), { message: yield message });
|
|
24
50
|
});
|
|
25
51
|
}
|
|
26
52
|
function createPrompt(view) {
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const cli_width_1 = require("cli-width");
|
|
4
|
-
const strip_ansi_1 = require("strip-ansi");
|
|
5
|
-
const ansi_escapes_1 = require("ansi-escapes");
|
|
6
|
+
const cli_width_1 = __importDefault(require("cli-width"));
|
|
7
|
+
const strip_ansi_1 = __importDefault(require("strip-ansi"));
|
|
8
|
+
const ansi_escapes_1 = __importDefault(require("ansi-escapes"));
|
|
6
9
|
const utils_mjs_1 = require('./utils.js');
|
|
7
10
|
const height = (content) => content.split('\n').length;
|
|
8
11
|
const lastLine = (content) => { var _a; return (_a = content.split('\n').pop()) !== null && _a !== void 0 ? _a : ''; };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.usePagination = void 0;
|
|
4
|
-
const chalk_1 = require("chalk");
|
|
5
|
-
const cli_width_1 = require("cli-width");
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const cli_width_1 = __importDefault(require("cli-width"));
|
|
6
9
|
const utils_mjs_1 = require('./utils.js');
|
|
7
10
|
const hook_engine_mjs_1 = require('./hook-engine.js');
|
|
8
11
|
const use_ref_mjs_1 = require('./use-ref.js');
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.usePrefix = void 0;
|
|
4
|
-
const chalk_1 = require("chalk");
|
|
5
|
-
const
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const cli_spinners_1 = __importDefault(require("cli-spinners"));
|
|
6
9
|
const use_state_mjs_1 = require('./use-state.js');
|
|
7
10
|
const use_effect_mjs_1 = require('./use-effect.js');
|
|
8
|
-
const spinner =
|
|
11
|
+
const spinner = cli_spinners_1.default.dots;
|
|
9
12
|
function usePrefix(isLoading = false) {
|
|
10
13
|
const [tick, setTick] = (0, use_state_mjs_1.useState)(0);
|
|
11
14
|
(0, use_effect_mjs_1.useEffect)(() => {
|
package/dist/cjs/lib/utils.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.breakLines = void 0;
|
|
4
|
-
const wrap_ansi_1 = require("wrap-ansi");
|
|
7
|
+
const wrap_ansi_1 = __importDefault(require("wrap-ansi"));
|
|
5
8
|
/**
|
|
6
9
|
* Force line returns at specific width. This function is ANSI code friendly and it'll
|
|
7
10
|
* ignore invisible codes during width calculation.
|
|
@@ -5,6 +5,6 @@ export { useEffect } from './lib/use-effect.js';
|
|
|
5
5
|
export { useRef } from './lib/use-ref.js';
|
|
6
6
|
export { useKeypress } from './lib/use-keypress.js';
|
|
7
7
|
export { usePagination } from './lib/use-pagination.js';
|
|
8
|
-
export { createPrompt, type AsyncPromptConfig } from './lib/create-prompt.js';
|
|
8
|
+
export { createPrompt, type PromptConfig, type AsyncPromptConfig, } from './lib/create-prompt.js';
|
|
9
9
|
export { Separator } from './lib/Separator.js';
|
|
10
10
|
export { type InquirerReadline } from './lib/read-line.type.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type Prompt } from '@inquirer/type';
|
|
1
|
+
import { type Prompt, type Prettify } from '@inquirer/type';
|
|
2
2
|
export type AsyncPromptConfig = {
|
|
3
3
|
message: string | Promise<string> | (() => Promise<string>);
|
|
4
|
-
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
|
5
4
|
};
|
|
5
|
+
export type PromptConfig<Config> = Prettify<AsyncPromptConfig & Config>;
|
|
6
6
|
type ResolvedPromptConfig = {
|
|
7
7
|
message: string;
|
|
8
|
-
validate: (value: string) => boolean | string | Promise<string | boolean>;
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
type ViewFunction<Value, Config> = (config: Prettify<Config & ResolvedPromptConfig>, done: (value: Value) => void) => string | [string, string | undefined];
|
|
10
|
+
export declare function createPrompt<Value, Config extends AsyncPromptConfig>(view: ViewFunction<Value, Config>): Prompt<Value, Config>;
|
|
11
11
|
export {};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -5,5 +5,5 @@ export { useEffect } from './lib/use-effect.mjs';
|
|
|
5
5
|
export { useRef } from './lib/use-ref.mjs';
|
|
6
6
|
export { useKeypress } from './lib/use-keypress.mjs';
|
|
7
7
|
export { usePagination } from './lib/use-pagination.mjs';
|
|
8
|
-
export { createPrompt } from './lib/create-prompt.mjs';
|
|
8
|
+
export { createPrompt, } from './lib/create-prompt.mjs';
|
|
9
9
|
export { Separator } from './lib/Separator.mjs';
|
|
@@ -8,7 +8,6 @@ import { withHooks, effectScheduler } from './hook-engine.mjs';
|
|
|
8
8
|
async function getPromptConfig(config) {
|
|
9
9
|
const message = typeof config.message === 'function' ? config.message() : config.message;
|
|
10
10
|
return {
|
|
11
|
-
validate: () => true,
|
|
12
11
|
...config,
|
|
13
12
|
message: await message,
|
|
14
13
|
};
|
|
@@ -5,6 +5,6 @@ export { useEffect } from './lib/use-effect.mjs';
|
|
|
5
5
|
export { useRef } from './lib/use-ref.mjs';
|
|
6
6
|
export { useKeypress } from './lib/use-keypress.mjs';
|
|
7
7
|
export { usePagination } from './lib/use-pagination.mjs';
|
|
8
|
-
export { createPrompt, type AsyncPromptConfig } from './lib/create-prompt.mjs';
|
|
8
|
+
export { createPrompt, type PromptConfig, type AsyncPromptConfig, } from './lib/create-prompt.mjs';
|
|
9
9
|
export { Separator } from './lib/Separator.mjs';
|
|
10
10
|
export { type InquirerReadline } from './lib/read-line.type.mjs';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { type Prompt } from '@inquirer/type';
|
|
1
|
+
import { type Prompt, type Prettify } from '@inquirer/type';
|
|
2
2
|
export type AsyncPromptConfig = {
|
|
3
3
|
message: string | Promise<string> | (() => Promise<string>);
|
|
4
|
-
validate?: (value: string) => boolean | string | Promise<string | boolean>;
|
|
5
4
|
};
|
|
5
|
+
export type PromptConfig<Config> = Prettify<AsyncPromptConfig & Config>;
|
|
6
6
|
type ResolvedPromptConfig = {
|
|
7
7
|
message: string;
|
|
8
|
-
validate: (value: string) => boolean | string | Promise<string | boolean>;
|
|
9
8
|
};
|
|
10
|
-
|
|
9
|
+
type ViewFunction<Value, Config> = (config: Prettify<Config & ResolvedPromptConfig>, done: (value: Value) => void) => string | [string, string | undefined];
|
|
10
|
+
export declare function createPrompt<Value, Config extends AsyncPromptConfig>(view: ViewFunction<Value, Config>): Prompt<Value, Config>;
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inquirer/core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=14.18.0"
|
|
6
6
|
},
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"license": "MIT",
|
|
58
58
|
"homepage": "https://github.com/SBoudrias/Inquirer.js/blob/master/packages/core/README.md",
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@inquirer/type": "^1.1.
|
|
60
|
+
"@inquirer/type": "^1.1.4",
|
|
61
61
|
"@types/mute-stream": "^0.0.1",
|
|
62
62
|
"@types/node": "^20.6.0",
|
|
63
63
|
"@types/wrap-ansi": "^3.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"wrap-ansi": "^6.2.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@inquirer/testing": "^2.1.
|
|
76
|
+
"@inquirer/testing": "^2.1.6"
|
|
77
77
|
},
|
|
78
78
|
"scripts": {
|
|
79
79
|
"tsc": "yarn run tsc:esm && yarn run tsc:cjs",
|
|
@@ -95,5 +95,5 @@
|
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
|
-
"gitHead": "
|
|
98
|
+
"gitHead": "c2d1c5fdfd1029f78351fb04e06f1cfb29d55bb6"
|
|
99
99
|
}
|