/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
lib/async-modules/isGeneratorLowered.js
26 строк
999 B
Alexander Akait
fix: top-level using declarations in modules (#21557)
30 июл 2026, 16:27
Не верифицирован
30 июл 2026, 16:27
01d3fa1
Код
Авторство
О чём код?
/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; /** @typedef {import("../Module")} Module */ /** @typedef {import("../ModuleGraph")} ModuleGraph */ /** @typedef {import("../RuntimeTemplate")} RuntimeTemplate */ /** * Whether an async module is lowered to a generator: the target has no * `async`/`await` but supports generators, and the module contains no * top-level `for await…of` or `await using` (which generators can't express). * @param {Module} module module * @param {ModuleGraph} moduleGraph module graph * @param {RuntimeTemplate} runtimeTemplate runtime template * @returns {boolean} true when the module should be emitted as a generator */ const isGeneratorLowered = (module, moduleGraph, runtimeTemplate) => moduleGraph.isAsync(module) && !runtimeTemplate.supportsAsyncFunction() && Boolean(runtimeTemplate.supportsGenerator()) && !(module.buildInfo && module.buildInfo.usesTopLevelAwaitForOf); module.exports = isGeneratorLowered;