MCPcopy
hub / github.com/webpack/webpack / _getAllLevelHooks

Method _getAllLevelHooks

lib/stats/StatsFactory.js:152–167  ·  view source on GitHub ↗

* Get all level hooks. * @template {StatsFactoryHooks[keyof StatsFactoryHooks]} HM * @template {HM extends HookMap<infer H> ? H : never} H * @param {HM} hookMap hook map * @param {Caches<H>} cache cache * @param {string} type type * @returns {H[]} hooks * @private

(hookMap, cache, type)

Source from the content-addressed store, hash-verified

150 * @private
151 */
152 _getAllLevelHooks(hookMap, cache, type) {
153 const cacheEntry = cache.get(type);
154 if (cacheEntry !== undefined) {
155 return cacheEntry;
156 }
157 const hooks = /** @type {H[]} */ ([]);
158 const typeParts = type.split(".");
159 for (let i = 0; i < typeParts.length; i++) {
160 const hook = /** @type {H} */ (hookMap.get(typeParts.slice(i).join(".")));
161 if (hook) {
162 hooks.push(hook);
163 }
164 }
165 cache.set(type, hooks);
166 return hooks;
167 }
168
169 /**
170 * Returns hook.

Callers 3

_forEachLevelMethod · 0.95
_forEachLevelFilterMethod · 0.95

Calls 5

splitMethod · 0.80
sliceMethod · 0.80
getMethod · 0.45
pushMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected