MCPcopy
hub / github.com/webpack/webpack / getSize

Method getSize

lib/json/JsonGenerator.js:152–160  ·  view source on GitHub ↗

* Returns the estimated size for the requested source type. * @param {NormalModule} module the module * @param {SourceType=} type source type * @returns {number} estimate size of the module

(module, type)

Source from the content-addressed store, hash-verified

150 * @returns {number} estimate size of the module
151 */
152 getSize(module, type) {
153 /** @type {JsonValue | undefined} */
154 const data =
155 module.buildInfo &&
156 module.buildInfo.jsonData &&
157 module.buildInfo.jsonData.get();
158 if (!data) return 0;
159 return /** @type {string} */ (stringifySafe(data)).length + 10;
160 }
161
162 /**
163 * Returns the reason this module cannot be concatenated, when one exists.

Callers

nothing calls this directly

Calls 2

stringifySafeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected