From c601fdef12799fb4604010a4d3370cb5b343a8a9 Mon Sep 17 00:00:00 2001 From: Vladimir Ilic Date: Fri, 12 Oct 2018 11:09:51 -0700 Subject: [PATCH] lib: migrate from process.binding('config') to getOptions() PR-URL: https://github.com/nodejs/node/pull/23588 Reviewed-By: James M Snell Reviewed-By: Gireesh Punathil Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Trivikram Kamat --- lib/internal/bootstrap/node.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 4b798701583c42..c152f95a334a94 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -120,13 +120,18 @@ NativeModule.require('internal/inspector_async_hook').setup(); } - const options = internalBinding('options'); - if (options.getOptions('--help')) { + const { getOptions } = internalBinding('options'); + 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); return; } - if (options.getOptions('--completion-bash')) { + if (completionBashOption) { NativeModule.require('internal/bash_completion').print(process.stdout); return; } @@ -144,7 +149,7 @@ setupGlobalURL(); } - if (process.binding('config').experimentalWorker) { + if (experimentalWorkerOption) { setupDOMException(); } @@ -176,9 +181,8 @@ 'DeprecationWarning', 'DEP0062', startup, true); } - if (process.binding('config').experimentalModules || - process.binding('config').experimentalVMModules) { - if (process.binding('config').experimentalModules) { + if (experimentalModulesOption || experimentalVMModulesOption) { + if (experimentalModulesOption) { process.emitWarning( 'The ESM module loader is experimental.', 'ExperimentalWarning', undefined);