From 6a6e2446efa0a014c7f8fa69e29a3db139fbf6f2 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 28 Aug 2024 15:21:43 +1000 Subject: [PATCH] BREAKING(net): remove `Deno.shutdown()` --- ext/net/01_net.js | 7 +------ ext/net/lib.deno_net.d.ts | 18 ------------------ runtime/js/90_deno_ns.js | 8 -------- runtime/js/99_main.js | 2 -- tests/specs/future/runtime_api/main.js | 1 - tests/specs/future/runtime_api/main.out | 1 - 6 files changed, 1 insertion(+), 36 deletions(-) diff --git a/ext/net/01_net.js b/ext/net/01_net.js index a41a27543ae9b7..87bbcd476ff052 100644 --- a/ext/net/01_net.js +++ b/ext/net/01_net.js @@ -63,10 +63,6 @@ async function write(rid, data) { return await core.write(rid, data); } -function shutdown(rid) { - return core.shutdown(rid); -} - async function resolveDns(query, recordType, options) { let cancelRid; let abortHandler; @@ -164,7 +160,7 @@ class Conn { } closeWrite() { - return shutdown(this.#rid); + return core.shutdown(this.#rid); } get readable() { @@ -647,7 +643,6 @@ export { Listener, listenOptionApiName, resolveDns, - shutdown, TcpConn, UnixConn, validatePort, diff --git a/ext/net/lib.deno_net.d.ts b/ext/net/lib.deno_net.d.ts index 13fbd35148686e..382a3ab8d92497 100644 --- a/ext/net/lib.deno_net.d.ts +++ b/ext/net/lib.deno_net.d.ts @@ -528,22 +528,4 @@ declare namespace Deno { conn: TcpConn, options?: StartTlsOptions, ): Promise; - - /** Shutdown socket send operations. - * - * Matches behavior of POSIX shutdown(3). - * - * ```ts - * const listener = Deno.listen({ port: 80 }); - * const conn = await listener.accept(); - * Deno.shutdown(conn.rid); - * ``` - * - * @deprecated This will be 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. - * - * @category Network - */ - export function shutdown(rid: number): Promise; } diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index cf3e445c9cb8ff..8625cf8c499025 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -190,14 +190,6 @@ const denoNs = { connectTls: tls.connectTls, listenTls: tls.listenTls, startTls: tls.startTls, - shutdown(rid) { - internals.warnOnDeprecatedApi( - "Deno.shutdown()", - new Error().stack, - "Use `Deno.Conn.closeWrite()` instead.", - ); - net.shutdown(rid); - }, fstatSync(rid) { internals.warnOnDeprecatedApi( "Deno.fstatSync()", diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js index 8b0d579ab539cb..4df296b498df4f 100644 --- a/runtime/js/99_main.js +++ b/runtime/js/99_main.js @@ -958,7 +958,6 @@ function bootstrapMainRuntime(runtimeOptions, warmup = false) { delete Deno.resources; delete Deno.seek; delete Deno.seekSync; - delete Deno.shutdown; delete Deno.writeAll; delete Deno.writeAllSync; delete Deno.write; @@ -1148,7 +1147,6 @@ function bootstrapWorkerRuntime( delete Deno.resources; delete Deno.seek; delete Deno.seekSync; - delete Deno.shutdown; delete Deno.writeAll; delete Deno.writeAllSync; delete Deno.write; diff --git a/tests/specs/future/runtime_api/main.js b/tests/specs/future/runtime_api/main.js index eac8ed194ab555..45641ba9a43db4 100644 --- a/tests/specs/future/runtime_api/main.js +++ b/tests/specs/future/runtime_api/main.js @@ -25,7 +25,6 @@ console.log("Deno.readSync is", Deno.readSync); console.log("Deno.resources is", Deno.resources); console.log("Deno.seek is", Deno.seek); console.log("Deno.seekSync is", Deno.seekSync); -console.log("Deno.shutdown is", Deno.shutdown); console.log("Deno.writeAll is", Deno.writeAll); console.log("Deno.writeAllSync is", Deno.writeAllSync); console.log("Deno.write is", Deno.write); diff --git a/tests/specs/future/runtime_api/main.out b/tests/specs/future/runtime_api/main.out index 4712a06b06c68a..6b504de1ecfc23 100644 --- a/tests/specs/future/runtime_api/main.out +++ b/tests/specs/future/runtime_api/main.out @@ -22,7 +22,6 @@ Deno.readSync is undefined Deno.resources is undefined Deno.seek is undefined Deno.seekSync is undefined -Deno.shutdown is undefined Deno.writeAll is undefined Deno.writeAllSync is undefined Deno.write is undefined