@listr2/prompt-adapter-inquirer 3.0.0 → 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 CHANGED
@@ -1,80 +1,69 @@
1
- "use strict";
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
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
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 __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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
- // src/index.ts
22
- var index_exports = {};
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
- // src/prompt.ts
29
- var import_listr2 = require("listr2");
30
- var ListrInquirerPromptAdapter = class extends import_listr2.ListrPromptAdapter {
31
- static {
32
- __name(this, "ListrInquirerPromptAdapter");
33
- }
34
- prompt;
35
- signal = new AbortController();
36
- /**
37
- * Get the current running instance of `inquirer`.
38
- */
39
- get instance() {
40
- return this.prompt;
41
- }
42
- /**
43
- * Create a new prompt with `inquirer`.
44
- */
45
- async run(prompt, ...[config, context]) {
46
- context ??= {};
47
- context.output ??= this.wrapper.stdout(import_listr2.ListrTaskEventType.PROMPT);
48
- context.signal ??= this.signal.signal;
49
- this.reportStarted();
50
- this.task.on(import_listr2.ListrTaskEventType.STATE, (event) => {
51
- if (event === import_listr2.ListrTaskState.SKIPPED && this.prompt) {
52
- this.cancel();
53
- }
54
- });
55
- this.prompt = prompt(config, context);
56
- let result;
57
- try {
58
- result = await this.prompt;
59
- this.reportCompleted();
60
- } catch (e) {
61
- this.reportFailed();
62
- throw e;
63
- }
64
- return result;
65
- }
66
- /**
67
- * Cancel the ongoing prompt.
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
- // Annotate the CommonJS export names for ESM import in node:
78
- 0 && (module.exports = {
79
- ListrInquirerPromptAdapter
80
- });
67
+
68
+ //#endregion
69
+ exports.ListrInquirerPromptAdapter = ListrInquirerPromptAdapter;
package/dist/index.d.cts CHANGED
@@ -1,21 +1,22 @@
1
- import { Prompt } from '@inquirer/type';
2
- import { ListrPromptAdapter } from 'listr2';
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
- private prompt;
6
- private signal;
7
- /**
8
- * Get the current running instance of `inquirer`.
9
- */
10
- get instance(): Promise<any>;
11
- /**
12
- * Create a new prompt with `inquirer`.
13
- */
14
- run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
15
- /**
16
- * Cancel the ongoing prompt.
17
- */
18
- cancel(): void;
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 { Prompt } from '@inquirer/type';
2
- import { ListrPromptAdapter } from 'listr2';
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
- private prompt;
6
- private signal;
7
- /**
8
- * Get the current running instance of `inquirer`.
9
- */
10
- get instance(): Promise<any>;
11
- /**
12
- * Create a new prompt with `inquirer`.
13
- */
14
- run<T extends Prompt<any, any> = Prompt<any, any>>(prompt: T, ...[config, context]: Parameters<T>): Promise<ReturnType<T>>;
15
- /**
16
- * Cancel the ongoing prompt.
17
- */
18
- cancel(): void;
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
- static {
8
- __name(this, "ListrInquirerPromptAdapter");
9
- }
10
- prompt;
11
- signal = new AbortController();
12
- /**
13
- * Get the current running instance of `inquirer`.
14
- */
15
- get instance() {
16
- return this.prompt;
17
- }
18
- /**
19
- * Create a new prompt with `inquirer`.
20
- */
21
- async run(prompt, ...[config, context]) {
22
- context ??= {};
23
- context.output ??= this.wrapper.stdout(ListrTaskEventType.PROMPT);
24
- context.signal ??= this.signal.signal;
25
- this.reportStarted();
26
- this.task.on(ListrTaskEventType.STATE, (event) => {
27
- if (event === ListrTaskState.SKIPPED && this.prompt) {
28
- this.cancel();
29
- }
30
- });
31
- this.prompt = prompt(config, context);
32
- let result;
33
- try {
34
- result = await this.prompt;
35
- this.reportCompleted();
36
- } catch (e) {
37
- this.reportFailed();
38
- throw e;
39
- }
40
- return result;
41
- }
42
- /**
43
- * Cancel the ongoing prompt.
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.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": "tsup-node",
37
- "dev:start": "tsup-node --watch",
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.0"
79
+ "listr2": "9.0.1"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@inquirer/prompts": ">= 3 < 8",
83
- "listr2": "9.0.0"
83
+ "listr2": "9.0.1"
84
84
  }
85
85
  }