* Load a module and translate it into a ModuleWrap for ordinary imported ESM. * This may be run asynchronously if there are asynchronous module loader hooks registered. * @param {ResolveResult} resolveResult Result from the resolve step. * @param {object} loadContext See load * @
(resolveResult, loadContext, parentURL)
| 493 | * @returns {Promise<ModuleWrap>|ModuleWrap} |
| 494 | */ |
| 495 | loadAndTranslate(resolveResult, loadContext, parentURL) { |
| 496 | const { url } = resolveResult; |
| 497 | const maybePromise = this.load(url, loadContext); |
| 498 | const afterLoad = (loadResult) => { |
| 499 | const translateContext = { |
| 500 | ...resolveResult, |
| 501 | ...loadResult, |
| 502 | translatorKey: loadResult.format, |
| 503 | __proto__: null, |
| 504 | }; |
| 505 | return this.#translate(url, translateContext, parentURL); |
| 506 | }; |
| 507 | if (isPromise(maybePromise)) { |
| 508 | return PromisePrototypeThen(maybePromise, afterLoad); |
| 509 | } |
| 510 | return afterLoad(maybePromise); |
| 511 | } |
| 512 | |
| 513 | /** |
| 514 | * Given a resolved module request, obtain a ModuleJobBase from it - if it's already cached, |
no test coverage detected