|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.3 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
|---|
| 3 | Author Haijie Xie @hai-x
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | "use strict";
|
|---|
| 7 |
|
|---|
| 8 | const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
|
|---|
| 9 |
|
|---|
| 10 | /** @typedef {import("../ModuleGraph")} ModuleGraph */
|
|---|
| 11 | /** @typedef {import("../Module")} Module */
|
|---|
| 12 |
|
|---|
| 13 | /** @typedef {Set<Module>} Modules */
|
|---|
| 14 |
|
|---|
| 15 | /**
|
|---|
| 16 | * Gets outgoing async modules.
|
|---|
| 17 | * @param {ModuleGraph} moduleGraph module graph
|
|---|
| 18 | * @param {Module} module module
|
|---|
| 19 | * @returns {Modules} set of modules
|
|---|
| 20 | */
|
|---|
| 21 | const getOutgoingAsyncModules = (moduleGraph, module) => {
|
|---|
| 22 | /** @type {Modules} */
|
|---|
| 23 | const set = new Set();
|
|---|
| 24 | /** @type {Modules} */
|
|---|
| 25 | const seen = new Set();
|
|---|
| 26 | (function g(module) {
|
|---|
| 27 | if (!moduleGraph.isAsync(module) || seen.has(module)) return;
|
|---|
| 28 | seen.add(module);
|
|---|
| 29 | if (module.buildMeta && module.buildMeta.async) {
|
|---|
| 30 | set.add(module);
|
|---|
| 31 | } else {
|
|---|
| 32 | const outgoingConnectionMap =
|
|---|
| 33 | moduleGraph.getOutgoingConnectionsByModule(module);
|
|---|
| 34 | if (outgoingConnectionMap) {
|
|---|
| 35 | for (const [module, connections] of outgoingConnectionMap) {
|
|---|
| 36 | if (
|
|---|
| 37 | connections.some(
|
|---|
| 38 | (c) =>
|
|---|
| 39 | c.dependency instanceof HarmonyImportDependency &&
|
|---|
| 40 | c.isTargetActive(undefined)
|
|---|
| 41 | ) &&
|
|---|
| 42 | module
|
|---|
| 43 | ) {
|
|---|
| 44 | g(module);
|
|---|
| 45 | }
|
|---|
| 46 | }
|
|---|
| 47 | }
|
|---|
| 48 | }
|
|---|
| 49 | })(module);
|
|---|
| 50 | return set;
|
|---|
| 51 | };
|
|---|
| 52 |
|
|---|
| 53 | module.exports.getOutgoingAsyncModules = getOutgoingAsyncModules;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.