()
| 569 | // this is used to deprecate APIs implemented in C++ where the deprecation |
| 570 | // utilities are not easily accessible. |
| 571 | function initializeDeprecations() { |
| 572 | const pendingDeprecation = getOptionValue('--pending-deprecation'); |
| 573 | |
| 574 | // DEP0103: access to `process.binding('util').isX` type checkers |
| 575 | // TODO(addaleax): Turn into a full runtime deprecation. |
| 576 | const utilBinding = internalBinding('util'); |
| 577 | const types = require('internal/util/types'); |
| 578 | for (const name of [ |
| 579 | 'isArrayBuffer', |
| 580 | 'isArrayBufferView', |
| 581 | 'isAsyncFunction', |
| 582 | 'isDataView', |
| 583 | 'isDate', |
| 584 | 'isExternal', |
| 585 | 'isMap', |
| 586 | 'isMapIterator', |
| 587 | 'isNativeError', |
| 588 | 'isPromise', |
| 589 | 'isRegExp', |
| 590 | 'isSet', |
| 591 | 'isSetIterator', |
| 592 | 'isTypedArray', |
| 593 | 'isUint8Array', |
| 594 | 'isAnyArrayBuffer', |
| 595 | ]) { |
| 596 | utilBinding[name] = pendingDeprecation ? |
| 597 | deprecate(types[name], |
| 598 | 'Accessing native typechecking bindings of Node ' + |
| 599 | 'directly is deprecated. ' + |
| 600 | `Please use \`util.types.${name}\` instead.`, |
| 601 | 'DEP0103') : |
| 602 | types[name]; |
| 603 | } |
| 604 | |
| 605 | // TODO(joyeecheung): this is a legacy property exposed to process. |
| 606 | // Now that we use the config binding to carry this information, remove |
| 607 | // it from the process. We may consider exposing it properly in |
| 608 | // process.features. |
| 609 | const { noBrowserGlobals } = internalBinding('config'); |
| 610 | if (noBrowserGlobals) { |
| 611 | ObjectDefineProperty(process, '_noBrowserGlobals', { |
| 612 | __proto__: null, |
| 613 | writable: false, |
| 614 | enumerable: true, |
| 615 | configurable: true, |
| 616 | value: noBrowserGlobals, |
| 617 | }); |
| 618 | } |
| 619 | |
| 620 | if (pendingDeprecation) { |
| 621 | process.binding = deprecate(process.binding, |
| 622 | 'process.binding() is deprecated. ' + |
| 623 | 'Please use public APIs instead.', 'DEP0111'); |
| 624 | |
| 625 | process._tickCallback = deprecate(process._tickCallback, |
| 626 | 'process._tickCallback() is deprecated', |
| 627 | 'DEP0134'); |
| 628 | } |
no test coverage detected
searching dependent graphs…