MCPcopy
hub / github.com/webpack/webpack / getChunkGraphForChunk

Method getChunkGraphForChunk

lib/ChunkGraph.js:2038–2063  ·  view source on GitHub ↗

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

(chunk, deprecateMessage, deprecationCode)

Source from the content-addressed store, hash-verified

2036 * @returns {ChunkGraph} the chunk graph
2037 */
2038 static getChunkGraphForChunk(chunk, deprecateMessage, deprecationCode) {
2039 const fn = deprecateGetChunkGraphForChunkMap.get(deprecateMessage);
2040 if (fn) return fn(chunk);
2041 const newFn = util.deprecate(
2042 /**
2043 * Handles the callback logic for this hook.
2044 * @param {Chunk} chunk the chunk
2045 * @returns {ChunkGraph} the chunk graph
2046 */
2047 (chunk) => {
2048 const chunkGraph = chunkGraphForChunkMap.get(chunk);
2049 if (!chunkGraph) {
2050 throw new Error(
2051 `${
2052 deprecateMessage
2053 }There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)`
2054 );
2055 }
2056 return chunkGraph;
2057 },
2058 `${deprecateMessage}: Use new ChunkGraph API`,
2059 deprecationCode
2060 );
2061 deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn);
2062 return newFn(chunk);
2063 }
2064
2065 /**
2066 * Sets chunk graph for chunk.

Callers 15

entryModuleMethod · 0.80
hasEntryModuleMethod · 0.80
addModuleMethod · 0.80
removeModuleMethod · 0.80
getNumberOfModulesMethod · 0.80
modulesIterableMethod · 0.80
compareToMethod · 0.80
containsModuleMethod · 0.80
getModulesMethod · 0.80
removeMethod · 0.80
moveModuleMethod · 0.80
integrateMethod · 0.80

Calls 4

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

Tested by

no test coverage detected