@inquirer/core
Advanced tools
Comparing version 10.1.0 to 10.1.1
@@ -38,3 +38,22 @@ "use strict"; | ||
const errors_js_1 = require("./errors.js"); | ||
function getCallSites() { | ||
const _prepareStackTrace = Error.prepareStackTrace; | ||
try { | ||
let result = []; | ||
Error.prepareStackTrace = (_, callSites) => { | ||
const callSitesWithoutCurrent = callSites.slice(1); | ||
result = callSitesWithoutCurrent; | ||
return callSitesWithoutCurrent; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, unicorn/error-message | ||
new Error().stack; | ||
return result; | ||
} | ||
finally { | ||
Error.prepareStackTrace = _prepareStackTrace; | ||
} | ||
} | ||
function createPrompt(view) { | ||
const callSites = getCallSites(); | ||
const callerFilename = callSites[1]?.getFileName?.(); | ||
const prompt = (config, context = {}) => { | ||
@@ -87,2 +106,7 @@ // Default `input` to stdin | ||
}); | ||
// Typescript won't allow this, but not all users rely on typescript. | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (nextView === undefined) { | ||
throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`); | ||
} | ||
const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView; | ||
@@ -89,0 +113,0 @@ screen.render(content, bottomContent); |
@@ -9,3 +9,22 @@ import * as readline from 'node:readline'; | ||
import { AbortPromptError, CancelPromptError, ExitPromptError } from './errors.js'; | ||
function getCallSites() { | ||
const _prepareStackTrace = Error.prepareStackTrace; | ||
try { | ||
let result = []; | ||
Error.prepareStackTrace = (_, callSites) => { | ||
const callSitesWithoutCurrent = callSites.slice(1); | ||
result = callSitesWithoutCurrent; | ||
return callSitesWithoutCurrent; | ||
}; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions, unicorn/error-message | ||
new Error().stack; | ||
return result; | ||
} | ||
finally { | ||
Error.prepareStackTrace = _prepareStackTrace; | ||
} | ||
} | ||
export function createPrompt(view) { | ||
const callSites = getCallSites(); | ||
const callerFilename = callSites[1]?.getFileName?.(); | ||
const prompt = (config, context = {}) => { | ||
@@ -58,2 +77,7 @@ // Default `input` to stdin | ||
}); | ||
// Typescript won't allow this, but not all users rely on typescript. | ||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition | ||
if (nextView === undefined) { | ||
throw new Error(`Prompt functions must return a string.\n at ${callerFilename}`); | ||
} | ||
const [content, bottomContent] = typeof nextView === 'string' ? [nextView] : nextView; | ||
@@ -60,0 +84,0 @@ screen.render(content, bottomContent); |
{ | ||
"name": "@inquirer/core", | ||
"version": "10.1.0", | ||
"version": "10.1.1", | ||
"description": "Core Inquirer prompt API", | ||
@@ -89,6 +89,6 @@ "keywords": [ | ||
"@arethetypeswrong/cli": "^0.17.0", | ||
"@inquirer/testing": "^2.1.37", | ||
"@inquirer/testing": "^2.1.38", | ||
"@repo/tsconfig": "workspace:*", | ||
"@types/mute-stream": "^0.0.4", | ||
"@types/node": "^22.9.0", | ||
"@types/node": "^22.10.1", | ||
"@types/wrap-ansi": "^3.0.0", | ||
@@ -112,3 +112,3 @@ "tshy": "^3.0.2" | ||
}, | ||
"gitHead": "84e49bdb552e1cb4f035d644190913f367a66e74" | ||
"gitHead": "5713287885155c0081fca4190c17c18c598d9602" | ||
} |
@@ -299,3 +299,3 @@ # `@inquirer/core` | ||
The [default theme keys cover](https://github.com/SBoudrias/Inquirer.js/blob/theme/packages/core/src/lib/theme.mts): | ||
The [default theme keys cover](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/core/src/lib/theme.ts): | ||
@@ -325,10 +325,10 @@ ```ts | ||
- [Confirm Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/src/index.mts) | ||
- [Input Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/input/src/index.mts) | ||
- [Password Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/password/src/index.mts) | ||
- [Editor Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/editor/src/index.mts) | ||
- [Select Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/src/index.mts) | ||
- [Checkbox Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/checkbox/src/index.mts) | ||
- [Rawlist Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/rawlist/src/index.mts) | ||
- [Expand Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/expand/src/index.mts) | ||
- [Confirm Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/confirm/src/index.ts) | ||
- [Input Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/input/src/index.ts) | ||
- [Password Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/password/src/index.ts) | ||
- [Editor Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/editor/src/index.ts) | ||
- [Select Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/select/src/index.ts) | ||
- [Checkbox Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/checkbox/src/index.ts) | ||
- [Rawlist Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/rawlist/src/index.ts) | ||
- [Expand Prompt](https://github.com/SBoudrias/Inquirer.js/blob/main/packages/expand/src/index.ts) | ||
@@ -335,0 +335,0 @@ ```ts |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
99424
2222