summaryrefslogtreecommitdiff
path: root/node.gyp
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-01-15 23:12:21 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-01-30 21:03:17 +0800
commit6967f91368cbb9cad3877ee59874cc83ccef4653 (patch)
tree2a7bae3359725c21df01aa31f266d6c79a2b7d35 /node.gyp
parentfeebdc5bc5a44779069a2269f4d3f15d4e36a277 (diff)
downloadandroid-node-v8-6967f91368cbb9cad3877ee59874cc83ccef4653.tar.gz
android-node-v8-6967f91368cbb9cad3877ee59874cc83ccef4653.tar.bz2
android-node-v8-6967f91368cbb9cad3877ee59874cc83ccef4653.zip
process: split execution into main scripts
This patch splits the execution mode selection from the environment setup in `lib/internal/bootstrap/node.js`, and split the entry point of different execution mode into main scripts under `lib/internal/main`: - `check_syntax.js`: used when `-c`/`--check` which only checks the syntax of the input instead of executing it. - `eval_stdin.js`: used when `-e` is passed without value and stdin is not a TTY (e.g. something is piped). - `eval_string`: used when `-e` is passed along with a string argument - `inspect.js`: for `node inspect`/`node debug` - `print_bash_completion.js`: for `--completion-bash` - `print_help.js`: for `--help` - `prof_process.js`: for `--prof-process` - `repl.js`: for the REPL - `run_main_module.js`: used when a main module is passed - `run_third_party_main.js`: for the legacy `_third_party_main.js` support - `worker_thread.js`: for workers This makes the entry points easier to navigate and paves the way for customized v8 snapshots (that do not need to deserialize execution mode setup) and better embedder APIs. As an example, after this patch, for the most common case where Node.js executes a user module as an entry point, it essentially goes through: - `lib/internal/per_context.js` to setup the v8 Context (which is also run when setting up contexts for the `vm` module) - `lib/internal/bootstrap/loaders.js` to set up internal binding and builtin module loaders (that are separate from the loaders accessible in the user land). - `lib/internal/bootstrap/node.js`: to set up the rest of the environment, including various globals and the process object - `lib/internal/main/run_main_module.js`: which is selected from C++ to prepare execution of the user module. This patch also removes `NativeModuleLoader::CompileAndCall` and exposes `NativeModuleLoader::LookupAndCompile` directly so that we can handle syntax errors and runtime errors of bootstrap scripts differently. PR-URL: https://github.com/nodejs/node/pull/25667 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'node.gyp')
-rw-r--r--node.gyp16
1 files changed, 13 insertions, 3 deletions
diff --git a/node.gyp b/node.gyp
index 0089b0a850..c7107f0295 100644
--- a/node.gyp
+++ b/node.gyp
@@ -29,6 +29,7 @@
'lib/internal/bootstrap/cache.js',
'lib/internal/bootstrap/loaders.js',
'lib/internal/bootstrap/node.js',
+ 'lib/internal/bootstrap/pre_execution.js',
'lib/async_hooks.js',
'lib/assert.js',
'lib/buffer.js',
@@ -85,7 +86,6 @@
'lib/zlib.js',
'lib/internal/assert.js',
'lib/internal/async_hooks.js',
- 'lib/internal/bash_completion.js',
'lib/internal/buffer.js',
'lib/internal/cli_table.js',
'lib/internal/child_process.js',
@@ -130,6 +130,17 @@
'lib/internal/inspector_async_hook.js',
'lib/internal/js_stream_socket.js',
'lib/internal/linkedlist.js',
+ 'lib/internal/main/check_syntax.js',
+ 'lib/internal/main/eval_string.js',
+ 'lib/internal/main/eval_stdin.js',
+ 'lib/internal/main/inspect.js',
+ 'lib/internal/main/print_bash_completion.js',
+ 'lib/internal/main/print_help.js',
+ 'lib/internal/main/prof_process.js',
+ 'lib/internal/main/repl.js',
+ 'lib/internal/main/run_main_module.js',
+ 'lib/internal/main/run_third_party_main.js',
+ 'lib/internal/main/worker_thread.js',
'lib/internal/modules/cjs/helpers.js',
'lib/internal/modules/cjs/loader.js',
'lib/internal/modules/esm/loader.js',
@@ -141,9 +152,8 @@
'lib/internal/safe_globals.js',
'lib/internal/net.js',
'lib/internal/options.js',
- 'lib/internal/policy/sri.js',
'lib/internal/policy/manifest.js',
- 'lib/internal/print_help.js',
+ 'lib/internal/policy/sri.js',
'lib/internal/priority_queue.js',
'lib/internal/process/esm_loader.js',
'lib/internal/process/execution.js',