* 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)
| 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. |
no test coverage detected