mirror of
https://github.com/nodejs/node.git
synced 2025-05-03 02:06:12 +00:00

This patch removes special case in the internal binding loader for natives, and implements it using the builtins internal binding. Internally we do not actually need the natives binding, so implement it as a legacy wrapper instead. PR-URL: https://github.com/nodejs/node/pull/48186 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
'use strict';
|
|
const {
|
|
ArrayPrototypeFilter,
|
|
ArrayPrototypeIncludes,
|
|
ObjectFromEntries,
|
|
ObjectEntries,
|
|
SafeArrayIterator,
|
|
} = primordials;
|
|
const { types } = require('util');
|
|
|
|
module.exports = {
|
|
util() {
|
|
return ObjectFromEntries(new SafeArrayIterator(ArrayPrototypeFilter(
|
|
ObjectEntries(types),
|
|
({ 0: key }) => {
|
|
return ArrayPrototypeIncludes([
|
|
'isArrayBuffer',
|
|
'isArrayBufferView',
|
|
'isAsyncFunction',
|
|
'isDataView',
|
|
'isDate',
|
|
'isExternal',
|
|
'isMap',
|
|
'isMapIterator',
|
|
'isNativeError',
|
|
'isPromise',
|
|
'isRegExp',
|
|
'isSet',
|
|
'isSetIterator',
|
|
'isTypedArray',
|
|
'isUint8Array',
|
|
'isAnyArrayBuffer',
|
|
], key);
|
|
})));
|
|
},
|
|
natives() {
|
|
const { natives: result, configs } = internalBinding('builtins');
|
|
// Legacy feature: process.binding('natives').config contains stringified
|
|
// config.gypi. We do not use this object internally so it's fine to mutate
|
|
// it.
|
|
result.configs = configs;
|
|
return result;
|
|
},
|
|
};
|