UNPKG

webpack

Version:

Packs ECMAScript/CommonJs/AMD modules for the browser. Allows you to split your codebase into multiple bundles, which can be loaded on demand. Supports loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.

27 lines (22 loc) 981 B
/* MIT License http://www.opensource.org/licenses/mit-license.php */ "use strict"; /** @import Module from "../Module" */ /** @import ModuleGraph from "../ModuleGraph" */ /** @import RuntimeTemplate from "../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;