MCPcopy
hub / github.com/webpack/webpack / getLongChunkName

Function getLongChunkName

lib/ids/IdHelpers.js:169–195  ·  view source on GitHub ↗
(
	chunk,
	chunkGraph,
	context,
	delimiter,
	hashFunction,
	associatedObjectForCache
)

Source from the content-addressed store, hash-verified

167 * @returns {string} short chunk name
168 */
169const getLongChunkName = (
170 chunk,
171 chunkGraph,
172 context,
173 delimiter,
174 hashFunction,
175 associatedObjectForCache
176) => {
177 const modules = chunkGraph.getChunkRootModules(chunk);
178 const shortModuleNames = modules.map((m) =>
179 requestToId(getShortModuleName(m, context, associatedObjectForCache))
180 );
181 const longModuleNames = modules.map((m) =>
182 requestToId(
183 getLongModuleName("", m, context, hashFunction, associatedObjectForCache)
184 )
185 );
186 chunk.idNameHints.sort();
187 const chunkName = [
188 ...chunk.idNameHints,
189 ...shortModuleNames,
190 ...longModuleNames
191 ]
192 .filter(Boolean)
193 .join(delimiter);
194 return shortenLongString(chunkName, delimiter, hashFunction);
195};
196
197/**
198 * Gets full chunk name.

Callers 1

applyMethod · 0.85

Calls 6

requestToIdFunction · 0.85
getShortModuleNameFunction · 0.85
getLongModuleNameFunction · 0.85
shortenLongStringFunction · 0.85
getChunkRootModulesMethod · 0.80
sortMethod · 0.80

Tested by

no test coverage detected