Skip to content

Commit f182696

Browse files
joyeecheungrichardlau
authored andcommitted
doc: document non-node_modules-only runtime deprecation
We already have this special kind of runtime deprecation for Buffer constructors which does not fit into the original description of runtiem deprecations. Document this kind of deprecation separately. PR-URL: #50748 Reviewed-By: Geoffrey Booth <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent c91b817 commit f182696

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

doc/api/deprecations.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ Node.js APIs might be deprecated for any of the following reasons:
1010
* An improved alternative API is available.
1111
* Breaking changes to the API are expected in a future major release.
1212

13-
Node.js uses three kinds of Deprecations:
13+
Node.js uses four kinds of deprecations:
1414

1515
* Documentation-only
16-
* Runtime
16+
* Application (non-`node_modules` code only)
17+
* Runtime (all code)
1718
* End-of-Life
1819

1920
A Documentation-only deprecation is one that is expressed only within the
@@ -25,10 +26,17 @@ deprecations below. Documentation-only deprecations that support that flag
2526
are explicitly labeled as such in the
2627
[list of Deprecated APIs](#list-of-deprecated-apis).
2728

28-
A Runtime deprecation will, by default, generate a process warning that will
29-
be printed to `stderr` the first time the deprecated API is used. When the
30-
[`--throw-deprecation`][] command-line flag is used, a Runtime deprecation will
31-
cause an error to be thrown.
29+
An Application deprecation for only non-`node_modules` code will, by default,
30+
generate a process warning that will be printed to `stderr` the first time
31+
the deprecated API is used in code that's not loaded from `node_modules`.
32+
When the [`--throw-deprecation`][] command-line flag is used, a Runtime
33+
deprecation will cause an error to be thrown. When
34+
[`--pending-deprecation`][] is used, warnings will also be emitted for
35+
code loaded from `node_modules`.
36+
37+
A runtime deprecation for all code is similar to the runtime deprecation
38+
for non-`node_modules` code, except that it also emits a warning for
39+
code loaded from `node_modules`.
3240

3341
An End-of-Life deprecation is used when functionality is or will soon be removed
3442
from Node.js.
@@ -140,7 +148,7 @@ changes:
140148
description: Documentation-only deprecation.
141149
-->
142150

143-
Type: Runtime (supports [`--pending-deprecation`][])
151+
Type: Application (non-`node_modules` code only)
144152

145153
The `Buffer()` function and `new Buffer()` constructor are deprecated due to
146154
API usability issues that can lead to accidental security issues.

0 commit comments

Comments
 (0)