feat(node): add Module.runMain() (#19080)

This PR adds the missing `Module.runMain()` function which is required
for tools like `ts-node`.

Fixes #19033
This commit is contained in:
Marvin Hagemeister 2023-05-11 00:13:45 +02:00 committed by GitHub
parent e72485fb17
commit 5fd74bfa1c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 0 deletions

View file

@ -1108,6 +1108,11 @@ Module.syncBuiltinESMExports = function syncBuiltinESMExports() {
throw new Error("not implemented");
};
// Mostly used by tools like ts-node.
Module.runMain = function () {
Module._load(process.argv[1], null, true);
};
Module.Module = Module;
nativeModuleExports.module = Module;