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

This patch: - Make NativeModuleLoader::LookupAndCompile() detect parameters based on module IDs. This allows us to compile more builtins when generating the embedded bootstrap, including - internal/per_context/* - internal/bootstrap/* - internal/main/* - Move pre_execution.js to lib/internal/process as it needs to be compiled as a regular built-in module, unlike other scripts in lib/internal/bootstrap - Move markBootstrapComplete() to the performance binding instead of making it a function-wrapper-based global to reduce number of special cases. PR-URL: https://github.com/nodejs/node/pull/44018 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
37 lines
894 B
JavaScript
37 lines
894 B
JavaScript
'use strict';
|
|
|
|
// Stdin is not a TTY, we will read it and execute it.
|
|
|
|
const {
|
|
prepareMainThreadExecution,
|
|
markBootstrapComplete
|
|
} = require('internal/process/pre_execution');
|
|
|
|
const { getOptionValue } = require('internal/options');
|
|
|
|
const {
|
|
evalModule,
|
|
evalScript,
|
|
readStdin
|
|
} = require('internal/process/execution');
|
|
|
|
prepareMainThreadExecution();
|
|
markBootstrapComplete();
|
|
|
|
readStdin((code) => {
|
|
// This is necessary for fork() and CJS module compilation.
|
|
// TODO(joyeecheung): pass this with something really internal.
|
|
process._eval = code;
|
|
|
|
const print = getOptionValue('--print');
|
|
const loadESM = getOptionValue('--import').length > 0;
|
|
if (getOptionValue('--input-type') === 'module')
|
|
evalModule(code, print);
|
|
else
|
|
evalScript('[stdin]',
|
|
code,
|
|
getOptionValue('--inspect-brk'),
|
|
print,
|
|
loadESM);
|
|
});
|