process: allow StartExecution() to take a main script ID#25474
process: allow StartExecution() to take a main script ID#25474joyeecheung wants to merge 1 commit intonodejs:masterfrom
Conversation
The idea is to allow the C++ layer to run arbitrary scripts as the main script. This paves the way for - cctest of the execution of Node.js instances - Earlier handling of per-process CLI options that affect execution modes (those usually do not make sense for the embedders). - Targets like mkcodecache or mksnapshot. Also moves the handling of `_third_party_main.js` into C++.
|
@joyeecheung sadly an error occured when I tried to trigger a build :( |
| Local<Value> main_script_v; | ||
| if (main_script_id == nullptr) { | ||
| // TODO(joyeecheung): make this mandatory - we may also create an overload | ||
| // for main_script that is a Local<Function>. |
There was a problem hiding this comment.
Just to make sure I understand this correctly, overload means an overload of StartExecution() that takes a Local<Function>? I like that idea. :)
There was a problem hiding this comment.
@addaleax Yeah, and maybe we could also use an overload with a C++ callback that takes some useful arguments (maybe Environment?)
| // directory which will be executed instead of Node's normal loading. | ||
| if (NativeModule.exists('_third_party_main')) { | ||
| function startMainThreadExecution(mainScript) { | ||
| if (mainScript) { |
There was a problem hiding this comment.
This bit here is temporary - I think it would be better to do the branching in C++ and directly compileAndCall the main scripts instead. For per-process CLI options like --help we could branch in node::Start() since they do not make a lot of sense for either embedders or the workers anyway. Although unfortunately for _third_party_main we have to keep a driver that wrap it into a process.nextTick() (or maybe there is a cleverer way out?)
The idea is to allow the C++ layer to run arbitrary scripts as the main script. This paves the way for - cctest of the execution of Node.js instances - Earlier handling of per-process CLI options that affect execution modes (those usually do not make sense for the embedders). - Targets like mkcodecache or mksnapshot. Also moves the handling of `_third_party_main.js` into C++. PR-URL: nodejs#25474 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
|
Landed in 2c7f4f4 |
The idea is to allow the C++ layer to run arbitrary scripts as the main script. This paves the way for - cctest of the execution of Node.js instances - Earlier handling of per-process CLI options that affect execution modes (those usually do not make sense for the embedders). - Targets like mkcodecache or mksnapshot. Also moves the handling of `_third_party_main.js` into C++. PR-URL: #25474 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
The idea is to allow the C++ layer to run arbitrary scripts as the main script. This paves the way for - cctest of the execution of Node.js instances - Earlier handling of per-process CLI options that affect execution modes (those usually do not make sense for the embedders). - Targets like mkcodecache or mksnapshot. Also moves the handling of `_third_party_main.js` into C++. PR-URL: nodejs#25474 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
The idea is to allow the C++ layer to run arbitrary scripts as the main script. This paves the way for - cctest of the execution of Node.js instances - Earlier handling of per-process CLI options that affect execution modes (those usually do not make sense for the embedders). - Targets like mkcodecache or mksnapshot. Also moves the handling of `_third_party_main.js` into C++. PR-URL: nodejs#25474 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
The idea is to allow the C++ layer to run arbitrary scripts
as the main script. This paves the way for
execution modes (those usually do not make sense for the
embedders).
Also moves the handling of
_third_party_main.jsinto C++.Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes