esm: sync-ify module translation · nodejs/node@b56d8af

@@ -537,7 +537,7 @@ class ModuleLoader {

537537

* matching translators.

538538

* @param {ModuleSource} source Source of the module to be translated.

539539

* @param {boolean} isMain Whether the module to be translated is the entry point.

540-

* @returns {ModuleWrap | Promise<ModuleWrap>}

540+

* @returns {ModuleWrap}

541541

*/

542542

#translate(url, format, source, isMain) {

543543

this.validateLoadResult(url, format);

@@ -547,7 +547,9 @@ class ModuleLoader {

547547

throw new ERR_UNKNOWN_MODULE_FORMAT(format, url);

548548

}

549549550-

return FunctionPrototypeCall(translator, this, url, source, isMain);

550+

const result = FunctionPrototypeCall(translator, this, url, source, isMain);

551+

assert(result instanceof ModuleWrap);

552+

return result;

551553

}

552554553555

/**