From 1fca6660af0a22b7545c51b75bbcec0b6b5cad3f Mon Sep 17 00:00:00 2001 From: James M Snell Date: Sat, 11 Mar 2017 12:18:53 -0800 Subject: [PATCH 1/2] src: add --pending-deprecation and NODE_PENDING_DEPRECATION Command line flag and environment variable that can be used to indicate that pending deprecations should be emitted. --- 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 5e6390335bfef1..0f367998a38379 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`