@inquirer/core 10.1.6 → 10.1.8

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/README.md CHANGED
@@ -4,19 +4,6 @@ The `@inquirer/core` package is the library enabling the creation of Inquirer pr
4
4
 
5
5
  It aims to implements a lightweight API similar to React hooks - but without JSX.
6
6
 
7
- # Special Thanks
8
-
9
- <div align="center" markdown="1">
10
-
11
- [![Warp](https://github.com/user-attachments/assets/0c3b132c-8984-49cf-918a-db6f6abe2c01)](https://www.warp.dev/?utm_source=npmjs&utm_medium=referral&utm_campaign=inquirer)<br>
12
-
13
- ### [Warp, the intelligent terminal for developers](https://www.warp.dev/?utm_source=npmjs&utm_medium=referral&utm_campaign=inquirer)
14
-
15
- [Inquirer's terminal of choice!](https://www.warp.dev/?utm_source=npmjs&utm_medium=referral&utm_campaign=inquirer)<br>
16
- [Available for MacOS and Linux](https://www.warp.dev/?utm_source=npmjs&utm_medium=referral&utm_campaign=inquirer)<br>
17
-
18
- </div>
19
-
20
7
  # Installation
21
8
 
22
9
  <table>
@@ -47,8 +47,8 @@ const hook_engine_js_1 = require("./hook-engine.js");
47
47
  const errors_js_1 = require("./errors.js");
48
48
  function getCallSites() {
49
49
  const _prepareStackTrace = Error.prepareStackTrace;
50
+ let result = [];
50
51
  try {
51
- let result = [];
52
52
  Error.prepareStackTrace = (_, callSites) => {
53
53
  const callSitesWithoutCurrent = callSites.slice(1);
54
54
  result = callSitesWithoutCurrent;
@@ -56,15 +56,17 @@ function getCallSites() {
56
56
  };
57
57
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions, unicorn/error-message
58
58
  new Error().stack;
59
- return result;
60
59
  }
61
- finally {
62
- Error.prepareStackTrace = _prepareStackTrace;
60
+ catch {
61
+ // An error will occur if the Node flag --frozen-intrinsics is used.
62
+ // https://nodejs.org/api/cli.html#--frozen-intrinsics
63
+ return result;
63
64
  }
65
+ Error.prepareStackTrace = _prepareStackTrace;
66
+ return result;
64
67
  }
65
68
  function createPrompt(view) {
66
69
  const callSites = getCallSites();
67
- const callerFilename = callSites[1]?.getFileName?.();
68
70
  const prompt = (config, context = {}) => {
69
71
  // Default `input` to stdin
70
72
  const { input = process.stdin, signal } = context;
@@ -114,6 +116,7 @@ function createPrompt(view) {
114
116
  // Typescript won't allow this, but not all users rely on typescript.
115
117
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
116
118
  if (nextView === undefined) {
119
+ const callerFilename = callSites[1]?.getFileName?.();
117
120
  throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`);
118
121
  }
119
122
  const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;
@@ -1,9 +1,9 @@
1
1
  import type { InquirerReadline } from '@inquirer/type';
2
2
  export default class ScreenManager {
3
- private readonly rl;
4
3
  private height;
5
4
  private extraLinesUnderPrompt;
6
5
  private cursorPos;
6
+ private readonly rl;
7
7
  constructor(rl: InquirerReadline);
8
8
  write(content: string): void;
9
9
  render(content: string, bottomContent?: string): void;
@@ -12,13 +12,12 @@ function cursorDown(n) {
12
12
  return n > 0 ? ansi_escapes_1.default.cursorDown(n) : '';
13
13
  }
14
14
  class ScreenManager {
15
- rl;
16
15
  // These variables are keeping information to allow correct prompt re-rendering
17
16
  height = 0;
18
17
  extraLinesUnderPrompt = 0;
19
18
  cursorPos;
19
+ rl;
20
20
  constructor(rl) {
21
- this.rl = rl;
22
21
  this.rl = rl;
23
22
  this.cursorPos = rl.getCursorPos();
24
23
  }
@@ -8,8 +8,8 @@ import { withHooks, effectScheduler } from './hook-engine.js';
8
8
  import { AbortPromptError, CancelPromptError, ExitPromptError } from './errors.js';
9
9
  function getCallSites() {
10
10
  const _prepareStackTrace = Error.prepareStackTrace;
11
+ let result = [];
11
12
  try {
12
- let result = [];
13
13
  Error.prepareStackTrace = (_, callSites) => {
14
14
  const callSitesWithoutCurrent = callSites.slice(1);
15
15
  result = callSitesWithoutCurrent;
@@ -17,15 +17,17 @@ function getCallSites() {
17
17
  };
18
18
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions, unicorn/error-message
19
19
  new Error().stack;
20
- return result;
21
20
  }
22
- finally {
23
- Error.prepareStackTrace = _prepareStackTrace;
21
+ catch {
22
+ // An error will occur if the Node flag --frozen-intrinsics is used.
23
+ // https://nodejs.org/api/cli.html#--frozen-intrinsics
24
+ return result;
24
25
  }
26
+ Error.prepareStackTrace = _prepareStackTrace;
27
+ return result;
25
28
  }
26
29
  export function createPrompt(view) {
27
30
  const callSites = getCallSites();
28
- const callerFilename = callSites[1]?.getFileName?.();
29
31
  const prompt = (config, context = {}) => {
30
32
  // Default `input` to stdin
31
33
  const { input = process.stdin, signal } = context;
@@ -75,6 +77,7 @@ export function createPrompt(view) {
75
77
  // Typescript won't allow this, but not all users rely on typescript.
76
78
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
77
79
  if (nextView === undefined) {
80
+ const callerFilename = callSites[1]?.getFileName?.();
78
81
  throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`);
79
82
  }
80
83
  const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView;
@@ -1,9 +1,9 @@
1
1
  import type { InquirerReadline } from '@inquirer/type';
2
2
  export default class ScreenManager {
3
- private readonly rl;
4
3
  private height;
5
4
  private extraLinesUnderPrompt;
6
5
  private cursorPos;
6
+ private readonly rl;
7
7
  constructor(rl: InquirerReadline);
8
8
  write(content: string): void;
9
9
  render(content: string, bottomContent?: string): void;
@@ -7,13 +7,12 @@ function cursorDown(n) {
7
7
  return n > 0 ? ansiEscapes.cursorDown(n) : '';
8
8
  }
9
9
  export default class ScreenManager {
10
- rl;
11
10
  // These variables are keeping information to allow correct prompt re-rendering
12
11
  height = 0;
13
12
  extraLinesUnderPrompt = 0;
14
13
  cursorPos;
14
+ rl;
15
15
  constructor(rl) {
16
- this.rl = rl;
17
16
  this.rl = rl;
18
17
  this.cursorPos = rl.getCursorPos();
19
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inquirer/core",
3
- "version": "10.1.6",
3
+ "version": "10.1.8",
4
4
  "description": "Core Inquirer prompt API",
5
5
  "keywords": [
6
6
  "answer",
@@ -74,8 +74,8 @@
74
74
  "tsc": "tshy"
75
75
  },
76
76
  "dependencies": {
77
- "@inquirer/figures": "^1.0.10",
78
- "@inquirer/type": "^3.0.4",
77
+ "@inquirer/figures": "^1.0.11",
78
+ "@inquirer/type": "^3.0.5",
79
79
  "ansi-escapes": "^4.3.2",
80
80
  "cli-width": "^4.1.0",
81
81
  "mute-stream": "^2.0.0",
@@ -84,11 +84,11 @@
84
84
  "yoctocolors-cjs": "^2.1.2"
85
85
  },
86
86
  "devDependencies": {
87
- "@arethetypeswrong/cli": "^0.17.3",
88
- "@inquirer/testing": "^2.1.43",
87
+ "@arethetypeswrong/cli": "^0.17.4",
88
+ "@inquirer/testing": "^2.1.45",
89
89
  "@repo/tsconfig": "workspace:*",
90
90
  "@types/mute-stream": "^0.0.4",
91
- "@types/node": "^22.13.0",
91
+ "@types/node": "^22.13.10",
92
92
  "@types/wrap-ansi": "^3.0.0",
93
93
  "tshy": "^3.0.2"
94
94
  },
@@ -115,5 +115,5 @@
115
115
  ".": "./src/index.ts"
116
116
  }
117
117
  },
118
- "gitHead": "b2709b82d621cd553adb26dd1c371cc957ba412e"
118
+ "gitHead": "79a0b3e7446b4a3de09445bf2f4031e4190b6382"
119
119
  }