* @returns {boolean} true, when the module exports are used in any way
*/
isUsed(runtime) {
if (this._redirectTo !== undefined) {
if (this._redirectTo.isUsed(runtime)) {
return true;
}
} else {
if (this._otherExportsInfo.getUsed(runtime) !== UsageState.Unused) {
return true;
}
}
for (const exportInfo of this._exports.values()) {
if (exportInfo.getUsed(runtime) !== UsageState.Unused) {
return true;
}
}
return false;
}
/**
* @param {RuntimeSpec} runtime the runtime
* @returns {boolean} true, when the module is used in any way
*/
isModuleUsed(runtime) {
if (this.isUsed(runtime)) return true;
if (this._sideEffectsOnlyInfo.getUsed(runtime) !== UsageState.Unused)
return true;
return false;
}
/**
* @param {RuntimeSpec} runtime the runtime
* @returns {SortableSet<string> | boolean | null} set of used exports, or true (when namespace object is used), or false (when unused), or null (when unknown)
* @param {ModuleGraph} moduleGraph the module graph
* @param {function(Module): boolean} validTargetModuleFilter a valid target module
* @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid
return this._findTarget(moduleGraph, validTargetModuleFilter, new Set());
}
/**
* @param {ModuleGraph} moduleGraph the module graph
* @param {function(Module): boolean} validTargetModuleFilter a valid target module
* @param {Set<ExportInfo> | undefined} alreadyVisited set of already visited export info to avoid circular references
* @returns {{ module: Module, export: string[] | undefined } | undefined | false} the target, undefined when there is no target, false when no target is valid