Buckets:
ktongue/docker_container / CAD_kevin /frontend /node_modules /webpack /lib /FlagEntryExportAsUsedPlugin.js
| /* | |
| MIT License http://www.opensource.org/licenses/mit-license.php | |
| Author Tobias Koppers @sokra | |
| */ | |
| ; | |
| const { getEntryRuntime } = require("./util/runtime"); | |
| /** @typedef {import("./Compiler")} Compiler */ | |
| const PLUGIN_NAME = "FlagEntryExportAsUsedPlugin"; | |
| class FlagEntryExportAsUsedPlugin { | |
| /** | |
| * @param {boolean} nsObjectUsed true, if the ns object is used | |
| * @param {string} explanation explanation for the reason | |
| */ | |
| constructor(nsObjectUsed, explanation) { | |
| this.nsObjectUsed = nsObjectUsed; | |
| this.explanation = explanation; | |
| } | |
| /** | |
| * Apply the plugin | |
| * @param {Compiler} compiler the compiler instance | |
| * @returns {void} | |
| */ | |
| apply(compiler) { | |
| compiler.hooks.thisCompilation.tap(PLUGIN_NAME, (compilation) => { | |
| const moduleGraph = compilation.moduleGraph; | |
| compilation.hooks.seal.tap(PLUGIN_NAME, () => { | |
| for (const [ | |
| entryName, | |
| { dependencies: deps, options } | |
| ] of compilation.entries) { | |
| const runtime = getEntryRuntime(compilation, entryName, options); | |
| for (const dep of deps) { | |
| const module = moduleGraph.getModule(dep); | |
| if (module) { | |
| const exportsInfo = moduleGraph.getExportsInfo(module); | |
| if (this.nsObjectUsed) { | |
| exportsInfo.setUsedInUnknownWay(runtime); | |
| } else { | |
| exportsInfo.setAllKnownExportsUsed(runtime); | |
| } | |
| moduleGraph.addExtraReason(module, this.explanation); | |
| } | |
| } | |
| } | |
| }); | |
| }); | |
| } | |
| } | |
| module.exports = FlagEntryExportAsUsedPlugin; | |
Xet Storage Details
- Size:
- 1.49 kB
- Xet hash:
- b3bee33d21d2b50b449b217370efc4ed42c9f2294d9f0c6ce27afcd5bfe33e08
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.