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

New flag is for string input only PR-URL: https://github.com/nodejs/node/pull/27184 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Myles Borins <myles.borins@gmail.com>
21 lines
656 B
JavaScript
21 lines
656 B
JavaScript
'use strict';
|
|
|
|
// User passed `-e` or `--eval` arguments to Node without `-i` or
|
|
// `--interactive`.
|
|
|
|
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');
|
|
const source = getOptionValue('--eval');
|
|
prepareMainThreadExecution();
|
|
addBuiltinLibsToObject(global);
|
|
markBootstrapComplete();
|
|
if (getOptionValue('--input-type') === 'module')
|
|
evalModule(source);
|
|
else
|
|
evalScript('[eval]', source, process._breakFirstLine);
|