Skip to content

Commit ff4fb7e

Browse files
committed
src: add --print-pending-tla flag
1 parent 8980483 commit ff4fb7e

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

doc/api/cli.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,6 +1578,17 @@ changes:
15781578

15791579
Identical to `-e` but prints the result.
15801580

1581+
### `--print-pending-tla`
1582+
1583+
<!-- YAML
1584+
added: REPLACEME
1585+
-->
1586+
1587+
Print pending top-level await in the graph.
1588+
1589+
<!-- TODO(joyeecheung): do a PR separately for this flag because we can also
1590+
fix https://github.com/nodejs/node/issues/42868 with it -->
1591+
15811592
### `--prof`
15821593

15831594
<!-- YAML
@@ -2556,6 +2567,7 @@ Node.js options that are allowed are:
25562567
* `--policy-integrity`
25572568
* `--preserve-symlinks-main`
25582569
* `--preserve-symlinks`
2570+
* `--print-pending-tla`
25592571
* `--prof-process`
25602572
* `--redirect-warnings`
25612573
* `--report-compact`

src/node_options.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,13 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() {
352352
"ES module syntax, try again to evaluate them as ES modules",
353353
&EnvironmentOptions::detect_module,
354354
kAllowedInEnvvar);
355+
AddOption("--print-pending-tla",
356+
"Print pending top-level await. If --experimental-require-module "
357+
"is true, evaluate asynchronous graphs loaded by `require()` but "
358+
"do not run the microtasks, in order to to find and print "
359+
"top-level await in the graph",
360+
&EnvironmentOptions::print_pending_tla,
361+
kAllowedInEnvvar);
355362
AddOption("--diagnostic-dir",
356363
"set dir for all output files"
357364
" (default: current working directory)",

src/node_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class EnvironmentOptions : public Options {
105105
bool abort_on_uncaught_exception = false;
106106
std::vector<std::string> conditions;
107107
bool detect_module = false;
108+
bool print_pending_tla = false;
108109
std::string dns_result_order;
109110
bool enable_source_maps = false;
110111
bool experimental_fetch = true;

0 commit comments

Comments
 (0)