mirror of
https://github.com/nodejs/node.git
synced 2025-05-10 05:30:00 +00:00

PR-URL: https://github.com/nodejs/node/pull/38230 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
31 lines
804 B
JavaScript
31 lines
804 B
JavaScript
'use strict';
|
|
|
|
// User passed `-e` or `--eval` arguments to Node without `-i` or
|
|
// `--interactive`.
|
|
|
|
const {
|
|
globalThis,
|
|
} = primordials;
|
|
|
|
const {
|
|
prepareMainThreadExecution
|
|
} = require('internal/bootstrap/pre_execution');
|
|
const { evalModule, evalScript } = require('internal/process/execution');
|
|
const { addBuiltinLibsToObject } = require('internal/modules/cjs/helpers');
|
|
|
|
const { getOptionValue } = require('internal/options');
|
|
|
|
prepareMainThreadExecution();
|
|
addBuiltinLibsToObject(globalThis);
|
|
markBootstrapComplete();
|
|
|
|
const source = getOptionValue('--eval');
|
|
const print = getOptionValue('--print');
|
|
if (getOptionValue('--input-type') === 'module')
|
|
evalModule(source, print);
|
|
else
|
|
evalScript('[eval]',
|
|
source,
|
|
getOptionValue('--inspect-brk'),
|
|
print);
|