MCPcopy
hub / github.com/webpack/webpack / captureSize

Function captureSize

tooling/print-cache-file.js:25–40  ·  view source on GitHub ↗
(data)

Source from the content-addressed store, hash-verified

23 * @returns {Promise<SizeInfo>} size info
24 */
25const captureSize = async (data) => {
26 let size = 0;
27 let lazySize = 0;
28 for (const b of data) {
29 if (Buffer.isBuffer(b)) {
30 size += b.length;
31 } else if (typeof b === "function") {
32 const i = lazySizes.length;
33 lazySizes.push(undefined);
34 const r = await captureSize(await b());
35 lazySize += r.size + r.lazySize;
36 lazySizes[i] = r;
37 }
38 }
39 return { size, lazySize };
40};
41
42const ESCAPE = null;
43const ESCAPE_ESCAPE_VALUE = null;

Callers 1

Calls 2

bFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected