File tree 4 files changed +74
-0
lines changed
4 files changed +74
-0
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,10 @@ const runtimeDeprecatedList = new SafeSet([
113
113
'v8' ,
114
114
] ) ;
115
115
116
+ const legacyWrapperList = new SafeSet ( [
117
+ 'util' ,
118
+ ] ) ;
119
+
116
120
// Set up process.binding() and process._linkedBinding().
117
121
{
118
122
const bindingObj = ObjectCreate ( null ) ;
@@ -129,6 +133,9 @@ const runtimeDeprecatedList = new SafeSet([
129
133
'DeprecationWarning' ,
130
134
'DEP0111' ) ;
131
135
}
136
+ if ( legacyWrapperList . has ( module ) ) {
137
+ return nativeModuleRequire ( 'internal/legacy/processbinding' ) [ module ] ( ) ;
138
+ }
132
139
return internalBinding ( module ) ;
133
140
}
134
141
// eslint-disable-next-line no-restricted-syntax
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ const {
3
+ ArrayPrototypeFilter,
4
+ ArrayPrototypeIncludes,
5
+ ObjectFromEntries,
6
+ ObjectEntries,
7
+ SafeArrayIterator,
8
+ } = primordials ;
9
+ const { types } = require ( 'util' ) ;
10
+
11
+ module . exports = {
12
+ util ( ) {
13
+ return ObjectFromEntries ( new SafeArrayIterator ( ArrayPrototypeFilter (
14
+ ObjectEntries ( types ) ,
15
+ ( { 0 : key } ) => {
16
+ return ArrayPrototypeIncludes ( [
17
+ 'isArrayBuffer' ,
18
+ 'isArrayBufferView' ,
19
+ 'isAsyncFunction' ,
20
+ 'isDataView' ,
21
+ 'isDate' ,
22
+ 'isExternal' ,
23
+ 'isMap' ,
24
+ 'isMapIterator' ,
25
+ 'isNativeError' ,
26
+ 'isPromise' ,
27
+ 'isRegExp' ,
28
+ 'isSet' ,
29
+ 'isSetIterator' ,
30
+ 'isTypedArray' ,
31
+ 'isUint8Array' ,
32
+ 'isAnyArrayBuffer' ,
33
+ ] , key ) ;
34
+ } ) ) ) ;
35
+ }
36
+ } ;
Original file line number Diff line number Diff line change 168
168
'lib/internal/idna.js' ,
169
169
'lib/internal/inspector_async_hook.js' ,
170
170
'lib/internal/js_stream_socket.js' ,
171
+ 'lib/internal/legacy/processbinding.js' ,
171
172
'lib/internal/linkedlist.js' ,
172
173
'lib/internal/main/check_syntax.js' ,
173
174
'lib/internal/main/eval_string.js' ,
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+ require ( '../common' ) ;
3
+ const assert = require ( 'assert' ) ;
4
+ const util = require ( 'util' ) ;
5
+
6
+ const utilBinding = process . binding ( 'util' ) ;
7
+ assert . deepStrictEqual (
8
+ Object . keys ( utilBinding ) . sort ( ) ,
9
+ [
10
+ 'isAnyArrayBuffer' ,
11
+ 'isArrayBuffer' ,
12
+ 'isArrayBufferView' ,
13
+ 'isAsyncFunction' ,
14
+ 'isDataView' ,
15
+ 'isDate' ,
16
+ 'isExternal' ,
17
+ 'isMap' ,
18
+ 'isMapIterator' ,
19
+ 'isNativeError' ,
20
+ 'isPromise' ,
21
+ 'isRegExp' ,
22
+ 'isSet' ,
23
+ 'isSetIterator' ,
24
+ 'isTypedArray' ,
25
+ 'isUint8Array' ,
26
+ ] ) ;
27
+
28
+ for ( const k of Object . keys ( utilBinding ) ) {
29
+ assert . strictEqual ( utilBinding [ k ] , util . types [ k ] ) ;
30
+ }
You can’t perform that action at this time.
0 commit comments