File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2203,6 +2203,9 @@ The `produceCachedData` option is deprecated. Use
22032203
22042204<!-- YAML
22052205changes:
2206+ - version: REPLACEME
2207+ pr-url: https://github.com/nodejs/node/pull/26500
2208+ description: Runtime deprecation.
22062209 - version: v11.12.0
22072210 pr-url: https://github.com/nodejs/node/pull/26500
22082211 description: Added support for `--pending-deprecation`.
@@ -2211,7 +2214,7 @@ changes:
22112214 description: Documentation-only deprecation.
22122215-->
22132216
2214- Type: Documentation-only (supports [ ` --pending-deprecation ` ] [ ] )
2217+ Type: Runtime (supports [ ` --pending-deprecation ` ] [ ] )
22152218
22162219` process.binding() ` is for use by Node.js internal code only.
22172220
Original file line number Diff line number Diff line change @@ -116,15 +116,6 @@ const processBindingAllowList = new SafeSet([
116116 'zlib' ,
117117] ) ;
118118
119- const runtimeDeprecatedList = new SafeSet ( [
120- 'async_wrap' ,
121- 'crypto' ,
122- 'http_parser' ,
123- 'signal_wrap' ,
124- 'url' ,
125- 'v8' ,
126- ] ) ;
127-
128119const legacyWrapperList = new SafeSet ( [
129120 'natives' ,
130121 'util' ,
@@ -146,16 +137,7 @@ const experimentalModuleList = new SafeSet();
146137
147138 process . binding = function binding ( module ) {
148139 module = String ( module ) ;
149- // Deprecated specific process.binding() modules, but not all, allow
150- // selective fallback to internalBinding for the deprecated ones.
151140 if ( processBindingAllowList . has ( module ) ) {
152- if ( runtimeDeprecatedList . has ( module ) ) {
153- runtimeDeprecatedList . delete ( module ) ;
154- process . emitWarning (
155- `Access to process.binding('${ module } ') is deprecated.` ,
156- 'DeprecationWarning' ,
157- 'DEP0111' ) ;
158- }
159141 if ( legacyWrapperList . has ( module ) ) {
160142 return requireBuiltin ( 'internal/legacy/processbinding' ) [ module ] ( ) ;
161143 }
Original file line number Diff line number Diff line change @@ -477,11 +477,10 @@ function initializeDeprecations() {
477477 } ) ;
478478 }
479479
480+ process . binding = deprecate ( process . binding ,
481+ 'process.binding() is deprecated. ' +
482+ 'Please use public APIs instead.' , 'DEP0111' ) ;
480483 if ( pendingDeprecation ) {
481- process . binding = deprecate ( process . binding ,
482- 'process.binding() is deprecated. ' +
483- 'Please use public APIs instead.' , 'DEP0111' ) ;
484-
485484 process . _tickCallback = deprecate ( process . _tickCallback ,
486485 'process._tickCallback() is deprecated' ,
487486 'DEP0134' ) ;
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+
3+ const common = require ( '../common' ) ;
4+ const assert = require ( 'assert' ) ;
5+ const { spawnSync } = require ( 'child_process' ) ;
6+
7+ // Assert that all allowed process.binding modules are
8+ // runtime deprecated.
9+ const processBindingAllowList = [
10+ 'async_wrap' ,
11+ 'buffer' ,
12+ 'cares_wrap' ,
13+ 'config' ,
14+ 'constants' ,
15+ 'contextify' ,
16+ 'crypto' ,
17+ 'fs' ,
18+ 'fs_event_wrap' ,
19+ 'http_parser' ,
20+ 'icu' ,
21+ 'inspector' ,
22+ 'js_stream' ,
23+ 'natives' ,
24+ 'os' ,
25+ 'pipe_wrap' ,
26+ 'process_wrap' ,
27+ 'signal_wrap' ,
28+ 'spawn_sync' ,
29+ 'stream_wrap' ,
30+ 'tcp_wrap' ,
31+ 'tls_wrap' ,
32+ 'tty_wrap' ,
33+ 'udp_wrap' ,
34+ 'url' ,
35+ 'util' ,
36+ 'uv' ,
37+ 'v8' ,
38+ 'zlib' ,
39+ ] ;
40+
41+ const requireCryptoModules = [ 'crypto' , 'tls_wrap' ] ;
42+ const requireIntlModules = [ 'icu' ] ;
43+
44+ for ( const module of processBindingAllowList ) {
45+ if ( requireCryptoModules . includes ( module ) && ! common . hasCrypto ) {
46+ continue ;
47+ }
48+
49+ if ( requireIntlModules . includes ( module ) && ! common . hasIntl ) {
50+ continue ;
51+ }
52+
53+ const { stderr } = spawnSync (
54+ process . execPath ,
55+ [
56+ '-p' , `process.binding('${ module } ');` ,
57+ ]
58+ ) ;
59+ assert . match ( stderr . toString ( ) , / p r o c e s s \. b i n d i n g \( \) i s d e p r e c a t e d / ) ;
60+ }
You can’t perform that action at this time.
0 commit comments