1 | "use strict";
|
---|
2 | var __values = (this && this.__values) || function(o) {
|
---|
3 | var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
---|
4 | if (m) return m.call(o);
|
---|
5 | if (o && typeof o.length === "number") return {
|
---|
6 | next: function () {
|
---|
7 | if (o && i >= o.length) o = void 0;
|
---|
8 | return { value: o && o[i++], done: !o };
|
---|
9 | }
|
---|
10 | };
|
---|
11 | throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
---|
12 | };
|
---|
13 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
14 | exports.WebpackStatsIterator = void 0;
|
---|
15 | var WebpackStatsIterator = /** @class */ (function () {
|
---|
16 | function WebpackStatsIterator() {
|
---|
17 | }
|
---|
18 | WebpackStatsIterator.prototype.collectModules = function (stats, chunkName) {
|
---|
19 | var e_1, _a;
|
---|
20 | var chunkModules = [];
|
---|
21 | try {
|
---|
22 | for (var _b = __values(stats.chunks), _c = _b.next(); !_c.done; _c = _b.next()) {
|
---|
23 | var chunk = _c.value;
|
---|
24 | if (chunk.names[0] === chunkName) {
|
---|
25 | this.traverseModules(chunk.modules, chunkModules);
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
29 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
30 | finally {
|
---|
31 | try {
|
---|
32 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
---|
33 | }
|
---|
34 | finally { if (e_1) throw e_1.error; }
|
---|
35 | }
|
---|
36 | return chunkModules;
|
---|
37 | };
|
---|
38 | WebpackStatsIterator.prototype.traverseModules = function (modules, chunkModules) {
|
---|
39 | var e_2, _a;
|
---|
40 | if (!modules) {
|
---|
41 | return;
|
---|
42 | }
|
---|
43 | try {
|
---|
44 | for (var modules_1 = __values(modules), modules_1_1 = modules_1.next(); !modules_1_1.done; modules_1_1 = modules_1.next()) {
|
---|
45 | var webpackModule = modules_1_1.value;
|
---|
46 | chunkModules.push({ resource: webpackModule.identifier });
|
---|
47 | this.traverseModules(webpackModule.modules, chunkModules);
|
---|
48 | }
|
---|
49 | }
|
---|
50 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
---|
51 | finally {
|
---|
52 | try {
|
---|
53 | if (modules_1_1 && !modules_1_1.done && (_a = modules_1.return)) _a.call(modules_1);
|
---|
54 | }
|
---|
55 | finally { if (e_2) throw e_2.error; }
|
---|
56 | }
|
---|
57 | };
|
---|
58 | return WebpackStatsIterator;
|
---|
59 | }());
|
---|
60 | exports.WebpackStatsIterator = WebpackStatsIterator;
|
---|