async-module
This module allows to use await
statements without being into an async function.
However, the execution of the await statements in the modules will be asynchronous.
Usage
// main.js'use strict';const Assert = ;;const mod = ; ;console; ;
// module.js'use strict';// this module contains an `await` statement outside of an async function. const res = await Promise;moduleexportsmessage = res;
WARNING
This module is a prank PoC. It is not to be used in production, nor by anyone really.
It aims at showing that it is not because a hack is possible in the node core that it should be used.
FYI, the source code of the module has only 12 LOC:
'use strict';const Module = ; const wrapper = '(async function (exports, require, module, __filename, __dirname) { ' '\n});'; Module { return wrapper0 + script + wrapper1;};
Please, never mess with the internals of Node.js like that unless you have a very good reason.