MCPcopy
hub / github.com/webpack/webpack / getChunkGraphForModule

Method getChunkGraphForModule

lib/ChunkGraph.js:1980–2005  ·  lib/ChunkGraph.js::ChunkGraph.getChunkGraphForModule

* Gets chunk graph for module. * @deprecated * @param {Module} module the module * @param {string} deprecateMessage message for the deprecation message * @param {string} deprecationCode code for the deprecation * @returns {ChunkGraph} the chunk graph

(module, deprecateMessage, deprecationCode)

Source from the content-addressed store, hash-verified

1978 * @returns {ChunkGraph} the chunk graph
1979 */
1980 static getChunkGraphForModule(module, deprecateMessage, deprecationCode) {
1981 const fn = deprecateGetChunkGraphForModuleMap.get(deprecateMessage);
1982 if (fn) return fn(module);
1983 const newFn = util.deprecate(
1984 /**
1985 * Handles the callback logic for this hook.
1986 * @param {Module} module the module
1987 * @returns {ChunkGraph} the chunk graph
1988 */
1989 (module) => {
1990 const chunkGraph = chunkGraphForModuleMap.get(module);
1991 if (!chunkGraph) {
1992 throw new Error(
1993 `${
1994 deprecateMessage
1995 }: There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)`
1996 );
1997 }
1998 return chunkGraph;
1999 },
2000 `${deprecateMessage}: Use new ChunkGraph API`,
2001 deprecationCode
2002 );
2003 deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn);
2004 return newFn(module);
2005 }
2006
2007 class="cm">// TODO remove in webpack 6
2008 class="cm">// BACKWARD-COMPAT START

Callers 12

idMethod · 0.80
hashMethod · 0.80
renderedHashMethod · 0.80
addChunkMethod · 0.80
removeChunkMethod · 0.80
isInChunkMethod · 0.80
isEntryModuleMethod · 0.80
getChunksMethod · 0.80
getNumberOfChunksMethod · 0.80
chunksIterableMethod · 0.80
updateHashMethod · 0.80
sourceMethod · 0.80

Calls 4

newFnFunction · 0.85
fnFunction · 0.50
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected