@deno/shim-prompts
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,9 +0,9 @@ | ||
export declare const alert: (typeof globalThis) extends { | ||
[P in "alert"]: infer T; | ||
export declare const alert: typeof globalThis extends { | ||
alert: infer T; | ||
} ? T : (message?: any) => void; | ||
export declare const confirm: (typeof globalThis) extends { | ||
[P in "confirm"]: infer T; | ||
export declare const confirm: typeof globalThis extends { | ||
confirm: infer T; | ||
} ? T : (message?: string) => boolean; | ||
export declare const prompt: (typeof globalThis) extends { | ||
[P in "prompt"]: infer T; | ||
export declare const prompt: typeof globalThis extends { | ||
prompt: infer T; | ||
} ? T : (message?: string, _default?: string) => string | null; |
@@ -16,6 +16,6 @@ "use strict"; | ||
}; | ||
exports.prompt = (_c = globalThis["prompt"]) !== null && _c !== void 0 ? _c : function prompt(message, defaultValue = undefined) { | ||
(0, fs_1.writeSync)(process.stdout.fd, new TextEncoder().encode(`${message} ${defaultValue == null ? "" : `[${defaultValue}]`} `)); | ||
exports.prompt = (_c = globalThis["prompt"]) !== null && _c !== void 0 ? _c : function prompt(message = "Prompt", defaultValue) { | ||
(0, fs_1.writeSync)(process.stdout.fd, new TextEncoder().encode(`${message}${defaultValue ? ` [${defaultValue}]` : ""} `)); | ||
const result = (0, readlineSync_js_1.readlineSync)(); | ||
return result.length > 0 ? result : defaultValue !== null && defaultValue !== void 0 ? defaultValue : null; | ||
}; |
export declare function readlineSync(): string; |
@@ -12,3 +12,3 @@ "use strict"; | ||
try { | ||
const bytesRead = (0, fs_1.readSync)(process.stdin.fd, buf, 0, 1, 0); | ||
const bytesRead = (0, fs_1.readSync)(process.stdin.fd, buf); | ||
if (bytesRead === 0) { | ||
@@ -19,3 +19,2 @@ return line; | ||
catch (err) { | ||
// @ts-expect-error Property 'code' does not exist on type 'Error'. | ||
if (err.code === "EOF") { | ||
@@ -29,3 +28,3 @@ return line; | ||
if (char === "\r") { | ||
(0, fs_1.readSync)(process.stdin.fd, buf, 0, 1, 0); | ||
(0, fs_1.readSync)(process.stdin.fd, buf); | ||
} | ||
@@ -32,0 +31,0 @@ return line; |
{ | ||
"name": "@deno/shim-prompts", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "alert, confirm, and prompt for Node.js", | ||
@@ -8,3 +8,2 @@ "main": "dist/index.js", | ||
"scripts": { | ||
"prepare": "echo \"Prepared.\"", | ||
"build": "tsc", | ||
@@ -18,3 +17,3 @@ "test": "echo \"No tests yet\"" | ||
"type": "git", | ||
"url": "git+https://github.com/denoland/deno.ns.git" | ||
"url": "git+https://github.com/denoland/node_deno_shims.git" | ||
}, | ||
@@ -30,9 +29,9 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/denoland/deno.ns/issues" | ||
"url": "https://github.com/denoland/node_deno_shims/issues" | ||
}, | ||
"homepage": "https://github.com/denoland/deno.ns#readme", | ||
"homepage": "https://github.com/denoland/node_deno_shims#readme", | ||
"devDependencies": { | ||
"@types/node": "^16.4.13", | ||
"typescript": "^4.5.2" | ||
"@types/node": "^20.9.0", | ||
"typescript": "^5.2.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
4334
60