diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-01-24 14:57:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 14:57:54 +0100 |
commit | 064a6c048ab420302cbb822bedd3fc365b4259a7 (patch) | |
tree | 1aa6ee2716f2cc30e74dd97818330a5e2d154a07 /ext/io/12_io.js | |
parent | 745333f073aba4c97e7d06c731063105493cde5a (diff) |
feat: Add warnings for more deprecated APIs (#21992)
Follow up to https://github.com/denoland/deno/pull/21939 that adds
deprecation warnings to more `Deno` APIs:
- `Deno.copy()`
- `Deno.iter()`
- `Deno.iterSync()`
- `new Deno.Buffer()`
- `Deno.readAll()`
- `Deno.readAllSync()`
- `Deno.writeAll()`
- `Deno.writeAllSync()`
- `Deno.FsWatcher.return`
- `Deno.serveHttp()`
- `Deno.metrics()`
---------
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Co-authored-by: Asher Gomez <ashersaupingomez@gmail.com>
Diffstat (limited to 'ext/io/12_io.js')
-rw-r--r-- | ext/io/12_io.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/io/12_io.js b/ext/io/12_io.js index 9f4a3766b..2a0d589a7 100644 --- a/ext/io/12_io.js +++ b/ext/io/12_io.js @@ -3,8 +3,7 @@ // Interfaces 100% copied from Go. // Documentation liberally lifted from them too. // Thank you! We love Go! <3 - -import { core, primordials } from "ext:core/mod.js"; +import { core, internals, primordials } from "ext:core/mod.js"; const { op_stdin_set_raw, op_is_terminal, @@ -40,6 +39,11 @@ async function copy( dst, options, ) { + internals.warnOnDeprecatedApi( + "Deno.copy()", + new Error().stack, + "Use `copy()` from `https://deno.land/std/io/copy.ts` instead.", + ); let n = 0; const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const b = new Uint8Array(bufSize); @@ -65,6 +69,11 @@ async function* iter( r, options, ) { + internals.warnOnDeprecatedApi( + "Deno.iter()", + new Error().stack, + "Use `ReadableStream` instead.", + ); const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const b = new Uint8Array(bufSize); while (true) { @@ -81,6 +90,11 @@ function* iterSync( r, options, ) { + internals.warnOnDeprecatedApi( + "Deno.iterSync()", + new Error().stack, + "Use `ReadableStream` instead.", + ); const bufSize = options?.bufSize ?? DEFAULT_BUFFER_SIZE; const b = new Uint8Array(bufSize); while (true) { |