| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3e14212 commit 527407c
14 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,7 +34,7 @@ const { | |||
| 34 | 34 | ERR_CRYPTO_FIPS_FORCED, | |
| 35 | 35 | ERR_CRYPTO_FIPS_UNAVAILABLE | |
| 36 | 36 | } = require('internal/errors').codes; | |
| 37 | - const constants = process.binding('constants').crypto; | ||
| 37 | + const constants = internalBinding('constants').crypto; | ||
| 38 | 38 | const { | |
| 39 | 39 | fipsMode, | |
| 40 | 40 | fipsForced | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,8 +1,7 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - const { getOptions } = internalBinding('options'); | ||
| 2 | + const { options, aliases } = require('internal/options'); | ||
| 3 | 3 | ||
| 4 | 4 | function print(stream) { | |
| 5 | - const { options, aliases } = getOptions(); | ||
| 6 | 5 | const all_opts = [...options.keys(), ...aliases.keys()]; | |
| 7 | 6 | ||
| 8 | 7 | stream.write(`_node_complete() { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -217,8 +217,7 @@ | |||
| 217 | 217 | ||
| 218 | 218 | NativeModule.isInternal = function(id) { | |
| 219 | 219 | return id.startsWith('internal/') || | |
| 220 | - (id === 'worker_threads' && | ||
| 221 | - !internalBinding('options').getOptions('--experimental-worker')); | ||
| 220 | + (id === 'worker_threads' && !config.experimentalWorker); | ||
| 222 | 221 | }; | |
| 223 | 222 | } | |
| 224 | 223 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -113,12 +113,13 @@ | |||
| 113 | 113 | NativeModule.require('internal/inspector_async_hook').setup(); | |
| 114 | 114 | } | |
| 115 | 115 | ||
| 116 | - const { getOptions } = internalBinding('options'); | ||
| 117 | - const helpOption = getOptions('--help'); | ||
| 118 | - const completionBashOption = getOptions('--completion-bash'); | ||
| 119 | - const experimentalModulesOption = getOptions('--experimental-modules'); | ||
| 120 | - const experimentalVMModulesOption = getOptions('--experimental-vm-modules'); | ||
| 121 | - const experimentalWorkerOption = getOptions('--experimental-worker'); | ||
| 116 | + const { getOptionValue } = NativeModule.require('internal/options'); | ||
| 117 | + const helpOption = getOptionValue('--help'); | ||
| 118 | + const completionBashOption = getOptionValue('--completion-bash'); | ||
| 119 | + const experimentalModulesOption = getOptionValue('--experimental-modules'); | ||
| 120 | + const experimentalVMModulesOption = | ||
| 121 | + getOptionValue('--experimental-vm-modules'); | ||
| 122 | + const experimentalWorkerOption = getOptionValue('--experimental-worker'); | ||
| 122 | 123 | if (helpOption) { | |
| 123 | 124 | NativeModule.require('internal/print_help').print(process.stdout); | |
| 124 | 125 | return; | |
@@ -631,10 +632,9 @@ | |||
| 631 | 632 | ||
| 632 | 633 | const get = () => { | |
| 633 | 634 | const { | |
| 634 | - getOptions, | ||
| 635 | 635 | envSettings: { kAllowedInEnvironment } | |
| 636 | 636 | } = internalBinding('options'); | |
| 637 | - const { options, aliases } = getOptions(); | ||
| 637 | + const { options, aliases } = NativeModule.require('internal/options'); | ||
| 638 | 638 | ||
| 639 | 639 | const allowedNodeEnvironmentFlags = []; | |
| 640 | 640 | for (const [name, info] of options) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,7 +9,7 @@ const { | |||
| 9 | 9 | CHAR_HASH, | |
| 10 | 10 | } = require('internal/constants'); | |
| 11 | 11 | ||
| 12 | - const { getOptions } = internalBinding('options'); | ||
| 12 | + const { getOptionValue } = require('internal/options'); | ||
| 13 | 13 | ||
| 14 | 14 | // Invoke with makeRequireFunction(module) where |module| is the Module object | |
| 15 | 15 | // to use as the context for the require() function. | |
@@ -107,7 +107,7 @@ const builtinLibs = [ | |||
| 107 | 107 | 'v8', 'vm', 'zlib' | |
| 108 | 108 | ]; | |
| 109 | 109 | ||
| 110 | - if (getOptions('--experimental-worker')) { | ||
| 110 | + if (getOptionValue('--experimental-worker')) { | ||
| 111 | 111 | builtinLibs.push('worker_threads'); | |
| 112 | 112 | builtinLibs.sort(); | |
| 113 | 113 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,10 +40,10 @@ const { | |||
| 40 | 40 | stripBOM, | |
| 41 | 41 | stripShebang | |
| 42 | 42 | } = require('internal/modules/cjs/helpers'); | |
| 43 | - const options = internalBinding('options'); | ||
| 44 | - const preserveSymlinks = options.getOptions('--preserve-symlinks'); | ||
| 45 | - const preserveSymlinksMain = options.getOptions('--preserve-symlinks-main'); | ||
| 46 | - const experimentalModules = options.getOptions('--experimental-modules'); | ||
| 43 | + const { getOptionValue } = require('internal/options'); | ||
| 44 | + const preserveSymlinks = getOptionValue('--preserve-symlinks'); | ||
| 45 | + const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); | ||
| 46 | + const experimentalModules = getOptionValue('--experimental-modules'); | ||
| 47 | 47 | ||
| 48 | 48 | const { | |
| 49 | 49 | ERR_INVALID_ARG_TYPE, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,9 +6,9 @@ const internalFS = require('internal/fs/utils'); | |||
| 6 | 6 | const { NativeModule } = require('internal/bootstrap/loaders'); | |
| 7 | 7 | const { extname } = require('path'); | |
| 8 | 8 | const { realpathSync } = require('fs'); | |
| 9 | - const { getOptions } = internalBinding('options'); | ||
| 10 | - const preserveSymlinks = getOptions('--preserve-symlinks'); | ||
| 11 | - const preserveSymlinksMain = getOptions('--preserve-symlinks-main'); | ||
| 9 | + const { getOptionValue } = require('internal/options'); | ||
| 10 | + const preserveSymlinks = getOptionValue('--preserve-symlinks'); | ||
| 11 | + const preserveSymlinksMain = getOptionValue('--preserve-symlinks-main'); | ||
| 12 | 12 | const { | |
| 13 | 13 | ERR_MISSING_MODULE, | |
| 14 | 14 | ERR_MODULE_RESOLUTION_LEGACY, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const { getOptions } = internalBinding('options'); | ||
| 4 | + const { options, aliases } = getOptions(); | ||
| 5 | + | ||
| 6 | + function getOptionValue(option) { | ||
| 7 | + const result = options.get(option); | ||
| 8 | + if (!result) { | ||
| 9 | + return undefined; | ||
| 10 | + } | ||
| 11 | + return result.value; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + module.exports = { | ||
| 15 | + options, | ||
| 16 | + aliases, | ||
| 17 | + getOptionValue | ||
| 18 | + }; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,6 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | - const { getOptions, types } = internalBinding('options'); | ||
| 2 | + | ||
| 3 | + const { types } = internalBinding('options'); | ||
| 3 | 4 | ||
| 4 | 5 | const typeLookup = []; | |
| 5 | 6 | for (const key of Object.keys(types)) | |
@@ -132,7 +133,7 @@ function format({ options, aliases = new Map(), firstColumn, secondColumn }) { | |||
| 132 | 133 | } | |
| 133 | 134 | ||
| 134 | 135 | function print(stream) { | |
| 135 | - const { options, aliases } = getOptions(); | ||
| 136 | + const { options, aliases } = require('internal/options'); | ||
| 136 | 137 | ||
| 137 | 138 | // Use 75 % of the available width, and at least 70 characters. | |
| 138 | 139 | const width = Math.max(70, (stream.columns || 0) * 0.75); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,7 +48,7 @@ exports.setup = function() { | |||
| 48 | 48 | ||
| 49 | 49 | let ESMLoader = new Loader(); | |
| 50 | 50 | const loaderPromise = (async () => { | |
| 51 | - const userLoader = internalBinding('options').getOptions('--loader'); | ||
| 51 | + const userLoader = require('internal/options').getOptionValue('--loader'); | ||
| 52 | 52 | if (userLoader) { | |
| 53 | 53 | const hooks = await ESMLoader.import( | |
| 54 | 54 | userLoader, pathToFileURL(`${process.cwd()}/`).href); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments