lib: migrate from process.binding('config') to getOptions()

PR-URL: https://github.com/nodejs/node/pull/23588
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Vladimir Ilic 2018-10-12 11:09:51 -07:00 committed by Rich Trott
parent cdba3c1de0
commit bb79e768e5

View File

@ -112,13 +112,18 @@
NativeModule.require('internal/inspector_async_hook').setup(); NativeModule.require('internal/inspector_async_hook').setup();
} }
const options = internalBinding('options'); const { getOptions } = internalBinding('options');
if (options.getOptions('--help')) { const helpOption = getOptions('--help');
const completionBashOption = getOptions('--completion-bash');
const experimentalModulesOption = getOptions('--experimental-modules');
const experimentalVMModulesOption = getOptions('--experimental-vm-modules');
const experimentalWorkerOption = getOptions('--experimental-worker');
if (helpOption) {
NativeModule.require('internal/print_help').print(process.stdout); NativeModule.require('internal/print_help').print(process.stdout);
return; return;
} }
if (options.getOptions('--completion-bash')) { if (completionBashOption) {
NativeModule.require('internal/bash_completion').print(process.stdout); NativeModule.require('internal/bash_completion').print(process.stdout);
return; return;
} }
@ -138,7 +143,7 @@
setupQueueMicrotask(); setupQueueMicrotask();
} }
if (process.binding('config').experimentalWorker) { if (experimentalWorkerOption) {
setupDOMException(); setupDOMException();
} }
@ -170,9 +175,8 @@
'DeprecationWarning', 'DEP0062', startup, true); 'DeprecationWarning', 'DEP0062', startup, true);
} }
if (process.binding('config').experimentalModules || if (experimentalModulesOption || experimentalVMModulesOption) {
process.binding('config').experimentalVMModules) { if (experimentalModulesOption) {
if (process.binding('config').experimentalModules) {
process.emitWarning( process.emitWarning(
'The ESM module loader is experimental.', 'The ESM module loader is experimental.',
'ExperimentalWarning', undefined); 'ExperimentalWarning', undefined);