From a16b570f8c1283db81b85ff78ce73608a4265f61 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 11 Mar 2017 12:18:53 -0800 Subject: [PATCH] src: add --pending-deprecation and NODE_PENDING_DEPRECATION MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Command line flag and environment variable that can be used to indicate that pending deprecations should be emitted. PR-URL: https://github.com/nodejs/node/pull/11968 Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: Michael Dawson Reviewed-By: Сковорода Никита Андреевич Reviewed-By: James M Snell --- doc/api/cli.md | 28 ++++++++++++++ doc/node.1 | 8 ++++ src/node.cc | 12 ++++++ src/node_config.cc | 3 ++ src/node_internals.h | 4 ++ test/parallel/test-pending-deprecation.js | 45 +++++++++++++++++++++++ 6 files changed, 100 insertions(+) create mode 100644 test/parallel/test-pending-deprecation.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 8e5915d5f9..e003d38fe2 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -137,6 +137,20 @@ added: v0.11.14 Throw errors for deprecations. +### `--pending-deprecation` + + +Emit pending deprecation warnings. + +*Note*: Pending deprecations are generally identical to a runtime deprecation +with the notable exception that they are turned *off* by default and will not +be emitted unless either the `--pending-deprecation` command line flag, or the +`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations +are used to provide a kind of selective "early warning" mechanism that +developers may leverage to detect deprecated API usage. + ### `--no-warnings` + +When set to `1`, emit pending deprecation warnings. + +*Note*: Pending deprecations are generally identical to a runtime deprecation +with the notable exception that they are turned *off* by default and will not +be emitted unless either the `--pending-deprecation` command line flag, or the +`NODE_PENDING_DEPRECATION=1` environment variable, is set. Pending deprecations +are used to provide a kind of selective "early warning" mechanism that +developers may leverage to detect deprecated API usage. + ### `NODE_PRESERVE_SYMLINKS=1`