Skip to content

Commit

Permalink
src: add --print-pending-tla flag
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Mar 6, 2024
1 parent a37bcd1 commit 02cd257
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,17 @@ changes:

Identical to `-e` but prints the result.

### `--print-pending-tla`

<!-- YAML
added: REPLACEME
-->

Print pending top-level await in the graph.

<!-- TODO(joyeecheung): do a PR separately for this flag because we can also
fix https://github.com/nodejs/node/issues/42868 with it -->

### `--prof`

<!-- YAML
Expand Down Expand Up @@ -2556,6 +2567,7 @@ Node.js options that are allowed are:
* `--policy-integrity`
* `--preserve-symlinks-main`
* `--preserve-symlinks`
* `--print-pending-tla`
* `--prof-process`
* `--redirect-warnings`
* `--report-compact`
Expand Down
7 changes: 7 additions & 0 deletions src/node_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,13 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
"ES module syntax, try again to evaluate them as ES modules",
&EnvironmentOptions::detect_module,
kAllowedInEnvvar);
AddOption("--print-pending-tla",
"Print pending top-level await. If --experimental-require-module "
"is true, evaluate asynchronous graphs loaded by `require()` but "
"do not run the microtasks, in order to to find and print "
"top-level await in the graph",
&EnvironmentOptions::print_pending_tla,
kAllowedInEnvvar);
AddOption("--diagnostic-dir",
"set dir for all output files"
" (default: current working directory)",
Expand Down
1 change: 1 addition & 0 deletions src/node_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ class EnvironmentOptions : public Options {
bool abort_on_uncaught_exception = false;
std::vector<std::string> conditions;
bool detect_module = false;
bool print_pending_tla = false;
std::string dns_result_order;
bool enable_source_maps = false;
bool experimental_fetch = true;
Expand Down

0 comments on commit 02cd257

Please sign in to comment.