MCPcopy
hub / github.com/webpack/webpack / getShortChunkName

Function getShortChunkName

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

Source from the content-addressed store, hash-verified

138 * @returns {string} short chunk name
139 */
140const getShortChunkName = (
141 chunk,
142 chunkGraph,
143 context,
144 delimiter,
145 hashFunction,
146 associatedObjectForCache
147) => {
148 const modules = chunkGraph.getChunkRootModules(chunk);
149 const shortModuleNames = modules.map((m) =>
150 requestToId(getShortModuleName(m, context, associatedObjectForCache))
151 );
152 chunk.idNameHints.sort();
153 const chunkName = [...chunk.idNameHints, ...shortModuleNames]
154 .filter(Boolean)
155 .join(delimiter);
156 return shortenLongString(chunkName, delimiter, hashFunction);
157};
158
159/**
160 * Gets long chunk name.

Callers 1

applyMethod · 0.85

Calls 5

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

Tested by

no test coverage detected