Description
Is your feature request related to a problem? Please describe.
Use case: I'm trying to implement "exports"
support inside the PnP resolver which patches the Node resolution algorithm and I want it to be as Node-compliant as possible. For that, I need to implement the resolving user conditions part via the --conditions
flag. The problem is that Node gives me no easy way to access the resolved value of a flag (as far as I'm aware).
Problem:
Node option values can come from 2 different places (as far as I'm aware): the arguments passed to the node binary and NODE_OPTIONS
.
Node currently has an internal function called getOptionValue
that returns the value of an option, resolving both the arguments passed to the node binary and NODE_OPTIONS
.
getOptionValue
is only exported in internal/options
, so it can't be accessed.
Also, getOptionValue
uses a native implementation via getOptions
from the options
internal binding which isn't whitelisted, so modules can't access it via process.binding
to reimplement getOptionValue
.
Describe the solution you'd like
I'd like a way to be able use getOptionValue
, and the most straightforward way I could think of is exposing it on process
via process.getOptionValue
.
Describe alternatives you've considered
Manually parse both process.execArgv
and process.env.NODE_OPTIONS
.