From 4c5ce9088328b620847f22b1161a41261675f8c9 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 24 Jan 2024 15:08:59 +1100 Subject: [PATCH] chore: update `Deno.{fsync,fsyncSync}()` deprecation notices (#22071) To align with other deprecations. --- cli/tsc/dts/lib.deno.ns.d.ts | 8 ++++---- ext/fs/30_fs.js | 10 ---------- runtime/js/90_deno_ns.js | 18 ++++++++++++++++-- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/cli/tsc/dts/lib.deno.ns.d.ts b/cli/tsc/dts/lib.deno.ns.d.ts index 2b82fa1523..8759306dfe 100644 --- a/cli/tsc/dts/lib.deno.ns.d.ts +++ b/cli/tsc/dts/lib.deno.ns.d.ts @@ -2168,8 +2168,8 @@ declare namespace Deno { * console.log(await Deno.readTextFile("my_file.txt")); // H * ``` * - * @deprecated Use `file.sync()` instead. {@linkcode Deno.fsync} will be - * removed in v2.0.0. + * @deprecated Use {@linkcode Deno.FsFile.sync} instead. + * {@linkcode Deno.fsync} will be removed in Deno 2.0. * * @category I/O */ @@ -2190,8 +2190,8 @@ declare namespace Deno { * console.log(Deno.readTextFileSync("my_file.txt")); // H * ``` * - * @deprecated Use `file.syncSync()` instead. {@linkcode Deno.fsyncSync} will - * be removed in v2.0.0. + * @deprecated Use {@linkcode Deno.FsFile.syncSync} instead. + * {@linkcode Deno.fsyncSync} will be removed in Deno 2.0. * * @category I/O */ diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 6923741eea..d0f7a2fad3 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -576,20 +576,10 @@ async function fdatasync(rid) { } function fsyncSync(rid) { - internals.warnOnDeprecatedApi( - "Deno.fsyncSync()", - new Error().stack, - "Use `file.syncSync()` instead.", - ); op_fs_fsync_sync(rid); } async function fsync(rid) { - internals.warnOnDeprecatedApi( - "Deno.fsync()", - new Error().stack, - "Use `file.sync()` instead.", - ); await op_fs_fsync_async(rid); } diff --git a/runtime/js/90_deno_ns.js b/runtime/js/90_deno_ns.js index 7ef807140d..452c62725d 100644 --- a/runtime/js/90_deno_ns.js +++ b/runtime/js/90_deno_ns.js @@ -127,8 +127,22 @@ const denoNs = { }, fstatSync: fs.fstatSync, fstat: fs.fstat, - fsyncSync: fs.fsyncSync, - fsync: fs.fsync, + fsyncSync(rid) { + internals.warnOnDeprecatedApi( + "Deno.fsyncSync()", + new Error().stack, + "Use `Deno.FsFile.syncSync()` instead.", + ); + fs.fsyncSync(rid); + }, + async fsync(rid) { + internals.warnOnDeprecatedApi( + "Deno.fsync()", + new Error().stack, + "Use `Deno.FsFile.sync()` instead.", + ); + await fs.fsync(rid); + }, fdatasyncSync: fs.fdatasyncSync, fdatasync: fs.fdatasync, symlink: fs.symlink,