Make RestoreProvidedData a custom class for visibility in profiles

This commit is contained in:
Tobias Koppers 2019-11-14 18:02:38 +01:00
parent f67d5df8b3
commit e9f8e63593
2 changed files with 27 additions and 2 deletions

View File

@ -8,6 +8,7 @@
const util = require("util");
const ModuleGraphConnection = require("./ModuleGraphConnection");
const SortableSet = require("./util/SortableSet");
const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
/** @typedef {import("./Dependency")} Dependency */
@ -33,6 +34,29 @@ const UsageState = Object.freeze({
Used: /** @type {4} */ (4)
});
class RestoreProvidedData {
constructor(exports, otherProvided, otherCanMangleProvide) {
this.exports = exports;
this.otherProvided = otherProvided;
this.otherCanMangleProvide = otherCanMangleProvide;
}
serialize({ write }) {
write(this.exports);
write(this.otherProvided), write(this.otherCanMangleProvide);
}
static deserialize({ read }) {
return new RestoreProvidedData(read(), read(), read());
}
}
makeSerializable(
RestoreProvidedData,
"webpack/lib/ModuleGraph",
"RestoreProvidedData"
);
class ExportsInfo {
constructor() {
/** @type {Map<string, ExportInfo>} */
@ -469,11 +493,11 @@ class ExportsInfo {
});
}
}
return {
return new RestoreProvidedData(
exports,
otherProvided,
otherCanMangleProvide
};
);
}
restoreProvided({ otherProvided, otherCanMangleProvide, exports }) {

View File

@ -126,6 +126,7 @@ module.exports = {
Module: () => require("../Module"),
ModuleBuildError: () => require("../ModuleBuildError"),
ModuleError: () => require("../ModuleError"),
ModuleGraph: () => require("../ModuleGraph"),
ModuleParseError: () => require("../ModuleParseError"),
ModuleWarning: () => require("../ModuleWarning"),
NormalModule: () => require("../NormalModule"),