diff --git a/doc/api/vm.md b/doc/api/vm.md index dd36293859fe1e..81f8c9d1f76372 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -920,6 +920,36 @@ to disallow any changes to it. Corresponds to the `[[RequestedModules]]` field of [Cyclic Module Record][]s in the ECMAScript specification. +### `sourceTextModule.hasAsyncGraph()` + + + +* Returns: {boolean} + +Iterates over the dependency graph and returns `true` if any module in its +dependencies or this module itself contains top-level `await` expressions, +otherwise returns `false`. + +The search may be slow if the graph is big enough. + +This requires the module to be instantiated first. If the module is not +instantiated yet, an error will be thrown. + +### `sourceTextModule.hasTopLevelAwait()` + + + +* Returns: {boolean} + +Returns whether the module itself contains any top-level `await` expressions. + +This corresponds to the field `[[HasTLA]]` in [Cyclic Module Record][] in the +ECMAScript specification. + ### `sourceTextModule.instantiate()`