(ids)
| 510 | * @return {number[][]} |
| 511 | */ |
| 512 | export function getSizes(ids) { |
| 513 | const scripts = getScriptsByIdsOrAll(ids); |
| 514 | return scripts.map(({ |
| 515 | meta, |
| 516 | custom: { pathMap = {} }, |
| 517 | props: { id }, |
| 518 | }, i) => [ |
| 519 | // Same order as SIZE_TITLES and sizesPrefixRe |
| 520 | scriptSizes[S_CODE_PRE + id] || 0, |
| 521 | deepSize(scripts[i]), |
| 522 | scriptSizes[S_VALUE_PRE + id] || 0, |
| 523 | meta.require.reduce(getSizeForRequires, { len: 0, pathMap }).len, |
| 524 | Object.values(meta.resources).reduce(getSizeForResources, { len: 0, pathMap }).len, |
| 525 | ]); |
| 526 | } |
| 527 | |
| 528 | function getSizeForRequires(accum, url) { |
| 529 | accum.len += (scriptSizes[S_REQUIRE_PRE + (accum.pathMap[url] || url)] || 0) + url.length; |
no test coverage detected