From 7eaf98c74180842867a7059186ea6aa2e658ce8c Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 5 Nov 2016 17:05:20 -0700 Subject: [PATCH 1/2] lib: add --deprecate-soon and util.deprecateSoon() This adds a non-intrusive mechanism for indicating that an API is expected to be deprecated "soon" where "soon" means at least the next semver-major Node.js release. The `DeprecateSoonWarning` is only emitted if the `--deprecate-soon` command line option is used which means the option will have zero impact for most situations. For those developers who wish to be proactively alerted to pending deprecations, use of the `--deprecate-soon` option can be used in testing/CI environments to determine which APIs may end up deprecated in the future. It should be noted that a "deprecate soon" warning is just a heads up, and that a decision can be made later NOT to deprecate the API if the change is deemed to be too intrusive. --- doc/api/cli.md | 7 ++++++ doc/node.1 | 4 +++ lib/internal/util.js | 30 ++++++++++++++++++++++ src/node.cc | 10 ++++++++ src/node_config.cc | 3 +++ src/node_internals.h | 2 ++ test/parallel/test-deprecate-soon.js | 37 ++++++++++++++++++++++++++++ 7 files changed, 93 insertions(+) create mode 100644 test/parallel/test-deprecate-soon.js diff --git a/doc/api/cli.md b/doc/api/cli.md index b45dc8c63f86b3..802302486d6b93 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -107,6 +107,13 @@ added: v0.11.14 Throw errors for deprecations. +### `--deprecate-soon` + + +Show warnings for APIs that are expected to be deprecated soon. + ### `--no-warnings` -Show warnings for APIs that are expected to be deprecated soon. +Show warnings for APIs that have been deprecated in the documentation. ### `--no-warnings`