1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

feat: deprecate Deno.shutdown() (#22067)

For removal in Deno v2.

---------

Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
Asher Gomez 2024-01-24 13:47:48 +11:00 committed by GitHub
parent 4c0b66baab
commit 5a4d69354c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 2 deletions

View file

@ -397,6 +397,9 @@ declare namespace Deno {
* Deno.shutdown(conn.rid);
* ```
*
* @deprecated Use {@linkcode Deno.Conn.closeWrite} instead.
* {@linkcode Deno.shutdown} will be removed in Deno 2.0.
*
* @category Network
*/
export function shutdown(rid: number): Promise<void>;

View file

@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { core } from "ext:core/mod.js";
import { core, internals } from "ext:core/mod.js";
const {
op_net_listen_udp,
op_net_listen_unixpacket,
@ -117,7 +117,14 @@ const denoNs = {
connectTls: tls.connectTls,
listenTls: tls.listenTls,
startTls: tls.startTls,
shutdown: net.shutdown,
shutdown(rid) {
internals.warnOnDeprecatedApi(
"Deno.shutdown()",
new Error().stack,
"Use `Deno.Conn.closeWrite()` instead.",
);
net.shutdown(rid);
},
fstatSync: fs.fstatSync,
fstat: fs.fstat,
fsyncSync: fs.fsyncSync,