(roots)
| 63 | |
| 64 | /** Bytes evaluated when `roots` are loaded, following static edges only. */ |
| 65 | const closure = (roots) => { |
| 66 | const seen = new Set(); |
| 67 | const queue = [...roots]; |
| 68 | while (queue.length > 0) { |
| 69 | const file = queue.pop(); |
| 70 | if (seen.has(file) || !graph.has(file)) continue; |
| 71 | seen.add(file); |
| 72 | queue.push(...graph.get(file).static); |
| 73 | } |
| 74 | return seen; |
| 75 | }; |
| 76 | |
| 77 | const bytes = (files) => [...files].reduce((sum, f) => sum + (graph.get(f)?.size ?? 0), 0); |
| 78 | const mb = (n) => `${(n / 1024 / 1024).toFixed(2)} MB`; |
no test coverage detected