Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102472093
InferAsyncModulesPlugin.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Feb 21, 01:48
Size
1 KB
Mime Type
text/x-c++
Expires
Sun, Feb 23, 01:48 (22 h, 33 m)
Engine
blob
Format
Raw Data
Handle
24326858
Attached To
rOACCT Open Access Compliance Check Tool (OACCT)
InferAsyncModulesPlugin.js
View Options
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const HarmonyImportDependency = require("../dependencies/HarmonyImportDependency");
/** @typedef {import("../Compiler")} Compiler */
/** @typedef {import("../Module")} Module */
class InferAsyncModulesPlugin {
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
* @returns {void}
*/
apply(compiler) {
compiler.hooks.compilation.tap("InferAsyncModulesPlugin", compilation => {
const { moduleGraph } = compilation;
compilation.hooks.finishModules.tap(
"InferAsyncModulesPlugin",
modules => {
/** @type {Set<Module>} */
const queue = new Set();
for (const module of modules) {
if (module.buildMeta && module.buildMeta.async) {
queue.add(module);
}
}
for (const module of queue) {
moduleGraph.setAsync(module);
const connections = moduleGraph.getIncomingConnections(module);
for (const connection of connections) {
const dep = connection.dependency;
if (
dep instanceof HarmonyImportDependency &&
connection.isTargetActive(undefined)
) {
queue.add(connection.originModule);
}
}
}
}
);
});
}
}
module.exports = InferAsyncModulesPlugin;
Event Timeline
Log In to Comment