MCPcopy
hub / github.com/webpack/webpack / _getCacheGroup

Method _getCacheGroup

lib/optimize/SplitChunksPlugin.js:788–873  ·  view source on GitHub ↗

* Returns the cache group (cached). * @param {CacheGroupSource} cacheGroupSource source * @returns {CacheGroup} the cache group (cached)

(cacheGroupSource)

Source from the content-addressed store, hash-verified

786 * @returns {CacheGroup} the cache group (cached)
787 */
788 _getCacheGroup(cacheGroupSource) {
789 const cacheEntry = this._cacheGroupCache.get(cacheGroupSource);
790 if (cacheEntry !== undefined) return cacheEntry;
791 const minSize = mergeSizes(
792 cacheGroupSource.minSize,
793 cacheGroupSource.enforce ? undefined : this.options.minSize
794 );
795 const minSizeReduction = mergeSizes(
796 cacheGroupSource.minSizeReduction,
797 cacheGroupSource.enforce ? undefined : this.options.minSizeReduction
798 );
799 const minRemainingSize = mergeSizes(
800 cacheGroupSource.minRemainingSize,
801 cacheGroupSource.enforce ? undefined : this.options.minRemainingSize
802 );
803 const enforceSizeThreshold = mergeSizes(
804 cacheGroupSource.enforceSizeThreshold,
805 cacheGroupSource.enforce ? undefined : this.options.enforceSizeThreshold
806 );
807 /** @type {CacheGroup} */
808 const cacheGroup = {
809 key: cacheGroupSource.key,
810 priority: cacheGroupSource.priority || 0,
811 chunksFilter: cacheGroupSource.chunksFilter || this.options.chunksFilter,
812 minSize,
813 minSizeReduction,
814 minRemainingSize,
815 enforceSizeThreshold,
816 maxAsyncSize: mergeSizes(
817 cacheGroupSource.maxAsyncSize,
818 cacheGroupSource.enforce ? undefined : this.options.maxAsyncSize
819 ),
820 maxInitialSize: mergeSizes(
821 cacheGroupSource.maxInitialSize,
822 cacheGroupSource.enforce ? undefined : this.options.maxInitialSize
823 ),
824 minChunks:
825 cacheGroupSource.minChunks !== undefined
826 ? cacheGroupSource.minChunks
827 : cacheGroupSource.enforce
828 ? 1
829 : this.options.minChunks,
830 maxAsyncRequests:
831 cacheGroupSource.maxAsyncRequests !== undefined
832 ? cacheGroupSource.maxAsyncRequests
833 : cacheGroupSource.enforce
834 ? Infinity
835 : this.options.maxAsyncRequests,
836 maxInitialRequests:
837 cacheGroupSource.maxInitialRequests !== undefined
838 ? cacheGroupSource.maxInitialRequests
839 : cacheGroupSource.enforce
840 ? Infinity
841 : this.options.maxInitialRequests,
842 getName:
843 cacheGroupSource.getName !== undefined
844 ? cacheGroupSource.getName
845 : this.options.getName,

Callers 1

applyMethod · 0.95

Calls 4

mergeSizesFunction · 0.85
hasNonZeroSizesFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected