1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | exports.PluginModuleCache = void 0;
|
---|
4 | var PluginModuleCache = /** @class */ (function () {
|
---|
5 | function PluginModuleCache() {
|
---|
6 | this.totalCache = {};
|
---|
7 | this.chunkCache = {};
|
---|
8 | this.chunkSeenCache = {};
|
---|
9 | }
|
---|
10 | PluginModuleCache.prototype.registerModule = function (chunkName, module) {
|
---|
11 | this.totalCache[module.name] = module;
|
---|
12 | if (!this.chunkCache[chunkName]) {
|
---|
13 | this.chunkCache[chunkName] = {};
|
---|
14 | }
|
---|
15 | this.chunkCache[chunkName][module.name] = module;
|
---|
16 | };
|
---|
17 | PluginModuleCache.prototype.getModule = function (packageName) {
|
---|
18 | return this.totalCache[packageName] || null;
|
---|
19 | };
|
---|
20 | PluginModuleCache.prototype.markSeenForChunk = function (chunkName, packageName) {
|
---|
21 | if (!this.chunkSeenCache[chunkName]) {
|
---|
22 | this.chunkSeenCache[chunkName] = {};
|
---|
23 | }
|
---|
24 | this.chunkSeenCache[chunkName][packageName] = true;
|
---|
25 | };
|
---|
26 | PluginModuleCache.prototype.alreadySeenForChunk = function (chunkName, packageName) {
|
---|
27 | return !!(this.chunkSeenCache[chunkName] &&
|
---|
28 | this.chunkSeenCache[chunkName][packageName]);
|
---|
29 | };
|
---|
30 | PluginModuleCache.prototype.getAllModulesForChunk = function (chunkName) {
|
---|
31 | var modules = [];
|
---|
32 | var cache = this.chunkCache[chunkName];
|
---|
33 | if (cache) {
|
---|
34 | Object.keys(cache).forEach(function (key) {
|
---|
35 | modules.push(cache[key]);
|
---|
36 | });
|
---|
37 | }
|
---|
38 | return modules;
|
---|
39 | };
|
---|
40 | PluginModuleCache.prototype.getAllModules = function () {
|
---|
41 | var _this = this;
|
---|
42 | var modules = [];
|
---|
43 | Object.keys(this.totalCache).forEach(function (key) {
|
---|
44 | modules.push(_this.totalCache[key]);
|
---|
45 | });
|
---|
46 | return modules;
|
---|
47 | };
|
---|
48 | return PluginModuleCache;
|
---|
49 | }());
|
---|
50 | exports.PluginModuleCache = PluginModuleCache;
|
---|