mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 20:38:55 +00:00
chore: soft-remove Deno.{stdin,stderr,stdout}.rid
(#25479)
Towards #22079
This commit is contained in:
parent
292344af42
commit
5bac4075c3
27
cli/tsc/dts/lib.deno.ns.d.ts
vendored
27
cli/tsc/dts/lib.deno.ns.d.ts
vendored
@ -2468,15 +2468,6 @@ declare namespace Deno {
|
||||
* @category I/O
|
||||
*/
|
||||
export const stdin: Reader & ReaderSync & Closer & {
|
||||
/**
|
||||
* The resource ID assigned to `stdin`. This can be used with the discrete
|
||||
* I/O functions in the `Deno` namespace.
|
||||
*
|
||||
* @deprecated This will be soft-removed in Deno 2.0. See the
|
||||
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
|
||||
* for migration instructions.
|
||||
*/
|
||||
readonly rid: number;
|
||||
/** A readable stream interface to `stdin`. */
|
||||
readonly readable: ReadableStream<Uint8Array>;
|
||||
/**
|
||||
@ -2516,15 +2507,6 @@ declare namespace Deno {
|
||||
* @category I/O
|
||||
*/
|
||||
export const stdout: Writer & WriterSync & Closer & {
|
||||
/**
|
||||
* The resource ID assigned to `stdout`. This can be used with the discrete
|
||||
* I/O functions in the `Deno` namespace.
|
||||
*
|
||||
* @deprecated This will be soft-removed in Deno 2.0. See the
|
||||
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
|
||||
* for migration instructions.
|
||||
*/
|
||||
readonly rid: number;
|
||||
/** A writable stream interface to `stdout`. */
|
||||
readonly writable: WritableStream<Uint8Array>;
|
||||
/**
|
||||
@ -2550,15 +2532,6 @@ declare namespace Deno {
|
||||
* @category I/O
|
||||
*/
|
||||
export const stderr: Writer & WriterSync & Closer & {
|
||||
/**
|
||||
* The resource ID assigned to `stderr`. This can be used with the discrete
|
||||
* I/O functions in the `Deno` namespace.
|
||||
*
|
||||
* @deprecated This will be soft-removed in Deno 2.0. See the
|
||||
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
|
||||
* for migration instructions.
|
||||
*/
|
||||
readonly rid: number;
|
||||
/** A writable stream interface to `stderr`. */
|
||||
readonly writable: WritableStream<Uint8Array>;
|
||||
/**
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Documentation liberally lifted from them too.
|
||||
// Thank you! We love Go! <3
|
||||
|
||||
import { core, internals, primordials } from "ext:core/mod.js";
|
||||
import { core, primordials } from "ext:core/mod.js";
|
||||
import { op_set_raw } from "ext:core/ops";
|
||||
const {
|
||||
Uint8Array,
|
||||
@ -121,11 +121,6 @@ class Stdin {
|
||||
}
|
||||
|
||||
get rid() {
|
||||
internals.warnOnDeprecatedApi(
|
||||
"Deno.stdin.rid",
|
||||
new Error().stack,
|
||||
"Use `Deno.stdin` instance methods instead.",
|
||||
);
|
||||
return this.#rid;
|
||||
}
|
||||
|
||||
@ -186,11 +181,6 @@ class Stdout {
|
||||
}
|
||||
|
||||
get rid() {
|
||||
internals.warnOnDeprecatedApi(
|
||||
"Deno.stdout.rid",
|
||||
new Error().stack,
|
||||
"Use `Deno.stdout` instance methods instead.",
|
||||
);
|
||||
return this.#rid;
|
||||
}
|
||||
|
||||
@ -226,11 +216,6 @@ class Stderr {
|
||||
}
|
||||
|
||||
get rid() {
|
||||
internals.warnOnDeprecatedApi(
|
||||
"Deno.stderr.rid",
|
||||
new Error().stack,
|
||||
"Use `Deno.stderr` instance methods instead.",
|
||||
);
|
||||
return this.#rid;
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,11 @@ import { copy } from "@std/io/copy";
|
||||
// Note tests for Deno.FsFile.setRaw is in integration tests.
|
||||
|
||||
Deno.test(function filesStdioFileDescriptors() {
|
||||
// @ts-ignore `Deno.stdin.rid` was soft-removed in Deno 2.
|
||||
assertEquals(Deno.stdin.rid, 0);
|
||||
// @ts-ignore `Deno.stdout.rid` was soft-removed in Deno 2.
|
||||
assertEquals(Deno.stdout.rid, 1);
|
||||
// @ts-ignore `Deno.stderr.rid` was soft-removed in Deno 2.
|
||||
assertEquals(Deno.stderr.rid, 2);
|
||||
});
|
||||
|
||||
|
@ -461,6 +461,7 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "process.stdin",
|
||||
fn() {
|
||||
// @ts-ignore `Deno.stdin.rid` was soft-removed in Deno 2.
|
||||
assertEquals(process.stdin.fd, Deno.stdin.rid);
|
||||
assertEquals(process.stdin.isTTY, Deno.stdin.isTerminal());
|
||||
},
|
||||
@ -640,6 +641,7 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "process.stdout",
|
||||
fn() {
|
||||
// @ts-ignore `Deno.stdout.rid` was soft-removed in Deno 2.
|
||||
assertEquals(process.stdout.fd, Deno.stdout.rid);
|
||||
const isTTY = Deno.stdout.isTerminal();
|
||||
assertEquals(process.stdout.isTTY, isTTY);
|
||||
@ -668,6 +670,7 @@ Deno.test({
|
||||
Deno.test({
|
||||
name: "process.stderr",
|
||||
fn() {
|
||||
// @ts-ignore `Deno.stderr.rid` was soft-removed in Deno 2.
|
||||
assertEquals(process.stderr.fd, Deno.stderr.rid);
|
||||
const isTTY = Deno.stderr.isTerminal();
|
||||
assertEquals(process.stderr.isTTY, isTTY);
|
||||
|
@ -7,9 +7,9 @@ import tty from "node:tty";
|
||||
import process from "node:process";
|
||||
|
||||
Deno.test("[node/tty isatty] returns true when fd is a tty, false otherwise", () => {
|
||||
assert(Deno.stdin.isTerminal() === isatty(Deno.stdin.rid));
|
||||
assert(Deno.stdout.isTerminal() === isatty(Deno.stdout.rid));
|
||||
assert(Deno.stderr.isTerminal() === isatty(Deno.stderr.rid));
|
||||
assert(Deno.stdin.isTerminal() === isatty((Deno as any).stdin.rid));
|
||||
assert(Deno.stdout.isTerminal() === isatty((Deno as any).stdout.rid));
|
||||
assert(Deno.stderr.isTerminal() === isatty((Deno as any).stderr.rid));
|
||||
|
||||
using file = Deno.openSync("README.md");
|
||||
assert(!isatty(file.rid));
|
||||
|
Loading…
Reference in New Issue
Block a user