node/lib/internal/main/embedding.js
Joyee Cheung f29d2b7053
src: simplify embedder entry point execution
Previously we wrapped the embedder entry point callback into a
binding and then invoke the binding from JS land which was a bit
convoluted. Now we just call it directly from C++.
The main scripts that needed to tail call the embedder callback now
return the arguments in an array so that the C++ land can extract
the arguments and pass them to the callback. We also set
`PauseOnNextJavascriptStatement()` for --inspect-brk and mark
the bootstrap complete milestone directly in C++ for these
execution modes.

PR-URL: https://github.com/nodejs/node/pull/51557
Reviewed-By: Daniel Lemire <daniel@lemire.me>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
2024-02-23 01:50:27 +00:00

15 lines
505 B
JavaScript

'use strict';
const {
prepareMainThreadExecution,
} = require('internal/process/pre_execution');
const { isExperimentalSeaWarningNeeded } = internalBinding('sea');
const { emitExperimentalWarning } = require('internal/util');
const { embedderRequire, embedderRunCjs } = require('internal/util/embedding');
prepareMainThreadExecution(false, true);
if (isExperimentalSeaWarningNeeded()) {
emitExperimentalWarning('Single executable application');
}
return [process, embedderRequire, embedderRunCjs];