summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-03-22 00:30:21 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-04-10 00:43:41 +0200
commit9d4ab9011796902a086ca12b0a18088e2fb35cd4 (patch)
tree9e8e5076a53ce845af0c9a0893d5e7482c4ad227 /doc
parente048b1552363df05d21ef3fa0054d9ab6b801df4 (diff)
downloadandroid-node-v8-9d4ab9011796902a086ca12b0a18088e2fb35cd4.tar.gz
android-node-v8-9d4ab9011796902a086ca12b0a18088e2fb35cd4.tar.bz2
android-node-v8-9d4ab9011796902a086ca12b0a18088e2fb35cd4.zip
buffer: do deprecation warning outside `node_modules`
In addition to `--pending-deprecation`, emit a deprecation warning for usage of the `Buffer()` constructor for call sites that are outside of `node_modules`. The goal of this is to better target developers, rather than burdening users with an omnipresent and quickly ignored warning. This implements the result of a TSC meeting discussion from March 22, 2018. PR-URL: https://github.com/nodejs/node/pull/19524 Refs: https://github.com/nodejs/node/issues/19079#issuecomment-375121443 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Rod Vagg <rod@vagg.org> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/buffer.md20
-rw-r--r--doc/api/deprecations.md6
2 files changed, 25 insertions, 1 deletions
diff --git a/doc/api/buffer.md b/doc/api/buffer.md
index 2ea989e7fe..fbd7ace6b6 100644
--- a/doc/api/buffer.md
+++ b/doc/api/buffer.md
@@ -304,6 +304,10 @@ It can be constructed in a variety of ways.
<!-- YAML
deprecated: v6.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19524
+ description: Calling this constructor emits a deprecation warning when
+ run from code outside the `node_modules` directory.
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
@@ -328,6 +332,10 @@ const buf = new Buffer([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]);
added: v3.0.0
deprecated: v6.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19524
+ description: Calling this constructor emits a deprecation warning when
+ run from code outside the `node_modules` directory.
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
@@ -380,6 +388,10 @@ console.log(buf);
<!-- YAML
deprecated: v6.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19524
+ description: Calling this constructor emits a deprecation warning when
+ run from code outside the `node_modules` directory.
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
@@ -410,6 +422,10 @@ console.log(buf2.toString());
<!-- YAML
deprecated: v6.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19524
+ description: Calling this constructor emits a deprecation warning when
+ run from code outside the `node_modules` directory.
- version: v8.0.0
pr-url: https://github.com/nodejs/node/pull/12141
description: new Buffer(size) will return zero-filled memory by default.
@@ -447,6 +463,10 @@ console.log(buf);
<!-- YAML
deprecated: v6.0.0
changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/19524
+ description: Calling this constructor emits a deprecation warning when
+ run from code outside the `node_modules` directory.
- version: v7.2.1
pr-url: https://github.com/nodejs/node/pull/9529
description: Calling this constructor no longer emits a deprecation warning.
diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md
index 6fd8d1d4f5..b78244b5d5 100644
--- a/doc/api/deprecations.md
+++ b/doc/api/deprecations.md
@@ -72,7 +72,7 @@ be used.
<a id="DEP0005"></a>
### DEP0005: Buffer() constructor
-Type: Documentation-only (supports [`--pending-deprecation`][])
+Type: Runtime (supports [`--pending-deprecation`][])
The `Buffer()` function and `new Buffer()` constructor are deprecated due to
API usability issues that can potentially lead to accidental security issues.
@@ -93,6 +93,10 @@ is strongly recommended:
* [`Buffer.from(string[, encoding])`][from_string_encoding] - Create a `Buffer`
that copies `string`.
+As of REPLACEME, a deprecation warning is printed at runtime when
+`--pending-deprecation` is used or when the calling code is
+outside `node_modules` in order to better target developers, rather than users.
+
<a id="DEP0006"></a>
### DEP0006: child\_process options.customFds