From d342707fa75b09d4f702b845fc3e021ca4ae6074 Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Sun, 13 Jan 2019 01:03:49 +0800 Subject: [PATCH] src: remove unused `internalBinding('config')` properties Remove the following properties: - `preserveSymlinks` - `preserveSymlinksMain` - `experimentalModules` - `userLoader` - `experimentalVMModules` - `experimentalREPLAwait` - `exposeInternals` We used to use them to pass cli option values from C++ into JS, but now the values are obtained in JS land using `require('internal/options').getOptionValue` instead so they are unused. Also removes `test/parallel/test-internal-modules-expose.js` which tests `--expose-internals`. We already have hundreds of tests depending on `--expose-internals`, they are more than enough to test the functionality of the flag. PR-URL: https://github.com/nodejs/node/pull/25463 Reviewed-By: Anna Henningsen Reviewed-By: Refael Ackermann Backport-PR-URL: https://github.com/nodejs/node/pull/26027 --- src/node_config.cc | 22 ------------------- test/parallel/test-internal-modules-expose.js | 12 ---------- 2 files changed, 34 deletions(-) delete mode 100644 test/parallel/test-internal-modules-expose.js diff --git a/src/node_config.cc b/src/node_config.cc index 45233eea129e99..1f851ef91cdd45 100644 --- a/src/node_config.cc +++ b/src/node_config.cc @@ -73,28 +73,6 @@ static void Initialize(Local target, #endif // NODE_HAVE_I18N_SUPPORT - if (env->options()->preserve_symlinks) - READONLY_TRUE_PROPERTY(target, "preserveSymlinks"); - if (env->options()->preserve_symlinks_main) - READONLY_TRUE_PROPERTY(target, "preserveSymlinksMain"); - - if (env->options()->experimental_modules) { - READONLY_TRUE_PROPERTY(target, "experimentalModules"); - const std::string& userland_loader = env->options()->userland_loader; - if (!userland_loader.empty()) { - READONLY_STRING_PROPERTY(target, "userLoader", userland_loader); - } - } - - if (env->options()->experimental_vm_modules) - READONLY_TRUE_PROPERTY(target, "experimentalVMModules"); - - if (env->options()->experimental_repl_await) - READONLY_TRUE_PROPERTY(target, "experimentalREPLAwait"); - - if (env->options()->expose_internals) - READONLY_TRUE_PROPERTY(target, "exposeInternals"); - READONLY_PROPERTY(target, "bits", Number::New(env->isolate(), 8 * sizeof(intptr_t))); diff --git a/test/parallel/test-internal-modules-expose.js b/test/parallel/test-internal-modules-expose.js deleted file mode 100644 index 5229032573088e..00000000000000 --- a/test/parallel/test-internal-modules-expose.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; -// Flags: --expose_internals - -require('../common'); -const assert = require('assert'); -const { internalBinding } = require('internal/test/binding'); -const config = internalBinding('config'); - -console.log(config, process.argv); - -assert.strictEqual(typeof require('internal/freelist').FreeList, 'function'); -assert.strictEqual(config.exposeInternals, true);