| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f182696 commit be3205a
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,34 +87,26 @@ ObjectDefineProperty(process, 'moduleLoadList', { | |||
| 87 | 87 | // more, we just implement them as legacy wrappers instead. See the | |
| 88 | 88 | // legacyWrapperList. | |
| 89 | 89 | const processBindingAllowList = new SafeSet([ | |
| 90 | - 'async_wrap', | ||
| 91 | 90 | 'buffer', | |
| 92 | 91 | 'cares_wrap', | |
| 93 | 92 | 'config', | |
| 94 | 93 | 'constants', | |
| 95 | 94 | 'contextify', | |
| 96 | - 'crypto', | ||
| 97 | 95 | 'fs', | |
| 98 | 96 | 'fs_event_wrap', | |
| 99 | - 'http_parser', | ||
| 100 | 97 | 'icu', | |
| 101 | 98 | 'inspector', | |
| 102 | 99 | 'js_stream', | |
| 103 | - 'natives', | ||
| 104 | 100 | 'os', | |
| 105 | 101 | 'pipe_wrap', | |
| 106 | 102 | 'process_wrap', | |
| 107 | - 'signal_wrap', | ||
| 108 | 103 | 'spawn_sync', | |
| 109 | 104 | 'stream_wrap', | |
| 110 | 105 | 'tcp_wrap', | |
| 111 | 106 | 'tls_wrap', | |
| 112 | 107 | 'tty_wrap', | |
| 113 | 108 | 'udp_wrap', | |
| 114 | - 'url', | ||
| 115 | - 'util', | ||
| 116 | 109 | 'uv', | |
| 117 | - 'v8', | ||
| 118 | 110 | 'zlib', | |
| 119 | 111 | ]); | |
| 120 | 112 | ||
@@ -148,19 +140,23 @@ const experimentalModuleList = new SafeSet(); | |||
| 148 | 140 | ||
| 149 | 141 | process.binding = function binding(module) { | |
| 150 | 142 | module = String(module); | |
| 143 | + const mod = bindingObj[module]; | ||
| 144 | + if (typeof mod === 'object') { | ||
| 145 | + return mod; | ||
| 146 | + } | ||
| 151 | 147 | // Deprecated specific process.binding() modules, but not all, allow | |
| 152 | 148 | // selective fallback to internalBinding for the deprecated ones. | |
| 149 | + if (runtimeDeprecatedList.has(module)) { | ||
| 150 | + process.emitWarning( | ||
| 151 | + `Access to process.binding('${module}') is deprecated.`, | ||
| 152 | + 'DeprecationWarning', | ||
| 153 | + 'DEP0111'); | ||
| 154 | + return internalBinding(module); | ||
| 155 | + } | ||
| 156 | + if (legacyWrapperList.has(module)) { | ||
| 157 | + return requireBuiltin('internal/legacy/processbinding')[module](); | ||
| 158 | + } | ||
| 153 | 159 | if (processBindingAllowList.has(module)) { | |
| 154 | - if (runtimeDeprecatedList.has(module)) { | ||
| 155 | - runtimeDeprecatedList.delete(module); | ||
| 156 | - process.emitWarning( | ||
| 157 | - `Access to process.binding('${module}') is deprecated.`, | ||
| 158 | - 'DeprecationWarning', | ||
| 159 | - 'DEP0111'); | ||
| 160 | - } | ||
| 161 | - if (legacyWrapperList.has(module)) { | ||
| 162 | - return requireBuiltin('internal/legacy/processbinding')[module](); | ||
| 163 | - } | ||
| 164 | 160 | return internalBinding(module); | |
| 165 | 161 | } | |
| 166 | 162 | // eslint-disable-next-line no-restricted-syntax | |
| Back | FazBrowse Home | New Git URL |
0 commit comments