node: make builtin libs available for `--eval`
Make the builtin libraries available for the `--eval` and
`--print` CLI options, using the same mechanism that the
REPL uses.
This renders workarounds like `node -e 'require("fs").doStuff()'`
unnecessary.
As part of this, the list of builtin modules and the code for
adding the corresponding properties to the target context is moved
to `internal/module.js`, and the previously missing `repl` entry
is added.
PR-URL: https://github.com/nodejs/node/pull/6207
Reviewed-By:
James M Snell <jasnell@gmail.com>
Reviewed-By:
Colin Ihrig <cjihrig@gmail.com>
parent
83bc0a2a
Please register or sign in to comment