dependencies.set(target.module, new Set([module]));
} else {
set.add(module);
}
}
if (exportInfo.exportsInfoOwned) {
if (
exportInfo.exportsInfo.setRedirectNamedTo(
targetExportsInfo
)
) {
changed = true;
}
} else if (
exportInfo.exportsInfo !== targetExportsInfo
) {
exportInfo.exportsInfo = targetExportsInfo;
changed = true;
}
}
};
mergeExports(exportsInfo, exports);
}
// store dependencies
if (exportDeps) {
cacheable = false;
for (const exportDependency of exportDeps) {
// add dependency for this module
const set = dependencies.get(exportDependency);
if (set === undefined) {
dependencies.set(exportDependency, new Set([module]));
} else {
set.add(module);
}
}
}
};
const notifyDependencies = () => {
const deps = dependencies.get(module);
if (deps !== undefined) {
for (const dep of deps) {
queue.enqueue(dep);
}
}
};
logger.time("figure out provided exports");
while (queue.length > 0) {
module = queue.dequeue();
statQueueItemsProcessed++;
exportsInfo = moduleGraph.getExportsInfo(module);
if (!module.buildMeta || !module.buildMeta.exportsType) {
if (exportsInfo.otherExportsInfo.provided !== null) {
// It's a module without declared exports
exportsInfo.setUnknownExportsProvided();
modulesToStore.add(module);
notifyDependencies();
}
} else {
// It's a module with declared exports
cacheable = true;
changed = false;
processDependenciesBlock(module);
if (cacheable) {
modulesToStore.add(module);
}
if (changed) {
notifyDependencies();
}
}
}
logger.timeEnd("figure out provided exports");
logger.log(
`${Math.round(
100 -
(100 * statRestoredFromCache) /
(statRestoredFromCache +
statNotCached +
statFlaggedUncached)
)}% of exports of modules have been determined (${statNotCached} not cached, ${statFlaggedUncached} flagged uncacheable, ${statRestoredFromCache} from cache, ${
statQueueItemsProcessed -
statNotCached -
statFlaggedUncached
} additional calculations due to dependencies)`
);
logger.time("store provided exports into cache");
asyncLib.each(
modulesToStore,
(module, callback) => {
if (
module.buildInfo.cacheable !== true ||
typeof module.buildInfo.hash !== "string"
) {
// not cacheable
return callback();
}
cache.store(
module.identifier(),
module.buildInfo.hash,
moduleGraph
.getExportsInfo(module)
.getRestoreProvidedData(),
callback
);
},
err => {
logger.timeEnd("store provided exports into cache");