@listr2/prompt-adapter-inquirer 3.0.0-beta.3 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +60 -71
- package/dist/index.d.cts +19 -18
- package/dist/index.d.ts +19 -18
- package/dist/index.js +43 -52
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,80 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
8
|
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
18
17
|
};
|
|
19
|
-
var
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
__export(index_exports, {
|
|
24
|
-
ListrInquirerPromptAdapter: () => ListrInquirerPromptAdapter
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(index_exports);
|
|
23
|
+
//#endregion
|
|
24
|
+
const listr2 = __toESM(require("listr2"));
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*/
|
|
69
|
-
cancel() {
|
|
70
|
-
if (!this.prompt) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
this.reportFailed();
|
|
74
|
-
this.signal.abort("Prompt was cancelled");
|
|
75
|
-
}
|
|
26
|
+
//#region src/prompt.ts
|
|
27
|
+
var ListrInquirerPromptAdapter = class extends listr2.ListrPromptAdapter {
|
|
28
|
+
prompt;
|
|
29
|
+
signal = new AbortController();
|
|
30
|
+
/**
|
|
31
|
+
* Get the current running instance of `inquirer`.
|
|
32
|
+
*/
|
|
33
|
+
get instance() {
|
|
34
|
+
return this.prompt;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create a new prompt with `inquirer`.
|
|
38
|
+
*/
|
|
39
|
+
async run(prompt, ...[config, context]) {
|
|
40
|
+
context ??= {};
|
|
41
|
+
context.output ??= this.wrapper.stdout(listr2.ListrTaskEventType.PROMPT);
|
|
42
|
+
context.signal ??= this.signal.signal;
|
|
43
|
+
this.reportStarted();
|
|
44
|
+
this.task.on(listr2.ListrTaskEventType.STATE, (event) => {
|
|
45
|
+
if (event === listr2.ListrTaskState.SKIPPED && this.prompt) this.cancel();
|
|
46
|
+
});
|
|
47
|
+
this.prompt = prompt(config, context);
|
|
48
|
+
let result;
|
|
49
|
+
try {
|
|
50
|
+
result = await this.prompt;
|
|
51
|
+
this.reportCompleted();
|
|
52
|
+
} catch (e) {
|
|
53
|
+
this.reportFailed();
|
|
54
|
+
throw e;
|
|
55
|
+
}
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Cancel the ongoing prompt.
|
|
60
|
+
*/
|
|
61
|
+
cancel() {
|
|
62
|
+
if (!this.prompt) return;
|
|
63
|
+
this.reportFailed();
|
|
64
|
+
this.signal.abort("Prompt was cancelled");
|
|
65
|
+
}
|
|
76
66
|
};
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
});
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.ListrInquirerPromptAdapter = ListrInquirerPromptAdapter;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import { Prompt } from
|
|
2
|
-
import { ListrPromptAdapter } from
|
|
1
|
+
import { Prompt } from "@inquirer/type";
|
|
2
|
+
import { ListrPromptAdapter } from "listr2";
|
|
3
3
|
|
|
4
|
+
//#region src/prompt.d.ts
|
|
4
5
|
declare class ListrInquirerPromptAdapter extends ListrPromptAdapter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
private prompt;
|
|
7
|
+
private signal;
|
|
8
|
+
/**
|
|
9
|
+
* Get the current running instance of `inquirer`.
|
|
10
|
+
*/
|
|
11
|
+
get instance(): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new prompt with `inquirer`.
|
|
14
|
+
*/
|
|
15
|
+
run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* Cancel the ongoing prompt.
|
|
18
|
+
*/
|
|
19
|
+
cancel(): void;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
export { ListrInquirerPromptAdapter };
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ListrInquirerPromptAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ListrPromptAdapter } from "listr2";
|
|
2
|
+
import { Prompt } from "@inquirer/type";
|
|
3
3
|
|
|
4
|
+
//#region src/prompt.d.ts
|
|
4
5
|
declare class ListrInquirerPromptAdapter extends ListrPromptAdapter {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
6
|
+
private prompt;
|
|
7
|
+
private signal;
|
|
8
|
+
/**
|
|
9
|
+
* Get the current running instance of `inquirer`.
|
|
10
|
+
*/
|
|
11
|
+
get instance(): Promise<any>;
|
|
12
|
+
/**
|
|
13
|
+
* Create a new prompt with `inquirer`.
|
|
14
|
+
*/
|
|
15
|
+
run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
|
|
16
|
+
/**
|
|
17
|
+
* Cancel the ongoing prompt.
|
|
18
|
+
*/
|
|
19
|
+
cancel(): void;
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
export { ListrInquirerPromptAdapter };
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ListrInquirerPromptAdapter };
|
package/dist/index.js
CHANGED
|
@@ -1,55 +1,46 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// src/prompt.ts
|
|
5
1
|
import { ListrPromptAdapter, ListrTaskEventType, ListrTaskState } from "listr2";
|
|
2
|
+
|
|
3
|
+
//#region src/prompt.ts
|
|
6
4
|
var ListrInquirerPromptAdapter = class extends ListrPromptAdapter {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
cancel() {
|
|
46
|
-
if (!this.prompt) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
this.reportFailed();
|
|
50
|
-
this.signal.abort("Prompt was cancelled");
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
export {
|
|
54
|
-
ListrInquirerPromptAdapter
|
|
5
|
+
prompt;
|
|
6
|
+
signal = new AbortController();
|
|
7
|
+
/**
|
|
8
|
+
* Get the current running instance of `inquirer`.
|
|
9
|
+
*/
|
|
10
|
+
get instance() {
|
|
11
|
+
return this.prompt;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Create a new prompt with `inquirer`.
|
|
15
|
+
*/
|
|
16
|
+
async run(prompt, ...[config, context]) {
|
|
17
|
+
context ??= {};
|
|
18
|
+
context.output ??= this.wrapper.stdout(ListrTaskEventType.PROMPT);
|
|
19
|
+
context.signal ??= this.signal.signal;
|
|
20
|
+
this.reportStarted();
|
|
21
|
+
this.task.on(ListrTaskEventType.STATE, (event) => {
|
|
22
|
+
if (event === ListrTaskState.SKIPPED && this.prompt) this.cancel();
|
|
23
|
+
});
|
|
24
|
+
this.prompt = prompt(config, context);
|
|
25
|
+
let result;
|
|
26
|
+
try {
|
|
27
|
+
result = await this.prompt;
|
|
28
|
+
this.reportCompleted();
|
|
29
|
+
} catch (e) {
|
|
30
|
+
this.reportFailed();
|
|
31
|
+
throw e;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Cancel the ongoing prompt.
|
|
37
|
+
*/
|
|
38
|
+
cancel() {
|
|
39
|
+
if (!this.prompt) return;
|
|
40
|
+
this.reportFailed();
|
|
41
|
+
this.signal.abort("Prompt was cancelled");
|
|
42
|
+
}
|
|
55
43
|
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ListrInquirerPromptAdapter };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listr2/prompt-adapter-inquirer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Listr2 prompt adapter for inquirer.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/listr2/listr2",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
"node": ">=20.0.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"dev:start": "
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"dev:start": "tsdown --watch",
|
|
38
38
|
"format": "prettier --log-level warn --write src/ tests/ && pnpm run lint --fix",
|
|
39
39
|
"lint": "eslint --flag v10_config_lookup_from_file src/ tests/",
|
|
40
40
|
"test": "NO_COLOR=1 TS_NODE_PROJECT=tests/tsconfig.json NODE_OPTIONS='--no-warnings --experimental-specifier-resolution=node --experimental-vm-modules' jest --config tests/jest.config.ts",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
"@inquirer/core": "^10.1.14",
|
|
77
77
|
"@inquirer/input": "^4.2.0",
|
|
78
78
|
"@inquirer/prompts": "^7.6.0",
|
|
79
|
-
"listr2": "9.0.
|
|
79
|
+
"listr2": "9.0.1"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
82
|
"@inquirer/prompts": ">= 3 < 8",
|
|
83
|
-
"listr2": "9.0.
|
|
83
|
+
"listr2": "9.0.1"
|
|
84
84
|
}
|
|
85
85
|
}
|