Repository navigation
lib: expose getOptionValue via process - #46404
sapphi-red wants to merge 1 commit into
Conversation
Add `process.getOptionValue` that exposes `getOptionValue` in `internal/options`. Fixes: nodejs#36935
| addReadOnlyProcessAlias('_breakFirstLine', '--inspect-brk', false); | ||
| addReadOnlyProcessAlias('_breakNodeFirstLine', '--inspect-brk-node', false); | ||
|
|
||
| process.getOptionValue = getOptionValue; |
There was a problem hiding this comment.
| process.getOptionValue = getOptionValue; | |
| process.getOptionValue = function getOptionValue(option) { | |
| require('internal/validators').validateString(option, 'option'); | |
| return getOptionValue(option); | |
| }; |
| added: REPLACEME | ||
| --> | ||
|
|
||
| > Stability: 1 - Experimental |
There was a problem hiding this comment.
Given the experimental nature of many of the individual options, wouldn't this be Experimental forever? Ergo, cannot be relied upon.
tniessen
left a comment
There was a problem hiding this comment.
As I said in #36935 (comment), this is risky. semver-minor changes to node options might break applications that use this function.
| import process from 'node:process'; | ||
|
|
||
| console.log('--pending-deprecation:', process.getOptionValue('--pending-deprecation')); | ||
| console.log('--conditions:', process.getOptionValue('--conditions')); |
There was a problem hiding this comment.
Consider this non-blocking but an alternative approach to implementing this would be to use constants on a process.options object. For instance,
process.options.pendingDeprecation
process.options.conditions
// ... or even
process.options['pending-deprecation']
process.options['conditions']I think this would help with @panva's concern in relation to experimental status since individual constants can be marked experimental while the process.options is not; as well as just being a bit easier.
|
This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open. |
|
Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions. |
Add
process.getOptionValuethat exposesgetOptionValueininternal/options.Fixes: #36935