MCPcopy
hub / github.com/webpack/webpack / size

Method size

lib/NormalModule.js:2199–2214  ·  view source on GitHub ↗

* Returns the estimated size for the requested source type. * @param {string=} type the source type for which the size should be estimated * @returns {number} the estimated size of the module (must be non-zero)

(type)

Source from the content-addressed store, hash-verified

2197 * @returns {number} the estimated size of the module (must be non-zero)
2198 */
2199 size(type) {
2200 const cachedSize =
2201 this._sourceSizes === undefined ? undefined : this._sourceSizes.get(type);
2202 if (cachedSize !== undefined) {
2203 return cachedSize;
2204 }
2205 const size = Math.max(
2206 1,
2207 /** @type {Generator} */ (this.generator).getSize(this, type)
2208 );
2209 if (this._sourceSizes === undefined) {
2210 this._sourceSizes = new Map();
2211 }
2212 this._sourceSizes.set(type, size);
2213 return size;
2214 }
2215
2216 /**
2217 * Adds the provided file dependencies to the module.

Callers 1

cleanupForCacheMethod · 0.95

Calls 3

getMethod · 0.45
getSizeMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected