UNPKG

bonsai-analyzer

Version:
24 lines (19 loc) 679 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getChunkModules; var _getModulesByChunk = _interopRequireDefault(require("./getModulesByChunk")); function getChunkModules(stats, parentChunks) { if (!parentChunks) { return null; } const modulesByChunk = (0, _getModulesByChunk.default)(stats, parentChunks.map(chunk => chunk.id)); return parentChunks.reduce((modules, chunk) => { const chunkWithModules = modulesByChunk[chunk.id] || { modules: [] }; return modules.concat(chunkWithModules.modules); }, []); }